aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorFilippos Karapetis2015-11-23 00:41:07 +0200
committerFilippos Karapetis2015-11-23 00:41:07 +0200
commitd9e2943fe6962810ffccc6ae136d7092ac0bd4bf (patch)
tree527c856b2adf129b8bde442823ffe6bcf81f4684 /engines/mads
parent0c7bde123b93f30939b3560e3117e1b13d27502e (diff)
parentf0d17d2c061dd2d4648e501d8f0caf8fd3ad7f73 (diff)
downloadscummvm-rg350-d9e2943fe6962810ffccc6ae136d7092ac0bd4bf.tar.gz
scummvm-rg350-d9e2943fe6962810ffccc6ae136d7092ac0bd4bf.tar.bz2
scummvm-rg350-d9e2943fe6962810ffccc6ae136d7092ac0bd4bf.zip
Merge pull request #626 from dreammaster/phantom
MADS: Return of the Phantom WIP
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/animation.cpp44
-rw-r--r--engines/mads/animation.h17
-rw-r--r--engines/mads/assets.h5
-rw-r--r--engines/mads/conversations.cpp348
-rw-r--r--engines/mads/conversations.h66
-rw-r--r--engines/mads/debugger.cpp14
-rw-r--r--engines/mads/debugger.h1
-rw-r--r--engines/mads/dialogs.h5
-rw-r--r--engines/mads/dragonsphere/dragonsphere_scenes.cpp19
-rw-r--r--engines/mads/dragonsphere/dragonsphere_scenes.h85
-rw-r--r--engines/mads/dragonsphere/dragonsphere_scenes1.cpp3714
-rw-r--r--engines/mads/dragonsphere/dragonsphere_scenes1.h188
-rw-r--r--engines/mads/dragonsphere/game_dragonsphere.cpp2
-rw-r--r--engines/mads/dragonsphere/game_dragonsphere.h13
-rw-r--r--engines/mads/dragonsphere/globals_dragonsphere.cpp51
-rw-r--r--engines/mads/dragonsphere/globals_dragonsphere.h184
-rw-r--r--engines/mads/game.cpp230
-rw-r--r--engines/mads/game.h32
-rw-r--r--engines/mads/hotspots.cpp21
-rw-r--r--engines/mads/hotspots.h20
-rw-r--r--engines/mads/mads.cpp11
-rw-r--r--engines/mads/mads.h3
-rw-r--r--engines/mads/menu_views.cpp77
-rw-r--r--engines/mads/menu_views.h17
-rw-r--r--engines/mads/messages.cpp14
-rw-r--r--engines/mads/messages.h3
-rw-r--r--engines/mads/module.mk7
-rw-r--r--engines/mads/nebular/game_nebular.cpp20
-rw-r--r--engines/mads/nebular/nebular_scenes1.cpp30
-rw-r--r--engines/mads/nebular/nebular_scenes2.cpp88
-rw-r--r--engines/mads/nebular/nebular_scenes3.cpp80
-rw-r--r--engines/mads/nebular/nebular_scenes4.cpp72
-rw-r--r--engines/mads/nebular/nebular_scenes5.cpp52
-rw-r--r--engines/mads/nebular/nebular_scenes6.cpp126
-rw-r--r--engines/mads/nebular/nebular_scenes7.cpp94
-rw-r--r--engines/mads/nebular/nebular_scenes8.cpp36
-rw-r--r--engines/mads/palette.h2
-rw-r--r--engines/mads/phantom/game_phantom.cpp772
-rw-r--r--engines/mads/phantom/game_phantom.h51
-rw-r--r--engines/mads/phantom/globals_phantom.cpp5
-rw-r--r--engines/mads/phantom/globals_phantom.h16
-rw-r--r--engines/mads/phantom/phantom_scenes.cpp111
-rw-r--r--engines/mads/phantom/phantom_scenes.h45
-rw-r--r--engines/mads/phantom/phantom_scenes1.cpp9426
-rw-r--r--engines/mads/phantom/phantom_scenes1.h337
-rw-r--r--engines/mads/phantom/phantom_scenes2.cpp7001
-rw-r--r--engines/mads/phantom/phantom_scenes2.h307
-rw-r--r--engines/mads/phantom/phantom_scenes3.cpp2774
-rw-r--r--engines/mads/phantom/phantom_scenes3.h248
-rw-r--r--engines/mads/phantom/phantom_scenes4.cpp4975
-rw-r--r--engines/mads/phantom/phantom_scenes4.h265
-rw-r--r--engines/mads/phantom/phantom_scenes5.cpp4309
-rw-r--r--engines/mads/phantom/phantom_scenes5.h219
-rw-r--r--engines/mads/player.cpp53
-rw-r--r--engines/mads/player.h13
-rw-r--r--engines/mads/rails.cpp14
-rw-r--r--engines/mads/rails.h4
-rw-r--r--engines/mads/scene.cpp189
-rw-r--r--engines/mads/scene.h24
-rw-r--r--engines/mads/scene_data.cpp87
-rw-r--r--engines/mads/screen.cpp12
-rw-r--r--engines/mads/sequence.cpp24
-rw-r--r--engines/mads/sequence.h5
-rw-r--r--engines/mads/sound.cpp2
-rw-r--r--engines/mads/sound.h2
-rw-r--r--engines/mads/user_interface.cpp2
-rw-r--r--engines/mads/user_interface.h4
67 files changed, 36399 insertions, 688 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index e4f44fc308..605c63e91d 100644
--- a/engines/mads/animation.cpp
+++ b/engines/mads/animation.cpp
@@ -162,6 +162,7 @@ Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) {
_flags = 0;
_font = nullptr;
_resetFlag = false;
+ _canChangeView = false;
_messageCtr = 0;
_skipLoad = false;
_freeFlag = false;
@@ -177,6 +178,7 @@ Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) {
_oldFrameEntry = 0;
_rgbResult = -1;
_palIndex1 = _palIndex2 = -1;
+ _dynamicHotspotIndex = -1;
}
Animation::~Animation() {
@@ -375,6 +377,7 @@ void Animation::loadFrame(int frameNumber) {
pt.x = _unkList[_unkIndex].x;
pt.y = _unkList[_unkIndex].y;
_unkIndex = 1 - _unkIndex;
+ warning("LoadFrame - Using unknown array");
}
if (drawFrame(spriteSet, pt, frameNumber))
@@ -463,21 +466,25 @@ void Animation::update() {
scene._spriteSlots.fullRefresh();
}
- // Handle any offset adjustment for sprites as of this frame
- bool paChanged = false;
- if (scene._posAdjust.x != misc._posAdjust.x) {
- scene._posAdjust.x = misc._posAdjust.x;
- paChanged = true;
- }
- if (scene._posAdjust.y != misc._posAdjust.y) {
- scene._posAdjust.y = misc._posAdjust.y;
- paChanged = true;
- }
+ bool isV2 = (_vm->getGameID() != GType_RexNebular);
+ if (isV2 && _canChangeView) {
+ // Handle any offset adjustment for sprites as of this frame
+ bool paChanged = false;
+ if (getFramePosAdjust(_currentFrame).x != scene._posAdjust.x) {
+ scene._posAdjust.x = getFramePosAdjust(_currentFrame).x;
+ paChanged = true;
+ }
+
+ if (getFramePosAdjust(_currentFrame).y != scene._posAdjust.y) {
+ scene._posAdjust.y = getFramePosAdjust(_currentFrame).y;
+ paChanged = true;
+ }
- if (paChanged) {
- int newIndex = scene._spriteSlots.add();
- scene._spriteSlots[newIndex]._seqIndex = -1;
- scene._spriteSlots[newIndex]._flags = IMG_REFRESH;
+ if (paChanged) {
+ int newIndex = scene._spriteSlots.add();
+ scene._spriteSlots[newIndex]._seqIndex = -1;
+ scene._spriteSlots[newIndex]._flags = IMG_REFRESH;
+ }
}
// Main frame animation loop - frames get animated by being placed, as necessary, into the
@@ -598,8 +605,8 @@ void Animation::setCurrentFrame(int frameNumber) {
_freeFlag = false;
}
-void Animation::setNextFrameTimer(int frameNumber) {
- _nextFrameTimer = frameNumber;
+void Animation::setNextFrameTimer(uint32 newTimer) {
+ _nextFrameTimer = newTimer;
}
void Animation::eraseSprites() {
@@ -611,4 +618,9 @@ void Animation::eraseSprites() {
}
}
+Common::Point Animation::getFramePosAdjust(int idx) {
+ warning("TODO: Implement getFramePosAdjust");
+
+ return Common::Point(0, 0);
+}
} // End of namespace MADS
diff --git a/engines/mads/animation.h b/engines/mads/animation.h
index 46ef85c5eb..a6a4cfbc8b 100644
--- a/engines/mads/animation.h
+++ b/engines/mads/animation.h
@@ -34,11 +34,12 @@
namespace MADS {
enum AnimFlag {
- ANIMFLAG_DITHER = 0x1000, // Dither to 16 colors
- ANIMFLAG_CUSTOM_FONT = 0x2000, // Load ccustom font
- ANIMFLAG_LOAD_BACKGROUND = 0x0100, // Load background
+ ANIMFLAG_LOAD_BACKGROUND = 0x0100, // Load background
ANIMFLAG_LOAD_BACKGROUND_ONLY = 0x0200, // Load background only
- ANIMFLAG_ANIMVIEW = 0x4000 // Cutscene animation
+
+ ANIMFLAG_DITHER = 0x0001, // Dither to 16 colors
+ ANIMFLAG_CUSTOM_FONT = 0x2000, // Load custom fonts
+ ANIMFLAG_ANIMVIEW = 0x4000 // Cutscene animation
};
enum AnimBgType {
@@ -189,8 +190,10 @@ public:
Common::Array<AnimUIEntry> _uiEntries;
Common::Array<AnimMessage> _messages;
bool _resetFlag;
+ bool _canChangeView;
int _currentFrame;
int _oldFrameEntry;
+ int _dynamicHotspotIndex;
static Animation *init(MADSEngine *vm, Scene *scene);
/*
@@ -224,8 +227,8 @@ public:
*/
void eraseSprites();
- void setNextFrameTimer(int frameNumber);
- int getNextFrameTimer() const { return _nextFrameTimer; }
+ void setNextFrameTimer(uint32 newTimer);
+ uint32 getNextFrameTimer() const { return _nextFrameTimer; }
void setCurrentFrame(int frameNumber);
int getCurrentFrame() const { return _currentFrame; }
@@ -235,6 +238,8 @@ public:
void resetSpriteSetsCount() { _header._spriteSetsCount = 0; } // CHECKME: See if it doesn't leak the memory when the destructor is called
SpriteAsset *getSpriteSet(int idx) { return _spriteSets[idx]; }
+
+ Common::Point getFramePosAdjust(int idx);
};
} // End of namespace MADS
diff --git a/engines/mads/assets.h b/engines/mads/assets.h
index 8a0dc2cd44..0aae534498 100644
--- a/engines/mads/assets.h
+++ b/engines/mads/assets.h
@@ -99,8 +99,9 @@ public:
int getCount() { return _frameCount; }
int getFrameRate() const { return _frameRate; }
int getPixelSpeed() const { return _pixelSpeed; }
- int getFrameWidth(int index);
- int getFrameHeight(int index);
+ Common::Point getFramePos(int index) { assert (index < _frameCount); return Common::Point(_frames[index]._bounds.left, _frames[index]._bounds.top); }
+ int getFrameWidth(int index) { assert (index < _frameCount); return _frames[index]._bounds.width(); }
+ int getFrameHeight(int index) { assert (index < _frameCount); return _frames[index]._bounds.height(); }
int getMaxFrameWidth() const { return _maxWidth; }
int getMaxFrameHeight() const { return _maxHeight; }
MSprite *getFrame(int frameIndex);
diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp
new file mode 100644
index 0000000000..86f38b29dc
--- /dev/null
+++ b/engines/mads/conversations.cpp
@@ -0,0 +1,348 @@
+/* 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 "mads/conversations.h"
+#include "mads/mads.h"
+#include "mads/compression.h"
+#include "common/file.h"
+#include "common/util.h" // for Common::hexdump
+
+namespace MADS {
+
+#define MAX_SPEAKERS 5
+
+enum DialogCommands {
+ cmdNodeEnd = 0,
+ //
+ cmdHide = 2,
+ cmdUnhide = 3,
+ cmdMessage = 4,
+ //
+ //
+ cmdGoto = 7,
+ //
+ cmdAssign = 9,
+ cmdDialogEnd = 255
+};
+
+struct ConvDialog {
+ int16 textLineIndex; // 0-based
+ int16 speechIndex; // 1-based
+ uint16 nodeOffset; // offset in section 6
+ uint16 nodeSize; // size in section 6
+};
+
+struct ConvNode {
+ uint16 index;
+ uint16 dialogCount;
+ int16 unk1;
+ int16 unk2;
+ int16 unk3;
+
+ Common::Array<ConvDialog> dialogs;
+};
+
+struct ConvData {
+ uint16 nodeCount; // conversation nodes, each one containing several dialog options and messages
+ uint16 dialogCount; // messages (non-selectable) + texts (selectable)
+ uint16 messageCount; // messages (non-selectable)
+ uint16 textLineCount;
+ uint16 unk2;
+ uint16 importCount;
+ uint16 speakerCount;
+ Common::String portraits[MAX_SPEAKERS];
+ bool speakerExists[MAX_SPEAKERS];
+ Common::String speechFile;
+ Common::Array<Common::String> textLines;
+ Common::Array<ConvNode> convNodes;
+};
+
+GameConversation::GameConversation(MADSEngine *vm)
+ : _vm(vm) {
+ _running = _restoreRunning = 0;
+}
+
+GameConversation::~GameConversation() {
+}
+
+void GameConversation::get(int id) {
+ Common::File inFile;
+ Common::String fileName = Common::String::format("CONV%03d.CNV", id);
+ // TODO: Also handle the .CND file
+
+ inFile.open(fileName);
+ MadsPack convFileUnpacked(&inFile);
+ Common::SeekableReadStream *convFile = convFileUnpacked.getItemStream(0);
+
+ char buffer[16];
+
+ ConvData conv;
+
+ // **** Section 0: Header *************************************************
+ conv.nodeCount = convFile->readUint16LE();
+ conv.dialogCount = convFile->readUint16LE();
+ conv.messageCount = convFile->readUint16LE();
+ conv.textLineCount = convFile->readUint16LE();
+ conv.unk2 = convFile->readUint16LE();
+ conv.importCount = convFile->readUint16LE();
+ conv.speakerCount = convFile->readUint16LE();
+
+ //debug("Conv %d has %d nodes, %d dialogs, %d messages, %d text lines, %d unk2, %d imports and %d speakers",
+ // id, conv.nodeCount, conv.dialogCount, conv.messageCount, conv.textLineCount, conv.unk2, conv.importCount, conv.speakerCount);
+
+ for (uint16 i = 0; i < MAX_SPEAKERS; i++) {
+ convFile->read(buffer, 16);
+ conv.portraits[i] = buffer;
+ //debug("Speaker %d, portrait %s", i, conv.portraits[i].c_str());
+ }
+
+ for (uint16 i = 0; i < MAX_SPEAKERS; i++) {
+ conv.speakerExists[i] = convFile->readUint16LE();
+ //debug("Speaker %d exists: %d", i, conv.speakerExists[i]);
+ }
+
+ convFile->read(buffer, 14);
+ conv.speechFile = Common::String(buffer);
+ //debug("Speech file %s", conv.speechFile.c_str());
+
+ uint16 textLength = convFile->readUint16LE(); // Total text length in section 5
+ convFile->skip(2); // TODO: unknown
+ uint16 commandLength = convFile->readUint16LE(); // Total length of commands in section 6
+ //debug("Node entry commands length: %d", commandLength);
+
+ /*debug("Section 0 unknown bytes");
+ byte *tmp0 = new byte[26];
+ convFile->read(tmp0, 26);
+ Common::hexdump(tmp0, 26);
+ delete[] tmp0;*/
+
+ // **** Section 1: Nodes **************************************************
+ convFile = convFileUnpacked.getItemStream(1);
+
+ for (uint16 i = 0; i < conv.nodeCount; i++) {
+ ConvNode node;
+ node.index = convFile->readUint16LE();
+ node.dialogCount = convFile->readUint16LE();
+ node.unk1 = convFile->readSint16LE(); // TODO
+ node.unk2 = convFile->readSint16LE(); // TODO
+ node.unk3 = convFile->readSint16LE(); // TODO
+ conv.convNodes.push_back(node);
+ //debug("Node %d, index %d, entries %d - %d, %d, %d", i, node.index, node.dialogCount, node.unk1, node.unk2, node.unk3);
+ }
+
+ // **** Section 2: Dialogs ************************************************
+ convFile = convFileUnpacked.getItemStream(2);
+ assert(convFile->size() == conv.dialogCount * 8);
+
+ for (uint16 i = 0; i < conv.nodeCount; i++) {
+ uint16 dialogCount = conv.convNodes[i].dialogCount;
+
+ for (uint16 j = 0; j < dialogCount; j++) {
+ ConvDialog dialog;
+ dialog.textLineIndex = convFile->readSint16LE();
+ dialog.speechIndex = convFile->readSint16LE();
+ dialog.nodeOffset = convFile->readUint16LE();
+ dialog.nodeSize = convFile->readUint16LE();
+ conv.convNodes[i].dialogs.push_back(dialog);
+ //debug("Node %d, dialog %d: text line %d, speech index %d, node offset %d, node size %d", j, i, dialog.textLineIndex, dialog.speechIndex, dialog.nodeOffset, dialog.nodeSize);
+ }
+ }
+
+ // **** Section 3: ???? ***************************************************
+ /*debug("Section 3");
+ convFile = convFileUnpacked.getItemStream(3);
+ byte *tmp1 = new byte[convFile->size()];
+ convFile->read(tmp1, convFile->size());
+ Common::hexdump(tmp1, convFile->size());
+ delete[] tmp1;*/
+ // TODO
+
+ // **** Section 4: Text line offsets **************************************
+ convFile = convFileUnpacked.getItemStream(4);
+ assert(convFile->size() == conv.textLineCount * 2);
+
+ uint16 *textLineOffsets = new uint16[conv.textLineCount]; // deleted below in section 5
+ for (uint16 i = 0; i < conv.textLineCount; i++)
+ textLineOffsets[i] = convFile->readUint16LE();
+
+ // **** Section 5: Text lines *********************************************
+ convFile = convFileUnpacked.getItemStream(5);
+ assert(convFile->size() == textLength);
+
+ Common::String textLine;
+ conv.textLines.resize(conv.textLineCount);
+ char textLineBuffer[256];
+ uint16 nextOffset;
+ for (uint16 i = 0; i < conv.textLineCount; i++) {
+ nextOffset = (i != conv.textLineCount - 1) ? textLineOffsets[i + 1] : convFile->size();
+ convFile->read(textLineBuffer, nextOffset - textLineOffsets[i]);
+ conv.textLines[i] = Common::String(textLineBuffer);
+ //debug("Text line %d: %s", i, conv.textLines[i].c_str());
+ }
+
+ delete[] textLineOffsets;
+
+ // **** Section 6: Node entry commands ************************************
+ convFile = convFileUnpacked.getItemStream(6);
+ assert(convFile->size() == commandLength);
+
+ for (uint16 i = 0; i < conv.nodeCount; i++) {
+ uint16 dialogCount = conv.convNodes[i].dialogCount;
+
+ for (uint16 j = 0; j < dialogCount; j++) {
+ //ConvDialog dialog = conv.convNodes[i].dialogs[j];
+ byte command;
+ uint16 chk;
+
+ do {
+ command = convFile->readByte();
+ chk = convFile->readUint16BE();
+ if (chk != 0xFF00 && chk != 0x0000) {
+ warning("Error while reading conversation node entries - bailing out");
+ break;
+ }
+
+ switch (command) {
+ case cmdNodeEnd:
+ //debug("Node end");
+ break;
+ case cmdDialogEnd:
+ //debug("Dialog end");
+ break;
+ case cmdHide: {
+ byte count = convFile->readByte();
+ for (byte k = 0; k < count; k++) {
+ /*uint16 nodeRef = */convFile->readUint16LE();
+ //debug("Hide node %d", nodeRef);
+ }
+
+ }
+ break;
+ case cmdUnhide: {
+ byte count = convFile->readByte();
+ for (byte k = 0; k < count; k++) {
+ /*uint16 nodeRef = */convFile->readUint16LE();
+ //debug("Unhide node %d", nodeRef);
+ }
+
+ }
+ break;
+ case cmdMessage:
+ //debug("Message");
+ convFile->skip(7); // TODO
+ break;
+ case cmdGoto: {
+ convFile->skip(3); // unused?
+ /*byte nodeRef = */convFile->readByte();
+ //debug("Goto %d", nodeRef);
+ }
+ break;
+ case cmdAssign: {
+ convFile->skip(3); // unused?
+ /*uint16 value = */convFile->readUint16LE();
+ /*uint16 variable = */convFile->readUint16LE();
+ //debug("Variable %d = %d", variable, value);
+ }
+ break;
+ default:
+ error("Unknown conversation command %d", command);
+ break;
+ }
+ } while (command != cmdNodeEnd && command != cmdDialogEnd);
+ }
+ }
+
+ inFile.close();
+
+ /*
+ // DEBUG: Show the very first message, and play the very first speech
+ _vm->_audio->setSoundGroup(conv.speechFile);
+ uint16 firstText = 0, firstSpeech = 1;
+
+ for (uint16 i = 0; i < conv.convNodes.size(); i++) {
+ for (uint16 k = 0; k < conv.convNodes[i].dialogs.size(); k++) {
+ if (conv.convNodes[i].dialogs[k].textLineIndex >= 0) {
+ firstText = conv.convNodes[i].dialogs[k].textLineIndex;
+ firstSpeech = conv.convNodes[i].dialogs[k].speechIndex;
+ break;
+ }
+ }
+ }
+
+ _vm->_audio->playSound(firstSpeech - 1);
+
+ TextDialog *dialog = new TextDialog(_vm, FONT_INTERFACE, Common::Point(0, 100), 30);
+ dialog->addLine(conv.textLines[firstText]);
+ dialog->show();
+ delete dialog;
+ */
+
+ warning("TODO GameConversation::get");
+}
+
+void GameConversation::run(int id) {
+ warning("TODO GameConversation::run");
+}
+
+void GameConversation::stop() {
+ warning("TODO GameConversation::stop");
+}
+
+void GameConversation::exportPointer(int *val) {
+ warning("TODO GameConversation::exportPointer");
+}
+
+void GameConversation::exportValue(int val) {
+ warning("TODO GameConversation::exportValue");
+}
+
+void GameConversation::setHeroTrigger(int val) {
+ _vm->_game->_trigger = val; // HACK
+ _running = -1; // HACK
+ warning("TODO: GameConversation::setHeroTrigger");
+}
+
+void GameConversation::setInterlocutorTrigger(int val) {
+ warning("TODO: GameConversation::setInterlocutorTrigger");
+}
+
+int* GameConversation::getVariable(int idx) {
+ warning("TODO: GameConversation::getVariable");
+ return nullptr;
+}
+
+void GameConversation::hold() {
+ warning("TODO: GameConversation::hold");
+}
+
+void GameConversation::release() {
+ warning("TODO: GameConversation::release");
+}
+
+void GameConversation::reset(int id) {
+ warning("TODO: GameConversation::reset");
+}
+
+void GameConversation::abortConv() {
+ warning("TODO: GameConversation::abort");
+}
+} // End of namespace MADS
diff --git a/engines/mads/conversations.h b/engines/mads/conversations.h
new file mode 100644
index 0000000000..c4bf06e6dc
--- /dev/null
+++ b/engines/mads/conversations.h
@@ -0,0 +1,66 @@
+/* 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 MADS_CONVERSATIONS_H
+#define MADS_CONVERSATIONS_H
+
+namespace MADS {
+
+class MADSEngine;
+
+class GameConversation {
+private:
+ MADSEngine *_vm;
+
+public:
+ /**
+ * Constructor
+ */
+ GameConversation(MADSEngine *vm);
+
+ /**
+ * Destructor
+ */
+ virtual ~GameConversation();
+
+ int* _nextStartNode;
+ int* getVariable(int idx);
+
+ void get(int id);
+ void run(int id);
+ void stop();
+ void exportPointer(int *val);
+ void exportValue(int val);
+ void setHeroTrigger(int val);
+ void setInterlocutorTrigger(int val);
+ void hold();
+ void release();
+ void reset(int id);
+ void abortConv();
+
+ int _running;
+ int _restoreRunning;
+};
+
+} // End of namespace MADS
+
+#endif /* MADS_CONVERSATIONS_H */
diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp
index a6a4d3edbc..740c19abad 100644
--- a/engines/mads/debugger.cpp
+++ b/engines/mads/debugger.cpp
@@ -49,6 +49,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("item", WRAP_METHOD(Debugger, Cmd_Item));
registerCmd("play_anim", WRAP_METHOD(Debugger, Cmd_PlayAnim));
registerCmd("play_text", WRAP_METHOD(Debugger, Cmd_PlayText));
+ registerCmd("set_camera", WRAP_METHOD(Debugger, Cmd_SetCamera));
}
static int strToInt(const char *s) {
@@ -391,4 +392,17 @@ bool Debugger::Cmd_PlayText(int argc, const char **argv) {
}
}
+bool Debugger::Cmd_SetCamera(int argc, const char **argv) {
+ if (argc != 3) {
+ debugPrintf("Usage: %s <x> <y>\n", argv[0]);
+ return true;
+ } else {
+ int x = strToInt(argv[1]);
+ int y = strToInt(argv[2]);
+ _vm->_game->_scene.setCamera(Common::Point(x, y));
+ _vm->_game->_scene.resetScene();
+ _vm->_game->_scene.drawElements(kTransitionNone, false);
+ return false;
+ }
+}
} // End of namespace MADS
diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h
index 70b2cadc65..f6b58ac0de 100644
--- a/engines/mads/debugger.h
+++ b/engines/mads/debugger.h
@@ -51,6 +51,7 @@ protected:
bool Cmd_Item(int argc, const char **argv);
bool Cmd_PlayAnim(int argc, const char **argv);
bool Cmd_PlayText(int argc, const char **argv);
+ bool Cmd_SetCamera(int argc, const char **argv);
public:
bool _showMousePos;
public:
diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h
index efd2871d89..27bc0a43ee 100644
--- a/engines/mads/dialogs.h
+++ b/engines/mads/dialogs.h
@@ -226,6 +226,11 @@ public:
virtual void showItem(int objectId, int messageId, int speech = 0) = 0;
virtual Common::String getVocab(int vocabId) = 0;
virtual bool show(int messageId, int objectId = -1) = 0;
+
+ /**
+ * Show a spinning picture of an object, used in V2+ games
+ */
+ virtual void spinObject(int idx) { warning("TODO: spinObject"); }
};
class FullScreenDialog: public EventTarget {
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.cpp b/engines/mads/dragonsphere/dragonsphere_scenes.cpp
index 6f5a28bff9..938931e80d 100644
--- a/engines/mads/dragonsphere/dragonsphere_scenes.cpp
+++ b/engines/mads/dragonsphere/dragonsphere_scenes.cpp
@@ -28,6 +28,7 @@
#include "mads/scene.h"
#include "mads/dragonsphere/game_dragonsphere.h"
#include "mads/dragonsphere/dragonsphere_scenes.h"
+#include "mads/dragonsphere/dragonsphere_scenes1.h"
namespace MADS {
@@ -42,15 +43,15 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) {
switch (scene._nextSceneId) {
// Scene group #1 (Castle, river and caves)
case 101: // king's bedroom
- return new DummyScene(vm); // TODO
+ return new Scene101(vm);
case 102: // queen's bedroom
- return new DummyScene(vm); // TODO
+ return new Scene102(vm);
case 103: // outside king's bedroom
- return new DummyScene(vm); // TODO
+ return new Scene103(vm);
case 104: // fireplace / bookshelf
- return new DummyScene(vm); // TODO
+ return new Scene104(vm);
case 105: // dining room
- return new DummyScene(vm); // TODO
+ return new Scene105(vm);
case 106: // throne room
return new DummyScene(vm); // TODO
case 107: // council chamber
@@ -201,12 +202,12 @@ Common::String DragonsphereScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) {
- // The intro scenes do not have any codes
- if (_sceneId >= 900)
+ Common::String ext = Common::String::format(".WW%d", variant);
+ Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
+ if (!Common::File::exists(fileName))
return;
- Common::String ext = Common::String::format(".WW%d", variant);
- File f(Resources::formatName(RESPREFIX_RM, _sceneId, ext));
+ File f(fileName);
MadsPack codesPack(&f);
Common::SeekableReadStream *stream = codesPack.getItemStream(0);
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h
index 173cc667ce..e9b48715db 100644
--- a/engines/mads/dragonsphere/dragonsphere_scenes.h
+++ b/engines/mads/dragonsphere/dragonsphere_scenes.h
@@ -29,29 +29,49 @@
#include "mads/dragonsphere/game_dragonsphere.h"
//#include "mads/dragonsphere/globals_dragonsphere.h"
-
namespace MADS {
namespace Dragonsphere {
+enum Verb {
+ VERB_LOOK = 0x3,
+ VERB_TAKE = 0x4,
+ VERB_PUSH = 0x5,
+ VERB_OPEN = 0x6,
+ VERB_PUT = 0x7,
+ VERB_TALK_TO = 0x8,
+ VERB_GIVE = 0x9,
+ VERB_PULL = 0xA,
+ VERB_CLOSE = 0xB,
+ VERB_THROW = 0xC,
+ VERB_WALK_TO = 0xD,
+ VERB_WALK_ACROSS = 0x11,
+ VERB_WALK_BEHIND = 0x1C,
+ VERB_LOOK_AT = 0x1E,
+ VERB_WALK_THROUGH = 0x25,
+ VERB_WALK_INTO = 0x27,
+ VERB_INVOKE = 0x2F,
+ VERB_ATTACK = 0x39,
+ VERB_CARVE_UP = 0x3A,
+ VERB_THRUST = 0x57,
+ VERB_POUR = 0x62,
+ VERB_POUR_CONTENTS_OF = 0x63,
+ VERB_DRINK = 0x64,
+ VERB_SHIFT_SELF = 0x73,
+ VERB_SHIFT_INTO_BEAR = 0x74,
+ VERB_SHIFT_INTO_SEAL = 0x75,
+ VERB_SHIFT_INTO_SNAKE = 0x76,
+ VERB_WALK_DOWN = 0xA9,
+ VERB_WALK = 0x1CB,
+ VERB_WALK_AROUND = 0x221
+};
+
enum Noun {
NOUN_GAME = 0x1,
NOUN_QSAVE = 0x2,
- NOUN_LOOK = 0x3,
- NOUN_TAKE = 0x4,
- NOUN_PUSH = 0x5,
- NOUN_OPEN = 0x6,
- NOUN_PUT = 0x7,
- NOUN_TALK_TO = 0x8,
- NOUN_GIVE = 0x9,
- NOUN_PULL = 0xA,
- NOUN_CLOSE = 0xB,
- NOUN_THROW = 0xC,
- NOUN_WALK_TO = 0xD,
NOUN_NOTHING = 0xE,
NOUN_ = 0xF,
NOUN_FLOOR = 0x10,
- NOUN_WALK_ACROSS = 0x11,
NOUN_RUG = 0x12,
NOUN_CARPET = 0x13,
NOUN_WALL = 0x14,
@@ -62,18 +82,14 @@ enum Noun {
NOUN_NIGHTSTAND = 0x19,
NOUN_TAPESTRY = 0x1A,
NOUN_DRESSING_SCREEN = 0x1B,
- NOUN_WALK_BEHIND = 0x1C,
NOUN_ROYAL_CREST = 0x1D,
- NOUN_LOOK_AT = 0x1E,
NOUN_WASHBASIN = 0x1F,
NOUN_WASH_AT = 0x20,
NOUN_BOOK = 0x21,
NOUN_FIREPLACE = 0x22,
NOUN_FIREPLACE_SCREEN = 0x23,
NOUN_DOOR_TO_QUEENS_ROOM = 0x24,
- NOUN_WALK_THROUGH = 0x25,
NOUN_HALL_TO_SOUTH = 0x26,
- NOUN_WALK_INTO = 0x27,
NOUN_WALL_PLAQUE = 0x28,
NOUN_DECORATION = 0x29,
NOUN_SWORDS = 0x2A,
@@ -81,7 +97,6 @@ enum Noun {
NOUN_BUST_ON_WALL = 0x2C,
NOUN_WALL_ARCH = 0x2D,
NOUN_SIGNET_RING = 0x2E,
- NOUN_INVOKE = 0x2F,
NOUN_POLISH = 0x30,
NOUN_GANGBANG = 0x31,
NOUN_BIRD_FIGURINE = 0x32,
@@ -91,8 +106,6 @@ enum Noun {
NOUN_MAKE_NOISE = 0x36,
NOUN_SHIELDSTONE = 0x37,
NOUN_SWORD = 0x38,
- NOUN_ATTACK = 0x39,
- NOUN_CARVE_UP = 0x3A,
NOUN_GOBLET = 0x3B,
NOUN_FILL = 0x3C,
NOUN_DRINK_FROM = 0x3D,
@@ -121,7 +134,6 @@ enum Noun {
NOUN_MAGIC_BELT = 0x54,
NOUN_ADJUST = 0x55,
NOUN_AMULET = 0x56,
- NOUN_THRUST = 0x57,
NOUN_MUD = 0x58,
NOUN_FEEL = 0x59,
NOUN_TASTE = 0x5A,
@@ -132,9 +144,6 @@ enum Noun {
NOUN_FLASK = 0x5F,
NOUN_FLASK_FULL_OF_ACID = 0x60,
NOUN_POUR_CONTENTS = 0x61,
- NOUN_POUR = 0x62,
- NOUN_POUR_CONTENTS_OF = 0x63,
- NOUN_DRINK = 0x64,
NOUN_ROPE = 0x65,
NOUN_TIE = 0x66,
NOUN_POWER_VACUUM_STONE = 0x67,
@@ -149,10 +158,6 @@ enum Noun {
NOUN_BLACK_SPHERE = 0x70,
NOUN_SOPTUS_SOPORIFIC = 0x71,
NOUN_SHIFTER_RING = 0x72,
- NOUN_SHIFT_SELF = 0x73,
- NOUN_SHIFT_INTO_BEAR = 0x74,
- NOUN_SHIFT_INTO_SEAL = 0x75,
- NOUN_SHIFT_INTO_SNAKE = 0x76,
NOUN_REVERT = 0x77,
NOUN_MEDICINE_BUNDLE = 0x78,
NOUN_SHAKE = 0x79,
@@ -203,7 +208,6 @@ enum Noun {
NOUN_DOOR = 0xA6,
NOUN_WALL_SWITCH = 0xA7,
NOUN_STAIRS = 0xA8,
- NOUN_WALK_DOWN = 0xA9,
NOUN_EDGE_OF_ABYSS = 0xAA,
NOUN_COURTYARD = 0xAB,
NOUN_ROCK = 0xAC,
@@ -493,7 +497,6 @@ enum Noun {
NOUN_PATH_TO_HIGHTOWER = 0x1C8,
NOUN_SPIRIT_PLANE = 0x1C9,
NOUN_SPIRIT_TREE = 0x1CA,
- NOUN_WALK = 0x1CB,
NOUN_REMAINS = 0x1CC,
NOUN_DOORWAY_TO_ELEVATOR = 0x1CD,
NOUN_DRAGON_DOOR = 0x1CE,
@@ -579,7 +582,6 @@ enum Noun {
NOUN_SHIFTER_VILLAGE = 0x21E,
NOUN_SLATHAN_SKY = 0x21F,
NOUN_SHIFTER = 0x220,
- NOUN_WALK_AROUND = 0x221,
NOUN_WRECKED_BRIDGE = 0x222,
NOUN_SHACK = 0x223,
NOUN_WRECKED_SHACK = 0x224,
@@ -656,27 +658,6 @@ protected:
};
// TODO: Temporary, remove once implemented properly
-class Scene1xx : public DragonsphereScene {
-protected:
- /**
- * Plays an appropriate sound when entering a scene
- */
- void sceneEntrySound() {}
-
- /**
- *Sets the AA file to use for the scene
- */
- void setAAName() {}
-
- /**
- * Updates the prefix used for getting player sprites for the scene
- */
- void setPlayerSpritesPrefix() {}
-public:
- Scene1xx(MADSEngine *vm) : DragonsphereScene(vm) {}
-};
-
-// TODO: Temporary, remove once implemented properly
class DummyScene : public DragonsphereScene {
public:
DummyScene(MADSEngine *vm) : DragonsphereScene(vm) {
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes1.cpp b/engines/mads/dragonsphere/dragonsphere_scenes1.cpp
new file mode 100644
index 0000000000..7abb4607ac
--- /dev/null
+++ b/engines/mads/dragonsphere/dragonsphere_scenes1.cpp
@@ -0,0 +1,3714 @@
+/* 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 "common/scummsys.h"
+#include "mads/mads.h"
+#include "mads/conversations.h"
+#include "mads/scene.h"
+#include "mads/dragonsphere/dragonsphere_scenes.h"
+#include "mads/dragonsphere/dragonsphere_scenes1.h"
+
+namespace MADS {
+
+namespace Dragonsphere {
+
+void Scene1xx::setAAName() {
+ int interface;
+
+ switch (_scene->_nextSceneId) {
+ case 108:
+ case 109:
+ interface = 3;
+ break;
+ case 110:
+ interface = 5;
+ break;
+ case 113:
+ case 114:
+ case 115:
+ case 117:
+ case 119:
+ interface = 1;
+ break;
+ case 116:
+ interface = 2;
+ break;
+ case 120:
+ interface = 8;
+ break;
+ default:
+ interface = 0;
+ break;
+ }
+
+ _game._aaName = Resources::formatAAName(interface);
+ _vm->_palette->setEntry(254, 56, 47, 32);
+
+}
+
+void Scene1xx::sceneEntrySound() {
+ if (!_vm->_musicFlag)
+ return;
+
+ switch (_scene->_nextSceneId) {
+ case 104:
+ if (_globals[kPlayerPersona] == 1)
+ _vm->_sound->command(44);
+ else
+ _vm->_sound->command(16);
+ break;
+
+ case 106:
+ if (_globals[kEndOfGame])
+ _vm->_sound->command(47);
+ else
+ _vm->_sound->command(16);
+ break;
+
+ case 108:
+ if (_game._visitedScenes.exists(109))
+ _vm->_sound->command(32);
+ else
+ _vm->_sound->command(33);
+ break;
+
+ case 109:
+ _vm->_sound->command(32);
+ break;
+
+ case 110:
+ _vm->_sound->command(37);
+ break;
+
+ case 111:
+ _vm->_sound->command(34);
+ break;
+
+ case 112:
+ _vm->_sound->command(38);
+ break;
+
+ case 113:
+ _vm->_sound->command(5);
+ if (_globals[kPlayerIsSeal])
+ _vm->_sound->command(35);
+ else
+ _vm->_sound->command(36);
+ break;
+
+ case 114:
+ _vm->_sound->command(36);
+ break;
+
+ case 115:
+ _vm->_sound->command(39);
+ break;
+
+ case 116:
+ _vm->_sound->command(40);
+ break;
+
+ case 117:
+ _vm->_sound->command(35);
+ break;
+
+ case 119:
+ _vm->_sound->command(41);
+ break;
+
+ case 120:
+ _vm->_sound->command(46);
+ break;
+
+ default:
+ _vm->_sound->command(16);
+ break;
+ }
+}
+
+void Scene1xx::setPlayerSpritesPrefix() {
+ int darkSceneFl = false;
+ int noPlayerFl = false;
+
+ _vm->_sound->command(5);
+ Common::String oldName = _game._player._spritesPrefix;
+
+ _globals[kPerformDisplacements] = true;
+
+ switch (_scene->_nextSceneId) {
+ case 106:
+ if (_scene->_currentSceneId == 120)
+ noPlayerFl = true;
+ break;
+
+ case 108:
+ case 109:
+ case 114:
+ case 115:
+ darkSceneFl = true;
+ break;
+
+ case 111:
+ case 112:
+ case 117:
+ case 120:
+ case 119:
+ noPlayerFl = true;
+ break;
+
+ case 113:
+ if (!_globals[kPlayerPersona])
+ noPlayerFl = true;
+ darkSceneFl = true;
+ break;
+ }
+
+ if (noPlayerFl || _globals[kNoLoadWalker]) {
+ _game._player._spritesPrefix = "";
+ } else if (!_game._player._forcePrefix) {
+ if (!_globals[kPlayerPersona] || _scene->_nextSceneId == 108 || _scene->_nextSceneId == 109) {
+ if (_scene->_nextSceneId == 113 || _scene->_nextSceneId == 114 || _scene->_nextSceneId == 115 || _scene->_nextSceneId == 116)
+ _game._player._spritesPrefix = "PD";
+ else
+ _game._player._spritesPrefix = "KG";
+ } else
+ _game._player._spritesPrefix = "PD";
+
+ if (darkSceneFl)
+ _game._player._spritesPrefix += "D";
+ }
+
+ if (oldName != _game._player._spritesPrefix)
+ _game._player._spritesChanged = true;
+
+ _game._player._scalingVelocity = true;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene101::Scene101(MADSEngine *vm) : Scene1xx(vm) {
+}
+
+void Scene101::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+}
+
+void Scene101::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene101::enter() {
+ sceneEntrySound();
+}
+
+void Scene101::step() {
+}
+
+void Scene101::actions() {
+ if (_action.isObject(NOUN_BED)) {
+ int sprIdx = _scene->_sprites.addSprites("*ob001i");
+ int seqIdx = _scene->_sequences.addStampCycle(sprIdx, false, 1);
+ _scene->_sequences.setDepth(seqIdx, 0);
+ _scene->_sequences.setPosition(seqIdx, Common::Point(10, 50));
+ _action._inProgress = false;
+ }
+}
+
+void Scene101::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene102::Scene102(MADSEngine *vm) : Scene1xx(vm) {
+ _diaryHotspotIdx1 = -1;
+ _diaryHotspotIdx2 = -1;
+ _diaryFrame = -1;
+ _animRunning = -1;
+}
+
+void Scene102::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsSint16LE(_diaryHotspotIdx1);
+ s.syncAsSint16LE(_diaryHotspotIdx2);
+ s.syncAsSint16LE(_diaryFrame);
+ s.syncAsSint16LE(_animRunning);
+}
+
+void Scene102::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_DIARIES);
+ _scene->addActiveVocab(VERB_WALK_TO);
+}
+
+void Scene102::enter() {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', 1));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('y', 0));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('y', 1));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', -1));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*KGRD_6");
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('y', 2));
+
+ _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 0);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 0);
+ _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 7, 0);
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 12);
+ _diaryHotspotIdx1 = _scene->_dynamicHotspots.add(NOUN_DIARIES, VERB_WALK_TO, SYNTAX_PLURAL, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(_diaryHotspotIdx1, Common::Point(47, 123), FACING_NORTHWEST);
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 12);
+ _diaryHotspotIdx2 = _scene->_dynamicHotspots.add(NOUN_DIARIES, VERB_WALK_TO, SYNTAX_PLURAL, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(_diaryHotspotIdx2, Common::Point(47, 123), FACING_NORTHWEST);
+
+ if (_scene->_priorSceneId == 103) {
+ _game._player._playerPos = Common::Point(170, 152);
+ _game._player._facing = FACING_NORTHWEST;
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5);
+ } else if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5);
+ _game._player.firstWalk(Common::Point(-10, 130), FACING_EAST, Common::Point(35, 144), FACING_EAST, false);
+ _game._player.setWalkTrigger(70);
+ } else {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene102::step() {
+ int resetFrame;
+
+ if ((_animRunning == 1) && _scene->_animation[_globals._animationIndexes[0]]) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() != _diaryFrame) {
+ _diaryFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ resetFrame = -1;
+
+ switch (_diaryFrame) {
+ case 6:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_ANIM, _globals._animationIndexes[0]);
+ break;
+
+ case 10:
+ _vm->_sound->command(65);
+ break;
+
+ case 26:
+ _vm->_dialogs->show(10210);
+ _vm->_dialogs->show(10211);
+ _vm->_dialogs->show(10212);
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ if (resetFrame != _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame()) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _diaryFrame = resetFrame;
+ }
+ }
+ }
+ }
+
+ if ((_animRunning == 2) && _scene->_animation[_globals._animationIndexes[0]]) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() != _diaryFrame) {
+ _diaryFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ resetFrame = -1;
+
+ switch (_diaryFrame) {
+ case 6:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[2], SYNC_ANIM, _globals._animationIndexes[0]);
+ break;
+
+ case 26:
+ _vm->_dialogs->show(10213);
+ _vm->_dialogs->show(10214);
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ if (resetFrame != _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame()) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _diaryFrame = resetFrame;
+ }
+ }
+ }
+ }
+
+ if (_game._trigger >= 70) {
+ switch (_game._trigger) {
+ case 70:
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 9, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ break;
+
+ case 71: {
+ int idx = _globals._sequenceIndexes[6];
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[6], SYNC_SEQ, idx);
+ _game._player._stepEnabled = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Scene102::actions() {
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(10201);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_KINGS_ROOM) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_KINGS_ROOM) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_KINGS_ROOM)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[7] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[7], true, 8, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[7], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 2, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2: {
+ int idx = _globals._sequenceIndexes[6];
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 5);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[6], SYNC_SEQ, idx);
+ }
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[7]);
+ _game._player.walk(Common::Point(0, 130), FACING_WEST);
+ _game._player._walkOffScreenSceneId = 101;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_HALLWAY) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_HALLWAY) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_HALLWAY)) {
+ _scene->_nextSceneId = 103;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_DIARIES) || _action.isAction(VERB_OPEN, NOUN_DIARIES)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _animRunning = 1;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('B',-1), 1);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 1:
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 12);
+ _diaryHotspotIdx1 = _scene->_dynamicHotspots.add(NOUN_DIARIES, VERB_WALK_TO, SYNTAX_PLURAL, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(_diaryHotspotIdx1, Common::Point(47, 123), FACING_NORTHWEST);
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->_sequences.addTimer(6, 2);
+ break;
+
+ case 2:
+ _game._player.walk(Common::Point(51, 121), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(3);
+ break;
+
+ case 3:
+ _game._player._visible = false;
+ _animRunning = 2;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('A',-1), 4);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 4:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 12);
+ _diaryHotspotIdx2 = _scene->_dynamicHotspots.add(NOUN_DIARIES, VERB_WALK_TO, SYNTAX_PLURAL, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(_diaryHotspotIdx2, Common::Point(47, 123), FACING_NORTHWEST);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FIREPLACE)) {
+ _vm->_dialogs->show(10202);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BED)) {
+ _vm->_dialogs->show(10203);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SHUTTERS)) {
+ _vm->_dialogs->show(10204);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RUG)) {
+ _vm->_dialogs->show(10206);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOOKCASE)) {
+ _vm->_dialogs->show(10208);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DIARIES)) {
+ _vm->_dialogs->show(10209);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_KINGS_ROOM)) {
+ _vm->_dialogs->show(10215);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOWERS)) {
+ _vm->_dialogs->show(10216);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WINDOW)) {
+ _vm->_dialogs->show(10217);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WOOD_BASKET)) {
+ _vm->_dialogs->show(10219);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FIREPLACE_SCREEN)) {
+ _vm->_dialogs->show(10220);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_NIGHTSTAND)) {
+ _vm->_dialogs->show(10222);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_HALLWAY)) {
+ _vm->_dialogs->show(10223);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHEST)) {
+ _vm->_dialogs->show(10224);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TAPESTRY)) {
+ _vm->_dialogs->show(10226);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SCONCE)) {
+ _vm->_dialogs->show(10227);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(10228);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10229);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DECORATION)) {
+ _vm->_dialogs->show(10230);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(10231);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CHEST)) {
+ _vm->_dialogs->show(10224);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_FLOWERS)) {
+ _vm->_dialogs->show(10225);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_WINDOW)) {
+ _vm->_dialogs->show(10218);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_FIREPLACE_SCREEN)) {
+ _vm->_dialogs->show(10221);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_SHUTTERS)) {
+ _vm->_dialogs->show(10205);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PULL, NOUN_RUG)) {
+ _vm->_dialogs->show(10207);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene102::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene103::Scene103(MADSEngine *vm) : Scene1xx(vm) {
+}
+
+void Scene103::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+}
+
+void Scene103::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene103::enter() {
+ _vm->_disableFastwalk = true;
+
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('y', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('y', 2));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('y', 7));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('y', 0));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('y', 3));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('y', 4));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('y', 5));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('y', 6));
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*KGRD_9");
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 0, 0);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 0, 4);
+ _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 7, 0, 0);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 0, 0);
+ _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 0, 3);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 0, 2);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 0, 0);
+ _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 0, 5);
+
+ if ((_scene->_priorSceneId == 104) || (_scene->_priorSceneId == 105)) {
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8);
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8);
+ }
+
+ if (_scene->_priorSceneId == 102) {
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 6);
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+ _scene->setCamera(Common::Point(320, 0));
+ _game._player.walk(Common::Point(482, 128), FACING_SOUTH);
+ _game._player.firstWalk(Common::Point(471, 108), FACING_SOUTH, Common::Point(482, 128), FACING_SOUTH, false);
+ _game._player.setWalkTrigger(72);
+ } else if (_scene->_priorSceneId == 104) {
+ _game._player._playerPos = Common::Point(130, 152);
+ _game._player._facing = FACING_NORTHEAST;
+ } else if (_scene->_priorSceneId == 105) {
+ _game._player._playerPos = Common::Point(517, 152);
+ _game._player._facing = FACING_NORTHWEST;
+ _scene->setCamera(Common::Point(320, 0));
+ } else if ((_scene->_priorSceneId == 101) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+ _game._player.firstWalk(Common::Point(173, 108), FACING_SOUTH, Common::Point(162, 127), FACING_SOUTH, false);
+ _game._player.setWalkTrigger(70);
+ } else {
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 6);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene103::step() {
+ switch (_game._trigger) {
+ case 70:
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 6);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 3);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ break;
+
+ case 71: {
+ int tmpIdx = _globals._sequenceIndexes[9];
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 6);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[9], SYNC_SEQ, tmpIdx);
+ _game._player._stepEnabled = true;
+ }
+ break;
+
+ case 72:
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[10], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 3);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 73);
+ break;
+
+ case 73: {
+ int tmpIdx = _globals._sequenceIndexes[10];
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[10], SYNC_SEQ, tmpIdx);
+ _game._player._stepEnabled = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene103::actions() {
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(10301);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_KINGS_ROOM) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_KINGS_ROOM) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_KINGS_ROOM)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[11] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[11], false, 7, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[11], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_SPRITE, 2, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2: {
+ int tmpIdx = _globals._sequenceIndexes[9];
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[9], SYNC_SEQ, tmpIdx);
+ }
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[11]);
+ _scene->_sequences.addTimer(1, 4);
+ break;
+
+ case 4:
+ _game._player.walk(Common::Point(173, 108), FACING_NORTH);
+ _game._player.setWalkTrigger(5);
+ break;
+
+ case 5:
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 6);
+ break;
+
+ case 6: {
+ int tmpIdx = _globals._sequenceIndexes[9];
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[9], SYNC_SEQ, tmpIdx);
+ _scene->_sequences.addTimer(6, 7);
+ }
+ break;
+
+ case 7:
+ _scene->_nextSceneId = 101;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_QUEENS_ROOM) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_QUEENS_ROOM) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_QUEENS_ROOM)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[11] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[11], true, 7, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[11], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_SPRITE, 2, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2: {
+ int tmpIdx = _globals._sequenceIndexes[10];
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[10], SYNC_SEQ, tmpIdx);
+ }
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[11]);
+ _scene->_sequences.addTimer(1, 4);
+ break;
+
+ case 4:
+ _game._player.walk(Common::Point(471, 108), FACING_NORTH);
+ _game._player.setWalkTrigger(5);
+ break;
+
+ case 5:
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[10], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 6);
+ break;
+
+ case 6: {
+ int tmpIdx = _globals._sequenceIndexes[10];
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[10], SYNC_SEQ, tmpIdx);
+ _scene->_sequences.addTimer(6, 7);
+ }
+ break;
+
+ case 7:
+ _scene->_nextSceneId = 102;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_MEETING_ROOM) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_MEETING_ROOM) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_MEETING_ROOM)) {
+ _scene->_nextSceneId = 104;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_BALLROOM) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_BALLROOM) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_BALLROOM)) {
+ _scene->_nextSceneId = 105;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_TAPESTRY)) {
+ if ((_scene->_customDest.x <= 75) && (_scene->_customDest.y <= 130))
+ _vm->_dialogs->show(10302);
+ else
+ _vm->_dialogs->show(10303);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COAT_OF_ARMS)) {
+ _vm->_dialogs->show(10305);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_QUEENS_ROOM)) {
+ _vm->_dialogs->show(10307);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_KINGS_ROOM)) {
+ _vm->_dialogs->show(10308);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEDAR_CHEST)) {
+ _vm->_dialogs->show(10309);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TABLE)) {
+ _vm->_dialogs->show(10311);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SMALL_WINDOW)) {
+ _vm->_dialogs->show(10312);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LARGE_WINDOW)) {
+ _vm->_dialogs->show(10314);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BATTLE_AXES)) {
+ _vm->_dialogs->show(10315);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BUST_ON_WALL)) {
+ _vm->_dialogs->show(10317);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DECORATION)) {
+ _vm->_dialogs->show(10320);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL_PLAQUE)) {
+ _vm->_dialogs->show(10322);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_BALLROOM)) {
+ _vm->_dialogs->show(10323);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_MEETING_ROOM)) {
+ _vm->_dialogs->show(10324);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_BATTLE_AXES)) {
+ _vm->_dialogs->show(10316);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_TAPESTRY)) {
+ _vm->_dialogs->show(10304);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PULL, NOUN_COAT_OF_ARMS)) {
+ _vm->_dialogs->show(10306);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CEDAR_CHEST)) {
+ _vm->_dialogs->show(10310);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_SMALL_WINDOW) || _action.isAction(VERB_OPEN, NOUN_LARGE_WINDOW)) {
+ _vm->_dialogs->show(10313);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene103::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene104::Scene104(MADSEngine *vm) : Scene1xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _anim5ActvFl = false;
+ _activateTimerFl = false;
+ _wasBearFl = false;
+ _amuletWorksFl = false;
+ _pidDrawnSword = false;
+ _anim6ActvFl = false;
+
+ _animationRunning = -1;
+ _deathTimer = -1;
+ _deathFrame = -1;
+ _doorwayHotspotId = -1;
+
+ _kingStatus = -1;
+ _kingFrame = -1;
+ _kingCount = -1;
+ _macCount = -1;
+ _macFrame = -1;
+ _macStatus = -1;
+ _queenStatus = -1;
+ _queenFrame = -1;
+ _queenCount = -1;
+ _pidStatus = -1;
+ _pidFrame = -1;
+ _pidCount = -1;
+ _twinklesFrame = -1;
+ _twinklesStatus = -1;
+ _twinklesCount = -1;
+
+ _tapestryFrame = -1;
+ _clock = -1;
+}
+
+void Scene104::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+ s.syncAsByte(_anim4ActvFl);
+ s.syncAsByte(_anim5ActvFl);
+ s.syncAsByte(_activateTimerFl);
+ s.syncAsByte(_wasBearFl);
+ s.syncAsByte(_amuletWorksFl);
+ s.syncAsByte(_pidDrawnSword);
+ s.syncAsByte(_anim6ActvFl);
+
+ s.syncAsSint16LE(_animationRunning);
+ s.syncAsSint16LE(_deathTimer);
+ s.syncAsSint16LE(_deathFrame);
+ s.syncAsSint16LE(_doorwayHotspotId);
+
+ s.syncAsSint16LE(_kingStatus);
+ s.syncAsSint16LE(_kingFrame);
+ s.syncAsSint16LE(_kingCount);
+ s.syncAsSint16LE(_queenStatus);
+ s.syncAsSint16LE(_queenFrame);
+ s.syncAsSint16LE(_queenCount);
+ s.syncAsSint16LE(_macStatus);
+ s.syncAsSint16LE(_macFrame);
+ s.syncAsSint16LE(_macCount);
+ s.syncAsSint16LE(_pidStatus);
+ s.syncAsSint16LE(_pidFrame);
+ s.syncAsSint16LE(_pidCount);
+ s.syncAsSint16LE(_twinklesStatus);
+ s.syncAsSint16LE(_twinklesFrame);
+ s.syncAsSint16LE(_twinklesCount);
+
+ s.syncAsSint16LE(_tapestryFrame);
+ s.syncAsSint32LE(_clock);
+}
+
+void Scene104::setup() {
+ if (_scene->_currentSceneId == 119)
+ _globals[kNoLoadWalker] = true;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_DOORWAY);
+ _scene->addActiveVocab(NOUN_QUEEN_MOTHER);
+ _scene->addActiveVocab(NOUN_KING);
+}
+
+void Scene104::enter() {
+ _vm->_gameConv->get(1);
+
+ if (_globals[kPlayerPersona] == 1) {
+ _scene->_sprites.addSprites(formAnimName('e', 8));
+ _scene->_sprites.addSprites(formAnimName('b', 5));
+ }
+
+ _scene->_hotspots.activate(NOUN_MACMORN, false);
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _animationRunning = 0;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _anim5ActvFl = false;
+ _kingCount = 0;
+ _macCount = 0;
+ _queenCount = 0;
+ _twinklesCount = 0;
+ _deathTimer = 0;
+ _clock = 0;
+ _activateTimerFl = false;
+ _wasBearFl = false;
+ _amuletWorksFl = false;
+ _pidDrawnSword = false;
+ }
+
+ _anim6ActvFl = false;
+
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 4));
+
+ if (_globals[kNoLoadWalker]) {
+ _scene->drawToBackground(_globals._spriteIndexes[6], 5, Common::Point(-32000, -32000), 0, 100);
+ _scene->_sprites.remove(_globals._spriteIndexes[6]);
+ }
+
+ if (_globals[kPlayerPersona] == 0) {
+ _scene->_hotspots.activateAtPos(NOUN_TABLE, false, Common::Point(139, 132));
+
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*KGRD_8");
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*KGRM1_8");
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('y', 5));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('y', 4));
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('y', 1));
+
+ if (_globals[kTapestryStatus] == 0 || _globals[kTapestryStatus] == 2) {
+ _scene->_hotspots.activate(NOUN_WALL_PANEL, false);
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, false);
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 6);
+ } else {
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6);
+ _scene->_hotspots.activateAtPos(NOUN_TAPESTRY, false, Common::Point(310, 70));
+ }
+
+ if (_globals[kBooksStatus] == 1 || _globals[kBooksStatus] == 3) {
+ if (_globals[kTapestryStatus] == 1 || _globals[kTapestryStatus] == 3)
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, false);
+ } else if (_globals[kBooksStatus] == 2 || _globals[kBooksStatus] == 4) {
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8);
+
+ if (_globals[kTapestryStatus] == 1 || _globals[kTapestryStatus] == 3) {
+ _scene->_hotspots.activate(NOUN_WALL_PANEL, false);
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, true);
+ }
+ }
+ } else {
+ _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('e', 5));
+ _scene->_sprites.addSprites(formAnimName('b', 0));
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('b', 3));
+ _scene->_hotspots.activateAtPos(NOUN_TABLE, false, Common::Point(140, 107));
+ _scene->_hotspots.activateAtPos(NOUN_TABLE, true, Common::Point(139, 132));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('y', 4));
+
+ if (_globals[kNoLoadWalker]) {
+ _scene->drawToBackground(_globals._spriteIndexes[10], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_sprites.remove(_globals._spriteIndexes[10]);
+ }
+
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('y', 3));
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8);
+ _doorwayHotspotId = _scene->_dynamicHotspots.add(NOUN_DOORWAY, VERB_WALK_THROUGH, SYNTAX_SINGULAR, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(_doorwayHotspotId, Common::Point(295, 145), FACING_NORTHEAST);
+
+ _globals[kBooksStatus] = 0;
+ _scene->_hotspots.activateAtPos(NOUN_TAPESTRY, false, Common::Point(310, 70));
+ }
+
+ if (_globals[kBooksStatus] == 0)
+ _scene->_hotspots.activate(NOUN_BOOKS, false);
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 0, 5);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 0);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 0);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3);
+ _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 0);
+
+
+ if (_globals[kPlayerPersona] == 0) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4);
+ }
+
+ if (_scene->_priorSceneId == 106) {
+ _game._player._playerPos = Common::Point(201, 152);
+ _game._player._facing = FACING_NORTHWEST;
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ } else if ((_scene->_priorSceneId == 119) || (_scene->_priorSceneId == 104)) {
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4);
+ _scene->_sequences.addTimer(60, 77);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('k', 1), 0);
+ _anim0ActvFl = true;
+ _kingStatus = 2;
+ _scene->setAnimFrame(_globals._animationIndexes[0], 22);
+
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('q', 1), 0);
+ _anim2ActvFl = true;
+ _queenStatus = 0;
+
+ _globals._sequenceIndexes[14] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[14], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 6);
+
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('p', 1), 79);
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_QUEEN_MOTHER, VERB_WALK_TO, SYNTAX_FEM_NOT_PROPER, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[2], 0);
+
+ _scene->_hotspots.activate(NOUN_MACMORN, true);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_KING, VERB_WALK_TO, SYNTAX_MASC_NOT_PROPER, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[0], 0);
+ } else if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _game._player.firstWalk(Common::Point(77, 93), FACING_SOUTH, Common::Point(74, 107), FACING_SOUTH, false);
+ _game._player.setWalkTrigger(70);
+ } else if (_globals[kNoLoadWalker]) {
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('k', 1), 0);
+ _anim0ActvFl = true;
+ _kingStatus = 0;
+ _scene->setAnimFrame(_globals._animationIndexes[0], 14);
+
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('q', 1), 0);
+ _anim2ActvFl = true;
+ _queenStatus = 0;
+
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('p', 2), 0);
+ _anim4ActvFl = true;
+ _pidStatus = 0;
+ if (_amuletWorksFl)
+ _scene->setAnimFrame(_globals._animationIndexes[4], 89);
+
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('m', 1), 0);
+ _anim1ActvFl = true;
+ _macStatus = 0;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 25);
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_QUEEN_MOTHER, VERB_WALK_TO, SYNTAX_FEM_NOT_PROPER, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[2], 0);
+
+ _scene->_hotspots.activate(NOUN_MACMORN, true);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_KING, VERB_WALK_TO, SYNTAX_MASC_NOT_PROPER, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[0], 0);
+
+ if (_vm->_gameConv->_restoreRunning == 1) {
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+ if (_globals[kLlanieStatus] != 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ } else {
+ _activateTimerFl = true;
+ _deathTimer = 0;
+ _clock = 0;
+ _game._player._stepEnabled = true;
+ }
+ } else {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 12);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene104::step() {
+ if (_anim0ActvFl)
+ handleKingAnimation();
+
+ if (_anim1ActvFl)
+ handleMacAnimation1();
+
+ if (_anim2ActvFl)
+ handleQueenAnimation();
+
+ if (_anim3ActvFl)
+ handleTwinklesAnimation();
+
+ if (_anim4ActvFl)
+ handlePidAnimation();
+
+ if (_anim5ActvFl)
+ handleMacAnimation2();
+
+ if (_anim6ActvFl)
+ handleDeathAnimation();
+
+ if ((_animationRunning == 1) && _scene->_animation[_globals._animationIndexes[0]]) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() != _tapestryFrame) {
+ _tapestryFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ if (_tapestryFrame == 13) {
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ }
+
+ if ((resetFrame >= 0) && (resetFrame != _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame())) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _tapestryFrame = resetFrame;
+ }
+ }
+ }
+
+ switch (_game._trigger) {
+ case 70:
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ break;
+
+ case 71: {
+ int idx = _globals._sequenceIndexes[6];
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[6], SYNC_SEQ, idx);
+ _game._player._stepEnabled = true;
+ }
+ break;
+ }
+
+ if (_game._trigger == 77)
+ _kingStatus = 0;
+
+ if (_game._trigger == 79) {
+ _scene->freeAnimation(_globals._animationIndexes[4]);
+
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('p', 2), 0);
+ _anim4ActvFl = true;
+ _pidStatus = 0;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[4], SYNC_CLOCK, 0);
+
+ _scene->deleteSequence(_globals._sequenceIndexes[14]);
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('m', 1), 0);
+ _anim1ActvFl = true;
+ _macStatus = 0;
+
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+
+ if (_globals[kLlanieStatus] != 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ }
+
+ if (_game._trigger == 85) {
+ _vm->_sound->command(100);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ }
+
+ if (_activateTimerFl) {
+ long clockDiff = _scene->_frameStartTime - _clock;
+ if ((clockDiff >= 0) && (clockDiff <= 4))
+ _deathTimer += clockDiff;
+ else
+ _deathTimer += 1;
+
+ _clock = _scene->_frameStartTime;
+
+ if (_deathTimer >= 1300) {
+ _activateTimerFl = false;
+ if (_pidDrawnSword) {
+ _pidStatus = 6;
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(1);
+ _vm->_gameConv->exportValue(0);
+ if (_globals[kLlanieStatus] != 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->hold();
+ } else
+ _pidStatus = 8;
+
+ _game._player._stepEnabled = false;
+ }
+ }
+
+
+ if ((_globals[kTapestryStatus] == 1 || _globals[kTapestryStatus] == 3)
+ && (_globals[kBooksStatus] == 2 || _globals[kBooksStatus] == 4))
+ _globals[kCanViewCrownHole] = true;
+
+ if (_game._trigger == 95) {
+ _vm->_gameConv->reset(1);
+ _vm->_dialogs->show(10466);
+ _globals[kNoLoadWalker] = false;
+ _scene->_nextSceneId = 119;
+ }
+}
+
+void Scene104::actions() {
+ if (_vm->_gameConv->_running == 1) {
+ handleFinalConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10401);
+ else
+ _vm->_dialogs->show(10437);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_THRONE_ROOM) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_THRONE_ROOM) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_THRONE_ROOM)) {
+ if (_globals[kPlayerPersona] == 0)
+ _scene->_nextSceneId = 106;
+ else
+ _vm->_dialogs->show(10434);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_HALLWAY) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_HALLWAY) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_HALLWAY)) {
+ if (_globals[kPlayerPersona] == 0) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[7] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[7], false, 8, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[7], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 2, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2: {
+ int tmpIdx = _globals._sequenceIndexes[6];
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[6], SYNC_SEQ, tmpIdx);
+ }
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[7]);
+ _scene->_sequences.addTimer(1, 4);
+ break;
+
+ case 4:
+ _game._player.walk(Common::Point(77, 93), FACING_NORTH);
+ _game._player.setWalkTrigger(5);
+ break;
+
+ case 5:
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 6);
+ break;
+
+ case 6: {
+ int tmpIdx = _globals._sequenceIndexes[6];
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[6], SYNC_SEQ, tmpIdx);
+ _scene->_sequences.addTimer(6, 7);
+ }
+ break;
+
+ case 7:
+ _scene->_nextSceneId = 103;
+ break;
+
+ default:
+ break;
+ }
+ } else
+ _vm->_dialogs->show(10434);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE) || _action.isAction(VERB_OPEN)) && _action.isObject(NOUN_BOOKS)) {
+ if ((_globals[kBooksStatus] == 1) || (_globals[kBooksStatus] == 3) || _game._trigger) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], false, 8, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -1, 3);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 3, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2: {
+ int tmpIdx = _globals._sequenceIndexes[12];
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[12], SYNC_SEQ, tmpIdx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8);
+ if ((_globals[kTapestryStatus] == 1) || (_globals[kTapestryStatus] == 3)) {
+ _scene->_hotspots.activate(NOUN_WALL_PANEL, false);
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, true);
+ }
+ }
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _scene->_sequences.addTimer(5, 4);
+ break;
+
+ case 4:
+ if (_globals[kBooksStatus] == 1) {
+ _globals[kPlayerScore] += 2;
+ _globals[kBooksStatus] = 2;
+ if ((_globals[kTapestryStatus] == 1) || (_globals[kTapestryStatus] == 3))
+ _vm->_dialogs->show(10428);
+ else {
+ _vm->_sound->command(94);
+ _vm->_sound->command(67);
+ _vm->_dialogs->show(10427);
+ }
+ } else {
+ _vm->_sound->command(94);
+ _vm->_sound->command(67);
+ _globals[kBooksStatus] = 4;
+ }
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_PUSH, NOUN_BOOKS)) {
+ if ((_globals[kBooksStatus] == 2) || (_globals[kBooksStatus] == 4)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], false, 8, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -1, 3);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 3, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _vm->_sound->command(94);
+ _vm->_sound->command(67);
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ _globals._sequenceIndexes[12] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[12], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8);
+ _scene->_sequences.addTimer(6, 2);
+ break;
+
+ case 2:
+ if ((_globals[kTapestryStatus] == 1) || (_globals[kTapestryStatus] == 3)) {
+ _scene->_hotspots.activate(NOUN_WALL_PANEL, true);
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, false);
+ }
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _scene->_sequences.addTimer(5, 4);
+ break;
+
+ case 4:
+ if (_globals[kBooksStatus] == 2)
+ _vm->_dialogs->show(10429);
+ _globals[kBooksStatus] = 3;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH)) && _action.isObject(NOUN_TAPESTRY)) {
+ if (_globals[kPlayerPersona] == 0) {
+ if (_scene->_customDest.x >= 279) {
+ if ((_globals[kTapestryStatus] == 0) || (_globals[kTapestryStatus] == 2)) {
+ switch (_game._trigger) {
+ case 0:
+ _scene->deleteSequence(_globals._sequenceIndexes[11]);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _animationRunning = 1;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('a', -1), 1);
+ break;
+
+ case 1:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6);
+ _scene->_hotspots.activateAtPos(NOUN_TAPESTRY, true, Common::Point(290, 20));
+ _scene->_hotspots.activateAtPos(NOUN_TAPESTRY, false, Common::Point(310, 70));
+ if ((_globals[kBooksStatus] == 2) || (_globals[kBooksStatus] == 4)) {
+ _scene->_hotspots.activate(NOUN_WALL_PANEL, false);
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, true);
+ } else {
+ _scene->_hotspots.activate(NOUN_WALL_PANEL, true);
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, false);
+ }
+ _scene->_sequences.addTimer(6, 2);
+ break;
+
+ case 2:
+ if (_globals[kTapestryStatus] == 0) {
+ _globals[kTapestryStatus] = 1;
+ _globals[kPlayerScore] += 2;
+ if (_globals[kBooksStatus] == 0 || _globals[kBooksStatus] == 1 || _globals[kBooksStatus] == 3)
+ _vm->_dialogs->show(10424);
+ else if (_globals[kBooksStatus] == 2 || _globals[kBooksStatus] == 4)
+ _vm->_dialogs->show(10425);
+ } else
+ _globals[kTapestryStatus] = 3;
+
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ } else
+ _vm->_dialogs->show(10404);
+ } else
+ _vm->_dialogs->show(10445);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_CLOSE) || _action.isAction(VERB_PUSH)) && _action.isObject(NOUN_TAPESTRY)) {
+ if (_globals[kPlayerPersona] == 0) {
+ if (_scene->_customDest.x >= 279) {
+ if (_globals[kTapestryStatus] == 1 || _globals[kTapestryStatus] == 3) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _animationRunning = 2;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', -1), 1);
+ break;
+
+ case 1:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 6);
+ _scene->_hotspots.activateAtPos(NOUN_TAPESTRY, false, Common::Point(290, 20));
+ _scene->_hotspots.activateAtPos(NOUN_TAPESTRY, true, Common::Point(310, 70));
+ _scene->_hotspots.activate(NOUN_SECRET_DOOR, false);
+ _scene->_hotspots.activate(NOUN_WALL_PANEL, false);
+ _scene->_sequences.addTimer(6, 2);
+ break;
+
+ case 2:
+ _globals[kTapestryStatus] = 2;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+ } else {
+ _vm->_dialogs->show(10445);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_BOOKS) || _action.isObject(NOUN_BOOKSHELF)) {
+ if (_globals[kPlayerPersona] == 0) {
+ switch (_globals[kBooksStatus]) {
+ case 0:
+ _scene->_hotspots.activate(NOUN_BOOKS, true);
+ _globals[kBooksStatus] = 1;
+ _vm->_dialogs->show(10418);
+ _action._inProgress = false;
+ return;
+
+ case 1:
+ _vm->_dialogs->show(10418);
+ _action._inProgress = false;
+ return;
+
+ case 2:
+ case 4:
+ _vm->_dialogs->show(10419);
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ _vm->_dialogs->show(10420);
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ } else {
+ _vm->_dialogs->show(10439);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isObject(NOUN_FIREPLACE)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10402);
+ else
+ _vm->_dialogs->show(10438);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TAPESTRY)) {
+ if (_globals[kPlayerPersona] == 0) {
+ if (_scene->_customDest.x >= 209 && _scene->_customDest.x <= 278)
+ _vm->_dialogs->show(10403);
+ else if (_scene->_customDest.x >= 107 && _scene->_customDest.x <= 190)
+ _vm->_dialogs->show(10422);
+ else if (_globals[kTapestryStatus] == 1 || _globals[kTapestryStatus] == 3)
+ _vm->_dialogs->show(10460);
+ else
+ _vm->_dialogs->show(10423);
+ } else
+ _vm->_dialogs->show(10439);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RUG)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10405);
+ else
+ _vm->_dialogs->show(10439);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FIREPLACE_SCREEN)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10407);
+ else
+ _vm->_dialogs->show(10439);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_THRONE_ROOM)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10409);
+ else
+ _vm->_dialogs->show(10434);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SCONCE)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10410);
+ else
+ _vm->_dialogs->show(10440);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WOOD_BASKET)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10411);
+ else
+ _vm->_dialogs->show(10439);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TROPHY)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10412);
+ else
+ _vm->_dialogs->show(10441);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_READING_BENCH)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10414);
+ else
+ _vm->_dialogs->show(10439);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LOVESEAT)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10416);
+ else
+ _vm->_dialogs->show(10439);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_HALLWAY)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10421);
+ else
+ _vm->_dialogs->show(10434);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SECRET_DOOR)) {
+ _vm->_dialogs->show(10430);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isObject(NOUN_DOORWAY) || _action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY) || _action.isAction(VERB_OPEN, NOUN_DOORWAY)) && (_globals[kPlayerPersona] == 1)) {
+ _vm->_dialogs->show(10432);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK, NOUN_WALL_PANEL)) {
+ if ((_globals[kBooksStatus] == 0) || (_globals[kBooksStatus] == 1))
+ _vm->_dialogs->show(10435);
+ else
+ _vm->_dialogs->show(10436);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_KING) && _globals[kPlayerPersona] == 1) {
+ _vm->_dialogs->show(10443);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MUSIC_BOX) && _globals[kNoLoadWalker]) {
+ _vm->_dialogs->showItem(OBJ_MAGIC_MUSIC_BOX, 843, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MACMORN) && (_globals[kPlayerPersona] == 1)) {
+ _vm->_dialogs->show(10444);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TABLE)) {
+ if (_globals[kPlayerPersona] == 1)
+ _vm->_dialogs->show(10455);
+ else if (_scene->_customDest.x < 174)
+ _vm->_dialogs->show(10451);
+ else
+ _vm->_dialogs->show(10448);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DECORATION)) {
+ if (_globals[kPlayerPersona] == 1)
+ _vm->_dialogs->show(10439);
+ else
+ _vm->_dialogs->show(10449);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SWORD)) {
+ if (_globals[kPlayerPersona] == 1)
+ _vm->_dialogs->show(10439);
+ else
+ _vm->_dialogs->show(10450);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR) && (_globals[kPlayerPersona] == 1)) {
+ _vm->_dialogs->show(10439);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL) && (_globals[kPlayerPersona] == 1)) {
+ _vm->_dialogs->show(10439);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CANDLESTICK)) {
+ if (_globals[kPlayerPersona] == 1)
+ _vm->_dialogs->show(10439);
+ else
+ _vm->_dialogs->show(10461);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_QUEEN_MOTHER)) {
+ _vm->_dialogs->show(10456);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MACMORN)) {
+ _vm->_dialogs->show(10444);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_RUG)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10406);
+ else
+ _vm->_dialogs->show(10445);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_FIREPLACE_SCREEN)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10408);
+ else
+ _vm->_dialogs->show(10445);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_TROPHY)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10413);
+ else
+ _vm->_dialogs->show(10445);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_READING_BENCH)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10415);
+ else
+ _vm->_dialogs->show(10445);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_LOVESEAT)) {
+ if (_globals[kPlayerPersona] == 0)
+ _vm->_dialogs->show(10417);
+ else
+ _vm->_dialogs->show(10445);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && (_action.isObject(NOUN_SECRET_DOOR) || _action.isObject(NOUN_WALL_PANEL))) {
+ _vm->_dialogs->show(10431);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_INVOKE, NOUN_SIGNET_RING) && (_globals[kPlayerPersona] == 1)) {
+ _vm->_dialogs->show(10433);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PUT, NOUN_TENTACLE_PARTS, NOUN_WALL_PANEL) && (_globals[kPlayerPersona] == 0)) {
+ _vm->_dialogs->show(10446);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_SHIFT_INTO_BEAR) && _anim0ActvFl) {
+ if (_wasBearFl)
+ _vm->_dialogs->show(10457);
+ else if (_amuletWorksFl)
+ _vm->_dialogs->show(10459);
+ else {
+ _wasBearFl = true;
+ _globals[kPlayerScore] += 2;
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportValue(1);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+ if (_globals[kLlanieStatus] != 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_ATTACK, NOUN_SWORD, NOUN_MACMORN) || _action.isAction(VERB_CARVE_UP, NOUN_SWORD, NOUN_MACMORN) || _action.isAction(VERB_THRUST, NOUN_SWORD, NOUN_MACMORN) || _action.isAction(VERB_TAKE, NOUN_SWORD)) && _anim0ActvFl) {
+ _activateTimerFl = false;
+ _pidStatus = 6;
+
+ if (!_amuletWorksFl) {
+ _globals[kPlayerScore] += 5;
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(1);
+ _vm->_gameConv->exportValue(0);
+ if (_globals[kLlanieStatus] != 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+
+ _vm->_gameConv->hold();
+ } else {
+ _macStatus = 6;
+ _game._player._stepEnabled = false;
+ }
+ _amuletWorksFl = true;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_INVOKE, NOUN_AMULET) && _anim0ActvFl) {
+ if (_amuletWorksFl) {
+ _activateTimerFl = false;
+ _pidStatus = 5;
+ _globals[kPlayerScore] += 15;
+ _globals[kAmuletStatus] = 2;
+ _game._player._stepEnabled = false;
+
+ _scene->freeAnimation(_globals._animationIndexes[1]);
+
+ _globals._sequenceIndexes[14] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[14], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 6);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[14], SYNC_CLOCK, 0);
+
+ _globals._spriteIndexes[15] = _scene->_sprites.addSprites(formAnimName('e', 3), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('m', 2), 0);
+ _anim1ActvFl = false;
+ _anim5ActvFl = true;
+ } else
+ _vm->_dialogs->showItem(OBJ_AMULET, 945, 0);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_ATTACK, NOUN_SWORD, NOUN_QUEEN_MOTHER) || _action.isAction(VERB_CARVE_UP, NOUN_SWORD, NOUN_QUEEN_MOTHER) || _action.isAction(VERB_THRUST, NOUN_SWORD, NOUN_QUEEN_MOTHER)) {
+ _vm->_dialogs->show(10458);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_MACMORN)) {
+ _vm->_dialogs->show(10464);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_QUEEN_MOTHER)) {
+ _vm->_dialogs->show(10463);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_KING)) {
+ _vm->_dialogs->show(10465);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_POUR_CONTENTS_OF, NOUN_MACMORN)) {
+ _vm->_dialogs->show(10462);
+ _action._inProgress = false;
+ return;
+ }
+
+
+ if (_anim2ActvFl && (_action.isAction(VERB_WALK_ACROSS) || _action.isAction(VERB_WALK_TO))) {
+ _vm->_dialogs->show(10445);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CANDLESTICK)) {
+ _vm->_dialogs->show(10468);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_MUSIC_BOX) && _globals[kNoLoadWalker]) {
+ _vm->_dialogs->show(10470);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene104::preActions() {
+ if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_OPEN) || _action.isAction(VERB_CLOSE) || _action.isAction(VERB_PUSH))
+ && _action.isObject(NOUN_TAPESTRY) && (_scene->_customDest.x > 280))
+ _game._player.walk(Common::Point(295, 145), FACING_NORTHEAST);
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_THRONE_ROOM)
+ || _action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_HALLWAY)
+ || _action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)
+ || ((_action.isAction(VERB_PULL) || _action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH)) && _action.isObject(NOUN_TAPESTRY))
+ || ((_action.isAction(VERB_PULL) || _action.isAction(VERB_CLOSE) || _action.isAction(VERB_PUSH)) && _action.isObject(NOUN_TAPESTRY))
+ || ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL))
+ && (_action.isObject(NOUN_RUG) || _action.isObject(NOUN_FIREPLACE_SCREEN) || _action.isObject(NOUN_TROPHY) || _action.isObject(NOUN_LOVESEAT)))
+ || _action.isAction(VERB_OPEN, NOUN_READING_BENCH)) {
+ if (_globals[kPlayerPersona] == 1)
+ _game._player.cancelWalk();
+ }
+
+ if (_globals[kNoLoadWalker])
+ _game._player._needToWalk = false;
+}
+
+void Scene104::handleFinalConversation() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 11:
+ _deathTimer = 0;
+ _clock = 0;
+ _activateTimerFl = true;
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 14:
+ if (!_game._trigger)
+ _macStatus = 3;
+
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 17:
+ _pidStatus = 3;
+ _vm->_gameConv->hold();
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 20:
+ if (!_game._trigger)
+ _macStatus = 2;
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 30:
+ *_vm->_gameConv->_nextStartNode = 31;
+ _vm->_gameConv->abortConv();
+
+ if (_globals[kLlanieStatus] == 2) {
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('l', 1), 0);
+ _anim3ActvFl = true;
+ _twinklesStatus = 1;
+ }
+ break;
+
+ case 38:
+ _globals[kEndOfGame] = true;
+ _scene->_nextSceneId = 106;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 81:
+ switch (_action._activeAction._verbId) {
+ case 0:
+ case 2:
+ case 4:
+ case 5:
+ case 7:
+ case 8:
+ case 11:
+ case 17:
+ if (_macStatus == 0)
+ _macStatus = 1;
+
+ _pidStatus = 0;
+ if (_queenStatus != 2)
+ _queenStatus = 0;
+
+ _kingStatus = 0;
+ break;
+
+ case 1:
+ case 3:
+ case 6:
+ case 20:
+ case 22:
+ case 24:
+ case 26:
+ case 28:
+ case 32:
+ case 34:
+ case 39:
+ case 41:
+ case 43:
+ _kingStatus = 1;
+ _pidStatus = 0;
+ if (_queenStatus != 2)
+ _queenStatus = 0;
+
+ if (_macStatus == 1)
+ _macStatus = 0;
+
+ break;
+
+ case 21:
+ case 23:
+ case 25:
+ case 27:
+ case 35:
+ case 40:
+ case 42:
+ if (_queenStatus != 2)
+ _queenStatus = 1;
+
+ _pidStatus = 0;
+ if (_macStatus == 1)
+ _macStatus = 0;
+
+ _kingStatus = 0;
+ break;
+
+ case 31:
+ case 33:
+ _twinklesStatus = 1;
+ _pidStatus = 0;
+ if (_queenStatus != 2)
+ _queenStatus = 0;
+
+ if (_macStatus == 1)
+ _macStatus = 0;
+
+ _kingStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 83:
+ if ((_action._activeAction._verbId == 8) || (_action._activeAction._verbId == 11))
+ _pidStatus = 2;
+ else
+ _pidStatus = 1;
+
+ if (_macStatus == 1)
+ _macStatus = 0;
+
+ if (_queenStatus != 2)
+ _queenStatus = 0;
+
+ _kingStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(83);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(81);
+
+ _kingCount = 0;
+ _queenCount = 0;
+ _macCount = 0;
+ _twinklesCount = 0;
+ _pidCount = 0;
+}
+
+void Scene104::handleKingAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _kingFrame)
+ return;
+
+ _kingFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_kingFrame) {
+ case 14:
+ case 21:
+ switch (_kingStatus) {
+ case 0:
+ if (_kingCount > _vm->getRandomNumber(40, 50)) {
+ _kingCount = 0;
+ if (_vm->getRandomNumber(1,2) == 1)
+ resetFrame = 13;
+ else
+ resetFrame = 14;
+ } else {
+ ++_kingCount;
+ resetFrame = 13;
+ }
+ break;
+
+ case 1:
+ resetFrame = 14;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 16:
+ case 17:
+ case 18:
+ case 19:
+ switch (_kingStatus) {
+ case 0:
+ if (_kingCount > _vm->getRandomNumber(40, 50)) {
+ _kingCount = 0;
+ if (_vm->getRandomNumber(1,2) == 1)
+ resetFrame = 15;
+ else
+ resetFrame = 19;
+ } else {
+ ++_kingCount;
+ resetFrame = 15;
+ }
+ break;
+
+ case 1:
+ resetFrame = _vm->getRandomNumber(16, 18);
+ ++_kingCount;
+ if (_kingCount > 15) {
+ _kingStatus = 0;
+ _kingCount = 0;
+ resetFrame = 15;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 22:
+ if (_kingStatus == 2)
+ resetFrame = 21;
+ else
+ resetFrame = 0;
+
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _kingFrame = resetFrame;
+ }
+}
+
+
+void Scene104::handleMacAnimation1() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _macFrame)
+ return;
+
+ _macFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_macFrame) {
+ case 1:
+ case 2:
+ case 7:
+ switch (_macStatus) {
+ case 0:
+ resetFrame = 0;
+ break;
+
+ case 1:
+ if (_macCount == 0) {
+ if (_vm->getRandomNumber(1,2) == 1)
+ resetFrame = 2;
+ else
+ resetFrame = 1;
+
+ ++_macCount;
+ } else {
+ resetFrame = _vm->getRandomNumber(0, 1);
+ ++_macCount;
+ if (_macCount > 15) {
+ _macStatus = 0;
+ _macCount = 0;
+ resetFrame = 0;
+ }
+ }
+ break;
+
+ case 2:
+ resetFrame = 90;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ case 4:
+ case 5:
+ switch (_macStatus) {
+ case 0:
+ case 2:
+ case 3:
+ case 4:
+ resetFrame = 5;
+ break;
+
+ case 1:
+ if (_macCount == 0) {
+ if (_vm->getRandomNumber(1,2) == 1)
+ resetFrame = 5;
+ else
+ resetFrame = 3;
+
+ ++_macCount;
+
+ } else {
+ resetFrame = _vm->getRandomNumber(3, 4);
+ ++_macCount;
+ if (_macCount > 15) {
+ _macStatus = 0;
+ _macCount = 0;
+ resetFrame = 5;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 25:
+ _game._player._stepEnabled = true;
+ break;
+
+ case 26:
+ case 90:
+ case 174:
+ switch (_macStatus) {
+ case 3:
+ resetFrame = 76;
+ _macStatus = 0;
+ _game._player._stepEnabled = false;
+ break;
+
+ case 4:
+ break;
+
+ case 5:
+ resetFrame = 147;
+ _macStatus = 0;
+ break;
+
+ case 6:
+ _pidFrame = 105;
+ resetFrame = 26;
+ _scene->setAnimFrame(_globals._animationIndexes[4], 105);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[4], SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ default:
+ resetFrame = 25;
+ break;
+ }
+ break;
+
+ case 36:
+ _globals._sequenceIndexes[13] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[13], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 13);
+ break;
+
+ case 37:
+ _scene->setAnimFrame(_globals._animationIndexes[4], 89);
+ _pidFrame = 89;
+ _pidStatus = 7;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[4], SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ case 76:
+ _vm->_gameConv->reset(1);
+ _vm->_dialogs->show(10467);
+ _globals[kNoLoadWalker] = false;
+ _scene->_nextSceneId = 119;
+ break;
+
+ case 82:
+ _pidStatus = 4;
+ break;
+
+ case 97:
+ _activateTimerFl = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 10, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 85);
+ break;
+
+ case 112:
+ resetFrame = 8;
+ _macStatus = 0;
+ break;
+
+ case 162:
+ _vm->_gameConv->release();
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _macFrame = resetFrame;
+ }
+}
+
+
+void Scene104::handleMacAnimation2() {
+
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _macFrame)
+ return;
+
+ _macFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_macFrame) {
+ case 1:
+ if (_macStatus != 4)
+ resetFrame = 0;
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[14]);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[14], SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ case 37:
+ _scene->freeAnimation(_globals._animationIndexes[1]);
+ _scene->_sprites.remove(_globals._spriteIndexes[15]);
+ _anim5ActvFl = false;
+ resetFrame = -1;
+
+ _vm->_dialogs->show(10426);
+ _vm->_sound->command(45);
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(1);
+ if (_globals[kLlanieStatus] != 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _macFrame = resetFrame;
+ }
+}
+
+void Scene104::handleQueenAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame() == _queenFrame)
+ return;
+
+ _queenFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_queenFrame) {
+ case 1:
+ case 8:
+ case 15:
+ case 24:
+ switch (_queenStatus) {
+ case 0:
+ if (_queenCount > _vm->getRandomNumber(40, 50)) {
+ _queenCount = 0;
+ if (_vm->getRandomNumber(1,2) == 1)
+ resetFrame = 0;
+ else
+ resetFrame = 8;
+ } else {
+ ++_queenCount;
+ resetFrame = 0;
+ }
+ break;
+
+ case 1:
+ if (_vm->getRandomNumber(1,2) == 1)
+ resetFrame = 1;
+ else
+ resetFrame = 15;
+
+ _queenStatus = 0;
+ break;
+
+ case 2:
+ resetFrame = 8;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 12:
+ case 29:
+ switch (_queenStatus) {
+ case 0:
+ if (_queenCount > _vm->getRandomNumber(40, 50)) {
+ _queenCount = 0;
+ if (_vm->getRandomNumber(1,2) == 1)
+ resetFrame = 11;
+ else
+ resetFrame = 12;
+ } else {
+ ++_queenCount;
+ resetFrame = 11;
+ }
+ break;
+
+ case 1:
+ resetFrame = 12;
+ break;
+
+ case 2:
+ resetFrame = 24;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 27:
+ switch (_queenStatus) {
+ case 0:
+ case 1:
+ resetFrame = 27;
+ break;
+
+ case 2:
+ resetFrame = 26;
+ break;
+
+ case 3:
+ resetFrame = 27;
+ _queenStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], resetFrame);
+ _queenFrame = resetFrame;
+ }
+}
+
+void Scene104::handleTwinklesAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == _twinklesFrame)
+ return;
+
+ _twinklesFrame = _scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_twinklesFrame) {
+ case 1:
+ if (_twinklesStatus == 2)
+ resetFrame = 0;
+ break;
+
+ case 10:
+ _queenStatus = 2;
+ break;
+
+ case 28:
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(1);
+ if (_globals[kLlanieStatus] != 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ break;
+
+ case 36:
+ _queenStatus = 3;
+ break;
+
+ case 37:
+ case 38:
+ case 47:
+ switch (_twinklesStatus) {
+ case 0:
+ if (_twinklesFrame != 37 && _twinklesFrame != 38)
+ _twinklesFrame = 38;
+
+ if (_twinklesCount > _vm->getRandomNumber(40, 50)) {
+ _twinklesCount = 0;
+ if (_vm->getRandomNumber(1, 2) == 1)
+ resetFrame = 36;
+ else
+ resetFrame = 37;
+ } else {
+ ++_twinklesCount;
+ resetFrame = _twinklesFrame - 1;
+ }
+ break;
+
+ case 1:
+ resetFrame = 38;
+ _twinklesStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], resetFrame);
+ _twinklesFrame = resetFrame;
+ }
+}
+
+void Scene104::handleDeathAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[4]]->getCurrentFrame() == _deathFrame)
+ return;
+
+ _deathFrame = _scene->_animation[_globals._animationIndexes[4]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ if (_deathFrame == 11)
+ _scene->playSpeech(7);
+ else if (_deathFrame == 17)
+ _scene->playSpeech(6);
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[4], resetFrame);
+ _deathFrame = resetFrame;
+ }
+}
+
+void Scene104::handlePidAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[4]]->getCurrentFrame() == _pidFrame)
+ return;
+
+ _pidFrame = _scene->_animation[_globals._animationIndexes[4]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_pidFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 9:
+ case 47:
+ case 81:
+ switch (_pidStatus) {
+ case 0:
+ resetFrame = 0;
+ break;
+
+ case 1:
+ resetFrame = _vm->getRandomNumber(0, 2);
+ ++_pidCount;
+ if (_pidCount > 20) {
+ _pidStatus = 0;
+ _pidCount = 0;
+ resetFrame = 0;
+ }
+ break;
+
+ case 2:
+ resetFrame = 3;
+ break;
+
+ case 3:
+ _activateTimerFl = false;
+ resetFrame = 10;
+ break;
+
+ case 5:
+ _game._player._stepEnabled = false;
+ _activateTimerFl = false;
+ resetFrame = 47;
+ _pidStatus = 0;
+ break;
+
+ case 6:
+ resetFrame = 81;
+ break;
+
+ case 8:
+ _scene->freeAnimation(_globals._animationIndexes[1]);
+ _scene->freeAnimation(_globals._animationIndexes[4]);
+ _anim1ActvFl = false;
+ _anim4ActvFl = false;
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('d', 2), 95);
+ _anim6ActvFl = true;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[4], SYNC_CLOCK, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ if (_pidStatus == 2) {
+ resetFrame = _vm->getRandomNumber(4, 6);
+ ++_pidCount;
+ if (_pidCount > 20) {
+ _pidStatus = 0;
+ _pidCount = 0;
+ resetFrame = 7;
+ }
+ } else
+ resetFrame = 7;
+ break;
+
+ case 24:
+ _vm->_gameConv->release();
+ break;
+
+ case 25:
+ if (_pidStatus == 4) {
+ resetFrame = 25;
+ _pidStatus = 0;
+ } else
+ resetFrame = 24;
+ break;
+
+ case 46:
+ _activateTimerFl = true;
+ _clock = 0;
+ _deathTimer = 0;
+ _game._player._stepEnabled = true;
+ break;
+
+ case 60:
+ resetFrame = 107;
+ break;
+
+ case 62:
+ _macStatus = 4;
+ break;
+
+ case 88:
+ if (_deathTimer < 1300)
+ _macStatus = 5;
+ break;
+
+ case 89:
+ if (_pidStatus == 5) {
+ resetFrame = 55;
+ _pidStatus = 0;
+ } else if (_deathTimer >= 1300)
+ _macStatus = 6;
+ else {
+ _pidDrawnSword = true;
+ resetFrame = 88;
+ }
+ break;
+
+ case 91:
+ _scene->playSpeech(7);
+ break;
+
+ case 95:
+ _scene->playSpeech(6);
+ break;
+
+ case 105:
+ resetFrame = 104;
+ break;
+
+ case 106:
+ if (_pidStatus == 7)
+ resetFrame = 89;
+ else
+ resetFrame = 105;
+ break;
+
+ case 111:
+ resetFrame = 60;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[4], resetFrame);
+ _pidFrame = resetFrame;
+ }
+}
+/*------------------------------------------------------------------------*/
+
+Scene105::Scene105(MADSEngine *vm) : Scene1xx(vm) {
+ _maidTalkingFl = false;
+ _sitUpFl = false;
+ _goodNumberFl = false;
+
+ _maidFrame = -1;
+ _newStatus = -1;
+ _previousStatus = -1;
+ _maidHotspotId1 = -1;
+ _maidHotspotId2 = -1;
+ _bucketHotspotId = -1;
+ _boneHotspotId = -1;
+ _gobletHotspotId = -1;
+}
+
+void Scene105::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_maidTalkingFl);
+ s.syncAsByte(_sitUpFl);
+ s.syncAsByte(_goodNumberFl);
+
+ s.syncAsSint16LE(_maidFrame);
+ s.syncAsSint16LE(_newStatus);
+ s.syncAsSint16LE(_previousStatus);
+ s.syncAsSint16LE(_maidHotspotId1);
+ s.syncAsSint16LE(_maidHotspotId2);
+ s.syncAsSint16LE(_bucketHotspotId);
+ s.syncAsSint16LE(_boneHotspotId);
+ s.syncAsSint16LE(_gobletHotspotId);
+}
+
+void Scene105::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_SCULLERY_MAID);
+ _scene->addActiveVocab(NOUN_BUCKET);
+ _scene->addActiveVocab(VERB_WALK_TO);
+ _scene->addActiveVocab(NOUN_BONE);
+ _scene->addActiveVocab(NOUN_GOBLET);
+}
+
+void Scene105::enter() {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*KGRD_8");
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 0);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 0, 3);
+
+ _maidHotspotId1 = _scene->_dynamicHotspots.add(NOUN_SCULLERY_MAID, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(189, 123, 189 + 25, 123 + 11));
+ _scene->_dynamicHotspots.setPosition(_maidHotspotId1, Common::Point(174, 151), FACING_NORTHEAST);
+ _scene->_dynamicHotspots[_maidHotspotId1]._articleNumber = PREP_ON;
+
+ _maidHotspotId2 = _scene->_dynamicHotspots.add(NOUN_SCULLERY_MAID, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(189, 134, 189 + 38, 134 + 9));
+ _scene->_dynamicHotspots.setPosition(_maidHotspotId2, Common::Point(174, 151), FACING_NORTHEAST);
+ _scene->_dynamicHotspots[_maidHotspotId2]._articleNumber = PREP_ON;
+
+ _bucketHotspotId = _scene->_dynamicHotspots.add(NOUN_BUCKET, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(176, 137, 176 + 10, 137 + 8));
+ _scene->_dynamicHotspots.setPosition(_bucketHotspotId, Common::Point(174, 151), FACING_NORTHEAST);
+
+ if (_game._objects.isInRoom(OBJ_GOBLET)) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('p', 1));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*KGRM_6");
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _gobletHotspotId = _scene->_dynamicHotspots.add(NOUN_GOBLET, VERB_WALK_TO, SYNTAX_SINGULAR, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0));
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 6);
+ _scene->_dynamicHotspots.setPosition(_gobletHotspotId, Common::Point(63, 142), FACING_WEST);
+ }
+
+ if (_game._objects.isInRoom(OBJ_BONE)) {
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*KGRL_6");
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, -1);
+ _boneHotspotId = _scene->_dynamicHotspots.add(NOUN_BONE, VERB_WALK_TO, SYNTAX_SINGULAR, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0));
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6);
+ _scene->_dynamicHotspots.setPosition(_boneHotspotId, Common::Point(255, 145), FACING_EAST);
+ }
+
+ _vm->_gameConv->get(2);
+ _newStatus = 1;
+ _previousStatus = 0;
+ _maidTalkingFl = false;
+ _sitUpFl = false;
+ _goodNumberFl = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('A',-1), 1);
+
+
+ if (_scene->_priorSceneId == 106) {
+ _game._player._playerPos = Common::Point(104, 152);
+ _game._player._facing = FACING_NORTHEAST;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12);
+ } else if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 6);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12);
+ _game._player.firstWalk(Common::Point(120, 96), FACING_SOUTH, Common::Point(117, 108), FACING_SOUTH, false);
+ _game._player.setWalkTrigger(70);
+ } else {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene105::step() {
+ if (_scene->_animation[_globals._animationIndexes[0]]) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() != _maidFrame) {
+ _maidFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ if (_sitUpFl && !_maidTalkingFl) {
+ _previousStatus = _newStatus;
+ _newStatus = 4;
+ }
+
+ if (_maidTalkingFl) {
+ _previousStatus = _newStatus;
+ _newStatus = 5;
+ }
+
+ switch (_maidFrame) {
+ case 16:
+ if (_newStatus == 1) {
+ _goodNumberFl = false;
+ while (!_goodNumberFl)
+ setRandomStatus();
+ }
+
+ if (_newStatus == 1)
+ resetFrame = 1;
+ else if ((_newStatus == 3 && !_sitUpFl) || _newStatus == 4)
+ resetFrame = 53;
+ else if ((_newStatus == 3) && (_sitUpFl))
+ resetFrame = 24;
+ break;
+
+ case 24:
+ if (_newStatus == 2) {
+ _goodNumberFl = false;
+ while (!_goodNumberFl)
+ setRandomStatus();
+ }
+
+ if ((_newStatus == 3) || (_newStatus == 5))
+ resetFrame = 53;
+ else if (_newStatus == 1)
+ resetFrame = 56;
+ else if (_newStatus == 4)
+ resetFrame = 53;
+
+ break;
+
+ case 32:
+ if (_newStatus == 3) {
+ _goodNumberFl = false;
+ while (!_goodNumberFl)
+ setRandomStatus();
+ }
+
+ if ((_newStatus == 1) || (_newStatus == 2))
+ resetFrame = 57;
+ else if (_newStatus == 4)
+ resetFrame = 55;
+ break;
+
+ case 53:
+ _maidTalkingFl = false;
+ _goodNumberFl = false;
+ while (!_goodNumberFl)
+ setRandomStatus();
+
+ if (_newStatus == 1)
+ resetFrame = 60;
+ else if (_newStatus == 2)
+ resetFrame = 57;
+ else if (_newStatus == 3)
+ resetFrame = 63;
+ else if (_newStatus == 4)
+ resetFrame = 55;
+ break;
+
+ case 56:
+ if (_newStatus == 4) {
+ _goodNumberFl = false;
+ while (!_goodNumberFl)
+ setRandomWipebrow();
+ }
+
+ if (_newStatus == 4)
+ resetFrame = 55;
+ else if (_newStatus == 5)
+ resetFrame = 32;
+ else if (_newStatus == 3)
+ resetFrame = 24;
+ break;
+
+ case 57:
+ if (_newStatus == 1)
+ resetFrame = 1;
+ break;
+
+ case 60:
+ if (_newStatus == 1)
+ resetFrame = 1;
+ else if (_newStatus == 2)
+ resetFrame = 16;
+ break;
+
+ case 63:
+ if (_newStatus == 1)
+ resetFrame = 1;
+ break;
+
+ case 64:
+ resetFrame = 24;
+ break;
+
+ default:
+ break;
+ }
+
+ if ((resetFrame >= 0) && (resetFrame != _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame())) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _maidFrame = resetFrame;
+ }
+ }
+ }
+
+ if (_game._trigger >= 70) {
+ switch (_game._trigger) {
+ case 70:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 5);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ break;
+
+ case 71: {
+ int seqIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_SEQ, seqIdx);
+ _game._player._stepEnabled = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Scene105::actions() {
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(10501);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 2) {
+ handleConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_HALLWAY) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_HALLWAY) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_HALLWAY)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[4] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[4], false, 8, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[4],true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 2, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2: {
+ int seqIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_SEQ, seqIdx);
+ }
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[4]);
+ _scene->_sequences.addTimer(1,4);
+ break;
+
+ case 4:
+ _game._player.walk(Common::Point(120, 96), FACING_NORTH);
+ _game._player.setWalkTrigger(5);
+ break;
+
+ case 5:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 6);
+ break;
+
+ case 6: {
+ int seqIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_SEQ, seqIdx);
+ _scene->_sequences.addTimer(6, 7);
+ }
+ break;
+
+ case 7:
+ _scene->_nextSceneId = 103;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_THRONE_ROOM) || _action.isAction(VERB_OPEN, NOUN_DOOR_TO_THRONE_ROOM) || _action.isAction(VERB_PULL, NOUN_DOOR_TO_THRONE_ROOM)) {
+ _scene->_nextSceneId = 106;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_SCULLERY_MAID)) {
+ _vm->_gameConv->run(2);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_GOBLET)) {
+ if (_game._trigger || !_game._objects.isInInventory(OBJ_GOBLET)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 6, 2);
+ _scene->_sequences.setAnimRange (_globals._sequenceIndexes[8], 1, 7);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 7, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence (_globals._sequenceIndexes[5]);
+ _scene->_dynamicHotspots.remove(_gobletHotspotId);
+ _vm->_sound->command(26);
+ _game._objects.addToInventory(OBJ_GOBLET);
+ _vm->_dialogs->showItem(OBJ_GOBLET, 10519, 0);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _globals[kPlayerScore] += 1;
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_BONE) && _action._mainObjectSource == CAT_HOTSPOT) {
+ if (_game._trigger || !_game._objects.isInInventory(OBJ_BONE)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[7] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[7], false, 6, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[7], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 6, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence (_globals._sequenceIndexes[6]);
+ _vm->_sound->command(26);
+ _scene->_dynamicHotspots.remove(_boneHotspotId);
+ _game._objects.addToInventory(OBJ_BONE);
+ _vm->_dialogs->showItem(OBJ_BONE, 10520, 0);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[7]);
+ if (!(_globals[kPlayerScoreFlags] & 2048)) {
+ _globals[kPlayerScoreFlags] |= 2048;
+ _globals[kPlayerScore] += 1;
+ }
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_BONE) && _game._objects.isInInventory(OBJ_BONE) && (_action._mainObjectSource == CAT_HOTSPOT)) {
+ _vm->_dialogs->show(40112);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(10502);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BRAZIER)) {
+ _vm->_dialogs->show(10503);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DINING_TABLE)) {
+ if (_scene->_customDest.x <= 98) {
+ if (_game._objects[OBJ_GOBLET]._roomNumber == _scene->_currentSceneId)
+ _vm->_dialogs->show(10505);
+ else
+ _vm->_dialogs->show(10522);
+ } else
+ _vm->_dialogs->show(10504);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHAIR)) {
+ _vm->_dialogs->show(10507);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WINDOW)) {
+ _vm->_dialogs->show(10508);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TAPESTRY)) {
+ _vm->_dialogs->show(10509);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_THRONE_ROOM)) {
+ _vm->_dialogs->show(10511);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10512);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_HALLWAY)) {
+ _vm->_dialogs->show(10513);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DIVIDING_WALL)) {
+ _vm->_dialogs->show(10514);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(10515);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SCULLERY_MAID)) {
+ _vm->_dialogs->show(10516);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GOBLET) && _game._objects.isInRoom(OBJ_GOBLET)) {
+ _vm->_dialogs->show(10517);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BONE) && _game._objects.isInRoom(OBJ_BONE)) {
+ _vm->_dialogs->show(10518);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SCONCE)) {
+ _vm->_dialogs->show(10524);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BUCKET)) {
+ _vm->_dialogs->show(10521);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_SCULLERY_MAID)) {
+ _vm->_dialogs->show(30);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_DINING_TABLE)) {
+ _vm->_dialogs->show(10506);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_TAPESTRY)) {
+ _vm->_dialogs->show(10510);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene105::preActions() {
+ if (_action.isAction(VERB_TALK_TO, NOUN_SCULLERY_MAID))
+ _sitUpFl = true;
+}
+
+void Scene105::setRandomStatus() {
+ _previousStatus = _newStatus;
+ int rndVal = _vm->getRandomNumber(1, 30);
+ if (rndVal < 20) {
+ _newStatus = 1;
+ _goodNumberFl = true;
+ } else if ((rndVal > 19) && (rndVal < 27) && (_previousStatus != 2)) {
+ _newStatus = 2;
+ _goodNumberFl = true;
+ } else if (_previousStatus != 3) {
+ _newStatus = 3;
+ _goodNumberFl = true;
+ }
+}
+
+void Scene105::setRandomWipebrow() {
+ _previousStatus = _newStatus;
+
+ if (_vm->getRandomNumber(1, 100) < 100) {
+ _newStatus = 4;
+ _goodNumberFl = true;
+ } else if (_previousStatus != 3) {
+ _newStatus = 3;
+ _goodNumberFl = true;
+ }
+}
+
+void Scene105::handleConversation() {
+ if ((_action._activeAction._verbId == 0) && !_sitUpFl)
+ _sitUpFl = true;
+
+ if ((_action._activeAction._verbId == 1) || (_action._activeAction._verbId == 2)) {
+ switch (_game._trigger) {
+ case 0:
+ _vm->_gameConv->setInterlocutorTrigger(1);
+ break;
+
+ case 1:
+ _maidTalkingFl = true;
+ _sitUpFl = false;
+ _vm->_gameConv->setHeroTrigger(2);
+ break;
+
+ case 2:
+ _maidTalkingFl = false;
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+} // End of namespace Dragonsphere
+} // End of namespace MADS
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes1.h b/engines/mads/dragonsphere/dragonsphere_scenes1.h
new file mode 100644
index 0000000000..fe51ed4135
--- /dev/null
+++ b/engines/mads/dragonsphere/dragonsphere_scenes1.h
@@ -0,0 +1,188 @@
+/* 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 MADS_DRAGON_SCENES1_H
+#define MADS_DRAGON_SCENES1_H
+
+#include "common/scummsys.h"
+#include "common/serializer.h"
+#include "mads/game.h"
+#include "mads/scene.h"
+#include "mads/dragonsphere/dragonsphere_scenes.h"
+
+namespace MADS {
+
+namespace Dragonsphere {
+
+class Scene1xx : public DragonsphereScene {
+protected:
+ /**
+ * Plays an appropriate sound when entering a scene
+ */
+ void sceneEntrySound();
+
+ /**
+ *Sets the AA file to use for the scene
+ */
+ void setAAName();
+
+ /**
+ * Updates the prefix used for getting player sprites for the scene
+ */
+ void setPlayerSpritesPrefix();
+public:
+ Scene1xx(MADSEngine *vm) : DragonsphereScene(vm) {}
+};
+
+class Scene101 : public Scene1xx {
+public:
+ Scene101(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene102 : public Scene1xx {
+private:
+ int _diaryHotspotIdx1;
+ int _diaryHotspotIdx2;
+ int _diaryFrame;
+ int _animRunning;
+
+public:
+ Scene102(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene103 : public Scene1xx {
+public:
+ Scene103(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene104 : public Scene1xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ bool _anim4ActvFl;
+ bool _anim5ActvFl;
+ bool _anim6ActvFl;
+ bool _activateTimerFl;
+ bool _wasBearFl;
+ bool _amuletWorksFl;
+ bool _pidDrawnSword;
+ int _animationRunning;
+ int _deathTimer;
+ int _deathFrame;
+ int _doorwayHotspotId;
+
+ int _kingStatus;
+ int _kingFrame;
+ int _kingCount;
+ int _queenStatus;
+ int _queenFrame;
+ int _queenCount;
+ int _pidStatus;
+ int _pidFrame;
+ int _pidCount;
+ int _macStatus;
+ int _macFrame;
+ int _macCount;
+ int _twinklesStatus;
+ int _twinklesFrame;
+ int _twinklesCount;
+ int _tapestryFrame;
+
+ int32 _clock;
+
+ void handleFinalConversation();
+ void handleKingAnimation();
+ void handleMacAnimation1();
+ void handleMacAnimation2();
+ void handleQueenAnimation();
+ void handleTwinklesAnimation();
+ void handleDeathAnimation();
+ void handlePidAnimation();
+
+public:
+ Scene104(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene105 : public Scene1xx {
+private:
+ bool _maidTalkingFl;
+ bool _sitUpFl;
+ bool _goodNumberFl;
+
+ int _maidFrame;
+ int _maidHotspotId1;
+ int _maidHotspotId2;
+ int _newStatus;
+ int _previousStatus;
+ int _bucketHotspotId;
+ int _boneHotspotId;
+ int _gobletHotspotId;
+
+ void setRandomStatus();
+ void setRandomWipebrow();
+ void handleConversation();
+
+public:
+ Scene105(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+} // End of namespace Dragonsphere
+} // End of namespace MADS
+
+#endif /* MADS_DRAGON_SCENES1_H */
diff --git a/engines/mads/dragonsphere/game_dragonsphere.cpp b/engines/mads/dragonsphere/game_dragonsphere.cpp
index b07eab9daa..f528056a54 100644
--- a/engines/mads/dragonsphere/game_dragonsphere.cpp
+++ b/engines/mads/dragonsphere/game_dragonsphere.cpp
@@ -28,7 +28,7 @@
#include "mads/msurface.h"
#include "mads/dragonsphere/game_dragonsphere.h"
//#include "mads/nebular/dialogs_nebular.h"
-//#include "mads/nebular/globals_nebular.h"
+#include "mads/dragonsphere/globals_dragonsphere.h"
#include "mads/dragonsphere/dragonsphere_scenes.h"
namespace MADS {
diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h
index b57f8833c6..b9eb86af64 100644
--- a/engines/mads/dragonsphere/game_dragonsphere.h
+++ b/engines/mads/dragonsphere/game_dragonsphere.h
@@ -26,7 +26,7 @@
#include "common/scummsys.h"
#include "mads/game.h"
#include "mads/globals.h"
-//#include "mads/nebular/globals_nebular.h"
+#include "mads/dragonsphere/globals_dragonsphere.h"
namespace MADS {
@@ -80,7 +80,7 @@ enum InventoryObject {
OBJ_DIAMOND_DUST = 40,
OBJ_RUBY_RING = 41,
OBJ_GOLD_NUGGET = 42,
- OBJ_MUSIC_BOX = 43,
+ OBJ_MAGIC_MUSIC_BOX = 43,
OBJ_EMERALD = 44,
OBJ_PARCHMENT = 45,
OBJ_GAME = 46,
@@ -88,15 +88,6 @@ enum InventoryObject {
OBJ_NEW_BUNDLE = 48
};
-// HACK: A stub for now, remove from here once it's implemented properly
-class DragonsphereGlobals : public Globals {
-public:
- DragonsphereGlobals() {
- resize(210); // Rex has 210 globals
- }
- virtual ~DragonsphereGlobals() {}
-};
-
class GameDragonsphere : public Game {
friend class Game;
protected:
diff --git a/engines/mads/dragonsphere/globals_dragonsphere.cpp b/engines/mads/dragonsphere/globals_dragonsphere.cpp
new file mode 100644
index 0000000000..fa05ed97c2
--- /dev/null
+++ b/engines/mads/dragonsphere/globals_dragonsphere.cpp
@@ -0,0 +1,51 @@
+/* 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 "common/scummsys.h"
+#include "common/config-manager.h"
+#include "mads/dragonsphere/globals_dragonsphere.h"
+
+namespace MADS {
+
+namespace Dragonsphere {
+
+DragonsphereGlobals::DragonsphereGlobals()
+ : Globals() {
+ // Initialize lists
+ resize(140);
+ _spriteIndexes.resize(30);
+ _sequenceIndexes.resize(30);
+ _animationIndexes.resize(30);
+}
+
+void DragonsphereGlobals::synchronize(Common::Serializer &s) {
+ Globals::synchronize(s);
+
+ _spriteIndexes.synchronize(s);
+ _sequenceIndexes.synchronize(s);
+ _animationIndexes.synchronize(s);
+}
+
+
+} // End of namespace Dragonsphere
+
+} // End of namespace MADS
diff --git a/engines/mads/dragonsphere/globals_dragonsphere.h b/engines/mads/dragonsphere/globals_dragonsphere.h
new file mode 100644
index 0000000000..cc0e42eb43
--- /dev/null
+++ b/engines/mads/dragonsphere/globals_dragonsphere.h
@@ -0,0 +1,184 @@
+/* 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 MADS_GLOBALS_DRAGONSPHERE_H
+#define MADS_GLOBALS_DRAGONSPHERE_H
+
+#include "common/scummsys.h"
+#include "common/array.h"
+#include "mads/game.h"
+#include "mads/resources.h"
+
+namespace MADS {
+
+namespace Dragonsphere {
+
+enum GlobalId {
+ // Global variables
+
+ kWalkerTiming = 0,
+ kWalkerTiming2 = 1,
+ kPlayerPersona = 10,
+ kPlayerScore = 11,
+ kDragonHighScene = 12,
+ kDragonMyScene = 13,
+ kNoLoadWalker = 14,
+ kPlayerScoreFlags = 15,
+ kSorcerorDefeated = 16,
+ kPreRoom = 17,
+ kPerformDisplacements = 18,
+
+ kKingStatus = 20,
+ kWardStatus = 21,
+ kTalkedToSoptus = 22,
+ kTalkedToShifter = 23,
+ kAmuletStatus = 24,
+ kBooksStatus = 25,
+ kTapestryStatus = 26,
+ kTalkedToMerchant = 27,
+ kCanViewCrownHole = 28,
+ kTalkedToStatus = 29,
+
+ kGuardPidStatus = 30,
+ kCrawledOutOfBed101 = 31,
+ kStatueIsOnStairway114 = 32,
+ kDogIsAsleep = 33,
+ kCrystalBallDead = 34,
+ kThrewBone = 35,
+ kWoodenDoorOpen = 36,
+ kKingIsInStairwell = 37,
+ kLlanieStatus = 38,
+ kNoTalkToGuard = 39,
+
+ kObjectGiven201 = 40,
+ kKingGotStabbed = 41,
+ kGivenObjectBefore = 42,
+ kGuardsAreAsleep = 43,
+ kDomeUp = 44,
+ kTalkedToWise = 45,
+ kDollGiven = 46,
+ kResetConv = 47,
+ kTalkedToGreta = 48,
+ kSlimeHealed = 49,
+
+ kDanceMusicOn = 50,
+ kPlayerIsSeal = 51,
+ kVinesHavePlayer = 52,
+ kEndOfGame = 53,
+ kResetConv2 = 54,
+ kInvokedFrom111 = 55,
+
+ kSaveWinsInDesert = 60,
+ kBubblesUpIn301 = 61,
+ kBubbleWontAttack = 62,
+ kPidLookedAtDoll = 63,
+
+ kOasis = 80,
+ kFireHoles = 81,
+ kDesertRoom = 82,
+ kFromDirection = 83,
+ kDesertCounter = 84,
+ kMoveDirection409 = 85,
+ kHealVerbsVisible = 86,
+ kGrapesHaveGrown = 87,
+ kPidTalkShamon = 88,
+ kPidJustDied = 89,
+
+ kGrapesAreDead = 90,
+ kRocIsChewingDates = 91,
+ kWinsInDesert = 92,
+ kWinsTillPrize = 93,
+ kPidHasBeenHealedSop = 94,
+ kGamePoints = 95,
+ kDancePoints = 96,
+ kCluePoints = 97,
+ kPrizesOwedToPlayer = 98,
+ kObjectFlags = 99,
+
+ kWaterfallDiverted = 100,
+ kShakStatus = 101,
+ kMaxGridValue = 102,
+ kMoveDirection510 = 103,
+ kShak506Angry = 104,
+ kMonsterIsDead = 105,
+ kDoneTalkingLani502 = 106,
+ kFoundLani504 = 107,
+ kSaidUseSwordShak = 108,
+ kGobletFilledSoporific = 109,
+
+ kBeenIn504AsPid = 110,
+ kSeenLaniDeadFirstTime = 111,
+ kSaidPoemIn504 = 112,
+ kTriedToHealLlanie504 = 113,
+ kPutBundleOnLlanie504 = 114,
+ kMake504Empty = 115,
+ kHasTakenMud = 116,
+ kPlatformClicked606 = 117,
+ kHadSpiritBundle = 118,
+
+ kMudIsInEye603 = 120,
+ kRopeIsAlive = 121,
+ kRatCageIsOpen = 122,
+ kFlaskOnPlate = 123,
+ kFluidIsDripping = 124,
+ kHoleIsIn607 = 125,
+ kRopeIsHangingIn607 = 126,
+ kObjectIsInFreezer605 = 127,
+ kObjectImitated = 128,
+ kHasRed = 129,
+
+ kHasYellow = 130,
+ kHasBlue = 131,
+ kWizardDead = 132,
+ kVineWillGrab = 133,
+ kFloorIsCool = 134,
+ kRatMelted = 135,
+ kDoorIsCool = 136,
+ kUsedElevator = 137,
+ kBeenOnTopFloor = 138,
+ kTorchIsIn609 = 139,
+
+ kGridPosition = 140
+ };
+
+class DragonsphereGlobals : public Globals {
+public:
+ SynchronizedList _spriteIndexes;
+ SynchronizedList _sequenceIndexes;
+ SynchronizedList _animationIndexes;
+public:
+ /**
+ * Constructor
+ */
+ DragonsphereGlobals();
+
+ /**
+ * Synchronize the globals data
+ */
+ virtual void synchronize(Common::Serializer &s);
+};
+
+} // End of namespace Dragonsphere
+
+} // End of namespace MADS
+
+#endif /* MADS_GLOBALS_DRAGONSPHERE_H */
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 91f6cd5630..607b7a44a6 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -58,7 +58,7 @@ Game *Game::init(MADSEngine *vm) {
Game::Game(MADSEngine *vm)
: _vm(vm), _surface(nullptr), _objects(vm), _scene(vm),
- _screenObjects(vm), _player(vm) {
+ _screenObjects(vm), _player(vm) {
_sectionNumber = 1;
_priorSectionNumber = 0;
_loadGameSlot = -1;
@@ -82,6 +82,7 @@ Game::Game(MADSEngine *vm)
_winStatus = 0;
_widepipeCtr = 0;
_fx = kTransitionNone;
+ _panningSpeed = 1; // Medium speed
// Load the inventory object list
_objects.load();
@@ -218,6 +219,10 @@ void Game::sectionLoop() {
}
_scene.loadScene(_scene._nextSceneId, _aaName, 0);
+ camInitDefault();
+ camSetSpeed();
+
+
_vm->_sound->pauseNewCommands();
if (!_player._spritesLoaded) {
@@ -297,8 +302,10 @@ void Game::sectionLoop() {
_vm->_events->waitCursor();
_kernelMode = KERNEL_ROOM_PRELOAD;
- delete _scene._activeAnimation;
- _scene._activeAnimation = nullptr;
+ for (int i = 0; i < 10; i++) {
+ delete _scene._animation[i];
+ _scene._animation[i] = nullptr;
+ }
_scene._reloadSceneFlag = false;
@@ -597,4 +604,221 @@ void Game::createThumbnail() {
::createThumbnail(_saveThumb, _vm->_screen.getData(), MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, thumbPalette);
}
+void Game::syncTimers(SyncType slaveType, int slaveId, SyncType masterType, int masterId) {
+ uint32 syncTime = 0;
+
+ switch (masterType) {
+ case SYNC_SEQ:
+ syncTime = _scene._sequences[masterId]._timeout;
+ break;
+
+ case SYNC_ANIM:
+ syncTime = _scene._animation[masterId]->getNextFrameTimer();
+ break;
+
+ case SYNC_CLOCK:
+ syncTime = _scene._frameStartTime + masterId;
+ break;
+
+ case SYNC_PLAYER:
+ syncTime = _player._priorTimer;
+ break;
+ }
+
+
+ switch (slaveType) {
+ case SYNC_SEQ:
+ _scene._sequences[slaveId]._timeout = syncTime;
+ break;
+
+ case SYNC_PLAYER:
+ _player._priorTimer = syncTime;
+ break;
+
+ case SYNC_ANIM:
+ _scene._animation[slaveId]->setNextFrameTimer(syncTime);
+ break;
+
+ case SYNC_CLOCK:
+ error("syncTimer is trying to force _frameStartTime");
+ }
+}
+
+void Game::camPanTo(Camera *camera, int target) {
+ if (!camera)
+ return;
+
+ if (camera->_panAllowedFl) {
+ camera->_activeFl = true;
+ camera->_manualFl = true;
+ camera->_target = target;
+ camera->_timer = _scene._frameStartTime;
+ }
+}
+
+void Game::camInitDefault() {
+ _camX._activeFl = false;
+ _camY._activeFl = false;
+
+ _camX._panAllowedFl = (_scene._sceneInfo->_width > MADS_SCREEN_WIDTH);
+ _camY._panAllowedFl = (_scene._sceneInfo->_height > MADS_SCENE_HEIGHT);
+
+ if (_camX._panAllowedFl) {
+ _camX._manualFl = false;
+ _camX._rate = 4;
+ _camX._speed = 4;
+ _camX._target = 0;
+ _camX._distOffCenter = 80;
+ _camX._startTolerance = 80;
+ _camX._endTolerance = 4;
+ _camX._timer = _scene._frameStartTime;
+ }
+
+ if (_camY._panAllowedFl) {
+ _camY._manualFl = true;
+ _camY._rate = 4;
+ _camY._speed = 2;
+ _camY._target = 0;
+ _camY._distOffCenter = 80;
+ _camY._startTolerance = 60;
+ _camY._endTolerance = 4;
+ _camY._timer = _scene._frameStartTime;
+ }
+}
+
+void Game::camSetSpeed() {
+ switch (_panningSpeed) {
+ case 1:
+ _camX._speed = 8;
+ _camY._speed = 4;
+ break;
+
+ case 2:
+ _camX._speed = 320;
+ _camY._speed = 160;
+ break;
+
+ default:
+ _camX._speed = 4;
+ _camY._speed = 2;
+ break;
+ }
+}
+
+void Game::camUpdate() {
+ bool any_pan = camPan(&_camX, &_scene._posAdjust.x, &_player._playerPos.x, 320, _scene._sceneInfo->_width);
+ any_pan |= camPan(&_camY, &_scene._posAdjust.y, &_player._playerPos.y, 156, _scene._sceneInfo->_height);
+
+ if (any_pan) {
+ _scene.setCamera(_scene._posAdjust);
+ _screenObjects._forceRescan = true;
+ }
+}
+
+bool Game::camPan(Camera *camera, int16 *picture_view, int16 *player_loc, int display_size, int picture_size) {
+ if (!camera)
+ return false;
+
+ bool panningFl = false;
+ if (camera->_panAllowedFl) {
+ camera->_currentFrameFl = false;
+
+ uint32 timer;
+ if ((abs((int32) (camera->_timer - _player._priorTimer)) < camera->_rate) && (_player._ticksAmount == camera->_rate))
+ timer = _player._priorTimer;
+ else
+ timer = camera->_timer;
+
+ if (camera->_activeFl && (_scene._frameStartTime < timer))
+ return (panningFl);
+
+ camera->_timer = _scene._frameStartTime + camera->_rate;
+
+ if (camera->_manualFl) {
+ if (camera->_activeFl) {
+ int diff = camera->_target - *picture_view;
+ int direction = 0;
+ if (diff < 0)
+ direction = -1;
+ else if (diff > 0)
+ direction = 1;
+
+ int magnitude = MIN(abs(diff), camera->_speed);
+
+ if (magnitude == 0)
+ camera->_activeFl = false;
+ else {
+ int panAmount;
+ if (direction < 0)
+ panAmount = -magnitude;
+ else
+ panAmount = magnitude;
+
+ *picture_view += panAmount;
+
+ panningFl = true;
+ camera->_currentFrameFl = true;
+ }
+ }
+ } else {
+ if (!camera->_activeFl) {
+ int lowEdge = *picture_view + camera->_startTolerance;
+ int highEdge = *picture_view - camera->_startTolerance + display_size - 1;
+
+ if ((*player_loc < lowEdge) && (picture_view > 0)) {
+ camera->_activeFl = true;
+ camera->_direction = -1;
+ }
+
+ if ((*player_loc > highEdge) && (*picture_view < (picture_size - display_size))) {
+ camera->_activeFl = true;
+ camera->_direction = 1;
+ }
+ }
+
+ int newTarget = *player_loc - (display_size >> 1);
+
+ if (camera->_direction < 0)
+ newTarget -= camera->_distOffCenter;
+ else
+ newTarget += camera->_distOffCenter;
+
+ newTarget = MAX(0, newTarget);
+ newTarget = MIN(newTarget, (picture_size - display_size));
+
+ camera->_target = newTarget;
+
+ int diff = newTarget - *picture_view;
+ int magnitude = abs(diff);
+
+ int direction = 0;
+ if (diff < 0)
+ direction = -1;
+ else if (diff > 0)
+ direction = 1;
+
+ if (camera->_activeFl && (magnitude <= camera->_endTolerance))
+ camera->_activeFl = false;
+
+ if (camera->_activeFl) {
+ magnitude = MIN(magnitude, camera->_speed);
+
+ int panAmount;
+ if (direction < 0)
+ panAmount = -magnitude;
+ else
+ panAmount = magnitude;
+
+ if (panAmount) {
+ *picture_view += panAmount;
+ panningFl = true;
+ camera->_currentFrameFl = true;
+ }
+ }
+ }
+ }
+
+ return (panningFl);
+}
+
} // End of namespace MADS
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 95b54b0d1a..0579d94b32 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -44,6 +44,11 @@ enum KernelMode {
KERNEL_ROOM_PRELOAD = 3, KERNEL_ROOM_INIT = 4, KERNEL_ACTIVE_CODE = 5
};
+enum SyncType {
+ SYNC_SEQ = 1, SYNC_PLAYER = 2, SYNC_ANIM = 3, SYNC_CLOCK = 4
+};
+
+
#define MADS_SAVEGAME_VERSION 1
struct MADSSavegameHeader {
@@ -142,6 +147,7 @@ public:
int _winStatus;
int _widepipeCtr;
int _loadGameSlot;
+ int _panningSpeed;
public:
virtual ~Game();
@@ -235,6 +241,32 @@ public:
* Creates a temporary thumbnail for use in saving games
*/
void createThumbnail();
+
+ void syncTimers(SyncType slaveType, int slaveId, SyncType masterType, int masterId);
+
+ typedef struct {
+ bool _panAllowedFl;
+ bool _activeFl;
+ bool _currentFrameFl;
+ bool _manualFl;
+
+ int _speed;
+ int _rate;
+ int _target;
+ int _distOffCenter;
+ int _startTolerance;
+ int _endTolerance;
+ int _direction;
+ uint32 _timer;
+ } Camera;
+ Camera _camX, _camY;
+
+ void camPanTo(Camera *camera, int target);
+ void camInitDefault();
+ void camSetSpeed();
+ void camUpdate();
+ bool camPan(Camera *camera, int16 *picture_view, int16 *player_loc, int display_size, int picture_size);
+
};
} // End of namespace MADS
diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp
index 8afef2e524..098313eca4 100644
--- a/engines/mads/hotspots.cpp
+++ b/engines/mads/hotspots.cpp
@@ -27,6 +27,7 @@ namespace MADS {
DynamicHotspot::DynamicHotspot() {
_seqIndex = 0;
+ _animIndex = -1;
_facing = FACING_NONE;
_descId = 0;
_verbId = 0;
@@ -52,6 +53,11 @@ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) {
_count = 0;
}
+int DynamicHotspots::add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds) {
+ warning("TODO: DynamicHotspots::add(5 params))");
+ return add(descId, verbId, seqIndex, bounds);
+}
+
int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rect &bounds) {
// Find a free slot
uint idx = 0;
@@ -69,6 +75,7 @@ int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rec
_entries[idx]._verbId = verbId;
_entries[idx]._articleNumber = PREP_IN;
_entries[idx]._cursor = CURSOR_NONE;
+ _entries[idx]._animIndex = -1;
++_count;
_changed = true;
@@ -101,6 +108,8 @@ void DynamicHotspots::remove(int index) {
if (index >= 0 && _entries[index]._active) {
if (_entries[index]._seqIndex >= 0)
scene._sequences[_entries[index]._seqIndex]._dynamicHotspotIndex = -1;
+ if (_entries[index]._animIndex >= 0)
+ scene._animation[_entries[index]._animIndex]->_dynamicHotspotIndex = -1;
_entries[index]._active = false;
--_count;
@@ -212,4 +221,16 @@ void Hotspots::activate(int vocabId, bool active) {
}
}
+void Hotspots::activateAtPos(int vocabId, bool active, Common::Point pos) {
+ for (uint idx = 0; idx < size(); ++idx) {
+ Hotspot &hotspot = (*this)[idx];
+ if ((hotspot._vocabId == vocabId) && (pos.x >= hotspot._bounds.left) &&
+ (pos.x <= hotspot._bounds.right) && (pos.y >= hotspot._bounds.top) &&
+ (pos.y <= hotspot._bounds.bottom)) {
+ hotspot._active = active;
+ _vm->_game->_screenObjects.setActive(CAT_HOTSPOT, idx, active);
+ }
+ }
+}
+
} // End of namespace MADS
diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h
index 902275bb21..ffd53e5a70 100644
--- a/engines/mads/hotspots.h
+++ b/engines/mads/hotspots.h
@@ -35,6 +35,7 @@ class DynamicHotspot {
public:
bool _active;
int _seqIndex;
+ int _animIndex;
Common::Rect _bounds;
Common::Point _feetPos;
Facing _facing;
@@ -54,7 +55,17 @@ public:
void synchronize(Common::Serializer &s);
};
-#define DYNAMIC_HOTSPOTS_SIZE 8
+#define DYNAMIC_HOTSPOTS_SIZE 16
+
+#define SYNTAX_SINGULAR 0
+#define SYNTAX_PLURAL 1
+#define SYNTAX_PARTITIVE 2
+#define SYNTAX_SINGULAR_MASC 3
+#define SYNTAX_SINGULAR_FEM 4
+#define SYNTAX_SINGULAR_LIVING 5
+#define SYNTAX_MASC_NOT_PROPER 6
+#define SYNTAX_FEM_NOT_PROPER 7
+#define MAX_SYNTAX 8
class DynamicHotspots {
private:
@@ -68,6 +79,7 @@ public:
Common::Array<MADS::DynamicHotspot>::size_type size() const { return _entries.size(); }
DynamicHotspot &operator[](uint idx) { return _entries[idx]; }
+ int add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds);
int add(int descId, int verbId, int seqIndex, const Common::Rect &bounds);
int setPosition(int index, const Common::Point &pos, Facing facing);
int setCursor(int index, CursorType cursor);
@@ -113,6 +125,12 @@ public:
* Sets the active state of a given hotspot
*/
void activate(int vocabId, bool active);
+
+ /**
+ * Sets the active state of a given hotspot if it includes a given position
+ */
+ void activateAtPos(int vocabId, bool active, Common::Point pos);
+
};
} // End of namespace MADS
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp
index 8c7b6b1ce3..0bdf484c9a 100644
--- a/engines/mads/mads.cpp
+++ b/engines/mads/mads.cpp
@@ -46,12 +46,14 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
_musicFlag = true;
_soundFlag = true;
_dithering = false;
+ _disableFastwalk = false;
_debugger = nullptr;
_dialogs = nullptr;
_events = nullptr;
_font = nullptr;
_game = nullptr;
+ _gameConv = nullptr;
_palette = nullptr;
_resources = nullptr;
_sound = nullptr;
@@ -65,6 +67,7 @@ MADSEngine::~MADSEngine() {
delete _font;
Font::deinit();
delete _game;
+ delete _gameConv;
delete _palette;
delete _resources;
delete _sound;
@@ -96,6 +99,14 @@ void MADSEngine::initialize() {
_audio = new AudioPlayer(_mixer, getGameID());
_game = Game::init(this);
+ switch (getGameID()) {
+ case GType_RexNebular:
+ _gameConv = nullptr;
+ break;
+ default:
+ _gameConv = new GameConversation(this);
+ }
+
loadOptions();
_screen.empty();
diff --git a/engines/mads/mads.h b/engines/mads/mads.h
index 901035320a..1b0f96a656 100644
--- a/engines/mads/mads.h
+++ b/engines/mads/mads.h
@@ -30,6 +30,7 @@
#include "common/util.h"
#include "engines/engine.h"
#include "graphics/surface.h"
+#include "mads/conversations.h"
#include "mads/debugger.h"
#include "mads/dialogs.h"
#include "mads/events.h"
@@ -96,6 +97,7 @@ public:
EventsManager *_events;
Font *_font;
Game *_game;
+ GameConversation * _gameConv;
Palette *_palette;
Resources *_resources;
ScreenSurface _screen;
@@ -108,6 +110,7 @@ public:
bool _musicFlag;
bool _soundFlag;
bool _dithering;
+ bool _disableFastwalk;
public:
MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc);
virtual ~MADSEngine();
diff --git a/engines/mads/menu_views.cpp b/engines/mads/menu_views.cpp
index cfc3b09461..10d5a2179a 100644
--- a/engines/mads/menu_views.cpp
+++ b/engines/mads/menu_views.cpp
@@ -1,24 +1,24 @@
/* 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.
- *
- */
+*
+* 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 "common/scummsys.h"
#include "mads/game.h"
@@ -254,6 +254,7 @@ void TextView::processCommand() {
sceneInfo->_width = MADS_SCREEN_WIDTH;
sceneInfo->_height = MADS_SCENE_HEIGHT;
_spareScreens[spareIndex].setSize(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT);
+
sceneInfo->loadMadsV1Background(screenId, "", SCENEFLAG_TRANSLATE,
_spareScreens[spareIndex]);
delete sceneInfo;
@@ -795,4 +796,40 @@ int AnimationView::getParameter() {
return result;
}
+void AnimationView::checkResource(const Common::String &resourceName) {
+ //bool hasSuffix = false;
+
+}
+
+int AnimationView::scanResourceIndex(const Common::String &resourceName) {
+ int foundIndex = -1;
+
+ if (_v1) {
+ const char *chP = strchr(resourceName.c_str(), '\\');
+ if (!chP) {
+ chP = strchr(resourceName.c_str(), '*');
+ }
+
+ Common::String resName = chP ? Common::String(chP + 1) : resourceName;
+
+ if (_v2 != 3) {
+ assert(_resIndex.size() == 0);
+ }
+
+ // Scan for the resource name
+ for (uint resIndex = 0; resIndex < _resIndex.size(); ++resIndex) {
+ ResIndexEntry &resEntry = _resIndex[resIndex];
+ if (resEntry._resourceName.compareToIgnoreCase(resourceName)) {
+ foundIndex = resIndex;
+ break;
+ }
+ }
+ }
+
+ if (foundIndex >= 0) {
+ // TODO
+ }
+ return -1;
+}
+
} // End of namespace MADS
diff --git a/engines/mads/menu_views.h b/engines/mads/menu_views.h
index 6c8a2a8bdd..c203248ad9 100644
--- a/engines/mads/menu_views.h
+++ b/engines/mads/menu_views.h
@@ -8,12 +8,20 @@
* 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.
+<<<<<<< HEAD
+
+=======
*
+>>>>>>> master
* 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.
+<<<<<<< HEAD
+
+=======
*
+>>>>>>> master
* 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.
@@ -119,8 +127,8 @@ protected:
virtual void doFrame();
/**
- * Called when the script is finished
- */
+ * Called when the script is finished
+ */
virtual void scriptDone();
public:
/**
@@ -191,6 +199,11 @@ private:
int _manualFrame2;
int _animFrameNumber;
bool _nextCyclingActive;
+private:
+ void checkResource(const Common::String &resourceName);
+
+ int scanResourceIndex(const Common::String &resourceName);
+
uint _scrollFrameCtr;
private:
void load();
diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp
index d88806150d..2bee77dae7 100644
--- a/engines/mads/messages.cpp
+++ b/engines/mads/messages.cpp
@@ -193,6 +193,10 @@ void KernelMessages::processText(int msgIndex) {
msg._timeout = 0;
}
+ if (msg._flags & KMSG_ANIM) {
+ warning("TODO: Implement animated text");
+ }
+
if ((msg._timeout <= 0) && (_vm->_game->_trigger == 0)) {
msg._flags |= KMSG_EXPIRE;
if (msg._trigger != 0) {
@@ -465,6 +469,16 @@ void KernelMessages::initRandomMessages(int maxSimultaneousMessages,
va_end(va);
}
+void KernelMessages::setAnim(int msgId, int seqId, int val3 = 0) {
+ if (msgId < 0)
+ return;
+
+ _entries[msgId]._flags |= KMSG_ANIM;
+ _entries[msgId]._sequenceIndex = seqId;
+
+ warning("TODO: KernelMessages::setAnim, unused parameter");
+}
+
/*------------------------------------------------------------------------*/
diff --git a/engines/mads/messages.h b/engines/mads/messages.h
index 764477a7fc..739b203b13 100644
--- a/engines/mads/messages.h
+++ b/engines/mads/messages.h
@@ -39,7 +39,7 @@ namespace MADS {
enum KernelMessageFlags {
KMSG_QUOTED = 1, KMSG_PLAYER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8,
KMSG_RIGHT_ALIGN = 0x10, KMSG_CENTER_ALIGN = 0x20, KMSG_EXPIRE = 0x40,
- KMSG_ACTIVE = 0x80
+ KMSG_ACTIVE = 0x80, KMSG_ANIM = 0x100
};
class MADSEngine;
@@ -104,6 +104,7 @@ public:
int addQuote(int quoteId, int endTrigger, uint32 timeout);
void scrollMessage(int msgIndex, int numTicks, bool quoted);
void setSeqIndex(int msgIndex, int seqIndex);
+ void setAnim(int msgId, int seqId, int val3);
void remove(int msgIndex);
void reset();
void update();
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index 7cb7a91e8c..c79a0edb26 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -3,10 +3,16 @@ MODULE := engines/mads
MODULE_OBJS := \
dragonsphere/game_dragonsphere.o \
dragonsphere/dragonsphere_scenes.o \
+ dragonsphere/dragonsphere_scenes1.o \
+ dragonsphere/globals_dragonsphere.o \
phantom/game_phantom.o \
phantom/globals_phantom.o \
phantom/phantom_scenes.o \
phantom/phantom_scenes1.o \
+ phantom/phantom_scenes2.o \
+ phantom/phantom_scenes3.o \
+ phantom/phantom_scenes4.o \
+ phantom/phantom_scenes5.o \
nebular/dialogs_nebular.o \
nebular/game_nebular.o \
nebular/globals_nebular.o \
@@ -26,6 +32,7 @@ MODULE_OBJS := \
assets.o \
audio.o \
compression.o \
+ conversations.o \
debugger.o \
detection.o \
dialogs.o \
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index 8f40bc15c8..5526845552 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -354,7 +354,7 @@ void GameNebular::setSectionHandler() {
void GameNebular::checkShowDialog() {
// Loop for showing dialogs, if any need to be shown
- if (_vm->_dialogs->_pendingDialog && (_player._stepEnabled || _winStatus)
+ if (_vm->_dialogs->_pendingDialog && (_player._stepEnabled || _winStatus)
&& !_globals[kCopyProtectFailed]) {
_player.releasePlayerSprites();
@@ -828,7 +828,7 @@ void GameNebular::unhandledAction() {
void GameNebular::step() {
if (_player._visible && _player._stepEnabled && !_player._moving &&
(_player._facing == _player._turnToFacing)) {
- if (_scene._frameStartTime >= *((uint32 *)&_globals[kWalkerTiming])) {
+ if (_scene._frameStartTime >= (uint32)_globals[kWalkerTiming]) {
if (!_player._stopWalkerIndex) {
int randomVal = _vm->getRandomNumber(29999);
if (_globals[kSexOfRex] == REX_MALE) {
@@ -877,19 +877,19 @@ void GameNebular::step() {
}
}
- *((uint32 *)&_globals[kWalkerTiming]) += 6;
+ _globals[kWalkerTiming] += 6;
}
}
// Below is countdown to set the timebomb off in room 604
if (_globals[kTimebombStatus] == TIMEBOMB_ACTIVATED) {
- int diff = _scene._frameStartTime - *((uint32 *)&_globals[kTimebombClock]);
- if ((diff >= 0) && (diff <= 60)) {
- *((uint32 *)&_globals[kTimebombTimer]) += diff;
- } else {
- ++*((uint32 *)&_globals[kTimebombTimer]);
- }
- *((uint32 *)&_globals[kTimebombClock]) = _scene._frameStartTime;
+ int diff = _scene._frameStartTime - _globals[kTimebombClock];
+ if ((diff >= 0) && (diff <= 60))
+ _globals[kTimebombTimer] += diff;
+ else
+ ++_globals[kTimebombTimer];
+
+ _globals[kTimebombClock] = (int) _scene._frameStartTime;
}
}
diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp
index 0cb1b11ee9..9207d87be7 100644
--- a/engines/mads/nebular/nebular_scenes1.cpp
+++ b/engines/mads/nebular/nebular_scenes1.cpp
@@ -258,32 +258,32 @@ void Scene101::step() {
break;
}
- if (_scene->_activeAnimation != nullptr) {
- if ((_scene->_activeAnimation->getCurrentFrame() >= 6) && (_messageNum == 0)) {
+ if (_scene->_animation[0] != nullptr) {
+ if ((_scene->_animation[0]->getCurrentFrame() >= 6) && (_messageNum == 0)) {
_messageNum++;
_scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(49));
_posY += 14;
}
- if ((_scene->_activeAnimation->getCurrentFrame() >= 7) && (_messageNum == 1)) {
+ if ((_scene->_animation[0]->getCurrentFrame() >= 7) && (_messageNum == 1)) {
_messageNum++;
_scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(54));
_posY += 14;
}
- if ((_scene->_activeAnimation->getCurrentFrame() >= 10) && (_messageNum == 2)) {
+ if ((_scene->_animation[0]->getCurrentFrame() >= 10) && (_messageNum == 2)) {
_messageNum++;
_scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(55));
_posY += 14;
}
- if ((_scene->_activeAnimation->getCurrentFrame() >= 17) && (_messageNum == 3)) {
+ if ((_scene->_animation[0]->getCurrentFrame() >= 17) && (_messageNum == 3)) {
_messageNum++;
_scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(56));
_posY += 14;
}
- if ((_scene->_activeAnimation->getCurrentFrame() >= 20) && (_messageNum == 4)) {
+ if ((_scene->_animation[0]->getCurrentFrame() >= 20) && (_messageNum == 4)) {
_messageNum++;
_scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(50));
_posY += 14;
@@ -1263,7 +1263,7 @@ void Scene102::actions() {
return;
}
- if (_action.isAction(VERB_LOOK, NOUN_BURGER) && (_action._mainObjectSource == 4)) {
+ if (_action.isAction(VERB_LOOK, NOUN_BURGER) && (_action._mainObjectSource == CAT_HOTSPOT)) {
_vm->_dialogs->show(801);
_action._inProgress = false;
}
@@ -1782,7 +1782,7 @@ void Scene104::step() {
if ((_game._player._special > 0) && _game._player._stepEnabled)
_game._player._stepEnabled = false;
- if (_kargShootingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) {
+ if (_kargShootingFl && (_scene->_animation[0]->getCurrentFrame() >= 19)) {
_scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52));
_kargShootingFl = false;
}
@@ -2079,7 +2079,7 @@ void Scene106::step() {
}
}
- if (_firstEmergingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) {
+ if (_firstEmergingFl && (_scene->_animation[0]->getCurrentFrame() >= 19)) {
_firstEmergingFl = false;
_scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52));
}
@@ -2263,7 +2263,7 @@ void Scene107::enter() {
}
void Scene107::step() {
- if (_shootingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) {
+ if (_shootingFl && (_scene->_animation[0]->getCurrentFrame() >= 19)) {
_scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52));
_shootingFl = false;
}
@@ -2295,7 +2295,7 @@ void Scene107::actions() {
_scene->_nextSceneId = 105;
else if (_action.isAction(VERB_LOOK, NOUN_NORTHERN_SEA_CLIFF))
_vm->_dialogs->show(10701);
- else if (_action.isAction(VERB_LOOK, NOUN_DEAD_FISH) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_DEAD_FISH) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(10702);
else if (_action.isAction(VERB_LOOK, NOUN_BUSH_LIKE_FORMATION))
_vm->_dialogs->show(10703);
@@ -2919,7 +2919,7 @@ void Scene110::actions() {
switch (_game._trigger) {
case 0:
_scene->loadAnimation(Resources::formatName(110, 'T', 0, EXT_AA, ""), 1);
- _scene->_activeAnimation->setNextFrameTimer(_game._player._ticksAmount + _game._player._priorTimer);
+ _scene->_animation[0]->setNextFrameTimer(_game._player._ticksAmount + _game._player._priorTimer);
_game._player._stepEnabled = false;
_game._player._visible = false;
break;
@@ -3066,7 +3066,7 @@ void Scene111::step() {
if (_game._trigger == 73)
_vm->_sound->command(37);
- if (_rexDivingFl && (_scene->_activeAnimation->getCurrentFrame() >= 9)) {
+ if (_rexDivingFl && (_scene->_animation[0]->getCurrentFrame() >= 9)) {
_vm->_sound->command(36);
_rexDivingFl = false;
}
@@ -3138,8 +3138,8 @@ void Scene112::enter() {
}
void Scene112::step() {
- if ((_scene->_activeAnimation != nullptr) && (_game._storyMode == STORYMODE_NICE)) {
- if (_scene->_activeAnimation->getCurrentFrame() >= 54) {
+ if ((_scene->_animation[0] != nullptr) && (_game._storyMode == STORYMODE_NICE)) {
+ if (_scene->_animation[0]->getCurrentFrame() >= 54) {
_scene->freeAnimation();
_game._trigger = 70;
}
diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp
index 1cbd6f56ef..7349677ab8 100644
--- a/engines/mads/nebular/nebular_scenes2.cpp
+++ b/engines/mads/nebular/nebular_scenes2.cpp
@@ -484,7 +484,7 @@ void Scene202::enter() {
}
_scene->loadAnimation(formAnimName('M', -1), 71);
- _scene->_activeAnimation->setCurrentFrame(200);
+ _scene->_animation[0]->setCurrentFrame(200);
} else {
if (_ladderTopFl) {
_game._player._visible = false;
@@ -596,7 +596,7 @@ void Scene202::step() {
break;
}
- if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) {
+ if (!_scene->_animation[0] && (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) {
int randVal = _vm->getRandomNumber(1, 500);
int threshold = 1;
if (_ladderTopFl)
@@ -615,11 +615,11 @@ void Scene202::step() {
}
}
- if (!_scene->_activeAnimation)
+ if (!_scene->_animation[0])
return;
if (_waitingMeteoFl) {
- if (_scene->_activeAnimation->getCurrentFrame() >= 200) {
+ if (_scene->_animation[0]->getCurrentFrame() >= 200) {
if ((_globals[kMeteorologistWatch] == METEOROLOGIST_TOWER) || _globals[kLadderBroken]) {
_scene->_nextSceneId = 213;
} else {
@@ -628,7 +628,7 @@ void Scene202::step() {
}
}
- if ((_scene->_activeAnimation->getCurrentFrame() == 160) && (_meteoFrame != _scene->_activeAnimation->getCurrentFrame())) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 160) && (_meteoFrame != _scene->_animation[0]->getCurrentFrame())) {
Common::Point msgPos;
int msgFlag;
if (!_ladderTopFl) {
@@ -647,15 +647,15 @@ void Scene202::step() {
_toTeleportFl = true;
}
- if (_scene->_activeAnimation->getCurrentFrame() == _meteoFrame) {
+ if (_scene->_animation[0]->getCurrentFrame() == _meteoFrame) {
return;
}
- _meteoFrame = _scene->_activeAnimation->getCurrentFrame();
+ _meteoFrame = _scene->_animation[0]->getCurrentFrame();
int randVal = _vm->getRandomNumber(1, 1000);
int frameStep = -1;
- switch (_scene->_activeAnimation->getCurrentFrame()) {
+ switch (_scene->_animation[0]->getCurrentFrame()) {
case 42:
case 77:
case 96:
@@ -693,8 +693,8 @@ void Scene202::step() {
break;
}
- if (frameStep >= 0 && frameStep != _scene->_activeAnimation->getCurrentFrame() + 1) {
- _scene->_activeAnimation->setCurrentFrame(frameStep);
+ if (frameStep >= 0 && frameStep != _scene->_animation[0]->getCurrentFrame() + 1) {
+ _scene->_animation[0]->setCurrentFrame(frameStep);
_meteoFrame = frameStep;
}
}
@@ -797,7 +797,7 @@ void Scene202::actions() {
_scene->_nextSceneId = 203;
} else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_NORTH)) {
if (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) {
- if (_scene->_activeAnimation)
+ if (_scene->_animation[0])
_globals[kMeteorologistStatus] = METEOROLOGIST_PRESENT;
else
_globals[kMeteorologistStatus] = METEOROLOGIST_ABSENT;
@@ -890,7 +890,7 @@ void Scene202::actions() {
_globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6);
_scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
_scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(172, 123));
- if (_scene->_activeAnimation) {
+ if (_scene->_animation[0]) {
_waitingMeteoFl = true;
_globals[kMeteorologistWatch] = METEOROLOGIST_GROUND;
} else {
@@ -898,7 +898,7 @@ void Scene202::actions() {
}
break;
case 2:
- if (!_scene->_activeAnimation && !_meteorologistSpecial) {
+ if (!_scene->_animation[0] && !_meteorologistSpecial) {
_vm->_dialogs->show(20222);
}
_scene->_sequences.remove(_globals._sequenceIndexes[10]);
@@ -932,13 +932,13 @@ void Scene202::actions() {
_globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2);
_scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(247, 82));
_scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
- if (_scene->_activeAnimation) {
- if (_scene->_activeAnimation->getCurrentFrame() > 200) {
+ if (_scene->_animation[0]) {
+ if (_scene->_animation[0]->getCurrentFrame() > 200) {
_scene->_sequences.addTimer(120, 2);
} else {
_waitingMeteoFl = true;
_globals[kMeteorologistWatch] = METEOROLOGIST_GONE;
- if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) {
+ if ((_scene->_animation[0]->getCurrentFrame() >= 44) && (_scene->_animation[0]->getCurrentFrame() <= 75)) {
_scene->_kernelMessages.reset();
int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100));
_scene->_kernelMessages.setQuoted(msgIndex, 4, false);
@@ -952,7 +952,7 @@ void Scene202::actions() {
}
break;
case 2:
- if (!_scene->_activeAnimation)
+ if (!_scene->_animation[0])
_vm->_dialogs->show(20222);
_meteorologistSpecial = false;
_scene->_sequences.remove(_globals._sequenceIndexes[10]);
@@ -1227,7 +1227,7 @@ void Scene205::enter() {
if (_globals[kSexOfRex] != SEX_MALE) {
_scene->loadAnimation(formAnimName('a', -1));
- _scene->_activeAnimation->_resetFlag = true;
+ _scene->_animation[0]->_resetFlag = true;
} else {
_beingKicked = true;
_globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0);
@@ -1379,8 +1379,8 @@ void Scene205::actions() {
_scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], -1);
_vm->_sound->command(27);
} else if (_game._trigger == 1) {
- if (_scene->_activeAnimation != nullptr)
- _scene->_activeAnimation->resetSpriteSetsCount();
+ if (_scene->_animation[0] != nullptr)
+ _scene->_animation[0]->resetSpriteSetsCount();
_vm->_dialogs->show(20516);
_scene->_reloadSceneFlag = true;
@@ -1405,9 +1405,9 @@ void Scene205::actions() {
_vm->_dialogs->show(20503);
else if (_action.isAction(VERB_LOOK, NOUN_HUT))
_vm->_dialogs->show(20504);
- else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(20505);
- else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(20506);
else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN_ON_SPIT))
_vm->_dialogs->show(20507);
@@ -1746,9 +1746,9 @@ void Scene208::enter() {
}
void Scene208::step() {
- if (_boundingFl && _scene->_activeAnimation &&
- (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) {
- _rhotundaTime = _scene->_activeAnimation->getCurrentFrame();
+ if (_boundingFl && _scene->_animation[0] &&
+ (_rhotundaTime <= _scene->_animation[0]->getCurrentFrame())) {
+ _rhotundaTime = _scene->_animation[0]->getCurrentFrame();
if (_rhotundaTime == 125)
_scene->_sequences.remove(_globals._sequenceIndexes[4]);
@@ -4064,7 +4064,7 @@ void Scene210::setDialogNode(int node) {
_vm->_palette->lock();
_scene->_kernelMessages.reset();
_scene->freeAnimation();
- _scene->_activeAnimation = nullptr;
+ _scene->_animation[0] = nullptr;
_scene->resetScene();
_globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1));
@@ -4263,8 +4263,8 @@ void Scene210::enter() {
}
restoreDialogNode(_curDialogNode, quote, number);
- if (_scene->_activeAnimation)
- _scene->_activeAnimation->setCurrentFrame(131);
+ if (_scene->_animation[0])
+ _scene->_animation[0]->setCurrentFrame(131);
}
_vm->_palette->setEntry(252, 63, 63, 10);
@@ -4274,9 +4274,9 @@ void Scene210::enter() {
}
void Scene210::step() {
- if ((_twinkleAnimationType == 1) && _scene->_activeAnimation) {
- if (_twinklesCurrentFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _twinklesCurrentFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_twinkleAnimationType == 1) && _scene->_animation[0]) {
+ if (_twinklesCurrentFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _twinklesCurrentFrame = _scene->_animation[0]->getCurrentFrame();
int reset_frame = -1;
int random = _vm->getRandomNumber(1, 1000);
@@ -4396,8 +4396,8 @@ void Scene210::step() {
}
if (reset_frame >= 0) {
- if (reset_frame != _scene->_activeAnimation->getCurrentFrame()) {
- _scene->_activeAnimation->setCurrentFrame(reset_frame);
+ if (reset_frame != _scene->_animation[0]->getCurrentFrame()) {
+ _scene->_animation[0]->setCurrentFrame(reset_frame);
_twinklesCurrentFrame = reset_frame;
}
@@ -4411,9 +4411,9 @@ void Scene210::step() {
}
}
- if ((_twinkleAnimationType == 2) && _scene->_activeAnimation) {
- if (_twinklesCurrentFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _twinklesCurrentFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_twinkleAnimationType == 2) && _scene->_animation[0]) {
+ if (_twinklesCurrentFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _twinklesCurrentFrame = _scene->_animation[0]->getCurrentFrame();
int reset_frame = -1;
if (_twinklesCurrentFrame == 53) {
@@ -4422,8 +4422,8 @@ void Scene210::step() {
} else if ((_twinklesCurrentFrame == 75) && _shouldTalk)
reset_frame = 60;
- if ((reset_frame >= 0) && (reset_frame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(reset_frame);
+ if ((reset_frame >= 0) && (reset_frame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(reset_frame);
_twinklesCurrentFrame = reset_frame;
}
}
@@ -4646,7 +4646,7 @@ void Scene211::enter() {
_game._player._stepEnabled = false;
_game._player._visible = false;
_scene->loadAnimation(formAnimName('A', -1), 100);
- _scene->_activeAnimation->setCurrentFrame(169);
+ _scene->_animation[0]->setCurrentFrame(169);
} else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
_game._player._playerPos = Common::Point(310, 31);
_game._player._facing = FACING_SOUTHWEST;
@@ -4725,8 +4725,8 @@ void Scene211::step() {
}
}
- if (_ambushFl && (_scene->_activeAnimation->getCurrentFrame() > _monkeyFrame)) {
- _monkeyFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_ambushFl && (_scene->_animation[0]->getCurrentFrame() > _monkeyFrame)) {
+ _monkeyFrame = _scene->_animation[0]->getCurrentFrame();
switch (_monkeyFrame) {
case 2: {
int msgIndex = _scene->_kernelMessages.add(Common::Point(12, 4), 0xFDFC, 0, 0, 60, _game.getQuote(157));
@@ -4798,9 +4798,9 @@ void Scene211::step() {
_wakeFl = false;
}
- if (_scene->_activeAnimation->getCurrentFrame() > _monkeyFrame) {
- _monkeyFrame = _scene->_activeAnimation->getCurrentFrame();
- switch (_scene->_activeAnimation->getCurrentFrame()) {
+ if (_scene->_animation[0]->getCurrentFrame() > _monkeyFrame) {
+ _monkeyFrame = _scene->_animation[0]->getCurrentFrame();
+ switch (_scene->_animation[0]->getCurrentFrame()) {
case 177: {
int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(165));
_scene->_kernelMessages.setQuoted(msgIndex, 4, true);
diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp
index 5a6edbf995..f9513b9bd3 100644
--- a/engines/mads/nebular/nebular_scenes3.cpp
+++ b/engines/mads/nebular/nebular_scenes3.cpp
@@ -293,8 +293,8 @@ void Scene302::step() {
if (_game._trigger == 71)
_scene->_nextSceneId = 303;
- if ((_scene->_activeAnimation != nullptr) && (_scene->_activeAnimation->getCurrentFrame() != _oldFrame)) {
- _oldFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_scene->_animation[0] != nullptr) && (_scene->_animation[0]->getCurrentFrame() != _oldFrame)) {
+ _oldFrame = _scene->_animation[0]->getCurrentFrame();
if (_oldFrame == 147) {
_game._objects.setRoom(OBJ_POISON_DARTS, 1);
_game._objects.setRoom(OBJ_BLOWGUN, 1);
@@ -828,23 +828,23 @@ void Scene307::enter() {
void Scene307::step() {
handleForceField(&_forceField, &_globals._spriteIndexes[0]);
- if ((_animationMode == 1) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() == 126) {
+ if ((_animationMode == 1) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() == 126) {
_forceField._flag = false;
_vm->_sound->command(5);
}
- if (_scene->_activeAnimation->getCurrentFrame() == 194) {
+ if (_scene->_animation[0]->getCurrentFrame() == 194) {
_forceField._flag = true;
_vm->_sound->command(24);
}
}
- if ((_animationMode == 2) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() == 54)
+ if ((_animationMode == 2) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() == 54)
_forceField._flag = false;
- if (_scene->_activeAnimation->getCurrentFrame() == 150) {
+ if (_scene->_animation[0]->getCurrentFrame() == 150) {
_game._player._visible = false;
_game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount;
}
@@ -869,7 +869,7 @@ void Scene307::step() {
}
_lastFrameTime = _scene->_frameStartTime;
- if ((_guardTime > 3000) && !_duringPeeingFl && (_scene->_activeAnimation == nullptr)
+ if ((_guardTime > 3000) && !_duringPeeingFl && (_scene->_animation[0] == nullptr)
&& (_game._screenObjects._inputMode != kInputConversation) && _globals[kMetBuddyBeast] && !_activePrisonerFl) {
if (!_game._objects.isInInventory(OBJ_SCALPEL) && !_grateOpenedFl) {
_game._player._stepEnabled = false;
@@ -879,7 +879,7 @@ void Scene307::step() {
_scene->loadAnimation(formAnimName('b', -1), 70);
}
_guardTime = 0;
- } else if ((_prisonerTimer > 300) && (_game._screenObjects._inputMode != kInputConversation) && (_scene->_activeAnimation == nullptr) && !_activePrisonerFl) {
+ } else if ((_prisonerTimer > 300) && (_game._screenObjects._inputMode != kInputConversation) && (_scene->_animation[0] == nullptr) && !_activePrisonerFl) {
if (!_globals[kMetBuddyBeast]) {
int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(_prisonerMessageId));
_scene->_kernelMessages.setQuoted(idx, 4, true);
@@ -1380,9 +1380,9 @@ void Scene309::enter() {
_game._player._stepEnabled = false;
_scene->loadAnimation(formAnimName('a', -1), 60);
- _characterSpriteIndexes[0] = _scene->_activeAnimation->_spriteListIndexes[2];
- _characterSpriteIndexes[1] = _scene->_activeAnimation->_spriteListIndexes[2];
- _characterSpriteIndexes[2] = _scene->_activeAnimation->_spriteListIndexes[1];
+ _characterSpriteIndexes[0] = _scene->_animation[0]->_spriteListIndexes[2];
+ _characterSpriteIndexes[1] = _scene->_animation[0]->_spriteListIndexes[2];
+ _characterSpriteIndexes[2] = _scene->_animation[0]->_spriteListIndexes[1];
_messagesIndexes[0] = -1;
_messagesIndexes[1] = -1;
@@ -1404,9 +1404,9 @@ void Scene309::step() {
if (_game._trigger == 62)
_messagesIndexes[2] = -1;
- if (_scene->_activeAnimation != nullptr) {
- if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _lastFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_scene->_animation[0] != nullptr) {
+ if (_lastFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _lastFrame = _scene->_animation[0]->getCurrentFrame();
if (_lastFrame == 39) {
_messagesIndexes[0] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 61, 210, _game.getQuote(348));
_messagesIndexes[1] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 0, 210, _game.getQuote(349));
@@ -1419,15 +1419,15 @@ void Scene309::step() {
if (_messagesIndexes[charIdx] >= 0) {
bool match = false;
int j = -1;
- for (j = _scene->_activeAnimation->_oldFrameEntry; j < _scene->_activeAnimation->_header._frameEntriesCount; j++) {
- if (_scene->_activeAnimation->_frameEntries[j]._spriteSlot._spritesIndex == _characterSpriteIndexes[charIdx]) {
+ for (j = _scene->_animation[0]->_oldFrameEntry; j < _scene->_animation[0]->_header._frameEntriesCount; j++) {
+ if (_scene->_animation[0]->_frameEntries[j]._spriteSlot._spritesIndex == _characterSpriteIndexes[charIdx]) {
match = true;
break;
}
}
if (match) {
- SpriteSlotSubset *curSpriteSlot = &_scene->_activeAnimation->_frameEntries[j]._spriteSlot;
+ SpriteSlotSubset *curSpriteSlot = &_scene->_animation[0]->_frameEntries[j]._spriteSlot;
_scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.x = curSpriteSlot->_position.x;
_scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.y = curSpriteSlot->_position.y - (50 + (14 * ((charIdx == 0) ? 2 : 1)));
}
@@ -2602,7 +2602,7 @@ void Scene318::enter() {
if (_globals[kAfterHavoc]) {
_scene->loadAnimation(formAnimName('f', -1));
- _scene->_activeAnimation->_resetFlag = true;
+ _scene->_animation[0]->_resetFlag = true;
} else if (!_globals[kHasSeenProfPyro]) {
_scene->_hotspots.activate(NOUN_PROFESSORS_GURNEY, false);
_scene->_hotspots.activate(NOUN_PROFESSOR, false);
@@ -2655,7 +2655,7 @@ void Scene318::enter() {
0x1C8, 0x1C9, 0x1CA, 0x1CB, 0x1CC, 0x1CD, 0x1CE, 0x1CF, 0x1D0, 0x1D1, 0x1D2, 0x1D3,
0x190, 0x19D, 0);
- if ((_scene->_priorSceneId == RETURNING_FROM_DIALOG) || (((_scene->_priorSceneId == 318) ||
+ if ((_scene->_priorSceneId == RETURNING_FROM_DIALOG) || (((_scene->_priorSceneId == 318) ||
(_scene->_priorSceneId == RETURNING_FROM_LOADING)) && (!_globals[kAfterHavoc]))) {
if (!_globals[kAfterHavoc]) {
_game._player._visible = false;
@@ -2705,9 +2705,9 @@ void Scene318::enter() {
}
void Scene318::step() {
- if ((_scene->_activeAnimation != nullptr) && (_animMode == 2)) {
- if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _lastFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_scene->_animation[0] != nullptr) && (_animMode == 2)) {
+ if (_lastFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _lastFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame = -1;
switch (_lastFrame) {
@@ -2759,8 +2759,8 @@ void Scene318::step() {
break;
}
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_lastFrame = nextFrame;
}
}
@@ -3185,11 +3185,11 @@ void Scene319::enter() {
}
void Scene319::step() {
- if (_scene->_activeAnimation == nullptr)
+ if (_scene->_animation[0] == nullptr)
return;
- if (_animFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _animFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_animFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _animFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame = -1;
if (_animMode == 1) {
switch (_animFrame) {
@@ -3305,8 +3305,8 @@ void Scene319::step() {
if ((_animMode == 4) && (_animFrame == 16))
_vm->_screen._shakeCountdown = 80;
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_animFrame = nextFrame;
}
}
@@ -3320,11 +3320,11 @@ void Scene319::step() {
_scene->freeAnimation();
_scene->loadAnimation(formAnimName('b', 0));
if (_nextAction1 == 3)
- _scene->_activeAnimation->setCurrentFrame(85);
+ _scene->_animation[0]->setCurrentFrame(85);
else if (_nextAction1 == 1)
- _scene->_activeAnimation->setCurrentFrame(40);
+ _scene->_animation[0]->setCurrentFrame(40);
- _animFrame = _scene->_activeAnimation->getCurrentFrame();
+ _animFrame = _scene->_animation[0]->getCurrentFrame();
_slacheTalkingFl = true;
_vm->_screen._shakeCountdown = 1;
@@ -3710,9 +3710,9 @@ void Scene320::enter() {
}
void Scene320::step() {
- if (_scene->_activeAnimation != nullptr) {
- if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _lastFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_scene->_animation[0] != nullptr) {
+ if (_lastFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _lastFrame = _scene->_animation[0]->getCurrentFrame();
switch (_lastFrame) {
case 95:
_blinkFl = true;
@@ -3892,8 +3892,8 @@ void Scene321::enter() {
}
void Scene321::step() {
- if (_scene->_activeAnimation != nullptr) {
- if ((_scene->_activeAnimation->getCurrentFrame() >= 260) && (_globals[kSexOfRex] == REX_MALE) && (_game._storyMode >= STORYMODE_NICE))
+ if (_scene->_animation[0] != nullptr) {
+ if ((_scene->_animation[0]->getCurrentFrame() >= 260) && (_globals[kSexOfRex] == REX_MALE) && (_game._storyMode >= STORYMODE_NICE))
_scene->_nextSceneId = 316;
}
@@ -5045,7 +5045,7 @@ void Scene359::actions() {
_vm->_dialogs->show(35918);
else if (_action.isAction(VERB_TAKE, NOUN_LIMB))
_vm->_dialogs->show(35919);
- else if (_action.isAction(VERB_LOOK, NOUN_SECURITY_CARD) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_SECURITY_CARD) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(35921);
else if (_action.isAction(VERB_LOOK, NOUN_BLOOD_STAIN)) {
if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359))
diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp
index c981f6a6e4..19e1fc792e 100644
--- a/engines/mads/nebular/nebular_scenes4.cpp
+++ b/engines/mads/nebular/nebular_scenes4.cpp
@@ -876,7 +876,7 @@ void Scene402::enter() {
_refuseAlienLiquor = false;
_scene->loadAnimation(Resources::formatName(402, 'd', 1, EXT_AA, ""));
- _scene->_activeAnimation->_resetFlag = true;
+ _scene->_animation[0]->_resetFlag = true;
_globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1);
_scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
@@ -1536,43 +1536,43 @@ void Scene402::step() {
if (_game._trigger == 32)
_rightWomanMoving = false;
- if (_scene->_activeAnimation->getCurrentFrame() == 1) {
+ if (_scene->_animation[0]->getCurrentFrame() == 1) {
switch (_vm->getRandomNumber(1, 50)) {
case 1:
- _scene->_activeAnimation->setCurrentFrame(2);
+ _scene->_animation[0]->setCurrentFrame(2);
break;
case 2:
- _scene->_activeAnimation->setCurrentFrame(7);
+ _scene->_animation[0]->setCurrentFrame(7);
break;
case 3:
- _scene->_activeAnimation->setCurrentFrame(11);
+ _scene->_animation[0]->setCurrentFrame(11);
break;
default:
- _scene->_activeAnimation->setCurrentFrame(0);
+ _scene->_animation[0]->setCurrentFrame(0);
break;
}
}
- if ((_scene->_activeAnimation->getCurrentFrame() == 4) && (_drinkTimer < 10)) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 4) && (_drinkTimer < 10)) {
++ _drinkTimer;
- _scene->_activeAnimation->setCurrentFrame(3);
+ _scene->_animation[0]->setCurrentFrame(3);
}
if (_drinkTimer == 10) {
_drinkTimer = 0;
- _scene->_activeAnimation->setCurrentFrame(4);
- _scene->_activeAnimation->_currentFrame = 5;
+ _scene->_animation[0]->setCurrentFrame(4);
+ _scene->_animation[0]->_currentFrame = 5;
}
- switch (_scene->_activeAnimation->getCurrentFrame()) {
+ switch (_scene->_animation[0]->getCurrentFrame()) {
case 6:
case 10:
case 14:
- _scene->_activeAnimation->setCurrentFrame(0);
+ _scene->_animation[0]->setCurrentFrame(0);
break;
default:
@@ -3126,36 +3126,36 @@ void Scene410::enter() {
sceneEntrySound();
_scene->loadAnimation(Resources::formatName(410, 'r', -1, EXT_AA, ""));
- _scene->_activeAnimation->_resetFlag = true;
+ _scene->_animation[0]->_resetFlag = true;
}
void Scene410::step() {
- if (_scene->_activeAnimation->getCurrentFrame() == 1) {
+ if (_scene->_animation[0]->getCurrentFrame() == 1) {
if (_vm->getRandomNumber(1, 30) == 1)
- _scene->_activeAnimation->setCurrentFrame(2);
+ _scene->_animation[0]->setCurrentFrame(2);
else
- _scene->_activeAnimation->setCurrentFrame(0);
+ _scene->_animation[0]->setCurrentFrame(0);
}
- if (_scene->_activeAnimation->getCurrentFrame() == 9) {
+ if (_scene->_animation[0]->getCurrentFrame() == 9) {
if (_vm->getRandomNumber(1, 30) == 1)
- _scene->_activeAnimation->setCurrentFrame(10);
+ _scene->_animation[0]->setCurrentFrame(10);
else
- _scene->_activeAnimation->setCurrentFrame(8);
+ _scene->_animation[0]->setCurrentFrame(8);
}
- if (_scene->_activeAnimation->getCurrentFrame() == 5) {
+ if (_scene->_animation[0]->getCurrentFrame() == 5) {
if (_vm->getRandomNumber(1, 30) == 1)
- _scene->_activeAnimation->setCurrentFrame(6);
+ _scene->_animation[0]->setCurrentFrame(6);
else
- _scene->_activeAnimation->setCurrentFrame(4);
+ _scene->_animation[0]->setCurrentFrame(4);
}
- if (_scene->_activeAnimation->getCurrentFrame() == 3) {
+ if (_scene->_animation[0]->getCurrentFrame() == 3) {
if (_vm->getRandomNumber(1, 2) == 1)
- _scene->_activeAnimation->setCurrentFrame(4);
+ _scene->_animation[0]->setCurrentFrame(4);
else // == 2
- _scene->_activeAnimation->setCurrentFrame(8);
+ _scene->_animation[0]->setCurrentFrame(8);
}
}
@@ -3491,7 +3491,7 @@ void Scene411::handleDialog() {
_game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount;
_game._player._visible = false;
_game._player._stepEnabled = false;
- _scene->_activeAnimation->setCurrentFrame(_resetFrame);
+ _scene->_animation[0]->setCurrentFrame(_resetFrame);
}
_scene->_kernelMessages.reset();
_newQuantity = computeQuoteAndQuantity();
@@ -3661,16 +3661,16 @@ void Scene411::enter() {
}
_scene->loadAnimation(formAnimName('a', -1));
- _scene->_activeAnimation->setCurrentFrame(128);
+ _scene->_animation[0]->setCurrentFrame(128);
_makeMushroomCloud = false;
_killRox = false;
}
void Scene411::step() {
- if (_scene->_activeAnimation != nullptr) {
- if (_curAnimationFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _curAnimationFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_scene->_animation[0] != nullptr) {
+ if (_curAnimationFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _curAnimationFrame = _scene->_animation[0]->getCurrentFrame();
_resetFrame = -1;
switch (_curAnimationFrame) {
@@ -3738,14 +3738,14 @@ void Scene411::step() {
break;
}
- if ((_resetFrame >= 0) && (_resetFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(_resetFrame);
+ if ((_resetFrame >= 0) && (_resetFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(_resetFrame);
_curAnimationFrame = _resetFrame;
}
}
}
- if (_scene->_activeAnimation->getCurrentFrame() == 86)
+ if (_scene->_animation[0]->getCurrentFrame() == 86)
_vm->_sound->command(59);
}
@@ -4113,10 +4113,10 @@ void Scene413::enter() {
}
void Scene413::step() {
- if (_scene->_activeAnimation && _scene->_activeAnimation->getCurrentFrame() == 38)
- _scene->_activeAnimation->setCurrentFrame(37);
+ if (_scene->_animation[0] && _scene->_animation[0]->getCurrentFrame() == 38)
+ _scene->_animation[0]->setCurrentFrame(37);
- if (_scene->_activeAnimation && _scene->_activeAnimation->getCurrentFrame() == 21 && _canMove) {
+ if (_scene->_animation[0] && _scene->_animation[0]->getCurrentFrame() == 21 && _canMove) {
_vm->_sound->command(27);
_canMove = false;
}
diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp
index 95eb429193..3778a59eb3 100644
--- a/engines/mads/nebular/nebular_scenes5.cpp
+++ b/engines/mads/nebular/nebular_scenes5.cpp
@@ -722,9 +722,9 @@ void Scene504::enter() {
}
void Scene504::step() {
- if ((_carAnimationMode == 1) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carAnimationMode == 1) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame;
if (_carFrame == 1)
@@ -732,8 +732,8 @@ void Scene504::step() {
else
nextFrame = -1;
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_carFrame = nextFrame;
}
}
@@ -943,15 +943,15 @@ void Scene505::enter() {
_game._player._stepEnabled = false;
_frame = -1;
_scene->loadAnimation(formAnimName('a', -1));
- _scene->_activeAnimation->setCurrentFrame(86);
+ _scene->_animation[0]->setCurrentFrame(86);
sceneEntrySound();
_vm->_sound->command(16);
}
void Scene505::step() {
- if (_frame != _scene->_activeAnimation->getCurrentFrame()) {
- _frame = _scene->_activeAnimation->getCurrentFrame();
+ if (_frame != _scene->_animation[0]->getCurrentFrame()) {
+ _frame = _scene->_animation[0]->getCurrentFrame();
int resetFrame = -1;
switch (_frame) {
@@ -1088,8 +1088,8 @@ void Scene505::step() {
break;
}
- if ((resetFrame >= 0) && (resetFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(resetFrame);
+ if ((resetFrame >= 0) && (resetFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(resetFrame);
_frame = resetFrame;
}
}
@@ -1254,7 +1254,7 @@ void Scene506::step() {
switch (_game._trigger) {
case 70:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(6, 71);
break;
@@ -1943,9 +1943,9 @@ void Scene511::enter() {
}
void Scene511::step() {
- if ((_lineAnimationMode == 1) && _scene->_activeAnimation) {
- if (_lineFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _lineFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_lineAnimationMode == 1) && _scene->_animation[0]) {
+ if (_lineFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _lineFrame = _scene->_animation[0]->getCurrentFrame();
int resetFrame = -1;
if ((_lineAnimationPosition == 2) && (_lineFrame == 14))
@@ -1961,8 +1961,8 @@ void Scene511::step() {
resetFrame = 2;
}
- if ((resetFrame >= 0) && (resetFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(resetFrame);
+ if ((resetFrame >= 0) && (resetFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(resetFrame);
_lineFrame = resetFrame;
}
}
@@ -1971,7 +1971,7 @@ void Scene511::step() {
switch (_game._trigger) {
case 70:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(6, 71);
break;
@@ -2009,7 +2009,7 @@ void Scene511::preActions() {
_scene->loadAnimation(formAnimName('R',2), 1);
} else if (_game._trigger == 1) {
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_game._objects.setRoom(OBJ_FISHING_LINE, 1);
_handingLine = false;
_game._player._stepEnabled = true;
@@ -2089,7 +2089,7 @@ void Scene511::actions() {
} else {
_vm->_dialogs->show(51130);
}
- } else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_BOAT) ||
+ } else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_BOAT) ||
_action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_BOAT)) {
if (_globals[kBoatRaised])
_vm->_dialogs->show(51131);
@@ -2118,8 +2118,8 @@ void Scene511::actions() {
_globals[kLineStatus] = 3;
_game._player._stepEnabled = true;
- if (_scene->_activeAnimation)
- _scene->_activeAnimation->eraseSprites();
+ if (_scene->_animation[0])
+ _scene->_animation[0]->eraseSprites();
_game._player.update();
}
}
@@ -2159,9 +2159,9 @@ void Scene511::actions() {
_vm->_dialogs->show(51128);
} else if (_action.isAction(VERB_LOOK, NOUN_PORTHOLE))
_vm->_dialogs->show(51122);
- else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 2))
+ else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == CAT_HOTSPOT) && (_globals[kLineStatus] == 2))
_vm->_dialogs->show(51126);
- else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 3))
+ else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == CAT_HOTSPOT) && (_globals[kLineStatus] == 3))
_vm->_dialogs->show(51133);
else if (_action.isAction(VERB_LOOK, NOUN_STATUE))
_vm->_dialogs->show(51127);
@@ -2434,8 +2434,8 @@ void Scene512::actions() {
_vm->_dialogs->show(51225);
else if (_action.isAction(VERB_LOOK, NOUN_PADLOCK_KEY) && _game._objects.isInRoom(OBJ_PADLOCK_KEY))
_vm->_dialogs->show(51215);
- else if (_action.isAction(VERB_LOOK, NOUN_FISHING_ROD) && (!_scene->_activeAnimation ||
- _scene->_activeAnimation->getCurrentFrame() == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_FISHING_ROD) && (!_scene->_animation[0] ||
+ _scene->_animation[0]->getCurrentFrame() == 4))
_vm->_dialogs->show(51216);
else if (_action.isAction(VERB_LOOK, NOUN_SHIPS_WHEEL))
_vm->_dialogs->show(51218);
@@ -2570,7 +2570,7 @@ void Scene513::step() {
switch (_game._trigger) {
case 70:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(6, 71);
break;
diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp
index d97e37ea0b..7098566f80 100644
--- a/engines/mads/nebular/nebular_scenes6.cpp
+++ b/engines/mads/nebular/nebular_scenes6.cpp
@@ -124,7 +124,7 @@ void Scene601::step() {
switch (_game._trigger) {
case 70:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(30, 71);
break;
@@ -431,7 +431,7 @@ void Scene602::actions() {
case 1: {
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_lastSpriteIdx = _globals._spriteIndexes[3];
_lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, -1);
_scene->_sequences.setDepth(_lastSequenceIdx, 14);
@@ -684,7 +684,7 @@ void Scene603::actions() {
_vm->_dialogs->show(60327);
else
_vm->_dialogs->show(60328);
- } else if (_action.isAction(VERB_LOOK, NOUN_COMPACT_CASE) && (_action._mainObjectSource == 4))
+ } else if (_action.isAction(VERB_LOOK, NOUN_COMPACT_CASE) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(60329);
// For the next two checks, the second part of the check wasn't surrounded par parenthesis, which was obviously wrong
else if (_action.isAction(VERB_LOOK) && (_action.isObject(NOUN_BRA) || _action.isObject(NOUN_BOA) || _action.isObject(NOUN_SLIP)))
@@ -775,7 +775,7 @@ void Scene604::step() {
switch (_game._trigger) {
case 70:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(30, 71);
break;
@@ -797,9 +797,9 @@ void Scene604::step() {
break;
}
- if (_monsterActive && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _monsterFrame) {
- _monsterFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_monsterActive && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _monsterFrame) {
+ _monsterFrame = _scene->_animation[0]->getCurrentFrame();
int nextMonsterFrame = -1;
switch (_monsterFrame) {
@@ -837,7 +837,7 @@ void Scene604::step() {
}
if ((nextMonsterFrame >= 0) && (nextMonsterFrame != _monsterFrame)) {
- _scene->_activeAnimation->setCurrentFrame(nextMonsterFrame);
+ _scene->_animation[0]->setCurrentFrame(nextMonsterFrame);
_monsterFrame = nextMonsterFrame;
}
}
@@ -1297,7 +1297,7 @@ void Scene607::step() {
switch (_game._trigger) {
case 80:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(6, 81);
break;
@@ -1331,7 +1331,7 @@ void Scene607::handleThrowingBone() {
case 1:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
if (_animationMode != 1)
_scene->_hotspots.activate(NOUN_OBNOXIOUS_DOG, false);
@@ -1605,7 +1605,7 @@ void Scene608::restoreAnimations() {
_scene->_sequences.remove(_globals._sequenceIndexes[6]);
_scene->_sequences.remove(_globals._sequenceIndexes[7]);
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(6);
+ _scene->_animation[0]->setCurrentFrame(6);
}
}
@@ -1757,7 +1757,7 @@ void Scene608::enter() {
int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25));
_carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST);
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(6);
+ _scene->_animation[0]->setCurrentFrame(6);
} else if (_globals[kCarStatus] == CAR_SQUASHES_DOG) {
_carMode = 2;
_dogDeathMode = 0;
@@ -1927,13 +1927,13 @@ void Scene608::step() {
_animationMode = 0;
}
- if ((_carMode == 4) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carMode == 4) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
if (_carFrame == 10) {
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
} else if (_carFrame == 56) {
resetDogVariables();
_animationMode = 0;
@@ -1942,12 +1942,12 @@ void Scene608::step() {
}
}
- if ((_carMode == 5) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carMode == 5) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
if (_carFrame == 10) {
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
} else if (_carFrame == 52) {
resetDogVariables();
_animationMode = 0;
@@ -1956,13 +1956,13 @@ void Scene608::step() {
}
}
- if ((_carMode == 6) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carMode == 6) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
if (_carFrame == 11) {
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
} else if (_carFrame == 41) {
_globals._sequenceIndexes[10] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[10], false, 9, 0, 0, 0);
_scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 10, 11);
@@ -2000,9 +2000,9 @@ void Scene608::step() {
if (_game._trigger == 112)
_dogYelping = false;
- if ((_carMode == 0) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carMode == 0) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame = -1;
if ((_globals[kCarStatus] == CAR_UP) || (_globals[kCarStatus] == CAR_DOWN)) {
@@ -2015,7 +2015,7 @@ void Scene608::step() {
break;
case 1:
- if (_scene->_activeAnimation->getCurrentFrame() >= 12) {
+ if (_scene->_animation[0]->getCurrentFrame() >= 12) {
nextFrame = 0;
_carMoveMode = 0;
_globals[kCarStatus] = CAR_UP;
@@ -2023,7 +2023,7 @@ void Scene608::step() {
break;
case 2:
- if (_scene->_activeAnimation->getCurrentFrame() >= 6) {
+ if (_scene->_animation[0]->getCurrentFrame() >= 6) {
nextFrame = 6;
_carMoveMode = 0;
_globals[kCarStatus] = CAR_DOWN;
@@ -2035,35 +2035,35 @@ void Scene608::step() {
}
}
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_carFrame = nextFrame;
}
}
}
- if ((_carMode == 2) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carMode == 2) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame = -1;
if (_carMoveMode == 0)
nextFrame = 28;
- else if (_scene->_activeAnimation->getCurrentFrame() >= 28) {
+ else if (_scene->_animation[0]->getCurrentFrame() >= 28) {
nextFrame = 28;
_carMoveMode = 0;
}
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_carFrame = nextFrame;
}
}
}
- if ((_carMode == 3) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carMode == 3) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame = -1;
if (_resetPositionsFl) {
@@ -2071,22 +2071,22 @@ void Scene608::step() {
_carMoveMode = 0;
} else if (_carMoveMode == 0)
nextFrame = 6;
- else if (_scene->_activeAnimation->getCurrentFrame() >= 6) {
+ else if (_scene->_animation[0]->getCurrentFrame() >= 6) {
nextFrame = 6;
_carMoveMode = 0;
}
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_carFrame = nextFrame;
}
}
}
- if ((_carMode == 1) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) {
- _carFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_carMode == 1) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _carFrame) {
+ _carFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame = -1;
if (_resetPositionsFl) {
@@ -2094,13 +2094,13 @@ void Scene608::step() {
_carMoveMode = 0;
} else if (_carMoveMode == 0)
nextFrame = 6;
- else if (_scene->_activeAnimation->getCurrentFrame() >= 6) {
+ else if (_scene->_animation[0]->getCurrentFrame() >= 6) {
nextFrame = 6;
_carMoveMode = 0;
}
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_carFrame = nextFrame;
}
}
@@ -2476,7 +2476,7 @@ void Scene608::actions() {
_vm->_dialogs->show(60824);
} else if (_action.isAction(VERB_OPEN, NOUN_STORAGE_BOX))
_vm->_dialogs->show(60826);
- else if (_action.isAction(VERB_LOOK, NOUN_REARVIEW_MIRROR) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_REARVIEW_MIRROR) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(60828);
else if (_action.isAction(VERB_LOOK, NOUN_TOOL_BOX)) {
if (_game._objects[OBJ_POLYCEMENT]._roomNumber == _scene->_currentSceneId)
@@ -2605,7 +2605,7 @@ void Scene609::step() {
switch (_game._trigger) {
case 70:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(6, 71);
break;
@@ -3014,7 +3014,7 @@ void Scene610::actions() {
_vm->_dialogs->show(61024);
else if (_action.isAction(VERB_LOOK, NOUN_SPOTLIGHT))
_vm->_dialogs->show(61025);
- else if (_action.isAction(VERB_LOOK, NOUN_PHONE_HANDSET) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_PHONE_HANDSET) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(61026);
else if (_action.isAction(VERB_LOOK, NOUN_PHONE_CRADLE))
_vm->_dialogs->show(61027);
@@ -3930,7 +3930,7 @@ void Scene611::enter() {
0x2D9, 0x2DA, 0x2DB, 0x2DC, 0x2DD, 0x2DE, 0x2DF, 0x2E0, 0x2E1, 0x2E2, 0x2E3, 0x2E4, 0x2E5, 0x2E6,
0x323, 0x324, 0);
- _dialog1.setup(kConvHermit1, 0x287, 0x288, 0x289, 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290,
+ _dialog1.setup(kConvHermit1, 0x287, 0x288, 0x289, 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290,
0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0);
_dialog2.setup(kConvHermit2, 0x29C, 0x29D, 0x29E, 0x29F, 0);
@@ -4145,13 +4145,13 @@ void Scene611::step() {
_hermitMovingFl = true;
}
- if (_stickFingerFl && (_scene->_activeAnimation->getCurrentFrame() == 47)) {
+ if (_stickFingerFl && (_scene->_animation[0]->getCurrentFrame() == 47)) {
_stickFingerFl = false;
_hermitMovingFl = true;
_hermitMode = 1;
}
- if (_scene->_activeAnimation != nullptr && (_scene->_activeAnimation->getCurrentFrame() == 240) && _check1Fl) {
+ if (_scene->_animation[0] != nullptr && (_scene->_animation[0]->getCurrentFrame() == 240) && _check1Fl) {
_check1Fl = false;
_scene->_kernelMessages.add(Common::Point(33, 88), 0xFDFC, 0, 0, 90, _game.getQuote(0x27E));
_scene->_sequences.addTimer(120, 120);
@@ -4240,7 +4240,7 @@ void Scene611::step() {
}
}
- if (_scene->_activeAnimation != nullptr && _scene->_activeAnimation->getCurrentFrame() == 254)
+ if (_scene->_animation[0] != nullptr && _scene->_animation[0]->getCurrentFrame() == 254)
_game._player._stepEnabled = true;
if (_game._trigger == 110) {
@@ -4266,7 +4266,7 @@ void Scene611::step() {
}
if (_hermitMode == 6) {
- if ((_scene->_activeAnimation->getCurrentFrame() == 9) && _check1Fl) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 9) && _check1Fl) {
_scene->_sequences.remove(_globals._sequenceIndexes[3]);
_globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0);
_scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2);
@@ -4275,7 +4275,7 @@ void Scene611::step() {
_check1Fl = false;
}
- if ((_scene->_activeAnimation->getCurrentFrame() == 17) && !_check1Fl) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 17) && !_check1Fl) {
_nextFrame = 26;
_hermitMode = 4;
_check1Fl = true;
@@ -4283,13 +4283,13 @@ void Scene611::step() {
}
if (_hermitMode == 4) {
- if ((_scene->_activeAnimation->getCurrentFrame() == 33) && _check1Fl) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 33) && _check1Fl) {
displayHermitQuestions(_hermitDisplayedQuestion);
_nextFrame = 1;
_check1Fl = false;
}
- if ((_scene->_activeAnimation->getCurrentFrame() == 9) && !_check1Fl) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 9) && !_check1Fl) {
_nextFrame = 8;
_scene->_sequences.addTimer(1, 113);
_check1Fl = true;
@@ -4315,8 +4315,8 @@ void Scene611::step() {
_scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 115);
}
- if ((_nextFrame >= 0) && (_nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(_nextFrame);
+ if ((_nextFrame >= 0) && (_nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(_nextFrame);
_nextFrame = -1;
}
@@ -4588,7 +4588,7 @@ void Scene612::step() {
switch (_game._trigger) {
case 70:
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_scene->_sequences.addTimer(6, 71);
break;
diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp
index c2a249e5f8..6caebb7f79 100644
--- a/engines/mads/nebular/nebular_scenes7.cpp
+++ b/engines/mads/nebular/nebular_scenes7.cpp
@@ -361,7 +361,7 @@ void Scene701::actions() {
case 1: {
_game._player._visible = true;
- _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount;
+ _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
_globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1);
_scene->_sequences.setDepth (_globals._sequenceIndexes[2], 9);
int idx = _scene->_dynamicHotspots.add(NOUN_BOAT, VERB_CLIMB_INTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0));
@@ -498,7 +498,7 @@ void Scene702::actions() {
_game._player._stepEnabled = false;
_game._player._visible = false;
_scene->_nextSceneId = 711;
- } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) {
+ } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) {
switch (_game._trigger) {
case 0:
_game._player._stepEnabled = false;
@@ -537,9 +537,9 @@ void Scene702::actions() {
_vm->_dialogs->show(70215);
else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER))
_vm->_dialogs->show(70216);
- else if (_action.isAction(VERB_LOOK, NOUN_BONES) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(70217);
- else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4)) {
+ else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT)) {
if (_game._objects.isInInventory(OBJ_BONES))
_vm->_dialogs->show(70219);
} else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY))
@@ -694,7 +694,7 @@ void Scene703::enter() {
_boatDir = 2;
_monsterMode = 0;
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(34);
+ _scene->_animation[0]->setCurrentFrame(34);
} else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
_game._player._stepEnabled = false;
_boatDir = 1;
@@ -712,17 +712,17 @@ void Scene703::enter() {
_boatDir = 1;
_monsterMode = 1;
_scene->loadAnimation(formAnimName('B', -1));
- _scene->_activeAnimation->setCurrentFrame(39);
+ _scene->_animation[0]->setCurrentFrame(39);
} else if (_boatDir == 1) {
_curSequence = 0;
_monsterMode = 0;
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(9);
+ _scene->_animation[0]->setCurrentFrame(9);
} else if (_boatDir == 2) {
_curSequence = 0;
_monsterMode = 0;
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(56);
+ _scene->_animation[0]->setCurrentFrame(56);
}
if (_scene->_roomChanged) {
@@ -764,9 +764,9 @@ void Scene703::step() {
if (_game._trigger == 70)
_scene->_reloadSceneFlag = true;
- if ((_monsterMode == 3) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) {
- _boatFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_monsterMode == 3) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
+ _boatFrame = _scene->_animation[0]->getCurrentFrame();
int nextBoatFrame = -1;
if (_boatFrame == 62) {
@@ -777,8 +777,8 @@ void Scene703::step() {
}
}
- if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextBoatFrame);
+ if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
_boatFrame = nextBoatFrame;
}
}
@@ -787,9 +787,9 @@ void Scene703::step() {
if (_game._trigger == 70)
_scene->_reloadSceneFlag = true;
- if ((_monsterMode == 0) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) {
- _boatFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_monsterMode == 0) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
+ _boatFrame = _scene->_animation[0]->getCurrentFrame();
int nextBoatFrame = -1;
switch (_boatFrame) {
@@ -860,8 +860,8 @@ void Scene703::step() {
break;
}
- if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextBoatFrame);
+ if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
_boatFrame = nextBoatFrame;
}
}
@@ -895,9 +895,9 @@ void Scene703::step() {
}
- if ((_monsterMode == 1) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) {
- _boatFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_monsterMode == 1) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
+ _boatFrame = _scene->_animation[0]->getCurrentFrame();
int nextBoatFrame = -1;
switch (_boatFrame) {
@@ -934,16 +934,16 @@ void Scene703::step() {
break;
}
- if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextBoatFrame);
+ if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
_boatFrame = nextBoatFrame;
}
}
}
- if ((_monsterMode == 2) && (_scene->_activeAnimation != nullptr)) {
- if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) {
- _boatFrame = _scene->_activeAnimation->getCurrentFrame();
+ if ((_monsterMode == 2) && (_scene->_animation[0] != nullptr)) {
+ if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
+ _boatFrame = _scene->_animation[0]->getCurrentFrame();
int nextBoatFrame = -1;
switch (_boatFrame) {
@@ -983,7 +983,7 @@ void Scene703::step() {
_scene->freeAnimation();
_monsterMode = 1;
_scene->loadAnimation(formAnimName('B', -1));
- _scene->_activeAnimation->setCurrentFrame(39);
+ _scene->_animation[0]->setCurrentFrame(39);
_game._player._stepEnabled = true;
break;
@@ -992,7 +992,7 @@ void Scene703::step() {
_scene->freeAnimation();
_monsterMode = 1;
_scene->loadAnimation(formAnimName('B', -1));
- _scene->_activeAnimation->setCurrentFrame(39);
+ _scene->_animation[0]->setCurrentFrame(39);
_game._player._stepEnabled = true;
} else
_game._objects.setRoom(OBJ_CHICKEN_BOMB, 1);
@@ -1005,7 +1005,7 @@ void Scene703::step() {
_scene->freeAnimation();
_monsterMode = 0;
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(9);
+ _scene->_animation[0]->setCurrentFrame(9);
_game._player._stepEnabled = true;
if (_game._storyMode == STORYMODE_NAUGHTY)
_vm->_dialogs->show(70321);
@@ -1018,8 +1018,8 @@ void Scene703::step() {
break;
}
- if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextBoatFrame);
+ if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
_boatFrame = nextBoatFrame;
}
}
@@ -1055,7 +1055,7 @@ void Scene703::actions() {
_scene->freeAnimation();
_monsterMode = 2;
_scene->loadAnimation(formAnimName('C', -1));
- _scene->_activeAnimation->setCurrentFrame(19);
+ _scene->_animation[0]->setCurrentFrame(19);
} else if (_action.isAction(VERB_THROW, NOUN_CHICKEN, NOUN_SEA_MONSTER)) {
_game._player._stepEnabled = false;
_scene->freeAnimation();
@@ -1066,13 +1066,13 @@ void Scene703::actions() {
_scene->freeAnimation();
_monsterMode = 2;
_scene->loadAnimation(formAnimName('C', -1));
- _scene->_activeAnimation->setCurrentFrame(39);
+ _scene->_animation[0]->setCurrentFrame(39);
} else if (_action.isAction(VERB_THROW, NOUN_BOMB, NOUN_SEA_MONSTER)) {
_game._player._stepEnabled = false;
_scene->freeAnimation();
_monsterMode = 2;
_scene->loadAnimation(formAnimName('C', -1));
- _scene->_activeAnimation->setCurrentFrame(59);
+ _scene->_animation[0]->setCurrentFrame(59);
} else if (_action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB, NOUN_SEA_MONSTER)) {
_useBomb = true;
_game._player._stepEnabled = false;
@@ -1241,21 +1241,21 @@ void Scene704::enter() {
_animationMode = 2;
_boatDirection = 2;
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(36);
+ _scene->_animation[0]->setCurrentFrame(36);
} else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
_game._player._stepEnabled = false;
_boatDirection = 1;
_scene->loadAnimation(formAnimName('A', -1));
} else if (_boatDirection == 1) {
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(8);
+ _scene->_animation[0]->setCurrentFrame(8);
} else if (_boatDirection == 2) {
if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) {
_scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(123, 125));
_scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
}
_scene->loadAnimation(formAnimName('A', -1));
- _scene->_activeAnimation->setCurrentFrame(57);
+ _scene->_animation[0]->setCurrentFrame(57);
}
if (_scene->_roomChanged)
@@ -1269,9 +1269,9 @@ void Scene704::enter() {
}
void Scene704::step() {
- if (_scene->_activeAnimation != nullptr) {
- if (_scene->_activeAnimation->getCurrentFrame() != _boatCurrentFrame) {
- _boatCurrentFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_scene->_animation[0] != nullptr) {
+ if (_scene->_animation[0]->getCurrentFrame() != _boatCurrentFrame) {
+ _boatCurrentFrame = _scene->_animation[0]->getCurrentFrame();
int nextFrame = -1;
switch (_boatCurrentFrame) {
@@ -1377,8 +1377,8 @@ void Scene704::step() {
break;
}
- if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
- _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
+ _scene->_animation[0]->setCurrentFrame(nextFrame);
_boatCurrentFrame = nextFrame;
}
}
@@ -1455,7 +1455,7 @@ void Scene704::actions() {
_vm->_dialogs->show(70412);
} else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM))
_vm->_dialogs->show(70413);
- else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(70414);
else if (_action.isAction(VERB_LOOK, NOUN_OPEN_WATER_TO_SOUTH))
_vm->_dialogs->show(70416);
@@ -1906,9 +1906,9 @@ void Scene706::step() {
_scene->_reloadSceneFlag = true;
}
- if (_scene->_activeAnimation != nullptr) {
- if ((_animationMode != 0) && (_scene->_activeAnimation->getCurrentFrame() != _animationFrame)) {
- _animationFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_scene->_animation[0] != nullptr) {
+ if ((_animationMode != 0) && (_scene->_animation[0]->getCurrentFrame() != _animationFrame)) {
+ _animationFrame = _scene->_animation[0]->getCurrentFrame();
if (_animationFrame == 6) {
_scene->_sequences.remove(_globals._sequenceIndexes[1]);
@@ -2017,7 +2017,7 @@ void Scene706::actions() {
_vm->_dialogs->show(70623);
else if (_action.isAction(VERB_LOOK, NOUN_VASE) && (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId))
_vm->_dialogs->show(70624);
- else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == 4))
+ else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == CAT_HOTSPOT))
_vm->_dialogs->show(70632);
else
return;
diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp
index a904569624..951b270a1c 100644
--- a/engines/mads/nebular/nebular_scenes8.cpp
+++ b/engines/mads/nebular/nebular_scenes8.cpp
@@ -930,7 +930,7 @@ void Scene804::enter() {
void Scene804::step() {
if (!_messWithThrottle) {
- if ((_throttleGone) && (_movingThrottle) && (_scene->_activeAnimation->getCurrentFrame() == 39)) {
+ if ((_throttleGone) && (_movingThrottle) && (_scene->_animation[0]->getCurrentFrame() == 39)) {
_globals._sequenceIndexes[1] = _scene->_sequences.startCycle
(_globals._spriteIndexes[1], false, 1);
_scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(133, 139));
@@ -938,7 +938,7 @@ void Scene804::step() {
_throttleGone = false;
}
- if ((_movingThrottle) && (_scene->_activeAnimation->getCurrentFrame() == 42)) {
+ if ((_movingThrottle) && (_scene->_animation[0]->getCurrentFrame() == 42)) {
_resetFrame = 0;
_movingThrottle = false;
}
@@ -947,12 +947,12 @@ void Scene804::step() {
_resetFrame = 42;
}
- if (_scene->_activeAnimation->getCurrentFrame() == 65)
+ if (_scene->_animation[0]->getCurrentFrame() == 65)
_scene->_sequences.remove(_globals._sequenceIndexes[7]);
switch (_game._storyMode) {
case STORYMODE_NAUGHTY:
- if (_scene->_activeAnimation->getCurrentFrame() == 81) {
+ if (_scene->_animation[0]->getCurrentFrame() == 81) {
_resetFrame = 80;
_globals[kInSpace] = false;
_globals[kBeamIsUp] = true;
@@ -964,7 +964,7 @@ void Scene804::step() {
break;
case STORYMODE_NICE:
- if (_scene->_activeAnimation->getCurrentFrame() == 68) {
+ if (_scene->_animation[0]->getCurrentFrame() == 68) {
_resetFrame = 66;
_globals[kInSpace] = false;
_globals[kBeamIsUp] = true;
@@ -975,12 +975,12 @@ void Scene804::step() {
}
}
- if (_scene->_activeAnimation->getCurrentFrame() == 34) {
+ if (_scene->_animation[0]->getCurrentFrame() == 34) {
_resetFrame = 36;
_scene->_sequences.remove(_globals._sequenceIndexes[1]);
}
- if (_scene->_activeAnimation->getCurrentFrame() == 37) {
+ if (_scene->_animation[0]->getCurrentFrame() == 37) {
_resetFrame = 36;
if (!_dontPullThrottleAgain) {
_dontPullThrottleAgain = true;
@@ -992,20 +992,20 @@ void Scene804::step() {
_scene->_nextSceneId = 803;
}
- if ((_scene->_activeAnimation->getCurrentFrame() == 7) && (!_globals[kWindowFixed])) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 7) && (!_globals[kWindowFixed])) {
_globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1);
_scene->_sequences.addTimer(20, 110);
_globals[kWindowFixed] = true;
}
- if (_scene->_activeAnimation->getCurrentFrame() == 10) {
+ if (_scene->_animation[0]->getCurrentFrame() == 10) {
_resetFrame = 0;
_game._player._stepEnabled = true;
_game._objects.setRoom(OBJ_POLYCEMENT, NOWHERE);
}
// FIXME: Original doesn't have resetFrame check. Check why this has been needed
- if (_resetFrame == -1 && _scene->_activeAnimation->getCurrentFrame() == 1) {
+ if (_resetFrame == -1 && _scene->_animation[0]->getCurrentFrame() == 1) {
int randomVal = _vm->getRandomNumber(29) + 1;
switch (randomVal) {
case 1:
@@ -1023,7 +1023,7 @@ void Scene804::step() {
}
}
- switch (_scene->_activeAnimation->getCurrentFrame()) {
+ switch (_scene->_animation[0]->getCurrentFrame()) {
case 26:
case 28:
case 31:
@@ -1031,12 +1031,12 @@ void Scene804::step() {
break;
}
} else {
- if ((_scene->_activeAnimation->getCurrentFrame() == 36) && (!_throttleGone)) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 36) && (!_throttleGone)) {
_scene->_sequences.remove(_globals._sequenceIndexes[1]);
_throttleGone = true;
}
- if (_scene->_activeAnimation->getCurrentFrame() == 39) {
+ if (_scene->_animation[0]->getCurrentFrame() == 39) {
_movingThrottle = false;
switch (_throttleCounter) {
case 1:
@@ -1074,8 +1074,8 @@ void Scene804::step() {
}
if (_resetFrame >= 0) {
- if (_resetFrame != _scene->_activeAnimation->getCurrentFrame()) {
- _scene->_activeAnimation->setCurrentFrame(_resetFrame);
+ if (_resetFrame != _scene->_animation[0]->getCurrentFrame()) {
+ _scene->_animation[0]->setCurrentFrame(_resetFrame);
_resetFrame = -1;
}
}
@@ -1084,12 +1084,12 @@ void Scene804::step() {
_scene->_nextSceneId = 803;
}
- if ((_scene->_activeAnimation->getCurrentFrame() == 72) && !_alreadyPop) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 72) && !_alreadyPop) {
_vm->_sound->command(21);
_alreadyPop = true;
}
- if ((_scene->_activeAnimation->getCurrentFrame() == 80) && !_alreadyOrgan) {
+ if ((_scene->_animation[0]->getCurrentFrame() == 80) && !_alreadyOrgan) {
_vm->_sound->command(22);
_alreadyOrgan = true;
}
@@ -1606,7 +1606,7 @@ void Scene810::enter() {
}
void Scene810::step() {
- if (_scene->_activeAnimation && (_scene->_activeAnimation->getCurrentFrame() == 200)
+ if (_scene->_animation[0] && (_scene->_animation[0]->getCurrentFrame() == 200)
&& _moveAllowed) {
_scene->_sequences.addTimer(100, 70);
_moveAllowed = false;
diff --git a/engines/mads/palette.h b/engines/mads/palette.h
index 6c98947384..1efe63b324 100644
--- a/engines/mads/palette.h
+++ b/engines/mads/palette.h
@@ -316,7 +316,7 @@ public:
void refreshSceneColors();
- static int closestColor(const byte *matchColor, const byte *refPalette,
+ static int closestColor(const byte *matchColor, const byte *refPalette,
int paletteInc, int count);
};
diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp
index 592a108aea..7e61241182 100644
--- a/engines/mads/phantom/game_phantom.cpp
+++ b/engines/mads/phantom/game_phantom.cpp
@@ -35,10 +35,109 @@ namespace MADS {
namespace Phantom {
-GamePhantom::GamePhantom(MADSEngine *vm)
- : Game(vm) {
+ Catacombs _easyCatacombs[32] = {
+ { 401, { -1, 1, 2, 6 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 404, { 10, 11, 3, 0 }, { 2, 3, 0, 1 }, MAZE_EVENT_PUDDLE },
+ { 404, { 0, 3, 4, -2 }, { 2, 3, 0, 1 }, MAZE_EVENT_BLOCK },
+ { 401, { 1, 14, 5, 2 }, { 2, 3, 0, 1 }, MAZE_EVENT_POT },
+ { 453, { 2, 4, -1, 4 }, { 2, 3, 0, 1 }, MAZE_EVENT_DRAIN },
+ { 403, { 3, 6, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_PLANK },
+ { 406, { -1, 0, -1, 5 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 453, { -1, 8, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 406, { -1, 9, -1, 7 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 401, { 1, -1, 10, 8 }, { 2, 3, 0, 1 }, MAZE_EVENT_RAT_NEST | MAZE_EVENT_SKULL },
+ { 408, { 9, -1, 1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 453, { 12, -1, -1, 1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_STONE },
+ { 408, { 13, -1, 11, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 401, { 13, 20, 12, 13 }, { 3, 3, 0, 0 }, MAZE_EVENT_BRICK },
+ { 453, { 16, 15, -1, 3 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_RAT_NEST },
+ { 456, { -1, -1, -1, 14 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 404, { -1, 17, 14, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_WEB | MAZE_EVENT_POT },
+ { 401, { 18, -1, 19, 16 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 408, { -1, -1, 17, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 403, { 17, -1, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_HOLE | MAZE_EVENT_WEB },
+ { 403, { 21, 22, -1, 13 }, { 2, 3, 0, 1 }, MAZE_EVENT_WEB | MAZE_EVENT_SKULL },
+ { 404, { -1, -1, 20, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 406, { -1, 23, -1, 20 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 404, { 24, 23, 23, 22 }, { 2, 2, 1, 1 }, MAZE_EVENT_RAT_NEST | MAZE_EVENT_BRICK },
+ { 401, { -1, 1, 23, 25 }, { 2, 1, 0, 1 }, MAZE_EVENT_PUDDLE | MAZE_EVENT_POT | MAZE_EVENT_BRICK },
+ { 407, { 29, 24, 28, 26 }, { 3, 3, 1, 1 }, MAZE_EVENT_NONE },
+ { 401, { 27, 25, 23, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_SKULL },
+ { 404, { -1, 28, 26, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_WEB | MAZE_EVENT_FALLEN_BLOCK },
+ { 456, { -1, 25, -1, 27 }, { 2, 2, 0, 1 }, MAZE_EVENT_NONE },
+ { 406, { -1, 30, -1, 25 }, { 2, 3, 0, 0 }, MAZE_EVENT_NONE },
+ { 453, { -3, 30, -1, 29 }, { 2, 3, 0, 1 }, MAZE_EVENT_STONE | MAZE_EVENT_RAT_NEST | MAZE_EVENT_WEB },
+ { 408, { -5, -1, -4, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_WEB | MAZE_EVENT_BRICK }
+ };
+
+ Catacombs _hardCatacombs[62] = {
+ { 401, { -1, 1, 2, 6 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 404, { 10, 11, 3, 0 }, { 2, 3, 0, 1 }, MAZE_EVENT_PUDDLE },
+ { 404, { 0, 3, 4, -2 }, { 2, 3, 0, 1 }, MAZE_EVENT_BLOCK },
+ { 401, { 1, 20, 5, 2 }, { 2, 0, 0, 1 }, MAZE_EVENT_POT },
+ { 453, { 2, 4, -1, 4 }, { 2, 3, 0, 1 }, MAZE_EVENT_DRAIN },
+ { 403, { 3, 6, -1, 4 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_PLANK },
+ { 406, { -1, 0, -1, 5 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 453, { -1, 8, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 406, { -1, 9, -1, 7 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 401, { 1, -1, 10, 8 }, { 0, 3, 0, 1 }, MAZE_EVENT_RAT_NEST | MAZE_EVENT_SKULL },
+ { 408, { 9, -1, 1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 453, { 12, -1, -1, 1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_STONE },
+ { 408, { 13, -1, 11, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 401, { 13, 21, 12, 13 }, { 3, 3, 0, 0 }, MAZE_EVENT_BRICK },
+ { 453, { 16, 15, -1, 20 }, { 2, 3, 0, 2 }, MAZE_EVENT_RAT_NEST | MAZE_EVENT_BRICK },
+ { 456, { -1, -1, -1, 14 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 404, { -1, 17, 14, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_WEB | MAZE_EVENT_POT },
+ { 401, { 18, -1, 19, 16 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 408, { -1, -1, 17, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 403, { 17, -1, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_HOLE | MAZE_EVENT_WEB },
+ { 408, { 3, -1, 14, -1 }, { 1, 3, 3, 1 }, MAZE_EVENT_NONE },
+ { 404, { 9, 30, 22, 13 }, { 0, 3, 0, 1 }, MAZE_EVENT_RAT_NEST },
+ { 403, { 21, 23, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_HOLE | MAZE_EVENT_WEB },
+ { 401, { -1, -1, 24, 22 }, { 2, 3, 3, 1 }, MAZE_EVENT_BRICK },
+ { 406, { -1, 26, -1, 23 }, { 2, 0, 0, 2 }, MAZE_EVENT_NONE },
+ { 407, { 36, 33, 35, 34 }, { 3, 3, 1, 1 }, MAZE_EVENT_NONE },
+ { 453, { 24, 27, -1, -1 }, { 1, 0, 0, 1 }, MAZE_EVENT_BRICK },
+ { 403, { 26, -1, -1, 28 }, { 1, 3, 0, 0 }, MAZE_EVENT_BRICK | MAZE_EVENT_SKULL },
+ { 404, { 27, 28, 28, 29 }, { 3, 2, 1, 2 }, MAZE_EVENT_NONE },
+ { 408, { -1, -1, 28, -1 }, { 2, 3, 3, 1 }, MAZE_EVENT_BRICK },
+ { 406, { -1, 31, -1, 21 }, { 2, 0, 0, 1 }, MAZE_EVENT_NONE },
+ { 401, { 30, 33, 1, -1 }, { 1, 2, 1, 1 }, MAZE_EVENT_PUDDLE | MAZE_EVENT_POT },
+ { 456, { -1, 31, -1, 33 }, { 2, 1, 0, 0 }, MAZE_EVENT_NONE },
+ { 404, { 32, -1, 31, 25 }, { 3, 3, 1, 1 }, MAZE_EVENT_NONE },
+ { 401, { 46, 25, 31, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_SKULL },
+ { 401, { -1, 25, 41, -1 }, { 2, 2, 1, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_POT },
+ { 406, { -1, 37, -1, 25 }, { 2, 3, 0, 0 }, MAZE_EVENT_NONE },
+ { 453, { -3, 37, -1, 36 }, { 2, 3, 0, 1 }, MAZE_EVENT_STONE | MAZE_EVENT_RAT_NEST | MAZE_EVENT_WEB },
+ { 408, { 57, -1, 54, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 408, { 40, -1, -4, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_WEB },
+ { 404, { 40, 40, 39, 53 }, { 1, 0, 0, 1 }, MAZE_EVENT_BLOCK | MAZE_EVENT_FALLEN_BLOCK },
+ { 456, { -1, 35, -1, 42 }, { 2, 2, 0, 2 }, MAZE_EVENT_NONE },
+ { 408, { 43, -1, 41, -1 }, { 1, 3, 3, 1 }, MAZE_EVENT_BRICK },
+ { 406, { -1, 42, -1, 61 }, { 2, 0, 0, 1 }, MAZE_EVENT_NONE },
+ { 403, { 58, 45, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_RAT_NEST },
+ { 401, { 34, -1, 46, 44 }, { 0, 3, 0, 1 }, MAZE_EVENT_RAT_NEST | MAZE_EVENT_BRICK },
+ { 404, { 45, -1, 34, 47 }, { 2, 3, 0, 1 }, MAZE_EVENT_WEB | MAZE_EVENT_FALLEN_BLOCK },
+ { 406, { -1, 46, -1, 48 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 403, { 49, 47, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_SKULL | MAZE_EVENT_WEB },
+ { 408, { 50, -1, 48, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 408, { 51, -1, 49, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 408, { 52, -1, 50, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 408, { -1, -1, 51, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK },
+ { 406, { -1, 40, -1, 54 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 403, { 38, 53, -1, 55 }, { 2, 3, 0, 1 }, MAZE_EVENT_SKULL },
+ { 453, { 56, 54, -1, -1 }, { 2, 3, 0, 1 }, MAZE_EVENT_BRICK | MAZE_EVENT_WEB },
+ { 401, { 56, -5, 55, 56 }, { 3, 3, 0, 0 }, MAZE_EVENT_BRICK | MAZE_EVENT_SKULL },
+ { 404, { -1, 57, 38, 57 }, { 2, 3, 0, 1 }, MAZE_EVENT_POT | MAZE_EVENT_BLOCK },
+ { 404, { 59, 59, 44, 60 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 404, { 59, 60, 59, 58 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 404, { 61, 58, 59, 59 }, { 2, 3, 0, 1 }, MAZE_EVENT_NONE },
+ { 404, { 34, 43, 60, 44 }, { 0, 3, 0, 1 }, MAZE_EVENT_NONE }
+ };
+
+GamePhantom::GamePhantom(MADSEngine *vm) : Game(vm) {
_surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT);
- _storyMode = STORYMODE_NAUGHTY;
+ _difficulty = DIFFICULTY_HARD;
}
void GamePhantom::startGame() {
@@ -51,8 +150,7 @@ void GamePhantom::startGame() {
void GamePhantom::initializeGlobals() {
_globals.reset();
-
- // TODO: Catacombs setup
+ setupCatacombs();
_player._facing = FACING_NORTH;
_player._turnToFacing = FACING_NORTH;
@@ -104,7 +202,7 @@ void GamePhantom::initializeGlobals() {
_globals[kChristineToldEnvelope] = false;
_globals[kLeaveAngelMusicOn] = false;
_globals[kDoorIn409IsOpen] = false;
- _globals[kUnknown] = false;
+ _globals[kPriestPistonPuke] = false;
_globals[kCobwebIsCut] = false;
_globals[kChristineIsInBoat] = false;
_globals[kRightDoorIsOpen504] = false;
@@ -161,27 +259,561 @@ void GamePhantom::checkShowDialog() {
}
}
+void GamePhantom::genericObjectExamine() {
+ MADSAction &action = _scene._action;
+ int id = _objects.getIdFromDesc(action._activeAction._objectNameId);
+
+ if (action.isAction(VERB_LOOK, NOUN_RED_FRAME))
+ _vm->_dialogs->showItem(id, (_globals[kCurrentYear] == 1993) ? 802 : 842, 0);
+ else if (action.isAction(VERB_LOOK, NOUN_YELLOW_FRAME))
+ _vm->_dialogs->showItem(id, (_globals[kCurrentYear] == 1993) ? 804 : 843, 0);
+ else if (action.isAction(VERB_LOOK, NOUN_BLUE_FRAME))
+ _vm->_dialogs->showItem(id, (_globals[kCurrentYear] == 1993) ? 817 : 844, 0);
+ else if (action.isAction(VERB_LOOK, NOUN_GREEN_FRAME))
+ _vm->_dialogs->showItem(id, (_globals[kCurrentYear] == 1993) ? 819 : 845, 0);
+ else if (action.isAction(VERB_LOOK, NOUN_LANTERN))
+ _vm->_dialogs->showItem(id, (_globals[kLanternStatus] == 1) ? 831 : 801, 0);
+ else if (action.isAction(VERB_LOOK, NOUN_SMALL_NOTE))
+ _vm->_dialogs->showItem(OBJ_SMALL_NOTE, 846, 2);
+ else if (action.isAction(VERB_LOOK, NOUN_PARCHMENT))
+ _vm->_dialogs->showItem(OBJ_PARCHMENT, 812, 3);
+ else if (action.isAction(VERB_LOOK, NOUN_LETTER))
+ _vm->_dialogs->showItem(OBJ_LETTER, 813, 4);
+ else if (action.isAction(VERB_LOOK, NOUN_NOTICE))
+ _vm->_dialogs->showItem(OBJ_NOTICE, 814, 5);
+ else if (action.isAction(VERB_LOOK, NOUN_CRUMPLED_NOTE))
+ _vm->_dialogs->showItem(OBJ_CRUMPLED_NOTE, 816, 6);
+ else if (action.isAction(VERB_LOOK, NOUN_LARGE_NOTE))
+ _vm->_dialogs->showItem(OBJ_LARGE_NOTE, 818, 7);
+ else
+ _vm->_dialogs->showItem(id, 800 + id, 0);
+}
+
void GamePhantom::doObjectAction() {
- // TODO: Copied from Nebular
- //Scene &scene = _scene;
MADSAction &action = _scene._action;
- //Dialogs &dialogs = *_vm->_dialogs;
- //int id;
- action._inProgress = false;
+ if ((_scene._currentSceneId >= 401) && (_scene._currentSceneId <= 456)
+ && (action.isObject(NOUN_RED_FRAME) || action.isObject(NOUN_YELLOW_FRAME) || action.isObject(NOUN_GREEN_FRAME) || action.isObject(NOUN_BLUE_FRAME))
+ && action.isAction(VERB_PUT)) {
+ if (action.isTarget(NOUN_UNLUCKY_ADVENTURER)) {
+ _vm->_dialogs->show(35);
+ action._inProgress = false;
+ return;
+ } else if (action.isTarget(NOUN_HOLE)) {
+ _vm->_dialogs->show(36);
+ action._inProgress = false;
+ return;
+ } else if (action.isTarget(NOUN_GRATE)) {
+ _vm->_dialogs->show(37);
+ action._inProgress = false;
+ return;
+ } else if (action.isTarget(NOUN_WALL)) {
+ _vm->_dialogs->show(38);
+ action._inProgress = false;
+ return;
+ }
+ }
+
+ if (action._lookFlag) {
+ _vm->_dialogs->show(810);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_PUT, NOUN_RED_FRAME) || action.isAction(VERB_PUT, NOUN_BLUE_FRAME) || action.isAction(VERB_PUT, NOUN_YELLOW_FRAME) || action.isAction(VERB_PUT, NOUN_GREEN_FRAME)) {
+ _vm->_dialogs->show((action.isTarget(NOUN_PUDDLE)) ? 40124 : 40125);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_WEAR, NOUN_WEDDING_RING)) {
+ if (_globals[kRingIsOnFinger])
+ _vm->_dialogs->show(849);
+ else {
+ _vm->_dialogs->show(835);
+ _globals[kRingIsOnFinger] = true;
+ }
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_REMOVE, NOUN_WEDDING_RING)) {
+ if (!_globals[kRingIsOnFinger])
+ _vm->_dialogs->show(848);
+ else {
+ _vm->_dialogs->show(836);
+ _globals[kRingIsOnFinger] = false;
+ }
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_ARCHWAY_TO_WEST) || action.isAction(VERB_LOOK, NOUN_ARCHWAY_TO_EAST) || action.isAction(VERB_LOOK, NOUN_ARCHWAY_TO_NORTH)) {
+ _vm->_dialogs->show(34);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_ATTACK, NOUN_CHRISTINE)) {
+ _vm->_dialogs->show(33);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_KEY)) {
+ _vm->_dialogs->showItem(OBJ_KEY, 800, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_SANDBAG)) {
+ _vm->_dialogs->showItem(OBJ_SANDBAG, 803, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_SMALL_NOTE) || action.isAction(VERB_READ, NOUN_SMALL_NOTE)) {
+ _vm->_dialogs->showItem(OBJ_SMALL_NOTE, 806, 2);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_ROPE)) {
+ _vm->_dialogs->showItem(OBJ_ROPE, 807, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_SWORD)) {
+ _vm->_dialogs->showItem(OBJ_SWORD, 808, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_ENVELOPE) || action.isAction(VERB_READ, NOUN_ENVELOPE)) {
+ _vm->_dialogs->showItem(OBJ_ENVELOPE, 809, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_TICKET) || action.isAction(VERB_READ, NOUN_TICKET)) {
+ _vm->_dialogs->showItem(OBJ_TICKET, 810, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_PIECE_OF_PAPER) || action.isAction(VERB_READ, NOUN_PIECE_OF_PAPER)) {
+ _vm->_dialogs->showItem(OBJ_PIECE_OF_PAPER, 811, 1);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_PARCHMENT) || action.isAction(VERB_READ, NOUN_PARCHMENT)) {
+ _vm->_dialogs->showItem(OBJ_PARCHMENT, 812, 3);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_LETTER) || action.isAction(VERB_READ, NOUN_LETTER)) {
+ _vm->_dialogs->showItem(OBJ_LETTER, 813, 4);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_NOTICE) || action.isAction(VERB_READ, NOUN_NOTICE)) {
+ _vm->_dialogs->showItem(OBJ_NOTICE, 814, 5);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_BOOK) || action.isAction(VERB_READ, NOUN_BOOK)) {
+ _vm->_dialogs->showItem(OBJ_BOOK, 815, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_CRUMPLED_NOTE) || action.isAction(VERB_READ, NOUN_CRUMPLED_NOTE)) {
+ _vm->_dialogs->showItem(OBJ_CRUMPLED_NOTE, 816, 6);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_LARGE_NOTE) || action.isAction(VERB_READ, NOUN_LARGE_NOTE)) {
+ _vm->_dialogs->showItem(OBJ_LARGE_NOTE, 818, 7);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_MUSIC_SCORE) || action.isAction(VERB_READ, NOUN_MUSIC_SCORE)) {
+ _vm->_dialogs->showItem(OBJ_MUSIC_SCORE, 820, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_WEDDING_RING)) {
+ _vm->_dialogs->showItem(OBJ_WEDDING_RING, 821, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_CABLE_HOOK)) {
+ _vm->_dialogs->showItem(OBJ_CABLE_HOOK, 822, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_ROPE_WITH_HOOK)) {
+ _vm->_dialogs->showItem(OBJ_ROPE_WITH_HOOK, 823, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK, NOUN_OAR)) {
+ _vm->_dialogs->showItem(OBJ_OAR, 824, 0);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_LOOK) && _objects.isInInventory(_objects.getIdFromDesc(action._activeAction._objectNameId))) {
+ genericObjectExamine();
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_TURN_ON, NOUN_LANTERN)) {
+ if ((_globals[kLanternStatus] == 1) && !_trigger)
+ _vm->_dialogs->show(828);
+ else {
+ switch (_trigger) {
+ case 0:
+ _scene._sequences.addTimer(4, 1);
+ _globals[kLanternStatus] = 1;
+ _vm->_dialogs->spinObject(OBJ_LANTERN);
+ break;
+
+ case 1:
+ _vm->_dialogs->show(825);
+ break;
+
+ default:
+ break;
+ }
+ }
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_TURN_OFF, NOUN_LANTERN)) {
+ if ((_globals[kLanternStatus] == 0) && !_trigger)
+ _vm->_dialogs->show(829);
+ else if ((_scene._currentSceneId / 100) == 4)
+ _vm->_dialogs->show(826);
+ else {
+ switch (_trigger) {
+ case 0:
+ _scene._sequences.addTimer(4, 1);
+ _globals[kLanternStatus] = 0;
+ _vm->_dialogs->spinObject(OBJ_LANTERN);
+ break;
+
+ case 1:
+ _vm->_dialogs->show(827);
+ break;
+
+ default:
+ break;
+ }
+ }
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_OPEN, NOUN_ENVELOPE)) {
+ _objects.setRoom(OBJ_ENVELOPE, NOWHERE);
+ _objects.addToInventory(OBJ_TICKET);
+ _objects.addToInventory(OBJ_PIECE_OF_PAPER);
+ _vm->_dialogs->show(833);
+ action._inProgress = false;
+ return;
+ }
+
+ if (action.isAction(VERB_ATTACH, NOUN_CABLE_HOOK, NOUN_ROPE)) {
+ if (!_objects.isInInventory(OBJ_ROPE))
+ _vm->_dialogs->show(11438);
+ else {
+ _objects.setRoom(OBJ_CABLE_HOOK, NOWHERE);
+ _objects.setRoom(OBJ_ROPE, NOWHERE);
+ _objects.addToInventory(OBJ_ROPE_WITH_HOOK);
+ _vm->_dialogs->showItem(OBJ_ROPE_WITH_HOOK, 823, 0);
+ }
+ action._inProgress = false;
+ }
}
void GamePhantom::unhandledAction() {
- // TODO
+ int messageId = 0;
+ int rndNum = _vm->getRandomNumber(1, 1000);
+ MADSAction &action = _scene._action;
+
+ if (action.isAction(VERB_PUT, NOUN_CHANDELIER, NOUN_SEATS))
+ _vm->_dialogs->show(10123);
+ else if (action.isAction(VERB_TAKE)) {
+ if (_objects.isInInventory(_objects.getIdFromDesc(action._activeAction._objectNameId)))
+ messageId = 25;
+ else {
+ if (rndNum <= 333)
+ messageId = 1;
+ else if (rndNum <= 666)
+ messageId = 2;
+ else
+ messageId = 3;
+ }
+ } else if (action.isAction(VERB_PUSH)) {
+ if (rndNum < 750)
+ messageId = 4;
+ else
+ messageId = 5;
+ } else if (action.isAction(VERB_PULL)) {
+ if (rndNum < 750)
+ messageId = 6;
+ else
+ messageId = 7;
+ } else if (action.isAction(VERB_OPEN)) {
+ if (rndNum <= 500)
+ messageId = 8;
+ else if (rndNum <= 750)
+ messageId = 9;
+ else
+ messageId = 10;
+ } else if (action.isAction(VERB_CLOSE)) {
+ if (rndNum <= 500)
+ messageId = 11;
+ else if (rndNum <= 750)
+ messageId = 12;
+ else
+ messageId = 13;
+ } else if (action.isAction(VERB_PUT)) {
+ if (_objects.isInInventory(_objects.getIdFromDesc(action._activeAction._objectNameId)))
+ messageId = 26;
+ else if (rndNum < 500)
+ messageId = 14;
+ else
+ messageId = 15;
+ } else if (action.isAction(VERB_TALK_TO)) {
+ if (rndNum <= 500)
+ messageId = 16;
+ else
+ messageId = 17;
+ } else if (action.isAction(VERB_GIVE)) {
+ if (_objects.isInInventory(_objects.getIdFromDesc(action._activeAction._objectNameId)))
+ messageId = 27;
+ else
+ messageId = 18;
+ } else if (action.isAction(VERB_THROW)) {
+ if (_objects.isInInventory(_objects.getIdFromDesc(action._activeAction._objectNameId)))
+ messageId = 19;
+ else
+ messageId = 28;
+ } else if (action.isAction(VERB_LOOK)) {
+ if (rndNum <= 333)
+ messageId = 20;
+ else if (rndNum <= 666)
+ messageId = 21;
+ else
+ messageId = 22;
+ } else if ((action.isAction(VERB_UNLOCK) || action.isAction(VERB_LOCK))
+ && (action.isObject(NOUN_DOOR) || action.isObject(NOUN_LEFT_DOOR) || action.isObject(NOUN_MIDDLE_DOOR) || action.isObject(NOUN_RIGHT_DOOR) || action.isObject(NOUN_TRAP_DOOR)))
+ messageId = 32;
+ else if (!action.isAction(VERB_WALK_TO) && !action.isAction(VERB_WALK_ACROSS) && !action.isAction(VERB_WALK_DOWN) && !action.isAction(VERB_WALK_UP)) {
+ if (rndNum < 500)
+ messageId = 23;
+ else
+ messageId = 24;
+ }
+
+ if (messageId)
+ _vm->_dialogs->show(messageId);
+}
+
+void GamePhantom::stopWalker() {
+ int state = _globals[kWalkerConverseState];
+ int command = _globals[kWalkerConverse];
+
+ _globals[kWalkerConverseNow] = state;
+
+ if ((_player._facing != FACING_NORTHEAST) && (_player._facing != FACING_NORTHWEST)) {
+ state = 0;
+ command = 0;
+ }
+
+ switch (state) {
+ case 1:
+ switch (command) {
+ case 1:
+ _player.addWalker(3, 0);
+ break;
+
+ case 2:
+ case 3:
+ _player.addWalker(6, 0);
+ _player.addWalker(5, 0);
+ _player.addWalker(4, 0);
+ state = 2;
+ break;
+
+ case 4:
+ _player.addWalker(8, 0);
+ _player.addWalker(4, 0);
+ state = 4;
+ break;
+
+ default:
+ _player.addWalker(-2, 0);
+ state = 0;
+ break;
+ }
+ break;
+
+ case 2:
+ case 3:
+ switch (command) {
+ case 2:
+ case 3:
+ if (state == 2) {
+ if (_vm->getRandomNumber(1, 30000) < 2000) {
+ _player.addWalker(10, 0);
+ _player.addWalker(7, 0);
+ state = 3;
+ } else
+ _player.addWalker(6, 0);
+ } else {
+ if (_vm->getRandomNumber(1, 30000) < 1000) {
+ _player.addWalker(6, 0);
+ _player.addWalker(7, 0);
+ state = 2;
+ } else
+ _player.addWalker(10, 0);
+ }
+ break;
+
+ default:
+ _player.addWalker(-4, 0);
+ _player.addWalker(-5, 0);
+ if (state == 3) {
+ _player.addWalker(6, 0);
+ _player.addWalker(7, 0);
+ }
+ state = 1;
+ break;
+ }
+ break;
+
+ case 4:
+ if (command == 4)
+ _player.addWalker(9, 0);
+ else {
+ _player.addWalker(-4, 0);
+ _player.addWalker(-8, 0);
+ state = 1;
+ }
+ break;
+
+ case 0:
+ default:
+ switch (command) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ _player.addWalker(2, 0);
+ state = 1;
+ break;
+
+ default:
+ stopWalkerBasic();
+ break;
+ }
+ break;
+ }
+
+ _globals[kWalkerConverse] = command;
+ _globals[kWalkerConverseState] = state;
}
void GamePhantom::step() {
- if (_player._visible && _player._stepEnabled && !_player._moving &&
- (_player._facing == _player._turnToFacing)) {
+ if (_player._visible && !_globals[kStopWalkerDisabled]
+ && (_player._stepEnabled || (_vm->_gameConv->_running >= 0))
+ && !_player._moving && (_player._facing == _player._turnToFacing)
+ && (_scene._frameStartTime >= (uint32)_globals[kWalkerTiming])) {
+ if (!_player._stopWalkerIndex)
+ stopWalker();
- // TODO
+ _globals[kWalkerTiming] += 6;
}
+}
+
+void GamePhantom::stopWalkerBasic() {
+ int rndVal = _vm->getRandomNumber(1, 30000);
+
+ switch (_player._facing) {
+ case FACING_SOUTH:
+ if (rndVal < 500) {
+ int maxSteps = _vm->getRandomNumber(4, 10);
+ for (int i = 0; i < maxSteps; i++)
+ _player.addWalker((rndVal < 250) ? 1 : 2, 0);
+ } else if (rndVal < 750) {
+ for (int i = 0; i < 4; i++)
+ _player.addWalker(1, 0);
+
+ _player.addWalker(0, 0);
+
+ for (int i = 0; i < 4; i++)
+ _player.addWalker(2, 0);
+
+ _player.addWalker(0, 0);
+ }
+ break;
+
+ case FACING_SOUTHEAST:
+ case FACING_SOUTHWEST:
+ case FACING_NORTHEAST:
+ case FACING_NORTHWEST:
+ if (rndVal < 150) {
+ _player.addWalker(-1, 0);
+ _player.addWalker(1, 0);
+ for (int i = 0; i < 6; i++)
+ _player.addWalker(0, 0);
+ }
+ break;
+
+ case FACING_EAST:
+ case FACING_WEST:
+ if (rndVal < 250) {
+ _player.addWalker(-1, 0);
+ int maxSteps = _vm->getRandomNumber(2, 6);
+ for (int i = 0; i < maxSteps; i++)
+ _player.addWalker(2, 0);
+ _player.addWalker(1, 0);
+ _player.addWalker(0, 0);
+ _player.addWalker(0, 0);
+ } else if (rndVal < 500)
+ _globals[kWalkerTiming] = (int)_scene._frameStartTime;
+ break;
+
+ case FACING_NORTH:
+ if (rndVal < 250) {
+ _player.addWalker(-1, 0);
+ int maxSteps = _vm->getRandomNumber(3, 7);
+ for (int i = 0; i < maxSteps; i++)
+ _player.addWalker(2, 0);
+ _player.addWalker(1, 0);
+ _player.addWalker(0, 0);
+ }
+ break;
+ default:
+ break;
+ }
}
void GamePhantom::synchronize(Common::Serializer &s, bool phase1) {
@@ -193,6 +825,116 @@ void GamePhantom::synchronize(Common::Serializer &s, bool phase1) {
}
}
+void GamePhantom::enterCatacombs(bool val) {
+ setupCatacombs();
+
+ int var4, var2;
+ if (_scene._currentSceneId == 409) {
+ if (val) {
+ var4 = _globals[kCatacombs409b];
+ var2 = _globals[kCatacombs409bFrom];
+ } else {
+ var4 = _globals[kCatacombs409a];
+ var2 = _globals[kCatacombs409aFrom];
+ }
+ } else if (_scene._currentSceneId == 501) {
+ var4 = _globals[kCatacombs501];
+ var2 = _globals[kCatacombs501From];
+ } else {
+ var4 = _globals[kCatacombs309];
+ var2 = _globals[kCatacombs309From];
+ }
+
+ newCatacombRoom(var4, var2);
+}
+
+void GamePhantom::initCatacombs() {
+ _globals[kCatacombsRoom] = _globals[kCatacombsNextRoom];
+}
+
+void GamePhantom::setupCatacombs() {
+ switch (_difficulty) {
+ case DIFFICULTY_EASY:
+ _catacombs = _easyCatacombs;
+ _catacombSize = 32;
+
+ _globals[kCatacombs309] = 2;
+ _globals[kCatacombs309From] = 3;
+ _globals[kCatacombs409a] = 30;
+ _globals[kCatacombs409aFrom] = 0;
+ _globals[kCatacombs409b] = 31;
+ _globals[kCatacombs409bFrom] = 2;
+ _globals[kCatacombs501] = 31;
+ _globals[kCatacombs501From] = 0;
+ break;
+
+ case DIFFICULTY_HARD:
+ _catacombs = _hardCatacombs;
+ _catacombSize = 62;
+
+ _globals[kCatacombs309] = 2;
+ _globals[kCatacombs309From] = 3;
+ _globals[kCatacombs409a] = 37;
+ _globals[kCatacombs409aFrom] = 0;
+ _globals[kCatacombs409b] = 39;
+ _globals[kCatacombs409bFrom] = 2;
+ _globals[kCatacombs501] = 56;
+ _globals[kCatacombs501From] = 1;
+ break;
+ }
+}
+
+int GamePhantom::exitCatacombs(int dir) {
+ int scene = _globals[kCatacombsRoom];
+ assert ((scene < _catacombSize) && (dir < 4));
+ return (_catacombs[scene]._exit[dir]);
+};
+
+void GamePhantom::moveCatacombs(int dir) {
+ assert(_globals[kCatacombsRoom] = CLIP(_globals[kCatacombsRoom], 0, _catacombSize));
+ assert(dir = CLIP(dir, 0, 3));
+
+ newCatacombRoom(_catacombs[_globals[kCatacombsRoom]]._fromDirection[dir], _catacombs[_globals[kCatacombsRoom]]._exit[dir]);
+};
+
+void GamePhantom::newCatacombRoom(int toRoom, int fromExit) {
+ _globals[kCatacombsNextRoom] = toRoom;
+ _globals[kCatacombsFrom] = fromExit & 0x03;
+ _globals[kCatacombsFlag] = fromExit & 0xFC;
+
+ int newSceneNum = -1;
+
+ if (toRoom < 0) {
+ switch (toRoom) {
+ case -5:
+ newSceneNum = 501;
+ break;
+
+ case -4:
+ case -3:
+ newSceneNum = 409;
+ break;
+
+ case -2:
+ newSceneNum = 309;
+ break;
+
+ default:
+ error("Unexpected room in newCatacombRoom");
+ }
+ } else {
+ newSceneNum = _catacombs[toRoom]._sceneNum;
+ _globals[81] = _catacombs[toRoom]._flags;
+ }
+
+ if (_triggerSetupMode == SEQUENCE_TRIGGER_PREPARE) {
+ _player._walkOffScreenSceneId = newSceneNum;
+ } else {
+ _scene._reloadSceneFlag = true;
+ _scene._nextSceneId = newSceneNum;
+ }
+}
+
} // End of namespace Phantom
} // End of namespace MADS
diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h
index 44b2321f42..2f0204f331 100644
--- a/engines/mads/phantom/game_phantom.h
+++ b/engines/mads/phantom/game_phantom.h
@@ -32,8 +32,9 @@ namespace MADS {
namespace Phantom {
-// TODO: Adapt for Phantom's difficulty setting
-enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 };
+enum Difficulty {
+ DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3
+};
enum InventoryObject {
OBJ_NONE = -1,
@@ -64,8 +65,40 @@ enum InventoryObject {
OBJ_OAR = 24
};
+enum MazeEvent {
+ MAZE_EVENT_NONE = 0,
+ MAZE_EVENT_PUDDLE = 0x0001,
+ MAZE_EVENT_RAT_NEST = 0x0002,
+ MAZE_EVENT_SKULL = 0x0004,
+ MAZE_EVENT_POT = 0x0008,
+ MAZE_EVENT_BRICK = 0x0010,
+ MAZE_EVENT_HOLE = 0x0020,
+ MAZE_EVENT_WEB = 0x0040,
+ MAZE_EVENT_PLANK = 0x0080,
+ MAZE_EVENT_DRAIN = 0x0100,
+ MAZE_EVENT_STONE = 0x0200,
+ MAZE_EVENT_BLOCK = 0x0400,
+ MAZE_EVENT_FALLEN_BLOCK = 0x0800
+};
+
+struct Catacombs {
+ int _sceneNum;
+ int _exit[4];
+ int _fromDirection[4];
+ int _flags;
+};
+
class GamePhantom : public Game {
friend class Game;
+
+private:
+ void genericObjectExamine();
+ void stopWalker();
+ void stopWalkerBasic();
+
+ Catacombs *_catacombs;
+ int _catacombSize;
+
protected:
GamePhantom(MADSEngine *vm);
@@ -78,7 +111,8 @@ protected:
virtual void checkShowDialog();
public:
PhantomGlobals _globals;
- StoryMode _storyMode;
+ Difficulty _difficulty;
+
virtual Globals &globals() { return _globals; }
@@ -89,20 +123,25 @@ public:
virtual void step();
virtual void synchronize(Common::Serializer &s, bool phase1);
-};
+ void setupCatacombs();
+ void enterCatacombs(bool val);
+ void initCatacombs();
+ void moveCatacombs(int dir);
+ int exitCatacombs(int dir);
+ void newCatacombRoom(int fromRoom, int fromExit);
+};
+// Section handlers aren't needed in ScummVM implementation
class Section1Handler : public SectionHandler {
public:
Section1Handler(MADSEngine *vm) : SectionHandler(vm) {}
- // TODO: Properly implement handler methods
virtual void preLoadSection() {}
virtual void sectionPtr2() {}
virtual void postLoadSection() {}
};
-// TODO: Properly implement handler classes
typedef Section1Handler Section2Handler;
typedef Section1Handler Section3Handler;
typedef Section1Handler Section4Handler;
diff --git a/engines/mads/phantom/globals_phantom.cpp b/engines/mads/phantom/globals_phantom.cpp
index e0db0a1bb0..eea84762fe 100644
--- a/engines/mads/phantom/globals_phantom.cpp
+++ b/engines/mads/phantom/globals_phantom.cpp
@@ -28,12 +28,12 @@ namespace MADS {
namespace Phantom {
-PhantomGlobals::PhantomGlobals()
- : Globals() {
+PhantomGlobals::PhantomGlobals() : Globals() {
// Initialize lists
resize(210);
_spriteIndexes.resize(30);
_sequenceIndexes.resize(30);
+ _animationIndexes.resize(30);
}
void PhantomGlobals::synchronize(Common::Serializer &s) {
@@ -41,6 +41,7 @@ void PhantomGlobals::synchronize(Common::Serializer &s) {
_spriteIndexes.synchronize(s);
_sequenceIndexes.synchronize(s);
+ _animationIndexes.synchronize(s);
}
diff --git a/engines/mads/phantom/globals_phantom.h b/engines/mads/phantom/globals_phantom.h
index c23b53cdf5..f120df3c47 100644
--- a/engines/mads/phantom/globals_phantom.h
+++ b/engines/mads/phantom/globals_phantom.h
@@ -99,9 +99,20 @@ enum GlobalId {
// Section #4 Variables
kCatacombsRoom = 80,
- // TODO
+ kCatacombsMisc = 81,
+ kCatacombsFlag = 82,
+ kCatacombsFrom = 83,
+ kCatacombs309 = 84,
+ kCatacombs409a = 85,
+ kCatacombs409b = 86,
+ kCatacombs501 = 87,
+ kCatacombs309From = 88,
+ kCatacombs409aFrom = 89,
+ kCatacombs409bFrom = 90,
+ kCatacombs501From = 91,
+ kCatacombsNextRoom = 92,
kDoorIn409IsOpen = 93,
- kUnknown = 94, // TODO
+ kPriestPistonPuke = 94,
kCobwebIsCut = 95,
// Section #5 Variables
@@ -124,6 +135,7 @@ class PhantomGlobals : public Globals {
public:
SynchronizedList _spriteIndexes;
SynchronizedList _sequenceIndexes;
+ SynchronizedList _animationIndexes;
public:
/**
* Constructor
diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp
index f7f4d154df..f7a7153fbe 100644
--- a/engines/mads/phantom/phantom_scenes.cpp
+++ b/engines/mads/phantom/phantom_scenes.cpp
@@ -29,6 +29,10 @@
#include "mads/phantom/game_phantom.h"
#include "mads/phantom/phantom_scenes.h"
#include "mads/phantom/phantom_scenes1.h"
+#include "mads/phantom/phantom_scenes2.h"
+#include "mads/phantom/phantom_scenes3.h"
+#include "mads/phantom/phantom_scenes4.h"
+#include "mads/phantom/phantom_scenes5.h"
namespace MADS {
@@ -37,8 +41,9 @@ namespace Phantom {
SceneLogic *SceneFactory::createScene(MADSEngine *vm) {
Scene &scene = vm->_game->_scene;
- // TODO
- //scene.addActiveVocab(NOUN_DROP);
+ // When changing from one section to the other, set the scaling velocity
+ if ((scene._nextSceneId / 100) != (scene._priorSceneId / 100))
+ vm->_game->_player._scalingVelocity = true;
switch (scene._nextSceneId) {
// Scene group #1 (theater, stage and dressing rooms)
@@ -47,107 +52,107 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) {
case 102: // music stands
return new Scene102(vm);
case 103: // below stage
- return new DummyScene(vm); // TODO
+ return new Scene103(vm);
case 104: // stage
- return new DummyScene(vm); // TODO
+ return new Scene104(vm);
case 105: // ground floor, storage room
- return new DummyScene(vm); // TODO
+ return new Scene105(vm);
case 106: // behind stage
- return new DummyScene(vm); // TODO
+ return new Scene106(vm);
case 107: // stage right wing
- return new DummyScene(vm); // TODO
+ return new Scene107(vm);
case 108: // stage left wing
- return new DummyScene(vm); // TODO
+ return new Scene108(vm);
case 109: // upper floor, staircase
- return new DummyScene(vm); // TODO
+ return new Scene109(vm);
case 110: // outside dressing rooms 1
- return new DummyScene(vm); // TODO
+ return new Scene110(vm);
case 111: // outside dressing rooms 2
- return new DummyScene(vm); // TODO
+ return new Scene111(vm);
case 112: // inside dressing room 1
- return new DummyScene(vm); // TODO
+ return new Scene112(vm);
case 113: // inside dressing room 2
- return new DummyScene(vm); // TODO
+ return new Scene113(vm);
case 114: // lower floor, storage room
- return new DummyScene(vm); // TODO
+ return new Scene114(vm);
case 150: // cutscene
- return new DummyScene(vm); // TODO
+ return new Scene150(vm);
// Scene group #2 (theater entrance, offices, balcony)
case 201: // entrance / ticket office
- return new DummyScene(vm); // TODO
+ return new Scene201(vm);
case 202: // outside offices / paintings room
- return new DummyScene(vm); // TODO
+ return new Scene202(vm);
case 203: // office
- return new DummyScene(vm); // TODO
+ return new Scene203(vm);
case 204: // library
- return new DummyScene(vm); // TODO
+ return new Scene204(vm);
case 205: // upper floor, outside balcony boxes
- return new DummyScene(vm); // TODO
+ return new Scene205(vm);
case 206: // balcony box #1
- return new DummyScene(vm); // TODO
+ return new Scene206(vm);
case 207: // balcony box #2
- return new DummyScene(vm); // TODO
+ return new Scene207(vm);
case 208: // stage and balcony view
- return new DummyScene(vm); // TODO
+ return new Scene208(vm);
case 250: // cutscene
- return new DummyScene(vm); // TODO
+ return new Scene250(vm);
// Scene group #3 (catwalks, chandelier, lake / catacombs entrance)
case 301: // catwalk #1 above stage
- return new DummyScene(vm); // TODO
+ return new Scene301(vm);
case 302: // catwalk #2 above stage
- return new DummyScene(vm); // TODO
+ return new Scene302(vm);
case 303: // above chandelier
- return new DummyScene(vm); // TODO
+ return new Scene303(vm);
case 304: // chandelier
- return new DummyScene(vm); // TODO
+ return new Scene304(vm);
case 305: // chandelier fight, phantom closeup
- return new DummyScene(vm); // TODO
+ return new Scene305(vm);
case 306: // chandelier #2
- return new DummyScene(vm); // TODO
+ return new Scene306(vm);
case 307: // catwalk #3 above stage
- return new DummyScene(vm); // TODO
+ return new Scene307(vm);
case 308: // hidden staircase behind balcony box
- return new DummyScene(vm); // TODO
+ return new Scene308(vm);
case 309: // lake and archway
- return new DummyScene(vm); // TODO
+ return new Scene309(vm);
case 310: // lake
- return new DummyScene(vm); // TODO
+ return new Scene310(vm);
// Scene group #4 (labyrinth)
case 401: // labyrinth room, 3 exits
- return new DummyScene(vm); // TODO
+ return new Scene401(vm);
case 403: // labyrinth room (big), 4 exits + 1 bricked door, left
- return new DummyScene(vm); // TODO
+ return new Scene403(vm);
case 404: // labyrinth room, 3 exits
- return new DummyScene(vm); // TODO
+ return new Scene404(vm);
case 406: // labyrinth room, 2 exits
- return new DummyScene(vm); // TODO
+ return new Scene406(vm);
case 407: // catacomb room / lake
- return new DummyScene(vm); // TODO
+ return new Scene407(vm);
case 408: // catacomb corridor
- return new DummyScene(vm); // TODO
+ return new Scene408(vm);
case 409: // catacomb room, door with switch panel
- return new DummyScene(vm); // TODO
+ return new Scene409(vm);
case 410: // skull switch panel
- return new DummyScene(vm); // TODO
+ return new Scene410(vm);
case 453: // Labyrinth room (big), 4 exits + 1 bricked door, right
- return new DummyScene(vm); // TODO
+ return new Scene453(vm);
case 456: // Labyrinth room, 2 exits
- return new DummyScene(vm); // TODO
+ return new Scene456(vm);
// Scene group #5 (Phantom's hideout)
case 501: // catacombs, outside phantom's hideout, lake and boat
- return new DummyScene(vm); // TODO
+ return new Scene501(vm);
case 502: // push panel trap
- return new DummyScene(vm); // TODO
+ return new Scene502(vm);
case 504: // Phantom's hideout, church organ
- return new DummyScene(vm); // TODO
+ return new Scene504(vm);
case 505: // Phantom's hideout, sarcophagus
- return new DummyScene(vm); // TODO
+ return new Scene505(vm);
case 506: // catacomb room with ramp
- return new DummyScene(vm); // TODO
+ return new Scene506(vm);
default:
error("Invalid scene %d called", scene._nextSceneId);
@@ -170,12 +175,12 @@ Common::String PhantomScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
void SceneInfoPhantom::loadCodes(MSurface &depthSurface, int variant) {
- // The intro scenes do not have any codes
- if (_sceneId >= 900)
+ Common::String ext = Common::String::format(".WW%d", variant);
+ Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
+ if (!Common::File::exists(fileName))
return;
- Common::String ext = Common::String::format(".WW%d", variant);
- File f(Resources::formatName(RESPREFIX_RM, _sceneId, ext));
+ File f(fileName);
MadsPack codesPack(&f);
Common::SeekableReadStream *stream = codesPack.getItemStream(0);
diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h
index c0a823ae06..a6a8395a2c 100644
--- a/engines/mads/phantom/phantom_scenes.h
+++ b/engines/mads/phantom/phantom_scenes.h
@@ -46,13 +46,19 @@ enum Verb {
VERB_CLOSE = 0xB,
VERB_THROW = 0xC,
VERB_WALK_TO = 0xD,
+ VERB_ATTACK = 0x14,
VERB_CLIMB_DOWN = 0x21,
VERB_CLIMB_INTO = 0x22,
VERB_CLIMB_THROUGH = 0x23,
+ VERB_EXIT = 0x34,
VERB_EXIT_TO = 0x37,
VERB_JUMP_INTO = 0x53,
+ VERB_LASSO = 0x59,
+ VERB_LOCK = 0x5D,
VERB_LOOK_AT = 0x60,
VERB_LOOK_THROUGH = 0x61,
+ VERB_READ = 0x7A,
+ VERB_REMOVE = 0x7C,
VERB_TURN_OFF = 0x95,
VERB_TURN_ON = 0x96,
VERB_UNLOCK = 0x97,
@@ -60,9 +66,18 @@ enum Verb {
VERB_WALK_DOWN = 0x9A,
VERB_WALK_THROUGH = 0x9B,
VERB_WALK_UP = 0x9C,
+ VERB_WEAR = 0xA1,
VERB_CLIMB_UP = 0xA5,
VERB_WALK_ONTO = 0xA6,
- VERB_WALK = 0xA7
+ VERB_WALK = 0xA7,
+ VERB_ENTER = 0xEC,
+ VERB_WALK_BEHIND = 0xF3,
+ VERB_CLIMB = 0x120,
+ VERB_ATTACH = 0x131,
+ VERB_GRAPPLE = 0x133,
+ VERB_SIT_ON = 0x138,
+ VERB_SIT_IN = 0x13A,
+ VERB_WALK_DOWN_STAIRS_TO = 0x153
};
enum Noun {
@@ -74,7 +89,6 @@ enum Noun {
NOUN_ACT_CURTAIN = 0x11,
NOUN_AISLE = 0x12,
NOUN_APRON = 0x13,
- NOUN_ATTACK = 0x14,
NOUN_BACKSTAGE = 0x15,
NOUN_BEAR_PROP = 0x16,
NOUN_BLUE_FRAME = 0x17,
@@ -103,7 +117,6 @@ enum Noun {
NOUN_DRESSING_TABLE = 0x31,
NOUN_ELEPHANT_PROP = 0x32,
NOUN_ENVELOPE = 0x33,
- NOUN_EXIT = 0x34,
NOUN_EXIT_DOWN = 0x35,
NOUN_EXIT_SIGN = 0x36,
NOUN_EXIT_TO_BACKSTAGE = 0x38,
@@ -138,11 +151,9 @@ enum Noun {
NOUN_LAMP = 0x56,
NOUN_LANTERN = 0x57,
NOUN_LARGE_NOTE = 0x58,
- NOUN_LASSO = 0x59,
NOUN_LEG = 0x5A,
NOUN_LETTER = 0x5B,
NOUN_LIGHT_FIXTURE = 0x5C,
- NOUN_LOCK = 0x5D,
NOUN_LOCKING_RAIL = 0x5E,
NOUN_LOCKRAIL = 0x5F,
NOUN_MANNEQUINS = 0x62,
@@ -169,9 +180,7 @@ enum Noun {
NOUN_PROSCENIUM_ARCH = 0x77,
NOUN_PURCHASE_LINES = 0x78,
NOUN_RAILING = 0x79,
- NOUN_READ = 0x7A,
NOUN_RED_FRAME = 0x7B,
- NOUN_REMOVE = 0x7C,
NOUN_ROPE = 0x7D,
NOUN_RUG = 0x7E,
NOUN_SANDBAG = 0x7F,
@@ -201,7 +210,6 @@ enum Noun {
NOUN_WARDROBE = 0x9E,
NOUN_WASTE_BASKET = 0x9F,
NOUN_WATER_PIPE = 0xA0,
- NOUN_WEAR = 0xA1,
NOUN_WEDDING_RING = 0xA2,
NOUN_YELLOW_FRAME = 0xA3,
NOUN_PROP = 0xA4,
@@ -273,14 +281,12 @@ enum Noun {
NOUN_DECORATIVE_VASE = 0xE9,
NOUN_MARBLE_COLUMN = 0xEA,
NOUN_BOX_FIVE = 0xEB,
- NOUN_ENTER = 0xEC,
NOUN_BOX_SIX = 0xED,
NOUN_BOX_SEVEN = 0xEE,
NOUN_BOX_EIGHT = 0xEF,
NOUN_BOX_NINE = 0xF0,
NOUN_STEP = 0xF1,
NOUN_PANEL = 0xF2,
- NOUN_WALK_BEHIND = 0xF3,
NOUN_MIDDLE_DOORWAY = 0xF4,
NOUN_LIGHT = 0xF5,
NOUN_CANDLE = 0xF6,
@@ -325,7 +331,6 @@ enum Noun {
NOUN_MIDDLE_LEVEL = 0x11D,
NOUN_LOWER_LEVEL = 0x11E,
NOUN_LADDER = 0x11F,
- NOUN_CLIMB = 0x120,
NOUN_CHANDELIER_TRAP = 0x121,
NOUN_PIECE_OF_WOOD = 0x122,
NOUN_CUT_HEMP = 0x123,
@@ -342,16 +347,12 @@ enum Noun {
NOUN_MONSIEUR_RICHARD = 0x12E,
NOUN_JULIE2 = 0x12F,
NOUN_CABLE_HOOK = 0x130,
- NOUN_ATTACH = 0x131,
NOUN_ROPE_WITH_HOOK = 0x132,
- NOUN_GRAPPLE = 0x133,
NOUN_OAR = 0x134,
NOUN_ORGAN = 0x135,
NOUN_SIT_AT = 0x136,
NOUN_ORGAN_BENCH = 0x137,
- NOUN_SIT_ON = 0x138,
NOUN_LARGE_CHAIR = 0x139,
- NOUN_SIT_IN = 0x13A,
NOUN_SARCOPHAGUS = 0x13B,
NOUN_SKULL = 0x13C,
NOUN_SKULLS = 0x13D,
@@ -376,7 +377,6 @@ enum Noun {
NOUN_BOX_TEN = 0x150,
NOUN_FOYER = 0x151,
NOUN_WALK_DOWN_STAIRCASE = 0x152,
- NOUN_WALK_DOWN_STAIRS_TO = 0x153,
NOUN_HAT_RACK = 0x154,
NOUN_VASE = 0x155,
NOUN_CLOTHES_DUMMY = 0x156,
@@ -484,20 +484,7 @@ protected:
SceneInfoPhantom(MADSEngine *vm) : SceneInfo(vm) {}
};
-// TODO: Temporary, remove once implemented properly
-class DummyScene : public PhantomScene {
-public:
- DummyScene(MADSEngine *vm) : PhantomScene(vm) {
- warning("Unimplemented scene");
- }
-
- virtual void setup() {}
- virtual void enter() {}
- virtual void actions() {}
-};
-
} // End of namespace Phantom
-
} // End of namespace MADS
#endif /* MADS_PHANTOM_SCENES_H */
diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp
index 2d991fd3bc..f42b3e64b5 100644
--- a/engines/mads/phantom/phantom_scenes1.cpp
+++ b/engines/mads/phantom/phantom_scenes1.cpp
@@ -11,7 +11,7 @@
* 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
+ * 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
@@ -22,6 +22,7 @@
#include "common/scummsys.h"
#include "mads/mads.h"
+#include "mads/conversations.h"
#include "mads/scene.h"
#include "mads/phantom/phantom_scenes.h"
#include "mads/phantom/phantom_scenes1.h"
@@ -31,72 +32,284 @@ namespace MADS {
namespace Phantom {
void Scene1xx::setAAName() {
- // TODO
- //int idx = 0;
- //_game._aaName = Resources::formatAAName(idx);
+ _game._aaName = Resources::formatAAName(_globals[kTempInterface]);
+ _vm->_palette->setEntry(254, 43, 47, 51);
}
void Scene1xx::sceneEntrySound() {
- // TODO
+ if (!_vm->_musicFlag)
+ return;
+
+ if (_globals[kDoneBrieConv203] == 3) {
+ _vm->_sound->command(39);
+ } else {
+ switch (_scene->_nextSceneId) {
+ case 101:
+ if (!_game._visitedScenes._sceneRevisited)
+ _vm->_sound->command(38);
+ else
+ _vm->_sound->command(16);
+ break;
+
+ case 102:
+ if (_scene->_priorSceneId == 104)
+ _vm->_sound->command(27);
+ else
+ _vm->_sound->command(16);
+ break;
+
+ case 103:
+ if ((_globals[kJacquesStatus] == 2)) {
+ _vm->_sound->command(32);
+ _globals[kJacquesStatus] = 3;
+ } else
+ _vm->_sound->command(16);
+ break;
+
+ case 104:
+ if ((_vm->_gameConv->_restoreRunning == 7) || (_scene->_priorSceneId == 301)) {
+ _vm->_sound->command(33);
+ } else if (!_globals[kRoom103104Transition] && !_globals[kObservedPhan104]) {
+ _vm->_sound->command(37);
+ _globals[kObservedPhan104] = true;
+ } else
+ _vm->_sound->command(16);
+ break;
+
+ case 111:
+ if (_scene->_priorSceneId == 150)
+ _vm->_sound->command(38);
+ else if (_globals[kLeaveAngelMusicOn])
+ _vm->_sound->command(34);
+ else
+ _vm->_sound->command(16);
+ break;
+ case 113:
+ if (_globals[kLeaveAngelMusicOn])
+ _vm->_sound->command(34);
+ else if (_globals[kCurrentYear] == 1993)
+ _vm->_sound->command(36);
+ else
+ _vm->_sound->command(35);
+ break;
+
+ default:
+ if ((_scene->_priorSceneId != 204) && (_scene->_nextSceneId != 150))
+ _vm->_sound->command(16);
+ break;
+ }
+ }
+}
+
+void Scene1xx::setPlayerSpritesPrefix() {
+ _vm->_sound->command(5);
+
+ Common::String oldName = _game._player._spritesPrefix;
+
+ if (!_game._player._forcePrefix)
+ _game._player._spritesPrefix = "RAL";
+
+ if (oldName != _game._player._spritesPrefix)
+ _game._player._spritesChanged = true;
+
+ _game._player._scalingVelocity = true;
}
/*------------------------------------------------------------------------*/
Scene101::Scene101(MADSEngine *vm) : Scene1xx(vm) {
-
+ _chanStatus = -1;
+ _wipeStatus = -1;
+ _callingStatus = -1;
+ _chandelierStatus = -1;
+ _callingFrame = -1;
+ _chandelierFrame = -1;
+ _convCounter = 0;
+ _talkCounter = -1;
+ _brieAnimId = 0;
+ _startWalkingFl = false;
+ _startWalking0Fl = false;
+ _anim0Running = false;
+ _anim1Running = false;
+ _startSittingFl = false;
}
void Scene101::synchronize(Common::Serializer &s) {
Scene1xx::synchronize(s);
-
+ s.syncAsSint16LE(_chanStatus);
+ s.syncAsSint16LE(_wipeStatus);
+ s.syncAsSint16LE(_callingStatus);
+ s.syncAsSint16LE(_chandelierStatus);
+ s.syncAsSint16LE(_callingFrame);
+ s.syncAsSint16LE(_chandelierFrame);
+ s.syncAsSint16LE(_convCounter);
+ s.syncAsSint16LE(_talkCounter);
+ s.syncAsSint16LE(_brieAnimId);
+ s.syncAsByte(_startWalkingFl);
+ s.syncAsByte(_startWalking0Fl);
+ s.syncAsByte(_anim0Running);
+ s.syncAsByte(_anim1Running);
+ s.syncAsByte(_startSittingFl);
}
void Scene101::setup() {
- //setPlayerSpritesPrefix();
+ setPlayerSpritesPrefix();
setAAName();
+ _scene->addActiveVocab(NOUN_MONSIEUR_BRIE);
}
void Scene101::enter() {
- // TODO
+ _vm->_disableFastwalk = true;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
+ _chanStatus = _wipeStatus = -1;
+ _startWalkingFl = _startWalking0Fl = false;
+ _anim0Running = _anim1Running = false;
+ _startSittingFl = false;
+ }
+
+ // Load Dialogs
+ _vm->_gameConv->get(0);
+ _vm->_gameConv->get(1);
if (_globals[kCurrentYear] == 1993) {
_globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
- // TODO
- //_scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
} else {
- // TODO
+ _scene->_hotspots.activate(NOUN_CHANDELIER, false);
+ }
+
+ if (_globals[kBrieTalkStatus] == 0) {
+ _game._player.firstWalk(Common::Point(-20, 75), FACING_EAST, Common::Point(18, 79), FACING_EAST, true);
+ _callingStatus = 0;
+ _chandelierStatus = 3;
+ _game._player.setWalkTrigger(50);
+
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('b', 9), 1);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 8), 1);
+
+ _anim0Running = true;
+ _anim1Running = true;
+
+ _brieAnimId = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[_brieAnimId]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_brieAnimId, Common::Point(490, 119), FACING_NONE);
+ _scene->setDynamicAnim(_brieAnimId, _globals._animationIndexes[0], 0);
+ _scene->setDynamicAnim(_brieAnimId, _globals._animationIndexes[0], 1);
+ _scene->setDynamicAnim(_brieAnimId, _globals._animationIndexes[0], 2);
+ _scene->setDynamicAnim(_brieAnimId, _globals._animationIndexes[0], 3);
+ _scene->setDynamicAnim(_brieAnimId, _globals._animationIndexes[0], 4);
+
+ int tmpIdx = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(25, 80), FACING_NONE);
+ _scene->setDynamicAnim(tmpIdx, _globals._animationIndexes[1], 1);
+ _scene->setDynamicAnim(tmpIdx, _globals._animationIndexes[1], 2);
+
+ _talkCounter = 0;
+ } else if (_globals[kBrieTalkStatus] == 1) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('b', 9), 1);
+ _brieAnimId = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[_brieAnimId]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(_brieAnimId, _globals._animationIndexes[1], 1);
+ _scene->setDynamicAnim(_brieAnimId, _globals._animationIndexes[1], 2);
+ _anim1Running = true;
+ _talkCounter = 0;
+ _chandelierStatus = 3;
+
+ if (_vm->_gameConv->_restoreRunning == 1) {
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _chandelierStatus = 4;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 25);
+ }
+ } else if (_scene->_priorSceneId == 202) {
+ if (_globals[kJacquesStatus] == 1)
+ _globals[kJacquesStatus] = 2;
+ _game._player.firstWalk(Common::Point(-20, 75), FACING_EAST, Common::Point(18, 79), FACING_EAST, true);
+ } else if ((_scene->_priorSceneId == 102) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player.firstWalk(Common::Point(655, 130), FACING_WEST, Common::Point(625, 127), FACING_WEST, true);
+ _scene->setCamera(Common::Point(320, 0));
}
- // TODO
+ sceneEntrySound();
}
void Scene101::step() {
- // TODO
+ if (_anim0Running)
+ handleAnimation0();
+
+ if ((_globals[kWalkerConverse] == 2) || (_globals[kWalkerConverse] == 3)) {
+ ++_convCounter;
+ if (_convCounter > 200)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ if (_anim1Running) {
+ handleAnimation1();
+
+ if (_scene->getAnimFrame(_globals._animationIndexes[1]) == 80) {
+ _game._player._stepEnabled = true;
+ _game._player.setWalkTrigger(55);
+ }
+ }
+
+ if (_scene->_posAdjust.x > 200 && !_startSittingFl && (_globals[kBrieTalkStatus] != 2)) {
+ _startSittingFl = true;
+ _game._player.walk(Common::Point(490, 119), FACING_NORTHEAST);
+ _game._player._stepEnabled = false;
+ _game._player.setWalkTrigger(55);
+ _chandelierStatus = 4;
+ }
+
+ if (_game._trigger == 55) {
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(1);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _chandelierFrame = -1;
+ _talkCounter = 0;
+ }
+
+ if (_game._trigger == 50) {
+ _vm->_gameConv->run(0);
+ _callingStatus = 1;
+ }
}
void Scene101::preActions() {
if (_action.isAction(VERB_EXIT_TO, NOUN_ORCHESTRA_PIT)) {
- // TODO: Handle Brie
- _game._player._walkOffScreenSceneId = 102;
+ if ((_globals[kBrieTalkStatus] == 2) || _startWalkingFl) {
+ _game._player._walkOffScreenSceneId = 102;
+ _globals[kBrieTalkStatus] = 2;
+ } else {
+ _vm->_gameConv->run(0);
+ _game._player._needToWalk = false;
+ }
} else if (_action.isAction(VERB_EXIT_TO, NOUN_GRAND_FOYER)) {
- // TODO: Handle Brie
- _game._player._walkOffScreenSceneId = 202;
- } else if (_action.isAction(VERB_TAKE, NOUN_MONSIEUR_BRIE)) {
- _vm->_dialogs->show(10121);
- } else if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_BRIE)) {
- if (_globals[kBrieTalkStatus] == 2)
+ if ((_globals[kBrieTalkStatus] == 2) || _startWalkingFl)
+ _game._player._walkOffScreenSceneId = 202;
+ else {
+ _vm->_gameConv->run(0);
_game._player._needToWalk = false;
- }
-
- // TODO
+ }
+ } else if (_action.isAction(VERB_TAKE, NOUN_MONSIEUR_BRIE))
+ _vm->_dialogs->show(10121);
+ else if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_BRIE) && (_globals[kBrieTalkStatus] == 2))
+ _game._player._needToWalk = false;
}
void Scene101::actions() {
- // TODO: Brie conversation
-
- // TODO: Look around
-
- if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_vm->_gameConv->_running == 0)
+ handleConversation0();
+ else if (_vm->_gameConv->_running == 1)
+ handleConversation1();
+ else if (_action._lookFlag) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10110);
+ else
+ _vm->_dialogs->show(10111);
+ } else if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
if (_action.isObject(NOUN_AISLE)) {
_vm->_dialogs->show(10112);
} else if (_action.isObject(NOUN_CHANDELIER)) {
@@ -106,8 +319,10 @@ void Scene101::actions() {
} else if (_action.isObject(NOUN_SIDE_WALL)) {
_vm->_dialogs->show(10115);
} else if (_action.isObject(NOUN_SEATS)) {
- // TODO: Finish this
- _vm->_dialogs->show(10116);
+ if ((_globals[kBrieTalkStatus] > 1) || _startWalkingFl)
+ _vm->_dialogs->show(10119);
+ else
+ _vm->_dialogs->show(10116);
} else if (_action.isObject(NOUN_GRAND_FOYER)) {
_vm->_dialogs->show(10117);
} else if (_action.isObject(NOUN_ORCHESTRA_PIT)) {
@@ -115,64 +330,358 @@ void Scene101::actions() {
} else if (_action.isObject(NOUN_MONSIEUR_BRIE)) {
_vm->_dialogs->show(10120);
}
-
- _game._player._stepEnabled = true;
} else if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_BRIE)) {
if (_globals[kBrieTalkStatus] == 2)
_vm->_dialogs->show(10122);
- _game._player._stepEnabled = true;
- } else if (_action.isAction(VERB_TAKE, NOUN_MONSIEUR_BRIE)) {
- _game._player._stepEnabled = true;
+ } else if (!_action.isAction(VERB_TAKE, NOUN_MONSIEUR_BRIE))
+ return;
+
+ _action._inProgress = false;
+}
+
+void Scene101::handleConversation0() {
+ _vm->_gameConv->setHeroTrigger(90);
+
+ if (_game._trigger == 90) {
+ _globals[kBrieTalkStatus] = 1;
+ _startWalking0Fl = true;
+ }
+}
+
+void Scene101::handleConversation1() {
+ if ((_action._activeAction._verbId >= 0) && (_action._activeAction._verbId <= 27)) {
+ bool interlocutorFl = false;
+
+ if (_game._trigger == 60) {
+ switch (_action._activeAction._verbId) {
+ case 0:
+ _chandelierStatus = 6;
+ _wipeStatus = 2;
+ break;
+
+ case 1:
+ _chandelierStatus = 2;
+ _chanStatus = 9;
+ break;
+
+ case 4:
+ _chandelierStatus = 0;
+ _chanStatus = -1;
+ _wipeStatus = -1;
+ break;
+
+ case 8:
+ case 10:
+ case 18:
+ case 22:
+ case 24:
+ _startWalkingFl = true;
+ _chanStatus = -1;
+ _wipeStatus = -1;
+ _globals[kWalkerConverse] = 0;
+ _vm->_gameConv->setInterlocutorTrigger(105);
+ interlocutorFl = true;
+ break;
+
+ case 12:
+ _chandelierStatus = 5;
+ _chanStatus = -1;
+ _wipeStatus = -1;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(60);
+
+ _vm->_gameConv->setHeroTrigger(70);
+
+ _talkCounter = 0;
+
+ if (_game._trigger == 60) {
+ if (!_startWalkingFl)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+
+ _chandelierStatus = 2;
+ } else if ((_game._trigger == 70) && !_startWalkingFl) {
+ _chandelierStatus = 4;
+ _chanStatus = -1;
+ _wipeStatus = -1;
+ if (!_startWalkingFl)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+
+ _convCounter = 0;
+ }
+ }
+}
+
+void Scene101::handleAnimation0() {
+ int resetFrame;
+
+ if (_scene->getAnimFrame(_globals._animationIndexes[0]) != _callingFrame) {
+ _callingFrame = _scene->getAnimFrame(_globals._animationIndexes[0]);
+ resetFrame = -1;
+ switch (_callingFrame) {
+ case 1:
+ case 9:
+ case 12:
+ if (_callingStatus == 1) {
+ if (_callingFrame == 9) {
+ if (_startWalking0Fl) {
+ resetFrame = 13;
+ _callingStatus = 3;
+ } else
+ _callingStatus = 2;
+ } else
+ resetFrame = 1;
+ }
+
+ if (_callingStatus == 0) {
+ if (_startWalking0Fl) {
+ resetFrame = 60;
+ _callingStatus = 3;
+ } else
+ resetFrame = 0;
+ }
+
+ if (_callingStatus == 2) {
+ if (_startWalking0Fl) {
+ resetFrame = 13;
+ _callingStatus = 3;
+ } else {
+ ++_talkCounter;
+
+ if (_talkCounter < 18) {
+ if (_vm->getRandomNumber(1, 2) == 1)
+ resetFrame = 7;
+ else
+ resetFrame = 10;
+ } else {
+ resetFrame = 54;
+ _callingStatus = 0;
+ }
+ }
+ }
+ break;
+
+ case 53:
+ _anim0Running = false;
+ _scene->freeAnimation(0);
+ break;
+
+ case 59:
+ if (_startWalking0Fl) {
+ resetFrame = 60;
+ _callingStatus = 3;
+ } else {
+ resetFrame = 0;
+ _callingStatus = 0;
+ }
+ break;
+
+ case 66:
+ resetFrame = 24;
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _callingFrame = resetFrame;
+ }
+ }
+}
+
+void Scene101::handleAnimation1() {
+ if (_scene->getAnimFrame(_globals._animationIndexes[1]) == _chandelierFrame)
+ return;
+
+ _chandelierFrame = _scene->getAnimFrame(_globals._animationIndexes[1]);
+ int resetFrame = -1;
+ switch (_chandelierFrame) {
+ case 1:
+ if (_chandelierStatus == 3)
+ resetFrame = 0;
+ break;
+
+ case 11:
+ case 14:
+ case 17:
+ case 19:
+ case 26:
+ case 44:
+ case 333:
+ if (_talkCounter == _chanStatus) {
+ _chandelierStatus = 0;
+ ++_talkCounter;
+ _chanStatus = -1;
+ }
+
+ if (_talkCounter == _wipeStatus) {
+ _chandelierStatus = 6;
+ ++_talkCounter;
+ _wipeStatus = -1;
+ }
+
+ if (_startWalkingFl) {
+ if (_vm->_gameConv->_running == 1) {
+ if (_talkCounter > 13)
+ _chandelierStatus = 1;
+ } else
+ _chandelierStatus = 1;
+ }
+
+ switch (_chandelierStatus) {
+ case 0:
+ resetFrame = 27;
+ _chandelierStatus = 2;
+ break;
+
+ case 1:
+ _globals[kBrieTalkStatus] = 2;
+ resetFrame = 45;
+ if (_vm->_gameConv->_running == 1)
+ _vm->_gameConv->stop();
+ _scene->_dynamicHotspots.remove(_brieAnimId);
+ _game._player._stepEnabled = false;
+ break;
+
+ case 2:
+ ++_talkCounter;
+ if (_talkCounter < 15) {
+ switch (_vm->getRandomNumber(1, 3)) {
+ case 1:
+ resetFrame = 12;
+ break;
+
+ case 2:
+ resetFrame = 14;
+ break;
+
+ case 3:
+ resetFrame = 17;
+ }
+ } else {
+ _chandelierStatus = 4;
+ resetFrame = 25;
+ }
+ break;
+
+ case 4:
+ resetFrame = 25;
+ break;
+
+ case 5:
+ resetFrame = 21;
+ _chandelierStatus = 2;
+ break;
+
+ case 6:
+ resetFrame = 316;
+ _chandelierStatus = 2;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 315:
+ _scene->freeAnimation(1);
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _chandelierFrame = resetFrame;
}
}
/*------------------------------------------------------------------------*/
Scene102::Scene102(MADSEngine *vm) : Scene1xx(vm) {
- _animRunningFl = false;
+ _anim0Running = false;
}
void Scene102::synchronize(Common::Serializer &s) {
Scene1xx::synchronize(s);
- s.syncAsByte(_animRunningFl);
+ s.syncAsByte(_anim0Running);
}
void Scene102::setup() {
- //setPlayerSpritesPrefix();
+ setPlayerSpritesPrefix();
setAAName();
}
void Scene102::enter() {
- _animRunningFl = false;
+ _anim0Running = false;
_globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0));
_globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RAL86");
if (_globals[kCurrentYear] == 1993) {
_globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
- // TODO
- //_scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
} else {
- // TODO
+ _scene->_hotspots.activate(NOUN_CHANDELIER, false);
}
if (_scene->_priorSceneId == 101) {
_game._player._playerPos = Common::Point(97, 79);
_game._player._facing = FACING_SOUTHEAST;
- // TODO
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 4);
_game._player.walk(Common::Point(83, 87), FACING_SOUTHEAST);
_scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
} else if (_scene->_priorSceneId == 104) {
// Player fell from pit -> death
- // TODO
- } else if (_scene->_priorSceneId == 103 || _scene->_priorSceneId != -1) {
+ Common::Point deathPos = Common::Point(0, 0);
+ int deathScale = 0;
+ int deathDepth = 0;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+
+ switch (_globals[36]) {
+ case 0:
+ deathPos = Common::Point(221, 57);
+ deathScale = 50;
+ deathDepth = 14;
+ break;
+
+ case 1:
+ deathPos = Common::Point(219, 85);
+ deathScale = 60;
+ deathDepth = 6;
+ break;
+
+ case 2:
+ deathPos = Common::Point(257, 138);
+ deathScale = 76;
+ deathDepth = 1;
+ break;
+
+ default:
+ break;
+ }
+ _scene->_userInterface.emptyConversationList();
+ _scene->_userInterface.setup(kInputConversation);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], deathDepth);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], deathPos);
+ _scene->_sequences.setScale(_globals._sequenceIndexes[3], deathScale);
+ _scene->_sequences.addTimer(120, 65);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 4);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else if (_scene->_priorSceneId == 103 || _scene->_priorSceneId != RETURNING_FROM_LOADING) {
_game._player._playerPos = Common::Point(282, 145);
_game._player._facing = FACING_WEST;
- _animRunningFl = true;
- // TODO: Door closing animation
+ _anim0Running = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 60);
} else if (_scene->_priorSceneId == -1) {
- // TODO
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 4);
_scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
}
@@ -180,52 +689,56 @@ void Scene102::enter() {
}
void Scene102::step() {
- if (_game._trigger == 60) { // Door closes
- // TODO
- _animRunningFl = false;
- } else if (_game._trigger == 65) { // Death
- // TODO
- _scene->_currentSceneId = 104;
+ if (_game._trigger == 60) {
+ // Door closes
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 4);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _anim0Running = false;
+ } else if (_game._trigger == 65) {
+ // Death
+ if (_globals[kDeathLocation] == 0)
+ _vm->_dialogs->show(10232);
+ else
+ _vm->_dialogs->show(10229);
+
+ _vm->_sound->command(16);
+ _scene->_nextSceneId = 104;
}
}
void Scene102::preActions() {
- if (_action.isAction(VERB_OPEN, NOUN_ORCHESTRA_DOOR) || _action.isAction(VERB_PUSH, NOUN_ORCHESTRA_DOOR)) {
+ if (_action.isAction(VERB_OPEN, NOUN_ORCHESTRA_DOOR) || _action.isAction(VERB_PUSH, NOUN_ORCHESTRA_DOOR))
_game._player.walk(Common::Point(282, 145), FACING_EAST);
- }
}
void Scene102::actions() {
if (_action.isAction(VERB_WALK_DOWN, NOUN_AISLE)) {
_scene->_nextSceneId = 101;
- _game._player._stepEnabled = true;
- }
-
- if (_action.isAction(VERB_WALK_THROUGH, NOUN_ORCHESTRA_DOOR) ||
+ } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_ORCHESTRA_DOOR) ||
_action.isAction(VERB_PUSH, NOUN_ORCHESTRA_DOOR) ||
_action.isAction(VERB_OPEN, NOUN_ORCHESTRA_DOOR)) {
- if (_animRunningFl) {
- // TODO
+ if (_anim0Running) {
+ _scene->_sequences.addTimer(15, 70);
+ _game._player._stepEnabled = false;
} else {
- _scene->_nextSceneId = 103; // FIXME: temporary HACK - remove!
-
switch (_game._trigger) {
case 70: // try again
case 0:
- // TODO
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 0), 1);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
break;
case 1:
_scene->_nextSceneId = 103;
break;
+ default:
+ break;
}
}
-
- _game._player._stepEnabled = true;
- }
-
- // TODO: Look around
-
- if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ } else if (_action._lookFlag)
+ _vm->_dialogs->show(10210);
+ else if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
if (_action.isObject(NOUN_PIT))
_vm->_dialogs->show(10211);
else if (_action.isObject(NOUN_SEATS))
@@ -263,18 +776,8779 @@ void Scene102::actions() {
_vm->_dialogs->show(10227);
else if (_action.isObject(NOUN_CHANDELIER))
_vm->_dialogs->show(10231);
+ } else if (_action.isAction(VERB_CLOSE, NOUN_ORCHESTRA_DOOR))
+ _vm->_dialogs->show(10228);
+
+ _game._player._stepEnabled = false;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene103::Scene103(MADSEngine *vm) : Scene1xx(vm) {
+ _jacquesAction = -1;
+ _lastRandom = -1;
+ _standPosition = -1;
+ _hotspotPrompt1 = -1;
+ _hotspotPrompt2 = -1;
+ _hotspotPrompt3 = -1;
+ _hotspotPrompt4 = -1;
+ _hotspotPrompt5 = -1;
+ _hotspotRightFloor1 = -1;
+ _hotspotRightFloor2 = -1;
+ _hotspotLeftFloor1 = -1;
+ _hotspotLeftFloor2 = -1;
+ _hotspotGentleman = -1;
+ _convCount = -1;
+ _lastStairFrame = -1;
+ _lastJacquesFrame = -1;
+ _talkCount = -1;
+
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _anim5ActvFl = false;
+ _anim6ActvFl = false;
+ _climbThroughTrapFl = false;
+ _guardFrameFl = false;
+ _sitFl = false;
+}
+
+void Scene103::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsSint16LE(_jacquesAction);
+ s.syncAsSint16LE(_lastRandom);
+ s.syncAsSint16LE(_standPosition);
+ s.syncAsSint16LE(_hotspotPrompt1);
+ s.syncAsSint16LE(_hotspotPrompt2);
+ s.syncAsSint16LE(_hotspotPrompt3);
+ s.syncAsSint16LE(_hotspotPrompt4);
+ s.syncAsSint16LE(_hotspotPrompt5);
+ s.syncAsSint16LE(_hotspotRightFloor1);
+ s.syncAsSint16LE(_hotspotRightFloor2);
+ s.syncAsSint16LE(_hotspotLeftFloor1);
+ s.syncAsSint16LE(_hotspotLeftFloor2);
+ s.syncAsSint16LE(_convCount);
+ s.syncAsSint16LE(_lastStairFrame);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+ s.syncAsByte(_anim4ActvFl);
+ s.syncAsByte(_anim5ActvFl);
+ s.syncAsByte(_anim6ActvFl);
+ s.syncAsByte(_climbThroughTrapFl);
+ s.syncAsByte(_guardFrameFl);
+ s.syncAsByte(_sitFl);
+}
+
+void Scene103::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->_variant = 0;
+
+ if ((_globals[kPrompterStandStatus] == 1) || (_globals[kCurrentYear] == 1881)) {
+ _scene->_variant = 1;
+ if ((_globals[kJacquesStatus] == 0) && (_globals[kCurrentYear] == 1881))
+ _scene->_variant = 2;
+ else if ((_globals[kJacquesStatus] >= 1) && (_globals[kCurrentYear] == 1881))
+ _scene->_variant = 3;
+ }
+
+ _scene->addActiveVocab(NOUN_PROMPTERS_STAND);
+ _scene->addActiveVocab(NOUN_JACQUES);
+ _scene->addActiveVocab(NOUN_GENTLEMAN);
+ _scene->addActiveVocab(VERB_CLIMB);
+}
+
+void Scene103::enter() {
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _anim5ActvFl = false;
+ _anim6ActvFl = false;
+ _climbThroughTrapFl = false;
+ _guardFrameFl = false;
+ _sitFl = false;
+ _jacquesAction = 1;
+ _lastRandom = 0;
+ _standPosition = 0;
+ }
+
+ if (_globals[kJacquesStatus] >= 1) {
+ if (_game._objects.isInRoom(OBJ_KEY)) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RRD_9");
+ }
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 3));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ } else {
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('a', 3));
+ }
+
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 2));
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RDR_6");
+
+ adjustRails(_scene->_variant);
+
+ _scene->_hotspots.activate(NOUN_JACQUES, false);
+ _scene->_hotspots.activate(NOUN_KEY, false);
+
+ _vm->_gameConv->get(12);
+
+ if (_globals[kTrapDoorStatus] == 0) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 3);
+ } else if (_globals[kTrapDoorStatus] == 1) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 3);
+ }
+
+ Common::Point promptPos;
+ Facing promptFacing;
+
+ if (_globals[kJacquesStatus] == 0) {
+ promptPos = Common::Point(115, 142);
+ promptFacing = FACING_NORTHEAST;
+ } else {
+ promptPos = Common::Point(171, 142);
+ promptFacing = FACING_NORTHWEST;
+ }
+
+ if ((_globals[kPrompterStandStatus] == 1) || (_globals[kCurrentYear] == 1881)) {
+ if (_globals[kJacquesStatus] >= 1) {
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(154, 139));
+
+ } else {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(154, 139));
+
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 1);
+ }
+
+ _hotspotPrompt1 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(121, 79, 121 + 40, 79 + 63));
+ _scene->_dynamicHotspots[_hotspotPrompt1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt1, promptPos, promptFacing);
+
+ _hotspotPrompt2 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(161, 67, 161 + 16, 67 + 75));
+ _scene->_dynamicHotspots[_hotspotPrompt2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt2, promptPos, promptFacing);
+
+ _hotspotPrompt3 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(177, 90, 177 + 18, 90 + 52));
+ _scene->_dynamicHotspots[_hotspotPrompt3]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt3, promptPos, promptFacing);
+
+ _hotspotPrompt4 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(114, 100, 114 + 7, 100 + 38));
+ _scene->_dynamicHotspots[_hotspotPrompt4]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt4, promptPos, promptFacing);
+
+ _hotspotPrompt5 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_CLIMB, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(121, 49, 121 + 40, 49 + 30));
+ _scene->_dynamicHotspots[_hotspotPrompt5]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt5, Common::Point(196, 134), FACING_SOUTHWEST);
+ _scene->_dynamicHotspots.setCursor(_hotspotPrompt5, CURSOR_GO_UP);
+
+ _hotspotRightFloor1 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(154, 6, 154 + 41, 6 + 6));
+ _scene->_dynamicHotspots[_hotspotRightFloor1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotRightFloor1, Common::Point(171, 142), FACING_NONE);
+
+ _hotspotRightFloor2 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(114, 136, 114 + 32, 136 + 6));
+ _scene->_dynamicHotspots[_hotspotRightFloor2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotRightFloor2, Common::Point(127, 140), FACING_NONE);
+
+ if ((_globals[kJacquesStatus] == 0) && (_globals[kCurrentYear] == 1881)) {
+ if (_globals[kJacquesNameIsKnown] >= 1) {
+ _hotspotGentleman = _scene->_dynamicHotspots.add(NOUN_JACQUES, VERB_WALKTO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(156, 116, 156 + 33, 116 + 31));
+ _scene->_dynamicHotspots[_hotspotGentleman]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotGentleman, Common::Point(206, 148), FACING_NORTHWEST);
+ } else {
+ _hotspotGentleman = _scene->_dynamicHotspots.add(NOUN_GENTLEMAN, VERB_WALKTO, SYNTAX_MASC_NOT_PROPER, -1, Common::Rect(156, 116, 156 + 33, 116 + 31));
+ _scene->_dynamicHotspots[_hotspotGentleman]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotGentleman, Common::Point(206, 148), FACING_NORTHWEST);
+ }
+ int tmpIdx = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(149, 140, 149 + 13, 140 + 7));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(155, 144), FACING_NONE);
+
+ tmpIdx = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(187, 136, 187 + 8, 136 + 7));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(195, 139), FACING_NONE);
+ } else if ((_globals[kJacquesStatus] >= 1) && (_globals[kCurrentYear] == 1881)) {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 3);
+ if (_game._objects.isInRoom(OBJ_KEY)) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ _scene->_hotspots.activate(NOUN_KEY, true);
+ }
+ _scene->_hotspots.activate(NOUN_JACQUES, true);
+ _scene->_dynamicHotspots.remove(_hotspotRightFloor2);
+
+ int tmpIdx = _scene->_dynamicHotspots.add(NOUN_JACQUES, VERB_WALKTO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(114, 132, 114 + 30, 132 + 10));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(95, 144), FACING_NORTHEAST);
+
+ tmpIdx = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(94, 129, 94 + 18, 129 + 4));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(95, 133), FACING_NONE);
+
+ tmpIdx = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(94, 132, 94 + 3, 132 + 9));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(93, 135), FACING_NONE);
+
+ tmpIdx = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(112, 150, 112 + 21, 150 + 3));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(118, 154), FACING_NONE);
+
+ tmpIdx = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(98, 146, 98 + 21, 146 + 4));
+ _scene->_dynamicHotspots[tmpIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(104, 148), FACING_NONE);
+ }
+ } else if (_globals[kPrompterStandStatus] == 0) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(37, 139));
+
+ _hotspotPrompt1 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(2, 79, 2 + 40, 79 + 63));
+ _scene->_dynamicHotspots[_hotspotPrompt1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt1, Common::Point(59, 140), FACING_NORTHWEST);
+
+ _hotspotPrompt2 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(42, 67, 42 + 16, 67 + 75));
+ _scene->_dynamicHotspots[_hotspotPrompt2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt2, Common::Point(59, 140), FACING_NORTHWEST);
+
+ _hotspotPrompt3 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(58, 90, 58 + 18, 90 + 52));
+ _scene->_dynamicHotspots[_hotspotPrompt3]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt3, Common::Point(59, 140), FACING_NORTHWEST);
+
+ _hotspotPrompt5 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_CLIMB, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(2, 49, 2 + 40, 49 + 30));
+ _scene->_dynamicHotspots[_hotspotPrompt5]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt5, Common::Point(79, 132), FACING_SOUTHWEST);
+ _scene->_dynamicHotspots.setCursor(_hotspotPrompt5, CURSOR_GO_UP);
+
+ _hotspotLeftFloor1 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(35, 137, 35 + 40, 137 + 5));
+ _scene->_dynamicHotspots[_hotspotLeftFloor1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotLeftFloor1, Common::Point(59, 140), FACING_NONE);
+ _hotspotLeftFloor2 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(76, 129, 76 + 6, 129 + 6));
+ _scene->_dynamicHotspots[_hotspotLeftFloor2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotLeftFloor2, Common::Point(80, 135), FACING_NONE);
+ }
+
+ if ((_globals[kJacquesStatus] == 0) && (_globals[kCurrentYear] == 1881)) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('j', 1), 1);
+ _anim0ActvFl = true;
+ _scene->setAnimFrame(_globals._animationIndexes[0], 9);
+ }
+
+ if (_scene->_priorSceneId == 104) {
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ if (_globals[kRoom103104Transition] == 0) {
+ _globals[kRoom103104Transition] = 1;
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 4);
+ _standPosition = 1;
+ _game._player._playerPos = Common::Point(79, 132);
+ _scene->_sequences.addTimer(1, 100);
+ } else {
+ _standPosition = 2;
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('w', 1), 0);
+ _anim3ActvFl = true;
+ _game._player._stepEnabled = true;
+ _game._player._playerPos = Common::Point(196, 134);
+ _scene->setAnimFrame(_globals._animationIndexes[3], 36);
+
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(154, 139));
+ }
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ } else if (_scene->_priorSceneId == 102) {
+ _game._player.firstWalk(Common::Point(-20, 140), FACING_EAST, Common::Point(15, 147), FACING_EAST, true);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ } else if ((_scene->_priorSceneId == 105) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(287, 135);
+ _game._player._facing = FACING_WEST;
+ _game._player._stepEnabled = false;
+ _game._player.walk(Common::Point(252, 134), FACING_WEST);
+ _game._player.setWalkTrigger(65);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 6);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ } else if (_scene->_priorSceneId == -1) {
+ if (_standPosition == 1) {
+ _game._player._visible = false;
+ _globals._animationIndexes[5] = _scene->loadAnimation(formAnimName('w', 3), 0);
+ _anim5ActvFl = true;
+ _scene->setAnimFrame(_globals._animationIndexes[5], 33);
+ } else if (_standPosition == 2) {
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(154, 139));
+ _game._player._visible = false;
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('w', 1), 0);
+ _anim3ActvFl = true;
+ _game._player._stepEnabled = true;
+ _scene->setAnimFrame(_globals._animationIndexes[3], 36);
+ } else if (_vm->_gameConv->_restoreRunning == 12) {
+ _vm->_gameConv->run(12);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_globals[kMusicSelected]);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene103::step() {
+ if (_anim0ActvFl)
+ handleJacquesAnim();
+
+ if (_anim3ActvFl)
+ climbRightStairs();
+
+ if (_anim5ActvFl)
+ climbLeftStairs();
+
+ if (_anim4ActvFl)
+ descendRightStairs();
+
+ if (_anim6ActvFl)
+ descendLeftStairs();
+
+ if ((_globals[kWalkerConverse] == 2) || (_globals[kWalkerConverse] == 3)) {
+ ++_convCount;
+ if (_convCount > 200)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ switch (_game._trigger) {
+ case 65:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 6);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ _vm->_sound->command(66);
+ break;
+
+ case 66: {
+ int syncIdx = _globals._sequenceIndexes[1];
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_SEQ, syncIdx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _game._player._stepEnabled = true;
+ }
+ break;
+
+ case 80:
+ _scene->_nextSceneId = 104;
+ _scene->_reloadSceneFlag = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 100:
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[10], false, 6, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 101);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], -1, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 4);
+ break;
+
+ case 101:
+ _globals._animationIndexes[5] = _scene->loadAnimation(formAnimName('w', 3), 0);
+ _anim5ActvFl = true;
+ _scene->setAnimFrame(_globals._animationIndexes[5], 33);
+ _game._player._stepEnabled = true;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[5], SYNC_SEQ, _globals._sequenceIndexes[10]);
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 0:
+ if (_anim1ActvFl) {
+ if ((_scene->getAnimFrame(_globals._animationIndexes[1]) == 10) && !_guardFrameFl) {
+ _vm->_sound->command(64);
+ _guardFrameFl = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 105);
+ }
+ } else if (_anim2ActvFl) {
+ if ((_scene->getAnimFrame(_globals._animationIndexes[2]) == 7) && !_guardFrameFl) {
+ _vm->_sound->command(64);
+ _guardFrameFl = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 110);
+ }
+ }
+ break;
+
+ case 105:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 2);
+ _guardFrameFl = false;
+ break;
+
+ case 110:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 2);
+ _guardFrameFl = false;
+ break;
+
+ default:
+ break;
+ }
+
+ if (_globals[kJacquesStatus] == 3) {
+ warning("TODO: add a check on the return value of _vm->_sound->command ???");
+ _vm->_sound->command(38);
+ }
+}
+
+void Scene103::preActions() {
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR))
+ _game._player._needToWalk = true;
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR_TO_PIT)) {
+ _game._player.walk(Common::Point(0, 150), FACING_WEST);
+ _game._player._walkOffScreenSceneId = 102;
+ }
+
+ if ((_standPosition != 0) && !_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR) &&
+ !_action.isAction(VERB_OPEN, NOUN_TRAP_DOOR) &&
+ !_action.isAction(VERB_CLIMB, NOUN_PROMPTERS_STAND) &&
+ !_action.isAction(VERB_PUSH, NOUN_TRAP_DOOR) &&
+ !_action.isAction(VERB_LOOK_THROUGH, NOUN_PROMPTERS_BOX) &&
+ !_action.isAction(VERB_PULL, NOUN_TRAP_DOOR)) {
+
+ if (_action.isAction(VERB_PULL) || _action.isAction(VERB_PUSH)) {
+ if (!_action.isObject(NOUN_LEVER) && !_game._trigger)
+ _game._player._needToWalk = false;
+ }
+
+ if ((_action.isAction(VERB_PUSH, NOUN_PROMPTERS_STAND)) || (_action.isAction(VERB_PULL, NOUN_PROMPTERS_STAND))) {
+ if (!_game._trigger)
+ _game._player._needToWalk = true;
+ }
+
+ if (_game._player._needToWalk) {
+ if (_globals[kPrompterStandStatus] == 0) {
+ switch (_game._trigger) {
+ case 0:
+ _scene->freeAnimation(5);
+ _game._player._readyToWalk = false;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _anim5ActvFl = false;
+ _anim6ActvFl = true;
+ _globals._animationIndexes[6] = _scene->loadAnimation(formAnimName('w', 4), 1);
+ break;
+
+ case 1:
+ _game._player._playerPos = Common::Point(79, 132);
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _standPosition = 0;
+ _game._player._readyToWalk = true;
+ if (_action.isAction(VERB_PUSH, NOUN_PROMPTERS_STAND))
+ _game._player._needToWalk = false;
+ _anim6ActvFl = false;
+ _game._player.resetFacing(FACING_NORTHEAST);
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[6]);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case 0:
+ _scene->freeAnimation(3);
+ _game._player._readyToWalk = false;
+ if (_action.isAction(VERB_PUSH, NOUN_PROMPTERS_STAND))
+ _game._player._needToWalk = true;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = true;
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('w', 2), 1);
+ break;
+
+ case 1:
+ _game._player._playerPos = Common::Point(196, 134);
+ _game._player._stepEnabled = true;
+ _game._player._readyToWalk = true;
+ if (_action.isAction(VERB_PUSH, NOUN_PROMPTERS_STAND))
+ _game._player._needToWalk = false;
+ _game._player._visible = true;
+ _standPosition = 0;
+ _anim4ActvFl = false;
+ _game._player.resetFacing(FACING_NORTHEAST);
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[4]);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ if (_standPosition == 0) {
+ if ((_action.isAction(VERB_PUSH, NOUN_PROMPTERS_STAND)) || (_action.isAction(VERB_PULL, NOUN_PROMPTERS_STAND))) {
+ if (_globals[kCurrentYear] == 1993) {
+ if (_globals[kPrompterStandStatus] == 0)
+ _game._player.walk(Common::Point(2, 138), FACING_WEST);
+ else
+ _game._player.walk(Common::Point(176, 142), FACING_WEST);
+ }
+ }
+ }
+
+ if (_action.isAction(VERB_LOOK_THROUGH, NOUN_PROMPTERS_BOX) && (_standPosition == 0) && (_globals[kPrompterStandStatus] == 0) && (_globals[kCurrentYear] == 1993))
+ _game._player.walk(Common::Point(79, 132), FACING_SOUTHWEST);
+
+ if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR) && (_standPosition == 0) && (_globals[kPrompterStandStatus] == 1) && (_globals[kTrapDoorStatus] == 0))
+ _game._player.walk(Common::Point(196, 134), FACING_SOUTHWEST);
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_PIT))
+ _game._player._walkOffScreenSceneId = 102;
+
+ if ((_action.isAction(VERB_OPEN, NOUN_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_DOOR) || _action.isAction(VERB_LOCK, NOUN_DOOR)) && (_standPosition == 0))
+ _game._player.walk(Common::Point(252, 134), FACING_EAST);
+}
+
+void Scene103::actions() {
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR_TO_PIT)) {
+ _scene->_nextSceneId = 102;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 12) {
+ process_conv_jacques();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR)) {
+ if (_globals[kTrapDoorStatus] == 1) {
+ _vm->_dialogs->show(10333);
+ _action._inProgress = false;
+ return;
+ } else if (_globals[kPrompterStandStatus] == 0) {
+ _vm->_dialogs->show(10341);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if ((_action.isAction(VERB_LOOK_THROUGH, NOUN_PROMPTERS_BOX)) && (_globals[kPrompterStandStatus] == 1)) {
+ _vm->_dialogs->show(10342);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_CLIMB, NOUN_PROMPTERS_STAND) && _standPosition == 0) ||
+ (_action.isAction(VERB_LOOK_THROUGH, NOUN_PROMPTERS_BOX) && (_standPosition == 0)) ||
+ (_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR) && (_standPosition == 0))) {
+ if (_globals[kPrompterStandStatus] == 0) {
+ if (_game._trigger == 0) {
+ if (_action.isAction(VERB_LOOK_THROUGH, NOUN_PROMPTERS_BOX)) {
+ _sitFl = true;
+ _globals._animationIndexes[5] = _scene->loadAnimation(formAnimName('w', 3), 115);
+ } else
+ _globals._animationIndexes[5] = _scene->loadAnimation(formAnimName('w', 3), 0);
+
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _anim5ActvFl = true;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[5], SYNC_PLAYER, 0);
+ _action._inProgress = false;
+ return;
+ }
+ } else if (_game._trigger == 0) {
+ if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR)) {
+ _climbThroughTrapFl = true;
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('w', 1), 120);
+ } else
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('w', 1), 0);
+
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _anim3ActvFl = true;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[3], SYNC_PLAYER, 0);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_CLIMB, NOUN_PROMPTERS_STAND) && (_standPosition != 0)) {
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_PUSH, NOUN_PROMPTERS_STAND)) || (_action.isAction(VERB_PULL, NOUN_PROMPTERS_STAND))) {
+ if (_globals[kCurrentYear] == 1993) {
+ if (_globals[kPrompterStandStatus] == 0) {
+ switch (_game._trigger) {
+ case 0:
+ if (_globals[kPrompterStandStatus] == 0) {
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('s', 1), 75);
+ _game._player._priorTimer = _scene->_frameStartTime;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ }
+ break;
+
+ case 75:
+ if (_globals[kPrompterStandStatus] == 0) {
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 1);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(154, 139));
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_ANIM, _globals._animationIndexes[0]);
+ _globals[kPrompterStandStatus] = 1;
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(117, 139);
+ _game._player.resetFacing(FACING_EAST);
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+
+ _scene->_dynamicHotspots.remove(_hotspotPrompt1);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt2);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt3);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt5);
+ _scene->_dynamicHotspots.remove(_hotspotLeftFloor1);
+ _scene->_dynamicHotspots.remove(_hotspotLeftFloor2);
+
+ _hotspotPrompt1 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(121, 79, 121 + 40, 79 + 63));
+ _scene->_dynamicHotspots[_hotspotPrompt1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt1, Common::Point(171, 142), FACING_NORTHWEST);
+
+ _hotspotPrompt2 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(161, 67, 161 + 16, 67 + 75));
+ _scene->_dynamicHotspots[_hotspotPrompt2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt2, Common::Point(171, 142), FACING_NORTHWEST);
+
+ _hotspotPrompt3 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(177, 90, 177 + 18, 90 + 52));
+ _scene->_dynamicHotspots[_hotspotPrompt3]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt3, Common::Point(171, 142), FACING_NORTHWEST);
+
+ _hotspotPrompt4 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(114, 100, 114 + 7, 100 + 38));
+ _scene->_dynamicHotspots[_hotspotPrompt4]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt4, Common::Point(171, 142), FACING_NORTHWEST);
+
+ _hotspotPrompt5 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_CLIMB, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(121, 49, 121 + 40, 49 + 30));
+ _scene->_dynamicHotspots[_hotspotPrompt5]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt5, Common::Point(196, 134), FACING_SOUTHWEST);
+ _scene->_dynamicHotspots.setCursor(_hotspotPrompt5, CURSOR_GO_UP);
+
+ _hotspotRightFloor1 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(154, 6, 154 + 41, 6 + 6));
+ _scene->_dynamicHotspots[_hotspotRightFloor1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotRightFloor1, Common::Point(171, 142), FACING_NONE);
+
+ _hotspotRightFloor2 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(114, 136, 114 + 32, 132 + 6));
+ _scene->_dynamicHotspots[_hotspotRightFloor2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotRightFloor2, Common::Point(127, 140), FACING_NONE);
+
+ _scene->changeVariant(1);
+ adjustRails(1);
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case 0:
+ if (_globals[kPrompterStandStatus] == 1) {
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('s', 2), 75);
+ _game._player._priorTimer = _scene->_frameStartTime;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ }
+ break;
+
+ case 75:
+ if (_globals[kPrompterStandStatus] == 1) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(37, 139));
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_ANIM, _globals._animationIndexes[0]);
+ _globals[kPrompterStandStatus] = 0;
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(62, 142);
+ _game._player.resetFacing(FACING_WEST);
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt1);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt2);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt3);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt4);
+ _scene->_dynamicHotspots.remove(_hotspotPrompt5);
+ _scene->_dynamicHotspots.remove(_hotspotRightFloor1);
+ _scene->_dynamicHotspots.remove(_hotspotRightFloor2);
+
+ _hotspotPrompt1 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(2, 79, 2 + 40, 79 + 63));
+ _scene->_dynamicHotspots[_hotspotPrompt1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt1, Common::Point(59, 140), FACING_NORTHWEST);
+
+ _hotspotPrompt2 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(42, 67, 42 + 16, 67 + 75));
+ _scene->_dynamicHotspots[_hotspotPrompt2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt2, Common::Point(59, 140), FACING_NORTHWEST);
+
+ _hotspotPrompt3 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(58, 90, 58 + 18, 90 + 52));
+ _scene->_dynamicHotspots[_hotspotPrompt3]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt3, Common::Point(59, 140), FACING_NORTHWEST);
+
+ _hotspotLeftFloor1 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(35, 137, 35 + 40, 137 + 5));
+ _scene->_dynamicHotspots[_hotspotLeftFloor1]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotLeftFloor1, Common::Point(59, 140), FACING_NONE);
+
+ _hotspotLeftFloor2 = _scene->_dynamicHotspots.add(NOUN_FLOOR, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(76, 129, 76 + 6, 129 + 6));
+ _scene->_dynamicHotspots[_hotspotLeftFloor2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotLeftFloor2, Common::Point(80, 135), FACING_NONE);
+
+ _hotspotPrompt5 = _scene->_dynamicHotspots.add(NOUN_PROMPTERS_STAND, VERB_CLIMB, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(2, 49, 2 + 40, 49 + 30));
+ _scene->_dynamicHotspots[_hotspotPrompt5]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotPrompt5, Common::Point(79, 132), FACING_SOUTHWEST);
+ _scene->_dynamicHotspots.setCursor(_hotspotPrompt5, CURSOR_GO_UP);
+
+ _scene->changeVariant(0);
+ adjustRails(0);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ } else if (_globals[kJacquesNameIsKnown])
+ _vm->_dialogs->show(10340);
else
+ _vm->_dialogs->show(10350);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_DOOR) || _action.isAction(VERB_LOCK, NOUN_DOOR)) {
+ if ((_globals[kCurrentYear] == 1881) && !_action.isAction(VERB_LOCK, NOUN_DOOR) && !_action.isAction(VERB_UNLOCK, NOUN_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[2] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[2], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 3, 70);
+ break;
+
+ case 2:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[2]);
+ _game._player.walk(Common::Point(295, 132), FACING_WEST);
+ _scene->_sequences.addTimer(180, 3);
+ break;
+
+ case 3:
+ _scene->_nextSceneId = 105;
+ break;
+
+ case 70:
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ _vm->_sound->command(66);
+ break;
+
+ case 71: {
+ int oldIdx = _globals._sequenceIndexes[1];
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_SEQ, oldIdx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1: {
+ int oldIdx = _globals._sequenceIndexes[2];
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[2], SYNC_SEQ, oldIdx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], false);
+ _scene->_sequences.addTimer(15, 2);
+ _vm->_sound->command(73);
+ }
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[2]);
+ _game._player._visible = true;
+ if (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK))
+ _vm->_dialogs->show(00032);
+ else
+ _vm->_dialogs->show(10335);
+
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_KEY) && (_game._objects.isInRoom(OBJ_KEY) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ _action._inProgress = false;
+ return;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _scene->_hotspots.activate(NOUN_KEY, false);
+ _game._objects.addToInventory(OBJ_KEY);
+ _vm->_sound->command(26);
+ _action._inProgress = false;
+ return;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ _globals[kPlayerScore] += 5;
+ _vm->_dialogs->showItem(OBJ_KEY, 800, 0);
+ _game._player._stepEnabled = true;
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_GENTLEMAN) || _action.isAction(VERB_TALK_TO, NOUN_JACQUES)) {
+ if (_globals[kJacquesStatus] == 0) {
+ _vm->_gameConv->run(12);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_globals[kMusicSelected]);
+ } else
+ _vm->_dialogs->show(10343);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR) || _climbThroughTrapFl) {
+ if ((_standPosition == 2) && (_globals[kTrapDoorStatus] == 0)) {
+ switch (_game._trigger) {
+ case 0:
+ case 120:
+ if (!(_globals[kPlayerScoreFlags] & 1)) {
+ _globals[kPlayerScoreFlags] |= 1;
+ _globals[kPlayerScore] += 3;
+ }
+
+ _scene->freeAnimation(3);
+ _anim3ActvFl = false;
+ _climbThroughTrapFl = false;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 5);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1:
+ _globals[kRoom103104Transition] = 1;
+ _scene->_nextSceneId = 104;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK_THROUGH, NOUN_PROMPTERS_BOX) || _sitFl) {
+ if (_standPosition == 1) {
+ switch (_game._trigger) {
+ case 0:
+ case 115:
+ _scene->freeAnimation(5);
+ _anim5ActvFl = false;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 4);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ if (!_sitFl)
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[10], SYNC_ANIM, _globals._animationIndexes[5]);
+ _sitFl = false;
+ break;
+
+ case 1:
+ _globals[kRoom103104Transition] = 0;
+ _scene->_nextSceneId = 104;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PUSH, NOUN_LEVER) || _action.isAction(VERB_PULL, NOUN_LEVER)) {
+ if (_globals[kTrapDoorStatus] == 1) {
+ switch (_game._trigger) {
+ case 0:
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('l', 1), 1);
+ _anim1ActvFl = true;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[1], SYNC_PLAYER, 0);
+ break;
+
+ case 1:
+ _anim1ActvFl = false;
+ _game._player._visible = true;
+ _globals[kTrapDoorStatus] = 0;
+ _game._player._stepEnabled = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case 0:
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('l', 2), 1);
+ _anim2ActvFl = true;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[2], SYNC_PLAYER, 0);
+ break;
+
+ case 1:
+ _anim2ActvFl = false;
+ _game._player._visible = true;
+ _globals[kTrapDoorStatus] = 1;
+ _game._player._stepEnabled = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[2]);
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if ((_globals[kCurrentYear] == 1881) && (_globals[kJacquesStatus] >= 1))
+ _vm->_dialogs->show(10311);
+ else
+ _vm->_dialogs->show(10310);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_PROMPTERS_STAND)) {
+ if (_globals[kJacquesStatus] >= 1)
+ _vm->_dialogs->show(10349);
+ else if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10312);
+ else
+ _vm->_dialogs->show(10345);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(10313);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TRAP_CEILING)) {
+ _vm->_dialogs->show(10314);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(10315);
+ _action._inProgress = false;
return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_TO_PIT)) {
+ _vm->_dialogs->show(10316);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10317);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROMPTERS_BOX)) {
+ _vm->_dialogs->show(10318);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(10319);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_JUNK)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10320);
+ else
+ _vm->_dialogs->show(10346);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CARTON)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10321);
+ else
+ _vm->_dialogs->show(10347);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GARBAGE_CAN)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10322);
+ else
+ _vm->_dialogs->show(10348);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CABLE)) {
+ _vm->_dialogs->show(10323);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_JACQUES) || _action.isObject(NOUN_GENTLEMAN)) {
+ if (_globals[kJacquesStatus] == 0)
+ _vm->_dialogs->show(10324);
+ else
+ _vm->_dialogs->show(10325);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_KEY) && _game._objects.isInRoom(OBJ_KEY)) {
+ _vm->_dialogs->show(10326);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAIR_UNIT)) {
+ _vm->_dialogs->show(10327);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(10328);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WATER_PIPE)) {
+ _vm->_dialogs->show(10329);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROMPTERS_SEAT)) {
+ _vm->_dialogs->show(10338);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEVER)) {
+ _vm->_dialogs->show(10339);
+ _action._inProgress = false;
+ return;
+ }
+
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_DOOR_TO_PIT)) {
+ _vm->_dialogs->show(10331);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_DOOR)) {
+ _vm->_dialogs->show(10331);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_OPEN, NOUN_TRAP_DOOR)) || (_action.isAction(VERB_CLOSE, NOUN_TRAP_DOOR))) {
+ _vm->_dialogs->show(10344);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_JACQUES) || _action.isAction(VERB_TAKE, NOUN_GENTLEMAN)) {
+ if (_globals[kJacquesStatus] == 0) {
+ if (_globals[kJacquesNameIsKnown])
+ _vm->_dialogs->show(10336);
+ else
+ _vm->_dialogs->show(10351);
+ } else
+ _vm->_dialogs->show(10337);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene103::adjustRails(int variant) {
+ switch (variant) {
+ case 0:
+ _scene->_rails.disableNode(3);
+ _scene->_rails.disableNode(4);
+ _scene->_rails.disableNode(5);
+ _scene->_rails.disableNode(6);
+ _scene->_rails.disableNode(12);
+ _scene->_rails.disableNode(13);
+ _scene->_rails.disableNode(14);
+ break;
+
+ case 1:
+ _scene->_rails.disableNode(1);
+ _scene->_rails.disableNode(2);
+ _scene->_rails.disableNode(3);
+ _scene->_rails.disableNode(4);
+ _scene->_rails.disableNode(5);
+ _scene->_rails.disableNode(6);
+ _scene->_rails.disableNode(7);
+ _scene->_rails.disableNode(9);
+ _scene->_rails.disableNode(10);
+ _scene->_rails.disableNode(11);
+ break;
+
+ case 2:
+ _scene->_rails.disableNode(1);
+ _scene->_rails.disableNode(2);
+ _scene->_rails.disableNode(5);
+ _scene->_rails.disableNode(6);
+ _scene->_rails.disableNode(7);
+ _scene->_rails.disableNode(9);
+ _scene->_rails.disableNode(10);
+ _scene->_rails.disableNode(11);
+ break;
+
+ case 3:
+ _scene->_rails.disableNode(1);
+ _scene->_rails.disableNode(2);
+ _scene->_rails.disableNode(3);
+ _scene->_rails.disableNode(4);
+ _scene->_rails.disableNode(10);
+ _scene->_rails.disableNode(11);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene103::handleJacquesAnim() {
+ if (_scene->getAnimFrame(_globals._animationIndexes[0]) == _lastJacquesFrame)
+ return;
+
+ _lastJacquesFrame = _scene->getAnimFrame(_globals._animationIndexes[0]);
+ int resetFrame = -1;
+ int random;
+
+ switch (_lastJacquesFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 9:
+ case 17:
+ case 23:
+ case 33:
+ case 51:
+ switch (_jacquesAction) {
+ case 2:
+ random = 4;
+ _jacquesAction = 0;
+ break;
+
+ case 3:
+ random = 5;
+ _jacquesAction = 0;
+ break;
+
+ case 4:
+ random = 6;
+ break;
+
+ case 0:
+ random = _vm->getRandomNumber(1, 3);
+ ++_talkCount;
+ if (_talkCount > 22) {
+ _jacquesAction = 1;
+ random = 9;
+ }
+ break;
+
+ default:
+ random = _vm->getRandomNumber(6, 50);
+ while (_lastRandom == random)
+ random = _vm->getRandomNumber(6, 50);
+
+ _lastRandom = random;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 0;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ resetFrame = 2;
+ break;
+
+ case 4:
+ resetFrame = 4;
+ break;
+
+ case 5:
+ resetFrame = 10;
+ break;
+
+ case 6:
+ resetFrame = 34;
+ break;
+
+ case 7:
+ resetFrame = 24;
+ break;
+
+ case 8:
+ resetFrame = 18;
+ break;
+
+ default:
+ resetFrame = 8;
+ break;
+ }
+ break;
+
+ case 36:
+ case 40:
+ case 48:
+ switch (_jacquesAction) {
+ case 0:
+ case 2:
+ case 3:
+ random = 2;
+ break;
+
+ case 4:
+ random = 1;
+ _jacquesAction = 0;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(2, 50);
+ while (_lastRandom == random)
+ random = _vm->getRandomNumber(2, 50);
+ _lastRandom = random;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 37;
+ break;
+
+ case 2:
+ resetFrame = 49;
+ break;
+
+ case 3:
+ resetFrame = 41;
+ break;
+
+ default:
+ resetFrame = 35;
+ break;
+ }
+ break;
+
+ case 44:
+ random = _vm->getRandomNumber(1, 50);
+ while (_lastRandom == random)
+ random = _vm->getRandomNumber(1, 50);
+
+ _lastRandom = random;
+
+ switch (_jacquesAction) {
+ case 0:
+ case 2:
+ case 3:
+ case 4:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ while (_lastRandom == random)
+ random = _vm->getRandomNumber(1, 50);
+ _lastRandom = random;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 45;
+ break;
+ default:
+ resetFrame = 43;
+ break;
+ }
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _lastJacquesFrame = resetFrame;
+ }
+}
+
+void Scene103::climbRightStairs() {
+ if (_scene->getAnimFrame(_globals._animationIndexes[3]) == _lastStairFrame)
+ return;
+
+ _lastStairFrame = _scene->getAnimFrame(_globals._animationIndexes[3]);
+ int stairsResetFrame = -1;
+
+ if (_lastStairFrame == 37) {
+ stairsResetFrame = 36;
+ _standPosition = 2;
_game._player._stepEnabled = true;
}
- if (_action.isAction(VERB_CLOSE, NOUN_ORCHESTRA_DOOR)) {
- _vm->_dialogs->show(10228);
+ if (_lastStairFrame == 2) {
+ _scene->deleteSequence(3);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(154, 139));
+ }
+
+ if (stairsResetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], stairsResetFrame);
+ _lastStairFrame = stairsResetFrame;
+ }
+}
+
+void Scene103::climbLeftStairs() {
+ if (_scene->getAnimFrame(_globals._animationIndexes[5]) == _lastStairFrame)
+ return;
+
+ _lastStairFrame = _scene->getAnimFrame(_globals._animationIndexes[5]);
+ int stairsResetFrame = -1;
+
+ if (_lastStairFrame == 34) {
+ stairsResetFrame = 33;
+ _standPosition = 1;
_game._player._stepEnabled = true;
}
+
+ if (_lastStairFrame == 2) {
+ _scene->deleteSequence(3);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(37, 139));
+ }
+
+ if (stairsResetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[5], stairsResetFrame);
+ _lastStairFrame = stairsResetFrame;
+ }
+}
+
+void Scene103::descendRightStairs() {
+ if (_scene->getAnimFrame(_globals._animationIndexes[4]) == _lastStairFrame)
+ return;
+
+ _lastStairFrame = _scene->getAnimFrame(_globals._animationIndexes[4]);
+
+ if (_lastStairFrame == 2) {
+ _scene->deleteSequence(3);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(154, 139));
+ }
+}
+
+void Scene103::descendLeftStairs() {
+ if (_scene->getAnimFrame(_globals._animationIndexes[6]) == _lastStairFrame)
+ return;
+
+ _lastStairFrame = _scene->getAnimFrame(_globals._animationIndexes[6]);
+
+ if (_lastStairFrame == 2) {
+ _scene->deleteSequence(3);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(37, 139));
+ }
+}
+
+void Scene103::process_conv_jacques() {
+ bool quitConversationFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 1:
+ _vm->_gameConv->setInterlocutorTrigger(96);
+ if (_globals[kJacquesNameIsKnown] == 0) {
+ _globals[kJacquesNameIsKnown] = 1;
+ _scene->_dynamicHotspots.remove(_hotspotGentleman);
+ _hotspotGentleman = _scene->_dynamicHotspots.add(NOUN_JACQUES, VERB_WALKTO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(156, 116, 156 + 33, 116 + 31));
+ _scene->_dynamicHotspots[_hotspotGentleman]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_hotspotGentleman, Common::Point(206, 148), FACING_NORTHWEST);
+ }
+ break;
+
+ case 4:
+ case 6:
+ case 7:
+ case 10:
+ case 19:
+ case 30: {
+ _globals[kWalkerConverse] = 0;
+ int *val = _vm->_gameConv->getVariable(26);
+ if (*val)
+ _globals[kJacquesNameIsKnown] = 2;
+
+ quitConversationFl = true;
+ }
+ break;
+
+ case 8:
+ _vm->_gameConv->setInterlocutorTrigger(94);
+ break;
+
+ case 12:
+ _vm->_gameConv->setInterlocutorTrigger(96);
+ break;
+
+ case 29:
+ _vm->_gameConv->setInterlocutorTrigger(98);
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_action._activeAction._verbId != 1) && (_action._activeAction._verbId != 8)
+ && (_action._activeAction._verbId != 12) && (_action._activeAction._verbId != 29))
+ _vm->_gameConv->setInterlocutorTrigger(90);
+
+ _vm->_gameConv->setHeroTrigger(92);
+
+ switch (_game._trigger) {
+ case 90:
+ if (!quitConversationFl)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _jacquesAction = 0;
+ break;
+
+ case 92:
+ if (!quitConversationFl)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+ _convCount = 0;
+ _jacquesAction = 1;
+ break;
+
+ case 94:
+ if (!quitConversationFl)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _jacquesAction = 2;
+ break;
+
+ case 96:
+ if (!quitConversationFl)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _jacquesAction = 3;
+ break;
+
+ case 98:
+ if (!quitConversationFl)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _jacquesAction = 4;
+ break;
+
+ default:
+ break;
+ }
+
+ _talkCount = 0;
}
+/*------------------------------------------------------------------------*/
+
+Scene104::Scene104(MADSEngine *vm) : Scene1xx(vm) {
+ _anim0ActvFl = _anim1ActvFl = _anim2ActvFl = false;
+ _needToTalk = false;
+ _needToGetUp = false;
+ _sittingUp = false;
+ _beforeHeLeaves = false;
+ _beforeSheLeaves = false;
+ _needToStandUp = false;
+
+ _walkStatus = -1;
+ _walkFrame = -1;
+ _coupleStatus = -1;
+ _richStatus = -1;
+ _richTalkCount = -1;
+ _manTalkCount = -1;
+ _womanTalkCount = -1;
+ _lookCount = -1;
+ _coupleFrame = -1;
+ _lastPlayerFrame = -1;
+ _richFrame = -1;
+}
+
+void Scene104::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_needToTalk);
+ s.syncAsByte(_needToGetUp);
+ s.syncAsByte(_sittingUp);
+ s.syncAsByte(_beforeHeLeaves);
+ s.syncAsByte(_beforeSheLeaves);
+ s.syncAsByte(_needToStandUp);
+
+ s.syncAsSint16LE(_walkStatus);
+ s.syncAsSint16LE(_walkFrame);
+ s.syncAsSint16LE(_coupleStatus);
+ s.syncAsSint16LE(_richStatus);
+ s.syncAsSint16LE(_richTalkCount);
+ s.syncAsSint16LE(_manTalkCount);
+ s.syncAsSint16LE(_womanTalkCount);
+ s.syncAsSint16LE(_lookCount);
+ s.syncAsSint16LE(_coupleFrame);
+ s.syncAsSint16LE(_lastPlayerFrame);
+}
+
+void Scene104::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kTrapDoorStatus] == 1)
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_MONSIEUR_RICHARD);
+}
+
+void Scene104::enter() {
+ _vm->_disableFastwalk = true;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _needToTalk = false;
+ _needToGetUp = false;
+ _sittingUp = false;
+ _beforeSheLeaves = false;
+ _needToStandUp = false;
+ }
+
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 6));
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+
+ if (_globals[kCurrentYear] == 1993)
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('z', 0));
+
+ _vm->_gameConv->get(7);
+
+ if (_globals[kTrapDoorStatus] == 1) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 15);
+ } else {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 15);
+ }
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (_vm->_gameConv->_restoreRunning == 7) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('d', 1), 1);
+ _walkStatus = 0;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('m', 1), 1);
+ if (_coupleStatus < 11) {
+ _coupleStatus = 1;
+ _richStatus = 0;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 14);
+ } else {
+ _coupleStatus = 17;
+ _richStatus = 4;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 105);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 216);
+ }
+
+ _vm->_gameConv->run(7);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _game._player._visible = false;
+ }
+
+ } else if (_scene->_priorSceneId == 301) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _anim1ActvFl = true;
+ _coupleStatus = 11;
+
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('d', 1), 1);
+ _anim2ActvFl = true;
+ _walkStatus = 0;
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('m', 1), 1);
+ _anim0ActvFl = true;
+ _richStatus = 0;
+
+ cleanInventory();
+
+ _game._player._visible = false;
+ _game._visitedScenes.pop_back();
+ _globals[kTrapDoorStatus] = 1;
+ _globals[kCurrentYear] = 1881;
+ _globals[kPrompterStandStatus] = 1;
+ _globals[kTicketPeoplePresent] = 1;
+ _globals[kMakeBrieLeave203] = false;
+ _game._player._playerPos.x = 161;
+
+ _game._visitedScenes.add(301);
+ _game._visitedScenes.add(101);
+
+ _scene->setCamera(Common::Point(60, 0));
+ _scene->_sequences.addTimer(1, 91);
+
+ } else if (_scene->_priorSceneId == 103) {
+ if (_globals[kRoom103104Transition] == 0) {
+ _scene->_userInterface.emptyConversationList();
+ _scene->_userInterface.setup(kInputConversation);
+
+ if (!_globals[kObservedPhan104]) {
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('p', 1), 93);
+ _game._player._playerPos.x = 319;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _scene->setCamera(Common::Point(158, 0));
+ } else {
+ _globals._animationIndexes[5] = _scene->loadAnimation(formAnimName('p', 2), 94);
+ _game._player._playerPos.x = 319;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _scene->setCamera(Common::Point(158, 0));
+ }
+ } else {
+ _game._player._playerPos = Common::Point(319, 96);
+ _game._player._facing = FACING_SOUTH;
+ _scene->setCamera(Common::Point(158, 0));
+ }
+ } else if (_scene->_priorSceneId == 102) {
+ switch (_globals[kDeathLocation]) {
+ case 0:
+ _game._player._playerPos = Common::Point(496, 79);
+ _scene->setCamera(Common::Point(320, 0));
+ break;
+
+ case 1:
+ _game._player._playerPos = Common::Point(346, 71);
+ _scene->setCamera(Common::Point(158, 0));
+ break;
+
+ case 2:
+ _game._player._playerPos = Common::Point(172, 73);
+ break;
+
+ default:
+ break;
+ }
+ } else if (_scene->_priorSceneId == 108) {
+ if (_game._player._playerPos.x > 213)
+ _game._player._playerPos.y = 97;
+ else if (_game._player._playerPos.x > 110)
+ _game._player._playerPos.y = 128;
+ else
+ _game._player._playerPos.y = 148;
+
+ _game._player.firstWalk(Common::Point(-20, _game._player._playerPos.y), FACING_EAST, Common::Point(12, _game._player._playerPos.y), FACING_EAST, true);
+ } else if ((_scene->_priorSceneId == 107) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ if (_game._player._playerPos.x > 191)
+ _game._player._playerPos.y = 142;
+ else if (_game._player._playerPos.x > 104)
+ _game._player._playerPos.y = 120;
+ else
+ _game._player._playerPos.y = 95;
+
+ _game._player.firstWalk(Common::Point(655, _game._player._playerPos.y), FACING_WEST, Common::Point(627, _game._player._playerPos.y), FACING_WEST, true);
+ _scene->setCamera(Common::Point(320, 0));
+ }
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else
+ _scene->_hotspots.activate(NOUN_CHANDELIER, false);
+
+ if (_globals[kTrapDoorStatus] == 1) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 15);
+ } else {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 15);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene104::step() {
+ if (_anim0ActvFl)
+ handleRichAnimations();
+
+ if (_anim1ActvFl)
+ handleCoupleAnimations();
+
+ if (_anim2ActvFl)
+ handleWalkAnimation();
+
+ if (_game._player._moving)
+ handlePlayerWalk();
+
+ if (_game._trigger == 91) {
+ _vm->_dialogs->show(10434);
+ _vm->_gameConv->run(7);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ }
+
+ if (_game._trigger == 93) {
+ _scene->_nextSceneId = 103;
+ _game._player._playerPos.x = 400;
+ _globals[kRoom103104Transition] = 0;
+ }
+
+ if (_game._trigger == 94) {
+ _scene->_nextSceneId = 103;
+ _globals[kRoom103104Transition] = 0;
+ }
+}
+
+void Scene104::preActions() {
+ if (_action.isAction(VERB_EXIT, NOUN_STAGE_LEFT))
+ _game._player._walkOffScreenSceneId = 108;
+
+ if (_action.isAction(VERB_EXIT, NOUN_STAGE_RIGHT))
+ _game._player._walkOffScreenSceneId = 107;
+
+ if (_action.isAction(VERB_OPEN, NOUN_TRAP_DOOR) || _action.isAction(VERB_CLOSE, NOUN_TRAP_DOOR))
+ _game._player.walk(Common::Point(320, 92), FACING_NORTH);
+}
+
+void Scene104::actions() {
+ if (_vm->_gameConv->_running == 7) {
+ processConversations();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR)) {
+ if (_globals[kTrapDoorStatus] == 0) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 13);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 16);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 60);
+ break;
+
+ case 60:
+ _scene->_nextSceneId = 103;
+ _globals[kRoom103104Transition] = 1;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ _vm->_dialogs->show(10429);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_JUMP_INTO, NOUN_ORCHESTRA_PIT)) {
+ switch (_game._trigger) {
+ case 0:
+ if (_game._player._playerPos.x > 400)
+ _globals[kDeathLocation] = 0;
+ else if (_game._player._playerPos.x > 200)
+ _globals[kDeathLocation] = 1;
+ else
+ _globals[kDeathLocation] = 2;
+
+ _scene->changeVariant(2);
+
+ if (_globals[kTrapDoorStatus] == 1)
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ else
+ _scene->drawToBackground(_globals._spriteIndexes[0], 2, Common::Point(-32000, -32000), 0, 100);
+
+ _vm->_dialogs->show(10426);
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], _game._player._playerPos);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1:
+ _globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 1, 10);
+ _scene->_sequences.addTimer(60, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 4, 4);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.setMotion(_globals._sequenceIndexes[3], 0, 0, 200);
+ break;
+
+ case 2:
+ _vm->_sound->command(1);
+ _vm->_sound->command(67);
+ _scene->_nextSceneId = 102;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10410);
+ else
+ _vm->_dialogs->show(10411);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(10412);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_APRON)) {
+ _vm->_dialogs->show(10413);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROSCENIUM_ARCH)) {
+ _vm->_dialogs->show(10414);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ACT_CURTAIN)) {
+ _vm->_dialogs->show(10415);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ORCHESTRA_PIT)) {
+ _vm->_dialogs->show(10416);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CONDUCTORS_STAND)) {
+ _vm->_dialogs->show(10417);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isObject(NOUN_MUSIC_STAND)) || (_action.isObject(NOUN_MUSIC_STANDS))) {
+ _vm->_dialogs->show(10418);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROMPTERS_BOX)) {
+ _vm->_dialogs->show(10419);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(10420);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOUSE)) {
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->show(10421);
+ else
+ _vm->_dialogs->show(10427);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE_LEFT)) {
+ _vm->_dialogs->show(10422);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE_RIGHT)) {
+ _vm->_dialogs->show(10423);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHANDELIER)) {
+ _vm->_dialogs->show(10428);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MONSIEUR_RICHARD)) {
+ _vm->_dialogs->show(10433);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_JUMP_INTO, NOUN_ORCHESTRA_PIT)) {
+ _vm->_dialogs->show(10426);
+ _scene->_nextSceneId = 102;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_PROMPTERS_BOX) || _action.isAction(VERB_CLOSE, NOUN_PROMPTERS_BOX)) {
+ _vm->_dialogs->show(10430);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_TRAP_DOOR)) {
+ if (_globals[kTrapDoorStatus] == 0)
+ _vm->_dialogs->show(10424);
+ else
+ _vm->_dialogs->show(10432);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_TRAP_DOOR)) {
+ if (_globals[kTrapDoorStatus] == 1)
+ _vm->_dialogs->show(10425);
+ else
+ _vm->_dialogs->show(10433);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHANDELIER)) {
+ _vm->_dialogs->show(10435);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene104::cleanInventory() {
+ if (_game._objects.isInInventory(OBJ_LARGE_NOTE))
+ _game._objects.setRoom(OBJ_LARGE_NOTE, NOWHERE);
+
+ if (_game._objects.isInInventory(OBJ_SANDBAG))
+ _game._objects.setRoom(OBJ_SANDBAG, NOWHERE);
+
+ if (_game._objects.isInInventory(OBJ_SMALL_NOTE))
+ _game._objects.setRoom(OBJ_SMALL_NOTE, NOWHERE);
+
+ if (_game._objects.isInInventory(OBJ_PARCHMENT))
+ _game._objects.setRoom(OBJ_PARCHMENT, NOWHERE);
+
+ if (_game._objects.isInInventory(OBJ_BOOK))
+ _game._objects.setRoom(OBJ_BOOK, NOWHERE);
+
+ if (_game._objects.isInInventory(OBJ_RED_FRAME))
+ _game._objects.setRoom(OBJ_RED_FRAME, 105);
+
+ if (_game._objects.isInInventory(OBJ_YELLOW_FRAME))
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, 107);
+
+ if (_game._objects.isInInventory(OBJ_BLUE_FRAME))
+ _game._objects.setRoom(OBJ_BLUE_FRAME, 302);
+
+ if (_game._objects.isInInventory(OBJ_GREEN_FRAME))
+ _game._objects.setRoom(OBJ_GREEN_FRAME, 307);
+}
+
+void Scene104::processConversations() {
+ bool interlocutorTriggerFl = false;
+ bool heroTriggerFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 2:
+ case 10:
+ case 12:
+ case 16:
+ case 20:
+ case 21:
+ case 24:
+ _vm->_gameConv->setInterlocutorTrigger(75);
+ interlocutorTriggerFl = true;
+ break;
+
+ case 3:
+ if (!_needToGetUp) {
+ _vm->_gameConv->setInterlocutorTrigger(67);
+ interlocutorTriggerFl = true;
+ _needToGetUp = true;
+ }
+ break;
+
+ case 8:
+ _vm->_gameConv->setInterlocutorTrigger(87);
+ interlocutorTriggerFl = true;
+ break;
+
+ case 11:
+ _vm->_gameConv->setInterlocutorTrigger(77);
+ interlocutorTriggerFl = true;
+ break;
+
+ case 14:
+ case 25:
+ if (!_game._trigger) {
+ _richStatus = 0;
+ _coupleStatus = 5;
+ _vm->_gameConv->hold();
+ }
+ break;
+
+ case 22:
+ _vm->_gameConv->setInterlocutorTrigger(75);
+ _vm->_gameConv->setHeroTrigger(79);
+ interlocutorTriggerFl = true;
+ heroTriggerFl = true;
+ break;
+
+ case 23:
+ _vm->_gameConv->setInterlocutorTrigger(89);
+ interlocutorTriggerFl = true;
+ break;
+
+ case 28:
+ _vm->_gameConv->setInterlocutorTrigger(81);
+ interlocutorTriggerFl = true;
+ break;
+
+ case 30:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _richStatus = 4;
+ }
+ break;
+
+ case 32:
+ _coupleStatus = 14;
+ heroTriggerFl = true;
+ interlocutorTriggerFl = true;
+ _vm->_gameConv->hold();
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 67:
+ _vm->_gameConv->hold();
+ _coupleStatus = 12;
+ break;
+
+ case 69:
+ if (!_beforeSheLeaves && !_beforeHeLeaves && (_coupleStatus != 14) && !_needToStandUp) {
+ _richStatus = 0;
+ if (_sittingUp)
+ _coupleStatus = 4;
+ else
+ _coupleStatus = 12;
+ }
+ break;
+
+ case 71:
+ if (!_beforeSheLeaves && !_beforeHeLeaves && (_coupleStatus != 14) && !_needToStandUp) {
+ _richStatus = 0;
+ if (_sittingUp && !_beforeSheLeaves) {
+ _coupleStatus = 3;
+ _richStatus = 0;
+ }
+ }
+ break;
+
+ case 75:
+ _richStatus = 1;
+
+ if (_sittingUp) {
+ if (_action._activeAction._verbId == 20) {
+ _lookCount = 0;
+ _coupleStatus = 9;
+ } else if ((_action._activeAction._verbId == 21) || (_action._activeAction._verbId == 22)) {
+ _lookCount = 0;
+ _coupleStatus = 10;
+ } else {
+ _coupleStatus = 1;
+ }
+ } else {
+ _coupleStatus = 11;
+ }
+ break;
+
+ case 77:
+ _richStatus = 0;
+ _coupleStatus = 8;
+ break;
+
+ case 79:
+ _richStatus = 0;
+ _coupleStatus = 7;
+ break;
+
+ case 81:
+ _richStatus = 1;
+ _beforeHeLeaves = true;
+ _coupleStatus = 15;
+ break;
+
+ case 83:
+ _vm->_gameConv->release();
+ if (_coupleStatus != 17)
+ _game._player._stepEnabled = false;
+ break;
+
+ case 87:
+ _richStatus = 3;
+ break;
+
+ case 89:
+ _richStatus = 2;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroTriggerFl && !_beforeSheLeaves)
+ _vm->_gameConv->setHeroTrigger(71);
+
+ if (!interlocutorTriggerFl)
+ _vm->_gameConv->setInterlocutorTrigger(69);
+
+ _richTalkCount = 0;
+ _manTalkCount = 0;
+ _womanTalkCount = 0;
+}
+
+void Scene104::handleWalkAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame() == _walkFrame)
+ return;
+
+ _walkFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ int daaeResetFrame = -1;
+
+ switch (_walkFrame) {
+ case 1:
+ if (_walkStatus == 0) {
+ daaeResetFrame = 0;
+ } else {
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[2], SYNC_ANIM, _globals._animationIndexes[1]);
+ daaeResetFrame = 1;
+ }
+ break;
+
+ case 138:
+ _walkStatus = 0;
+ daaeResetFrame = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (daaeResetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], daaeResetFrame);
+ _walkFrame = daaeResetFrame;
+ }
+}
+
+void Scene104::handleRichAnimations() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _richFrame)
+ return;
+
+ _richFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int random;
+ int resetFrame = -1;
+
+ switch (_richFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 8:
+ case 14:
+ case 22:
+ case 34:
+ case 40:
+ case 44:
+ case 48:
+ random = -1;
+ if (_richStatus == 1) {
+ random = _vm->getRandomNumber(1, 3);
+ ++_richTalkCount;
+ if (_richTalkCount > 15) {
+ _richStatus = 0;
+ random = 40;
+ }
+ }
+
+ if (_richStatus == 0)
+ random = _vm->getRandomNumber(7, 80);
+
+ if (_richStatus == 2) {
+ random = 4;
+ _richStatus = 1;
+ _richTalkCount = 8;
+ }
+
+ if (_richStatus == 3) {
+ random = 5;
+ _richStatus = 1;
+ _richTalkCount = 8;
+ }
+
+ if (_richStatus == 4)
+ random = 6;
+
+ if (_richStatus == 5)
+ random = 7;
+
+ switch (random) {
+ case 1:
+ resetFrame = 1;
+ break;
+
+ case 2:
+ resetFrame = 2;
+ break;
+
+ case 3:
+ resetFrame = 3;
+ break;
+
+ case 4:
+ resetFrame = 23;
+ break;
+
+ case 5:
+ resetFrame = 35;
+ break;
+
+ case 6:
+ resetFrame = 49;
+ break;
+
+ case 7:
+ resetFrame = 41;
+ break;
+
+ case 8:
+ resetFrame = 45;
+ break;
+
+ case 9:
+ resetFrame = 9;
+ break;
+
+ case 10:
+ resetFrame = 5;
+ break;
+
+ case 11:
+ resetFrame = 15;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 117:
+ _coupleStatus = 13;
+ break;
+
+ case 125:
+ resetFrame = 124;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _richFrame = resetFrame;
+ }
+}
+
+void Scene104::handleCoupleAnimations() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _coupleFrame)
+ return;
+
+ _coupleFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random;
+
+ switch (_coupleFrame) {
+ case 1:
+ case 103:
+ case 104:
+ case 105:
+ if (_coupleStatus == 11)
+ resetFrame = 0;
+ else {
+ resetFrame = _vm->getRandomNumber(102, 104);
+ ++_womanTalkCount;
+ if (_womanTalkCount > 15) {
+ if (_needToGetUp) {
+ _coupleStatus = 6;
+ resetFrame = 1;
+ } else {
+ _coupleStatus = 11;
+ resetFrame = 0;
+ }
+ }
+ }
+ break;
+
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 25:
+ case 33:
+ case 41:
+ switch (_coupleFrame) {
+ case 9:
+ _coupleStatus = 6;
+ break;
+
+ case 33:
+ _vm->_gameConv->release();
+ if (_action._activeAction._verbId == 13)
+ _coupleStatus = 4;
+
+ break;
+
+ case 41:
+ _vm->_gameConv->release();
+ _sittingUp = true;
+ if (_needToTalk)
+ _coupleStatus = 3;
+ else
+ _coupleStatus = 1;
+ break;
+
+ default:
+ break;
+ }
+
+ random = -1;
+
+ switch (_coupleStatus) {
+ case 1:
+ random = 12;
+ break;
+
+ case 2:
+ case 7:
+ case 8:
+ random = 11;
+ break;
+
+ case 3:
+ random = _vm->getRandomNumber(4, 6);
+ ++_manTalkCount;
+ if (_manTalkCount > 15) {
+ _coupleStatus = 1;
+ random = 12;
+ }
+ break;
+
+ case 4:
+ if (_beforeSheLeaves) {
+ random = 10;
+ } else {
+ random = _vm->getRandomNumber(1, 3);
+ ++_womanTalkCount;
+ if (_womanTalkCount > 15) {
+ _coupleStatus = 1;
+ random = 12;
+ }
+ }
+ break;
+
+ case 5:
+ _coupleStatus = 1;
+ random = 8;
+ break;
+
+ case 6:
+ _coupleStatus = 1;
+ random = 7;
+ break;
+
+ case 13:
+ random = 9;
+ break;
+
+ case 15:
+ random = 10;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 12;
+ break;
+
+ case 2:
+ resetFrame = 13;
+ break;
+
+ case 3:
+ resetFrame = 14;
+ break;
+
+ case 4:
+ resetFrame = 9;
+ break;
+
+ case 5:
+ resetFrame = 10;
+ break;
+
+ case 6:
+ resetFrame = 11;
+ break;
+
+ case 7:
+ resetFrame = 33;
+ break;
+
+ case 8:
+ resetFrame = 25;
+ break;
+
+ case 9:
+ resetFrame = 54;
+ break;
+
+ case 10:
+ resetFrame = 41;
+ break;
+
+ case 11:
+ resetFrame = 15;
+ break;
+
+ case 12:
+ resetFrame = 14;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ random = -1;
+ switch (_coupleStatus) {
+ case 1:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 15:
+ case 16:
+ random = 7;
+ break;
+
+ case 2:
+ random = 8;
+ break;
+
+ case 7:
+ random = _vm->getRandomNumber(4, 6);
+ ++_manTalkCount;
+ if (_manTalkCount > 15) {
+ _coupleStatus = 2;
+ random = 8;
+ }
+ break;
+
+ case 8:
+ random = _vm->getRandomNumber(1, 3);
+ ++_womanTalkCount;
+ if (_womanTalkCount > 15) {
+ _coupleStatus = 1;
+ random = 7;
+ }
+ break;
+
+ case 9:
+ random = 1;
+ ++_lookCount;
+ if (_lookCount > 6) {
+ _coupleStatus = 1;
+ random = 7;
+ }
+ break;
+
+ case 10:
+ random = 1;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 20;
+ break;
+
+ case 2:
+ resetFrame = 21;
+ break;
+
+ case 3:
+ resetFrame = 22;
+ break;
+
+ case 4:
+ resetFrame = 17;
+ break;
+
+ case 5:
+ resetFrame = 18;
+ break;
+
+ case 6:
+ resetFrame = 19;
+ break;
+
+ case 7:
+ resetFrame = 23;
+ break;
+
+ case 8:
+ resetFrame = 20;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 52:
+ _walkStatus = 1;
+ resetFrame = 54;
+ break;
+
+ case 55:
+ if (_coupleStatus != 13)
+ resetFrame = 54;
+
+ break;
+
+ case 89:
+ _vm->_gameConv->release();
+ break;
+
+ case 90:
+ if (_coupleStatus != 14) {
+ resetFrame = 89;
+ } else {
+ resetFrame = 90;
+ _globals[kTempVar] = 200;
+ }
+ break;
+
+ case 102:
+ _vm->_gameConv->release();
+ _game._player._playerPos = Common::Point(166, 126);
+ _game._player.resetFacing(FACING_SOUTH);
+ resetFrame = 105;
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ case 106:
+ _coupleStatus = 17;
+ resetFrame = 105;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _coupleFrame = resetFrame;
+ }
+}
+
+void Scene104::handlePlayerWalk() {
+ if (_game._player._frameNumber == _lastPlayerFrame)
+ return;
+
+ _lastPlayerFrame = _game._player._frameNumber;
+ switch (_game._player._facing) {
+ case FACING_NORTH:
+ case FACING_SOUTH:
+ if ((_game._player._frameNumber == 5) || (_game._player._frameNumber == 11))
+ _vm->_sound->command(68);
+ break;
+
+ case FACING_NORTHEAST:
+ case FACING_NORTHWEST:
+ case FACING_SOUTHEAST:
+ case FACING_SOUTHWEST:
+ if ((_game._player._frameNumber == 7) || (_game._player._frameNumber == 14))
+ _vm->_sound->command(68);
+ break;
+
+ case FACING_EAST:
+ case FACING_WEST:
+ if ((_game._player._frameNumber == 8) || (_game._player._frameNumber == 16))
+ _vm->_sound->command(68);
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene105::Scene105(MADSEngine *vm) : Scene1xx(vm) {
+}
+
+void Scene105::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+}
+
+void Scene105::setup() {
+ if (_globals[kCurrentYear] == 1993)
+ _scene->_variant = 1;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_LIGHT_FIXTURE);
+}
+
+void Scene105::enter() {
+ _scene->loadSpeech(8);
+
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*RDR_9");
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ if (_globals[kCurrentYear] == 1993)
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('z', -1));
+
+ if ((_globals[kCurrentYear] == 1881) && (!_globals[kHintThatDaaeIsHome2])) {
+ if ((_globals[kJacquesNameIsKnown] == 2) && (_globals[kMadameNameIsKnown] == 2) &&
+ _globals[kPanelIn206] && _globals[kDoneRichConv203] && _game._objects.isInInventory(OBJ_LANTERN) &&
+ ((_game._objects.isInInventory(OBJ_CABLE_HOOK) && _game._objects.isInInventory(OBJ_ROPE)) || _game._objects.isInInventory(OBJ_ROPE_WITH_HOOK))) {
+ _globals[kHintThatDaaeIsHome2] = true;
+ _scene->_sequences.addTimer(300, 75);
+ }
+ }
+
+ if ((_game._objects.isInRoom(OBJ_LANTERN)) && (_globals[kCurrentYear] == 1881)) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else {
+ _scene->_hotspots.activate(NOUN_LANTERN, false);
+ }
+
+ if (_game._objects.isInRoom(OBJ_RED_FRAME)) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ } else {
+ _scene->_hotspots.activate(NOUN_RED_FRAME, false);
+ }
+
+ if (_globals[kCurrentYear] == 1993) {
+ _scene->drawToBackground(_globals._spriteIndexes[3], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_PROPS, false);
+ _scene->_hotspots.activate(NOUN_BEAR_PROP, false);
+ _scene->_hotspots.activate(NOUN_STAIR_UNIT, false);
+ _scene->_hotspots.activate(NOUN_PROP, false);
+ _scene->_hotspots.activate(NOUN_ELEPHANT_PROP, false);
+ _scene->_hotspots.activate(NOUN_COLUMN_PROP, false);
+
+ int tmpIdx = _scene->_dynamicHotspots.add(NOUN_COLUMN_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(132, 24, 132 + 21, 24 + 105));
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(159, 133), FACING_NORTHWEST);
+
+ tmpIdx = _scene->_dynamicHotspots.add(NOUN_COLUMN_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(56, 45, 56 + 11, 45 + 77));
+ _scene->_dynamicHotspots.setPosition(tmpIdx, Common::Point(72, 126), FACING_NORTHWEST);
+
+ _scene->_dynamicHotspots.add(NOUN_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(0, 125, 29, 125 + 31));
+ _scene->_dynamicHotspots.add(NOUN_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(29, 136, 29 + 50, 136 + 20));
+ _scene->_dynamicHotspots.add(NOUN_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(79, 141, 79 + 53, 141 + 15));
+
+ _scene->_dynamicHotspots.add(NOUN_BEAR_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(278, 132, 278 + 21, 132 + 24));
+ _scene->_dynamicHotspots.add(NOUN_BEAR_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(299, 146, 299 + 8, 146 + 10));
+ _scene->_dynamicHotspots.add(NOUN_BEAR_PROP, VERB_WALKTO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(269, 142, 269 + 8, 142 + 8));
+
+ _scene->_dynamicHotspots.add(NOUN_LIGHT_FIXTURE, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(102, 14, 102 + 24, 102 + 10));
+ }
+
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ if ((_scene->_priorSceneId == 106) || (_scene->_priorSceneId == 114)) {
+ _game._player._playerPos = Common::Point(198, 132);
+ _game._player._facing = FACING_WEST;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ } else if ((_scene->_priorSceneId == 103) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(3, 112);
+ _game._player._facing = FACING_SOUTHEAST;
+ _game._player.walk(Common::Point(45, 131), FACING_SOUTHEAST);
+ _game._player.setWalkTrigger(60);
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 8);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ } else if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene105::step() {
+ switch (_game._trigger) {
+ case 60:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 8);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ _vm->_sound->command(66);
+ break;
+
+ case 61:
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ _game._player._stepEnabled = true;
+ break;
+
+ case 75:
+ _scene->playSpeech(8);
+ _scene->_sequences.addTimer(120, 76);
+ break;
+
+ case 76:
+ _vm->_dialogs->show(10537);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene105::actions() {
+ if ((_action.isAction(VERB_PUSH, NOUN_THUNDER_MACHINE)) || (_action.isAction(VERB_PULL, NOUN_THUNDER_MACHINE))) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('t', 1), 70);
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[4], SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->_sequences.setSeqPlayer(_globals._animationIndexes[0], false);
+ break;
+
+ case 70:
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[4], SYNC_ANIM, _globals._animationIndexes[0]);
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_UP, NOUN_CIRCULAR_STAIRCASE)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 1), 1);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 1:
+ _scene->_nextSceneId = 106;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_DOWN, NOUN_CIRCULAR_STAIRCASE)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 1);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 1:
+ _scene->_nextSceneId = 114;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME) && (_game._objects.isInRoom(OBJ_RED_FRAME) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ if (_globals[kCurrentYear] == 1881) {
+ int count = 0;
+
+ if (_game._objects.isInInventory(NOUN_YELLOW_FRAME))
+ ++count;
+
+ if (_game._objects.isInInventory(NOUN_GREEN_FRAME))
+ ++count;
+
+ if (_game._objects.isInInventory(NOUN_BLUE_FRAME))
+ ++count;
+
+ if (count < 3)
+ _globals[kPlayerScore] += 5;
+ }
+
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[5], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _scene->_hotspots.activate(NOUN_RED_FRAME, false);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[5]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 842, 0);
+ else
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+
+ _game._player._stepEnabled = true;
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_LANTERN) && (_game._objects.isInRoom(OBJ_LANTERN) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[6] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[6], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[6], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_SPRITE, 4, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _scene->_hotspots.activate(NOUN_LANTERN, false);
+ _game._objects.addToInventory(OBJ_LANTERN);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[6]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ _vm->_dialogs->showItem(OBJ_LANTERN, 801, 0);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR) || (_game._trigger) ||
+ _action.isAction(VERB_UNLOCK, NOUN_DOOR) || _action.isAction(VERB_LOCK, NOUN_DOOR)) {
+ if ((_globals[kCurrentYear] == 1881) && !_action.isAction(VERB_UNLOCK) && !_action.isAction(VERB_LOCK)){
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[6] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[6], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[6], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_SPRITE, 4, 65);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2:
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(180, 3);
+ break;
+
+ case 3:
+ _scene->_nextSceneId = 103;
+ break;
+
+ case 65:
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 8);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ _vm->_sound->command(66);
+ break;
+
+ case 66: {
+ int tmpIdx = _globals._sequenceIndexes[2];
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 8);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[2], SYNC_SEQ, tmpIdx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _game._player.walk(Common::Point(0, 111), FACING_NORTHWEST);
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], true, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[6], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1: {
+ int tmpIdx = _globals._sequenceIndexes[6];
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], true, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[6], SYNC_SEQ, tmpIdx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[6], false);
+ _vm->_sound->command(73);
+ _scene->_sequences.addTimer(15, 2);
+ }
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], true, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[6], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[6]);
+ _game._player._visible = true;
+ if (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK))
+ _vm->_dialogs->show(32);
+ else
+ _vm->_dialogs->show(10536);
+
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10510);
+ else
+ _vm->_dialogs->show(10511);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(10512);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CIRCULAR_STAIRCASE)) {
+ _vm->_dialogs->show(10513);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LANTERN) && _game._objects.isInRoom(OBJ_LANTERN)) {
+ _vm->_dialogs->show(10514);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && _game._objects.isInRoom(OBJ_RED_FRAME)){
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->show(10530);
+ else
+ _vm->_dialogs->show(10515);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(10516);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10517);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROP_TABLE)) {
+ _vm->_dialogs->show(10518);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BEAR_PROP)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10519);
+ else
+ _vm->_dialogs->show(10538);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ELEPHANT_PROP)) {
+ _vm->_dialogs->show(10520);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COLUMN_PROP)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10521);
+ else
+ _vm->_dialogs->show(10539);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_THUNDER_MACHINE)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10522);
+ else
+ _vm->_dialogs->show(10540);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAIR_UNIT)) {
+ _vm->_dialogs->show(10523);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROP)) {
+ _vm->_dialogs->show(10524);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROPS)) {
+ _vm->_dialogs->show(10525);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXIT_SIGN)) {
+ _vm->_dialogs->show(10526);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLATS)) {
+ _vm->_dialogs->show(10527);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HEMP)) {
+ _vm->_dialogs->show(10528);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PIPE)) {
+ _vm->_dialogs->show(10529);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRAFFITI)) {
+ _vm->_dialogs->show(10531);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT_FIXTURE)) {
+ _vm->_dialogs->show(10535);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_BEAR_PROP)) {
+ _vm->_dialogs->show(10532);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_BEAR_PROP)) {
+ _vm->_dialogs->show(10533);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_DOOR)) {
+ _vm->_dialogs->show(10534);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene105::preActions() {
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR_TO_PIT))
+ _game._player._walkOffScreenSceneId = 102;
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_DOOR) || _action.isAction(VERB_LOCK, NOUN_DOOR))
+ _game._player.walk(Common::Point(33, 128), FACING_NORTHWEST);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene106::Scene106(MADSEngine *vm) : Scene1xx(vm) {
+ _sandbagHostpotId = -1;
+}
+
+void Scene106::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsSint16LE(_sandbagHostpotId);
+}
+
+void Scene106::setup() {
+ if (_globals[kCurrentYear] == 1881)
+ _scene->_variant = 1;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene106::enter() {
+ _scene->loadSpeech(8);
+
+ if (_globals[kCurrentYear] == 1993) {
+ if (!_game._objects.isInInventory(OBJ_SANDBAG)) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ }
+ } else {
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ if (_game._objects.isInRoom(OBJ_CABLE_HOOK) && !_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK)) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ }
+ }
+
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RDR_9");
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 2));
+
+ if ((_globals[kCurrentYear] == 1881) && (!_globals[kHintThatDaaeIsHome1])) {
+ if ((_globals[kJacquesNameIsKnown] == 2) && (_globals[kMadameNameIsKnown] == 2)
+ && (_globals[kPanelIn206]) && (_globals[kDoneRichConv203]) && (_game._objects.isInInventory(OBJ_LANTERN))
+ && ((_game._objects.isInInventory(OBJ_CABLE_HOOK) && _game._objects.isInInventory(OBJ_ROPE))
+ || _game._objects.isInInventory(OBJ_ROPE_WITH_HOOK))) {
+ _globals[kHintThatDaaeIsHome1] = true;
+ _scene->_sequences.addTimer(300, 85);
+ }
+ }
+
+ if ((_globals[kSandbagStatus] == 1) && (_globals[kCurrentYear] == 1993) && _game._objects.isInRoom(OBJ_SANDBAG)) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _sandbagHostpotId = _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(227, 140, 227 + 18, 140 + 11));
+ _scene->_dynamicHotspots.setPosition(_sandbagHostpotId, Common::Point(224, 152), FACING_NORTHEAST);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ }
+
+ if (_globals[kCurrentYear] == 1881) {
+ _scene->drawToBackground(_globals._spriteIndexes[7], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_BIG_PROP, false);
+ _scene->_hotspots.activate(NOUN_STATUE, false);
+ _scene->_hotspots.activate(NOUN_PLANT_PROP, false);
+ _scene->_hotspots.activate(NOUN_PEDESTAL, false);
+ _scene->_hotspots.activate(NOUN_SANDBAG, false);
+ _scene->_hotspots.activate(NOUN_CRATE, false);
+
+ _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(40, 47, 40 + 11, 47 + 17));
+ _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(98, 14, 98 + 5, 14 + 10));
+ _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(111, 23, 111 + 6, 23 + 9));
+ _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(119, 12, 119 + 5, 12 + 8));
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_STAGE, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(80, 114, 80 + 24, 114 + 4));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(93, 121), FACING_NONE);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_STAGE, VERB_WALK_ACROSS, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(106, 102, 106 + 5, 102 + 10));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(108, 109), FACING_NONE);
+ } else {
+ _scene->_hotspots.activate(NOUN_BOXES, false);
+ _scene->_hotspots.activate(NOUN_CASE, false);
+ }
+
+ if ((_game._objects.isInRoom(OBJ_CABLE_HOOK)) && (_globals[kCurrentYear] == 1881) && !_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK)){
+ _globals._sequenceIndexes[8] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[8], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 3);
+ } else {
+ _scene->_hotspots.activate(NOUN_CABLE_HOOK, false);
+ }
+
+ if (_scene->_priorSceneId == 109) {
+ _game._player._playerPos = Common::Point(180, 58);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(179, 63), FACING_SOUTH);
+ _game._player.setWalkTrigger(60);
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 5);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else if ((_scene->_priorSceneId == 105) || (_scene->_priorSceneId == 301)) {
+ _game._player._playerPos = Common::Point(235, 142);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(227, 143), FACING_WEST);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else if (_scene->_priorSceneId == 107) {
+ _game._player._playerPos = Common::Point(143, 68);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(163, 68), FACING_SOUTHEAST);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else if ((_scene->_priorSceneId == 108) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player.firstWalk(Common::Point(-20, 130), FACING_SOUTHEAST, Common::Point(19, 147), FACING_NORTHEAST, true);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene106::step() {
+ switch (_game._trigger) {
+ case 85:
+ _scene->playSpeech(8);
+ _scene->_sequences.addTimer(120, 86);
+ break;
+
+ case 86:
+ _vm->_dialogs->show(10637);
+ break;
+
+ case 60:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 5);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ break;
+
+ case 61:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _vm->_sound->command(25);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene106::actions() {
+ if ((_action.isAction(VERB_TAKE, NOUN_SANDBAG)) && (_scene->_customDest.y < 61)) {
+ _vm->_dialogs->show(10635);
+ _action._inProgress = false;
+ return;
+ } else if (_action.isAction(VERB_TAKE, NOUN_SANDBAG)) {
+ if (_game._objects.isInRoom(OBJ_SANDBAG)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[5], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _scene->_dynamicHotspots.remove(_sandbagHostpotId);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[5]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ _game._objects.addToInventory(OBJ_SANDBAG);
+ _vm->_dialogs->showItem(OBJ_SANDBAG, 803, 0);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CABLE_HOOK)) {
+ if (_game._objects.isInRoom(OBJ_CABLE_HOOK)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[5], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ _globals[kPlayerScore] += 5;
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[8]);
+ _scene->_hotspots.activate(NOUN_CABLE_HOOK, false);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[5]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ _game._objects.addToInventory(OBJ_CABLE_HOOK);
+ _vm->_dialogs->showItem(OBJ_CABLE_HOOK, 822, 0);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ switch (_game._trigger) {
+ case 75:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 76);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ _action._inProgress = false;
+ return;
+
+ case 76:
+ _scene->_nextSceneId = 105;
+ _action._inProgress = false;
+ return;
+
+ case 80:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 1), 81);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ _action._inProgress = false;
+ return;
+
+ case 81:
+ _scene->_sequences.addTimer(120, 82);
+ _action._inProgress = false;
+ return;
+
+ case 82:
+ _scene->_nextSceneId = 301;
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_STAGE_RIGHT_WING)) {
+ _scene->_nextSceneId = 107;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_DOWN) || _action.isAction(VERB_CLIMB_UP)) {
+ if (_globals[kSandbagStatus] == 1) {
+ switch (_game._trigger) {
+ case 0:
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('s',-1), 1);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ break;
+
+ case 1:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(225, 143);
+ _game._player.resetFacing(FACING_EAST);
+ _game._player.walk(Common::Point(236, 142), FACING_EAST);
+
+ if (_action.isAction(VERB_CLIMB_DOWN))
+ _game._player.setWalkTrigger(75);
+ else
+ _game._player.setWalkTrigger(80);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case 0:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 4, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 9);
+ _scene->_sequences.addTimer(6, 2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1:
+ _vm->_sound->command(70);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ _sandbagHostpotId = _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(227, 140, 227 + 18, 140 + 11));
+ _scene->_dynamicHotspots.setPosition(_sandbagHostpotId, Common::Point(224, 152), FACING_NORTHEAST);
+ break;
+
+ case 2:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('s', 1), 3);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _game._player._playerPos = Common::Point(228, 140);
+ _game._player.resetFacing(FACING_SOUTHEAST);
+ _globals[kSandbagStatus] = 1;
+ _vm->_dialogs->show(10632);
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 4, 65);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 67);
+ break;
+
+ case 65:
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 5);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ break;
+
+ case 66: {
+ int idx = _globals._sequenceIndexes[2];
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 5);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[2], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ }
+ break;
+
+ case 67:
+ _game._player._visible = true;
+ _game._player.walk(Common::Point(180, 60), FACING_NORTH);
+ _game._player.setWalkTrigger(68);
+ break;
+
+ case 68:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 69);
+ break;
+
+ case 69:
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _scene->_nextSceneId = 109;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(10610);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_STAGE_RIGHT_WING)) {
+ _vm->_dialogs->show(10611);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE_LEFT_WING)) {
+ _vm->_dialogs->show(10612);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_IN_TWO)) {
+ _vm->_dialogs->show(10613);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CYCLORAMA)) {
+ _vm->_dialogs->show(10614);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(10615);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PEDESTAL)) {
+ _vm->_dialogs->show(10616);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PLANT_PROP)) {
+ _vm->_dialogs->show(10617);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SANDBAG)) {
+ if (_scene->_customDest.y < 60) {
+ _vm->_dialogs->show(10618);
+ _action._inProgress = false;
+ return;
+ } else if (_game._objects.isInRoom(OBJ_SANDBAG)) {
+ _vm->_dialogs->show(10633);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isObject(NOUN_STATUE)) {
+ _vm->_dialogs->show(10619);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CIRCULAR_STAIRCASE)) {
+ _vm->_dialogs->show(10620);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BATTEN)) {
+ _vm->_dialogs->show(10621);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(10622);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOXES) || _action.isObject(NOUN_BOX)) {
+ _vm->_dialogs->show(10623);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BIG_PROP)) {
+ _vm->_dialogs->show(10624);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CRATE)) {
+ _vm->_dialogs->show(10625);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CASE)) {
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->show(10638);
+ else
+ _vm->_dialogs->show(10636);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_VENTILATION_DUCT)) {
+ _vm->_dialogs->show(10626);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_JUNK)) {
+ _vm->_dialogs->show(10627);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLATS)) {
+ _vm->_dialogs->show(10628);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10629);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CABLE_HOOK) && _game._objects.isInRoom(OBJ_CABLE_HOOK)) {
+ _vm->_dialogs->show(10639);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_STATUE)) {
+ _vm->_dialogs->show(10630);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_DOOR)) {
+ _vm->_dialogs->show(10634);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene106::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_STAGE_LEFT_WING))
+ _game._player._walkOffScreenSceneId = 108;
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR))
+ _game._player.walk(Common::Point(179, 63), FACING_NORTHWEST);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene107::Scene107(MADSEngine *vm) : Scene1xx(vm) {
+}
+
+void Scene107::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+}
+
+void Scene107::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene107::enter() {
+ if (_globals[kCurrentYear] == 1993)
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+
+ if (_game._objects.isInRoom(OBJ_YELLOW_FRAME)) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RRD_9");
+ }
+
+ if (_game._objects.isInRoom(OBJ_YELLOW_FRAME)) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else {
+ _scene->_hotspots.activate(NOUN_YELLOW_FRAME, false);
+ }
+
+ if (_globals[kCurrentYear] == 1993) {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_PROP_TABLE, false);
+ } else {
+ _scene->_hotspots.activate(NOUN_HEADSET, false);
+ }
+
+ if (_scene->_priorSceneId == 106) {
+ _game._player._playerPos = Common::Point(276, 73);
+ _game._player._facing = FACING_SOUTHWEST;
+ _game._player.walk(Common::Point(248, 75), FACING_SOUTHWEST);
+ } else if ((_scene->_priorSceneId == 104) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ if (_game._player._playerPos.y > 128) {
+ _game._player._playerPos.x = 216;
+ _game._player._facing = FACING_NORTHWEST;
+ } else if (_game._player._playerPos.y > 99) {
+ _game._player._playerPos.x = 127;
+ _game._player._facing = FACING_NORTHWEST;
+ } else {
+ _game._player._playerPos.x = 44;
+ _game._player._facing = FACING_NORTHEAST;
+ }
+ _game._player._playerPos.y = 143;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene107::step() {
+}
+
+void Scene107::actions() {
+ if (_action.isAction(VERB_WALK_ONTO, NOUN_STAGE)) {
+ _scene->_nextSceneId = 104;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK, NOUN_BACKSTAGE)) {
+ _scene->_nextSceneId = 106;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME) && (_game._objects.isInRoom(OBJ_YELLOW_FRAME) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ if (_globals[kCurrentYear] == 1881) {
+ int count = 0;
+ if (_game._objects.isInInventory(OBJ_GREEN_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_RED_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_BLUE_FRAME))
+ ++count;
+
+ if (count < 3)
+ _globals[kPlayerScore] += 5;
+ }
+
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_hotspots.activate(NOUN_YELLOW_FRAME, false);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 843, 0);
+ else
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(10710);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(10711);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_IN_TWO)) {
+ _vm->_dialogs->show(10712);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_IN_ONE)) {
+ _vm->_dialogs->show(10713);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CYCLORAMA)) {
+ _vm->_dialogs->show(10714);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COUNTERWEIGHT_SYSTEM)) {
+ _vm->_dialogs->show(10715);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PURCHASE_LINES)) {
+ _vm->_dialogs->show(10716);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LOCKRAIL)) {
+ _vm->_dialogs->show(10717);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(10718);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROP_TABLE)) {
+ _vm->_dialogs->show(10719);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ACT_CURTAIN)) {
+ _vm->_dialogs->show(10720);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEG)) {
+ _vm->_dialogs->show(10721);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_APRON)) {
+ _vm->_dialogs->show(10722);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROSCENIUM_ARCH)) {
+ _vm->_dialogs->show(10723);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(10724);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BACKSTAGE)) {
+ _vm->_dialogs->show(10725);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && _game._objects.isInRoom(OBJ_YELLOW_FRAME)) {
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->show(10727);
+ else
+ _vm->_dialogs->show(10726);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HEADSET)) {
+ _vm->_dialogs->show(10728);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10730);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_HEADSET)) {
+ _vm->_dialogs->show(10729);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_HEADSET)) {
+ _vm->_dialogs->show(10732);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PULL, NOUN_PURCHASE_LINES)) {
+ _vm->_dialogs->show(10731);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene107::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene108::Scene108(MADSEngine *vm) : Scene1xx(vm) {
+ _anim0ActvFl = false;
+ _handRaisedFl = false;
+ _shutUpCount = -1;
+ _maxTalkCount = -1;
+ _charAction = -1;
+ _charFrame = -1;
+ _charHotspotId = -1;
+ _charTalkCount = -1;
+ _conversationCount = -1;
+ _prevShutUpFrame = -1;
+}
+
+void Scene108::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_handRaisedFl);
+ s.syncAsSint16LE(_shutUpCount);
+ s.syncAsSint16LE(_maxTalkCount);
+ s.syncAsSint16LE(_charAction);
+ s.syncAsSint16LE(_charFrame);
+ s.syncAsSint16LE(_charHotspotId);
+ s.syncAsSint16LE(_charTalkCount);
+ s.syncAsSint16LE(_conversationCount);
+ s.syncAsSint16LE(_prevShutUpFrame);
+}
+
+void Scene108::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kCurrentYear] == 1993)
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_GENTLEMAN);
+ _scene->addActiveVocab(NOUN_CHARLES);
+}
+
+void Scene108::enter() {
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _handRaisedFl = false;
+ _charTalkCount = 0;
+ _shutUpCount = 40;
+ _maxTalkCount = 15;
+ }
+
+ _vm->_gameConv->get(2);
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _scene->_hotspots.activate(NOUN_STOOL, false);
+ int idx = _scene->_dynamicHotspots.add(NOUN_STOOL, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(250, 68, 250 + 8, 68 + 21));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(253, 75), FACING_SOUTHEAST);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ } else {
+ _scene->_hotspots.activate(NOUN_HEADSET, false);
+ int idx = _scene->_dynamicHotspots.add(NOUN_WALL, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(258, 58, 258 + 6, 58 + 10));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(236, 69), FACING_NORTHEAST);
+ }
+
+ if ((_globals[kCurrentYear] == 1993) && (_globals[kDoneBrieConv203] == 0)) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('c', 1), 1);
+ _anim0ActvFl = true;
+
+ if (_vm->_gameConv->_running == 2) {
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _charAction = 0;
+ _vm->_gameConv->run(2);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_globals[kJulieNameIsKnown]);
+ _vm->_gameConv->exportValue(_globals[kObservedPhan104]);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 55);
+ _shutUpCount = 40;
+ } else {
+ _charAction = 2;
+ }
+
+ if (_globals[kCharlesNameIsKnown]) {
+ _charHotspotId = _scene->_dynamicHotspots.add(NOUN_CHARLES, VERB_WALK_TO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(253, 52, 253 + 15, 52 + 34));
+ _scene->_dynamicHotspots[_charHotspotId]._articleNumber = PREP_ON;
+ } else {
+ _charHotspotId = _scene->_dynamicHotspots.add(NOUN_GENTLEMAN, VERB_WALK_TO, SYNTAX_MASC_NOT_PROPER, EXT_NONE, Common::Rect(253, 52, 253 + 15, 52 + 34));
+ _scene->_dynamicHotspots[_charHotspotId]._articleNumber = PREP_ON;
+ }
+ _scene->_dynamicHotspots.setPosition(_charHotspotId, Common::Point(235, 102), FACING_NORTHEAST);
+ }
+
+ if (_scene->_priorSceneId == 106) {
+ _game._player._playerPos = Common::Point(48, 81);
+ _game._player._facing = FACING_SOUTHEAST;
+ _game._player.walk(Common::Point(71, 76), FACING_SOUTHEAST);
+ } else if ((_scene->_priorSceneId == 104) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ if (_game._player._playerPos.y > 128) {
+ _game._player._playerPos.x = 124;
+ _game._player._facing = FACING_NORTHEAST;
+ } else if (_game._player._playerPos.y > 99) {
+ _game._player._playerPos.x = 185;
+ _game._player._facing = FACING_NORTHEAST;
+ } else {
+ _game._player._playerPos.x = 243;
+ _game._player._facing = FACING_NORTHWEST;
+ }
+
+ _game._player._playerPos.y = 143;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene108::step() {
+ if (_anim0ActvFl)
+ handleCharAnimation();
+
+ if ((_globals[kWalkerConverse] == 2) || (_globals[kWalkerConverse] == 3)) {
+ ++_conversationCount;
+ if (_conversationCount > 200)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+}
+
+void Scene108::actions() {
+ if (_vm->_gameConv->_running == 2) {
+ handleCharlesConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_GENTLEMAN) || _action.isAction(VERB_TALK_TO, NOUN_CHARLES)) {
+ _charAction = 6;
+ _game._player._stepEnabled = false;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_ONTO, NOUN_STAGE)) {
+ _scene->_nextSceneId = 104;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK, NOUN_BACKSTAGE)) {
+ _scene->_nextSceneId = 106;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(10810);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10730);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(10811);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_IN_TWO)) {
+ _vm->_dialogs->show(10812);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_IN_ONE)) {
+ _vm->_dialogs->show(10813);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROSCENIUM_ARCH)) {
+ _vm->_dialogs->show(10814);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ACT_CURTAIN)) {
+ _vm->_dialogs->show(10815);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEG)) {
+ _vm->_dialogs->show(10816);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CYCLORAMA)) {
+ _vm->_dialogs->show(10817);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLATS)) {
+ _vm->_dialogs->show(10818);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGEMANAGERS_POST)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(10819);
+ else
+ _vm->_dialogs->show(10820);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STOOL)) {
+ _vm->_dialogs->show(10821);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BACKSTAGE)) {
+ _vm->_dialogs->show(10822);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(10823);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HEADSET)) {
+ _vm->_dialogs->show(10824);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10826);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHARLES) || _action.isObject(NOUN_GENTLEMAN)) {
+ _vm->_dialogs->show(10827);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHARLES) || _action.isAction(VERB_TAKE, NOUN_GENTLEMAN)) {
+ _vm->_dialogs->show(10828);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_HEADSET)) {
+ _vm->_dialogs->show(10825);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_STOOL) && (_globals[kCurrentYear] == 1993)) {
+ _vm->_dialogs->show(10829);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_HEADSET)) {
+ _vm->_dialogs->show(10830);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene108::preActions() {
+}
+
+void Scene108::handleCharAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _charFrame)
+ return;
+
+ _charFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random = -1;
+
+ switch (_charFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 92:
+ if (_charAction == 2)
+ random = _vm->getRandomNumber(2, 15);
+
+ if (_charAction == 6) {
+ _charTalkCount = 0;
+ _charAction = 1;
+ random = 1;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 5;
+ break;
+
+ case 2:
+ resetFrame = 0;
+ break;
+
+ case 3:
+ resetFrame = 1;
+ break;
+
+ case 4:
+ resetFrame = 2;
+ break;
+
+ default:
+ resetFrame = 3;
+ break;
+ }
+ break;
+
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 27:
+ case 33:
+ case 41:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ case 62:
+ case 73:
+ if (_charFrame == 18) {
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(2);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_globals[kJulieNameIsKnown]);
+ _vm->_gameConv->exportValue(_globals[kObservedPhan104]);
+ }
+
+ if (_charAction == 1) {
+ if (_handRaisedFl) {
+ random = _vm->getRandomNumber(1, 3);
+ } else {
+ random = _vm->getRandomNumber(1, 4);
+ if (random == 4)
+ random = _vm->getRandomNumber(1, 4);
+ }
+
+ if (random == 4)
+ _handRaisedFl = true;
+
+ ++_charTalkCount;
+ if (_charTalkCount > _maxTalkCount) {
+ _charAction = 0;
+ _shutUpCount = 0;
+ _prevShutUpFrame = 10;
+ random = 12;
+ }
+ } else if (_charAction == 0) {
+ int delay = _vm->getRandomNumber(10, 15);
+ ++_shutUpCount;
+ if (_shutUpCount > delay) {
+ random = _vm->getRandomNumber(10, 16);
+ _prevShutUpFrame = random;
+ if (random == 15)
+ _shutUpCount = 16;
+ else
+ _shutUpCount = 0;
+ } else {
+ random = _prevShutUpFrame;
+ }
+ } else if (_charAction == 7) {
+ _charAction = 1;
+ random = 5;
+ } else if (_charAction == 3) {
+ _charAction = 1;
+ random = 6;
+ } else if (_charAction == 5) {
+ _charAction = 1;
+ random = 7;
+ } else if (_charAction == 4) {
+ _charAction = 1;
+ random = 8;
+ } else if (_charAction == 2) {
+ random = 9;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 18;
+ break;
+
+ case 2:
+ resetFrame = 19;
+ break;
+
+ case 3:
+ resetFrame = 20;
+ break;
+
+ case 4:
+ resetFrame = 62;
+ _charTalkCount += 5;
+ break;
+
+ case 5:
+ resetFrame = 21;
+ break;
+
+ case 6:
+ resetFrame = 41;
+ break;
+
+ case 7:
+ resetFrame = 33;
+ break;
+
+ case 8:
+ resetFrame = 27;
+ break;
+
+ case 9:
+ resetFrame = 74;
+ break;
+
+ case 10:
+ resetFrame = 51;
+ break;
+
+ case 11:
+ resetFrame = 53;
+ break;
+
+ case 12:
+ resetFrame = 54;
+ break;
+
+ case 13:
+ resetFrame = 55;
+ break;
+
+ case 14:
+ resetFrame = 56;
+ break;
+
+ case 15:
+ resetFrame = 57;
+ break;
+
+ case 16:
+ resetFrame = 52;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _charFrame = resetFrame;
+ }
+}
+
+void Scene108::handleCharlesConversation() {
+ switch (_action._activeAction._verbId) {
+ case 1:
+ case 25:
+ case 26:
+ _globals[kWalkerConverse] = 0;
+ _vm->_gameConv->setHeroTrigger(64);
+ if (_action._activeAction._verbId == 26)
+ _globals[kCharlesNameIsKnown] = 2;
+ break;
+
+ case 2:
+ if (!_globals[kCharlesNameIsKnown]) {
+ _scene->_dynamicHotspots.remove(_charHotspotId);
+ _charHotspotId = _scene->_dynamicHotspots.add(NOUN_CHARLES, VERB_WALK_TO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(253, 52, 253 + 15, 52 + 34));
+ _scene->_dynamicHotspots[_charHotspotId]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_charHotspotId, Common::Point(235, 102), FACING_NORTHEAST);
+ _globals[kCharlesNameIsKnown] = true;
+ }
+ break;
+
+ case 5:
+ _vm->_gameConv->setInterlocutorTrigger(66);
+ _maxTalkCount = 35;
+ break;
+
+ case 6:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 15:
+ _maxTalkCount = 35;
+ break;
+
+ case 16:
+ _vm->_gameConv->setInterlocutorTrigger(68);
+ _maxTalkCount = 35;
+ break;
+
+ case 19:
+ _vm->_gameConv->setInterlocutorTrigger(72);
+ break;
+
+ case 22:
+ _vm->_gameConv->setInterlocutorTrigger(70);
+ break;
+
+ default:
+ _maxTalkCount = 15;
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 60:
+ _charAction = 1;
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ break;
+
+ case 62:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+ _conversationCount = 0;
+ _charAction = 0;
+ break;
+
+ case 64:
+ _charAction = 2;
+ break;
+
+ case 66:
+ _charAction = 5;
+ break;
+
+ case 68:
+ _charAction = 4;
+ break;
+
+ case 70:
+ _charAction = 7;
+ break;
+
+ case 72:
+ _charAction = 3;
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_action._activeAction._verbId != 1) && (_action._activeAction._verbId != 5) &&
+ (_action._activeAction._verbId != 16) && (_action._activeAction._verbId != 19) &&
+ (_action._activeAction._verbId != 22) && (_action._activeAction._verbId != 25) &&
+ (_action._activeAction._verbId != 26) && (_charAction != 2)) {
+ _vm->_gameConv->setInterlocutorTrigger(60);
+ _vm->_gameConv->setHeroTrigger(62);
+ }
+
+ _charTalkCount = 0;
+ _shutUpCount = 40;
+ _handRaisedFl = false;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene109::Scene109(MADSEngine *vm) : Scene1xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+}
+
+void Scene109::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+}
+
+void Scene109::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene109::enter() {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RDR_6");
+
+ if (_globals[kCurrentYear] == 1881) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4));
+
+ _scene->_hotspots.activate(NOUN_LIGHT_FIXTURE, false);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+ _scene->_sequences.addTimer(1, 70);
+ } else {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('z', 0));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('z', 1));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('z', 2));
+
+ _scene->_hotspots.activate(NOUN_LAMP, false);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1);
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, 1);
+ }
+
+ if (_scene->_priorSceneId == 106) {
+ _game._player._playerPos = Common::Point(31, 459);
+ _game._player._facing = FACING_NORTHEAST;
+ _scene->setCamera(Common::Point(0, 312));
+ _scene->sceneScale(467, 95, 442, 78);
+ _currentFloor = 1;
+ } else if (_scene->_priorSceneId == 111) {
+ if (_globals[kLeaveAngelMusicOn]) {
+ _globals[kLeaveAngelMusicOn] = false;
+ sceneEntrySound();
+ }
+ _game._player._playerPos = Common::Point(4, 136);
+ _game._player._facing = FACING_EAST;
+ _game._player.walk(Common::Point(32, 138), FACING_EAST);
+ _game._player.setWalkTrigger(60);
+ _game._player._stepEnabled = false;
+ _scene->setCamera(Common::Point(0, 0));
+ _scene->sceneScale(155, 95, 130, 78);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _currentFloor = 3;
+ } else if ((_scene->_priorSceneId == 110) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(3, 292);
+ _game._player._facing = FACING_EAST;
+ _game._player.walk(Common::Point(31, 295), FACING_EAST);
+ _game._player.setWalkTrigger(65);
+ _game._player._stepEnabled = false;
+ _scene->setCamera(Common::Point(0, 156));
+ _scene->sceneScale(311, 95, 286, 78);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _currentFloor = 2;
+ } else if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (_currentFloor == 2) {
+ _scene->setCamera(Common::Point(0, 156));
+ _scene->sceneScale(311, 95, 286, 78);
+ } else if (_currentFloor == 3) {
+ _scene->setCamera(Common::Point(0, 0));
+ _scene->sceneScale(155, 95, 130, 78);
+ } else {
+ _scene->setCamera(Common::Point(0, 312));
+ _scene->sceneScale(467, 95, 442, 78);
+ }
+ }
+
+ sceneEntrySound();
+}
+
+void Scene109::step() {
+ if (_anim0ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 80)
+ _game.camPanTo(&_game._camY, 156);
+ }
+
+ if (_anim1ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == 80)
+ _game.camPanTo(&_game._camY, 0);
+ }
+
+ if (_anim2ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame() == 7)
+ _game.camPanTo(&_game._camY, 312);
+ }
+
+ if (_anim3ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == 14)
+ _game.camPanTo(&_game._camY, 156);
+ }
+
+ switch (_game._trigger) {
+ case 60:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 3);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ break;
+
+ case 61:
+ _vm->_sound->command(25);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 65:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 3);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ break;
+
+ case 66:
+ _vm->_sound->command(25);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+
+ if (_game._trigger == 70) {
+ int rndFrame = _vm->getRandomNumber(1, 3);
+ int rndDelay = _vm->getRandomNumber(4, 7);
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, rndFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, rndFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, rndFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ _scene->_sequences.addTimer(rndDelay, 70);
+ }
+}
+
+void Scene109::actions() {
+ if (_action.isAction(VERB_WALK, NOUN_BACKSTAGE)) {
+ _scene->_nextSceneId = 106;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_UP, NOUN_STAIRCASE)) {
+ if (_currentFloor == 2) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player.walk(Common::Point(58, 295), FACING_EAST);
+ _game._player.setWalkTrigger(1);
+ break;
+
+ case 1:
+ _anim1ActvFl = true;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('w', 2), 2);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[1], SYNC_PLAYER, 0);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ _scene->sceneScale(155, 95, 130, 78);
+ _anim1ActvFl = false;
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(261, 137);
+ _game._player.walk(Common::Point(281, 143), FACING_SOUTHWEST);
+ _game._player.setWalkTrigger(3);
+ break;
+
+ case 3:
+ _game._player._stepEnabled = true;
+ _currentFloor = 3;
+ break;
+
+ default:
+ break;
+ }
+ } else if (_currentFloor == 1) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player.walk(Common::Point(58, 452), FACING_EAST);
+ _game._player.setWalkTrigger(1);
+ break;
+
+ case 1:
+ _anim0ActvFl = true;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('w', 1), 2);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->sceneScale(311, 95, 286, 78);
+ _anim0ActvFl = false;
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(264, 295);
+ _game._player.walk(Common::Point(289, 299), FACING_SOUTHWEST);
+ _game._player.setWalkTrigger(3);
+ break;
+
+ case 3:
+ _game._player._stepEnabled = true;
+ _currentFloor = 2;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_DOWN, NOUN_STAIRCASE)) {
+ if (_currentFloor == 2) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player.walk(Common::Point(287, 291), FACING_WEST);
+ _game._player.setWalkTrigger(1);
+ break;
+
+ case 1:
+ _game._player.walk(Common::Point(269, 292), FACING_WEST);
+ _game._player.setWalkTrigger(2);
+ break;
+
+ case 2:
+ _anim2ActvFl = true;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('w', 3), 3);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[2], SYNC_PLAYER, 0);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[2]);
+ _scene->sceneScale(467, 95, 442, 78);
+ _anim2ActvFl = false;
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(61, 450);
+ _game._player.walk(Common::Point(36, 450), FACING_SOUTHEAST);
+ _game._player.setWalkTrigger(4);
+ break;
+
+ case 4:
+ _game._player._stepEnabled = true;
+ _currentFloor = 1;
+ break;
+
+ default:
+ break;
+ }
+ } else if (_currentFloor == 3) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player.walk(Common::Point(287, 137), FACING_WEST);
+ _game._player.setWalkTrigger(1);
+ break;
+
+ case 1:
+ _game._player.walk(Common::Point(269, 138), FACING_WEST);
+ _game._player.setWalkTrigger(2);
+ break;
+
+ case 2:
+ _anim3ActvFl = true;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('w', 4), 3);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[3], SYNC_PLAYER, 0);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[3]);
+ _scene->sceneScale(311, 95, 286, 78);
+ _anim3ActvFl = false;
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(59, 296);
+ _game._player.walk(Common::Point(40, 294), FACING_SOUTHEAST);
+ _game._player.setWalkTrigger(4);
+ break;
+
+ case 4:
+ _game._player._stepEnabled = true;
+ _currentFloor = 2;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR) || _game._trigger) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 4, 75);
+ break;
+
+ case 2:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ if (_currentFloor == 3)
+ _game._player.walk(Common::Point(2, 131), FACING_WEST);
+ else if (_currentFloor == 2)
+ _game._player.walk(Common::Point(2, 281), FACING_WEST);
+
+ _scene->_sequences.addTimer(180, 3);
+ break;
+
+ case 3:
+ if (_currentFloor == 3)
+ _scene->_nextSceneId = 111;
+ else if (_currentFloor == 2)
+ _scene->_nextSceneId = 110;
+ break;
+
+ case 75:
+ _vm->_sound->command(24);
+ if (_currentFloor == 3) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 3);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 76);
+ } else if (_currentFloor == 2) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 3);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 76);
+ }
+ break;
+
+ case 76:
+ if (_currentFloor == 3) {
+ int idx = _globals._sequenceIndexes[0];
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 3);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[0], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else if (_currentFloor == 2) {
+ int idx = _globals._sequenceIndexes[1];
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 3);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ }
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(10910);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_STAIRCASE)) {
+ if (_currentFloor == 1)
+ _vm->_dialogs->show(10911);
+ else if (_currentFloor == 2)
+ _vm->_dialogs->show(10921);
+ else if (_currentFloor == 3)
+ _vm->_dialogs->show(10922);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(10912);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BACKSTAGE)) {
+ _vm->_dialogs->show(10913);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(10914);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAILING)) {
+ _vm->_dialogs->show(10915);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(10916);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT_FIXTURE)) {
+ _vm->_dialogs->show(10917);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LAMP)) {
+ _vm->_dialogs->show(10918);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOLE)) {
+ _vm->_dialogs->show(10919);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(10920);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_LAMP)) {
+ _vm->_dialogs->show(10924);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_DOOR)) {
+ _vm->_dialogs->show(10923);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene109::preActions() {
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ if (_currentFloor == 3)
+ _game._player.walk(Common::Point(32, 138), FACING_WEST);
+ else if (_currentFloor == 2)
+ _game._player.walk(Common::Point(31, 295), FACING_WEST);
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene110::Scene110(MADSEngine *vm) : Scene1xx(vm) {
+}
+
+void Scene110::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+}
+
+void Scene110::setup() {
+ if (_globals[kCurrentYear] == 1993)
+ _scene->_variant = 1;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene110::enter() {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RDR_9");
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_POSTER, false);
+ _scene->_hotspots.activate(NOUN_WASTE_BASKET, false);
+
+ if (_globals[kDoneBrieConv203] == 0) {
+ if (_globals[kJuliesDoor] == 0) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8);
+ }
+ } else {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8);
+ }
+ } else {
+ _scene->_hotspots.activate(NOUN_BULLETIN_BOARD, false);
+ _scene->_hotspots.activate(NOUN_PAPER, false);
+ _scene->_hotspots.activate(NOUN_TRASH_BUCKET, false);
+ }
+
+ if (_scene->_priorSceneId == 112) {
+ _game._player._playerPos = Common::Point(261, 121);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(221, 131), FACING_SOUTH);
+ } else if ((_scene->_priorSceneId == 109) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player.firstWalk(Common::Point(335, 150), FACING_WEST, Common::Point(310, 150), FACING_WEST, true);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene110::step() {
+}
+
+void Scene110::actions() {
+ if ((_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_RIGHT_DOOR) || _action.isAction(VERB_LOCK, NOUN_RIGHT_DOOR))
+ && (_globals[kDoneBrieConv203] == 0) && (_globals[kCurrentYear] == 1993) && (_globals[kJuliesDoor] == 0)) {
+ _scene->_nextSceneId = 112;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_DOOR) || _action.isAction(VERB_OPEN, NOUN_LEFT_DOOR)
+ || _action.isAction(VERB_UNLOCK, NOUN_LEFT_DOOR) || _action.isAction(VERB_LOCK, NOUN_LEFT_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[1];
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], false);
+ _scene->_sequences.addTimer(30, 2);
+ _vm->_sound->command(73);
+ }
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ if (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK))
+ _vm->_dialogs->show(32);
+ else
+ _vm->_dialogs->show(11022);
+
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR) || _action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR)
+ || _action.isAction(VERB_UNLOCK, NOUN_RIGHT_DOOR) || _action.isAction(VERB_LOCK, NOUN_RIGHT_DOOR)) {
+ if ((_globals[kCurrentYear] == 1881) || (_globals[kDoneBrieConv203] >= 1)
+ && !_action.isAction(VERB_UNLOCK, NOUN_RIGHT_DOOR) && !_action.isAction(VERB_LOCK, NOUN_RIGHT_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[1];
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], false);
+ _scene->_sequences.addTimer(30, 2);
+ _vm->_sound->command(73);
+ }
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ if (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK))
+ _vm->_dialogs->show(32);
+ else
+ _vm->_dialogs->show(11023);
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ } else if (_globals[kJuliesDoor] == 1) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 7, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 4, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 1:
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 10, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _game._player.walk(Common::Point(261, 121), FACING_NORTHEAST);
+ _game._player.setWalkTrigger(4);
+ break;
+
+ case 4:
+ _scene->_nextSceneId = 112;
+ _globals[kJuliesDoor] = 0;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(11010);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(11011);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(11012);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(11013);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAIRWELL)) {
+ _vm->_dialogs->show(11014);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RIGHT_DOOR)) {
+ if (_globals[kDoneBrieConv203] >= 1)
+ _vm->_dialogs->show(11016);
+ else if (_globals[kChrisFStatus] == 1)
+ _vm->_dialogs->show(11015);
+ else
+ _vm->_dialogs->show(11016);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEFT_DOOR)) {
+ _vm->_dialogs->show(11016);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isObject(NOUN_WASTE_BASKET)) || (_action.isObject(NOUN_TRASH_BUCKET))) {
+ _vm->_dialogs->show(11017);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_POSTER)) {
+ _vm->_dialogs->show(11018);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BULLETIN_BOARD)) {
+ _vm->_dialogs->show(11019);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PAPER)) {
+ _vm->_dialogs->show(11029);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_WASTE_BASKET) || _action.isAction(VERB_TAKE, NOUN_TRASH_BUCKET)) {
+ _vm->_dialogs->show(11020);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT_FIXTURE)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11021);
+ else
+ _vm->_dialogs->show(11028);
+
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_PAPER)) {
+ _vm->_dialogs->show(11030);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_RIGHT_DOOR)) {
+ if (_globals[kDoneBrieConv203] >= 1)
+ _vm->_dialogs->show(11026);
+ else if (_globals[kChrisFStatus] == 1)
+ _vm->_dialogs->show(11024);
+ else
+ _vm->_dialogs->show(11026);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_LEFT_DOOR)) {
+ _vm->_dialogs->show(11025);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR)) {
+ if ((_globals[kChrisFStatus] == 1) && (_globals[kDoneBrieConv203] == 0))
+ _vm->_dialogs->show(11027);
+
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene110::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_STAIRWELL))
+ _game._player._walkOffScreenSceneId = 109;
+
+ if (_action.isAction(VERB_OPEN, NOUN_LEFT_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_LEFT_DOOR) || _action.isAction(VERB_LOCK, NOUN_LEFT_DOOR))
+ _game._player.walk(Common::Point(111, 126), FACING_NORTHEAST);
+
+ if (_action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR) || _action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR)
+ || _action.isAction(VERB_UNLOCK, NOUN_RIGHT_DOOR) || _action.isAction(VERB_LOCK, NOUN_RIGHT_DOOR)) {
+ if ((_globals[kCurrentYear] == 1881) || (_globals[kDoneBrieConv203] >= 1))
+ _game._player.walk(Common::Point(221, 131), FACING_NORTHEAST);
+ else if ((_globals[kJuliesDoor] == 1) || _action.isAction(VERB_OPEN))
+ _game._player.walk(Common::Point(223, 128), FACING_NORTHEAST);
+ else if (_globals[kJuliesDoor] == 0)
+ _game._player.walk(Common::Point(261, 120), FACING_NORTHEAST);
+ }
+
+ if (_action.isAction(VERB_LOOK, NOUN_PAPER))
+ _game._player._needToWalk = true;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene111::Scene111(MADSEngine *vm) : Scene1xx(vm) {
+ _removeAxe = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _closedFl = false;
+ _listenFrame = -1;
+ _listenStatus = -1;
+
+}
+
+void Scene111::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_removeAxe);
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_closedFl);
+ s.syncAsSint16LE(_listenFrame);
+ s.syncAsSint16LE(_listenStatus);
+}
+
+void Scene111::setup() {
+ if (_globals[kCurrentYear] == 1993)
+ _scene->_variant = 1;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene111::enter() {
+ _scene->_hotspots.activate(NOUN_HOOK, false);
+
+ _removeAxe = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _closedFl = true;
+
+ if (_globals[kCurrentYear] == 1881) {
+ if ((_globals[kJacquesNameIsKnown] == 2) && (_globals[kMadameNameIsKnown] == 2) && (_globals[kPanelIn206]) &&
+ (_globals[kDoneRichConv203]) && (_game._objects.isInInventory(OBJ_LANTERN)) &&
+ ((_game._objects.isInInventory(OBJ_CABLE_HOOK) && _game._objects.isInInventory(OBJ_ROPE)) || _game._objects.isInInventory(OBJ_ROPE_WITH_HOOK))) {
+ _closedFl = false;
+ } else
+ _closedFl = true;
+ } else
+ _closedFl = false;
+
+ if (_globals[kJacquesStatus]) {
+ _scene->_hotspots.activate(NOUN_HOOK, true);
+ _scene->_hotspots.activate(NOUN_FIRE_AXE, false);
+ }
+
+ _vm->_gameConv->get(14);
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RDR_9");
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 3));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 0));
+
+ if (_globals[kCurrentYear] == 1881)
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 2));
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _scene->drawToBackground(_globals._spriteIndexes[1], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_LAMP, false);
+ int idx = _scene->_dynamicHotspots.add(NOUN_WALL, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(35, 82, 35 + 13, 82 + 11));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(78, 122), FACING_NORTHEAST);
+ } else {
+ _scene->_hotspots.activate(NOUN_LIGHT, false);
+ if (_globals[kChristineDoorStatus] == 2) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 10);
+ _scene->drawToBackground(_globals._spriteIndexes[4], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_FIRE_AXE, false);
+ _scene->_hotspots.activate(NOUN_DOOR_CHUNKS, true);
+ _scene->_hotspots.activate(NOUN_HANDLE, true);
+ _scene->_hotspots.activate(NOUN_AXE, true);
+ }
+ }
+
+ if ((_globals[kChristineDoorStatus] == 0) && (_scene->_priorSceneId != 113) && !_closedFl) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ }
+
+ if ((_globals[kCurrentYear] == 1993) || (_globals[kChristineDoorStatus] <= 1)) {
+ if (!_globals[kJacquesStatus]) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 5);
+ _scene->_hotspots.activate(NOUN_AXE, false);
+ }
+ _scene->_hotspots.activate(NOUN_DOOR_CHUNKS, false);
+ _scene->_hotspots.activate(NOUN_HANDLE, false);
+ }
+
+ if (_scene->_priorSceneId == 113) {
+ _game._player._playerPos = Common::Point(146, 108);
+ _game._player.walk(Common::Point(112, 126), FACING_SOUTH);
+
+ if (!_globals[kLeaveAngelMusicOn])
+ sceneEntrySound();
+
+ if (_globals[kChristineDoorStatus] != 2) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ if ((_globals[kCurrentYear] == 1881) && (_globals[kLeaveAngelMusicOn])) {
+ _game._player.setWalkTrigger(60);
+ _game._player._stepEnabled = false;
+ _globals[kChristineDoorStatus] = 1;
+ _globals[kChrisKickedRaoulOut] = true;
+ _globals[kHintThatDaaeIsHome1] = true;
+ _globals[kHintThatDaaeIsHome2] = true;
+ }
+ }
+ } else if ((_scene->_priorSceneId == 109) || (_scene->_priorSceneId != RETURNING_FROM_LOADING))
+ _game._player.firstWalk(Common::Point(335, 150), FACING_WEST, Common::Point(311, 150), FACING_WEST, true);
+
+ sceneEntrySound();
+}
+
+void Scene111::step() {
+ if (_anim0ActvFl)
+ handleListenAnimation();
+
+ if (!_removeAxe && _anim1ActvFl && (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == 5)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _game._objects.addToInventory(OBJ_FIRE_AXE);
+ _removeAxe = true;
+ }
+
+ if (_game._objects.isInInventory(OBJ_FIRE_AXE) && _anim1ActvFl && (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == 36))
+ _game._objects.setRoom(OBJ_FIRE_AXE, NOWHERE);
+
+ if (_game._player._playerPos == Common::Point(145, 108))
+ _scene->_nextSceneId = 113;
+
+ switch (_game._trigger) {
+ case 60:
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[5], false, 7, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 62);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ break;
+
+ case 62:
+ _vm->_sound->command(25);
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(14);
+ if (_game._difficulty == DIFFICULTY_EASY)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+
+ _game._player.walk(Common::Point(119, 124), FACING_EAST);
+ _game._player.setWalkTrigger(64);
+ break;
+
+ case 64:
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 70);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ _anim0ActvFl = true;
+ _listenStatus = 0;
+ _game._player._visible = false;
+ break;
+
+ case 70:
+ _game._player._visible = true;
+ _anim0ActvFl = false;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->_sequences.addTimer(30, 71);
+ break;
+
+ case 71:
+ _vm->_gameConv->release();
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene111::actions() {
+ if (_vm->_gameConv->_running == 14) {
+ handleListenConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR) || _action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_LOCK)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ _action._inProgress = false;
+ return;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[0];
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[0], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], false);
+ _scene->_sequences.addTimer(30, 2);
+ _vm->_sound->command(73);
+ _action._inProgress = false;
+ return;
+ }
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ if (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK))
+ _vm->_dialogs->show(32);
+ else
+ _vm->_dialogs->show(11123);
+
+ _game._player._stepEnabled = true;
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_DOOR) || _action.isAction(VERB_OPEN, NOUN_LEFT_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_LEFT_DOOR) || _action.isAction(VERB_LOCK, NOUN_LEFT_DOOR)) {
+ if ((_globals[kChristineDoorStatus] == 1) || _closedFl || _action.isAction(VERB_UNLOCK, NOUN_LEFT_DOOR) || _action.isAction(VERB_LOCK, NOUN_LEFT_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ _action._inProgress = false;
+ return;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[0];
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[0], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], false);
+ _scene->_sequences.addTimer(30, 2);
+ _vm->_sound->command(73);
+ _action._inProgress = false;
+ return;
+ }
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+
+ if (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK))
+ _vm->_dialogs->show(32);
+ else if ((_globals[kChrisKickedRaoulOut]) && (_globals[kTicketPeoplePresent] == 1) && (_globals[kJacquesStatus] == 0))
+ _vm->_dialogs->show(11135);
+ else
+ _vm->_dialogs->show(11124);
+
+ _game._player._stepEnabled = true;
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ } else if (_globals[kChristineDoorStatus] == 2) {
+ _vm->_dialogs->show(11137);
+ _action._inProgress = false;
+ return;
+ } else {
+ _vm->_dialogs->show(11126);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_FIRE_AXE)) {
+ if ((_globals[kCurrentYear] == 1881) && (_globals[kJacquesStatus] == 0) && (_globals[kChristineDoorStatus] == 1) && (_globals[kChrisKickedRaoulOut])) {
+ switch (_game._trigger) {
+ case 0:
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('q', -1), 1);
+ _scene->_hotspots.activate(NOUN_FIRE_AXE, false);
+ _scene->_hotspots.activate(NOUN_DOOR_CHUNKS, true);
+ _scene->_hotspots.activate(NOUN_HANDLE, true);
+ _scene->_hotspots.activate(NOUN_AXE, true);
+ _anim1ActvFl = true;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ break;
+
+ case 1:
+ _globals[kChristineDoorStatus] = 2;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_ANIM, _globals._animationIndexes[1]);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 10);
+ _scene->drawToBackground(_globals._spriteIndexes[4], 1, Common::Point(-32000, -32000), 0, 100);
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ _game._player._visible = true;
+ _game._player._playerPos = Common::Point(126, 126);
+ _anim1ActvFl = false;
+ _game._player.walk(Common::Point(145, 108), FACING_NORTHEAST);
+ _game._player.resetFacing(FACING_NORTHWEST);
+ break;
+
+ default:
+ break;
+ }
+ } else if (_globals[kCurrentYear] == 1993 && _globals[kMakeBrieLeave203])
+ _vm->_dialogs->show(11142);
+ else
+ _vm->_dialogs->show(11134);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11110);
+ else
+ _vm->_dialogs->show(11111);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(11112);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(11113);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(11114);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAIRWELL)) {
+ _vm->_dialogs->show(11115);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TABLE)) {
+ _vm->_dialogs->show(11118);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PLANT)) {
+ _vm->_dialogs->show(11119);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FIRE_AXE)) {
+ _vm->_dialogs->show(11120);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HANDLE)) {
+ _vm->_dialogs->show(11121);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_AXE)) {
+ _vm->_dialogs->show(11122);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR_CHUNKS)) {
+ _vm->_dialogs->show(11129);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT)) {
+ _vm->_dialogs->show(11131);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LAMP)) {
+ _vm->_dialogs->show(11132);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOOK)) {
+ _vm->_dialogs->show(11141);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEFT_DOOR)) {
+ if (_globals[kJacquesStatus])
+ _vm->_dialogs->show(11140);
+ else if (_globals[kChristineDoorStatus] == 2)
+ _vm->_dialogs->show(11130);
+ else if ((_globals[kChrisKickedRaoulOut]) && (_globals[kTicketPeoplePresent] == 1))
+ _vm->_dialogs->show(11136);
+ else if ((_globals[kChristineDoorStatus] == 1) || _closedFl)
+ _vm->_dialogs->show(11117);
+ else if (_globals[kChristineDoorStatus] == 0)
+ _vm->_dialogs->show(11116);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RIGHT_DOOR)) {
+ _vm->_dialogs->show(11117);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_RIGHT_DOOR)) {
+ _vm->_dialogs->show(11128);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_LEFT_DOOR)) {
+ if (_closedFl)
+ _vm->_dialogs->show(11128);
+ else if ((_globals[kChristineDoorStatus] == 2) && (!_globals[kTicketPeoplePresent]))
+ _vm->_dialogs->show(11138);
+ else if (_globals[kChristineDoorStatus] == 1)
+ _vm->_dialogs->show(11127);
+ else if (_globals[kChristineDoorStatus] == 0)
+ _vm->_dialogs->show(11125);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_LEFT_DOOR)) {
+ if (_globals[kChristineDoorStatus] == 0)
+ _vm->_dialogs->show(11126);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene111::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_STAIRWELL)) {
+ if (_globals[kLeaveAngelMusicOn]) {
+ _vm->_dialogs->show(11139);
+ _game._player._needToWalk = false;
+ _game._player.cancelCommand();
+ } else
+ _game._player._walkOffScreenSceneId = 109;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_FIRE_AXE) && _game._objects.isInRoom(OBJ_FIRE_AXE) && (_globals[kCurrentYear] == 1881)
+ && (_globals[kChristineDoorStatus] == 1) && (_globals[kChrisKickedRaoulOut]) && (_globals[kJacquesStatus] == 0))
+ _game._player.walk(Common::Point(119, 124), FACING_EAST);
+
+ if (_action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_RIGHT_DOOR) || _action.isAction(VERB_LOCK, NOUN_RIGHT_DOOR))
+ _game._player.walk(Common::Point(219, 131), FACING_NORTHEAST);
+
+ if (_action.isAction(VERB_OPEN, NOUN_LEFT_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_LEFT_DOOR) || _action.isAction(VERB_LOCK, NOUN_LEFT_DOOR))
+ _game._player.walk(Common::Point(109, 124), FACING_NORTHEAST);
+
+ if ((_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_DOOR) || _action.isAction(VERB_UNLOCK, NOUN_LEFT_DOOR) || _action.isAction(VERB_LOCK, NOUN_LEFT_DOOR))
+ && !_closedFl && ((_globals[kChristineDoorStatus] == 2) || (_globals[kChristineDoorStatus] == 0)))
+ _game._player.walk(Common::Point(145, 108), FACING_NORTHEAST);
+}
+
+void Scene111::handleListenAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _listenFrame)
+ return;
+
+ int nextFrame = -1;
+ _listenFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+
+ if (_listenFrame == 6) {
+ if (_listenStatus == 0)
+ nextFrame = 5;
+ else if (_listenStatus == 1)
+ nextFrame = 7;
+ }
+
+ if (nextFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], nextFrame);
+ _listenFrame = nextFrame;
+ }
+}
+
+void Scene111::handleListenConversation() {
+ if (_action._activeAction._verbId == 1)
+ _vm->_gameConv->setInterlocutorTrigger(66);
+
+ if (_action._activeAction._verbId == 7)
+ _vm->_gameConv->setInterlocutorTrigger(68);
+
+ if (_game._trigger == 66)
+ _listenStatus = 0;
+
+ if (_game._trigger == 68) {
+ _listenStatus = 1;
+ _vm->_gameConv->hold();
+ }
+
+ if ((_action._activeAction._verbId != 1) && (_action._activeAction._verbId != 7))
+ _vm->_gameConv->setInterlocutorTrigger(72);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene112::Scene112(MADSEngine *vm) : Scene1xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _raoulAction = -1;
+ _raoulFrame = -1;
+ _didOptionFl = -1;
+ _julieFrame = -1;
+ _julieAction = -1;
+ _julieHotspotId = -1;
+ _julieCounter = -1;
+}
+
+void Scene112::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsSint16LE(_raoulAction);
+ s.syncAsSint16LE(_raoulFrame);
+ s.syncAsSint16LE(_didOptionFl);
+ s.syncAsSint16LE(_julieFrame);
+ s.syncAsSint16LE(_julieAction);
+ s.syncAsSint16LE(_julieCounter);
+}
+
+void Scene112::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_WOMAN);
+ _scene->addActiveVocab(NOUN_JULIE);
+}
+
+void Scene112::enter() {
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _raoulAction = 2;
+ _didOptionFl = 0;
+ }
+
+ _vm->_gameConv->get(3);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('j', 1), 1);
+ _anim0ActvFl = true;
+ _julieAction = 2;
+ _scene->setAnimFrame(_globals._animationIndexes[0], 3);
+ if (_globals[kJulieNameIsKnown] == 2) {
+ _julieHotspotId = _scene->_dynamicHotspots.add(NOUN_JULIE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(255, 82, 255 + 30, 82 + 44));
+ _scene->_dynamicHotspots[_julieHotspotId]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_julieHotspotId, Common::Point(216, 137), FACING_NORTHEAST);
+ _scene->_hotspots.activate(NOUN_WOMAN, false);
+ }
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _anim1ActvFl = true;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 82);
+ _raoulAction = 2;
+
+ if (_vm->_gameConv->_restoreRunning == 3) {
+ _vm->_gameConv->run(3);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _scene->setAnimFrame(_globals._animationIndexes[1], 17);
+ _raoulAction = 1;
+ _game._player._playerPos = Common::Point(53, 128);
+ _game._player._facing = FACING_EAST;
+ _game._player._visible = false;
+ } else if ((_scene->_priorSceneId == 110) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(128, 145);
+ _game._player._facing = FACING_NORTH;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene112::step() {
+ if (_anim0ActvFl)
+ handleJulieAnimation();
+
+ if (_anim1ActvFl)
+ handleRaoulChair();
+}
+
+void Scene112::actions() {
+ if (_vm->_gameConv->_running == 3) {
+ handleConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_TALK_TO, NOUN_JULIE)) || (_action.isAction(VERB_TALK_TO, NOUN_WOMAN))) {
+ if (_globals[kJulieNameIsKnown] > 0) {
+ _game._player._visible = false;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[1], SYNC_PLAYER, 0);
+ _scene->setAnimFrame(_globals._animationIndexes[1], 1);
+ _raoulAction = 1;
+ }
+ _vm->_gameConv->run(3);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CORRIDOR)) {
+ _scene->_nextSceneId = 110;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(11210);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(11211);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(11212);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MIRROR)) {
+ _vm->_dialogs->show(11213);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BALLET_BAR)) {
+ _vm->_dialogs->show(11214);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CORRIDOR)) {
+ _vm->_dialogs->show(11215);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_THROW_RUGS)) {
+ _vm->_dialogs->show(11216);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DRESSING_SCREEN)) {
+ _vm->_dialogs->show(11217);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DRESSING_TABLE)) {
+ _vm->_dialogs->show(11218);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHAIR)) {
+ _vm->_dialogs->show(11219);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PLANT)) {
+ _vm->_dialogs->show(11220);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COAT_RACK)) {
+ _vm->_dialogs->show(11221);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_UMBRELLA)) {
+ _vm->_dialogs->show(11222);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PAINTINGS)) {
+ _vm->_dialogs->show(11223);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TRASH_BUCKET)) {
+ _vm->_dialogs->show(11224);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SHELF)) {
+ _vm->_dialogs->show(11225);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CONTAINER)) {
+ _vm->_dialogs->show(11226);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TORN_POSTER)) {
+ _vm->_dialogs->show(11227);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_POSTER)) {
+ _vm->_dialogs->show(11228);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isObject(NOUN_REVIEW)) || (_action.isObject(NOUN_REVIEWS))) {
+ _vm->_dialogs->show(11229);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_JULIE)) {
+ _vm->_dialogs->show(11231);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COSTUME_RACK)) {
+ _vm->_dialogs->show(11232);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT_FIXTURE)) {
+ _vm->_dialogs->show(11233);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WARDROBE)) {
+ _vm->_dialogs->show(11234);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WOMAN)) {
+ _vm->_dialogs->show(11237);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE)) {
+ if (_action.isObject(NOUN_WOMAN) || _action.isObject(NOUN_JULIE)) {
+ _vm->_dialogs->show(11238);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_WARDROBE)) {
+ _vm->_dialogs->show(11235);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CONTAINER)) {
+ _vm->_dialogs->show(11236);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene112::preActions() {
+ if ((_action.isAction(VERB_TALK_TO, NOUN_JULIE) || _action.isAction(VERB_TALK_TO, NOUN_WOMAN)) && (_globals[kJulieNameIsKnown] > 0))
+ _game._player.walk(Common::Point(53, 128), FACING_EAST);
+}
+
+void Scene112::handleConversation() {
+ switch (_action._activeAction._verbId) {
+ case 1:
+ if (!_game._trigger && (_raoulAction == 2))
+ _vm->_gameConv->setInterlocutorTrigger(68);
+ break;
+
+ case 3:
+ case 4:
+ if (_globals[kJulieNameIsKnown] < 2) {
+ _globals[kJulieNameIsKnown] = 2;
+ _scene->_hotspots.activate(NOUN_WOMAN, false);
+ _julieHotspotId = _scene->_dynamicHotspots.add(NOUN_JULIE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(255, 82, 255 + 30, 82 + 44));
+ _scene->_dynamicHotspots[_julieHotspotId]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_julieHotspotId, Common::Point(216, 137), FACING_NORTHEAST);
+ }
+ break;
+
+ case 5:
+ _vm->_gameConv->setInterlocutorTrigger(74);
+ _globals[kJulieNameIsKnown] = 1;
+ break;
+
+ case 6:
+ case 7:
+ case 10:
+ case 23:
+ case 27:
+ _vm->_gameConv->setInterlocutorTrigger(74);
+ _globals[kJulieNameIsKnown] = 2;
+ break;
+
+ case 13:
+ _julieAction = 1;
+ _raoulAction = 1;
+ break;
+
+ case 14:
+ case 15:
+ case 16:
+ _julieAction = 0;
+ _raoulAction = 1;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 60:
+ _julieAction = 0;
+ _raoulAction = 1;
+ break;
+
+ case 62:
+ _julieAction = 2;
+ if (_raoulAction != 2)
+ _raoulAction = 0;
+ break;
+
+ case 68:
+ _scene->_sequences.addTimer(120, 70);
+ _vm->_gameConv->hold();
+ break;
+
+ case 70:
+ _game._player.walk(Common::Point(53, 128), FACING_EAST);
+ _game._player.setWalkTrigger(72);
+ break;
+
+ case 72:
+ _vm->_gameConv->release();
+ _game._player._visible = false;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[1], SYNC_PLAYER, 0);
+ _scene->setAnimFrame(_globals._animationIndexes[1], 1);
+ _raoulAction = 1;
+ break;
+
+ case 74:
+ _raoulAction = 3;
+ _vm->_gameConv->hold();
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_action._activeAction._verbId != 0) && (_action._activeAction._verbId != 1) &&
+ (_action._activeAction._verbId != 2) && (_action._activeAction._verbId != 5) &&
+ (_action._activeAction._verbId != 6) && (_action._activeAction._verbId != 7) &&
+ (_action._activeAction._verbId != 10) && (_action._activeAction._verbId != 23) &&
+ (_action._activeAction._verbId != 27)) {
+ _vm->_gameConv->setInterlocutorTrigger(60);
+ _vm->_gameConv->setHeroTrigger(62);
+ }
+
+ if (_action._activeAction._verbId == 18)
+ _globals[kCanFindBookInLibrary] = true;
+
+ _julieCounter = 0;
+}
+
+void Scene112::handleJulieAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _julieFrame)
+ return;
+
+ _julieFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int random = -1;
+ int resetFrame = -1;
+
+ switch (_julieFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 22:
+ case 39:
+ case 71:
+ case 107:
+ switch (_julieAction) {
+ case 0:
+ random = _vm->getRandomNumber(4, 6);
+ ++_julieCounter;
+ if (_julieCounter > 25)
+ _julieAction = 2;
+ break;
+
+ case 1:
+ random = 3;
+ break;
+
+ case 2:
+ random = _vm->getRandomNumber(1, 3);
+ while (_didOptionFl == random)
+ random = _vm->getRandomNumber(1, 3);
+ _didOptionFl = random;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 22;
+ break;
+
+ case 2:
+ resetFrame = 39;
+ break;
+
+ case 3:
+ resetFrame = 83;
+ break;
+
+ case 4:
+ resetFrame = 0;
+ break;
+
+ case 5:
+ resetFrame = 1;
+ break;
+
+ case 6:
+ resetFrame = 2;
+ break;
+
+ default:
+ break;
+ }
+ break;
+ case 56:
+ case 77:
+ case 83:
+ random = _vm->getRandomNumber(1, 3);
+ while (_didOptionFl == random)
+ random = _vm->getRandomNumber(1, 3);
+ _didOptionFl = random;
+
+ if ((_julieAction == 0) || (_julieAction == 1))
+ random = 3;
+
+ switch (random) {
+ case 1:
+ resetFrame = 71;
+ break;
+
+ case 2:
+ resetFrame = 77;
+ break;
+
+ case 3:
+ resetFrame = 56;
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+
+ case 95:
+ if (_julieAction == 1)
+ random = 2;
+ else
+ random = 1;
+
+ switch (random) {
+ case 1:
+ resetFrame = 95;
+ break;
+
+ case 2:
+ resetFrame = 107;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 130:
+ resetFrame = 95;
+ _julieAction = 2;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _julieFrame = resetFrame;
+ }
+}
+
+void Scene112::handleRaoulChair() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _raoulFrame)
+ return;
+
+ _raoulFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random = -1;
+
+ switch (_raoulFrame) {
+ case 18:
+ case 30:
+ case 41:
+ case 49:
+ case 56:
+ case 65:
+ switch (_raoulAction) {
+ case 0:
+ random = _vm->getRandomNumber(1, 4);
+ _raoulAction = 1;
+ break;
+
+ case 2:
+ random = 6;
+ break;
+
+ case 3:
+ random = 5;
+ _raoulAction = 2;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(7, 50);
+ while (_didOptionFl == random)
+ random = _vm->getRandomNumber(7, 50);
+ _didOptionFl = random;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 49;
+ break;
+
+ case 2:
+ resetFrame = 41;
+ break;
+
+ case 3:
+ resetFrame = 18;
+ break;
+
+ case 4:
+ resetFrame = 30;
+ break;
+
+ case 5:
+ resetFrame = 65;
+ break;
+
+ case 6:
+ resetFrame = 82;
+ break;
+
+ case 7:
+ resetFrame = 56;
+ break;
+
+ default:
+ resetFrame = 17;
+ break;
+ }
+ break;
+
+ case 61:
+ if (_raoulAction == 1)
+ random = 1;
+ else
+ random = 2;
+
+ switch (random) {
+ case 1:
+ resetFrame = 60;
+ break;
+
+ case 2:
+ resetFrame = 61;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 82:
+ _raoulAction = 2;
+ _game._player._visible = true;
+ _vm->_gameConv->release();
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ case 83:
+ if (_raoulAction == 2)
+ random = 1;
+ else
+ random = 2;
+
+ switch (random) {
+ case 1:
+ resetFrame = 82;
+ break;
+
+ case 2:
+ resetFrame = 0;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene113::Scene113(MADSEngine *vm) : Scene1xx(vm) {
+ _standingAndTalking = false;
+ _dayWantsToTalk = false;
+ _musicPlaying = false;
+ _afterKissFl = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _prevent1 = false;
+ _prevent2 = false;
+ _raoulStandingFl = false;
+ _armsOutFl = false;
+
+ _dayStatus = -1;
+ _raoulAction = -1;
+ _christineHotspotId2 = -1;
+ _raoulCount = -1;
+ _dayCount = -1;
+ _standCount = -1;
+ _julieStatus = -1;
+ _florentStatus = -1;
+ _florentFrame = -1;
+ _florentCount = -1;
+ _dayFrame = -1;
+ _lastDayResetFrame = -1;
+ _raoulFrame = -1;
+ _julieFrame = -1;
+ _julieCount = -1;
+}
+
+void Scene113::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+
+ s.syncAsByte(_standingAndTalking);
+ s.syncAsByte(_dayWantsToTalk);
+ s.syncAsByte(_musicPlaying);
+ s.syncAsByte(_afterKissFl);
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+ s.syncAsByte(_anim4ActvFl);
+ s.syncAsByte(_prevent1);
+ s.syncAsByte(_prevent2);
+ s.syncAsByte(_raoulStandingFl);
+ s.syncAsByte(_armsOutFl);
+
+ s.syncAsSint16LE(_dayStatus);
+ s.syncAsSint16LE(_raoulAction);
+ s.syncAsSint16LE(_christineHotspotId2);
+ s.syncAsSint16LE(_raoulCount);
+ s.syncAsSint16LE(_dayCount);
+ s.syncAsSint16LE(_standCount);
+ s.syncAsSint16LE(_julieStatus);
+ s.syncAsSint16LE(_florentStatus);
+ s.syncAsSint16LE(_florentFrame);
+ s.syncAsSint16LE(_florentCount);
+ s.syncAsSint16LE(_dayFrame);
+ s.syncAsSint16LE(_lastDayResetFrame);
+ s.syncAsSint16LE(_raoulFrame);
+ s.syncAsSint16LE(_julieFrame);
+ s.syncAsSint16LE(_julieCount);
+}
+
+void Scene113::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_CHRISTINE);
+ _scene->addActiveVocab(NOUN_WOMAN);
+ _scene->addActiveVocab(NOUN_JULIE);
+}
+
+void Scene113::enter() {
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _standingAndTalking = false;
+ _dayWantsToTalk = false;
+ _musicPlaying = false;
+ _afterKissFl = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _prevent1 = false;
+ _prevent2 = false;
+ _raoulStandingFl = false;
+ _armsOutFl = false;
+ }
+
+ _scene->_hotspots.activate(NOUN_SMALL_NOTE, false);
+ _scene->_hotspots.activate(NOUN_DRESSING_GOWN, false);
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+ _scene->_hotspots.activate(NOUN_JULIE, false);
+ _scene->_hotspots.activate(NOUN_LIGHT_FIXTURE, false);
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('f', 0));
+
+ if (_game._objects.isInRoom(OBJ_SMALL_NOTE))
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 1));
+
+ if ((_globals[kDoneBrieConv203] == 1) || (_globals[kDoneBrieConv203] == 3))
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 3));
+ }
+
+ if (_globals[kCurrentYear] == 1993) {
+ _vm->_gameConv->get(4);
+ if ((_globals[kDoneBrieConv203] == 1) || (_globals[kDoneBrieConv203] == 3))
+ _vm->_gameConv->get(6);
+ } else {
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*faceral", false);
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*facecrsd", false);
+ _vm->_gameConv->get(13);
+ }
+
+ if (_globals[kCurrentYear] == 1993) {
+ _scene->drawToBackground(_globals._spriteIndexes[3], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_VASE, false);
+ _scene->_hotspots.activate(NOUN_FAN, false);
+ _scene->_hotspots.activateAtPos(NOUN_LIGHT_FIXTURE, true, Common::Point(155, 17));
+ } else {
+ _scene->_hotspots.activateAtPos(NOUN_LIGHT_FIXTURE, true, Common::Point(150, 46));
+ _scene->_hotspots.activate(NOUN_NOTICE, false);
+ }
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (_globals[kCurrentYear] == 1881) {
+ if (_dayStatus <= 3) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _anim1ActvFl = true;
+ }
+
+ if (_raoulAction == 3)
+ _scene->setAnimFrame(_globals._animationIndexes[1], 33);
+ else {
+ _raoulAction = 1;
+ _game._player._visible = false;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 8);
+ }
+
+ if (_musicPlaying) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 2), 0);
+ _anim0ActvFl = true;
+ _christineHotspotId1 = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[_christineHotspotId1]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 13);
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 14);
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 16);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 212);
+ _game._player._visible = true;
+ _anim1ActvFl = false;
+ } else {
+ switch (_dayStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 0);
+ _anim0ActvFl = true;
+ _dayStatus = 2;
+ _scene->setAnimFrame(_globals._animationIndexes[0], 208);
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, false, Common::Point(220, 130));
+ break;
+
+ default:
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 2), 0);
+ _anim0ActvFl = true;
+ _dayStatus = 7;
+ _game._player._visible = false;
+ _scene->setAnimFrame(_globals._animationIndexes[0], 165);
+ break;
+ }
+ _christineHotspotId1 = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[_christineHotspotId1]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 13);
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 14);
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 16);
+ }
+
+ if (_dayStatus == 2) {
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, false, Common::Point(220, 130));
+ } else {
+ _game._player._playerPos = Common::Point(175, 148);
+ _game._player._facing = FACING_NORTHEAST;
+ }
+
+ } else if ((_globals[kDoneBrieConv203] == 1) || (_globals[kDoneBrieConv203] == 3)) {
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('x', 1), 1);
+ _julieStatus = 0;
+ _anim4ActvFl = true;
+ _globals[kMakeBrieLeave203] = true;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_hotspots.activate(NOUN_DRESSING_GOWN, true);
+ _scene->_hotspots.activate(NOUN_JULIE, true);
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, true, Common::Point(220, 130));
+ } else if (_globals[kCurrentYear] == 1993) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('f', 1), 1);
+ _anim2ActvFl = true;
+
+ if (_florentStatus != 3)
+ _florentStatus = 1;
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _anim3ActvFl = true;
+
+ if (_raoulAction == 3)
+ _scene->setAnimFrame(_globals._animationIndexes[3], 33);
+ else {
+ _scene->setAnimFrame(_globals._animationIndexes[3], 8);
+ _raoulAction = 1;
+ _game._player._playerPos = Common::Point(201, 120);
+ _game._player._facing = FACING_SOUTH;
+ _game._player._visible = false;
+ }
+
+ if (_florentStatus == 3)
+ _scene->setAnimFrame(_globals._animationIndexes[2], 41);
+
+ if (_globals[kFlorentNameIsKnown] >= 1) {
+ _christineHotspotId2 = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(43, 118, 43 + 15, 118 + 29));
+ _scene->_dynamicHotspots[_christineHotspotId2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_christineHotspotId2, Common::Point(106, 127), FACING_SOUTHWEST);
+ } else {
+ _christineHotspotId2 = _scene->_dynamicHotspots.add(NOUN_WOMAN, VERB_WALK_TO, SYNTAX_FEM_NOT_PROPER, EXT_NONE, Common::Rect(43, 118, 43 + 15, 118 + 29));
+ _scene->_dynamicHotspots[_christineHotspotId2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_christineHotspotId2, Common::Point(106, 127), FACING_SOUTHWEST);
+ }
+
+ _scene->_hotspots.activate(NOUN_DRESSING_GOWN, true);
+
+ if (_game._objects.isInRoom(OBJ_SMALL_NOTE)) {
+ _scene->_hotspots.activate(NOUN_SMALL_NOTE, true);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 13);
+ }
+ }
+ } else if (_globals[kCurrentYear] == 1993) {
+ if ((_globals[kDoneBrieConv203] == 1) || (_globals[kDoneBrieConv203] == 3)) {
+ if (!(_globals[kPlayerScoreFlags] & 4)) {
+ _globals[kPlayerScoreFlags] = _globals[kPlayerScoreFlags] | 4;
+ _globals[kPlayerScore] += 5;
+ }
+
+ _globals._animationIndexes[4] = _scene->loadAnimation(formAnimName('x', 1), 1);
+ _julieStatus = 0;
+ _anim4ActvFl = true;
+ _globals[kMakeBrieLeave203] = true;
+ _game._player._playerPos = Common::Point(190, 148);
+ _game._player._facing = FACING_NORTH;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_hotspots.activate(NOUN_DRESSING_GOWN, true);
+ _scene->_hotspots.activate(NOUN_JULIE, true);
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, true, Common::Point(220, 130));
+ _game._player.walk(Common::Point(175, 128), FACING_NORTHEAST);
+ _game._player.setWalkTrigger(102);
+ } else {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('f', 1), 1);
+ _florentStatus = 1;
+ _anim2ActvFl = true;
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _raoulAction = 3;
+ _anim3ActvFl = true;
+ _scene->setAnimFrame(_globals._animationIndexes[3], 33);
+
+ if (_globals[kFlorentNameIsKnown] >= 1) {
+ _christineHotspotId2 = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(43, 118, 43 + 15, 118 + 29));
+ _scene->_dynamicHotspots[_christineHotspotId2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_christineHotspotId2, Common::Point(106, 127), FACING_SOUTHWEST);
+ } else {
+ _christineHotspotId2 = _scene->_dynamicHotspots.add(NOUN_WOMAN, VERB_WALK_TO, SYNTAX_FEM_NOT_PROPER, EXT_NONE, Common::Rect(43, 118, 43 + 15, 118 + 29));
+ _scene->_dynamicHotspots[_christineHotspotId2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_christineHotspotId2, Common::Point(106, 127), FACING_SOUTHWEST);
+ }
+
+ _game._player._playerPos = Common::Point(190, 148);
+ _game._player._facing = FACING_NORTH;
+
+ _scene->_hotspots.activate(NOUN_DRESSING_GOWN, true);
+ if (_game._objects.isInRoom(OBJ_SMALL_NOTE)) {
+ _scene->_hotspots.activate(NOUN_SMALL_NOTE, true);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 13);
+ }
+ }
+ } else if ((_globals[kCurrentYear] == 1881) && (! _globals[kChrisKickedRaoulOut])) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _raoulAction = 3;
+ _anim1ActvFl = true;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 33);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 1);
+ _dayStatus = 2;
+ _anim0ActvFl = true;
+
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, false, Common::Point(220, 130));
+ _scene->_sequences.addTimer(60, 60);
+ _game._player._playerPos = Common::Point(190, 148);
+ _game._player._facing = FACING_NORTH;
+ } else if ((_globals[kCurrentYear] == 1881) && _globals[kChrisKickedRaoulOut]) {
+ _globals[kChrisKickedRaoulOut] = 2;
+ _game._player._playerPos = Common::Point(190, 148);
+ _game._player._facing = FACING_NORTH;
+ _globals[kCameFromFade] = true;
+ _game._player._stepEnabled = false;
+ _globals[kPlayerScore] += 8;
+ _scene->_sequences.addTimer(60, 110);
+ } else if (_scene->_priorSceneId == 111) {
+ _game._player._playerPos = Common::Point(190, 148);
+ _game._player._facing = FACING_NORTH;
+ }
+
+ switch (_vm->_gameConv->_restoreRunning) {
+ case 4:
+ _vm->_gameConv->run(4);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ break;
+
+ case 6:
+ _vm->_gameConv->run(6);
+ break;
+
+ case 13:
+ _vm->_gameConv->run(13);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ break;
+
+ default:
+ break;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene113::step() {
+ if (_anim1ActvFl)
+ handleRaoulAnimation2();
+
+ if (_anim4ActvFl)
+ handleJulieAnimation();
+
+ if (_anim2ActvFl)
+ handleFlorentAnimation();
+
+ if (_anim3ActvFl) {
+ handleRaoulAnimation();
+
+ if ((!_game._objects.isInInventory(OBJ_SMALL_NOTE)) && (_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == 26)) {
+ _scene->_hotspots.activate(NOUN_SMALL_NOTE, false);
+ _game._objects.addToInventory(OBJ_SMALL_NOTE);
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _vm->_sound->command(26);
+ _vm->_dialogs->showItem(OBJ_SMALL_NOTE, 806, 2);
+ }
+ }
+
+ if ((_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 86) && (!_prevent2)) {
+ _scene->freeAnimation(_globals._animationIndexes[0]);
+ _prevent2 = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 2), 0);
+ _scene->setAnimFrame (_globals._animationIndexes[0], 86);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_CLOCK, 0);
+ _scene->animations_tick();
+ }
+
+ if (_anim0ActvFl) {
+ handleDayAnimation();
+
+ if ((_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 95) && (!_armsOutFl)) {
+ _standingAndTalking = true;
+ _dayStatus = 7;
+ _raoulAction = 3;
+ _armsOutFl = true;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_ANIM, _globals._animationIndexes[1]);
+ }
+
+ if ((_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 165) && !_afterKissFl)
+ _afterKissFl = true;
+ }
+
+ switch (_game._trigger) {
+ case 60:
+ if (!_game._visitedScenes._sceneRevisited)
+ _vm->_dialogs->show(11342);
+ break;
+
+ case 102:
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(6);
+ break;
+
+ case 108:
+ _vm->_dialogs->show(11332);
+ _vm->_dialogs->show(11333);
+ _scene->_nextSceneId = 150;
+ _globals[kLeaveAngelMusicOn] = false;
+ break;
+
+ case 110:
+ _vm->_dialogs->show(11331);
+ _game._player.walk(Common::Point(272, 138), FACING_EAST);
+ _game._player.setWalkTrigger(108);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene113::actions() {
+ if (_vm->_gameConv->_running == 13) {
+ handleLoveConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 4) {
+ handleFlorentConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 6) {
+ handleDeadConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_TALK_TO, NOUN_WOMAN)) || (_action.isAction(VERB_TALK_TO, NOUN_CHRISTINE))) {
+ if (_globals[kCurrentYear] == 1881) {
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(13);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ } else if (_globals[kDoneBrieConv203]) {
+ _vm->_dialogs->show(11348);
+ } else {
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(4);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CORRIDOR)) {
+ if (_globals[kDoneBrieConv203] == 1)
+ _globals[kDoneBrieConv203] = 3;
+
+ _scene->_nextSceneId = 111;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if (_globals[kCurrentYear] == 1993) {
+ if (_globals[kDoneBrieConv203])
+ _vm->_dialogs->show(11340);
+ else
+ _vm->_dialogs->show(11310);
+ } else {
+ _vm->_dialogs->show(11311);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(11312);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RUG)) {
+ _vm->_dialogs->show(11313);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(11314);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COUCH)) {
+ _vm->_dialogs->show(11315);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MURAL)) {
+ _vm->_dialogs->show(11316);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PAINTING)) {
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->show(11317);
+ else
+ _vm->_dialogs->show(11343);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PAINTING)) {
+ _vm->_dialogs->show(11317);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DRESSING_TABLE)) {
+ _vm->_dialogs->show(11318);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHAIR)) {
+ _vm->_dialogs->show(11319);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MIRROR)) {
+ if (_globals[kCurrentYear] == 1993) {
+ _vm->_dialogs->show(11344);
+ } else {
+ _vm->_dialogs->show(11320);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FAN)) {
+ _vm->_dialogs->show(11321);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_VASE)) {
+ _vm->_dialogs->show(11322);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HAT_RACK)) {
+ _vm->_dialogs->show(11323);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT_FIXTURE)) {
+ _vm->_dialogs->show(11324);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(11325);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WARDROBE)) {
+ _vm->_dialogs->show(11326);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DRESSING_SCREEN)) {
+ _vm->_dialogs->show(11327);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CORRIDOR)) {
+ _vm->_dialogs->show(11328);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DRESSING_GOWN)) {
+ _vm->_dialogs->show(11330);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SMALL_NOTE) && _game._objects.isInRoom(OBJ_SMALL_NOTE)) {
+ _vm->_dialogs->show(11349);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHRISTINE) && _globals[kDoneBrieConv203]) {
+ _vm->_dialogs->show(11338);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_JULIE)) {
+ _vm->_dialogs->show(11339);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_NOTICE)) {
+ _vm->_dialogs->show(11347);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CLOTHES_DUMMY)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11345);
+ else
+ _vm->_dialogs->show(11346);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WOMAN) || _action.isObject(NOUN_CHRISTINE)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11341);
+ else {
+ if (_musicPlaying)
+ _vm->_dialogs->show(11336);
+ else
+ _vm->_dialogs->show(11342);
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_WARDROBE)) {
+ _vm->_dialogs->show(11329);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_SMALL_NOTE) && _game._objects.isInRoom(OBJ_SMALL_NOTE)) {
+ _vm->_dialogs->show(11334);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_DRESSING_GOWN)) {
+ _vm->_dialogs->show(11335);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHRISTINE) || _action.isAction(VERB_TAKE, NOUN_WOMAN)) {
+ _vm->_dialogs->show(11337);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene113::preActions() {
+ if (_action.isAction(VERB_WALK_UP, NOUN_AISLE))
+ _game._player._walkOffScreenSceneId = 101;
+
+ if (_action.isAction(VERB_LOOK, NOUN_MIRROR))
+ _game._player.walk(Common::Point(272, 138), FACING_EAST);
+
+ if (! _action.isAction(VERB_EXIT_TO, NOUN_CORRIDOR) && !_globals[kChrisKickedRaoulOut]
+ && !_action.isAction(VERB_LOOK, NOUN_CHRISTINE) && !_action.isAction(VERB_TAKE, NOUN_CHRISTINE) && _musicPlaying) {
+ _vm->_gameConv->run(13);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _game._player.cancelCommand();
+ } else if (_action.isAction(VERB_TALK_TO, NOUN_WOMAN) || _action.isAction(VERB_TALK_TO, NOUN_CHRISTINE)) {
+ _game._player.walk(Common::Point(106, 127), FACING_SOUTHWEST);
+ }
+
+ if (!_action.isAction(VERB_EXIT_TO, NOUN_CORRIDOR) && !_action.isAction(VERB_LOOK, NOUN_JULIE)
+ && !_action.isAction(VERB_LOOK, NOUN_CHRISTINE) && !_action._lookFlag && (_globals[kDoneBrieConv203] != 0)
+ && (_globals[kCurrentYear] == 1993)) {
+ if (_action.isAction(VERB_TALK_TO, NOUN_CHRISTINE)) {
+ _game._player._needToWalk = false;
+
+ } else if (_action.isAction(VERB_LOOK)) {
+ _game._player._needToWalk = false;
+
+ } else if (_action.isAction(VERB_TALK_TO, NOUN_JULIE)) {
+ _game._player._needToWalk = false;
+ _vm->_gameConv->run(6);
+ _game._player.cancelCommand();
+
+ } else {
+ _vm->_dialogs->show(11350);
+ _game._player._needToWalk = false;
+ _game._player.cancelCommand();
+ }
+ }
+}
+
+void Scene113::handleFlorentAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame() == _florentFrame)
+ return;
+
+ int random;
+ _florentFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_florentFrame) {
+ case 1:
+ case 11:
+ case 23:
+ case 38:
+ case 45:
+ random = _vm->getRandomNumber(4, 30);
+
+ if (_florentStatus == 2) {
+ random = 1;
+ }
+
+ if (_florentStatus == 0) {
+ random = 2;
+ }
+
+ if (_florentStatus == 3) {
+ random = 3;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 2;
+ _florentStatus = 1;
+ break;
+
+ case 2:
+ resetFrame = 28;
+ break;
+
+ case 3:
+ resetFrame = 39;
+ break;
+
+ case 4:
+ resetFrame = 12;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ case 33:
+ random = _vm->getRandomNumber(5, 20);
+
+ if (_florentStatus == 0) {
+ random = _vm->getRandomNumber(1, 4);
+ ++_florentCount;
+ if (_florentCount > 5) {
+ _florentStatus = 1;
+ random = 5;
+ }
+ }
+
+ if ((_florentStatus == 2) ||
+ (_florentStatus == 3)) {
+ random = 5;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 23;
+ break;
+
+ case 2:
+ resetFrame = 24;
+ break;
+
+ case 3:
+ resetFrame = 25;
+ break;
+
+ case 4:
+ resetFrame = 26;
+ break;
+
+ case 5:
+ resetFrame = 34;
+ break;
+
+ default:
+ resetFrame = 32;
+ break;
+ }
+ break;
+
+ case 42:
+ if (_florentStatus == 3)
+ resetFrame = 41;
+
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], resetFrame);
+ _florentFrame = resetFrame;
+ }
+}
+
+void Scene113::handleDayAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _dayFrame)
+ return;
+
+ _dayFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int random;
+ int resetFrame = -1;
+ switch (_dayFrame) {
+ case 1:
+ case 4:
+ case 14:
+ case 17:
+ case 20:
+ case 26:
+ case 166:
+ case 206:
+ case 207:
+ case 208:
+ case 209:
+ case 210:
+ case 211:
+ case 219:
+ case 231:
+ case 253:
+ switch (_dayStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 3);
+ ++_dayCount;
+ if (_dayCount < 6) {
+ if (random == 1) {
+ resetFrame = 1;
+ } else if (random == 2) {
+ resetFrame = 15;
+ } else {
+ resetFrame = 18;
+ }
+ } else {
+ _dayStatus = 1;
+ resetFrame = 25;
+ _dayWantsToTalk = false;
+ }
+ break;
+
+ case 1:
+ if (_dayWantsToTalk) {
+ _dayStatus = 0;
+ _dayWantsToTalk = false;
+ resetFrame = 1;
+ } else {
+ resetFrame = 25;
+ }
+ break;
+
+ case 2:
+ random = _vm->getRandomNumber(1, 50);
+ switch (random) {
+ case 1:
+ resetFrame = 212;
+ break;
+
+ case 2:
+ resetFrame = 219;
+ break;
+
+ case 3:
+ resetFrame = 231;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 3:
+ resetFrame = 5;
+ _dayStatus = 0;
+ break;
+
+ case 4:
+ resetFrame = 31;
+ break;
+
+ case 5:
+ resetFrame = _vm->getRandomNumber(205, 207);
+ ++_standCount;
+ if (_standCount > 18) {
+ _dayStatus = 7;
+ resetFrame = 165;
+ }
+ if (_musicPlaying)
+ resetFrame = 167;
+ break;
+
+ case 6:
+ resetFrame = _vm->getRandomNumber(208, 210);
+ while (_lastDayResetFrame == resetFrame)
+ resetFrame = _vm->getRandomNumber(208, 210);
+
+ _lastDayResetFrame = resetFrame;
+
+ ++_standCount;
+ if (_standCount > 18) {
+ _dayStatus = 7;
+ resetFrame = 165;
+ }
+
+ if (_musicPlaying)
+ resetFrame = 167;
+ break;
+
+ case 7:
+ resetFrame = 165;
+ if (_musicPlaying)
+ resetFrame = 167;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 182:
+ _game._player._visible = true;
+ _vm->_gameConv->release();
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ _game._player._playerPos = Common::Point(175, 148);
+ _game._player._turnToFacing = FACING_NORTHEAST;
+ _game._player.resetFacing(FACING_SOUTHEAST);
+ _game._player._turnToFacing = FACING_NORTHEAST;
+ break;
+
+ case 205:
+ case 212:
+ resetFrame = 211;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _dayFrame = resetFrame;
+ }
+}
+
+void Scene113::handleRaoulAnimation() {
+ if (_globals[kFlorentNameIsKnown] == 2)
+ _raoulAction = 3;
+
+ if (_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == _raoulFrame)
+ return;
+
+ _raoulFrame = _scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_raoulFrame) {
+ case 9:
+ case 10:
+ case 11:
+ case 34:
+ case 33:
+ if (_raoulFrame == 33)
+ _vm->_gameConv->release();
+
+ switch (_raoulAction) {
+ case 0:
+ resetFrame = _vm->getRandomNumber(7, 9);
+ ++_raoulCount;
+
+ if (_raoulCount > 17) {
+ _raoulAction = 1;
+ resetFrame = 8;
+ }
+ break;
+
+ case 1:
+ resetFrame = 8;
+ break;
+
+ case 2:
+ resetFrame = 11;
+ break;
+
+ case 3:
+ resetFrame = 33;
+ break;
+
+ case 4:
+ resetFrame = 38;
+ _raoulStandingFl = true;
+ _vm->_gameConv->hold();
+ break;
+
+ case 5:
+ resetFrame = 20;
+ _raoulAction = 1;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 19:
+ if ((_raoulAction == 5) && (!_game._objects.isInInventory(OBJ_SMALL_NOTE))) {
+ resetFrame = 20;
+ _raoulAction = 1;
+ } else if (_raoulAction == 4) {
+ resetFrame = 38;
+ _raoulStandingFl = true;
+ } else if (_raoulAction == 0) {
+ resetFrame = 9;
+ } else {
+ resetFrame = 8;
+ _raoulAction = 1;
+ }
+ break;
+
+ case 42:
+ if (_raoulAction == 4) {
+ if (!_prevent2) {
+ _vm->_gameConv->release();
+ }
+ resetFrame = 33;
+ _raoulAction = 3;
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[3]);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+void Scene113::handleRaoulAnimation2() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _raoulFrame)
+ return;
+
+ _raoulFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+ switch (_raoulFrame) {
+ case 9:
+ case 10:
+ case 11:
+ case 34:
+ switch (_raoulAction) {
+ case 0:
+ resetFrame = _vm->getRandomNumber(7, 9);
+ ++_raoulCount;
+
+ if (_raoulCount > 17) {
+ _raoulAction = 1;
+ resetFrame = 8;
+ }
+ break;
+
+ case 1:
+ resetFrame = 8;
+ break;
+
+ case 2:
+ resetFrame = 11;
+ break;
+
+ case 3:
+ resetFrame = 33;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 19:
+ if (_raoulAction == 0)
+ resetFrame = 9;
+ else {
+ resetFrame = 8;
+ _raoulAction = 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+void Scene113::handleJulieAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[4]]->getCurrentFrame() == _julieFrame)
+ return;
+
+ _julieFrame = _scene->_animation[_globals._animationIndexes[4]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random;
+
+ switch (_julieFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 11:
+ case 16:
+ case 17:
+ switch (_julieStatus) {
+ case 0:
+ random = _vm->getRandomNumber(4, 20);
+ break;
+
+ case 1:
+ random = _vm->getRandomNumber(1, 3);
+ ++_julieCount;
+ if (_julieCount > 20) {
+ _julieStatus = 0;
+ random = 6;
+ }
+ break;
+
+ default:
+ random = -1;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 0;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ resetFrame = 2;
+ break;
+
+ case 4:
+ resetFrame = 12;
+ break;
+
+ case 5:
+ resetFrame = 4;
+ break;
+
+ default:
+ resetFrame = 16;
+ break;
+ }
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[4], resetFrame);
+ _julieFrame = resetFrame;
+ }
+}
+
+void Scene113::handleDeadConversation() {
+ switch (_game._trigger) {
+ case 106:
+ _julieStatus = 1;
+ break;
+
+ case 104:
+ _julieStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ _vm->_gameConv->setInterlocutorTrigger(106);
+ _vm->_gameConv->setHeroTrigger(104);
+
+ _julieCount = 0;
+}
+
+void Scene113::handleFlorentConversation() {
+ int random;
+
+ switch (_action._activeAction._verbId) {
+ case 3:
+ case 4:
+ if (!_prevent1) {
+ _globals[kFlorentNameIsKnown] = 1;
+ _vm->_gameConv->setInterlocutorTrigger(82);
+ _scene->_dynamicHotspots.remove(_christineHotspotId2);
+ _christineHotspotId2 = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(43, 118, 43 + 15, 118 + 29));
+ _scene->_dynamicHotspots[_christineHotspotId2]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(_christineHotspotId2, Common::Point(106, 127), FACING_SOUTHWEST);
+ _prevent1 = true;
+ }
+ break;
+
+ case 19:
+ _florentStatus = 2;
+ _vm->_gameConv->setInterlocutorTrigger(86);
+ break;
+
+ case 25:
+ if (_raoulAction != 3)
+ _raoulAction = 4;
+ break;
+
+ case 26:
+ if (!_prevent2) {
+ _scene->_sequences.addTimer(120, 92);
+ _vm->_gameConv->setInterlocutorTrigger(96);
+ _florentStatus = 0;
+ _prevent2 = true;
+ }
+ break;
+
+ case 27:
+ case 30:
+ _vm->_gameConv->setInterlocutorTrigger(98);
+ break;
+
+ case 28:
+ case 29:
+ _vm->_gameConv->setInterlocutorTrigger(100);
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 62:
+ if ((_action._activeAction._verbId != 3) && (_action._activeAction._verbId != 4) && (_action._activeAction._verbId != 19) &&
+ (_action._activeAction._verbId != 27) && (_action._activeAction._verbId != 28) && (_action._activeAction._verbId != 29)) {
+ if ((_raoulAction != 5) && (_raoulAction != 4) && !_raoulStandingFl)
+ _raoulAction = 0;
+
+ if ((_florentStatus != 3) && (_florentStatus != 2))
+ _florentStatus = 1;
+ }
+ break;
+
+ case 66:
+ if ((_florentStatus != 3) &&
+ (_florentStatus != 2)) {
+ random = _vm->getRandomNumber(1,5);
+ if (random == 1)
+ _florentStatus = 0;
+ }
+
+ if ((_raoulAction != 3) && (_raoulAction != 5) && (_raoulAction != 4) && (!_raoulStandingFl)) {
+ _raoulAction = 1;
+ random = _vm->getRandomNumber(1, 2);
+ if (random == 1)
+ _raoulAction = 2;
+ }
+ break;
+
+ case 80:
+ _vm->_gameConv->release();
+ _game._player._visible = false;
+ _raoulAction = 1;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[3], SYNC_PLAYER, 0);
+ _scene->setAnimFrame(_globals._animationIndexes[3], 1);
+ break;
+
+ case 82:
+ _florentStatus = 0;
+ _scene->_sequences.addTimer(120, 84);
+ _vm->_gameConv->hold();
+ break;
+
+ case 84:
+ _game._player.walk(Common::Point(201, 120), FACING_SOUTH);
+ _game._player.setWalkTrigger(80);
+ break;
+
+ case 86:
+ _raoulAction = 5;
+ _vm->_gameConv->hold();
+ break;
+
+ case 92:
+ _game._player.walk(Common::Point(68, 142), FACING_SOUTHWEST);
+ _game._player.setWalkTrigger(94);
+ break;
+
+ case 94:
+ _globals[kStopWalkerDisabled] = true;
+ _globals[kFlorentNameIsKnown] = 2;
+ _vm->_gameConv->release();
+ break;
+
+ case 96:
+ _vm->_gameConv->hold();
+ break;
+
+ case 98:
+ _florentStatus = 3;
+ break;
+
+ case 100:
+ _florentStatus = 1;
+ _globals[kStopWalkerDisabled] = false;
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_action._activeAction._verbId != 3) && (_action._activeAction._verbId != 4) && (_action._activeAction._verbId != 19) &&
+ (_action._activeAction._verbId != 28) && (_action._activeAction._verbId != 29) && (_action._activeAction._verbId != 27) &&
+ (_action._activeAction._verbId != 30) && (_action._activeAction._verbId != 26))
+ _vm->_gameConv->setInterlocutorTrigger(66);
+
+ _vm->_gameConv->setHeroTrigger(62);
+ _raoulCount = 0;
+ _florentCount = 0;
+}
+
+void Scene113::handleLoveConversation() {
+ int random;
+
+ switch (_action._activeAction._verbId) {
+ case 1:
+ case 2:
+ if (!_prevent1) {
+ _vm->_gameConv->setInterlocutorTrigger(82);
+ _prevent1 = true;
+ }
+ break;
+
+ case 21:
+ if (!_armsOutFl) {
+ _dayStatus = 4;
+ _scene->_sequences.addTimer(1, 70);
+ _scene->_userInterface.emptyConversationList();
+ _scene->_userInterface.setup(kInputConversation);
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+ _vm->_gameConv->hold();
+ }
+ break;
+
+ case 27:
+ _vm->_sound->command(34);
+ _globals[kLeaveAngelMusicOn] = true;
+ break;
+
+ case 31:
+ if (!_musicPlaying) {
+ _vm->_gameConv->hold();
+ _dayStatus = 7;
+ _musicPlaying = true;
+ _christineHotspotId1 = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[_christineHotspotId1]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 14);
+ _scene->setDynamicAnim(_christineHotspotId1, _globals._animationIndexes[0], 16);
+ }
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 62:
+ if (_action._activeAction._verbId != 0) {
+ if (_standingAndTalking) {
+ _dayStatus = 6;
+ } else if (_dayStatus != 4) {
+ _dayStatus = 1;
+ _raoulAction = 0;
+ _dayWantsToTalk = false;
+ }
+ }
+ break;
+
+ case 66:
+ if (_standingAndTalking) {
+ _dayStatus = 5;
+
+ } else {
+ if (_action._activeAction._verbId == 19) {
+ _dayStatus = 3;
+ } else {
+ _dayStatus = 1;
+ _dayWantsToTalk = true;
+ }
+
+ if (_raoulAction != 3) {
+ _raoulAction = 1;
+ random = _vm->getRandomNumber(1, 2);
+ if (random == 1) {
+ _raoulAction = 2;
+ }
+ }
+ }
+ break;
+
+ case 70:
+ if (_armsOutFl) {
+ _vm->_gameConv->release();
+ _vm->_gameConv->setInterlocutorTrigger(76);
+ }
+ break;
+
+ case 72:
+ if (_afterKissFl)
+ _vm->_gameConv->release();
+ else
+ _scene->_sequences.addTimer(1, 72);
+ break;
+
+ case 76:
+ _vm->_gameConv->hold();
+ _scene->_sequences.addTimer(1, 72);
+ break;
+
+ case 78:
+ if (_armsOutFl) {
+ _vm->_gameConv->release();
+ _vm->_gameConv->setInterlocutorTrigger(76);
+ }
+ break;
+
+ case 80:
+ _vm->_gameConv->release();
+ _game._player._visible = false;
+ _raoulAction = 1;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[1], SYNC_PLAYER, 0);
+ _scene->setAnimFrame(_globals._animationIndexes[1], 1);
+ break;
+
+ case 82:
+ _scene->_sequences.addTimer(120, 84);
+ _vm->_gameConv->hold();
+ _dayStatus = 1;
+ _dayWantsToTalk = true;
+ break;
+
+ case 84:
+ _game._player.walk(Common::Point(201, 120), FACING_SOUTH);
+ _game._player.setWalkTrigger(80);
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_action._activeAction._verbId != 21) && (_action._activeAction._verbId != 1) && (_action._activeAction._verbId != 2))
+ _vm->_gameConv->setInterlocutorTrigger(66);
+
+ _vm->_gameConv->setHeroTrigger(62);
+
+ _raoulCount = 0;
+ _dayCount = 0;
+ _standCount = 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene114::Scene114(MADSEngine *vm) : Scene1xx(vm) {
+}
+
+void Scene114::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+}
+
+void Scene114::setup() {
+ if (_globals[kCurrentYear] == 1993)
+ _scene->_variant = 1;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene114::enter() {
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ } else if (_game._objects.isInRoom(OBJ_ROPE) && !_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK)) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RDR_9");
+ }
+
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0));
+
+ if ((_game._objects.isInRoom(OBJ_ROPE)) && (_globals[kCurrentYear] == 1881) && !_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK)) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2);
+ } else
+ _scene->_hotspots.activate(NOUN_ROPE, false);
+
+ if (_globals[kCurrentYear] == 1993) {
+ _scene->_hotspots.activate(NOUN_CYLINDER, false);
+ _scene->_hotspots.activate(NOUN_MANNEQUINS, false);
+ _scene->_hotspots.activate(NOUN_PROP, false);
+ _scene->_hotspots.activate(NOUN_BUST, false);
+ _scene->_hotspots.activate(NOUN_SCAFFOLDING, false);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ } else {
+ _scene->_hotspots.activate(NOUN_BOXES, false);
+ _scene->_hotspots.activate(NOUN_DINETTE_SET, false);
+ _scene->_hotspots.activate(NOUN_CRATE, false);
+ _scene->_hotspots.activate(NOUN_CASES, false);
+ }
+
+ if ((_scene->_priorSceneId == 105) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(218, 123);
+ _game._player._facing = FACING_WEST;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene114::step() {
+}
+
+void Scene114::actions() {
+ if (_action.isAction(VERB_CLIMB_UP, NOUN_CIRCULAR_STAIRCASE)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 1), 1);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 1:
+ _scene->_nextSceneId = 105;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_UP, NOUN_CIRCULAR_STAIRCASE)) {
+ _scene->_nextSceneId = 105;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_ROPE) && (_game._objects.isInRoom(OBJ_ROPE) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 6, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 3);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 3, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_hotspots.activate(NOUN_ROPE, false);
+ _game._objects.addToInventory(OBJ_ROPE);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ _vm->_dialogs->showItem(OBJ_ROPE, 807, 0);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(11410);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(11411);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CIRCULAR_STAIRCASE)) {
+ _vm->_dialogs->show(11412);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ROPE) && _game._objects.isInRoom(OBJ_ROPE)) {
+ _vm->_dialogs->show(11413);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(11414);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MANNEQUINS)) {
+ _vm->_dialogs->show(11415);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLAT)) {
+ _vm->_dialogs->show(11416);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SCAFFOLDING)) {
+ _vm->_dialogs->show(11417);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MUMMY_PROP)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11418);
+ else
+ _vm->_dialogs->show(11433);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CRATES)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11419);
+ else
+ _vm->_dialogs->show(11434);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CRATE)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11420);
+ else
+ _vm->_dialogs->show(11435);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CARTONS)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11421);
+ else
+ _vm->_dialogs->show(11436);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CARTON)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11422);
+ else
+ _vm->_dialogs->show(11437);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROP)) {
+ _vm->_dialogs->show(11423);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BUST)) {
+ _vm->_dialogs->show(11424);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MUG)) {
+ _vm->_dialogs->show(11425);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isObject(NOUN_CASES)) || (_action.isObject(NOUN_CASE))) {
+ _vm->_dialogs->show(11426);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOXES) || _action.isObject(NOUN_BOX)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11427);
+ else
+ _vm->_dialogs->show(11439);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOX)) {
+ if (_globals[kCurrentYear] == 1881) {
+ _vm->_dialogs->show(11439);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isObject(NOUN_DINETTE_SET)) {
+ _vm->_dialogs->show(11428);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CYLINDER)) {
+ _vm->_dialogs->show(11429);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CARTONS)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11421);
+ else
+ _vm->_dialogs->show(11436);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CARTON)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11422);
+ else
+ _vm->_dialogs->show(11437);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CRATES)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11419);
+ else
+ _vm->_dialogs->show(11434);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CRATE)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11419);
+ else
+ _vm->_dialogs->show(11435);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_CASES)) {
+ _vm->_dialogs->show(11426);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_BOXES) || _action.isAction(VERB_OPEN, NOUN_BOX)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(11427);
+ else
+ _vm->_dialogs->show(11439);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_MUG)) {
+ _vm->_dialogs->show(11430);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_MUMMY_PROP)) {
+ _vm->_dialogs->show(11431);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_MUMMY_PROP)) {
+ _vm->_dialogs->show(11432);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene114::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene150::Scene150(MADSEngine *vm) : Scene1xx(vm) {
+}
+
+void Scene150::synchronize(Common::Serializer &s) {
+ Scene1xx::synchronize(s);
+}
+
+void Scene150::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene150::enter() {
+ warning("TODO: Switch to letter box view. See definition of MADS_MENU_Y");
+
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+
+ if (_scene->_priorSceneId == 113)
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 1);
+ else if (_scene->_priorSceneId == 203) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('f', 1), 2);
+ sceneEntrySound();
+ } else if (_scene->_priorSceneId == 306)
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('e', 1), 4);
+ else if (_scene->_priorSceneId == 208)
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('h', 1), 3);
+ else
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('q', 1), 5);
+}
+
+void Scene150::step() {
+ if (_game._trigger == 1)
+ _scene->_nextSceneId = 203;
+
+ if (_game._trigger == 2)
+ _scene->_nextSceneId = 111;
+
+ if (_game._trigger == 4)
+ _scene->_nextSceneId = 204;
+
+ if (_game._trigger == 3) {
+ _globals[kJacquesStatus] = 1;
+ _scene->_nextSceneId = 205;
+ }
+
+ if (_game._trigger == 5)
+ _game._winStatus = 1;
+
+ if (_scene->_nextSceneId != _scene->_currentSceneId) {
+ byte pal[768];
+ _vm->_palette->getFullPalette(pal);
+ Common::fill(&pal[12], &pal[756], 0);
+ _vm->_palette->setFullPalette(pal);
+ }
+}
+
+void Scene150::actions() {
+}
+
+void Scene150::preActions() {
+}
/*------------------------------------------------------------------------*/
diff --git a/engines/mads/phantom/phantom_scenes1.h b/engines/mads/phantom/phantom_scenes1.h
index 0f5f56a4cf..d1be6e027e 100644
--- a/engines/mads/phantom/phantom_scenes1.h
+++ b/engines/mads/phantom/phantom_scenes1.h
@@ -55,8 +55,20 @@ public:
class Scene101 : public Scene1xx {
private:
- // TODO
-
+ int _chanStatus;
+ int _wipeStatus;
+ int _callingStatus;
+ int _chandelierStatus;
+ int _callingFrame;
+ int _chandelierFrame;
+ int _talkCounter;
+ int _convCounter;
+ int _brieAnimId;
+ bool _startWalkingFl;
+ bool _startWalking0Fl;
+ bool _anim0Running;
+ bool _anim1Running;
+ bool _startSittingFl;
public:
Scene101(MADSEngine *vm);
virtual void synchronize(Common::Serializer &s);
@@ -66,11 +78,16 @@ public:
virtual void step();
virtual void preActions();
virtual void actions();
+
+ void handleConversation0();
+ void handleConversation1();
+ void handleAnimation0();
+ void handleAnimation1();
};
class Scene102 : public Scene1xx {
private:
- bool _animRunningFl;
+ bool _anim0Running;
public:
Scene102(MADSEngine *vm);
@@ -83,6 +100,320 @@ public:
virtual void actions();
};
+class Scene103 : public Scene1xx {
+private:
+ int _jacquesAction;
+ int _lastRandom;
+ int _standPosition;
+ int _hotspotPrompt1;
+ int _hotspotPrompt2;
+ int _hotspotPrompt3;
+ int _hotspotPrompt4;
+ int _hotspotPrompt5;
+ int _hotspotRightFloor1;
+ int _hotspotRightFloor2;
+ int _hotspotLeftFloor1;
+ int _hotspotLeftFloor2;
+ int _hotspotGentleman;
+ int _convCount;
+ int _lastStairFrame;
+ int _lastJacquesFrame;
+ int _talkCount;
+
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ bool _anim4ActvFl;
+ bool _anim5ActvFl;
+ bool _anim6ActvFl;
+ bool _climbThroughTrapFl;
+ bool _guardFrameFl;
+ bool _sitFl;
+
+ void adjustRails(int variant);
+ void handleJacquesAnim();
+ void climbRightStairs();
+ void climbLeftStairs();
+ void descendRightStairs();
+ void descendLeftStairs();
+ void process_conv_jacques();
+
+public:
+ Scene103(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene104 : public Scene1xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _needToGetUp;
+ bool _needToStandUp;
+ bool _needToTalk;
+ bool _sittingUp;
+ bool _beforeSheLeaves;
+ bool _beforeHeLeaves;
+
+ int _walkStatus;
+ int _walkFrame;
+ int _coupleStatus;
+ int _coupleFrame;
+ int _richStatus;
+ int _richFrame;
+ int _manTalkCount;
+ int _womanTalkCount;
+ int _lookCount;
+ int _richTalkCount;
+ int _lastPlayerFrame;
+
+ void cleanInventory();
+ void processConversations();
+ void handleWalkAnimation();
+ void handleCoupleAnimations();
+ void handleRichAnimations();
+ void handlePlayerWalk();
+
+public:
+ Scene104(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene105 : public Scene1xx {
+public:
+ Scene105(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene106 : public Scene1xx {
+private:
+ int _sandbagHostpotId;
+public:
+ Scene106(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene107 : public Scene1xx {
+public:
+ Scene107(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene108 : public Scene1xx {
+private:
+ bool _anim0ActvFl;
+ bool _handRaisedFl;
+ int _shutUpCount;
+ int _maxTalkCount;
+ int _charAction;
+ int _charFrame;
+ int _charTalkCount;
+ int _charHotspotId;
+ int _conversationCount;
+ int _prevShutUpFrame;
+
+ void handleCharAnimation();
+ void handleCharlesConversation();
+
+public:
+ Scene108(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene109 : public Scene1xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ int _currentFloor;
+public:
+ Scene109(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene110 : public Scene1xx {
+public:
+ Scene110(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene111 : public Scene1xx {
+private:
+ bool _removeAxe;
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _closedFl;
+ int _listenFrame;
+ int _listenStatus;
+
+ void handleListenAnimation();
+ void handleListenConversation();
+
+public:
+ Scene111(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene112 : public Scene1xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+
+ int _raoulAction;
+ int _raoulFrame;
+ int _didOptionFl;
+ int _julieFrame;
+ int _julieAction;
+ int _julieCounter;
+ int _julieHotspotId;
+
+ void handleConversation();
+ void handleJulieAnimation();
+ void handleRaoulChair();
+
+public:
+ Scene112(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene113 : public Scene1xx {
+private:
+ bool _standingAndTalking;
+ bool _dayWantsToTalk;
+ bool _musicPlaying;
+ bool _afterKissFl;
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ bool _anim4ActvFl;
+ bool _prevent1;
+ bool _prevent2;
+ bool _raoulStandingFl;
+ bool _armsOutFl;
+
+ int _christineHotspotId1;
+ int _christineHotspotId2;
+ int _dayStatus;
+ int _dayFrame;
+ int _dayCount;
+ int _florentStatus;
+ int _florentFrame;
+ int _florentCount;
+ int _julieStatus;
+ int _julieFrame;
+ int _julieCount;
+ int _raoulAction;
+ int _raoulFrame;
+ int _raoulCount;
+ int _lastDayResetFrame;
+ int _standCount;
+
+ void handleFlorentAnimation();
+ void handleDayAnimation();
+ void handleRaoulAnimation();
+ void handleRaoulAnimation2();
+ void handleJulieAnimation();
+ void handleDeadConversation();
+ void handleFlorentConversation();
+ void handleLoveConversation();
+
+public:
+ Scene113(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene114 : public Scene1xx {
+public:
+ Scene114(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene150 : public Scene1xx {
+public:
+ Scene150(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
} // End of namespace Phantom
} // End of namespace MADS
diff --git a/engines/mads/phantom/phantom_scenes2.cpp b/engines/mads/phantom/phantom_scenes2.cpp
new file mode 100644
index 0000000000..1590d06549
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes2.cpp
@@ -0,0 +1,7001 @@
+/* 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 "common/scummsys.h"
+#include "mads/mads.h"
+#include "mads/conversations.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+#include "mads/phantom/phantom_scenes2.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+void Scene2xx::setAAName() {
+ _game._aaName = Resources::formatAAName(_globals[kTempInterface]);
+ _vm->_palette->setEntry(254, 43, 47, 51);
+}
+
+void Scene2xx::sceneEntrySound() {
+ if (!_vm->_musicFlag)
+ return;
+
+ switch (_scene->_nextSceneId) {
+ case 206:
+ if (!_globals[kKnockedOverHead])
+ _vm->_sound->command(16);
+ break;
+
+ case 208:
+ _vm->_sound->command(34);
+ break;
+
+ default:
+ if (_scene->_nextSceneId != 250)
+ _vm->_sound->command(16);
+ break;
+ }
+}
+
+void Scene2xx::setPlayerSpritesPrefix() {
+ _vm->_sound->command(5);
+
+ if (_scene->_nextSceneId == 208)
+ _game._player._spritesPrefix = "";
+ else {
+ Common::String oldName = _game._player._spritesPrefix;
+ if (!_game._player._forcePrefix)
+ _game._player._spritesPrefix = "RAL";
+ if (oldName != _game._player._spritesPrefix)
+ _game._player._spritesChanged = true;
+ }
+
+ _game._player._scalingVelocity = true;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene201::Scene201(MADSEngine *vm) : Scene2xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _needHoldFl = false;
+ _sellerCount = -1;
+ _sellerStatus = -1;
+ _sellerFrame = -1;
+ _raoulFrame = -1;
+ _raoulStatus = -1;
+}
+
+void Scene201::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_needHoldFl);
+ s.syncAsSint16LE(_sellerCount);
+ s.syncAsSint16LE(_sellerStatus);
+ s.syncAsSint16LE(_sellerFrame);
+ s.syncAsSint16LE(_raoulFrame);
+ s.syncAsSint16LE(_raoulStatus);
+}
+
+void Scene201::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene201::enter() {
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ }
+
+ _sellerCount = 0;
+ _needHoldFl = false;
+
+ _vm->_gameConv->get(16);
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 0));
+
+ if (_globals[kTicketPeoplePresent]) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('s', 1), 0);
+ _anim1ActvFl = true;
+ _sellerStatus = 2;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 5);
+ } else {
+ _scene->_hotspots.activate(NOUN_TICKET_SELLER, false);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ }
+
+ if (_vm->_gameConv->_restoreRunning == 16) {
+ _game._player._playerPos = Common::Point(72, 101);
+ _game._player._facing = FACING_NORTHWEST;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ _anim0ActvFl = true;
+ _raoulStatus = 1;
+ _game._player._visible = false;
+
+ _vm->_gameConv->run(16);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportPointer(&_globals[kChristineToldEnvelope]);
+ }
+
+ if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(314, 86);
+ _game._player.walk(Common::Point(266, 98), FACING_SOUTHWEST);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene201::step() {
+ if (_anim0ActvFl)
+ handleRaoulAnimation();
+
+ if (_anim1ActvFl)
+ handleSellerAnimation();
+
+ if ((_needHoldFl) && (_vm->_gameConv->_running != 16)) {
+ _game._player._stepEnabled = false;
+ _needHoldFl = false;
+ }
+}
+
+void Scene201::actions() {
+ if (_vm->_gameConv->_running == 16) {
+ handleConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY)) {
+ _scene->_nextSceneId = 202;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_TICKET_SELLER)) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ _anim0ActvFl = true;
+ _raoulStatus = 1;
+ _vm->_gameConv->run(16);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportPointer(&_globals[kChristineToldEnvelope]);
+ _game._player._visible = false;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(20110);
+ else
+ _vm->_dialogs->show(20111);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(20112);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(20113);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BUST)) {
+ _vm->_dialogs->show(20114);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PEDESTAL)) {
+ _vm->_dialogs->show(20115);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BARRIER)) {
+ _vm->_dialogs->show(20116);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PLACARD)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(20117);
+ else
+ _vm->_dialogs->show(20118);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TICKET_WINDOW)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(20119);
+ else
+ _vm->_dialogs->show(20120);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(20121);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TICKET_SELLER)) {
+ _vm->_dialogs->show(20123);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_TICKET_SELLER)) {
+ _vm->_dialogs->show(20124);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_BUST)) {
+ _vm->_dialogs->show(20122);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene201::preActions() {
+ if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) && _action.isObject(NOUN_PLACARD))
+ _game._player.walk(Common::Point(147, 104), FACING_NORTHWEST);
+}
+
+void Scene201::handleRaoulAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _raoulFrame)
+ return;
+
+ _raoulFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int random = -1;
+ int resetFrame = -1;
+
+ switch (_raoulFrame) {
+ case 1:
+ case 19:
+ case 49:
+ random = _vm->getRandomNumber(4, 50);
+
+ switch (_raoulStatus) {
+ case 0:
+ random = 1;
+ break;
+
+ case 2:
+ random = 2;
+ _game._player._stepEnabled = false;
+ break;
+
+ case 3:
+ random = 3;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 9;
+ _raoulStatus = 1;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ _game._player._visible = true;
+ _sellerStatus = 2;
+ _anim0ActvFl = false;
+ resetFrame = 49;
+ _game._player._stepEnabled = true;
+ _needHoldFl = false;
+ break;
+
+ case 4:
+ resetFrame = 19;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+
+ }
+ break;
+
+ case 5:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _game._objects.addToInventory(OBJ_ENVELOPE);
+ _vm->_sound->command(26);
+ _vm->_dialogs->showItem(OBJ_ENVELOPE, 834, 0);
+ break;
+
+ case 9:
+ _game._player._visible = true;
+ _anim0ActvFl = false;
+ _game._player._stepEnabled = true;
+ resetFrame = 49;
+ break;
+
+ case 23:
+ case 35:
+ case 45:
+ random = _vm->getRandomNumber(3, 70);
+
+ switch (_raoulStatus) {
+ case 0:
+ random = 2;
+ break;
+
+ case 2:
+ case 3:
+ random = 1;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 45;
+ break;
+
+ case 2:
+ resetFrame = 23;
+ _raoulStatus = 1;
+ break;
+
+ case 3:
+ resetFrame = 35;
+ break;
+
+ default:
+ resetFrame = 22;
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+void Scene201::handleSellerAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _sellerFrame )
+ return;
+
+ int random = -1;
+ int resetFrame = -1;
+ _sellerFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+
+ switch (_sellerFrame ) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 10:
+ if (_sellerFrame == 10)
+ _raoulStatus = 2;
+
+ switch (_sellerStatus) {
+ case 0:
+ random = 1;
+ break;
+
+ case 1:
+ random = _vm->getRandomNumber(1, 5);
+ ++_sellerCount;
+ if (_sellerCount > 30) {
+ _sellerStatus = 0;
+ random = 6;
+ }
+ break;
+
+ case 2:
+ if (_sellerFrame == 6)
+ random = 6;
+ else if (_sellerFrame == 7)
+ random = 7;
+ else
+ random = _vm->getRandomNumber(6, 7);
+
+ ++_sellerCount;
+ if (_sellerCount > 30) {
+ _sellerCount = 0;
+ random = _vm->getRandomNumber(6, 7);
+ }
+ break;
+
+ case 3:
+ random = 8;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 0;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ resetFrame = 2;
+ break;
+
+ case 4:
+ resetFrame = 3;
+ break;
+
+ case 5:
+ resetFrame = 4;
+ break;
+
+ case 6:
+ resetFrame = 5;
+ break;
+
+ case 7:
+ resetFrame = 6;
+ break;
+
+ case 8:
+ resetFrame = 7;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 9:
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ _sellerStatus = 2;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _sellerFrame = resetFrame;
+ }
+}
+
+void Scene201::handleConversation() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 4:
+ case 12:
+ case 13:
+ case 14:
+ _vm->_gameConv->setInterlocutorTrigger(90);
+ _needHoldFl = true;
+ interlocutorFl = true;
+ break;
+
+ case 6:
+ _sellerStatus = 3;
+ _needHoldFl = true;
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 65:
+ if (_sellerStatus != 3)
+ _sellerStatus = 1;
+ break;
+
+ case 70:
+ if (_sellerStatus != 3) {
+ _sellerStatus = 0;
+ _raoulStatus = 0;
+ }
+ break;
+
+ case 90:
+ _vm->_gameConv->setHeroTrigger(91);
+ heroFl = true;
+ break;
+
+ case 91:
+ _raoulStatus = 3;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(70);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(65);
+
+ _sellerCount = 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene202::Scene202(MADSEngine *vm) : Scene2xx(vm) {
+ _ticketGivenFl = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _skipWalkFl = false;
+
+ for (int i = 0; i < 5; i++) {
+ _chandeliersPosX[i] = -1;
+ _chandeliersHotspotId[i] = -1;
+ }
+
+ _conversationCount = -1;
+ _usherStatus = -1;
+ _usherFrame = -1;
+ _usherCount = -1;
+ _degasStatus = -1;
+ _degasFrame = -1;
+}
+
+void Scene202::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_ticketGivenFl);
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_skipWalkFl);
+
+ for (int i = 0; i < 5; i++) {
+ s.syncAsSint16LE(_chandeliersPosX[i]);
+ s.syncAsSint16LE(_chandeliersHotspotId[i]);
+ }
+
+ s.syncAsSint16LE(_conversationCount);
+ s.syncAsSint16LE(_usherStatus);
+ s.syncAsSint16LE(_usherFrame);
+ s.syncAsSint16LE(_usherCount);
+ s.syncAsSint16LE(_degasStatus);
+ s.syncAsSint16LE(_degasFrame);
+}
+
+void Scene202::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kTicketPeoplePresent] == 2)
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_CHANDELIER);
+ _scene->addActiveVocab(NOUN_EDGAR_DEGAS);
+}
+
+void Scene202::enter() {
+ _vm->_disableFastwalk = true;
+ _ticketGivenFl = false;
+ _chandeliersPosX[0] = 77;
+ _chandeliersPosX[1] = 192;
+ _chandeliersPosX[2] = 319;
+ _chandeliersPosX[3] = 445;
+ _chandeliersPosX[4] = 560;
+
+ if (_globals[kTicketPeoplePresent] == 2)
+ _globals[kMakeRichLeave203] = true;
+
+ if ((_globals[kDegasNameIsKnown]) || (_globals[kCurrentYear] == 1993))
+ _scene->_hotspots.activate(NOUN_GENTLEMAN, false);
+
+ for (int i = 0; i < 5; i++) {
+ _globals._sequenceIndexes[2 + i] = -1;
+ _chandeliersHotspotId[i] = -1;
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _skipWalkFl = false;
+ }
+
+ _conversationCount = 0;
+ _vm->_gameConv->get(17);
+ _vm->_gameConv->get(9);
+
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RDR_9");
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0));
+
+ if (_globals[kTicketPeoplePresent] == 2) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 0), 0);
+ _anim0ActvFl = true;
+ _usherStatus = 2;
+ } else
+ _scene->_hotspots.activate(NOUN_USHER, false);
+
+ if (_globals[kDegasNameIsKnown])
+ _anim1ActvFl = false;
+
+ if ((_globals[kCurrentYear] == 1881) && (!_globals[kDegasNameIsKnown])) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('d', 1), 100);
+ _anim1ActvFl = true;
+ _degasStatus = 4;
+ }
+
+ if (_vm->_gameConv->_restoreRunning == 17) {
+ _vm->_gameConv->run(17);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(0);
+ _game._player._playerPos = Common::Point(569, 147);
+ _game._player._facing = FACING_NORTHEAST;
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ if (_vm->_gameConv->_restoreRunning == 9) {
+ _vm->_gameConv->run(9);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _game._player._playerPos = Common::Point(400, 141);
+ _game._player._facing = FACING_NORTHWEST;
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ if (_scene->_priorSceneId == 201) {
+ _game._player._playerPos = Common::Point(3, 141);
+ _game._player.walk(Common::Point(40, 141), FACING_EAST);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else if (_scene->_priorSceneId == 203) {
+ _game._player._playerPos = Common::Point(134, 112);
+ _game._player._facing = FACING_SOUTH;
+ _game._player._stepEnabled = false;
+ _game._player.walk(Common::Point(126, 123), FACING_SOUTH);
+ _game._player.setWalkTrigger(60);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else if (_scene->_priorSceneId == 204) {
+ _game._player._playerPos = Common::Point(253, 117);
+ _game._player.walk(Common::Point(255, 133), FACING_SOUTH);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->setCamera(Common::Point(70, 0));
+ } else if (_scene->_priorSceneId == 205) {
+ _game._player._playerPos = Common::Point(510, 117);
+ _game._player.walk(Common::Point(512, 133), FACING_SOUTH);
+ _scene->setCamera(Common::Point(320, 0));
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else if ((_scene->_priorSceneId == 101) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(636, 143);
+ _game._player.walk(Common::Point(598, 143), FACING_WEST);
+ _scene->setCamera(Common::Point(320, 0));
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ }
+
+ handleChandeliersPositions();
+ sceneEntrySound();
+}
+
+void Scene202::step() {
+ if (_game._camX._currentFrameFl)
+ handleChandeliersPositions();
+
+ if (_anim0ActvFl)
+ handleUsherAnimation();
+
+ if (_game._trigger == 100)
+ _anim1ActvFl = false;
+
+ if (_anim1ActvFl)
+ handleDegasAnimation();
+
+ if ((_globals[kCurrentYear] == 1881) && !_globals[kDegasNameIsKnown] && (_game._player._playerPos.x < 405) && !_skipWalkFl) {
+ _game._player.walk(Common::Point(400, 141), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(90);
+ _game._player._stepEnabled = false;
+ _skipWalkFl = true;
+ }
+
+ if (_game._trigger == 90) {
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(9);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ switch (_game._trigger) {
+ case 60:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ break;
+
+ case 61:
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_globals[kWalkerConverse] == 2) || (_globals[kWalkerConverse] == 3)) {
+ ++_conversationCount;
+ if (_conversationCount > 200)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+}
+
+void Scene202::actions() {
+ if (_vm->_gameConv->_running == 17) {
+ handleConversation1();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 9) {
+ handleConversation2();
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_globals[kTicketPeoplePresent] == 2) && (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_ARCHWAY) || _action.isAction(VERB_TALK_TO, NOUN_USHER))) {
+ _vm->_gameConv->run(17);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(0);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_GIVE, NOUN_TICKET, NOUN_USHER)) {
+ _ticketGivenFl = true;
+ _vm->_gameConv->run(17);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(1);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_GENTLEMAN) || _action.isAction(VERB_TALK_TO, NOUN_EDGAR_DEGAS)) {
+ if (!_globals[kDegasNameIsKnown] ) {
+ _vm->_gameConv->run(9);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ } else
+ _vm->_dialogs->show(20224);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_DOOR) || _action.isAction(VERB_OPEN, NOUN_LEFT_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 4, 80);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 82);
+ break;
+
+ case 80:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 81);
+ _vm->_sound->command(24);
+ break;
+
+ case 81: {
+ int idx = _globals._sequenceIndexes[0];
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[0], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _game._player.walk(Common::Point(134, 112), FACING_NORTH);
+ _game._player.setWalkTrigger(83);
+ }
+ break;
+
+ case 82:
+ _game._player._visible = true;
+ break;
+
+ case 83:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 84);
+ _vm->_sound->command(25);
+ break;
+
+ case 84:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1);
+ _scene->_nextSceneId = 203;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_ARCHWAY)) {
+ _scene->_nextSceneId = 201;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_ARCHWAY)) {
+ _scene->_nextSceneId = 101;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_MIDDLE_DOOR)) {
+ _scene->_nextSceneId = 204;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR)) {
+ _scene->_nextSceneId = 205;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(20210);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(20211);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(20212);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEFT_ARCHWAY)) {
+ _vm->_dialogs->show(20213);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RIGHT_ARCHWAY)) {
+ _vm->_dialogs->show(20214);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEFT_DOOR)) {
+ _vm->_dialogs->show(20215);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MIDDLE_DOOR)) {
+ _vm->_dialogs->show(20216);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RIGHT_DOOR)) {
+ _vm->_dialogs->show(20217);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT_FIXTURE)) {
+ _vm->_dialogs->show(20218);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_OVERDOOR_MEDALLION)) {
+ _vm->_dialogs->show(20219);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DECORATIVE_MOLDING)) {
+ _vm->_dialogs->show(20220);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PAINTING)) {
+ _vm->_dialogs->show(20221);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EDGAR_DEGAS) || _action.isObject(NOUN_GENTLEMAN)) {
+ _vm->_dialogs->show(20223);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_USHER)) {
+ _vm->_dialogs->show(20225);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHANDELIER)) {
+ _vm->_dialogs->show(20218);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE) && (_action.isObject(NOUN_GENTLEMAN) || _action.isObject(NOUN_EDGAR_DEGAS))) {
+ _vm->_dialogs->show(20226);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_USHER)) {
+ _vm->_dialogs->show(20227);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_DOOR)) {
+ _vm->_dialogs->show(20222);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene202::preActions() {
+ if (_action.isAction(VERB_OPEN, NOUN_LEFT_DOOR))
+ _game._player.walk(Common::Point(126, 123), FACING_NORTHEAST);
+
+ if ((_globals[kTicketPeoplePresent] == 2) && _action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_ARCHWAY))
+ _game._player.walk(Common::Point(569, 147), FACING_NORTHEAST);
+
+ if (_action.isAction(VERB_TAKE, NOUN_GENTLEMAN) || _action.isAction(VERB_TAKE, NOUN_EDGAR_DEGAS))
+ _game._player._needToWalk = false;
+}
+
+void Scene202::handleConversation1() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 0:
+ if (!_ticketGivenFl)
+ _usherStatus = 4;
+
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 3:
+ _vm->_gameConv->setInterlocutorTrigger(72);
+ _vm->_gameConv->setHeroTrigger(76);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 4:
+ _vm->_gameConv->setHeroTrigger(76);
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 70:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _usherStatus = 0;
+ break;
+
+ case 72:
+ _usherStatus = 17;
+ break;
+
+ case 74:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+ _usherStatus = 2;
+ _conversationCount = 0;
+ break;
+
+ case 76:
+ _globals[kWalkerConverse] = 0;
+ _ticketGivenFl = false;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(74);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(70);
+
+ _usherCount = 0;
+}
+
+void Scene202::handleConversation2() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 1:
+ _globals[kDegasNameIsKnown] = 1;
+ break;
+
+ case 10:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _vm->_gameConv->setHeroTrigger(96);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 74:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+ _degasStatus = 4;
+ _conversationCount = 0;
+ break;
+
+ case 93:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ switch (_action._activeAction._verbId) {
+ case 1:
+ _degasStatus = 1;
+ break;
+
+ case 2:
+ _degasStatus = 2;
+ break;
+
+ default:
+ if ((_action._activeAction._verbId != 11) && (_action._activeAction._verbId != 12))
+ _degasStatus = 0;
+ break;
+ }
+ break;
+
+ case 96:
+ _vm->_gameConv->setInterlocutorTrigger(97);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 97:
+ _vm->_gameConv->setHeroTrigger(98);
+ _degasStatus = 0;
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 98:
+ _globals[kWalkerConverse] = 0;
+ _degasStatus = 3;
+
+ if (_globals[kDegasNameIsKnown] == 1) {
+ int idx = _scene->_dynamicHotspots.add(NOUN_EDGAR_DEGAS, VERB_WALK_TO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(596, 144), FACING_EAST);
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[1], 1);
+ } else {
+ int idx = _scene->_dynamicHotspots.add(NOUN_GENTLEMAN, VERB_WALK_TO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(596, 144), FACING_EAST);
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[1], 1);
+ }
+
+ _globals[kDegasNameIsKnown] = 2;
+ interlocutorFl = true;
+ heroFl = true;
+ _scene->_hotspots.activate(NOUN_GENTLEMAN, false);
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->hold();
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(74);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(93);
+}
+
+void Scene202::handleChandeliersPositions() {
+ int center = _scene->_posAdjust.x + 160;
+
+ for (int chandelier = 0; chandelier < 5; chandelier++) {
+ if (_globals._sequenceIndexes[chandelier + 2] >= 0)
+ _scene->deleteSequence(_globals._sequenceIndexes[chandelier + 2]);
+
+ int diff = center - _chandeliersPosX[chandelier];
+ int dir = 0;
+
+ if (diff < 0)
+ dir = 1;
+ else if (diff > 0)
+ dir = -1;
+
+ int shiftBase = (int)(abs(diff) / 5);
+ if (dir < 0)
+ shiftBase = -shiftBase;
+
+ int posX = _chandeliersPosX[chandelier] + shiftBase - 1;
+ int posY = _scene->_sprites[_globals._spriteIndexes[2]]->getFrameHeight(0) - 1;
+ int frameWidth = _scene->_sprites[_globals._spriteIndexes[2]]->getFrameWidth(0);
+
+ if (((posX - ((frameWidth >> 1) + 1)) >= (_scene->_posAdjust.x + 320)) || ((posX + ((frameWidth >> 1) + 1)) < _scene->_posAdjust.x))
+ _globals._sequenceIndexes[chandelier + 2] = -1;
+ else {
+ if (_chandeliersHotspotId[chandelier] != -1)
+ _scene->_dynamicHotspots.remove(_chandeliersHotspotId[chandelier]);
+
+ _chandeliersHotspotId[chandelier] = _scene->_dynamicHotspots.add(NOUN_CHANDELIER, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(posX - 8, posY - 12, posX + 8, posY + 1));
+
+ _globals._sequenceIndexes[chandelier + 2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[chandelier + 2], Common::Point(posX, posY));
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[chandelier + 2], 1);
+ }
+ }
+}
+
+void Scene202::handleUsherAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _usherFrame)
+ return;
+
+ _usherFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random;
+ switch (_usherFrame) {
+ case 1:
+ case 13:
+ case 35:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ switch (_usherStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 3);
+ ++_usherCount;
+ if (_usherCount > 15) {
+ if (_action._activeAction._verbId == 0) {
+ _usherStatus = 3;
+ random = 5;
+ } else {
+ _usherStatus = 2;
+ random = 7;
+ }
+ }
+ break;
+
+ case 3:
+ random = 5;
+ break;
+
+ case 4:
+ random = 6;
+ break;
+
+ case 17:
+ random = 4;
+ break;
+
+ default:
+ random = 7;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 51;
+ break;
+
+ case 2:
+ resetFrame = 52;
+ break;
+
+ case 3:
+ resetFrame = 53;
+ break;
+
+ case 4:
+ resetFrame = 21;
+ _usherStatus = 17;
+ break;
+
+ case 5:
+ resetFrame = 1;
+ break;
+
+ case 6:
+ resetFrame = 35;
+ _usherStatus = 0;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 7:
+ if (_usherStatus == 3)
+ random = 1;
+ else
+ random = 2;
+
+ if (random == 1)
+ resetFrame = 6;
+ else
+ resetFrame = 7;
+
+ break;
+
+ case 28:
+ if (_usherStatus == 17) {
+ random = 1;
+ ++_usherCount;
+ if (_usherCount > 15) {
+ _usherStatus = 2;
+ random = 2;
+ }
+ } else
+ random = 2;
+
+ if (random == 1)
+ resetFrame = 27;
+ else
+ resetFrame = 28;
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _usherFrame = resetFrame;
+ }
+}
+
+void Scene202::handleDegasAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _degasFrame)
+ return;
+
+ _degasFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random;
+
+ switch (_degasFrame) {
+ case 1:
+ case 17:
+ case 58:
+ switch (_degasStatus) {
+ case 0:
+ _degasStatus = 4;
+ random = 1;
+ break;
+
+ case 1:
+ case 2:
+ case 3:
+ random = 2;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(3, 50);
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 1;
+ break;
+
+ case 2:
+ resetFrame = 58;
+ break;
+
+ case 3:
+ resetFrame = 58;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 33:
+ case 40:
+ case 55:
+ case 62:
+ switch (_degasStatus) {
+ case 0:
+ _degasStatus = 4;
+ random = 1;
+ break;
+
+ case 1:
+ _degasStatus = 4;
+ random = 2;
+ break;
+
+ case 2:
+ _degasStatus = 4;
+ random = 3;
+ break;
+
+ case 3:
+ random = 4;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(5, 50);
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 33;
+ break;
+
+ case 2:
+ resetFrame = 17;
+ break;
+
+ case 3:
+ resetFrame = 42;
+ break;
+
+ case 4:
+ resetFrame = 62;
+ break;
+
+ case 5:
+ resetFrame = 41;
+ break;
+
+ case 6:
+ resetFrame = 55;
+ break;
+
+ default:
+ resetFrame = 39;
+ break;
+ }
+ break;
+
+ case 42:
+ switch (_degasStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 39;
+ else
+ resetFrame = 41;
+
+ break;
+
+ case 110:
+ _vm->_gameConv->release();
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _degasFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene203::Scene203(MADSEngine *vm) : Scene2xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _showNoteFl = false;
+
+ _brieStatus = -1;
+ _brieFrame = -1;
+ _brieCount = -1;
+ _raoulStatus = -1;
+ _raoulFrame = -1;
+ _raoulCount = -1;
+ _richardStatus = -1;
+ _richardFrame = -1;
+ _daaeStatus = -1;
+ _daaeFrame = -1;
+ _conversationCount = -1;
+}
+
+void Scene203::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+ s.syncAsByte(_showNoteFl);
+
+ s.syncAsSint16LE(_brieStatus);
+ s.syncAsSint16LE(_brieFrame);
+ s.syncAsSint16LE(_brieCount);
+ s.syncAsSint16LE(_raoulStatus);
+ s.syncAsSint16LE(_raoulFrame);
+ s.syncAsSint16LE(_raoulCount);
+ s.syncAsSint16LE(_richardStatus);
+ s.syncAsSint16LE(_richardFrame);
+ s.syncAsSint16LE(_daaeStatus);
+ s.syncAsSint16LE(_daaeFrame);
+ s.syncAsSint16LE(_conversationCount);
+}
+
+void Scene203::setup() {
+ if (_globals[kCurrentYear] == 1993)
+ _scene->_variant = 1;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene203::enter() {
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _showNoteFl = false;
+ }
+
+ _conversationCount = 0;
+ _scene->_hotspots.activate(NOUN_LETTER, false);
+ _scene->_hotspots.activate(NOUN_PARCHMENT, false);
+ _scene->_hotspots.activate(NOUN_NOTICE, false);
+
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RDR_6");
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _vm->_gameConv->get(5);
+ } else {
+ _vm->_gameConv->get(8);
+ _vm->_gameConv->get(15);
+ }
+
+ if (_globals[kCurrentYear] == 1993) {
+ if (_game._objects.isInRoom(OBJ_PARCHMENT)) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 3);
+ _scene->_hotspots.activate(NOUN_PARCHMENT, true);
+ }
+
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, false);
+ _scene->_hotspots.activate(NOUN_MANAGERS_CHAIR, false);
+
+ if (!_globals[kMakeBrieLeave203]) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 9), 1);
+ _anim0ActvFl = true;
+ _brieStatus = 4;
+ } else {
+ _scene->_hotspots.activate(NOUN_MONSIEUR_BRIE, false);
+ _scene->_hotspots.activate(NOUN_MANAGERS_CHAIR, true);
+ }
+
+ if ((_scene->_priorSceneId == RETURNING_FROM_LOADING) && (_vm->_gameConv->_restoreRunning == 5)) {
+ _brieStatus = 4;
+ _raoulStatus = 0;
+ _anim1ActvFl = true;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('c', 1), 0);
+ _scene->setAnimFrame(_globals._animationIndexes[1], 9);
+ _vm->_gameConv->run(5);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_SMALL_NOTE));
+ _vm->_gameConv->exportValue(_globals[kReadBook]);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_LARGE_NOTE));
+ _vm->_gameConv->exportValue(_globals[kLookedAtCase]);
+ _vm->_gameConv->exportValue(_globals[kCharlesNameIsKnown]);
+ _vm->_gameConv->exportValue(_globals[kCanFindBookInLibrary]);
+ _vm->_gameConv->exportValue(_globals[kFlorentNameIsKnown]);
+ _vm->_gameConv->exportValue(_globals[kSandbagStatus]);
+ _vm->_gameConv->exportValue(_globals[kObservedPhan104]);
+ }
+
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_CANDLE, false);
+ } else if (_globals[kJacquesStatus] == 0) {
+ _scene->_hotspots.activate(NOUN_DESK_LAMP, false);
+ _scene->_hotspots.activate(NOUN_MONSIEUR_BRIE, false);
+ _scene->_hotspots.activate(NOUN_MANAGERS_CHAIR, false);
+
+ if (!_globals[kMakeRichLeave203]) {
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('r', 1), 1);
+ _anim2ActvFl = true;
+ _richardStatus = 4;
+ } else {
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, false);
+ _scene->_hotspots.activate(NOUN_MANAGERS_CHAIR, true);
+ }
+
+ if ((_scene->_priorSceneId == RETURNING_FROM_LOADING) && (_vm->_gameConv->_restoreRunning == 8)) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('c', 1), 0);
+ _scene->setAnimFrame(_globals._animationIndexes[1], 9);
+ _anim1ActvFl = true;
+ _game._player._visible = false;
+ _raoulStatus = 0;
+ _vm->_gameConv->run(8);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ }
+
+ if (_game._objects.isInRoom(OBJ_LETTER)) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3);
+ _scene->_hotspots.activate(NOUN_LETTER, true);
+ }
+
+ if (_game._objects.isInRoom(OBJ_NOTICE)) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 3);
+ _scene->_hotspots.activate(NOUN_NOTICE, true);
+ }
+ } else {
+ _scene->_hotspots.activate(NOUN_MONSIEUR_BRIE, false);
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, false);
+ _scene->_hotspots.activate(NOUN_DESK_LAMP, false);
+ }
+
+ if (_vm->_gameConv->_restoreRunning == 15) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ _game._player._playerPos = Common::Point(98, 137);
+ _game._player._facing = FACING_NORTHEAST;
+ _vm->_gameConv->run(15);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportPointer(&_globals[kChristineToldEnvelope]);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ } else if (_scene->_priorSceneId == 202) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ _game._player._playerPos = Common::Point(195, 147);
+ _game._player._facing = FACING_NORTH;
+ } else if (_scene->_priorSceneId == 150) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ _game._player._playerPos = Common::Point(98, 137);
+ _game._player._facing = FACING_NORTHEAST;
+ _vm->_gameConv->run(15);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportPointer(&_globals[kChristineToldEnvelope]);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ } else if ((_scene->_priorSceneId == 204) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _game._player._playerPos = Common::Point(319, 123);
+ _game._player._facing = FACING_SOUTHWEST;
+ _game._player.walk(Common::Point(276, 123), FACING_WEST);
+ _game._player.setWalkTrigger(95);
+ _game._player._stepEnabled = false;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene203::step() {
+ if (_anim0ActvFl)
+ handleBrieAnimation();
+
+ if (_anim1ActvFl)
+ handleRaoulAnimation();
+
+ if (_anim2ActvFl)
+ handleRichardAnimation();
+
+ if (_anim3ActvFl)
+ handleDaaeAnimation();
+
+ if ((_globals[kWalkerConverse] == 2) || (_globals[kWalkerConverse] == 3)) {
+ ++_conversationCount;
+ if (_conversationCount > 200)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ switch (_game._trigger) {
+ case 95:
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[5], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 96);
+ break;
+
+ case 96:
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ if (_vm->_gameConv->_running != 15)
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene203::actions() {
+ if (_vm->_gameConv->_running == 5) {
+ handleBrieConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 8) {
+ handleRichardConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 15) {
+ handleRichardAndDaaeConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR) || _game._trigger) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[4] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[4], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[4], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 4, 90);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 92);
+ break;
+
+ case 90:
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 91);
+ break;
+
+ case 91:
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ break;
+
+ case 92:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[4]);
+ _game._player.walk(Common::Point(319, 123), FACING_WEST);
+ _game._player.setWalkTrigger(93);
+ break;
+
+ case 93:
+ _scene->_nextSceneId = 204;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_BRIE)) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('c', 1), 0);
+ _anim1ActvFl = true;
+ _game._player._visible = false;
+ _raoulStatus = 0;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[1], SYNC_PLAYER, 0);
+
+ _vm->_gameConv->run(5);
+ _vm->_gameConv->hold();
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_SMALL_NOTE));
+ _vm->_gameConv->exportValue(_globals[kReadBook]);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_LARGE_NOTE));
+ _vm->_gameConv->exportValue(_globals[kLookedAtCase]);
+ if (_globals[kCharlesNameIsKnown] == 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+
+ _vm->_gameConv->exportValue(_globals[kCanFindBookInLibrary]);
+ _vm->_gameConv->exportValue(_globals[kFlorentNameIsKnown]);
+ _vm->_gameConv->exportValue(_globals[kSandbagStatus]);
+ _vm->_gameConv->exportValue(_globals[kObservedPhan104]);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_RICHARD)) {
+ if (_globals[kCameFromFade]) {
+ _vm->_gameConv->run(15);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportPointer(&_globals[kChristineToldEnvelope]);
+ } else {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('c', 1), 0);
+ _anim1ActvFl = true;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _raoulStatus = 0;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[1], SYNC_PLAYER, 0);
+
+ _vm->_gameConv->run(8);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->hold();
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_GRAND_FOYER)) {
+ _scene->_nextSceneId = 202;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ if (_globals[kMakeBrieLeave203])
+ _vm->_dialogs->show(20337);
+ else
+ _vm->_dialogs->show(20310);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(20311);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(20312);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOOKCASE)) {
+ _vm->_dialogs->show(20313);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOORWAY)) {
+ _vm->_dialogs->show(20314);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COMFY_CHAIR)) {
+ _vm->_dialogs->show(20315);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DESK)) {
+ _vm->_dialogs->show(20316);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MANAGERS_CHAIR)) {
+ _vm->_dialogs->show(20317);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DESK_LAMP)) {
+ _vm->_dialogs->show(20318);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LAMP)) {
+ _vm->_dialogs->show(20319);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHT_FIXTURE)) {
+ _vm->_dialogs->show(20320);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WINDOW)) {
+ _vm->_dialogs->show(20321);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SHEERS)) {
+ _vm->_dialogs->show(20322);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TAPESTRY)) {
+ _vm->_dialogs->show(20323);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRAND_FOYER)) {
+ _vm->_dialogs->show(20324);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TABLE)) {
+ _vm->_dialogs->show(20325);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CANDLE)) {
+ _vm->_dialogs->show(20326);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MONSIEUR_BRIE)) {
+ _vm->_dialogs->show(20327);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MONSIEUR_RICHARD)) {
+ _vm->_dialogs->show(20328);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PARCHMENT) && _game._objects.isInRoom(OBJ_PARCHMENT)) {
+ _vm->_dialogs->show(20329);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LETTER) && _game._objects.isInRoom(OBJ_LETTER)) {
+ _vm->_dialogs->show(20331);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_NOTICE) && _game._objects.isInRoom(OBJ_NOTICE)) {
+ _vm->_dialogs->show(20333);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_PARCHMENT)) {
+ _vm->_dialogs->show(20330);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_LETTER)) {
+ _vm->_dialogs->show(20332);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_NOTICE)) {
+ _vm->_dialogs->show(20334);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_MONSIEUR_BRIE)) {
+ _vm->_dialogs->show(20335);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_MONSIEUR_RICHARD)) {
+ _vm->_dialogs->show(20336);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene203::preActions() {
+ if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_RICHARD)) {
+ if (_globals[kCameFromFade])
+ _game._player.walk(Common::Point(98, 137), FACING_NORTHEAST);
+ else
+ _game._player.walk(Common::Point(154, 131), FACING_NORTHWEST);
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_BRIE))
+ _game._player.walk(Common::Point(154, 131), FACING_NORTHWEST);
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR))
+ _game._player.walk(Common::Point(276, 123), FACING_EAST);
+}
+
+void Scene203::handleBrieConversation() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 9:
+ case 12:
+ case 35:
+ case 42:
+ _vm->_gameConv->setInterlocutorTrigger(70);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 14:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _raoulStatus = 5;
+ }
+ break;
+
+ case 17:
+ _raoulStatus = 0;
+ _vm->_gameConv->hold();
+ break;
+
+ case 24:
+ _vm->_gameConv->setInterlocutorTrigger(78);
+ interlocutorFl = true;
+ break;
+
+ case 20:
+ case 25:
+ _vm->_gameConv->setInterlocutorTrigger(76);
+ interlocutorFl = true;
+ break;
+
+ case 37:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(65);
+ else
+ _scene->playSpeech(1);
+
+ _scene->_sequences.addTimer(60, 110);
+ }
+ break;
+
+ case 41:
+ _globals[kDoneBrieConv203] = 1;
+ _globals[kChrisFStatus] = 0;
+ break;
+
+ case 44:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _raoulStatus = 3;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 60:
+ _brieStatus = 0;
+ break;
+
+ case 65:
+ _brieStatus = 4;
+ break;
+
+ case 70:
+ _vm->_gameConv->setHeroTrigger(71);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 71:
+ _raoulStatus = 2;
+ break;
+
+ case 74:
+ _vm->_gameConv->hold();
+ _raoulStatus = 3;
+ break;
+
+ case 76:
+ _brieStatus = 1;
+ break;
+
+ case 78:
+ _brieStatus = 2;
+ break;
+
+ case 110:
+ _vm->_gameConv->release();
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl && (_raoulStatus != 5))
+ _vm->_gameConv->setHeroTrigger(65);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(60);
+
+ _brieCount = 0;
+ _raoulCount = 0;
+}
+
+void Scene203::handleRichardConversation() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 4:
+ _vm->_gameConv->setInterlocutorTrigger(83);
+ interlocutorFl = true;
+ break;
+
+ case 5:
+ case 15:
+ case 20:
+ case 21:
+ case 27:
+ _vm->_gameConv->setInterlocutorTrigger(70);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 7:
+ if (_game._objects.isInRoom(OBJ_NOTICE) && !_game._trigger) {
+ _vm->_gameConv->hold();
+ _raoulStatus = 3;
+ }
+ break;
+
+ case 9:
+ if (_game._objects.isInRoom(OBJ_LETTER) && !_game._trigger) {
+ _vm->_gameConv->hold();
+ _raoulStatus = 4;
+ }
+ break;
+
+ case 17:
+ _vm->_gameConv->setInterlocutorTrigger(85);
+ interlocutorFl = true;
+ break;
+
+ case 19:
+ _vm->_gameConv->setInterlocutorTrigger(81);
+ interlocutorFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 65:
+ _richardStatus = 4;
+ break;
+
+ case 70:
+ _vm->_gameConv->setHeroTrigger(71);
+ interlocutorFl = true;
+ heroFl = true;
+ break;
+
+ case 71: {
+ _raoulStatus = 2;
+ int *val1 = _vm->_gameConv->getVariable(24);
+ int *val2 = _vm->_gameConv->getVariable(26);
+ if ((*val1) && (*val2)) {
+ _globals[kDoneRichConv203] = true;
+ _globals[kMadameGiryShowsUp] = true;
+ }
+ }
+ break;
+
+ case 74:
+ _vm->_gameConv->hold();
+ _raoulStatus = 3;
+ break;
+
+ case 81:
+ _richardStatus = 2;
+ break;
+
+ case 83:
+ _richardStatus = 1;
+ break;
+
+ case 85:
+ _richardStatus = 3;
+ break;
+
+ case 100:
+ _richardStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl && (_raoulStatus != 5))
+ _vm->_gameConv->setHeroTrigger(65);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(100);
+
+ _brieCount = 0;
+ _raoulCount = 0;
+}
+
+void Scene203::handleRichardAndDaaeConversation() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 5:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 90);
+ interlocutorFl = true;
+ heroFl = true;
+ }
+ break;
+
+ case 11:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _daaeStatus = 3;
+ }
+ break;
+
+ case 13:
+ case 14:
+ case 15:
+ _globals[kChristineDoorStatus] = 1;
+ _globals[kTicketPeoplePresent] = 2;
+ heroFl = true;
+ interlocutorFl = true;
+ _vm->_gameConv->setInterlocutorTrigger(115);
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 65:
+ if (_globals[kWalkerConverse] != 0)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+
+ if ((_richardStatus != 5) && (_richardStatus != 7))
+ _richardStatus = 4;
+
+ _conversationCount = 0;
+ break;
+
+ case 90:
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('d', 1), 0);
+ _anim3ActvFl = true;
+ _daaeStatus = 0;
+ break;
+
+ case 100:
+ if (_globals[kWalkerConverse] != 0)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+
+ if ((_action._activeAction._verbId == 7) || (_action._activeAction._verbId == 9))
+ _daaeStatus = 1;
+ else if (_richardStatus == 7)
+ _richardStatus = 5;
+ else if (_richardStatus != 5)
+ _richardStatus = 0;
+
+ break;
+
+ case 115:
+ _globals[kWalkerConverse] = 0;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(65);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(100);
+
+ _brieCount = 0;
+ _raoulCount = 0;
+}
+
+void Scene203::handleBrieAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _brieFrame)
+ return;
+
+ _brieFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random = -1;
+
+ switch (_brieFrame) {
+ case 1:
+ case 2:
+ case 4:
+ case 11:
+ case 22:
+ case 31:
+ case 35:
+ case 29:
+ random = _vm->getRandomNumber(6, 45);
+
+ switch (_brieStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 2);
+ ++_brieCount;
+ if (_brieCount > 20) {
+ _brieStatus = 4;
+ random = 45;
+ }
+ break;
+
+ case 1:
+ random = 5;
+ break;
+
+ case 2:
+ random = 4;
+ break;
+
+ case 3:
+ random = 3;
+ _brieStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 0;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ resetFrame = 2;
+ break;
+
+ case 4:
+ resetFrame = 22;
+ _brieStatus = 0;
+ break;
+
+ case 5:
+ resetFrame = 13;
+ break;
+
+ case 6:
+ resetFrame = 4;
+ break;
+
+ case 7:
+ resetFrame = 29;
+ break;
+
+ case 8:
+ resetFrame = 31;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 30:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_brieStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 30;
+ else
+ resetFrame = 29;
+
+ break;
+
+ case 8:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_brieStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ random = 3;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 11;
+ break;
+
+ case 2:
+ resetFrame = 12;
+ break;
+
+ case 3:
+ resetFrame = 8;
+ break;
+
+ default:
+ resetFrame = 7;
+ break;
+ }
+ break;
+
+ case 12:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_brieStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 7;
+ else
+ resetFrame = 11;
+
+ break;
+
+ case 13:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_brieStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 7;
+ else
+ resetFrame = 12;
+
+ break;
+
+ case 17:
+ case 18:
+ switch (_brieStatus) {
+ case 0:
+ case 2:
+ case 3:
+ random = 3;
+ break;
+ case 1:
+ random = _vm->getRandomNumber(1, 2);
+ ++_brieCount;
+ if (_brieCount > 20) {
+ _brieStatus = 4;
+ random = 3;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 16;
+ break;
+
+ case 2:
+ resetFrame = 17;
+ break;
+
+ case 3:
+ resetFrame = 18;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 33:
+ case 40:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_brieStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ random = 1;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 33;
+ break;
+
+ case 2:
+ resetFrame = 35;
+ break;
+
+ default:
+ resetFrame = 32;
+ break;
+ }
+ break;
+
+ case 38:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_brieStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 38;
+ else
+ resetFrame = 37;
+
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _brieFrame = resetFrame;
+ }
+}
+
+void Scene203::handleRichardAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame() == _richardFrame)
+ return;
+
+ _richardFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random = -1;
+
+ switch (_richardFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 7:
+ case 15:
+ case 25:
+ case 37:
+ case 53:
+ case 59:
+ case 63:
+ case 67:
+ case 69:
+ case 79:
+ case 87:
+ case 108:
+ random = _vm->getRandomNumber(8, 45);
+
+ switch (_richardStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 3);
+ ++_brieCount;
+ if (_brieCount > 20) {
+ _richardStatus = 4;
+ random = 45;
+ }
+ break;
+
+ case 1:
+ random = 4;
+ _richardStatus = 0;
+ break;
+
+ case 2:
+ random = 5;
+ _richardStatus = 0;
+ break;
+
+ case 3:
+ random = 6;
+ _richardStatus = 0;
+ break;
+
+ case 5:
+ random = 7;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 0;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ resetFrame = 2;
+ break;
+
+ case 4:
+ resetFrame = 69;
+ break;
+
+ case 5:
+ resetFrame = 53;
+ _richardStatus = 0;
+ break;
+
+ case 6:
+ resetFrame = 42;
+ break;
+
+ case 7:
+ resetFrame = 87;
+ break;
+
+ case 8:
+ resetFrame = 25;
+ break;
+
+ case 9:
+ resetFrame = 15;
+ break;
+
+ case 10:
+ resetFrame = 3;
+ break;
+
+ case 11:
+ resetFrame = 7;
+ break;
+
+ case 12:
+ resetFrame = 59;
+ break;
+
+ case 13:
+ resetFrame = 63;
+ break;
+
+ case 14:
+ resetFrame = 67;
+ break;
+
+ case 15:
+ resetFrame = 79;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 5:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 5;
+ else
+ resetFrame = 4;
+
+ break;
+
+ case 11:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 11;
+ else
+ resetFrame = 10;
+
+ break;
+
+ case 61:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 61;
+ else
+ resetFrame = 60;
+
+ break;
+
+ case 65:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 65;
+ else
+ resetFrame = 64;
+
+ break;
+
+ case 68:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 68;
+ else
+ resetFrame = 67;
+
+ break;
+
+ case 83:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 83;
+ else
+ resetFrame = 82;
+
+ break;
+
+ case 92:
+ _vm->_gameConv->release();
+ break;
+
+ case 93:
+ case 94:
+ case 95:
+ if (_richardStatus == 5) {
+ random = _vm->getRandomNumber(1, 3);
+ ++_brieCount;
+ if (_brieCount > 20) {
+ _richardStatus = 7;
+ random = 4;
+ }
+ } else
+ random = 4;
+
+ switch (random) {
+ case 1:
+ resetFrame = 92;
+ break;
+
+ case 2:
+ resetFrame = 93;
+ break;
+
+ case 3:
+ resetFrame = 94;
+ break;
+
+ case 4:
+ resetFrame = 95;
+ break;
+ }
+ break;
+
+ case 100:
+ case 101:
+ case 102:
+ switch (_richardStatus) {
+ case 5:
+ random = _vm->getRandomNumber(1, 3);
+ ++_brieCount;
+ if (_brieCount > 20) {
+ _richardStatus = 7;
+ random = 1;
+ }
+ break;
+
+ case 7:
+ random = 1;
+ break;
+
+ default:
+ random = 4;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 99;
+ break;
+
+ case 2:
+ resetFrame = 100;
+ break;
+
+ case 3:
+ resetFrame = 101;
+ break;
+
+ case 4:
+ resetFrame = 102;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 31:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_richardStatus) {
+ case 0 :
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ random = 1;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 31;
+ else
+ resetFrame = 30;
+
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], resetFrame);
+ _richardFrame = resetFrame;
+ }
+}
+
+void Scene203::handleRaoulAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _raoulFrame)
+ return;
+
+ _raoulFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random = -1;
+
+ switch (_raoulFrame) {
+ case 9:
+ case 21:
+ case 57:
+ _vm->_gameConv->release();
+ break;
+
+ case 10:
+ case 22:
+ case 30:
+ case 34:
+ case 58:
+ if (_raoulFrame == 22)
+ _raoulStatus = 0;
+
+ random = _vm->getRandomNumber(5, 45);
+
+ switch (_raoulStatus) {
+ case 1:
+ random = 1;
+ break;
+
+ case 2:
+ _game._player._stepEnabled = false;
+ random = 2;
+ break;
+
+ case 3:
+ case 5:
+ random = 3;
+ break;
+
+ case 4:
+ random = 4;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(5, 100);
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 22;
+ break;
+
+ case 2:
+ resetFrame = 34;
+ break;
+
+ case 3:
+ resetFrame = 10;
+ break;
+
+ case 4:
+ resetFrame = 45;
+ break;
+
+ case 5:
+ resetFrame = 30;
+ break;
+
+ default:
+ resetFrame = 9;
+ break;
+ }
+ break;
+
+ case 16:
+ switch (_raoulStatus) {
+ case 3:
+ random = 1;
+ break;
+
+ case 0:
+ case 2:
+ random = 2;
+ break;
+
+ case 5:
+ random = 3;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ if (_globals[kCurrentYear] == 1881) {
+ resetFrame = 16;
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _scene->_hotspots.activate(NOUN_NOTICE, false);
+ _game._objects.addToInventory(OBJ_NOTICE);
+ _vm->_sound->command(26);
+ _scene->_speechReady = -1;
+ _vm->_dialogs->showItem(OBJ_NOTICE, 814, 5);
+ _raoulStatus = 0;
+ } else {
+ resetFrame = 16;
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _scene->_hotspots.activate(NOUN_PARCHMENT, false);
+ _game._objects.addToInventory(OBJ_PARCHMENT);
+ _vm->_sound->command(26);
+ _scene->_speechReady = -1;
+ _vm->_dialogs->showItem(OBJ_PARCHMENT, 812, 3);
+ _raoulStatus = 0;
+ }
+ break;
+
+ case 2:
+ if (_showNoteFl) {
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _showNoteFl = false;
+ }
+ break;
+
+ default:
+ if (!_showNoteFl) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], true, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3);
+ _vm->_gameConv->release();
+ _showNoteFl = true;
+ }
+ resetFrame = 15;
+ break;
+ }
+ break;
+
+ case 26:
+ random = _vm->getRandomNumber(1, 45);
+
+ switch (_raoulStatus) {
+ case 0:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ random = 1;
+ break;
+
+ case 1:
+ random = 2;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 26;
+ else
+ resetFrame = 25;
+
+ break;
+
+ case 45:
+ _anim1ActvFl = false;
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ resetFrame = 58;
+ if (_globals[kDoneBrieConv203] && (_globals[kCurrentYear] == 1993)) {
+ _globals[kPrompterStandStatus] = 1;
+ _scene->_nextSceneId = 150;
+ }
+ break;
+
+ case 52:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _scene->_hotspots.activate(NOUN_LETTER, false);
+ _game._objects.addToInventory(OBJ_LETTER);
+ _vm->_sound->command(26);
+ _scene->_speechReady = -1;
+ _vm->_dialogs->showItem(OBJ_LETTER, 813, 4);
+ _raoulStatus = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+void Scene203::handleDaaeAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == _daaeFrame)
+ return;
+
+ _daaeFrame = _scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random = -1;
+
+ switch (_daaeFrame) {
+ case 20:
+ _vm->_gameConv->release();
+ _richardStatus = 5;
+ break;
+
+ case 175:
+ _richardStatus = 4;
+ break;
+
+ case 198:
+ _vm->_gameConv->release();
+ break;
+
+ case 201:
+ _scene->_sequences.addTimer(1, 95);
+ break;
+
+ case 76:
+ case 92:
+ case 102:
+ case 123:
+ switch (_daaeStatus) {
+ case 1:
+ random = _vm->getRandomNumber(1, 2);
+ _daaeStatus = 2;
+ break;
+
+ case 2:
+ random = 3;
+ _daaeStatus = 0;
+ break;
+
+ case 3:
+ random = 4;
+ break;
+
+ default:
+ random = 5;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 79;
+ break;
+
+ case 2:
+ resetFrame = 92;
+ break;
+
+ case 3:
+ resetFrame = 102;
+ break;
+
+ case 4:
+ resetFrame = 123;
+ break;
+
+ case 5:
+ resetFrame = 75;
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], resetFrame);
+ _daaeFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene204::Scene204(MADSEngine *vm) : Scene2xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _raoulDown = false;
+ _florentGone = false;
+ _skip1Fl = false;
+ _skip2Fl = false;
+ _skip3Fl = false;
+ _endGameFl = false;
+
+ _brieStatus = -1;
+ _brieFrame = -1;
+ _florStatus = -1;
+ _florFrame = -1;
+ _raoulStatus = -1;
+ _raoulFrame = -1;
+ _raoulCount = -1;
+}
+
+void Scene204::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+ s.syncAsByte(_raoulDown);
+ s.syncAsByte(_florentGone);
+ s.syncAsByte(_skip1Fl);
+ s.syncAsByte(_skip2Fl);
+ s.syncAsByte(_skip3Fl);
+ s.syncAsByte(_endGameFl);
+
+ s.syncAsSint16LE(_brieStatus);
+ s.syncAsSint16LE(_brieFrame);
+ s.syncAsSint16LE(_florStatus);
+ s.syncAsSint16LE(_florFrame);
+ s.syncAsSint16LE(_raoulStatus);
+ s.syncAsSint16LE(_raoulFrame);
+ s.syncAsSint16LE(_raoulCount);
+}
+
+void Scene204::setup() {
+ if ((_globals[kCurrentYear] == 1993) || _globals[kRightDoorIsOpen504])
+ _scene->_variant = 1;
+
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene204::enter() {
+ _skip3Fl = false;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _florentGone = false;
+ _skip1Fl = false;
+ _skip2Fl = false;
+ _endGameFl = false;
+ _raoulDown = true;
+ }
+
+ if (_globals[kTicketPeoplePresent] == 2)
+ _globals[kMakeRichLeave203] = true;
+
+ if (_globals[kRightDoorIsOpen504])
+ _endGameFl = true;
+
+ warning("TODO: If end of game, remove the walking areas");
+
+ _scene->_hotspots.activate(NOUN_BOOK, false);
+ _vm->_gameConv->get(22);
+
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 6));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RALRH_9");
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RDRR_6");
+
+ if (_game._objects.isInRoom(OBJ_BOOK) || (_globals[kCurrentYear] == 1881) || _endGameFl) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 5);
+ if (_globals[kScannedBookcase] && (_globals[kCurrentYear] == 1993))
+ _scene->_hotspots.activate(NOUN_BOOK, true);
+ }
+
+ if ((_globals[kCurrentYear] == 1993) || _endGameFl) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_sprites.remove(_globals._spriteIndexes[0]);
+ _scene->_hotspots.activate(NOUN_CANDLE, false);
+ _scene->_hotspots.activate(NOUN_BUST, false);
+ _scene->_hotspots.activate(NOUN_COFFEE_TABLE, false);
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_COFFEE_TABLE, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(83, 140, 83 + 45, 140 + 12));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(84, 150), FACING_SOUTHEAST);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_GRAND_FOYER, VERB_EXIT_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(199, 147, 199 + 52, 147 + 8));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(224, 152), FACING_SOUTH);
+ _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_GRAND_FOYER, VERB_EXIT_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(145, 147, 145 + 54, 147 + 8));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 152), FACING_SOUTH);
+ _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN);
+ } else {
+ _scene->_hotspots.activate(NOUN_LIGHT, false);
+ _scene->_hotspots.activate(NOUN_GLASS_CASE, false);
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_COMFY_CHAIR, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(220, 147, 220 + 6, 147 + 8));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(220, 150), FACING_SOUTHEAST);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_COMFY_CHAIR, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(226, 134, 226 + 12, 134 + 21));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(220, 150), FACING_SOUTHEAST);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_COMFY_CHAIR, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(238, 128, 238 + 13, 128 + 27));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(220, 150), FACING_SOUTHEAST);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_GRAND_FOYER, VERB_EXIT_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(199, 147, 199 + 19, 147 + 8));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(209, 152), FACING_SOUTH);
+ _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_GRAND_FOYER, VERB_EXIT_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(84, 147, 84 + 61, 147 + 8));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(115, 152), FACING_SOUTH);
+ _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN);
+ }
+
+ if ((_scene->_priorSceneId == 306) || (_endGameFl)) {
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _scene->drawToBackground(_globals._spriteIndexes[6], 1, Common::Point(-32000, -32000), 0, 100);
+ } else if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _scene->drawToBackground(_globals._spriteIndexes[1], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_sprites.remove(_globals._spriteIndexes[1]);
+ }
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (_endGameFl) {
+ _game.loadQuoteSet(0x75, 0);
+
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ _anim2ActvFl = true;
+
+ if (_florentGone) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], 9);
+ _raoulStatus = 1;
+ } else {
+ _scene->setAnimFrame(_globals._animationIndexes[2], 32);
+ _raoulStatus = 4;
+ }
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('m', 1), 0);
+ _anim0ActvFl = true;
+ _brieStatus = 2;
+
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('f', 1), 0);
+ _anim1ActvFl = true;
+ _florStatus = 2;
+
+ if (_florentGone)
+ _scene->setAnimFrame(_globals._animationIndexes[1], 172);
+ else if (!_raoulDown)
+ _scene->setAnimFrame(_globals._animationIndexes[1], 21);
+
+ _game._player._visible = false;
+ _vm->_gameConv->run(22);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ } else {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5);
+ }
+ } else if (_scene->_priorSceneId == 202) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5);
+ if (_globals[kCurrentYear] == 1993)
+ _game._player._playerPos = Common::Point(175, 145);
+ else
+ _game._player._playerPos = Common::Point(115, 147);
+
+ _game._player._facing = FACING_NORTHWEST;
+ } else if (_scene->_priorSceneId == 150) {
+ int size = _game._objects.size();
+ for (int i = 0; i < size; i++)
+ _game._objects.setRoom(i, 1);
+
+ _game.loadQuoteSet(0x75, 0);
+
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ _anim2ActvFl = true;
+ _raoulStatus = 4;
+ _scene->setAnimFrame(_globals._animationIndexes[2], 32);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('m', 1), 0);
+ _anim0ActvFl = true;
+ _brieStatus = 2;
+
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('f', 1), 0);
+ _anim1ActvFl = true;
+ _raoulDown = true;
+ _florStatus = 2;
+
+ _game._player._visible = false;
+ _endGameFl = true;
+
+ _vm->_gameConv->run(22);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ } else if ((_scene->_priorSceneId == 203) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player.firstWalk(Common::Point(-10, 136), FACING_EAST, Common::Point(30, 140), FACING_EAST, true);
+ _game._player.setWalkTrigger(70);
+ _game._player._stepEnabled = false;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene204::step() {
+ if (_anim0ActvFl)
+ handleBrieAnimation();
+
+ if (_anim1ActvFl)
+ handleFlorAnimation();
+
+ if (_anim2ActvFl)
+ handleRaoulAnimation();
+
+ if (_anim3ActvFl)
+ handleEndAnimation();
+
+ if (_game._trigger == 85)
+ _scene->_nextSceneId = 250;
+
+ if ((_vm->_gameConv->_running != 22) && !_skip1Fl && _endGameFl) {
+ _game._player._stepEnabled = false;
+ _skip1Fl = true;
+ }
+
+ if (_game._trigger == 70) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ } else if (_game._trigger == 71) {
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5);
+ _game._player._stepEnabled = true;
+ }
+}
+
+void Scene204::actions() {
+ if (_vm->_gameConv->_running == 22) {
+ handleConversation();
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[5], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 4, 60);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ break;
+
+ case 60:
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ break;
+
+ case 61:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[5]);
+ _game._player.walk(Common::Point(0, 136), FACING_WEST);
+ _game._player.setWalkTrigger(62);
+ break;
+
+ case 62:
+ _scene->_nextSceneId = 203;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_BOOK) && (_game._objects.isInRoom(OBJ_BOOK) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[4] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[4], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[4], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 8, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_hotspots.activate(NOUN_BOOK, false);
+ _game._objects.addToInventory(OBJ_BOOK);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[4]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ _vm->_dialogs->showItem(OBJ_BOOK, 815, 0);
+ _globals[kReadBook] = true;
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_GRAND_FOYER)) {
+ _scene->_nextSceneId = 202;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(20410);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(20411);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(20412);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RUG)) {
+ _vm->_dialogs->show(20413);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GLASS_CASE)) {
+ _vm->_dialogs->show(20414);
+ _globals[kLookedAtCase] = true;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ if (_globals[kSandbagStatus] == 0)
+ _vm->_dialogs->show(20429);
+ else
+ _vm->_dialogs->show(20416);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOOKCASE)) {
+ if (_globals[kCanFindBookInLibrary] && (_globals[kCurrentYear] == 1993)) {
+ if ((_scene->_customDest.x < 46) && !_game._objects.isInInventory(OBJ_BOOK)) {
+ if (!_globals[kScannedBookcase]) {
+ _vm->_dialogs->show(20433);
+ _scene->_hotspots.activate(NOUN_BOOK, true);
+ _globals[kScannedBookcase] = true;
+ } else {
+ _vm->_dialogs->show(20437);
+ }
+ } else {
+ _vm->_dialogs->show(20417);
+ }
+ } else {
+ _vm->_dialogs->show(20417);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SOFA)) {
+ _vm->_dialogs->show(20418);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_END_TABLE)) {
+ _vm->_dialogs->show(20419);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LAMP)) {
+ _vm->_dialogs->show(20420);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BUST)) {
+ _vm->_dialogs->show(20421);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COFFEE_TABLE)) {
+ _vm->_dialogs->show(20422);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COMFY_CHAIR)) {
+ _vm->_dialogs->show(20423);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DECORATIVE_VASE )) {
+ _vm->_dialogs->show(20424);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PAINTING)) {
+ _vm->_dialogs->show(20425);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRAND_FOYER)) {
+ _vm->_dialogs->show(20426);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(20427);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WINDOW)) {
+ _vm->_dialogs->show(20428);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOOK) && _game._objects.isInRoom(OBJ_BOOK)) {
+ _vm->_dialogs->show(20434);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_BUST)) {
+ _vm->_dialogs->show(20436);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene204::preActions() {
+ if (_action.isAction(VERB_LOOK, NOUN_BOOKCASE))
+ _game._player._needToWalk = true;
+
+ if (_action.isAction(VERB_LOOK, NOUN_BOOK) && _game._objects.isInRoom(OBJ_BOOK))
+ _game._player._needToWalk = true;
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR))
+ _game._player.walk(Common::Point(27, 139), FACING_WEST);
+}
+
+void Scene204::handleConversation() {
+ bool interlocutorFl = false;
+ bool heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 6:
+ case 7:
+ case 8:
+ if (_raoulDown) {
+ _vm->_gameConv->hold();
+ _raoulDown = false;
+ }
+ break;
+
+ case 17:
+ if (!_game._trigger) {
+ _florStatus = 3;
+ _florentGone = true;
+ interlocutorFl = true;
+ heroFl = true;
+ _vm->_gameConv->hold();
+ }
+ break;
+
+ case 25:
+ if (!_game._trigger) {
+ _raoulStatus = 5;
+ _florStatus = 5;
+ interlocutorFl = true;
+ heroFl = true;
+ _vm->_gameConv->hold();
+ }
+ break;
+
+ case 29:
+ interlocutorFl = true;
+ heroFl = true;
+ if (!_game._trigger) {
+ _brieStatus = 3;
+ _vm->_gameConv->hold();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 75:
+ if (_florentGone) {
+ if (_raoulStatus != 2)
+ _raoulStatus = 0;
+ } else
+ _florStatus = 4;
+
+ break;
+
+ case 80:
+ if (_florentGone) {
+ if ((_action._activeAction._verbId != 18) && (_action._activeAction._verbId != 23))
+ _brieStatus = 0;
+ } else {
+ switch (_action._activeAction._verbId) {
+ case 1:
+ case 7:
+ case 8:
+ case 9:
+ case 13:
+ case 15:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ _brieStatus = 0;
+ break;
+
+ default:
+ _florStatus = 0;
+ break;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl && !_raoulDown)
+ _vm->_gameConv->setHeroTrigger(75);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(80);
+
+ _raoulCount = 0;
+}
+
+void Scene204::handleBrieAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _brieFrame)
+ return;
+
+ _brieFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random;
+
+ switch (_brieFrame) {
+ case 80:
+ _vm->_gameConv->release();
+ _raoulStatus = 2;
+ break;
+
+ case 173:
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->show(20430);
+ _game._player._stepEnabled = false;
+ break;
+
+ case 174:
+ _raoulStatus = 3;
+ resetFrame = 173;
+ break;
+
+ case 1:
+ case 22:
+ case 49:
+ case 7:
+ case 13:
+ case 33:
+ case 61:
+ switch (_brieStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 4);
+ _brieStatus = 2;
+ break;
+
+ case 1:
+ random = 5;
+ break;
+
+ case 3:
+ random = 6;
+ break;
+
+ case 4:
+ random = 7;
+ break;
+
+ default:
+ random = 8;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 1;
+ _brieStatus = 2;
+ break;
+
+ case 2:
+ resetFrame = 7;
+ _brieStatus = 2;
+ break;
+
+ case 3:
+ resetFrame = 22;
+ _brieStatus = 2;
+ break;
+
+ case 4:
+ resetFrame = 49;
+ _brieStatus = 2;
+ break;
+
+ case 5:
+ resetFrame = 13;
+ _brieStatus = 2;
+ break;
+
+ case 6:
+ resetFrame = 61;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _brieFrame = resetFrame;
+ }
+}
+
+void Scene204::handleFlorAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _florFrame)
+ return;
+
+ _florFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random;
+
+ switch (_florFrame) {
+ case 80:
+ _scene->setAnimFrame(_globals._animationIndexes[2], 1);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[2], SYNC_ANIM, _globals._animationIndexes[1]);
+ _raoulStatus = 1;
+ break;
+
+ case 86:
+ _vm->_gameConv->release();
+ break;
+
+ case 173:
+ resetFrame = 172;
+ break;
+
+ case 1:
+ case 2:
+ case 3:
+ if (_raoulDown) {
+ random = _vm->getRandomNumber(1, 1000);
+ if (random < 300)
+ resetFrame = 0;
+ else if (random < 600)
+ resetFrame = 1;
+ else
+ resetFrame = 2;
+ }
+ break;
+
+ case 21:
+ case 180:
+ _vm->_gameConv->release();
+ break;
+
+ case 22:
+ case 50:
+ case 30:
+ case 174:
+ case 175:
+ case 176:
+ case 181:
+ switch (_florStatus) {
+ case 0:
+ random = 1;
+ _florStatus = 2;
+ break;
+
+ case 1:
+ random = 2;
+ _florStatus = 2;
+ break;
+
+ case 3:
+ random = 3;
+ break;
+
+ case 5:
+ random = 4;
+ _florStatus = 2;
+ break;
+
+ case 4:
+ random = _vm->getRandomNumber(5, 7);
+ ++_raoulCount;
+ if (_raoulCount > 17) {
+ _florStatus = 2;
+ random = 8;
+ }
+ break;
+
+ default:
+ random = 7;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 22;
+ break;
+
+ case 2:
+ resetFrame = 30;
+ break;
+
+ case 3:
+ resetFrame = 53;
+ break;
+
+ case 4:
+ resetFrame = 176;
+ break;
+
+ case 5:
+ resetFrame = 173;
+ break;
+
+ case 6:
+ resetFrame = 174;
+ break;
+
+ case 7:
+ resetFrame = 175;
+ break;
+
+ default:
+ resetFrame = 21;
+ break;
+ }
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _florFrame = resetFrame;
+ }
+}
+
+void Scene204::handleRaoulAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame() == _raoulFrame)
+ return;
+
+ _raoulFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ int resetFrame = -1;
+ int random;
+
+ switch (_raoulFrame) {
+ case 1:
+ if (_raoulStatus == 4)
+ resetFrame = 0;
+
+ break;
+
+ case 10:
+ case 14:
+ case 20:
+ case 258:
+ switch (_raoulStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 2);
+ _raoulStatus = 1;
+ break;
+
+ case 2:
+ random = 3;
+ break;
+
+ case 5:
+ random = 4;
+ break;
+
+ default:
+ random = 5;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 10;
+ _raoulStatus = 1;
+ break;
+
+ case 2:
+ resetFrame = 14;
+ _raoulStatus = 1;
+ break;
+
+ case 3:
+ resetFrame = 20;
+ break;
+
+ case 4:
+ resetFrame = 253;
+ _raoulStatus = 1;
+ break;
+
+ default:
+ resetFrame = 9;
+ break;
+ }
+ break;
+
+ case 31:
+ if (_raoulStatus == 3)
+ resetFrame = 33;
+ else
+ resetFrame = 30;
+
+ break;
+
+ case 33:
+ resetFrame = 32;
+ break;
+
+ case 114:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _game._objects.addToInventory(OBJ_BOOK);
+ break;
+
+ case 213:
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->showItem(OBJ_BOOK, 20431, 0);
+ _game._player._stepEnabled = false;
+ break;
+
+ case 229:
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->showItem(OBJ_BOOK, 20432, 0);
+ _game._player._stepEnabled = false;
+ break;
+
+ case 237:
+ _scene->freeAnimation(_globals._animationIndexes[1]);
+ _scene->freeAnimation(_globals._animationIndexes[0]);
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim3ActvFl = true;
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('e', 1), 0);
+ _scene->loadSpeech(9);
+ break;
+
+ case 253:
+ resetFrame = 244;
+ break;
+
+ case 257:
+ _vm->_gameConv->release();
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+void Scene204::handleEndAnimation() {
+ if ((_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == 15) && !_skip3Fl) {
+ _scene->playSpeech(9);
+ _skip3Fl = true;
+ }
+
+ if ((_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == 26) && !_skip2Fl) {
+ _scene->_sequences.addTimer(300, 85);
+ _scene->_kernelMessages.add(Common::Point(123, 137), 0x1110, 0, 0, 360, _game.getQuote(0x75));
+ _skip2Fl = true;
+ }
+
+ if (_scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame() == 27)
+ _scene->setAnimFrame(_globals._animationIndexes[3], 12);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene205::Scene205(MADSEngine *vm) : Scene2xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _noConversationHold = false;
+ _giveTicketFl = false;
+
+ _richardFrame = -1;
+ _richardStatus = -1;
+ _richardCount = -1;
+ _giryFrame = -1;
+ _giryStatus = -1;
+ _giryCount = -1;
+ _conversationCounter = -1;
+ _lastRandom = -1;
+}
+
+void Scene205::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_noConversationHold);
+ s.syncAsByte(_giveTicketFl);
+
+ s.syncAsSint16LE(_richardFrame);
+ s.syncAsSint16LE(_richardStatus);
+ s.syncAsSint16LE(_richardCount);
+ s.syncAsSint16LE(_giryFrame);
+ s.syncAsSint16LE(_giryStatus);
+ s.syncAsSint16LE(_giryCount);
+ s.syncAsSint16LE(_conversationCounter);
+ s.syncAsSint16LE(_lastRandom);
+}
+
+void Scene205::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kCurrentYear] != 1881)
+ return;
+
+ if (_globals[kJacquesStatus] == 1)
+ _scene->_variant = 3;
+ else if (_globals[kJacquesStatus] == 0) {
+ if (_globals[kMadameGiryLocation] == 0)
+ _scene->_variant = 2;
+ else if (_globals[kMadameGiryLocation] == 1)
+ _scene->_variant = 1;
+ }
+}
+
+void Scene205::enter() {
+ _vm->_disableFastwalk = true;
+
+ if (_globals[kJacquesStatus] != 1) {
+ _scene->_rails.disableNode(6);
+ _scene->_rails.disableNode(7);
+ _scene->_rails.disableNode(8);
+ _scene->_rails.disableNode(9);
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _lastRandom = -1;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ }
+
+ _conversationCounter = 0;
+ _noConversationHold = false;
+ _giveTicketFl = false;
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RDR_9");
+
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, false);
+ _scene->_hotspots.activate(NOUN_MADAME_GIRY, false);
+ _scene->_hotspots.activate(NOUN_WOMAN, false);
+
+ _vm->_gameConv->get(18);
+ _vm->_gameConv->get(10);
+ _vm->_gameConv->get(11);
+
+ if (_globals[kCurrentYear] == 1881) {
+ if ((_globals[kMadameGiryShowsUp]) && (_globals[kJacquesStatus] == 0)) {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('g', 1), 1);
+ _anim1ActvFl = true;
+ _giryStatus = 2;
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_MADAME_GIRY, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(75, 84), FACING_NORTHWEST);
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[1], 1);
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[1], 2);
+
+ switch (_globals[kMadameGiryLocation]) {
+ case 0:
+ _scene->setAnimFrame(_globals._animationIndexes[1], 138);
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(62, 54));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(62, 66));
+ break;
+
+ case 1:
+ if (_globals[kMadameNameIsKnown] >= 1) {
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(113, 44));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(107, 66));
+ } else
+ _scene->_hotspots.activate(NOUN_WOMAN, true);
+
+ break;
+
+ case 2:
+ _scene->setAnimFrame(_globals._animationIndexes[1], 273);
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(283, 51));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(289, 62));
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (_vm->_gameConv->_restoreRunning == 10) {
+ int count = 0;
+
+ if (_game._objects.isInInventory(OBJ_RED_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_GREEN_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_YELLOW_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_BLUE_FRAME))
+ ++count;
+
+ _vm->_gameConv->run(10);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_game._difficulty);
+
+ if (count > 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _noConversationHold = true;
+
+ if (_giryStatus == 4)
+ _scene->setAnimFrame(_globals._animationIndexes[1], 66);
+ else
+ _giryStatus = 2;
+ } else if (_vm->_gameConv->_restoreRunning == 11) {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(0);
+ _vm->_gameConv->exportValue(0);
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+ }
+ }
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ if (_globals[kJacquesStatus] == 1) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 9), 1);
+ _anim0ActvFl = true;
+ _richardStatus = 3;
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, true);
+
+ if (_vm->_gameConv->_restoreRunning == 18) {
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _richardStatus = 3;
+ _vm->_gameConv->run(18);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 1);
+ }
+ }
+ }
+
+ if (_scene->_priorSceneId == 206) {
+ _game._player._playerPos = Common::Point(37, 64);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(41, 67), FACING_SOUTH);
+ _game._player.setWalkTrigger(90);
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ if (_globals[kJacquesStatus] == 1) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 9), 1);
+ _anim0ActvFl = true;
+ _richardStatus = 3;
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, true);
+ }
+ } else if (_scene->_priorSceneId == 207) {
+ _game._player._playerPos = Common::Point(263, 59);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(262, 63), FACING_SOUTH);
+ _game._player.setWalkTrigger(95);
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else if (_scene->_priorSceneId == 150) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 9), 1);
+ _anim0ActvFl = true;
+ _richardStatus = 3;
+ _game._player._playerPos = Common::Point(132, 112);
+ _game._player._facing = FACING_NORTHWEST;
+ _globals[kDoorsIn205] = 1;
+ _globals[kTicketPeoplePresent] = 0;
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, true);
+ _vm->_gameConv->run(18);
+ } else if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ if (_globals[kJacquesStatus] == 1) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 9), 1);
+ _anim0ActvFl = true;
+ _richardStatus = 3;
+ _scene->_hotspots.activate(NOUN_MONSIEUR_RICHARD, true);
+ }
+
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ _game._player.firstWalk(Common::Point(-20, 144), FACING_EAST, Common::Point(19, 144), FACING_NORTHEAST, true);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene205::step() {
+ if (_anim0ActvFl)
+ handleRichardAnimation();
+
+ if (_anim1ActvFl)
+ handleGiryAnimation();
+
+ if ((_globals[kWalkerConverse] == 2) || (_globals[kWalkerConverse] == 3)) {
+ ++_conversationCounter;
+ if (_conversationCounter > 200)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+
+ if (_giveTicketFl && !_action.isAction(VERB_GIVE)) {
+ _globals[kWalkerConverse] = 0;
+ _game._player.walk(Common::Point(_game._player._playerPos.x + 5, _game._player._playerPos.y - 10), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(100);
+ _giveTicketFl = false;
+ }
+
+ switch (_game._trigger) {
+ case 100:
+ _game._player._visible = false;
+ _globals._sequenceIndexes[2] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[2], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 102);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 4, 101);
+ break;
+
+ case 101:
+ _game._objects.setRoom(OBJ_TICKET, NOWHERE);
+ _giryStatus = 2;
+ break;
+
+ case 102:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[2]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->release();
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 90:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 91);
+ break;
+
+ case 91:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _vm->_sound->command(25);
+ _game._player._stepEnabled = true;
+ break;
+
+ case 95:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 96);
+ break;
+
+ case 96:
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _vm->_sound->command(25);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene205::actions() {
+ if (_vm->_gameConv->_running == 18) {
+ handleConversation18();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 10) {
+ handleConversation10();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 11) {
+ handleConversation11();
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_OPEN, NOUN_BOX_FIVE)) || (_action.isAction(VERB_ENTER, NOUN_BOX_FIVE))) {
+ if (_globals[kTicketPeoplePresent] == 2) {
+ if (_globals[kMadameGiryLocation] == 2) {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(3);
+ _vm->_gameConv->exportValue(0);
+ } else {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(4);
+ _vm->_gameConv->exportValue(0);
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_DOWN_STAIRS_TO, NOUN_GRAND_FOYER)) {
+ if (_globals[kTicketPeoplePresent] == 2) {
+ if (_globals[kMadameGiryLocation] == 2) {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(1);
+ _vm->_gameConv->exportValue(0);
+ } else {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(2);
+ _vm->_gameConv->exportValue(0);
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if ((_action.isAction(VERB_ENTER)) || (_action.isAction(VERB_OPEN)) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_LOCK)) {
+ if (((_action.isObject(NOUN_BOX_FIVE)) && ((_globals[kDoorsIn205] == 0) || (_globals[kDoorsIn205] == 2))
+ || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_LOCK))
+ || ((_action.isObject(NOUN_BOX_NINE)) && ((_globals[kDoorsIn205] == 0) || (_globals[kDoorsIn205] == 1)))
+ || (_action.isObject(NOUN_BOX_SIX)) || (_action.isObject(NOUN_BOX_SEVEN)) || (_action.isObject(NOUN_BOX_EIGHT))) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ _action._inProgress = false;
+ return;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[2];
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[2], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], false);
+ _vm->_sound->command(72);
+ _scene->_sequences.addTimer(15, 2);
+ _action._inProgress = false;
+ return;
+ }
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[2]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ if (_action.isAction(VERB_UNLOCK) || _action.isAction(VERB_LOCK))
+ _vm->_dialogs->show(20528);
+ else
+ _vm->_dialogs->show(20527);
+
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ } else if (((_action.isObject(NOUN_BOX_FIVE)) && ((_globals[kDoorsIn205] == 3) || (_globals[kDoorsIn205] == 1)))
+ || ((_action.isObject(NOUN_BOX_NINE)) && ((_globals[kDoorsIn205] == 3) || (_globals[kDoorsIn205] == 2)))) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[2] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[2], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[2], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 4, 80);
+ _action._inProgress = false;
+ return;
+
+ case 80:
+ _vm->_sound->command(24);
+ if (_action.isObject(NOUN_BOX_FIVE)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 81);
+ } else if (_action.isObject(NOUN_BOX_NINE)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 81);
+ }
+ _action._inProgress = false;
+ return;
+
+ case 81:
+ if (_action.isObject(NOUN_BOX_FIVE)) {
+ int idx = _globals._sequenceIndexes[0];
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[0], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ } else if (_action.isObject(NOUN_BOX_NINE)) {
+ int idx = _globals._sequenceIndexes[1];
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ }
+ _action._inProgress = false;
+ return;
+
+ case 2:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[2]);
+ if (_action.isObject(NOUN_BOX_FIVE)) {
+ _game._player.walk(Common::Point(37, 64), FACING_NORTH);
+ _game._player.setWalkTrigger(3);
+
+ } else if (_action.isObject(NOUN_BOX_NINE)) {
+ _game._player.walk(Common::Point(263, 59), FACING_NORTH);
+ _game._player.setWalkTrigger(3);
+ }
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ if (_action.isObject(NOUN_BOX_FIVE)) {
+ _scene->_nextSceneId = 206;
+ _globals[kMadameGiryLocation] = 1;
+ } else if (_action.isObject(NOUN_BOX_NINE)) {
+ _scene->_nextSceneId = 207;
+ _globals[kMadameGiryLocation] = 1;
+ }
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_RICHARD)) {
+ _vm->_gameConv->run(18);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_MADAME_GIRY) || _action.isAction(VERB_TALK_TO, NOUN_WOMAN) || _action.isAction(VERB_GIVE, NOUN_TICKET, NOUN_MADAME_GIRY)) {
+ if (_globals[kTicketPeoplePresent] == 2) {
+ if ((_globals[kDoorsIn205] == 2) || (_globals[kDoorsIn205] == 3)) {
+ if (_globals[kMadameGiryLocation] == 2) {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(1);
+
+ if (_action.isAction(VERB_GIVE))
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ } else {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(2);
+
+ if (_action.isAction(VERB_GIVE))
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ }
+ } else {
+ _vm->_gameConv->run(11);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET));
+ _vm->_gameConv->exportValue(0);
+
+ if (_action.isAction(VERB_GIVE))
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+ }
+ } else {
+ int count = 0;
+
+ if (_game._objects.isInInventory(OBJ_RED_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_GREEN_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_YELLOW_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_BLUE_FRAME))
+ ++count;
+
+ _vm->_gameConv->run(10);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _vm->_gameConv->exportValue(_game._difficulty);
+
+ if (count > 2)
+ _vm->_gameConv->exportValue(1);
+ else
+ _vm->_gameConv->exportValue(0);
+
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(20510);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_BOX_SIX)) {
+ _vm->_dialogs->show(20511);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOX_SEVEN)) {
+ _vm->_dialogs->show(20512);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOX_EIGHT)) {
+ _vm->_dialogs->show(20513);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOX_NINE)) {
+ if ((_globals[kDoorsIn205] == 0) || (_globals[kDoorsIn205] == 1))
+ _vm->_dialogs->show(20516);
+ else
+ _vm->_dialogs->show(20517);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOX_FIVE)) {
+ if ((_globals[kDoorsIn205] == 0) || (_globals[kDoorsIn205] == 2))
+ _vm->_dialogs->show(20514);
+ else
+ _vm->_dialogs->show(20515);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(20518);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MARBLE_COLUMN)) {
+ _vm->_dialogs->show(20519);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(20520);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(20521);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BUST)) {
+ _vm->_dialogs->show(20522);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CARPET)) {
+ _vm->_dialogs->show(20523);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRAND_FOYER)) {
+ _vm->_dialogs->show(20524);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WOMAN) || _action.isObject(NOUN_MADAME_GIRY)) {
+ _vm->_dialogs->show(20525);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MONSIEUR_RICHARD)) {
+ _vm->_dialogs->show(20526);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_BUST)) {
+ _vm->_dialogs->show(20529);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_BOX_TEN) || _action.isAction(VERB_ENTER, NOUN_BOX_TEN) || _action.isAction(VERB_LOOK, NOUN_BOX_TEN)) {
+ _vm->_dialogs->show(20513);
+ _action._inProgress = false;
+ return;
+ }
+
+ // FIX: the original was doing a | between the two 'objects'
+ if (_action.isAction(VERB_TAKE) && (_action.isObject(NOUN_WOMAN) || _action.isObject(NOUN_MADAME_GIRY))) {
+ _vm->_dialogs->show(20530);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene205::preActions() {
+ if (_action.isObject(NOUN_BOX_FIVE) && (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_OPEN)))
+ _game._player.walk(Common::Point(37, 67), FACING_NORTHEAST);
+
+ if (_action.isObject(NOUN_BOX_SIX) && (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_OPEN)))
+ _game._player.walk(Common::Point(80, 68), FACING_NORTHEAST);
+
+ if (_action.isObject(NOUN_BOX_SEVEN) && (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_OPEN)))
+ _game._player.walk(Common::Point(167, 65), FACING_NORTHEAST);
+
+ if (_action.isObject(NOUN_BOX_EIGHT) && (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_OPEN)))
+ _game._player.walk(Common::Point(212, 64), FACING_NORTHEAST);
+
+ if (_action.isObject(NOUN_BOX_NINE) && (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_OPEN)))
+ _game._player.walk(Common::Point(258, 63), FACING_NORTHEAST);
+
+ if (_action.isAction(VERB_WALK_DOWN_STAIRS_TO, NOUN_GRAND_FOYER) && (_globals[kDoorsIn205] != 2) && (_globals[kDoorsIn205] != 3)) {
+ _game._player._walkOffScreenSceneId = 202;
+ _globals[kMadameGiryLocation] = 1;
+ }
+}
+
+void Scene205::handleConversation18() {
+ int interlocutorFl = false;
+ int heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 0:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _richardStatus = 0;
+ break;
+
+ case 3:
+ case 4:
+ _vm->_gameConv->setHeroTrigger(64);
+ _globals[kRanConvIn205] = true;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 64:
+ _globals[kWalkerConverse] = 0;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ case 62:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+ _richardStatus = 0;
+ break;
+
+ case 60:
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+ _richardStatus = 3;
+ _conversationCounter = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(60);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(62);
+
+ _richardCount = 0;
+}
+
+void Scene205::handleConversation10() {
+ int interlocutorFl = false;
+ int heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 9:
+ _vm->_gameConv->setInterlocutorTrigger(68);
+ interlocutorFl = true;
+ _globals[kMadameNameIsKnown] = 1;
+ _scene->_hotspots.activate(NOUN_WOMAN, false);
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(113, 44));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(107, 66));
+ break;
+
+ case 10:
+ _globals[kMadameNameIsKnown] = 1;
+ _scene->_hotspots.activate(NOUN_WOMAN, false);
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(113, 44));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(107, 66));
+ break;
+
+ case 7:
+ if (!_game._trigger) {
+ _giryStatus = 6;
+ _globals[kMadameNameIsKnown] = 2;
+ _globals[kMadameGiryLocation] = 0;
+ _scene->changeVariant(2);
+ _scene->_rails.disableNode(6);
+ _scene->_rails.disableNode(7);
+ _scene->_rails.disableNode(8);
+ _scene->_rails.disableNode(9);
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, false, Common::Point(113, 44));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, false, Common::Point(107, 66));
+ interlocutorFl = true;
+ heroFl = true;
+ if (_globals[kDoorsIn205] == 0)
+ _globals[kDoorsIn205] = 1;
+ else if (_globals[kDoorsIn205] == 2)
+ _globals[kDoorsIn205] = 3;
+ }
+ break;
+
+ case 13:
+ case 45:
+ _vm->_gameConv->setInterlocutorTrigger(70);
+ interlocutorFl = true;
+ break;
+
+ case 21:
+ if (!_game._trigger && !_noConversationHold) {
+ _vm->_gameConv->hold();
+ _giryStatus = 4;
+ } else
+ _noConversationHold = false;
+
+ break;
+
+ case 17:
+ _vm->_gameConv->setInterlocutorTrigger(72);
+ interlocutorFl = true;
+ break;
+
+ case 11:
+ if (!_game._trigger) {
+ _vm->_gameConv->setInterlocutorTrigger(74);
+ }
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ case 23:
+ case 25:
+ if ((!_game._trigger) && (_giryStatus == 4)) {
+ _vm->_gameConv->hold();
+ _giryStatus = 0;
+ }
+ break;
+
+ case 4:
+ case 5:
+ case 8:
+ case 14:
+ case 16:
+ case 19:
+ case 40:
+ case 46:
+ _vm->_gameConv->setInterlocutorTrigger(64);
+ interlocutorFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 64:
+ switch (_action._activeAction._verbId) {
+ case 5:
+ case 14:
+ case 16:
+ case 19:
+ case 40:
+ case 46:
+ _giryStatus = 0;
+ break;
+ }
+ _globals[kWalkerConverse] = 0;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ case 68:
+ _giryStatus = 5;
+ break;
+
+ case 74:
+ _giryStatus = 8;
+ _globals[kWalkerConverse] = 0;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ case 72:
+ _giryStatus = 3;
+ break;
+
+ case 70:
+ if (_action._activeAction._verbId == 13) {
+ _globals[kWalkerConverse] = 0;
+ heroFl = true;
+ interlocutorFl = true;
+ }
+ _giryStatus = 1;
+ break;
+
+ case 66:
+ if (_globals[kWalkerConverse] != 0)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+
+ if ((_giryStatus != 4) && (_giryStatus != 6) && (_giryStatus != 7))
+ _giryStatus = 0;
+ break;
+
+ case 60:
+ if (_globals[kWalkerConverse] != 0)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+
+ if ((_giryStatus != 4) && (_giryStatus != 6) && (_giryStatus != 7))
+ _giryStatus = 2;
+
+ _conversationCounter = 0;
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(60);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(66);
+
+ _giryCount = 0;
+}
+
+void Scene205::handleConversation11() {
+ int interlocutorFl = false;
+ int heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 5:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _giryStatus = 9;
+ }
+ break;
+
+ case 8:
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _giryStatus = 7;
+ _vm->_gameConv->setInterlocutorTrigger(64);
+ _game._player.walk(Common::Point(225,79), FACING_NORTHEAST);
+ interlocutorFl = true;
+ _globals[kMadameGiryLocation] = 2;
+ _scene->changeVariant(4);
+ _scene->_rails.disableNode(6);
+ _scene->_rails.disableNode(7);
+ _scene->_rails.disableNode(8);
+ _scene->_rails.disableNode(9);
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, false, Common::Point(113, 44));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, false, Common::Point(107, 66));
+ if (_globals[kDoorsIn205] == 0)
+ _globals[kDoorsIn205] = 2;
+ else if (_globals[kDoorsIn205] == 1)
+ _globals[kDoorsIn205] = 3;
+ }
+ break;
+
+ case 9:
+ case 10:
+ case 12:
+ case 13:
+ case 14:
+ _vm->_gameConv->setInterlocutorTrigger(64);
+ interlocutorFl = true;
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 64:
+ switch (_action._activeAction._verbId) {
+ case 6:
+ case 10:
+ case 12:
+ case 13:
+ case 14:
+ _giryStatus = 0;
+ break;
+ }
+ _globals[kWalkerConverse] = 0;
+ heroFl = true;
+ interlocutorFl = true;
+ break;
+
+ case 110:
+ _vm->_gameConv->hold();
+ _giryStatus = 7;
+ break;
+
+ case 66:
+ if (_globals[kWalkerConverse] != 0)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
+
+ if (_giryStatus != 9)
+ _giryStatus = 0;
+ break;
+
+ case 60:
+ if (_globals[kWalkerConverse] != 0)
+ _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3);
+
+ if (_giryStatus != 9)
+ _giryStatus = 2;
+
+ _conversationCounter = 0;
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(60);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(66);
+
+ _giryCount = 0;
+}
+
+void Scene205::handleRichardAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _richardFrame)
+ return;
+
+ _richardFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int random;
+ int resetFrame = -1;
+
+ switch (_richardFrame) {
+ case 1:
+ case 2:
+ case 3:
+ case 11:
+ case 19:
+ case 35:
+ case 47:
+ case 57:
+ case 69:
+ switch (_richardStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 3);
+ ++_richardCount;
+ if (_richardCount > 30) {
+ _richardStatus = 3;
+ random = 9;
+ }
+ break;
+
+ case 1:
+ random = 4;
+ _richardStatus = 0;
+ break;
+
+ case 2:
+ random = 6;
+ break;
+
+ case 4:
+ random = 5;
+ _richardStatus = 0;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(7, 50);
+ while (_lastRandom == random)
+ random = _vm->getRandomNumber(7, 50);
+
+ _lastRandom = random;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 0;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ resetFrame = 2;
+ break;
+
+ case 4:
+ resetFrame = 11;
+ break;
+
+ case 5:
+ resetFrame = 3;
+ break;
+
+ case 6:
+ resetFrame = 57;
+ break;
+
+ case 7:
+ resetFrame = 23;
+ break;
+
+ case 8:
+ resetFrame = 19;
+ break;
+
+ case 9:
+ resetFrame = 21;
+ break;
+
+ case 10:
+ resetFrame = 25;
+ break;
+
+ case 11:
+ resetFrame = 35;
+ break;
+
+ case 12:
+ resetFrame = 47;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 30:
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 4:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 30;
+ else
+ resetFrame = 29;
+
+ break;
+
+ case 24:
+ switch (_richardStatus) {
+ case 1:
+ case 2:
+ case 4:
+ case 0:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 30);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 0;
+ else
+ resetFrame = 23;
+
+ break;
+
+ case 20:
+ switch (_richardStatus) {
+ case 1:
+ case 2:
+ case 4:
+ case 0:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 0;
+ else
+ resetFrame = 19;
+
+ break;
+
+ case 22:
+ switch (_richardStatus) {
+ case 1:
+ case 2:
+ case 4:
+ case 0:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 0;
+ else
+ resetFrame = 21;
+
+ break;
+
+ case 41:
+ switch (_richardStatus) {
+ case 1:
+ case 2:
+ case 4:
+ case 0:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 41;
+ else
+ resetFrame = 40;
+
+ break;
+
+ case 52:
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 4:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 52;
+ else
+ resetFrame = 51;
+
+ break;
+
+ case 65:
+ switch (_richardStatus) {
+ case 0:
+ case 1:
+ case 2:
+ case 4:
+ random = 1;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 50);
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 65;
+ else
+ resetFrame = 64;
+
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _richardFrame = resetFrame;
+ }
+}
+
+void Scene205::handleGiryAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _giryFrame)
+ return;
+
+ _giryFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int random;
+ int resetFrame = -1;
+
+ switch (_giryFrame) {
+ case 77:
+ _vm->_gameConv->release();
+ break;
+
+ case 1:
+ case 2:
+ case 3:
+ case 44:
+ case 14:
+ case 21:
+ case 35:
+ case 56:
+ case 78:
+ case 284:
+ switch (_giryStatus) {
+ case 0:
+ random = _vm->getRandomNumber(1, 3);
+ ++_giryCount;
+ if (_giryCount > 30) {
+ _giryStatus = 2;
+ random = 100;
+ }
+ break;
+
+ case 8:
+ random = 4;
+ _giryStatus = 0;
+ break;
+
+ case 3:
+ random = 5;
+ _giryStatus = 0;
+ break;
+
+ case 1:
+ random = 6;
+ break;
+
+ case 5:
+ _giryStatus = 0;
+ random = 7;
+ break;
+
+ case 4:
+ random = 8;
+ break;
+
+ case 6:
+ random = 9;
+ _giryStatus = 2;
+ break;
+
+ case 7:
+ random = 10;
+ _giryStatus = 2;
+ break;
+
+ case 9:
+ random = 11;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(12, 100);
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 0;
+ break;
+
+ case 2:
+ resetFrame = 1;
+ break;
+
+ case 3:
+ resetFrame = 2;
+ break;
+
+ case 4:
+ resetFrame = 3;
+ break;
+
+ case 5:
+ resetFrame = 16;
+ break;
+
+ case 6:
+ resetFrame = 21;
+ break;
+
+ case 7:
+ resetFrame = 44;
+ break;
+
+ case 8:
+ resetFrame = 56;
+ break;
+
+ case 9:
+ resetFrame = 78;
+ _vm->_gameConv->hold();
+ break;
+
+ case 10:
+ resetFrame = 140;
+ break;
+
+ case 11:
+ resetFrame = 276;
+ break;
+
+ case 12:
+ resetFrame = 35;
+ break;
+
+ default:
+ resetFrame = 0;
+ break;
+ }
+ break;
+
+ case 27:
+ case 28:
+ case 29:
+ switch (_giryStatus) {
+ case 0:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ random = 4;
+ break;
+
+ default:
+ random = _vm->getRandomNumber(1, 3);
+ ++_giryCount;
+ if (_giryCount > 30) {
+ _giryStatus = 2;
+ random = 100;
+ }
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 26;
+ break;
+
+ case 2:
+ resetFrame = 27;
+ break;
+
+ case 3:
+ resetFrame = 28;
+ break;
+
+ default:
+ resetFrame = 29;
+ break;
+ }
+ break;
+
+ case 265:
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(283, 51));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(289, 62));
+ _vm->_gameConv->release();
+ break;
+
+ case 274:
+ case 275:
+ case 276:
+ if (_giryStatus == 0) {
+ random = _vm->getRandomNumber(1, 3);
+ ++_giryCount;
+ if (_giryCount > 30) {
+ _giryStatus = 2;
+ random = 100;
+ }
+ } else
+ random = 100;
+
+ switch (random) {
+ case 1:
+ resetFrame = 273;
+ break;
+
+ case 2:
+ resetFrame = 274;
+ break;
+
+ case 3:
+ resetFrame = 275;
+ break;
+
+ default:
+ resetFrame = 273;
+ break;
+ }
+ break;
+
+ case 85:
+ _vm->_gameConv->release();
+ break;
+
+ case 110:
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(62, 54));
+ _scene->_hotspots.activateAtPos(NOUN_MADAME_GIRY, true, Common::Point(62, 66));
+ break;
+
+ case 138:
+ case 139:
+ case 140:
+ switch (_giryStatus) {
+ case 0:
+ case 1:
+ random = _vm->getRandomNumber(1, 3);
+ ++_giryCount;
+ if (_giryCount > 30) {
+ _giryStatus = 2;
+ random = 100;
+ }
+ break;
+
+ default:
+ random = 100;
+ break;
+ }
+
+ switch (random) {
+ case 1:
+ resetFrame = 137;
+ break;
+
+ case 2:
+ resetFrame = 138;
+ break;
+
+ case 3:
+ resetFrame = 139;
+ break;
+
+ default:
+ resetFrame = 137;
+ break;
+ }
+ break;
+
+ case 66:
+ _vm->_gameConv->release();
+ break;
+
+ case 67:
+ switch (_giryStatus) {
+ case 0:
+ case 9:
+ case 2:
+ case 3:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ random = 1;
+ break;
+
+ default:
+ random = 100;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 67;
+ else
+ resetFrame = 66;
+
+ break;
+
+ case 8:
+ case 9:
+ switch (_giryStatus) {
+ case 0:
+ case 9:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ random = 1;
+ break;
+
+ default:
+ random = 100;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 9;
+ else
+ resetFrame = 8;
+
+ break;
+
+ case 280:
+ _giveTicketFl = true;
+ break;
+
+ case 281:
+ switch (_giryStatus) {
+ case 0:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ random = 1;
+ break;
+
+ default:
+ random = 100;
+ break;
+ }
+
+ if (random == 1)
+ resetFrame = 281;
+ else
+ resetFrame = 280;
+
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _giryFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene206::Scene206(MADSEngine *vm) : Scene2xx(vm) {
+ _anim0ActvFl = false;
+ _skip1Fl = false;
+ _skip2Fl = false;
+}
+
+void Scene206::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_skip1Fl);
+ s.syncAsByte(_skip2Fl);
+}
+
+void Scene206::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene206::enter() {
+ _anim0ActvFl = false;
+ _skip1Fl = false;
+ _skip2Fl = false;
+
+ _scene->loadSpeech(1);
+ _vm->_gameConv->get(26);
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RDR_9");
+
+ if (_scene->_priorSceneId != 308) {
+ if (_globals[kPanelIn206] == 0) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ } else {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13);
+ }
+ }
+
+ if (_globals[kPanelIn206] == 0) {
+ _scene->_hotspots.activate(NOUN_PANEL, false);
+ _scene->_hotspots.activate(NOUN_KEYHOLE, false);
+ }
+
+ if (_game._objects.isInRoom(OBJ_CRUMPLED_NOTE)) {
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 10);
+ } else
+ _scene->_hotspots.activate(NOUN_CRUMPLED_NOTE, false);
+
+ if (_globals[kTrapDoorStatus] == 0) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ }
+
+ if (_globals[kRightDoorIsOpen504] && !_globals[kKnockedOverHead]) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('h', 1), 88);
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _anim0ActvFl = true;
+ } else if (_scene->_priorSceneId == 308) {
+ _game._player._playerPos = Common::Point(67, 127);
+ _game._player._stepEnabled = false;
+ _game._player.walk(Common::Point(108, 137), FACING_EAST);
+ _game._player.setWalkTrigger(82);
+ } else if ((_scene->_priorSceneId == 205) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(153, 148);
+ _game._player._facing = FACING_NORTH;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene206::step() {
+ switch (_game._trigger) {
+ case 82:
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 83);
+ break;
+
+ case 83:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13);
+ _game._player._stepEnabled = true;
+ break;
+
+ case 88:
+ _game._player._playerPos = Common::Point(168, 138);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _anim0ActvFl = false;
+ _game._player.resetFacing(FACING_WEST);
+ break;
+
+ default:
+ break;
+ }
+
+ if (_anim0ActvFl && !_skip1Fl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 118) {
+ _globals[kKnockedOverHead] = true;
+ _skip1Fl = true;
+ _scene->_sequences.addTimer(1, 84);
+ }
+ }
+
+ if (_anim0ActvFl && !_skip2Fl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 61) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(65);
+ else
+ _scene->playSpeech(1);
+
+ _skip2Fl = true;
+ }
+ }
+
+ switch (_game._trigger) {
+ case 84:
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 85);
+ break;
+
+ case 85:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene206::actions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_LOGE_CORRIDOR)) {
+ if (_globals[kRightDoorIsOpen504]) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(65);
+ else
+ _scene->playSpeech(1);
+
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(4);
+ } else
+ _scene->_nextSceneId = 205;
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CRUMPLED_NOTE) && (_game._objects.isInRoom(OBJ_CRUMPLED_NOTE) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[5], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 4, 77);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 78);
+ _action._inProgress = false;
+ return;
+
+ case 77:
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+ _scene->_hotspots.activate(NOUN_CRUMPLED_NOTE, false);
+ _game._objects.addToInventory(OBJ_CRUMPLED_NOTE);
+ _vm->_sound->command(26);
+ _action._inProgress = false;
+ return;
+
+ case 78:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[5]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 79);
+ _action._inProgress = false;
+ return;
+
+ case 79:
+ _vm->_dialogs->showItem(OBJ_CRUMPLED_NOTE, 816, 6);
+ _game._player._stepEnabled = true;
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_BEHIND, NOUN_PANEL) || _action.isAction(VERB_OPEN, NOUN_PANEL)
+ || ((_game._trigger >= 70) && (_game._trigger < 77))) {
+ if (_globals[kPanelIn206] == 3) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[5], true, 7, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 70);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ break;
+
+ case 70:
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ break;
+
+ case 71:
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _game._player.walk(Common::Point(67, 127), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(72);
+ break;
+
+ case 72:
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 73);
+ break;
+
+ case 73:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_nextSceneId = 308;
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[5], true, 7, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 74);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 75);
+ break;
+
+ case 74:
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _vm->_dialogs->show(20625);
+ break;
+
+ case 75:
+ _vm->_sound->command(72);
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_UNLOCK, NOUN_PANEL) || _action.isAction(VERB_LOCK, NOUN_PANEL) || _action.isAction(VERB_PUT, NOUN_KEY, NOUN_KEYHOLE)
+ || _action.isAction(VERB_UNLOCK, NOUN_KEYHOLE) || _action.isAction(VERB_LOCK, NOUN_KEYHOLE) || (_game._trigger >= 64)) {
+ if (_globals[kPanelIn206] >= 1) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], true, 7, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 64);
+ break;
+
+ case 64: {
+ _vm->_sound->command(71);
+ int idx = _globals._sequenceIndexes[5];
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], true, -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[5], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], false);
+ _scene->_sequences.addTimer(30, 65);
+ }
+ break;
+
+ case 65:
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[5], true, 7, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[5], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ break;
+
+ case 66:
+ if (_action.isAction(VERB_LOCK)) {
+ _globals[kPanelIn206] = 2;
+ _vm->_dialogs->show(20629);
+ } else if (_action.isAction(VERB_UNLOCK)) {
+ _globals[kPanelIn206] = 3;
+ _vm->_dialogs->show(20628);
+ }
+
+ if (_action.isAction(VERB_PUT)) {
+ if (_globals[kPanelIn206] <= 2) {
+ _globals[kPanelIn206] = 3;
+ _vm->_dialogs->show(20628);
+ } else {
+ _globals[kPanelIn206] = 2;
+ _vm->_dialogs->show(20629);
+ }
+ }
+
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[5]);
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(20610);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(20611);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(20612);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RIGHT_COLUMN)) {
+ _vm->_dialogs->show(20614);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_KEYHOLE)) {
+ _vm->_dialogs->show(20615);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAIL)) {
+ _vm->_dialogs->show(20616);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SEAT)) {
+ _vm->_dialogs->show(20617);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LOGE_CORRIDOR)) {
+ _vm->_dialogs->show(20618);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE)) {
+ if (_globals[kJacquesStatus])
+ _vm->_dialogs->show(20630);
+ else
+ _vm->_dialogs->show(20619);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOUSE)) {
+ _vm->_dialogs->show(20620);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(20621);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOUSE_LIGHT)) {
+ _vm->_dialogs->show(20622);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PANEL)) {
+ if (_globals[kPanelIn206] == 3)
+ _vm->_dialogs->show(20624);
+ else
+ _vm->_dialogs->show(20626);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isObject(NOUN_LEFT_COLUMN)) && (!_game._trigger)) {
+ if (_globals[kPanelIn206] == 0) {
+ _vm->_dialogs->show(20613);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('k', 1), 95);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ } else
+ _vm->_dialogs->show(20623);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CRUMPLED_NOTE) && _game._objects.isInRoom(OBJ_CRUMPLED_NOTE)) {
+ _vm->_dialogs->show(20627);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ switch (_game._trigger) {
+ case 95:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->_hotspots.activate(NOUN_PANEL, true);
+ _scene->_hotspots.activate(NOUN_KEYHOLE, true);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13);
+ if (!(_globals[kPlayerScoreFlags] & 8)) {
+ _globals[kPlayerScoreFlags] |= 8;
+ _globals[kPlayerScore] += 5;
+ }
+ _scene->_sequences.addTimer(15, 96);
+
+ _action._inProgress = false;
+ return;
+
+ case 96:
+ _game._player._stepEnabled = true;
+ _globals[kPanelIn206] = 1;
+ _vm->_dialogs->show(20623);
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+}
+
+void Scene206::preActions() {
+ if (_action.isAction(VERB_LOOK, NOUN_LEFT_COLUMN))
+ _game._player._needToWalk = true;
+
+ if (_action.isAction(VERB_UNLOCK, NOUN_PANEL) || _action.isAction(VERB_WALK_BEHIND, NOUN_PANEL)
+ || _action.isAction(VERB_LOCK, NOUN_PANEL) || _action.isAction(VERB_OPEN, NOUN_PANEL))
+ _game._player.walk(Common::Point(108, 137), FACING_NORTHWEST);
+
+ if (_action.isObject(NOUN_LEFT_COLUMN) && (_globals[kPanelIn206] == 0))
+ _game._player.walk(Common::Point(103, 137), FACING_NORTHWEST);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene207::Scene207(MADSEngine *vm) : Scene2xx(vm) {
+ _skip1Fl = false;
+ _anim0ActvFl = false;
+}
+
+void Scene207::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_skip1Fl);
+ s.syncAsByte(_anim0ActvFl);
+}
+
+void Scene207::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene207::enter() {
+ _scene->loadSpeech(2);
+ _skip1Fl = false;
+ _anim0ActvFl = false;
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0));
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
+
+ if ((_scene->_priorSceneId == 205) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(159, 147);
+ _game._player._facing = FACING_NORTH;
+ }
+
+ sceneEntrySound();
+}
+
+void Scene207::step() {
+ if (_anim0ActvFl && !_skip1Fl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 6) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(69);
+ else
+ _scene->playSpeech(2);
+
+ _skip1Fl = true;
+ }
+ }
+}
+
+void Scene207::actions() {
+ if (_action.isAction(VERB_TAKE, NOUN_SEAT)) {
+ switch (_game._trigger) {
+ case 0:
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _vm->_sound->command(3);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.addTimer(120, 2);
+ _scene->_sequences.addTimer(240, 3);
+ break;
+
+ case 2:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
+ break;
+
+ case 3:
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('s', 1), 5);
+ _anim0ActvFl = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ break;
+
+ case 4:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ break;
+
+ case 5:
+ _scene->_nextSceneId = 208;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_LOGE_CORRIDOR)) {
+ _scene->_nextSceneId = 205;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(20710);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(20711);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(20712);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEFT_COLUMN)) {
+ _vm->_dialogs->show(20713);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RIGHT_COLUMN)) {
+ _vm->_dialogs->show(20714);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAIL)) {
+ _vm->_dialogs->show(20715);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SEAT)) {
+ _vm->_dialogs->show(20716);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LOGE_CORRIDOR)) {
+ _vm->_dialogs->show(20717);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAGE)) {
+ _vm->_dialogs->show(20718);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOUSE)) {
+ _vm->_dialogs->show(20719);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(20720);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOUSE_LIGHT)) {
+ _vm->_dialogs->show(20721);
+ _action._inProgress = false;
+ return;
+ }
+ }
+}
+
+void Scene207::preActions() {
+ if (_action.isAction(VERB_TAKE, NOUN_SEAT))
+ _game._player.walk(Common::Point(139, 124), FACING_NORTH);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene208::Scene208(MADSEngine *vm) : Scene2xx(vm) {
+ _skip1Fl = false;
+ _skip2Fl = false;
+
+ _topLeftPeopleFrame = -1;
+ _topRightPeopleFrame = -1;
+ _middleLeftPeopleFrame = -1;
+ _centerPeopleFrame = -1;
+ _middleRightPeopleFrame = -1;
+ _bottomLeftPeopleFrame = -1;
+ _bottomMiddlePeopleFrame = -1;
+ _bottomRightPeopleFrame = -1;
+ _direction = -1;
+}
+
+void Scene208::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+
+ s.syncAsByte(_skip1Fl);
+ s.syncAsByte(_skip2Fl);
+
+ s.syncAsSint16LE(_topLeftPeopleFrame);
+ s.syncAsSint16LE(_topRightPeopleFrame);
+ s.syncAsSint16LE(_middleLeftPeopleFrame);
+ s.syncAsSint16LE(_centerPeopleFrame);
+ s.syncAsSint16LE(_middleRightPeopleFrame);
+ s.syncAsSint16LE(_bottomLeftPeopleFrame);
+ s.syncAsSint16LE(_bottomMiddlePeopleFrame);
+ s.syncAsSint16LE(_bottomRightPeopleFrame);
+ s.syncAsSint16LE(_direction);
+}
+
+void Scene208::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene208::enter() {
+ _scene->loadSpeech(1);
+
+ _skip1Fl = false;
+ _skip2Fl = false;
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 6));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('x', 7));
+
+ _scene->_userInterface.emptyConversationList();
+ _scene->_userInterface.setup(kInputConversation);
+
+ _scene->loadSpeech(1);
+
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+
+ _topLeftPeopleFrame = 2;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, _topLeftPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1);
+ _scene->_sequences.addTimer(120, 60);
+
+ _topRightPeopleFrame = 2;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, _topRightPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ _scene->_sequences.addTimer(30, 62);
+
+ _middleLeftPeopleFrame = 2;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, _middleLeftPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _scene->_sequences.addTimer(30, 64);
+
+ _centerPeopleFrame = 1;
+ _direction = 1;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, _centerPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.addTimer(300, 66);
+
+ _middleRightPeopleFrame = 3;
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, _middleRightPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1);
+ _scene->_sequences.addTimer(60, 68);
+
+ _bottomLeftPeopleFrame = 4;
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, _bottomLeftPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.addTimer(60, 70);
+
+ _bottomMiddlePeopleFrame = 4;
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, _bottomMiddlePeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _scene->_sequences.addTimer(30, 72);
+
+ _bottomRightPeopleFrame = 3;
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, _bottomRightPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+ _scene->_sequences.addTimer(15, 74);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('p', 1), 80);
+
+ sceneEntrySound();
+}
+
+void Scene208::step() {
+ animateTopLeftPeople();
+ animateTopRightPeople();
+ animateMiddleLeftPeople();
+ animateCenterPeople();
+ animateMiddleRightPeople();
+ animateBottomLeftPeople();
+ animateBottomMiddlePeople();
+ animateBottomRightPeople();
+
+ if (!_skip1Fl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 49) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(65);
+ else
+ _scene->playSpeech(1);
+
+ _skip1Fl = true;
+ }
+ }
+
+ if (!_skip2Fl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 68) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(65);
+ else
+ _scene->playSpeech(1);
+
+ _skip2Fl = true;
+ }
+ }
+
+ if (_game._trigger == 80)
+ _scene->_nextSceneId = 150;
+}
+
+void Scene208::actions() {
+}
+
+void Scene208::preActions() {
+}
+
+void Scene208::animateTopLeftPeople() {
+
+ if (_game._trigger != 60)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+
+ int triggerVal;
+ int rndVal = _vm->getRandomNumber(1, 2);
+ if (_topLeftPeopleFrame == 3)
+ triggerVal = 1;
+ else
+ triggerVal = rndVal;
+
+ if (rndVal == triggerVal) {
+ _topLeftPeopleFrame += _vm->getRandomNumber(-1, 1);
+ if (_topLeftPeopleFrame == 0)
+ _topLeftPeopleFrame = 1;
+ else if (_topLeftPeopleFrame == 4)
+ _topLeftPeopleFrame = 3;
+ }
+
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, _topLeftPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1);
+ int delay = _vm->getRandomNumber(15, 60);
+ _scene->_sequences.addTimer(delay, 60);
+}
+
+void Scene208::animateTopRightPeople() {
+ if (_game._trigger != 62)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+
+ int triggerVal;
+ int rndVal = _vm->getRandomNumber(1, 2);
+ if (_topRightPeopleFrame == 4)
+ triggerVal = 1;
+ else
+ triggerVal = rndVal;
+
+ if (rndVal == triggerVal) {
+ _topRightPeopleFrame += _vm->getRandomNumber(-1, 1);
+ if (_topRightPeopleFrame == 0)
+ _topRightPeopleFrame = 1;
+ else if (_topRightPeopleFrame == 5)
+ _topRightPeopleFrame = 4;
+ }
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, _topRightPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ int delay = _vm->getRandomNumber(15, 60);
+ _scene->_sequences.addTimer(delay, 62);
+}
+
+void Scene208::animateMiddleLeftPeople() {
+ if (_game._trigger != 64)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ int delay = _vm->getRandomNumber(60, 120);
+
+ int triggerVal;
+ int rndVal = _vm->getRandomNumber(1, 2);
+ if (_middleLeftPeopleFrame == 2)
+ triggerVal = 1;
+ else
+ triggerVal = rndVal;
+
+ if (rndVal == triggerVal) {
+ _middleLeftPeopleFrame += _vm->getRandomNumber(-1, 1);
+ if (_middleLeftPeopleFrame == 0)
+ _middleLeftPeopleFrame = 1;
+ else if (_middleLeftPeopleFrame == 5)
+ _middleLeftPeopleFrame = 4;
+ }
+
+ if ((_centerPeopleFrame == 3) && (_middleLeftPeopleFrame < 4)) {
+ ++_middleLeftPeopleFrame;
+ delay = 10;
+ }
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, _middleLeftPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _scene->_sequences.addTimer(delay, 64);
+}
+
+
+void Scene208::animateCenterPeople() {
+ if (_game._trigger != 66)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+
+ int delay;
+
+ if (_direction) {
+ ++_centerPeopleFrame;
+ delay = 15;
+ if (_centerPeopleFrame == 4) {
+ delay = _vm->getRandomNumber(300, 420);
+ --_centerPeopleFrame;
+ _direction = 0;
+ }
+ } else {
+ --_centerPeopleFrame;
+ delay = 15;
+ if (_centerPeopleFrame == 0) {
+ delay = _vm->getRandomNumber(600, 900);
+ ++_centerPeopleFrame;
+ _direction = 1;
+ }
+ }
+
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, _centerPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.addTimer(delay, 66);
+}
+
+void Scene208::animateMiddleRightPeople() {
+ if (_game._trigger != 68)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+
+ int triggerVal;
+ int rndVal = _vm->getRandomNumber(1, 2);
+ if (_middleRightPeopleFrame == 1)
+ triggerVal = 1;
+ else
+ triggerVal = rndVal;
+
+ if (rndVal == triggerVal) {
+ _middleRightPeopleFrame += _vm->getRandomNumber(-1, 1);
+ if (_middleRightPeopleFrame == 0)
+ _middleRightPeopleFrame = 1;
+ else if (_middleRightPeopleFrame == 4)
+ _middleRightPeopleFrame = 3;
+
+ if (_centerPeopleFrame == 3)
+ _middleRightPeopleFrame = 3;
+ }
+
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, _middleRightPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1);
+ int delay = _vm->getRandomNumber(15, 60);
+ _scene->_sequences.addTimer(delay, 68);
+}
+
+void Scene208::animateBottomLeftPeople() {
+ if (_game._trigger != 70)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+
+ int triggerVal;
+ int rndVal = _vm->getRandomNumber(1, 2);
+ if (_bottomLeftPeopleFrame == 4)
+ triggerVal = 1;
+ else
+ triggerVal = rndVal;
+
+ if (rndVal == triggerVal) {
+ _bottomLeftPeopleFrame += _vm->getRandomNumber(-1, 1);
+ if (_bottomLeftPeopleFrame == 0)
+ _bottomLeftPeopleFrame = 1;
+ else if (_bottomLeftPeopleFrame == 5)
+ _bottomLeftPeopleFrame = 4;
+ }
+
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, _bottomLeftPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ int delay = _vm->getRandomNumber(15, 60);
+ _scene->_sequences.addTimer(delay, 70);
+}
+
+void Scene208::animateBottomMiddlePeople() {
+ if (_game._trigger != 72)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+
+ int triggerVal;
+ int rndVal = _vm->getRandomNumber(1, 2);
+ if (_bottomMiddlePeopleFrame == 4)
+ triggerVal = 1;
+ else
+ triggerVal = rndVal;
+
+ if (rndVal == triggerVal) {
+ _bottomMiddlePeopleFrame += _vm->getRandomNumber(-1, 1);
+ if (_bottomMiddlePeopleFrame == 0)
+ _bottomMiddlePeopleFrame = 1;
+ else if (_bottomMiddlePeopleFrame == 5)
+ _bottomMiddlePeopleFrame = 4;
+ }
+
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, _bottomMiddlePeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ int delay = _vm->getRandomNumber(15, 60);
+ _scene->_sequences.addTimer(delay, 72);
+}
+
+void Scene208::animateBottomRightPeople() {
+ if (_game._trigger != 74)
+ return;
+
+ _scene->deleteSequence(_globals._sequenceIndexes[7]);
+
+ int triggerVal;
+ int rndVal = _vm->getRandomNumber(1, 2);
+ if ((_bottomRightPeopleFrame == 3) || (_bottomRightPeopleFrame == 1))
+ triggerVal = 1;
+ else
+ triggerVal = rndVal;
+
+ if (rndVal == triggerVal) {
+ _bottomRightPeopleFrame += _vm->getRandomNumber(-1, 1);
+ if (_bottomRightPeopleFrame == 0)
+ _bottomRightPeopleFrame = 1;
+ else if (_bottomRightPeopleFrame == 4)
+ _bottomRightPeopleFrame = 3;
+ }
+
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, _bottomRightPeopleFrame);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+ int delay = _vm->getRandomNumber(15, 60);
+ _scene->_sequences.addTimer(delay, 74);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene250::Scene250(MADSEngine *vm) : Scene2xx(vm) {
+}
+
+void Scene250::synchronize(Common::Serializer &s) {
+ Scene2xx::synchronize(s);
+}
+
+void Scene250::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene250::enter() {
+ warning("TODO: Switch to letter box view. See definition of MADS_MENU_Y");
+
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+
+ _game.loadQuoteSet(0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0);
+ _globals._animationIndexes[0] = _scene->loadAnimation("*RM150Q1", 1);
+}
+
+void Scene250::step() {
+ if (_game._trigger == 1)
+ _scene->_sequences.addTimer(12, 2);
+
+ if (_game._trigger == 2) {
+ int y = 68;
+
+ _scene->_kernelMessages.add(Common::Point(160, y), 0x1110, 0x20, 0, 900, _game.getQuote(0x36));
+ y += 16;
+
+ if (_globals[kPlayerScore] > 250)
+ _globals[kPlayerScore] = 250;
+
+ Common::String message = Common::String::format("%d", _globals[kPlayerScore]);
+ message += " ";
+ message += _game.getQuote(0x37);
+ message += " 250 ";
+ message += _game.getQuote(0x38);
+
+ _scene->_kernelMessages.add(Common::Point(160, y), 0x1110, 0x20, 3, 900, message);
+ y += 16;
+
+ _scene->_kernelMessages.add(Common::Point(160, y), 0x1110, 0x20, 0, 900, _game.getQuote(0x39));
+ y += 16;
+
+ int score = _globals[kPlayerScore];
+ int messageId;
+
+ if (score <= 25)
+ // Score level: Stage sweeper
+ messageId = 0x3A;
+ else if (score <= 50)
+ // Score level: Dresser
+ messageId = 0x3B;
+ else if (score <= 75)
+ // Score level: Usher
+ messageId = 0x3C;
+ else if (score <= 100)
+ // Score level: Stagehand
+ messageId = 0x3D;
+ else if (score <= 150)
+ // Score level: Chorus member
+ messageId = 0x3E;
+ else if (score <= 200)
+ // Score level: Supporting player
+ messageId = 0x3F;
+ else if (score <= 249)
+ // Score level: Star player
+ messageId = 0x40;
+ else
+ // Score level: Director
+ messageId = 0x41;
+
+ _scene->_kernelMessages.add(Common::Point(160, y), 0x1110, 0x20, 0, 900, _game.getQuote(messageId));
+ _scene->_sequences.addTimer(930, 3);
+ }
+
+ if (_game._trigger == 3)
+ _game._winStatus = 1;
+}
+
+void Scene250::actions() {
+}
+
+void Scene250::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+} // End of namespace Phantom
+} // End of namespace MADS
diff --git a/engines/mads/phantom/phantom_scenes2.h b/engines/mads/phantom/phantom_scenes2.h
new file mode 100644
index 0000000000..7e86e2ce0f
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes2.h
@@ -0,0 +1,307 @@
+/* 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 MADS_PHANTOM_SCENES2_H
+#define MADS_PHANTOM_SCENES2_H
+
+#include "common/scummsys.h"
+#include "common/serializer.h"
+#include "mads/game.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+class Scene2xx : public PhantomScene {
+protected:
+ /**
+ * Plays an appropriate sound when entering a scene
+ */
+ void sceneEntrySound();
+
+ /**
+ *Sets the AA file to use for the scene
+ */
+ void setAAName();
+
+ /**
+ * Updates the prefix used for getting player sprites for the scene
+ */
+ void setPlayerSpritesPrefix();
+public:
+ Scene2xx(MADSEngine *vm) : PhantomScene(vm) {}
+};
+
+class Scene201 : public Scene2xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _needHoldFl;
+ int _sellerCount;
+ int _sellerStatus;
+ int _sellerFrame;
+ int _raoulFrame;
+ int _raoulStatus;
+
+ void handleSellerAnimation();
+ void handleRaoulAnimation();
+ void handleConversation();
+
+public:
+ Scene201(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene202 : public Scene2xx {
+private:
+ bool _ticketGivenFl;
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _skipWalkFl;
+ int _chandeliersPosX[5];
+ int _chandeliersHotspotId[5];
+ int _conversationCount;
+ int _usherStatus;
+ int _usherFrame;
+ int _usherCount;
+ int _degasStatus;
+ int _degasFrame;
+
+ void handleConversation1();
+ void handleConversation2();
+ void handleUsherAnimation();
+ void handleDegasAnimation();
+ void handleChandeliersPositions();
+
+public:
+ Scene202(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene203 : public Scene2xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ bool _showNoteFl;
+
+ int _brieStatus;
+ int _brieFrame;
+ int _brieCount;
+ int _raoulStatus;
+ int _raoulFrame;
+ int _raoulCount;
+ int _richardStatus;
+ int _richardFrame;
+ int _daaeStatus;
+ int _daaeFrame;
+ int _conversationCount;
+
+ void handleBrieConversation();
+ void handleRichardConversation();
+ void handleRichardAndDaaeConversation();
+ void handleBrieAnimation();
+ void handleRichardAnimation();
+ void handleRaoulAnimation();
+ void handleDaaeAnimation();
+
+public:
+ Scene203(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene204 : public Scene2xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ bool _raoulDown;
+ bool _florentGone;
+ bool _skip1Fl;
+ bool _skip2Fl;
+ bool _skip3Fl;
+ bool _endGameFl;
+
+ int _brieStatus;
+ int _brieFrame;
+ int _florStatus;
+ int _florFrame;
+ int _raoulStatus;
+ int _raoulFrame;
+ int _raoulCount;
+
+ void handleConversation();
+ void handleBrieAnimation();
+ void handleFlorAnimation();
+ void handleRaoulAnimation();
+ void handleEndAnimation();
+
+public:
+ Scene204(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene205 : public Scene2xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _noConversationHold;
+ bool _giveTicketFl;
+
+ int _richardFrame;
+ int _richardStatus;
+ int _richardCount;
+ int _giryFrame;
+ int _giryStatus;
+ int _giryCount;
+ int _conversationCounter;
+ int _lastRandom;
+
+ void handleConversation18();
+ void handleConversation10();
+ void handleConversation11();
+ void handleRichardAnimation();
+ void handleGiryAnimation();
+
+public:
+ Scene205(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene206 : public Scene2xx {
+private:
+ bool _anim0ActvFl;
+ bool _skip1Fl;
+ bool _skip2Fl;
+
+public:
+ Scene206(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene207 : public Scene2xx {
+private:
+ bool _skip1Fl;
+ bool _anim0ActvFl;
+
+public:
+ Scene207(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene208 : public Scene2xx {
+private:
+ bool _skip1Fl;
+ bool _skip2Fl;
+
+ int _topLeftPeopleFrame;
+ int _topRightPeopleFrame;
+ int _middleLeftPeopleFrame;
+ int _centerPeopleFrame;
+ int _middleRightPeopleFrame;
+ int _bottomLeftPeopleFrame;
+ int _bottomMiddlePeopleFrame;
+ int _bottomRightPeopleFrame;
+ int _direction;
+
+ void animateTopLeftPeople();
+ void animateTopRightPeople();
+ void animateMiddleLeftPeople();
+ void animateCenterPeople();
+ void animateMiddleRightPeople();
+ void animateBottomLeftPeople();
+ void animateBottomMiddlePeople();
+ void animateBottomRightPeople();
+
+public:
+ Scene208(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene250 : public Scene2xx {
+public:
+ Scene250(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+} // End of namespace Phantom
+} // End of namespace MADS
+
+#endif /* MADS_PHANTOM_SCENES2_H */
diff --git a/engines/mads/phantom/phantom_scenes3.cpp b/engines/mads/phantom/phantom_scenes3.cpp
new file mode 100644
index 0000000000..33d569dec3
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes3.cpp
@@ -0,0 +1,2774 @@
+/* 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 "common/scummsys.h"
+#include "mads/mads.h"
+#include "mads/conversations.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+#include "mads/phantom/phantom_scenes3.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+void Scene3xx::setAAName() {
+ _game._aaName = Resources::formatAAName(_globals[kTempInterface]);
+ _vm->_palette->setEntry(254, 43, 47, 51);
+}
+
+void Scene3xx::sceneEntrySound() {
+ if (!_vm->_musicFlag)
+ return;
+
+ switch (_scene->_nextSceneId) {
+ case 303:
+ case 304:
+ case 305:
+ case 307:
+ case 308:
+ if (_globals[kKnockedOverHead])
+ _vm->_sound->command(33);
+ else
+ _vm->_sound->command(16);
+ break;
+
+ case 310:
+ case 320:
+ case 330:
+ case 340:
+ _vm->_sound->command(36);
+ break;
+
+ default:
+ if (_scene->_nextSceneId != 306)
+ _vm->_sound->command(16);
+ break;
+ }
+}
+
+void Scene3xx::setPlayerSpritesPrefix() {
+ _vm->_sound->command(5);
+
+ if ((_scene->_nextSceneId == 304) || (_scene->_nextSceneId == 305) || (_scene->_nextSceneId == 306) || (_scene->_nextSceneId == 310))
+ _game._player._spritesPrefix = "";
+ else {
+ Common::String oldName = _game._player._spritesPrefix;
+ if (!_game._player._forcePrefix)
+ _game._player._spritesPrefix = "RAL";
+ if (oldName != _game._player._spritesPrefix)
+ _game._player._spritesChanged = true;
+ }
+
+ _game._player._scalingVelocity = true;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene301::Scene301(MADSEngine *vm) : Scene3xx(vm) {
+ _anim0ActvFl = false;
+ _skip1Fl = false;
+ _skip2Fl = false;
+
+ _lightingHotspotId = -1;
+ _sandbagHotspotId = -1;
+}
+
+void Scene301::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_skip1Fl);
+ s.syncAsByte(_skip2Fl);
+
+ s.syncAsSint16LE(_lightingHotspotId);
+ s.syncAsSint16LE(_sandbagHotspotId);
+}
+
+void Scene301::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene301::enter() {
+ _vm->_disableFastwalk = true;
+
+ _anim0ActvFl = false;
+ _skip2Fl = false;
+ _skip1Fl = false;
+
+ _scene->loadSpeech(6);
+
+ _scene->_hotspots.activate(NOUN_CABLE, false);
+ _scene->_hotspots.activate(NOUN_STOOL, false);
+
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 0));
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('z', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('z', 2));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('z', 3));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('z', 4));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('z', 5));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('z', 6));
+
+ _lightingHotspotId = _scene->_dynamicHotspots.add(NOUN_LIGHTING_INSTRUMENT, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(50, 116, 50 + 19, 116 + 10));
+ _scene->_dynamicHotspots.setPosition(_lightingHotspotId, Common::Point(67, 129), FACING_NORTHWEST);
+ _lightingHotspotId = _scene->_dynamicHotspots.add(NOUN_LIGHTING_INSTRUMENT, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(126, 118, 126 + 29, 118 + 8));
+ _scene->_dynamicHotspots.setPosition(_lightingHotspotId, Common::Point(152, 129), FACING_NORTHWEST);
+
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+
+ _scene->_hotspots.activate(NOUN_CABLE, true);
+ } else {
+ _sandbagHotspotId = _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(464, 114, 464 + 11, 114 + 9));
+ _scene->_dynamicHotspots.setPosition(_sandbagHotspotId, Common::Point(475, 125), FACING_NORTHWEST);
+ _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(468, 42, 468 + 6, 42 + 13));
+ _scene->_hotspots.activate(NOUN_STOOL, true);
+ _scene->_hotspots.activate(NOUN_BIG_PROP, false);
+ }
+
+ if (_scene->_priorSceneId == 302) {
+ _game._player.firstWalk(Common::Point(-20, 132), FACING_WEST, Common::Point(19, 132), FACING_EAST, true);
+ _scene->setCamera(Common::Point(0, 0));
+ } else if ((_scene->_priorSceneId == 106) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(568, 133);
+ _game._player._facing = FACING_WEST;
+ _scene->setCamera(Common::Point(320, 0));
+ }
+
+ if (!_game._visitedScenes._sceneRevisited) {
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 5);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 64);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene301::step() {
+ if ((_globals[kDoneBrieConv203] == 3) && (_scene->_posAdjust.x < 320) && (_game._player._playerPos.x < 350)) {
+ _game._player.cancelCommand();
+ _game._player.walk(Common::Point(256, 130), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(60);
+ _globals[kDoneBrieConv203] = 0;
+ _game._player._stepEnabled = false;
+ }
+
+ if (_game._trigger == 60) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('p', 1), 0);
+ _anim0ActvFl = true;
+ _game._player._visible = false;
+ _globals[kPlayerScore] += 10;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ }
+
+ if (_anim0ActvFl && !_skip1Fl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 50) {
+ _scene->playSpeech(6);
+ _skip1Fl = true;
+ }
+ }
+
+ if (_anim0ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 61) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], 60);
+ if (!_skip2Fl) {
+ _vm->_sound->command(1);
+ _scene->_sequences.addTimer(420, 70);
+ _skip2Fl = true;
+ }
+ }
+ }
+
+ if (_game._trigger == 70) {
+ _scene->_userInterface.noInventoryAnim();
+ // CHECKME: Not sure about the next function call
+ _scene->_userInterface.refresh();
+ _scene->_nextSceneId = 104;
+ }
+
+ if (_game._trigger == 64)
+ _scene->_sequences.addTimer(60, 65);
+
+ if (_game._trigger == 65)
+ _vm->_dialogs->show(30137);
+}
+
+void Scene301::actions() {
+ if (_action.isAction(VERB_CLIMB_DOWN, NOUN_CIRCULAR_STAIRCASE)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 1);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 1:
+ _scene->_nextSceneId = 106;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(30110);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_GRID)) {
+ _vm->_dialogs->show(30111);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CATWALK)) {
+ _vm->_dialogs->show(30112);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SIDE_WALL)) {
+ _vm->_dialogs->show(30113);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BACK_WALL)) {
+ _vm->_dialogs->show(30114);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SUPPORT)) {
+ _vm->_dialogs->show(30115);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ACT_CURTAIN)) {
+ _vm->_dialogs->show(30116);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOUSE)) {
+ _vm->_dialogs->show(30117);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_OTHER_CATWALK)) {
+ _vm->_dialogs->show(30118);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRIDWORK)) {
+ _vm->_dialogs->show(30119);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BEAM_POSITION)) {
+ _vm->_dialogs->show(30120);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHTING_INSTRUMENT)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(30121);
+ else
+ _vm->_dialogs->show(30122);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TARP)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(30123);
+ else
+ _vm->_dialogs->show(30140);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COUNTERWEIGHT_SYSTEM)) {
+ _vm->_dialogs->show(30124);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SANDBAG) && (_action._mainObjectSource == CAT_HOTSPOT)) {
+ _vm->_dialogs->show(30125);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BATTEN)) {
+ _vm->_dialogs->show(30126);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STOOL)) {
+ _vm->_dialogs->show(30127);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HEMP)) {
+ _vm->_dialogs->show(30128);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CIRCULAR_STAIRCASE)) {
+ _vm->_dialogs->show(30129);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CATWALK_OVER_HOUSE)) {
+ _vm->_dialogs->show(30130);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STAIRCASE_POST)) {
+ _vm->_dialogs->show(30131);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAILING)) {
+ _vm->_dialogs->show(30132);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CYCLORAMA)) {
+ _vm->_dialogs->show(30133);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BIG_PROP)) {
+ _vm->_dialogs->show(30134);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PROSCENIUM_ARCH)) {
+ _vm->_dialogs->show(30135);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CABLE)) {
+ _vm->_dialogs->show(30136);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_HEMP)) {
+ _vm->_dialogs->show(30138);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PULL, NOUN_HEMP)) {
+ _vm->_dialogs->show(30141);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_SANDBAG) && (_action._mainObjectSource == CAT_HOTSPOT)) {
+ _vm->_dialogs->show(30139);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_TARP)) {
+ _vm->_dialogs->show(30142);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene301::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CATWALK_OVER_HOUSE))
+ _game._player._walkOffScreenSceneId = 302;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene302::Scene302(MADSEngine *vm) : Scene3xx(vm) {
+}
+
+void Scene302::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+}
+
+void Scene302::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene302::enter() {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RRD_9");
+
+ if (_game._objects.isInRoom(OBJ_BLUE_FRAME)) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else
+ _scene->_hotspots.activate(NOUN_BLUE_FRAME, false);
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ }
+
+ if (_scene->_priorSceneId == 303)
+ _game._player.firstWalk(Common::Point(-20, 134), FACING_WEST, Common::Point(15, 134), FACING_EAST, true);
+ else if ((_scene->_priorSceneId == 301) || (_scene->_priorSceneId != RETURNING_FROM_LOADING))
+ _game._player.firstWalk(Common::Point(340, 134), FACING_WEST, Common::Point(297, 134), FACING_WEST, true);
+
+ sceneEntrySound();
+}
+
+void Scene302::step() {
+}
+
+void Scene302::actions() {
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME) && (_game._objects.isInRoom(OBJ_BLUE_FRAME) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ if (_globals[kCurrentYear] == 1881) {
+ int count = 0;
+ if (_game._objects.isInInventory(OBJ_YELLOW_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_RED_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_GREEN_FRAME))
+ ++count;
+ if (count < 3)
+ _globals[kPlayerScore] += 5;
+ }
+
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_hotspots.activate(NOUN_BLUE_FRAME, false);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 844, 0);
+ else
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(30210);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_CATWALK)) {
+ _vm->_dialogs->show(30211);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRID)) {
+ _vm->_dialogs->show(30212);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HEMP)) {
+ _vm->_dialogs->show(30213);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SIDE_WALL)) {
+ _vm->_dialogs->show(30214);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CATWALK)) {
+ _vm->_dialogs->show(30215);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAILING)) {
+ _vm->_dialogs->show(30216);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BEAM_POSITION)) {
+ _vm->_dialogs->show(30217);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LIGHTING_INSTRUMENT)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(30218);
+ else
+ _vm->_dialogs->show(30219);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && _game._objects.isInRoom(OBJ_BLUE_FRAME)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(30220);
+ else
+ _vm->_dialogs->show(30221);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SUPPORT)) {
+ _vm->_dialogs->show(30222);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_OTHER_CATWALK)) {
+ _vm->_dialogs->show(30223);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_HEMP)) {
+ _vm->_dialogs->show(30224);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PULL, NOUN_HEMP)) {
+ _vm->_dialogs->show(30141);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene302::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CATWALK)) {
+ if (_scene->_customDest.x > 160)
+ _game._player._walkOffScreenSceneId = 301;
+ else
+ _game._player._walkOffScreenSceneId = 303;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene303::Scene303(MADSEngine *vm) : Scene3xx(vm) {
+ _anim0ActvFl = false;
+ _hempHotspotId = -1;
+ _skipFrameCheckFl = -1;
+}
+
+void Scene303::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsSint16LE(_hempHotspotId);
+ s.syncAsSint16LE(_skipFrameCheckFl);
+}
+
+void Scene303::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_CHANDELIER_CABLE);
+ _scene->addActiveVocab(VERB_CLIMB_DOWN);
+}
+
+void Scene303::enter() {
+ _anim0ActvFl = false;
+ _skipFrameCheckFl = false;
+
+ if (_globals[kRightDoorIsOpen504])
+ _vm->_gameConv->get(26);
+
+ if (_globals[kCurrentYear] == 1993) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ }
+
+ if ((_game._objects.isInRoom(OBJ_LARGE_NOTE)) && (_globals[kCurrentYear] == 1993)) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4);
+ } else
+ _scene->_hotspots.activate(NOUN_LARGE_NOTE, false);
+
+ if (_globals[kCurrentYear] == 1993)
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ else {
+ _hempHotspotId = _scene->_dynamicHotspots.add(NOUN_CHANDELIER_CABLE, VERB_CLIMB_DOWN, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(74, 92, 74 + 7, 92 + 12));
+ _scene->_dynamicHotspots.setPosition(_hempHotspotId, Common::Point(95, 107), FACING_NORTHWEST);
+ _scene->_dynamicHotspots[_hempHotspotId]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setCursor(_hempHotspotId, CURSOR_GO_DOWN);
+ }
+
+ if (_scene->_priorSceneId == 307)
+ _game._player.firstWalk(Common::Point(-20, 135), FACING_EAST, Common::Point(16, 135), FACING_EAST, true);
+ else if (_scene->_priorSceneId == 304) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 1), 60);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ } else if (_scene->_priorSceneId == 305) {
+ _game._objects.addToInventory(OBJ_SWORD);
+ _game._player._playerPos = Common::Point(117, 92);
+ _game._player._facing = FACING_SOUTHWEST;
+ } else if ((_scene->_priorSceneId == 302) || (_scene->_priorSceneId != RETURNING_FROM_LOADING))
+ _game._player.firstWalk(Common::Point(340, 136), FACING_WEST, Common::Point(303, 136), FACING_WEST, true);
+
+ _scene->_rails.disableLine(5, 9);
+ _scene->_rails.disableLine(5, 12);
+ _scene->_rails.disableLine(5, 8);
+ _scene->_rails.disableLine(6, 3);
+ _scene->_rails.disableLine(6, 2);
+ _scene->_rails.disableLine(11, 3);
+ _scene->_rails.disableLine(11, 4);
+ _scene->_rails.disableLine(10, 2);
+ _scene->_rails.disableLine(4, 9);
+ _scene->_rails.disableLine(8, 0);
+
+ sceneEntrySound();
+}
+
+void Scene303::step() {
+ if (_game._trigger == 60) {
+ _game._player._playerPos = Common::Point(110, 95);
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _game._player.resetFacing(FACING_SOUTHWEST);
+ }
+
+ if (_anim0ActvFl) {
+ if ((_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() >= 6) && !_skipFrameCheckFl) {
+ _skipFrameCheckFl = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_hotspots.activate(NOUN_LARGE_NOTE, false);
+ _game._objects.addToInventory(OBJ_LARGE_NOTE);
+ _vm->_sound->command(26);
+ }
+ }
+}
+
+void Scene303::actions() {
+ if ((_action.isAction(VERB_TAKE, NOUN_LARGE_NOTE) && _game._objects.isInRoom(OBJ_LARGE_NOTE)) || ((_game._trigger > 0) && _game._trigger < 3)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('n', 1), 1);
+ _anim0ActvFl = true;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ _globals[kPlayerScore] += 5;
+ break;
+
+ case 1:
+ _anim0ActvFl = false;
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->_sequences.addTimer(20, 2);
+ break;
+
+ case 2:
+ _vm->_dialogs->showItem(OBJ_LARGE_NOTE, 818, 7);
+ _game._player._stepEnabled = true;
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_INTO, NOUN_HOLE) || _action.isAction(VERB_CLIMB_DOWN, NOUN_CHANDELIER_CABLE)) {
+ if (_globals[kCurrentYear] == 1881) {
+ switch (_game._trigger) {
+ case 0:
+ if (_globals[kRightDoorIsOpen504])
+ _vm->_dialogs->show(30331);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 3);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ break;
+
+ case 3:
+ _scene->_nextSceneId = 304;
+ break;
+
+ default:
+ break;
+ }
+ } else
+ _vm->_dialogs->show(30325);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CATWALK)) {
+ if (_globals[kRightDoorIsOpen504]) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(74);
+ else
+ _scene->playSpeech(1);
+
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(4);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(30310);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ // CHECKME: That's illogical, the check is always false... Should be out of the big 'look' check
+ // It looks to me like an original bug
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CATWALK)) {
+ _vm->_dialogs->show(30316);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CATWALK)) {
+ _vm->_dialogs->show(30311);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRID)) {
+ _vm->_dialogs->show(30312);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHANDELIER_CABLE)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(30317);
+ else if (_globals[kRightDoorIsOpen504])
+ _vm->_dialogs->show(30330);
+ else
+ _vm->_dialogs->show(30329);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HEMP)) {
+ _vm->_dialogs->show(30313);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BACK_WALL)) {
+ _vm->_dialogs->show(30314);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DUCTWORK)) {
+ _vm->_dialogs->show(30315);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CRATE)) {
+ _vm->_dialogs->show(30318);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SUPPORT)) {
+ _vm->_dialogs->show(30319);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PIECE_OF_WOOD)) {
+ _vm->_dialogs->show(30320);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAILING)) {
+ _vm->_dialogs->show(30321);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHANDELIER_TRAP)) {
+ _vm->_dialogs->show(30322);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOLE)) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(30326);
+ else
+ _vm->_dialogs->show(30323);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LARGE_NOTE) && _game._objects.isInRoom(OBJ_LARGE_NOTE)) {
+ _vm->_dialogs->show(30324);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_TO, NOUN_HOLE)) {
+ _vm->_dialogs->show(30325);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_HEMP)) {
+ _vm->_dialogs->show(30327);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PULL, NOUN_HEMP)) {
+ _vm->_dialogs->show(30141);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene303::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CATWALK) && !_globals[kRightDoorIsOpen504]) {
+ if (_scene->_customDest.x > 160)
+ _game._player._walkOffScreenSceneId = 302;
+ else
+ _game._player._walkOffScreenSceneId = 307;
+ }
+
+ if (_action.isAction(VERB_CLIMB_INTO, NOUN_HOLE) || _action.isAction(VERB_CLIMB_DOWN, NOUN_CHANDELIER_CABLE))
+ _game._player.walk(Common::Point(110, 95), FACING_SOUTHWEST);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene304::Scene304(MADSEngine *vm) : Scene3xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+
+ _raoulFrame = -1;
+ _raoulStatus = -1;
+ _fightFrame = -1;
+ _fightStatus = -1;
+ _fightCount = -1;
+ _phantomFrame = -1;
+ _phantomStatus = -1;
+}
+
+void Scene304::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+
+ s.syncAsSint16LE(_raoulFrame);
+ s.syncAsSint16LE(_raoulStatus);
+ s.syncAsSint16LE(_fightFrame);
+ s.syncAsSint16LE(_fightStatus);
+ s.syncAsSint16LE(_fightCount);
+ s.syncAsSint16LE(_phantomFrame);
+ s.syncAsSint16LE(_phantomStatus);
+}
+
+void Scene304::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene304::enter() {
+ _game._player._playerPos.x = 0;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ }
+
+ if (_globals[kRightDoorIsOpen504])
+ _vm->_gameConv->get(23);
+
+ if (!_globals[kRightDoorIsOpen504]) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('n', 1), 0);
+ _anim0ActvFl = true;
+ _raoulStatus = 1;
+ _game._player._stepEnabled = false;
+ } else {
+ _scene->_userInterface.setup(kInputLimitedSentences);
+
+ if (_scene->_priorSceneId == 305) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+
+ _game._player._stepEnabled = false;
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('f', 1), 0);
+ _anim1ActvFl = true;
+ _scene->setAnimFrame(_globals._animationIndexes[1], 138);
+
+ } else {
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('f', 1), 0);
+ _anim1ActvFl = true;
+ _phantomStatus = 0;
+
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ _anim2ActvFl = true;
+ _fightStatus = 0;
+
+ _game._player._stepEnabled = false;
+ _fightCount = 0;
+
+ _globals[kPlayerScore] += 10;
+
+ _vm->_gameConv->run(23);
+ _vm->_gameConv->hold();
+ }
+ }
+
+
+ if ((_scene->_priorSceneId == RETURNING_FROM_LOADING) && !_globals[kRightDoorIsOpen504]) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], 53);
+ _game._player._stepEnabled = true;
+ }
+
+ _game._player._visible = false;
+
+ sceneEntrySound();
+}
+
+void Scene304::step() {
+ if (_anim0ActvFl)
+ handleRaoulAnimation();
+
+ if (_anim1ActvFl)
+ handlePhantomAnimation();
+
+ if (_anim2ActvFl)
+ handleFightAnimation();
+}
+
+void Scene304::actions() {
+ if (_vm->_gameConv->_running == 23) {
+ handleConversation23();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_OPENING) || _action.isAction(VERB_CLIMB, NOUN_CHANDELIER_CABLE)) {
+ _raoulStatus = 0;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(30410);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(30411);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOME)) {
+ _vm->_dialogs->show(30412);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LATTICEWORK)) {
+ _vm->_dialogs->show(30413);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_OPENING)) {
+ _vm->_dialogs->show(30414);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHANDELIER)) {
+ _vm->_dialogs->show(30415);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHANDELIER_CABLE)) {
+ _vm->_dialogs->show(30416);
+ _action._inProgress = false;
+ return;
+ }
+ }
+}
+
+void Scene304::preActions() {
+}
+
+void Scene304::handleConversation23() {
+ switch (_action._activeAction._verbId) {
+ case 5:
+ _phantomStatus = 1;
+ _vm->_gameConv->hold();
+ break;
+
+ case 6:
+ if (_phantomStatus != 1)
+ _fightStatus = 0;
+
+ _vm->_gameConv->hold();
+ break;
+
+ case 9:
+ if (_phantomStatus != 1)
+ _fightStatus = 2;
+
+ break;
+
+ case 12:
+ _phantomStatus = 2;
+ break;
+
+ default:
+ break;
+ }
+
+ _fightCount = 0;
+}
+
+void Scene304::handleRaoulAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _raoulFrame)
+ return;
+
+ _raoulFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_raoulFrame) {
+ case 20:
+ _game._player._stepEnabled = true;
+ resetFrame = 53;
+ break;
+
+ case 53:
+ _scene->_nextSceneId = 303;
+ break;
+
+ case 54:
+ case 55:
+ case 56:
+ if (_raoulStatus == 0) {
+ resetFrame = 20;
+ _game._player._stepEnabled = false;
+ } else {
+ int random = _vm->getRandomNumber(1, 50);
+ switch (_raoulFrame) {
+ case 54:
+ if (random == 1)
+ resetFrame = 54;
+ else if (random == 2)
+ resetFrame = 55;
+ else
+ resetFrame = _raoulFrame - 1;
+
+ break;
+
+ case 55:
+ if (random == 1)
+ resetFrame = 54;
+ else if (random == 2)
+ resetFrame = 53;
+ else
+ resetFrame = _raoulFrame - 1;
+
+ break;
+
+ case 56:
+ if (random == 1)
+ resetFrame = 55;
+ else if (random == 2)
+ resetFrame = 53;
+ else
+ resetFrame = _raoulFrame - 1;
+
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+void Scene304::handlePhantomAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _phantomFrame)
+ return;
+
+ _phantomFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_phantomFrame) {
+ case 7:
+ case 11:
+ resetFrame = _vm->getRandomNumber(6, 7);
+
+ if (_phantomStatus == 1)
+ resetFrame = 7;
+
+ break;
+
+ case 9:
+ case 15:
+ switch (_vm->getRandomNumber(1, 3)) {
+ case 1:
+ resetFrame = 8;
+ break;
+
+ case 2:
+ resetFrame = 9;
+ break;
+
+ case 3:
+ resetFrame = 11;
+ break;
+ }
+
+ if (_phantomStatus == 1)
+ resetFrame = 11;
+
+ break;
+
+ case 13:
+ case 24:
+ switch (_vm->getRandomNumber(1, 3)) {
+ case 1:
+ resetFrame = 12;
+ break;
+
+ case 2:
+ resetFrame = 13;
+ break;
+
+ case 3:
+ resetFrame = 16;
+ break;
+ }
+
+ if (_phantomStatus == 1)
+ resetFrame = 16;
+
+ break;
+
+ case 20:
+ if (_vm->getRandomNumber(1, 2) == 1)
+ resetFrame = 19;
+ else
+ resetFrame = 20;
+
+ if (_phantomStatus == 1)
+ resetFrame = 24;
+
+ break;
+
+ case 25:
+ _vm->_gameConv->release();
+ break;
+
+ case 47:
+ _fightStatus = 0;
+ break;
+
+ case 59:
+ if (_phantomStatus == 2)
+ resetFrame = 59;
+ else
+ resetFrame = 58;
+ break;
+
+ case 60:
+ _game._player._stepEnabled = false;
+ break;
+
+ case 80:
+ _game._objects.setRoom(OBJ_SWORD, NOWHERE);
+ break;
+
+ case 137:
+ _game._player._playerPos.x = 100;
+ _scene->_nextSceneId = 305;
+ break;
+
+ case 176:
+ _game._player._playerPos.x = 200;
+ _scene->_nextSceneId = 305;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _phantomFrame = resetFrame;
+ }
+}
+
+void Scene304::handleFightAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame() == _fightFrame)
+ return;
+
+ _fightFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_fightFrame) {
+ case 22:
+ _vm->_gameConv->release();
+ break;
+
+ case 23:
+ if (_fightStatus != 2)
+ resetFrame = 22;
+ break;
+
+ case 25:
+ case 26:
+ case 27:
+ if (_fightStatus == 2) {
+ resetFrame = _vm->getRandomNumber(24, 26);
+ ++_fightCount;
+ if (_fightCount > 17)
+ resetFrame = 24;
+ }
+ break;
+
+ case 28:
+ _fightStatus = 2;
+ break;
+
+ case 45:
+ _vm->_gameConv->release();
+ break;
+
+ case 46:
+ case 47:
+ case 48:
+ if (_fightStatus == 2) {
+ resetFrame = _vm->getRandomNumber(45, 47);
+ ++_fightCount;
+ if (_fightCount > 17)
+ resetFrame = 45;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], resetFrame);
+ _fightFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene305::Scene305(MADSEngine *vm) : Scene3xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _skipFl = false;
+ _unmaskFl = false;
+
+ _unmaskFrame = -1;
+}
+
+void Scene305::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_skipFl);
+ s.syncAsByte(_unmaskFl);
+
+ s.syncAsSint16LE(_unmaskFrame);
+}
+
+void Scene305::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene305::enter() {
+ _unmaskFl = false;
+ _skipFl = false;
+ _game._player._visible = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+
+ _scene->_userInterface.setup(kInputLimitedSentences);
+ _scene->loadSpeech(5);
+ _game.loadQuoteSet(0x64, 0x65, 0);
+
+ if (_game._player._playerPos.x == 100) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 60);
+ _scene->_hotspots.activate(NOUN_MASK, false);
+ _anim1ActvFl = true;
+ } else if (_game._player._playerPos.x == 200) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 1), 0);
+ _anim0ActvFl = true;
+ _scene->_hotspots.activate(NOUN_CANE, false);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene305::step() {
+ if (_anim0ActvFl)
+ handle_animation_unmask ();
+
+ if (_anim1ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 53)
+ _game._player._stepEnabled = false;
+
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 54 && !_skipFl) {
+ _scene->playSpeech(5);
+ _skipFl = true;
+ }
+ }
+
+ if (_game._trigger == 60) {
+ _globals[kPlayerScore] -= 10;
+ _scene->_userInterface.noInventoryAnim();
+ // CHECKME: Not sure about the next function call
+ _scene->_userInterface.refresh();
+ _scene->_nextSceneId = 303;
+ }
+}
+
+void Scene305::actions() {
+ if (_action.isAction(VERB_PUSH, NOUN_CANE)) {
+ _scene->_nextSceneId = 304;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_MASK)) {
+ _unmaskFl = true;
+ _game._player._stepEnabled = false;
+ _action._inProgress = false;
+ }
+}
+
+void Scene305::preActions() {
+}
+
+void Scene305::handle_animation_unmask() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _unmaskFrame)
+ return;
+
+ _unmaskFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_unmaskFrame) {
+ case 25:
+ if (!_unmaskFl)
+ resetFrame = 0;
+
+ break;
+
+ case 60:
+ _scene->playSpeech(10);
+ _scene->_kernelMessages.add(Common::Point(176, 53), 0x1110, 0, 0, 360, _game.getQuote(0x64));
+ _scene->_kernelMessages.add(Common::Point(176, 68), 0x1110, 0, 0, 360, _game.getQuote(0x65));
+ break;
+
+ case 95:
+ _scene->_nextSceneId = 306;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _unmaskFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene306::Scene306(MADSEngine *vm) : Scene3xx(vm) {
+ _speechDoneFl = false;
+}
+
+void Scene306::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsByte(_speechDoneFl);
+}
+
+void Scene306::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene306::enter() {
+ _scene->loadSpeech(6);
+ _speechDoneFl = false;
+
+ warning("TODO: Switch to letter box view. See definition of MADS_MENU_Y");
+
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('a', 1), 60);
+
+ sceneEntrySound();
+}
+
+void Scene306::step() {
+ if (_game._trigger == 60) {
+ if (_vm->_sound->_preferRoland)
+ _scene->_sequences.addTimer(120, 61);
+ else
+ _scene->_sequences.addTimer(300, 61);
+ }
+
+ if (!_speechDoneFl && (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 3)) {
+ _scene->playSpeech(6);
+ _speechDoneFl = true;
+ }
+
+ if (_game._trigger == 61) {
+ _vm->_sound->command(1);
+ _vm->_sound->command(66);
+ _scene->_sequences.addTimer(120, 62);
+ }
+
+ if (_game._trigger == 62)
+ _scene->_nextSceneId = 150;
+}
+
+void Scene306::actions() {
+}
+
+void Scene306::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene307::Scene307(MADSEngine *vm) : Scene3xx(vm) {
+}
+
+void Scene307::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+}
+
+void Scene307::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene307::enter() {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RDR_9");
+
+ if (_globals[kRightDoorIsOpen504])
+ _scene->_hotspots.activate(NOUN_DOOR, true);
+ else
+ _scene->_hotspots.activate(NOUN_DOOR, false);
+
+ if (_game._objects.isInRoom(OBJ_GREEN_FRAME) && (_game._difficulty == DIFFICULTY_EASY)) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ } else
+ _scene->_hotspots.activate(NOUN_GREEN_FRAME, false);
+
+ if (_scene->_priorSceneId == 308) {
+ _game._player._playerPos = Common::Point(18, 134);
+ _game._player._facing = FACING_SOUTHEAST;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -2);
+ if (!(_globals[kPlayerScoreFlags] & 16)) {
+ _globals[kPlayerScoreFlags] |= 16;
+ _globals[kPlayerScore] += 5;
+ }
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4);
+ _game._player.walk(Common::Point(41, 137), FACING_EAST);
+ _game._player.setWalkTrigger(60);
+ } else if ((_scene->_priorSceneId == 303) || (_scene->_priorSceneId != RETURNING_FROM_LOADING))
+ _game._player.firstWalk(Common::Point(340, 137), FACING_WEST, Common::Point(304, 137), FACING_WEST, true);
+
+ sceneEntrySound();
+}
+
+void Scene307::step() {
+ switch (_game._trigger) {
+ case 60:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ break;
+
+ case 61:
+ _vm->_sound->command(25);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene307::actions() {
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME) && (_game._objects.isInRoom(OBJ_GREEN_FRAME) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ if (_globals[kCurrentYear] == 1881) {
+ int count = 0;
+ if (_game._objects.isInInventory(OBJ_YELLOW_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_RED_FRAME))
+ ++count;
+ if (_game._objects.isInInventory(OBJ_BLUE_FRAME))
+ ++count;
+
+ if (count < 3)
+ _globals[kPlayerScore] += 5;
+ }
+
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_hotspots.activate(NOUN_GREEN_FRAME, false);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ if (_globals[kCurrentYear] == 1881)
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 845, 0);
+ else
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[4] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[4], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[4], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 4, 70);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 72);
+ break;
+
+ case 70:
+ _vm->_sound->command(24);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ break;
+
+ case 71: {
+ int idx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.addTimer(10, 73);
+ }
+ break;
+
+ case 72:
+ _game._player._visible = true;
+ break;
+
+ case 73:
+ _scene->_nextSceneId = 308;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(30710);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_COLUMN)) {
+ if (_globals[kRightDoorIsOpen504])
+ _vm->_dialogs->show(30725);
+ else
+ _vm->_dialogs->show(30711);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CATWALK)) {
+ _vm->_dialogs->show(30712);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRID)) {
+ _vm->_dialogs->show(30713);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GIRDER)) {
+ _vm->_dialogs->show(30714);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRIDWORK)) {
+ _vm->_dialogs->show(30715);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HEMP)) {
+ _vm->_dialogs->show(30716);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BACK_WALL)) {
+ _vm->_dialogs->show(30717);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DUCTWORK)) {
+ _vm->_dialogs->show(30718);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isObject(NOUN_GREEN_FRAME)) && (_game._objects.isInRoom(OBJ_GREEN_FRAME))) {
+ if (_globals[kCurrentYear] == 1993)
+ _vm->_dialogs->show(30719);
+ else
+ _vm->_dialogs->show(30720);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ALCOVE)) {
+ _vm->_dialogs->show(30721);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAILING)) {
+ _vm->_dialogs->show(30722);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(30726);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_HEMP)) {
+ _vm->_dialogs->show(30723);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PULL, NOUN_HEMP)) {
+ _vm->_dialogs->show(30141);
+ _action._inProgress = false;
+ }
+}
+
+void Scene307::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_ALCOVE))
+ _game._player._walkOffScreenSceneId = 303;
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR))
+ _game._player.walk(Common::Point(28, 137), FACING_NORTHWEST);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene308::Scene308(MADSEngine *vm) : Scene3xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _skip1Fl = false;
+ _skip2Fl = false;
+
+ _currentFloor = -1;
+}
+
+void Scene308::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+ s.syncAsByte(_skip1Fl);
+ s.syncAsByte(_skip2Fl);
+
+ s.syncAsSint16LE(_currentFloor);
+}
+
+void Scene308::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene308::enter() {
+ _scene->loadSpeech(4);
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ }
+
+ _skip1Fl = false;
+ _skip2Fl = false;
+
+ _vm->_gameConv->get(26);
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0));
+ _scene->_userInterface.setup(kInputLimitedSentences);
+ _game._player._visible = false;
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ switch (_currentFloor) {
+ case 1:
+ if (_globals[kRightDoorIsOpen504]) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], Common::Point(160, 104));
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(161, 124));
+ } else {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], Common::Point(160, 127));
+ }
+ break;
+
+ case 2:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], Common::Point(160, 76));
+ break;
+
+ case 3:
+ if (_globals[kRightDoorIsOpen504] && !_globals[kKnockedOverHead]) {
+ _anim0ActvFl = true;
+ _skip1Fl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 2), 2);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 76);
+ } else {
+ _anim0ActvFl = true;
+ _skip1Fl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 2), 2);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 96);
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else if (_scene->_priorSceneId == 309) {
+ _currentFloor = 1;
+ if (_globals[kRightDoorIsOpen504]) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], Common::Point(160, 104));
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(161, 124));
+ } else {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], Common::Point(160, 127));
+ }
+ } else if (_scene->_priorSceneId == 206) {
+ _currentFloor = 2;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], Common::Point(160, 76));
+ } else if (_scene->_priorSceneId == 307) {
+ _currentFloor = 3;
+ _anim0ActvFl = true;
+ _skip1Fl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 2), 2);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 96);
+ }
+
+ if (!_game._visitedScenes._sceneRevisited) {
+ _globals[kPlayerScore] += 5;
+ _scene->_sequences.addTimer(1, 60);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene308::step() {
+ if (_game._trigger == 60)
+ _vm->_dialogs->show(30810);
+
+ if (_anim2ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 77) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], 76);
+ if (!_skip1Fl) {
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->show(30811);
+ _skip1Fl = true;
+ }
+ }
+ }
+
+ if (_anim0ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 97) {
+ if (_globals[kTopFloorLocked]) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], 96);
+ if (!_skip1Fl) {
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->show(30811);
+ _skip1Fl = true;
+ }
+ }
+ } else if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 116) {
+ _globals[kTopFloorLocked] = true;
+ _scene->_nextSceneId = 307;
+ }
+ }
+
+ if (_anim1ActvFl) {
+ if ((_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 51) && _globals[kTopFloorLocked]) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], 50);
+ if (!_skip1Fl) {
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->show(30811);
+ _skip1Fl = true;
+ }
+ }
+ }
+}
+
+void Scene308::actions() {
+ switch (_game._trigger) {
+ case 1:
+ _scene->_nextSceneId = 206;
+ _action._inProgress = false;
+ return;
+
+ case 2:
+ _scene->_nextSceneId = 307;
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ _scene->_nextSceneId = 309;
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MIDDLE_LEVEL)) {
+ switch (_currentFloor) {
+ case 1:
+ if (_globals[kRightDoorIsOpen504]) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 1), 1);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _game._player._stepEnabled = false;
+ } else {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 1), 1);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _game._player._stepEnabled = false;
+ }
+ _action._inProgress = false;
+ return;
+
+ case 2:
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('m', 1), 1);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _game._player._stepEnabled = false;
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ if (_globals[kRightDoorIsOpen504] && !_globals[kKnockedOverHead]) {
+ _scene->freeAnimation(_globals._animationIndexes[0]);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 4), 1);
+ _game._player._stepEnabled = false;
+ _anim2ActvFl = false;
+
+ } else {
+ _scene->freeAnimation(_globals._animationIndexes[0]);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('x', 1), 1);
+ _game._player._stepEnabled = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ }
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_UPPER_LEVEL)) {
+ switch (_currentFloor) {
+ case 1:
+ if (_globals[kRightDoorIsOpen504]) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 2), 1);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _game._player._stepEnabled = false;
+ _anim2ActvFl = true;
+ _currentFloor = 3;
+ } else {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 2), 2);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _game._player._stepEnabled = false;
+ _anim0ActvFl = true;
+ _currentFloor = 3;
+ }
+ _action._inProgress = false;
+ return;
+
+ case 2:
+ if (_globals[kRightDoorIsOpen504]) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 3), 2);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _game._player._stepEnabled = false;
+ } else {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('u', 3), 2);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _game._player._stepEnabled = false;
+ _anim1ActvFl = true;
+ _currentFloor = 3;
+ }
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ if (_globals[kRightDoorIsOpen504])
+ _globals[kTopFloorLocked] = false;
+ else {
+ _skip2Fl = false;
+ _skip1Fl = false;
+ }
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_LOWER_LEVEL)) {
+ switch (_currentFloor) {
+ case 1:
+ if (_globals[kRightDoorIsOpen504]) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(1);
+ } else {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 3);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _game._player._stepEnabled = false;
+ }
+ _action._inProgress = false;
+ return;
+
+ case 2:
+ if (_globals[kRightDoorIsOpen504]) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(74);
+ else
+ _scene->playSpeech(1);
+
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(6);
+
+ } else {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 3);
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _game._player._stepEnabled = false;
+ }
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ if (_globals[kRightDoorIsOpen504] && !_globals[kKnockedOverHead]) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(5);
+ } else if (_globals[kRightDoorIsOpen504] && _globals[kKnockedOverHead]) {
+ if (_vm->_sound->_preferRoland)
+ _vm->_sound->command(74);
+ else
+ _scene->playSpeech(1);
+
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(6);
+ } else {
+ _scene->freeAnimation(_globals._animationIndexes[0]);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('x', 2), 3);
+ _game._player._stepEnabled = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ }
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Scene308::preActions() {
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene309::Scene309(MADSEngine *vm) : Scene3xx(vm) {
+ _anim0ActvFl = false;
+
+ _boatStatus = -1;
+ _boatFrame = -1;
+ _talkCount = -1;
+}
+
+void Scene309::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+
+ s.syncAsSint16LE(_boatStatus);
+ s.syncAsSint16LE(_boatFrame);
+ s.syncAsSint16LE(_talkCount);
+}
+
+void Scene309::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kRightDoorIsOpen504])
+ _scene->_variant = 1;
+}
+
+void Scene309::enter() {
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+ _scene->_hotspots.activate(NOUN_BOAT, false);
+
+ _anim0ActvFl = false;
+ _boatStatus = 1;
+ _vm->_gameConv->get(26);
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RDR_9");
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+
+ if (_game._visitedScenes.exists(310)) {
+ _anim0ActvFl = true;
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 1), 70);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 184);
+ int id = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(id, Common::Point(62, 146), FACING_NORTHWEST);
+ _scene->_dynamicHotspots[id]._articleNumber = PREP_ON;
+
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 10);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 11);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 12);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 13);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 14);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 15);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 16);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 17);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 18);
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _scene->_hotspots.activate(NOUN_BOAT, true);
+ }
+ }
+
+ if (_scene->_priorSceneId == 404) {
+ _game._player._playerPos = Common::Point(319, 136);
+ _game._player._facing = FACING_SOUTHWEST;
+ _game._player.walk(Common::Point(281, 148), FACING_SOUTHWEST);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ } else if (_scene->_priorSceneId == 310) {
+ _game._player._playerPos = Common::Point(209, 144);
+ _game._player._facing = FACING_SOUTH;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _anim0ActvFl = true;
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 1), 70);
+ int id = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(id, Common::Point(63, 146), FACING_NORTHWEST);
+ _scene->_dynamicHotspots[id]._articleNumber = PREP_ON;
+
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 10);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 11);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 12);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 13);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 14);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 15);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 16);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 17);
+ _scene->setDynamicAnim(id, _globals._animationIndexes[0], 18);
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _scene->_hotspots.activate(NOUN_BOAT, true);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ } else if ((_scene->_priorSceneId == 308) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(0, 121);
+ _game._player._facing = FACING_SOUTHEAST;
+ _game._player.walk(Common::Point(28, 142), FACING_SOUTHEAST);
+ _game._player.setWalkTrigger(65);
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene309::step() {
+ if (_anim0ActvFl)
+ handleBoatAnimation ();
+
+ switch (_game._trigger) {
+ case 65:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ break;
+
+ case 66:
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 10);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene309::actions() {
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_STONE_ARCHWAY)) {
+ if (_globals[kRightDoorIsOpen504]) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(1);
+ _boatStatus = 0;
+ _talkCount = 0;
+ } else if (_globals[kLanternStatus] == 1)
+ _game.enterCatacombs(false);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_CHRISTINE)) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(1);
+ _boatStatus = 0;
+ _talkCount = 0;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 4, 60);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 62);
+ break;
+
+ case 60:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ _vm->_sound->command(24);
+ break;
+
+ case 61: {
+ int idx = _globals._sequenceIndexes[0];
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[0], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _game._player.walk(Common::Point(0, 121), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(63);
+ }
+ break;
+
+ case 62:
+ _game._player._visible = true;
+ break;
+
+ case 63:
+ if (!_globals[kRightDoorIsOpen504]) {
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 64);
+ _vm->_sound->command(25);
+ } else
+ _scene->setAnimFrame(_globals._animationIndexes[0], 186);
+
+ break;
+
+ case 64:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1);
+ _scene->_nextSceneId = 308;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(30910);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_STONE_WALL)) {
+ _vm->_dialogs->show(30911);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LAKE)) {
+ _vm->_dialogs->show(30912);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STONE_COLUMN)) {
+ _vm->_dialogs->show(30913);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOORWAY)) {
+ _vm->_dialogs->show(30914);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STONE_ARCHWAY)) {
+ _vm->_dialogs->show(30915);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STONE_FLOOR)) {
+ _vm->_dialogs->show(30916);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CATACOMBS)) {
+ _vm->_dialogs->show(30917);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHRISTINE)) {
+ _vm->_dialogs->show(30919);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOAT)) {
+ _vm->_dialogs->show(30921);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_CLIMB_INTO, NOUN_BOAT)) {
+ _vm->_dialogs->show(30920);
+ _action._inProgress = false;
+ }
+}
+
+void Scene309::preActions() {
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_STONE_ARCHWAY) && (_globals[kLanternStatus] == 0)) {
+ _game._player._needToWalk = false;
+ _vm->_dialogs->show(30918);
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_STONE_ARCHWAY) && _globals[kRightDoorIsOpen504])
+ _game._player.walk(Common::Point(285, 147), FACING_NORTHEAST);
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR))
+ _game._player.walk(Common::Point(16, 139), FACING_NORTHEAST);
+}
+
+void Scene309::handleBoatAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _boatFrame)
+ return;
+
+ _boatFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+
+ switch (_boatFrame) {
+ case 72:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _game._player._visible = true;
+ break;
+
+ case 130:
+ _game._player._stepEnabled = true;
+ break;
+
+ case 185:
+ if (_boatStatus == 0)
+ resetFrame = 244;
+ else
+ resetFrame = 184;
+
+ break;
+
+ case 244:
+ _scene->_nextSceneId = 308;
+ break;
+
+ case 245:
+ case 246:
+ case 247:
+ resetFrame = _vm->getRandomNumber(244, 246);
+ ++_talkCount;
+ if (_talkCount > 10) {
+ resetFrame = 184;
+ _boatStatus = 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _boatFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene310::Scene310(MADSEngine *vm) : Scene3xx(vm) {
+ _raoulMessageColor = -1;
+ _chrisMessageColor = -1;
+ _lakeFrame = -1;
+ for (int i = 0; i < 4; i++)
+ _multiplanePosX[i] = -1;
+}
+
+void Scene310::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsSint16LE(_raoulMessageColor);
+ s.syncAsSint16LE(_chrisMessageColor);
+ s.syncAsSint16LE(_lakeFrame);
+ for (int i = 0; i < 4; i++)
+ s.syncAsSint16LE(_multiplanePosX[i]);
+}
+
+void Scene310::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene310::enter() {
+ warning("TODO: Switch to letter box view. See definition of MADS_MENU_Y");
+
+ for (int i = 0; i < 4; i++) {
+ _globals._spriteIndexes[i] = _scene->_sprites.addSprites(formAnimName('f', i));
+ _globals._sequenceIndexes[i] = -1;
+ }
+
+ _multiplanePosX[0] = 100;
+ _multiplanePosX[1] = 210;
+ _multiplanePosX[2] = 320;
+ _multiplanePosX[3] = 472;
+
+ _game.loadQuoteSet(0x66, 0x67, 0x69, 0x6A, 0x6C, 0x6D, 0x6E, 0x6F, 0x71, 0x72, 0x74, 0x70, 0x68, 0x73, 0x6B, 0);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 80);
+ _scene->_animation[_globals._animationIndexes[0]]->_canChangeView = true;
+ _game._camX._manualFl = true;
+
+ _raoulMessageColor = 0x102;
+ _chrisMessageColor = 0x1110;
+
+ _scene->_userInterface.emptyConversationList();
+ _scene->_userInterface.setup(kInputConversation);
+
+ sceneEntrySound();
+}
+
+void Scene310::step() {
+ handleLakeAnimation();
+
+ if (_game._trigger == 80)
+ _scene->_nextSceneId = 309;
+
+ bool positionsSetFl = false;
+
+ if (_globals._animationIndexes[0] >= 0) {
+ MADS::Animation *anim = _scene->_animation[_globals._animationIndexes[0]];
+ int curFrame = anim->getCurrentFrame();
+ uint32 clock = anim->getNextFrameTimer();
+ if ((curFrame > 0) && (_scene->_frameStartTime >= clock)) {
+ Common::Point pos = anim->getFramePosAdjust(curFrame);
+ if (pos.x != _scene->_posAdjust.x) {
+ setMultiplanePos(pos.x);
+ positionsSetFl = true;
+ }
+ }
+ }
+
+ if (!positionsSetFl && (_game._fx != kTransitionNone))
+ setMultiplanePos(320);
+}
+
+void Scene310::actions() {
+}
+
+void Scene310::preActions() {
+}
+
+void Scene310::setMultiplanePos(int x_new) {
+ int center = x_new + 160;
+
+ for (int i = 0; i < 4; i++) {
+ if (_globals._sequenceIndexes[i] >= 0)
+ _scene->deleteSequence(_globals._sequenceIndexes[i]);
+
+ int difference = center - _multiplanePosX[i];
+
+ int direction = 0;
+ if (difference < 0)
+ direction = 1;
+ else if (difference > 0)
+ direction = -1;
+
+ int displace = abs(difference);
+ if (direction < 0)
+ displace = -displace;
+
+ int x = _multiplanePosX[i] + displace - 1;
+ int y = _scene->_sprites[_globals._spriteIndexes[i]]->getFrameWidth(0) + 29;
+ int halfWidth = 1 + (_scene->_sprites[_globals._spriteIndexes[i]]->getFrameHeight(0) / 2);
+
+ if (((x - halfWidth) >= (x_new + 320)) || ((x + halfWidth) < x_new))
+ _globals._sequenceIndexes[i] = -1;
+ else {
+ _globals._sequenceIndexes[i] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[i], false, 1);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[i], Common::Point(x, y));
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[i], 1);
+ }
+ }
+}
+
+void Scene310::handleLakeAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _lakeFrame)
+ return;
+
+
+ _lakeFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+ int id;
+
+ switch (_lakeFrame) {
+ case 60:
+ id = _scene->_kernelMessages.add(Common::Point(-142, 0), _chrisMessageColor, 0, 61, 600, _game.getQuote(0x66));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-142, 15), _chrisMessageColor, 0, 0, 600, _game.getQuote(0x67));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-142, 30), _chrisMessageColor, 0, 0, 600, _game.getQuote(0x68));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 120:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 140:
+ id = _scene->_kernelMessages.add(Common::Point(-120, 0), _chrisMessageColor, 0, 63, 360, _game.getQuote(0x69));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-120, 15), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x6A));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-120, 30), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x6B));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 200:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 220:
+ id = _scene->_kernelMessages.add(Common::Point(-32, 30), _chrisMessageColor, 0, 65, 240, _game.getQuote(0x6C));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-32, 45), _chrisMessageColor, 0, 0, 240, _game.getQuote(0x6D));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 280:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 300:
+ id = _scene->_kernelMessages.add(Common::Point(101, 0), _raoulMessageColor, 0, 67, 360, _game.getQuote(0x6E));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(101, 15), _raoulMessageColor, 0, 0, 360, _game.getQuote(0x6F));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(101, 30), _raoulMessageColor, 0, 0, 360, _game.getQuote(0x70));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 360:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 380:
+ id = _scene->_kernelMessages.add(Common::Point(107, 0), _chrisMessageColor, 0, 69, 360, _game.getQuote(0x71));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(107, 15), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x72));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(107, 30), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x73));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 440:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 460:
+ id = _scene->_kernelMessages.add(Common::Point(107, 7), _chrisMessageColor, 0, 0, 180, _game.getQuote(0x74));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 510:
+ _scene->_kernelMessages.reset();
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _lakeFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+} // End of namespace Phantom
+} // End of namespace MADS
diff --git a/engines/mads/phantom/phantom_scenes3.h b/engines/mads/phantom/phantom_scenes3.h
new file mode 100644
index 0000000000..58f2a08b91
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes3.h
@@ -0,0 +1,248 @@
+/* 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 MADS_PHANTOM_SCENES3_H
+#define MADS_PHANTOM_SCENES3_H
+
+#include "common/scummsys.h"
+#include "common/serializer.h"
+#include "mads/game.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+class Scene3xx : public PhantomScene {
+protected:
+ /**
+ * Plays an appropriate sound when entering a scene
+ */
+ void sceneEntrySound();
+
+ /**
+ *Sets the AA file to use for the scene
+ */
+ void setAAName();
+
+ /**
+ * Updates the prefix used for getting player sprites for the scene
+ */
+ void setPlayerSpritesPrefix();
+public:
+ Scene3xx(MADSEngine *vm) : PhantomScene(vm) {}
+};
+
+class Scene301 : public Scene3xx {
+private:
+ bool _anim0ActvFl;
+ bool _skip1Fl;
+ bool _skip2Fl;
+
+ int _lightingHotspotId;
+ int _sandbagHotspotId;
+
+public:
+ Scene301(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene302 : public Scene3xx {
+public:
+ Scene302(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene303 : public Scene3xx {
+private:
+ bool _anim0ActvFl;
+ int _hempHotspotId;
+ int _skipFrameCheckFl;
+public:
+ Scene303(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene304 : public Scene3xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+
+ int _raoulFrame;
+ int _raoulStatus;
+ int _fightFrame;
+ int _fightStatus;
+ int _fightCount;
+ int _phantomFrame;
+ int _phantomStatus;
+
+ void handleConversation23();
+ void handleRaoulAnimation();
+ void handlePhantomAnimation();
+ void handleFightAnimation();
+
+public:
+ Scene304(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene305 : public Scene3xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _skipFl;
+ bool _unmaskFl;
+
+ int _unmaskFrame;
+
+ void handle_animation_unmask();
+
+public:
+ Scene305(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene306 : public Scene3xx {
+private:
+ bool _speechDoneFl;
+
+public:
+ Scene306(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene307 : public Scene3xx {
+public:
+ Scene307(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene308 : public Scene3xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ bool _skip1Fl;
+ bool _skip2Fl;
+ int _currentFloor;
+
+public:
+ Scene308(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene309 : public Scene3xx {
+private:
+ bool _anim0ActvFl;
+
+ int _boatStatus;
+ int _boatFrame;
+ int _talkCount;
+
+ void Scene309::handleBoatAnimation();
+
+public:
+ Scene309(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene310 : public Scene3xx {
+private:
+ int _raoulMessageColor;
+ int _chrisMessageColor;
+ int _multiplanePosX[4];
+ int _lakeFrame;
+
+ void setMultiplanePos(int x_new);
+ void handleLakeAnimation();
+
+public:
+ Scene310(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+} // End of namespace Phantom
+} // End of namespace MADS
+
+#endif /* MADS_PHANTOM_SCENES3_H */
diff --git a/engines/mads/phantom/phantom_scenes4.cpp b/engines/mads/phantom/phantom_scenes4.cpp
new file mode 100644
index 0000000000..618677beda
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes4.cpp
@@ -0,0 +1,4975 @@
+/* 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 "common/scummsys.h"
+#include "mads/mads.h"
+#include "mads/conversations.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+#include "mads/phantom/phantom_scenes4.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+void Scene4xx::setAAName() {
+ _game._aaName = Resources::formatAAName(1);
+ _vm->_palette->setEntry(254, 43, 47, 51);
+}
+
+void Scene4xx::sceneEntrySound() {
+ if (!_vm->_musicFlag)
+ return;
+
+ _vm->_sound->command(16);
+}
+
+void Scene4xx::setPlayerSpritesPrefix() {
+ _vm->_sound->command(5);
+
+ Common::String oldName = _game._player._spritesPrefix;
+ if (!_game._player._forcePrefix)
+ _game._player._spritesPrefix = "RAL";
+ if (oldName != _game._player._spritesPrefix)
+ _game._player._spritesChanged = true;
+
+ _game._player._scalingVelocity = true;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene401::Scene401(MADSEngine *vm) : Scene4xx(vm) {
+ _anim0ActvFl = false;
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHostpotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene401::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHostpotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene401::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_PUDDLE)
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene401::enter() {
+ _game.initCatacombs();
+ _anim0ActvFl = false;
+
+ _scene->_hotspots.activate(NOUN_PUDDLE, false);
+ _scene->_hotspots.activate(NOUN_RATS_NEST, false);
+ _scene->_hotspots.activate(NOUN_SKULL, false);
+ _scene->_hotspots.activate(NOUN_POT, false);
+
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('f', 3));
+
+ if (_game.exitCatacombs(0) == -1) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _scene->drawToBackground(_globals._spriteIndexes[1], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, false);
+ }
+
+ if (_game.exitCatacombs(3) == -1) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('c', 0));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_WEST, false);
+ }
+
+ if (_game.exitCatacombs(1) == -1) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 2));
+ _scene->drawToBackground(_globals._spriteIndexes[2], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_EAST, false);
+ }
+
+ if (_game.exitCatacombs(2) == -1)
+ _scene->_hotspots.activate(NOUN_MORE_CATACOMBS, false);
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_RAT_NEST) {
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', 4));
+ _scene->drawToBackground(_globals._spriteIndexes[4], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_RATS_NEST, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_SKULL) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('c', 5));
+ _scene->drawToBackground(_globals._spriteIndexes[5], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_SKULL, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_POT) {
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('c', 6));
+ _scene->drawToBackground(_globals._spriteIndexes[6], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_POT, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_BRICK) {
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', 7));
+ _scene->drawToBackground(_globals._spriteIndexes[7], 1, Common::Point(-32000, -32000), 0, 100);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_PUDDLE) {
+ _scene->_hotspots.activate(NOUN_PUDDLE, true);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 0);
+ _anim0ActvFl = true;
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 0:
+ _game._player._playerPos = Common::Point(128, 78);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(128, 91), FACING_SOUTH);
+ break;
+
+ case 1:
+ _game._player._playerPos = Common::Point(311, 115);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(271, 123), FACING_WEST);
+ break;
+
+ case 2:
+ _game._player._playerPos = Common::Point(142, 146);
+ _game._player._facing = FACING_NORTH;
+ break;
+
+ case 3:
+ _game._player._playerPos = Common::Point(4, 113);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(48, 113), FACING_EAST);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId , Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene401::step() {
+ if (_anim0ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 20)
+ _scene->setAnimFrame(_globals._animationIndexes[0], 0);
+ }
+}
+
+void Scene401::actions() {
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME)) {
+ if (_frameInRoomFl)
+ _vm->_dialogs->show(29);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId , Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME)) {
+ if ((_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _scene->_dynamicHotspots.remove(_greenFrameHostpotId );
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[11]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_NORTH)) {
+ _game.moveCatacombs(0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST)) {
+ _game.moveCatacombs(3);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS)) {
+ _game.moveCatacombs(2);
+ if ((_game._difficulty == DIFFICULTY_HARD) && (_globals[kCatacombsRoom] == 31))
+ _globals[kPriestPistonPuke] = true;
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_EAST)) {
+ _game.moveCatacombs(1);
+ if ((_game._difficulty == DIFFICULTY_EASY) && (_globals[kCatacombsRoom] == 24))
+ _globals[kPriestPistonPuke] = true;
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(40110);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(40111);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(40112);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(40113);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(40114);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(40115);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLOCKED_ARCHWAY)) {
+ _vm->_dialogs->show(40116);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PUDDLE)) {
+ _vm->_dialogs->show(40117);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(40118);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SKULL)) {
+ _vm->_dialogs->show(40120);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+
+ if (_action.isObject(NOUN_BROKEN_POT)) {
+ _vm->_dialogs->show(40122);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(40119);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_SKULL)) {
+ _vm->_dialogs->show(40121);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_BROKEN_POT)) {
+ _vm->_dialogs->show(40123);
+ _action._inProgress = false;
+ }
+}
+
+void Scene401::preActions() {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME)
+ || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene403::Scene403(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHostpotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene403::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHostpotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene403::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_HOLE)
+ _scene->_variant = 1;
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_PLANK)
+ _scene->_variant = 2;
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene403::enter() {
+ _game.initCatacombs();
+
+ _scene->_hotspots.activate(NOUN_HOLE, false);
+ _scene->_hotspots.activate(NOUN_WEB, false);
+ _scene->_hotspots.activate(NOUN_RATS_NEST, false);
+ _scene->_hotspots.activate(NOUN_SKULL, false);
+ _scene->_hotspots.activate(NOUN_PLANK, false);
+ _scene->_hotspots.activate(NOUN_GATE, false);
+
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('f', 3));
+
+ if (_game.exitCatacombs(0) == -1) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _scene->drawToBackground(_globals._spriteIndexes[1], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, false);
+ }
+
+ if (_game.exitCatacombs(3) == -1) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('c', 0));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_WEST, false);
+ }
+
+ if (_game.exitCatacombs(1) == -1) {
+ _scene->_hotspots.activate(NOUN_MORE_CATACOMBS, false);
+ _scene->_hotspots.activate(NOUN_GATE, true);
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('c', 9));
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_HOLE) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 3));
+ _scene->drawToBackground(_globals._spriteIndexes[2], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_HOLE, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_WEB) {
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('c', 4));
+ _scene->drawToBackground(_globals._spriteIndexes[3], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_WEB, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_BRICK) {
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', 5));
+ _scene->drawToBackground(_globals._spriteIndexes[4], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activateAtPos(NOUN_EXPOSED_BRICK, false, Common::Point(178, 35));
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_RAT_NEST) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('c', 6));
+ _scene->drawToBackground(_globals._spriteIndexes[5], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_RATS_NEST, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_SKULL) {
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('c', 7));
+ _scene->drawToBackground(_globals._spriteIndexes[6], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_SKULL, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_PLANK) {
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', 8));
+ _scene->drawToBackground(_globals._spriteIndexes[7], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_PLANK, true);
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 0:
+ _game._player._playerPos = Common::Point(212, 86);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(212, 100), FACING_SOUTH);
+ break;
+
+ case 1:
+ _game._player.firstWalk(Common::Point(330, 126), FACING_EAST, Common::Point(305, 126), FACING_WEST, true);
+ break;
+
+ case 3:
+ _game._player._playerPos = Common::Point(3, 128);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(40, 128), FACING_EAST);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if ((_game._difficulty == DIFFICULTY_EASY) && (_globals[kCatacombsRoom] == 19))
+ _scene->_sequences.addTimer(120, 60);
+
+ sceneEntrySound();
+}
+
+void Scene403::step() {
+ if (_game._trigger == 60)
+ _vm->_dialogs->show(31);
+}
+
+void Scene403::actions() {
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _vm->_dialogs->show(29);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME))) {
+ if ((_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _scene->_dynamicHotspots.remove(_greenFrameHostpotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[11]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_NORTH)) {
+ _game.moveCatacombs(0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST)) {
+ _game.moveCatacombs(3);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(40310);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(40311);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(40312);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(40313);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(40314);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(40315);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLOCKED_ARCHWAY)) {
+ _vm->_dialogs->show(40316);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(40318);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SKULL)) {
+ _vm->_dialogs->show(40320);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOLE)) {
+ _vm->_dialogs->show(40323);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WEB)) {
+ _vm->_dialogs->show(40324);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GATE)) {
+ _vm->_dialogs->show(45330);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PLANK)) {
+ _vm->_dialogs->show(40325);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_GATE)) {
+ _vm->_dialogs->show(45331);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(40319);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_SKULL)) {
+ _vm->_dialogs->show(40321);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_PLANK)) {
+ _vm->_dialogs->show(40326);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene403::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS))
+ _game.moveCatacombs(1);
+
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene404::Scene404(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+ _anim0ActvFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHostpotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene404::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+ s.syncAsByte(_anim0ActvFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHostpotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene404::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_BLOCK)
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene404::enter() {
+ _game.initCatacombs();
+
+ _scene->_hotspots.activate(NOUN_RATS_NEST, false);
+ _scene->_hotspots.activate(NOUN_WEB, false);
+ _scene->_hotspots.activate(NOUN_BROKEN_POT, false);
+ _scene->_hotspots.activate(NOUN_BLOCK, false);
+ _scene->_hotspots.activate(NOUN_PUDDLE, false);
+
+ _anim0ActvFl = false;
+
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('f', 3));
+
+
+ if (_game.exitCatacombs(0) == -1) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _scene->drawToBackground(_globals._spriteIndexes[1], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, false);
+ }
+
+ if (_game.exitCatacombs(3) == -1) {
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('c', 0));
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_WEST, false);
+ }
+
+ if (_game.exitCatacombs(1) == -1) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 2));
+ _scene->drawToBackground(_globals._spriteIndexes[2], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_EAST, false);
+ }
+
+ if (_game.exitCatacombs(2) == -1)
+ _scene->_hotspots.activate(NOUN_MORE_CATACOMBS, false);
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_RAT_NEST) {
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('c', 3));
+ _scene->drawToBackground(_globals._spriteIndexes[3], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_RATS_NEST, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_WEB) {
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', 4));
+ _scene->drawToBackground(_globals._spriteIndexes[4], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_WEB, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_POT) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('c', 5));
+ _scene->drawToBackground(_globals._spriteIndexes[5], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_BROKEN_POT, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_BLOCK) {
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', 7));
+ _scene->drawToBackground(_globals._spriteIndexes[7], 1, Common::Point(-32000, -32000), 0, 100);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_FALLEN_BLOCK) {
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('c', 8));
+ _scene->drawToBackground(_globals._spriteIndexes[8], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_BLOCK, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_PUDDLE) {
+ _scene->_hotspots.activate(NOUN_PUDDLE, true);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 0);
+ _anim0ActvFl = true;
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 0:
+ _game._player._playerPos = Common::Point(156, 98);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(156, 117), FACING_SOUTH);
+ break;
+
+ case 1:
+ _game._player._playerPos = Common::Point(319, 135);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(279, 135), FACING_WEST);
+ break;
+
+ case 2:
+ _game._player._playerPos = Common::Point(175, 147);
+ _game._player._facing = FACING_NORTH;
+ break;
+
+ case 3:
+ _game._player._playerPos = Common::Point(17, 131);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(60, 131), FACING_EAST);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[13] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[13], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_globals[kPriestPistonPuke])
+ _scene->_sequences.addTimer(120, 60);
+
+ sceneEntrySound();
+}
+
+void Scene404::step() {
+ if (_anim0ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 20)
+ _scene->setAnimFrame(_globals._animationIndexes[0], 0);
+ }
+
+ if (_game._trigger == 60) {
+ _vm->_dialogs->show(30);
+ _globals[kPriestPistonPuke] = false;
+ }
+}
+
+void Scene404::actions() {
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _vm->_dialogs->show(29);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[9] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[9], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[9], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[13] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[13], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[9]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE)) {
+ if ((_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME)) && (_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[9] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[9], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[9], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[11]);
+ _scene->_dynamicHotspots.remove(_greenFrameHostpotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[13]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[9]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_NORTH)) {
+ _game.moveCatacombs(0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST)) {
+ _game.moveCatacombs(3);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS)) {
+ _game.moveCatacombs(2);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_EAST)) {
+ _game.moveCatacombs(1);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(40410);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(40411);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(40412);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(40413);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(40414);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(40415);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PUDDLE)) {
+ _vm->_dialogs->show(40417);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(40418);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BROKEN_POT)) {
+ _vm->_dialogs->show(40421);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WEB)) {
+ _vm->_dialogs->show(40424);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLOCK)) {
+ _vm->_dialogs->show(40430);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(40419);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_BROKEN_POT)) {
+ _vm->_dialogs->show(40422);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_BLOCK)) {
+ _vm->_dialogs->show(40431);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene404::preActions() {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[10]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene406::Scene406(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHostpotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene406::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHostpotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene406::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene406::enter() {
+ _game.initCatacombs();
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 3));
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 1:
+ _game._player._playerPos = Common::Point(310, 118);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(271, 118), FACING_WEST);
+ break;
+
+ case 3:
+ _game._player._playerPos = Common::Point(20, 122);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(66, 122), FACING_EAST);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene406::step() {
+}
+
+void Scene406::actions() {
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _vm->_dialogs->show(29);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _greenFrameHostpotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHostpotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME))) {
+ if ((_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_dynamicHotspots.remove(_greenFrameHostpotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST)) {
+ _game.moveCatacombs(3);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_EAST)) {
+ _game.moveCatacombs(1);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(40610);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(40611);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(40612);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(40613);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(40614);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(40615);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLOCKED_ARCHWAY)) {
+ _vm->_dialogs->show(40616);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRATE)) {
+ _vm->_dialogs->show(40617);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_GRATE) || _action.isAction(VERB_PUSH, NOUN_GRATE) || _action.isAction(VERB_PULL, NOUN_GRATE)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], true, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], true, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addTimer(30, 3);
+ break;
+
+ case 3:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], true, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
+ break;
+
+ case 4:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _scene->_sequences.addTimer(6, 5);
+ break;
+
+ case 5:
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->show(40618);
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ }
+}
+
+void Scene406::preActions() {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ pos.x += 12;
+ _game._player.walk(pos, FACING_NORTHWEST);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene407::Scene407(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHotspotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene407::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHotspotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene407::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene407::enter() {
+ _game.initCatacombs();
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 3));
+
+ if (_game.exitCatacombs(3) == -1) {
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(9, 46));
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(8, 138));
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(12, 149));
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(0, 151));
+ }
+
+ if (_game.exitCatacombs(1) == -1) {
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(310, 107));
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(308, 175));
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(308, 146));
+ _scene->_hotspots.activateAtPos(NOUN_MORE_CATACOMBS, false, Common::Point(309, 152));
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 0:
+ _game._player._playerPos = Common::Point(197, 14);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(181, 14), FACING_WEST);
+ break;
+
+ case 1:
+ _game._player.firstWalk(Common::Point(330, 146), FACING_WEST, Common::Point(298, 146), FACING_WEST, true);
+ break;
+
+ case 2:
+ _game._player._playerPos = Common::Point(147, 14);
+ _game._player._facing = FACING_EAST;
+ _game._player.walk(Common::Point(165, 14), FACING_EAST);
+ break;
+
+ case 3:
+ _game._player.firstWalk(Common::Point(-20, 143), FACING_WEST, Common::Point(20, 143), FACING_WEST, true);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene407::step() {
+}
+
+void Scene407::actions() {
+ if (_action.isAction(VERB_WALK_TO, NOUN_WALL) && (_game._player._playerPos.y > 30) && (_scene->_customDest.x > 160) && (_scene->_customDest.x < 190)) {
+ _vm->_dialogs->show(40718);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_TO) && (_scene->_customDest.x < 130) && (_game._player._playerPos.y < 30)) {
+ _vm->_dialogs->show(40718);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_TO) && (_scene->_customDest.x > 203) && (_game._player._playerPos.y < 30)) {
+ _vm->_dialogs->show(40718);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_TO, NOUN_FLOOR)) {
+ if ((_game._player._playerPos.y < 30) && (_scene->_customDest.y > 29)) {
+ _vm->_dialogs->show(40718);
+ _action._inProgress = false;
+ return;
+ } else if ((_game._player._playerPos.y > 29) && (_scene->_customDest.y < 30)) {
+ _vm->_dialogs->show(40718);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME)) {
+ if ((_game._player._playerPos.y < 30) && (_scene->_customDest.y < 30))
+ _vm->_dialogs->show(40717);
+ else if ((_game._player._playerPos.y < 30) && (_scene->_customDest.y > 29))
+ _vm->_dialogs->show(40718);
+ else if (_frameInRoomFl)
+ _vm->_dialogs->show(29);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME)) {
+ if ((_takingFrameInRoomFl || _game._trigger)) {
+ if (_game._player._playerPos.y < 30)
+ _vm->_dialogs->show(40718);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_dynamicHotspots.remove(_greenFrameHotspotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST)) {
+ if (_game._player._playerPos.y < 30)
+ _game.moveCatacombs(2);
+ else
+ _vm->_dialogs->show(40718);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_EAST)) {
+ if (_game._player._playerPos.y < 30)
+ _game.moveCatacombs(0);
+ else
+ _vm->_dialogs->show(40718);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS) && (_game._player._playerPos.y < 30)) {
+ _vm->_dialogs->show(40718);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(40710);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(40711);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(40712);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(40713);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(40714);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COLUMN)) {
+ _vm->_dialogs->show(40715);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 818, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LAKE)) {
+ _vm->_dialogs->show(40716);
+ _action._inProgress = false;
+ }
+ }
+}
+
+void Scene407::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS)) {
+ if (_game._player._playerPos.y > 30) {
+ if (_scene->_customDest.x < 100)
+ _game.moveCatacombs(3);
+ else
+ _game.moveCatacombs(1);
+ } else
+ _game._player._needToWalk = false;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH) && (_game._player._playerPos.y > 30))
+ _game._player._needToWalk = false;
+
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if ((_frameInRoomFl) || (_game._player._playerPos.y < 30) || (_scene->_customDest.y < 30))
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[1]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME))) {
+ if (_takingFrameInRoomFl && (_game._player._playerPos.y < 30))
+ _game._player._needToWalk = false;
+ }
+
+ if (_action.isAction(VERB_WALK_ACROSS, NOUN_FLOOR) && (_game._player._playerPos.y < 30) && (_scene->_customDest.y > 29))
+ _game._player._needToWalk = false;
+
+ if (_action.isAction(VERB_WALK_TO, NOUN_LAKE) && (_game._player._playerPos.y < 30))
+ _game._player.walk(Common::Point(172, 18), FACING_SOUTH);
+
+ if (_action.isAction(VERB_WALK_TO) && (_scene->_customDest.x < 130) && (_game._player._playerPos.y < 30))
+ _game._player._needToWalk = false;
+
+ if (_action.isAction(VERB_WALK_TO) && (_scene->_customDest.x > 203) && (_game._player._playerPos.y < 30))
+ _game._player._needToWalk = false;
+
+ if (_action.isAction(VERB_WALK_TO, NOUN_WALL) && (_game._player._playerPos.y > 30) && (_scene->_customDest.x > 160) && (_scene->_customDest.x < 190))
+ _game._player._needToWalk = false;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene408::Scene408(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHotspotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene408::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHotspotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene408::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if ((_globals[kCatacombsMisc] & MAZE_EVENT_WEB) && (!_globals[kCobwebIsCut]))
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene408::enter() {
+ _game.initCatacombs();
+ _scene->_hotspots.activate(NOUN_COBWEB, false);
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('c', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', 3));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', 2));
+
+ if (_game.exitCatacombs(0) == -1) {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, false);
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(147, 121));
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(153, 121));
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(154, 115));
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(161, 101));
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(162, 106));
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(187, 107));
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(185, 101));
+ _scene->_hotspots.activateAtPos(NOUN_FLOOR, false, Common::Point(192, 119));
+ _scene->_hotspots.activateAtPos(NOUN_WALL, false, Common::Point(147, 76));
+ _scene->_hotspots.activateAtPos(NOUN_WALL, false, Common::Point(159, 108));
+ _scene->_hotspots.activateAtPos(NOUN_WALL, false, Common::Point(185, 93));
+ _scene->_hotspots.activateAtPos(NOUN_WALL, false, Common::Point(199, 91));
+ _scene->changeVariant(1);
+ } else
+ _scene->_hotspots.activate(NOUN_GATE, false);
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 0:
+ _game._player._playerPos = Common::Point(174, 100);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(174, 106), FACING_SOUTH);
+ break;
+
+ case 2:
+ _game._player._playerPos = Common::Point(175, 145);
+ _game._player._facing = FACING_NORTH;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_WEB) {
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('x', -1));
+ if (!_globals[kCobwebIsCut]) {
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 10);
+ _scene->_hotspots.activate(NOUN_COBWEB, true);
+ } else {
+ _globals._sequenceIndexes[8] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[8], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 10);
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(199, 112, 199 + 6, 112 + 12));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 125), FACING_NORTHEAST);
+ idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(202, 81, 202 + 5, 81 + 31));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 125), FACING_NORTHEAST);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(138, 74, 138 + 7, 74 + 33));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(154, 124), FACING_NORTHWEST);
+ idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(143, 107, 143 + 6, 107 + 15));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(154, 124), FACING_NORTHWEST);
+ }
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_BRICK) {
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', 2));
+ _scene->drawToBackground(_globals._spriteIndexes[7], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_EXPOSED_BRICK, false);
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if ((_game._difficulty == DIFFICULTY_HARD) && (_globals[kCatacombsRoom] == 52))
+ _scene->_sequences.addTimer(120, 60);
+
+ sceneEntrySound();
+}
+
+void Scene408::step() {
+ if (_game._trigger == 60)
+ _vm->_dialogs->show(31);
+}
+
+void Scene408::actions() {
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _vm->_dialogs->show(29);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+
+ if (_action.isAction(VERB_TAKE)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME))) {
+ if ((_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _scene->_dynamicHotspots.remove(_greenFrameHotspotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_NORTH)) {
+ _game.moveCatacombs(0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS)) {
+ _game.moveCatacombs(2);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(40810);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(40811);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(40812);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(40813);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(40814);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(40815);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(40816);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GATE)) {
+ _vm->_dialogs->show(40817);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COBWEB)) {
+ if (_globals[kCobwebIsCut])
+ _vm->_dialogs->show(40820);
+ else
+ _vm->_dialogs->show(40819);
+
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if ((_action.isAction(VERB_ATTACK, NOUN_COBWEB) && !_globals[kCobwebIsCut])) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('W', 1), 70);
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _globals[kCobwebIsCut] = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_game._trigger == 70) {
+ _globals._sequenceIndexes[8] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[8], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 14);
+ _scene->changeVariant(0);
+ _scene->_hotspots.activate(NOUN_COBWEB, false);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+
+ int idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(199, 112, 199 + 6, 112 + 12));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 125), FACING_NORTHEAST);
+ idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(202, 81, 202 + 5, 81 + 31));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 125), FACING_NORTHEAST);
+
+ idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(138, 74, 138 + 7, 74 + 33));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(154, 124), FACING_NORTHWEST);
+ idx = _scene->_dynamicHotspots.add(NOUN_COBWEB, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(143, 107, 143 + 6, 107 + 15));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(154, 124), FACING_NORTHWEST);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_GATE)) {
+ _vm->_dialogs->show(40818);
+ _action._inProgress = false;
+ }
+}
+
+void Scene408::preActions() {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene409::Scene409(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHotspotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene409::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHotspotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene409::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene409::enter() {
+ _game.initCatacombs();
+
+ _scene->loadSpeech(3);
+ _scene->_hotspots.activate(NOUN_SWORD, false);
+
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RDR_9");
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', 3));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 0));
+
+ if (_game._objects.isInRoom(OBJ_SWORD)) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_hotspots.activate(NOUN_SWORD, true);
+ }
+
+ if (!_globals[kDoorIn409IsOpen]) {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, false);
+ } else
+ _scene->_hotspots.activate(NOUN_DOOR, false);
+
+ if (_scene->_priorSceneId == 410) {
+ _game._player._facing = FACING_NORTH;
+ _game._player._playerPos = Common::Point(229, 106);
+
+ if (_globals[kFlickedLever1] && _globals[kFlickedLever2] && _globals[kFlickedLever3] && _globals[kFlickedLever4]) {
+ if ((_globals[kFlickedLever1] == 5) && (_globals[kFlickedLever2] == 18) && (_globals[kFlickedLever3] == 9) && (_globals[kFlickedLever4] == 11)) {
+ if (!_globals[kDoorIn409IsOpen]) {
+ _globals[kPlayerScore] += 5;
+ _vm->_sound->command(24);
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 65);
+ }
+ } else {
+ _globals[kFlickedLever1] = 0;
+ _globals[kFlickedLever2] = 0;
+ _globals[kFlickedLever3] = 0;
+ _globals[kFlickedLever4] = 0;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 15, 60);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ _vm->_sound->command(68);
+ }
+ } else {
+ _globals[kFlickedLever1] = 0;
+ _globals[kFlickedLever2] = 0;
+ _globals[kFlickedLever3] = 0;
+ _globals[kFlickedLever4] = 0;
+ }
+ } else if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 0:
+ _game._player._playerPos = Common::Point(195, 92);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(195, 107), FACING_SOUTH);
+ break;
+
+ case 2:
+ _game._player._playerPos = Common::Point(184, 45);
+ _game._player._facing = FACING_NORTH;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene409::step() {
+ if (_game._trigger == 60) {
+ _game._player._visible = false;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[7]);
+ _scene->playSpeech(3);
+ }
+
+ if (_game._trigger == 61) {
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+ _scene->_sequences.addTimer(60, 62);
+ _vm->_sound->command(27);
+ }
+
+ if (_game._trigger == 62)
+ _scene->_reloadSceneFlag = true;
+
+ if (_game._trigger == 65) {
+ _game._player._stepEnabled = true;
+ _globals[kDoorIn409IsOpen] = true;
+ _scene->_hotspots.activate(NOUN_DOOR, false);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, true);
+ }
+}
+
+void Scene409::actions() {
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 4, 4);
+ _action._inProgress = false;
+ return;
+
+ case 1: {
+ int syncIdx = _globals._sequenceIndexes[8];
+ _globals._sequenceIndexes[8] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[8], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[8], SYNC_SEQ, syncIdx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], false);
+ _scene->_sequences.addTimer(30, 2);
+ _action._inProgress = false;
+ }
+ return;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[8]);
+ _globals._sequenceIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ _action._inProgress = false;
+ return;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _vm->_dialogs->show(40923);
+ _game._player._stepEnabled = true;
+ _action._inProgress = false;
+ return;
+
+ case 4:
+ _vm->_sound->command(70);
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME)) {
+ if (_frameInRoomFl) {
+ _vm->_dialogs->show(29);
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE)) {
+ if ((_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME))
+ && (_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _scene->_dynamicHotspots.remove(_greenFrameHotspotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_NORTH)) {
+ _game.enterCatacombs(true);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS)) {
+ _game.enterCatacombs(false);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(40910);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_SWORD) && (_game._objects.isInRoom(OBJ_SWORD) || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _scene->_hotspots.activate(NOUN_SWORD, false);
+ _game._objects.addToInventory(OBJ_SWORD);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ _vm->_dialogs->showItem(OBJ_SWORD, 808, 0);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(40911);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(40912);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(40913);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(40914);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(40915);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLOCKED_ARCHWAY)) {
+ _vm->_dialogs->show(40916);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GRATE)) {
+ _vm->_dialogs->show(40917);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_UNLUCKY_ADVENTURER)) {
+ _vm->_dialogs->show(40920);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SWORD) && _game._objects.isInRoom(OBJ_SWORD)) {
+ _vm->_dialogs->show(40921);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_LOOK, NOUN_SWITCH_PANEL)) {
+ _vm->_dialogs->show(40919);
+ _scene->_nextSceneId = 410;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_TO, NOUN_SWITCH_PANEL)) {
+ _scene->_nextSceneId = 410;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_GRATE) || _action.isAction(VERB_PUSH, NOUN_GRATE) || _action.isAction(VERB_PULL, NOUN_GRATE)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 2:
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addTimer(30, 3);
+ break;
+
+ case 3:
+ _scene->deleteSequence(_globals._sequenceIndexes[0]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
+ break;
+
+ case 4:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _scene->_sequences.addTimer(6, 5);
+ break;
+
+ case 5:
+ _game._player._stepEnabled = true;
+ _vm->_dialogs->show(40918);
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_UNLUCKY_ADVENTURER)) {
+ _vm->_dialogs->show(40924);
+ _action._inProgress = false;
+ }
+}
+
+void Scene409::preActions() {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+
+ if (_action.isAction(VERB_LOOK, NOUN_SWITCH_PANEL))
+ _game._player.walk(Common::Point(229, 106), FACING_NORTH);
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR))
+ _game._player.walk(Common::Point(191, 104), FACING_NORTHEAST);
+
+ if (_action.isAction(VERB_OPEN, NOUN_GRATE))
+ _game._player._needToWalk = true;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene410::Scene410(MADSEngine *vm) : Scene4xx(vm) {
+ for (int i = 0; i < 26; i++)
+ _skullSequence[i];
+}
+
+void Scene410::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ for (int i = 0; i < 26; i++)
+ s.syncAsSint16LE(_skullSequence[i]);
+}
+
+void Scene410::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene410::enter() {
+ _game._player._visible = false;
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('l', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('l', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('l', 2));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 0));
+
+ for (int i = 1; i < 27; i++) {
+ Common::Point pos;
+ int type;
+
+ getLeverInfo(&pos, &type, i, NULL);
+ int stampType = -1;
+
+ switch (type) {
+ case 1:
+ stampType = _globals._spriteIndexes[0];
+ break;
+
+ case 2:
+ stampType = _globals._spriteIndexes[1];
+ break;
+
+ case 3:
+ stampType = _globals._spriteIndexes[2];
+ break;
+
+ default:
+ break;
+ }
+
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(stampType, false, 1);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], pos);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ _skullSequence[i - 1] = _globals._sequenceIndexes[0];
+ }
+
+ if (_globals[kFlickedLever1]) {
+ Common::Point pos;
+ int type;
+
+ getLeverInfo(&pos, &type, _globals[kFlickedLever1], NULL);
+ int stampType = -1;
+
+ switch (type) {
+ case 1:
+ stampType = _globals._spriteIndexes[0];
+ break;
+
+ case 2:
+ stampType = _globals._spriteIndexes[1];
+ break;
+
+ case 3:
+ stampType = _globals._spriteIndexes[2];
+ break;
+
+ default:
+ break;
+ }
+ _scene->deleteSequence(_skullSequence[_globals[kFlickedLever1] - 1]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(stampType, false, -2);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], pos);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ }
+
+ if (_globals[kFlickedLever2]) {
+ Common::Point pos;
+ int type;
+
+ getLeverInfo(&pos, &type, _globals[kFlickedLever2], NULL);
+ int stampType = -1;
+ switch (type) {
+ case 1:
+ stampType = _globals._spriteIndexes[0];
+ break;
+
+ case 2:
+ stampType = _globals._spriteIndexes[1];
+ break;
+
+ case 3:
+ stampType = _globals._spriteIndexes[2];
+ break;
+
+ default:
+ break;
+ }
+ _scene->deleteSequence(_skullSequence[_globals[kFlickedLever2] - 1]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(stampType, false, -2);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], pos);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ }
+
+ if (_globals[kFlickedLever3]) {
+ Common::Point pos;
+ int type;
+
+ getLeverInfo(&pos, &type, _globals[kFlickedLever3], NULL);
+ int stampType = -1;
+ switch (type) {
+ case 1:
+ stampType = _globals._spriteIndexes[0];
+ break;
+
+ case 2:
+ stampType = _globals._spriteIndexes[1];
+ break;
+
+ case 3:
+ stampType = _globals._spriteIndexes[2];
+ break;
+
+ default:
+ break;
+ }
+ _scene->deleteSequence(_skullSequence[_globals[kFlickedLever3] - 1]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(stampType, false, -2);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], pos);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ }
+
+ if (_globals[kFlickedLever4]) {
+ Common::Point pos;
+ int type;
+
+ getLeverInfo(&pos, &type, _globals[kFlickedLever4], NULL);
+ int stampType = -1;
+ switch (type) {
+ case 1:
+ stampType = _globals._spriteIndexes[0];
+ break;
+
+ case 2:
+ stampType = _globals._spriteIndexes[1];
+ break;
+
+ case 3:
+ stampType = _globals._spriteIndexes[2];
+ break;
+
+ default:
+ break;
+ }
+ _scene->deleteSequence(_skullSequence[_globals[kFlickedLever4] - 1]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(stampType, false, -2);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], pos);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene410::step() {
+}
+
+void Scene410::actions() {
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(41013);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) {
+ if (_globals[kDoorIn409IsOpen])
+ _vm->_dialogs->show(41014);
+ else {
+ Common::Point pos;
+ int type;
+ int number;
+
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ getLeverInfo(&pos, &type, 0, &number);
+ _globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 4, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ if (pos.y == 46)
+ pos.y = 48;
+
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(pos.x + 4, pos.y + 107));
+ if (!_globals[kDoorIn409IsOpen])
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 16, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ getLeverInfo(&pos, &type, 0, &number);
+
+ if ((_globals[kFlickedLever1] != number) && (_globals[kFlickedLever2] != number) && (_globals[kFlickedLever3] != number) && (_globals[kFlickedLever4] != number)) {
+ _vm->_sound->command(65);
+
+ if (!_globals[kFlickedLever1]) {
+ _globals[kFlickedLever1] = number;
+ if (_globals[kFlickedLever1] == 5)
+ _vm->_sound->command(66);
+ } else if (!_globals[kFlickedLever2]) {
+ _globals[kFlickedLever2] = number;
+ if ((_globals[kFlickedLever1] == 5) && (_globals[kFlickedLever2] == 18))
+ _vm->_sound->command(66);
+ } else if (!_globals[kFlickedLever3]) {
+ _globals[kFlickedLever3] = number;
+ if ((_globals[kFlickedLever1] == 5) && (_globals[kFlickedLever2] == 18) && (_globals[kFlickedLever3] == 9))
+ _vm->_sound->command(66);
+ } else if (!_globals[kFlickedLever4]) {
+ _globals[kFlickedLever4] = number;
+ if ((_globals[kFlickedLever1] == 5) && (_globals[kFlickedLever2] == 18) && (_globals[kFlickedLever3] == 9) && (_globals[kFlickedLever4] == 11))
+ _vm->_sound->command(66);
+ }
+
+ if (_game._difficulty == DIFFICULTY_EASY)
+ _scene->drawToBackground(_globals._spriteIndexes[4], number, Common::Point(-32000, -32000), 0, 100);
+
+ switch (type) {
+ case 1:
+ _scene->deleteSequence(_skullSequence[number - 1]);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 4, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], pos);
+ break;
+
+ case 2:
+ _scene->deleteSequence(_skullSequence[number - 1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 4, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[1], pos);
+ break;
+
+ case 3:
+ _scene->deleteSequence(_skullSequence[number - 1]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[2], pos);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case 2:
+ _game._player._stepEnabled = true;
+
+ if ((_globals[kFlickedLever1] == 5) && (_globals[kFlickedLever2] == 18) && (_globals[kFlickedLever3] == 9) && (_globals[kFlickedLever4] == 11) && !_globals[kDoorIn409IsOpen])
+ _vm->_sound->command(67);
+
+ if (_globals[kFlickedLever1] && _globals[kFlickedLever2] && _globals[kFlickedLever3] && _globals[kFlickedLever4])
+ _scene->_nextSceneId = 409;
+
+ break;
+
+ case 4:
+ getLeverInfo(&pos, &type, 0, &number);
+ _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[0], pos);
+ break;
+
+ case 5:
+ getLeverInfo(&pos, &type, 0, &number);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[1], pos);
+ break;
+
+ case 6:
+ getLeverInfo(&pos, &type, 0, &number);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[2], pos);
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(41011);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SWITCH_PANEL)) {
+ _vm->_dialogs->show(41011);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CATACOMB_ROOM)) {
+ _vm->_dialogs->show(41015);
+ _action._inProgress = false;
+ return;
+ }
+
+ switch (_action._activeAction._objectNameId) {
+ case NOUN_SKULL_SWITCH_1:
+ case NOUN_SKULL_SWITCH_2:
+ case NOUN_SKULL_SWITCH_3:
+ case NOUN_SKULL_SWITCH_4:
+ case NOUN_SKULL_SWITCH_5:
+ case NOUN_SKULL_SWITCH_6:
+ case NOUN_SKULL_SWITCH_7:
+ case NOUN_SKULL_SWITCH_8:
+ case NOUN_SKULL_SWITCH_9:
+ case NOUN_SKULL_SWITCH_10:
+ case NOUN_SKULL_SWITCH_11:
+ case NOUN_SKULL_SWITCH_12:
+ case NOUN_SKULL_SWITCH_13:
+ case NOUN_SKULL_SWITCH_14:
+ case NOUN_SKULL_SWITCH_15:
+ case NOUN_SKULL_SWITCH_16:
+ case NOUN_SKULL_SWITCH_17:
+ case NOUN_SKULL_SWITCH_18:
+ case NOUN_SKULL_SWITCH_19:
+ case NOUN_SKULL_SWITCH_20:
+ case NOUN_SKULL_SWITCH_21:
+ case NOUN_SKULL_SWITCH_22:
+ case NOUN_SKULL_SWITCH_23:
+ case NOUN_SKULL_SWITCH_24:
+ case NOUN_SKULL_SWITCH_25:
+ case NOUN_SKULL_SWITCH_26:
+ _vm->_dialogs->show(41012);
+ _action._inProgress = false;
+ return;
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_EXIT_TO, NOUN_CATACOMB_ROOM)) {
+ _scene->_nextSceneId = 409;
+ _action._inProgress = false;
+ }
+}
+
+void Scene410::preActions() {
+}
+
+void Scene410::getLeverInfo(Common::Point *pos, int *type, int lever, int *noun) {
+ if (noun != NULL) {
+ switch (_action._activeAction._objectNameId) {
+ case NOUN_SKULL_SWITCH_1:
+ lever = 1;
+ break;
+
+ case NOUN_SKULL_SWITCH_2:
+ lever = 2;
+ break;
+
+ case NOUN_SKULL_SWITCH_3:
+ lever = 3;
+ break;
+
+ case NOUN_SKULL_SWITCH_4:
+ lever = 4;
+ break;
+
+ case NOUN_SKULL_SWITCH_5:
+ lever = 5;
+ break;
+
+ case NOUN_SKULL_SWITCH_6:
+ lever = 6;
+ break;
+
+ case NOUN_SKULL_SWITCH_7:
+ lever = 7;
+ break;
+
+ case NOUN_SKULL_SWITCH_8:
+ lever = 8;
+ break;
+
+ case NOUN_SKULL_SWITCH_9:
+ lever = 9;
+ break;
+
+ case NOUN_SKULL_SWITCH_10:
+ lever = 10;
+ break;
+
+ case NOUN_SKULL_SWITCH_11:
+ lever = 11;
+ break;
+
+ case NOUN_SKULL_SWITCH_12:
+ lever = 12;
+ break;
+
+ case NOUN_SKULL_SWITCH_13:
+ lever = 13;
+ break;
+
+ case NOUN_SKULL_SWITCH_14:
+ lever = 14;
+ break;
+
+ case NOUN_SKULL_SWITCH_15:
+ lever = 15;
+ break;
+
+ case NOUN_SKULL_SWITCH_16:
+ lever = 16;
+ break;
+
+ case NOUN_SKULL_SWITCH_17:
+ lever = 17;
+ break;
+
+ case NOUN_SKULL_SWITCH_18:
+ lever = 18;
+ break;
+
+ case NOUN_SKULL_SWITCH_19:
+ lever = 19;
+ break;
+
+ case NOUN_SKULL_SWITCH_20:
+ lever = 20;
+ break;
+
+ case NOUN_SKULL_SWITCH_21:
+ lever = 21;
+ break;
+
+ case NOUN_SKULL_SWITCH_22:
+ lever = 22;
+ break;
+
+ case NOUN_SKULL_SWITCH_23:
+ lever = 23;
+ break;
+
+ case NOUN_SKULL_SWITCH_24:
+ lever = 24;
+ break;
+
+ case NOUN_SKULL_SWITCH_25:
+ lever = 25;
+ break;
+
+ case NOUN_SKULL_SWITCH_26:
+ lever = 26;
+ break;
+
+ default:
+ break;
+ }
+ *noun = lever;
+ }
+
+ switch (lever) {
+ case 1:
+ *pos = Common::Point(124, 46);
+ *type = 3;
+ break;
+
+ case 2:
+ *pos = Common::Point(143, 46);
+ *type = 2;
+ break;
+
+ case 3:
+ *pos = Common::Point(162, 46);
+ *type = 1;
+ break;
+
+ case 4:
+ *pos = Common::Point(181, 46);
+ *type = 3;
+ break;
+
+ case 5:
+ *pos = Common::Point(200, 46);
+ *type = 1;
+ break;
+
+ case 6:
+ *pos = Common::Point(219, 46);
+ *type = 2;
+ break;
+
+ case 7:
+ *pos = Common::Point(238, 46);
+ *type = 1;
+ break;
+
+ case 8:
+ *pos = Common::Point(133, 71);
+ *type = 3;
+ break;
+
+ case 9:
+ *pos = Common::Point(152, 71);
+ *type = 2;
+ break;
+
+ case 10:
+ *pos = Common::Point(171, 71);
+ *type = 1;
+ break;
+
+ case 11:
+ *pos = Common::Point(190, 71);
+ *type = 3;
+ break;
+
+ case 12:
+ *pos = Common::Point(209, 71);
+ *type = 2;
+ break;
+
+ case 13:
+ *pos = Common::Point(228, 71);
+ *type = 1;
+ break;
+
+ case 14:
+ *pos = Common::Point(124, 98);
+ *type = 1;
+ break;
+
+ case 15:
+ *pos = Common::Point(143, 98);
+ *type = 3;
+ break;
+
+ case 16:
+ *pos = Common::Point(162, 98);
+ *type = 2;
+ break;
+
+ case 17:
+ *pos = Common::Point(181, 98);
+ *type = 1;
+ break;
+
+ case 18:
+ *pos = Common::Point(200, 98);
+ *type = 1;
+ break;
+
+ case 19:
+ *pos = Common::Point(219, 98);
+ *type = 2;
+ break;
+
+ case 20:
+ *pos = Common::Point(238, 98);
+ *type = 1;
+ break;
+
+ case 21:
+ *pos = Common::Point(133, 125);
+ *type = 3;
+ break;
+
+ case 22:
+ *pos = Common::Point(152, 125);
+ *type = 1;
+ break;
+
+ case 23:
+ *pos = Common::Point(171, 125);
+ *type = 3;
+ break;
+
+ case 24:
+ *pos = Common::Point(190, 125);
+ *type = 2;
+ break;
+
+ case 25:
+ *pos = Common::Point(209, 125);
+ *type = 1;
+ break;
+
+ case 26:
+ *pos = Common::Point(228, 125);
+ *type = 2;
+ break;
+
+ default:
+ *pos = Common::Point(-1, -1);
+ *type = -1;
+ break;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene453::Scene453(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHotspotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene453::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHotspotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene453::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_STONE)
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene453::enter() {
+ _game.initCatacombs();
+
+ _scene->_hotspots.activate(NOUN_SKULL, false);
+ _scene->_hotspots.activate(NOUN_DRAIN, false);
+ _scene->_hotspots.activate(NOUN_RATS_NEST, false);
+ _scene->_hotspots.activate(NOUN_WEB, false);
+ _scene->_hotspots.activate(NOUN_STONE, false);
+ _scene->_hotspots.activate(NOUN_HOLE, false);
+ _scene->_hotspots.activate(NOUN_GATE, false);
+
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('f', 3));
+
+
+ if (_game.exitCatacombs(0) == -1) {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _scene->drawToBackground(_globals._spriteIndexes[1], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, false);
+ }
+
+ if (_game.exitCatacombs(3) == -1) {
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('c', 8));
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_MORE_CATACOMBS, false);
+ _scene->_hotspots.activate(NOUN_GATE, true);
+ }
+
+ if (_game.exitCatacombs(1) == -1) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 2));
+ _scene->drawToBackground(_globals._spriteIndexes[2], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_EAST, false);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_DRAIN) {
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('c', 3));
+ _scene->drawToBackground(_globals._spriteIndexes[3], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_DRAIN, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_RAT_NEST) {
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', 4));
+ _scene->drawToBackground(_globals._spriteIndexes[4], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_SKULL, true);
+ _scene->_hotspots.activate(NOUN_RATS_NEST, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_WEB) {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('c', 5));
+ _scene->drawToBackground(_globals._spriteIndexes[5], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_WEB, true);
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_BRICK) {
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('c', 6));
+ _scene->drawToBackground(_globals._spriteIndexes[6], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activateAtPos(NOUN_EXPOSED_BRICK, false, Common::Point(138, 35));
+ _scene->_hotspots.activateAtPos(NOUN_EXPOSED_BRICK, false, Common::Point(84, 27));
+ }
+
+ if (_globals[kCatacombsMisc] & MAZE_EVENT_STONE) {
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', 7));
+ _scene->drawToBackground(_globals._spriteIndexes[7], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_HOLE, true);
+ _scene->_hotspots.activate(NOUN_STONE, true);
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 0:
+ _game._player._playerPos = Common::Point(107, 87);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(107, 98), FACING_SOUTH);
+ break;
+
+ case 1:
+ _game._player._playerPos = Common::Point(316, 129);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(277, 129), FACING_WEST);
+ break;
+
+ case 3:
+ _game._player.firstWalk(Common::Point(-20, 128), FACING_EAST, Common::Point(19, 128), FACING_EAST, true);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene453::step() {
+}
+
+void Scene453::actions() {
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME)) {
+ if (_frameInRoomFl)
+ _vm->_dialogs->show(29);
+ else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[10] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[10], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME)) {
+ if ((_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[9]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[10]);
+ _scene->_dynamicHotspots.remove(_greenFrameHotspotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[11]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_NORTH)) {
+ _game.moveCatacombs(0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_EAST)) {
+ _game.moveCatacombs(1);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(45310);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(45311);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(45312);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(45313);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(45314);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_HOLE)) {
+ _vm->_dialogs->show(45317);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SKULL)) {
+ _vm->_dialogs->show(45318);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WEB)) {
+ _vm->_dialogs->show(45324);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(45325);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DRAIN)) {
+ _vm->_dialogs->show(45327);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_STONE)) {
+ _vm->_dialogs->show(45328);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(45315);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GATE)) {
+ _vm->_dialogs->show(45330);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_SKULL)) {
+ _vm->_dialogs->show(45319);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_GATE)) {
+ _vm->_dialogs->show(45331);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_RATS_NEST)) {
+ _vm->_dialogs->show(45326);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_STONE)) {
+ _vm->_dialogs->show(45329);
+ _action._inProgress = false;
+ }
+}
+
+void Scene453::preActions() {
+ if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS))
+ _game.moveCatacombs(3);
+
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR) && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[9]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene456::Scene456(MADSEngine *vm) : Scene4xx(vm) {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ _redFrameHotspotId = -1;
+ _greenFrameHotspotId = -1;
+ _blueFrameHotspotId = -1;
+ _yellowFrameHotspotId = -1;
+}
+
+void Scene456::synchronize(Common::Serializer &s) {
+ Scene4xx::synchronize(s);
+
+ s.syncAsByte(_frameInRoomFl);
+ s.syncAsByte(_takingFrameInRoomFl);
+
+ s.syncAsSint16LE(_redFrameHotspotId);
+ s.syncAsSint16LE(_greenFrameHotspotId);
+ s.syncAsSint16LE(_blueFrameHotspotId);
+ s.syncAsSint16LE(_yellowFrameHotspotId);
+}
+
+void Scene456::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_RED_FRAME);
+ _scene->addActiveVocab(NOUN_YELLOW_FRAME);
+ _scene->addActiveVocab(NOUN_BLUE_FRAME);
+ _scene->addActiveVocab(NOUN_GREEN_FRAME);
+}
+
+void Scene456::enter() {
+ _game.initCatacombs();
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RRD_9");
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 2));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', 3));
+
+ if (_game.exitCatacombs(1) == -1) {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_hotspots.activate(NOUN_ARCHWAY_TO_EAST, false);
+ }
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ switch (_globals[kCatacombsFrom]) {
+ case 1:
+ _game._player._playerPos = Common::Point(298, 123);
+ _game._player._facing = FACING_WEST;
+ _game._player.walk(Common::Point(254, 123), FACING_WEST);
+ break;
+
+ case 3:
+ _game._player._playerPos = Common::Point(14, 117);
+ _game._player._facing = FACING_SOUTH;
+ _game._player.walk(Common::Point(46, 117), FACING_EAST);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene456::step() {
+}
+
+void Scene456::actions() {
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)) {
+ if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME)) {
+ if (_frameInRoomFl) {
+ _vm->_dialogs->show(29);
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE);
+ _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE);
+ _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE);
+ _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE);
+ _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600;
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1));
+ _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+
+ if (_action.isAction(VERB_TAKE)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME))) {
+ if ((_takingFrameInRoomFl || _game._trigger)) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 5, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1:
+ if (_action.isObject(NOUN_RED_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _scene->_dynamicHotspots.remove(_redFrameHotspotId);
+ _game._objects.addToInventory(OBJ_RED_FRAME);
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _scene->_dynamicHotspots.remove(_greenFrameHotspotId);
+ _game._objects.addToInventory(OBJ_GREEN_FRAME);
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[4]);
+ _scene->_dynamicHotspots.remove(_blueFrameHotspotId);
+ _game._objects.addToInventory(OBJ_BLUE_FRAME);
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME)) {
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _scene->_dynamicHotspots.remove(_yellowFrameHotspotId);
+ _game._objects.addToInventory(OBJ_YELLOW_FRAME);
+ }
+
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[1]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST)) {
+ _game.moveCatacombs(3);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_EAST)) {
+ _game.moveCatacombs(1);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(45610);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(45611);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(45612);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY)) {
+ _vm->_dialogs->show(45613);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_EXPOSED_BRICK)) {
+ _vm->_dialogs->show(45614);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) {
+ _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MORE_CATACOMBS)) {
+ _vm->_dialogs->show(45615);
+ _action._inProgress = false;
+ }
+ }
+}
+
+void Scene456::preActions() {
+ _frameInRoomFl = false;
+ _takingFrameInRoomFl = false;
+
+ if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) {
+ _frameInRoomFl = true;
+ if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME))
+ _takingFrameInRoomFl = true;
+ }
+
+ if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)
+ && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) {
+ if (_frameInRoomFl)
+ _game._player._needToWalk = false;
+ else {
+ Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0);
+ _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+} // End of namespace Phantom
+} // End of namespace MADS
diff --git a/engines/mads/phantom/phantom_scenes4.h b/engines/mads/phantom/phantom_scenes4.h
new file mode 100644
index 0000000000..5aece98cd6
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes4.h
@@ -0,0 +1,265 @@
+/* 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 MADS_PHANTOM_SCENES4_H
+#define MADS_PHANTOM_SCENES4_H
+
+#include "common/scummsys.h"
+#include "common/serializer.h"
+#include "mads/game.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+class Scene4xx : public PhantomScene {
+protected:
+ /**
+ * Plays an appropriate sound when entering a scene
+ */
+ void sceneEntrySound();
+
+ /**
+ *Sets the AA file to use for the scene
+ */
+ void setAAName();
+
+ /**
+ * Updates the prefix used for getting player sprites for the scene
+ */
+ void setPlayerSpritesPrefix();
+public:
+ Scene4xx(MADSEngine *vm) : PhantomScene(vm) {}
+};
+
+class Scene401 : public Scene4xx {
+private:
+ bool _anim0ActvFl;
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHostpotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene401(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene403 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHostpotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene403(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene404 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+ bool _anim0ActvFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHostpotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene404(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene406 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHostpotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene406(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene407 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHotspotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene407(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene408 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHotspotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene408(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene409 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHotspotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene409(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene410 : public Scene4xx {
+private:
+ int _skullSequence[26];
+ void getLeverInfo(Common::Point *pos, int *type, int lever_number, int *noun);
+
+public:
+ Scene410(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene453 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHotspotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene453(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene456 : public Scene4xx {
+private:
+ bool _frameInRoomFl;
+ bool _takingFrameInRoomFl;
+
+ int _redFrameHotspotId;
+ int _greenFrameHotspotId;
+ int _blueFrameHotspotId;
+ int _yellowFrameHotspotId;
+
+public:
+ Scene456(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+} // End of namespace Phantom
+} // End of namespace MADS
+
+#endif /* MADS_PHANTOM_SCENES4_H */
diff --git a/engines/mads/phantom/phantom_scenes5.cpp b/engines/mads/phantom/phantom_scenes5.cpp
new file mode 100644
index 0000000000..508f2b936d
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes5.cpp
@@ -0,0 +1,4309 @@
+/* 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 "common/scummsys.h"
+#include "mads/mads.h"
+#include "mads/conversations.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+#include "mads/phantom/phantom_scenes5.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+void Scene5xx::setAAName() {
+ _game._aaName = Resources::formatAAName(1);
+ _vm->_palette->setEntry(254, 43, 47, 51);
+}
+
+void Scene5xx::sceneEntrySound() {
+ if (!_vm->_musicFlag)
+ return;
+
+ if ((_globals[kCoffinStatus] == 2) && !_game._visitedScenes.exists(506) && (_globals[kFightStatus] == 0) && (_scene->_currentSceneId == 504))
+ _vm->_sound->command(33);
+ else if (_scene->_currentSceneId == 505)
+ _vm->_sound->command((_vm->_gameConv->_restoreRunning == 20) ? 39 : 16);
+ else
+ _vm->_sound->command(16);
+}
+
+void Scene5xx::setPlayerSpritesPrefix() {
+ _vm->_sound->command(5);
+
+ Common::String oldName = _game._player._spritesPrefix;
+ if (!_game._player._forcePrefix)
+ _game._player._spritesPrefix = "RAL";
+ if (oldName != _game._player._spritesPrefix)
+ _game._player._spritesChanged = true;
+
+ _game._player._scalingVelocity = true;
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene501::Scene501(MADSEngine *vm) : Scene5xx(vm) {
+ _anim0ActvFl = false;
+ _skipFl = false;
+}
+
+void Scene501::synchronize(Common::Serializer &s) {
+ Scene5xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_skipFl);
+}
+
+void Scene501::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_CHRISTINE);
+ _scene->addActiveVocab(VERB_LOOK_AT);
+ _scene->addActiveVocab(VERB_WALK_TO);
+}
+
+void Scene501::enter() {
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+ _scene->_hotspots.activate(NOUN_BOAT, false);
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _skipFl = false;
+ }
+
+ _vm->_gameConv->get(26);
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_6", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_9", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_8", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RDRR_6");
+
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (_globals[kChristineIsInBoat]) {
+ _anim0ActvFl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 1), 100);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 124);
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, true, Common::Point(113, 93));
+ _scene->_hotspots.activate(NOUN_BOAT, true);
+ }
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4);
+ }
+
+ if (_scene->_priorSceneId == 506) {
+ _game._player._playerPos = Common::Point(305, 112);
+ _game._player._facing = FACING_WEST;
+ _game._player._stepEnabled = false;
+
+ if (_globals[kChristineIsInBoat]) {
+ _anim0ActvFl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 1), 100);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 124);
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, true, Common::Point(113, 93));
+ _scene->_hotspots.activate(NOUN_BOAT, true);
+ _game._player.walk(Common::Point(260, 112), FACING_SOUTHWEST);
+ _game._player.setWalkTrigger(80);
+ _game._player.setWalkTrigger(55);
+ } else {
+ _anim0ActvFl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 1), 100);
+ _globals[kChristineIsInBoat] = true;
+ _scene->_hotspots.activate(NOUN_BOAT, true);
+ _game._player.walk(Common::Point(260, 112), FACING_SOUTHWEST);
+ _game._player.setWalkTrigger(80);
+ }
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4);
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ } else if ((_scene->_priorSceneId == 401) || (_scene->_priorSceneId == 408) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player.firstWalk(Common::Point(-20, 109), FACING_EAST, Common::Point(24, 109), FACING_EAST, true);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4);
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene501::step() {
+ switch (_game._trigger) {
+ case 55:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 56);
+ break;
+
+ case 56:
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10);
+ if (!_globals[kChrisWillTakeSeat])
+ _game._player._stepEnabled = true;
+
+ _globals[kChrisWillTakeSeat] = false;
+ break;
+
+ default:
+ break;
+ }
+
+
+ switch (_game._trigger) {
+ case 60:
+ _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ break;
+
+ case 61:
+ _vm->_sound->command(25);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, -1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4);
+ _game._player._stepEnabled = true;
+ break;
+
+ case 80: {
+ _game._player.walk(Common::Point(255, 118), FACING_NORTHWEST);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 2);
+ int idx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[0], 0);
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[0], 1);
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[0], 2);
+ _scene->setDynamicAnim(idx, _globals._animationIndexes[0], 3);
+ }
+ break;
+
+ case 90:
+ _globals[kPlayerScore] += 5;
+ _scene->_nextSceneId = 310;
+ break;
+
+ case 100:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 9, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 90);
+ break;
+
+ default:
+ break;
+ }
+
+ if (_anim0ActvFl) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 103)
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, true, Common::Point(125, 94));
+
+ if ((_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 28) && !_skipFl) {
+ _skipFl = true;
+ _scene->_sequences.addTimer(1, 55);
+ }
+
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 124) {
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, false, Common::Point(125, 94));
+ _scene->_hotspots.activateAtPos(NOUN_CHRISTINE, true , Common::Point(113, 93));
+ }
+
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 125)
+ _scene->setAnimFrame(_globals._animationIndexes[0], 124);
+
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 1)
+ _scene->setAnimFrame(_globals._animationIndexes[0], 0);
+
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 84)
+ _game._player._stepEnabled = true;
+ }
+}
+
+void Scene501::actions() {
+ if (_vm->_gameConv->_running == 26) {
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST) && (_globals[kChristineIsInBoat])) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(3);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_CHRISTINE)) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(1);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_INTO, NOUN_BOAT)) {
+ if (_game._objects.isInInventory(OBJ_OAR))
+ _anim0ActvFl = false;
+ else
+ _vm->_dialogs->show(50123);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_UNLOCK, NOUN_DOOR) || _action.isAction(VERB_LOCK, NOUN_DOOR)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], false);
+ _scene->_sequences.addTimer(15, 2);
+ _vm->_sound->command(74);
+ }
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[3]);
+ _game._player._visible = true;
+ _vm->_dialogs->show(50122);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ if (_scene->_customDest.x < 287) {
+ if (!_globals[kChristineIsInBoat]) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], false);
+ _scene->_sequences.addTimer(15, 2);
+ _vm->_sound->command(74);
+ }
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[3]);
+ _game._player._visible = true;
+ _vm->_dialogs->show(50120);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 4, 65);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 67);
+ break;
+
+ case 65:
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ _vm->_sound->command(24);
+ break;
+
+ case 66:
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _game._player.walk(Common::Point(305, 112), FACING_EAST);
+ _game._player.setWalkTrigger(68);
+ break;
+
+ case 67:
+ _game._player._visible = true;
+ break;
+
+ case 68:
+ _vm->_gameConv->abortConv();
+ _scene->_nextSceneId = 506;
+ break;
+ }
+ }
+ } else {
+ if (!_globals[kChristineIsInBoat]) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 4, 65);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 67);
+ break;
+
+ case 65: {
+ int idx = _globals._sequenceIndexes[1];
+ _scene->deleteSequence(_globals._sequenceIndexes[1]);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[1], SYNC_SEQ, idx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ _vm->_sound->command(24);
+ }
+ break;
+
+ case 66:
+ _game._player.walk(Common::Point(319, 116), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(68);
+ break;
+
+ case 67:
+ _game._player._visible = true;
+ break;
+
+ case 68:
+ _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 69);
+ _vm->_sound->command(25);
+ break;
+
+ case 69:
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 5);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ _scene->_nextSceneId = 502;
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
+ break;
+
+ case 1: {
+ int idx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 4);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[3], SYNC_SEQ, idx);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], false);
+ _scene->_sequences.addTimer(15, 2);
+ _vm->_sound->command(73);
+ }
+ break;
+
+ case 2:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[3], false);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
+ break;
+
+ case 3:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[3]);
+ _game._player._visible = true;
+ _vm->_dialogs->show(50120);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(50110);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(50111);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(50112);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(50113);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LAKE)) {
+ _vm->_dialogs->show(50114);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_BOAT)) {
+ _vm->_dialogs->show(50126);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TORCH)) {
+ _vm->_dialogs->show(50117);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ARCHWAY_TO_WEST)) {
+ _vm->_dialogs->show(50118);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ if (_scene->_customDest.x < 287) {
+ if (_game._visitedScenes.exists(506))
+ _vm->_dialogs->show(50127);
+ else
+ _vm->_dialogs->show(50119);
+ } else {
+ if (_game._visitedScenes.exists(506))
+ _vm->_dialogs->show(50128);
+ else
+ _vm->_dialogs->show(50119);
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COLUMN)) {
+ _vm->_dialogs->show(50121);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHRISTINE)) {
+ _vm->_dialogs->show(50124);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_TORCH)) {
+ _vm->_dialogs->show(50125);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHRISTINE)) {
+ _vm->_dialogs->show(50129);
+ _action._inProgress = false;
+ }
+}
+
+void Scene501::preActions() {
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST)) {
+ if (_globals[kLanternStatus] == 0) {
+ _game._player._needToWalk = false;
+ _vm->_dialogs->show(30918);
+ _game._player.cancelCommand();
+ } else if (!_globals[kChristineIsInBoat])
+ _game.enterCatacombs(0);
+ }
+
+ if ((_action.isObject(NOUN_DOOR)) && (_action.isAction(VERB_LOCK) || _action.isAction(VERB_UNLOCK) || _action.isAction(VERB_OPEN))) {
+ if (_scene->_customDest.x < 287)
+ _game._player.walk(Common::Point(266, 112), FACING_EAST);
+ else
+ _game._player.walk(Common::Point(287, 118), FACING_EAST);
+ }
+
+ if ((_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) && _game._visitedScenes.exists(506) && _scene->_customDest.x < 287) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._readyToWalk = false;
+ _game._player._needToWalk = false;
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(2);
+ _scene->_sequences.addTimer(6, 1);
+ break;
+
+ case 1:
+ if (_vm->_gameConv->_running >= 0)
+ _scene->_sequences.addTimer(6, 1);
+ else {
+ _game._player._stepEnabled = true;
+ _action._inProgress = true;
+ _game._player._needToWalk = true;
+ _game._player._readyToWalk = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_WEST) && _globals[kLanternStatus] && _globals[kRightDoorIsOpen504])
+ _game._player.walk(Common::Point(24, 110), FACING_WEST);
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene502::Scene502(MADSEngine *vm) : Scene5xx(vm) {
+ _fire1ActiveFl = false;
+ _fire2ActiveFl = false;
+ _fire3ActiveFl = false;
+ _fire4ActiveFl = false;
+ _panelTurningFl = false;
+ _trapDoorHotspotEnabled = false;
+ _acceleratedFireActivationFl = false;
+
+ for (int i = 0; i < 16; i++) {
+ _puzzlePictures[i] = -1;
+ _puzzleSprites[i] = -1;
+ _puzzleSequences[i] = -1;
+ }
+
+ _panelPushedNum = -1;
+ _messageLevel = -1;
+ _cycleStage = -1;
+
+ _nextPos = Common::Point(-1, -1);
+
+ _lastFrameTime = 0;
+ _timer = 0;
+ _deathTimer = 0;
+
+ _cyclePointer = nullptr;
+}
+
+Scene502::~Scene502() {
+ if (_cyclePointer)
+ delete(_cyclePointer);
+}
+
+void Scene502::synchronize(Common::Serializer &s) {
+ Scene5xx::synchronize(s);
+
+ s.syncAsByte(_fire1ActiveFl);
+ s.syncAsByte(_fire2ActiveFl);
+ s.syncAsByte(_fire3ActiveFl);
+ s.syncAsByte(_fire4ActiveFl);
+ s.syncAsByte(_panelTurningFl);
+ s.syncAsByte(_trapDoorHotspotEnabled);
+ s.syncAsByte(_acceleratedFireActivationFl);
+
+ for (int i = 0; i < 16; i++) {
+ s.syncAsSint16LE(_puzzlePictures[i]);
+ s.syncAsSint16LE(_puzzleSprites[i]);
+ s.syncAsSint16LE(_puzzleSequences[i]);
+ }
+
+ s.syncAsSint16LE(_panelPushedNum);
+ s.syncAsSint16LE(_messageLevel);
+ s.syncAsSint16LE(_cycleStage);
+
+ s.syncAsSint16LE(_nextPos.x);
+ s.syncAsSint16LE(_nextPos.y);
+
+ s.syncAsUint32LE(_lastFrameTime);
+ s.syncAsUint32LE(_timer);
+ s.syncAsUint32LE(_deathTimer);
+
+ warning("more syncing required");
+}
+
+void Scene502::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene502::enter() {
+ loadCyclingInfo();
+ _scene->loadSpeech(7);
+
+ _panelPushedNum = -1;
+ _panelTurningFl = false;
+ _fire1ActiveFl = false;
+ _fire2ActiveFl = false;
+ _fire3ActiveFl = false;
+ _fire4ActiveFl = false;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _lastFrameTime = _scene->_frameStartTime;
+ _cycleStage = 0;
+ _timer = 0;
+ _deathTimer = 0;
+ _messageLevel = 1;
+ _acceleratedFireActivationFl = true;
+ _trapDoorHotspotEnabled = false;
+ }
+
+ _scene->_hotspots.activate(NOUN_ROPE, false);
+ _scene->_hotspots.activateAtPos(NOUN_TRAP_DOOR, false, Common::Point(225, 28));
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 4));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 5));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 3));
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('x', 6));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('j', 0));
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('k', 0));
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('l', 0));
+ _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('m', 0));
+ _globals._spriteIndexes[16] = _scene->_sprites.addSprites(formAnimName('h', 0));
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ } else
+ _scene->drawToBackground(_globals._spriteIndexes[5], -2, Common::Point(-32000, -32000), 0, 100);
+
+ if ((_scene->_priorSceneId == 501) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ if (!_game._visitedScenes._sceneRevisited) {
+ if (_game._objects.isInInventory(OBJ_ROPE))
+ _globals[kCableHookWasSeparate] = true;
+ else
+ _globals[kCableHookWasSeparate] = false;
+ } else if (_globals[kCableHookWasSeparate]) {
+ _game._objects.addToInventory(OBJ_ROPE);
+ _game._objects.addToInventory(OBJ_CABLE_HOOK);
+ _game._objects.setRoom(OBJ_ROPE_WITH_HOOK, NOWHERE);
+ } else {
+ _game._objects.setRoom(OBJ_ROPE, NOWHERE);
+ _game._objects.setRoom(OBJ_CABLE_HOOK, NOWHERE);
+ _game._objects.addToInventory(OBJ_ROPE_WITH_HOOK);
+ }
+
+ _game._player._playerPos = Common::Point(43, 154);
+ _game._player._facing = FACING_EAST;
+ _game._player._stepEnabled = false;
+ _game._player.walk(Common::Point(87, 153), FACING_EAST);
+ _game._player.setWalkTrigger(77);
+ }
+
+ room_502_initialize_panels();
+
+ if (_trapDoorHotspotEnabled) {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 6);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1);
+ _scene->_hotspots.activate(NOUN_TRAP_DOOR, false);
+ _scene->_hotspots.activateAtPos(NOUN_TRAP_DOOR, true, Common::Point(225, 28));
+ if (!_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK) && !_game._objects.isInInventory(OBJ_CABLE_HOOK)) {
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 12);
+ _scene->_hotspots.activate(NOUN_ROPE, true);
+ }
+ } else {
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene502::step() {
+ if (_acceleratedFireActivationFl) {
+ int32 diff = _scene->_frameStartTime - _lastFrameTime;
+ if ((diff >= 0) && (diff <= 4)) {
+ _timer += diff;
+ _deathTimer += diff;
+ } else {
+ _timer += 1;
+ _deathTimer += 1;
+ }
+ _lastFrameTime = _scene->_frameStartTime;
+
+ if (_timer >= 300) {
+ _timer = 0;
+ if (_cycleStage < 8)
+ ++_cycleStage;
+ }
+ }
+
+ if ((_deathTimer >= 7200) && !_panelTurningFl) {
+ _vm->_dialogs->show(50215);
+ _game._player.walk(Common::Point(160, 148), FACING_NORTH);
+ _game._player.setWalkTrigger(71);
+ _game._player._stepEnabled = false;
+ _panelTurningFl = true;
+ _deathTimer = 0;
+ }
+
+ if ((_deathTimer > 900) && (_messageLevel == 1) && !_panelTurningFl) {
+ _messageLevel = 2;
+ _vm->_dialogs->show(50212);
+ }
+
+ if ((_deathTimer > 3600) && (_messageLevel == 2) && !_panelTurningFl) {
+ _messageLevel = 3;
+ _vm->_dialogs->show(50213);
+ }
+
+ if ((_deathTimer > 5400) && (_messageLevel == 3) && !_panelTurningFl) {
+ _messageLevel = 4;
+ _vm->_dialogs->show(50214);
+ }
+
+ switch (_game._trigger) {
+ case 71:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 72);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 44, 73);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 51, 74);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 32, 75);
+ break;
+
+ case 72:
+ _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1);
+ _scene->_userInterface.noInventoryAnim();
+ // CHECKME: Not sure about the next function call
+ _scene->_userInterface.refresh();
+ _scene->_sequences.addTimer(120, 76);
+ break;
+
+ case 73:
+ _vm->_sound->command(1);
+ _vm->_sound->command(67);
+ break;
+
+ case 74:
+ _vm->_sound->command(27);
+ break;
+
+ case 75:
+ _scene->playSpeech(7);
+ break;
+
+ case 76:
+ _scene->_reloadSceneFlag = true;
+ break;
+
+ case 77:
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 78);
+ break;
+
+ case 78:
+ _vm->_dialogs->show(50211);
+ _scene->drawToBackground(_globals._spriteIndexes[5], -2, Common::Point(-32000, -32000), 0, 100);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!_trapDoorHotspotEnabled)
+ animateFireBursts();
+
+ setPaletteCycle();
+}
+
+void Scene502::actions() {
+ if (_game._trigger >= 110) {
+ handlePanelAnimation();
+ _action._inProgress = false;
+ return;
+ }
+
+ switch (_game._trigger) {
+ case 80:
+ _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 6);
+ _scene->_hotspots.activateAtPos(NOUN_ROPE, true, Common::Point(225, 28));
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1);
+ _scene->_hotspots.activate(NOUN_TRAP_DOOR, false);
+ _scene->_hotspots.activateAtPos(NOUN_TRAP_DOOR, true, Common::Point(225, 28));
+ if (!_panelTurningFl)
+ _vm->_dialogs->show(50216);
+
+ _action._inProgress = false;
+ return;
+
+ case 90:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[10] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[10], false, 7, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[10], true);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 14, 18);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 91);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_SPRITE, 18, 110);
+ _action._inProgress = false;
+ return;
+
+ case 91:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[10]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _scene->_sequences.addTimer(5, 102);
+ _action._inProgress = false;
+ return;
+
+ case 95:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[10] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[10], false, 7, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[10], true);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 8, 13);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 96);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_SPRITE, 13, 110);
+ _action._inProgress = false;
+ return;
+
+ case 96:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[10]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _scene->_sequences.addTimer(5, 102);
+ _action._inProgress = false;
+ return;
+
+ case 100:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[10] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[10], false, 9, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[10], true);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 5, 7);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 101);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_SPRITE, 7, 110);
+ _action._inProgress = false;
+ return;
+
+ case 101:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[10]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(5, 102);
+ _action._inProgress = false;
+ return;
+
+ case 102:
+ _panelTurningFl = false;
+ _game._player._stepEnabled = true;
+ _action._inProgress = false;
+ return;
+
+ case 105:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[10] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[10], false, 8, 2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[10], true);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 4);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 106);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_SPRITE, 4, 110);
+ _action._inProgress = false;
+ return;
+
+ case 106:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[10]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(5, 102);
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+
+ if (_action.isAction(VERB_PUSH, NOUN_PANEL)) {
+ if (_panelTurningFl) {
+ _action._inProgress = false;
+ return;
+ }
+
+ Common::Point walkToPos;
+ getPanelInfo(&walkToPos, &_panelPushedNum, _scene->_customDest, &_nextPos);
+ _panelTurningFl = true;
+
+ switch (_panelPushedNum) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ _scene->_sequences.addTimer(1, 90);
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ _scene->_sequences.addTimer(1, 95);
+ break;
+
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ _scene->_sequences.addTimer(1, 100);
+ break;
+
+ default:
+ _scene->_sequences.addTimer(1, 105);
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_THROW, NOUN_ROPE_WITH_HOOK, NOUN_TRAP_DOOR) || _action.isAction(VERB_GRAPPLE, NOUN_TRAP_DOOR)) {
+ if (_trapDoorHotspotEnabled) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _panelTurningFl = true;
+ _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 13);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 82);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 10, 83);
+ _game._objects.setRoom(OBJ_ROPE_WITH_HOOK, NOWHERE);
+ break;
+
+ case 82:
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _panelTurningFl = false;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[7]);
+ _globals._sequenceIndexes[9] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[9], false, -2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 13);
+ _scene->_hotspots.activate(NOUN_ROPE, true);
+ break;
+
+ case 83:
+ _vm->_sound->command(69);
+ break;
+
+ default:
+ break;
+ }
+ } else
+ _vm->_dialogs->show(50229);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR)
+ && (_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK) || _game._objects.isInInventory(OBJ_CABLE_HOOK))) {
+ _vm->_dialogs->show(50228);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_THROW, NOUN_ROPE, NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(50226);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_THROW, NOUN_CABLE_HOOK, NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(50227);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLIMB, NOUN_ROPE) || _action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR)) {
+ switch (_game._trigger) {
+ case 0:
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _panelTurningFl = true;
+ _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 10);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 82);
+ break;
+
+ case 82:
+ _scene->_nextSceneId = 504;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(50210);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(50217);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(_trapDoorHotspotEnabled ? 50220 : 50225);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(50219);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(50221);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PANELS)) {
+ _vm->_dialogs->show(50222);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PANEL)) {
+ _vm->_dialogs->show(50223);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(50224);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ROPE) && !_game._objects.isInInventory(OBJ_ROPE)
+ && !_game._objects.isInInventory(OBJ_CABLE_HOOK) && !_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK)) {
+ _vm->_dialogs->show(50233);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(_trapDoorHotspotEnabled ? 50230 : 50228);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE, NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(_trapDoorHotspotEnabled ? 50228 : 50231);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_ROPE) && !_game._objects.isInInventory(OBJ_ROPE)
+ && !_game._objects.isInInventory(OBJ_CABLE_HOOK) && !_game._objects.isInInventory(OBJ_ROPE_WITH_HOOK)) {
+ _vm->_dialogs->show(50234);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LASSO, NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(50232);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene502::preActions() {
+ int panel;
+
+ if (_action.isAction(VERB_PUSH, NOUN_PANEL)) {
+ Common::Point walkToPos;
+ Common::Point tmpPos;
+ getPanelInfo(&walkToPos, &panel, _scene->_customDest, &tmpPos);
+ _game._player.walk(walkToPos, FACING_NORTH);
+ }
+
+ if (_trapDoorHotspotEnabled && (_action.isAction(VERB_CLIMB, NOUN_ROPE) || _action.isAction(VERB_CLIMB_THROUGH, NOUN_TRAP_DOOR)))
+ _game._player.walk(Common::Point(211, 149), FACING_NORTH);
+
+ if (_trapDoorHotspotEnabled && (_action.isAction(VERB_THROW, NOUN_ROPE_WITH_HOOK, NOUN_TRAP_DOOR) || _action.isAction(VERB_GRAPPLE, NOUN_TRAP_DOOR)))
+ _game._player.walk(Common::Point(200, 149), FACING_NORTH);
+}
+
+void Scene502::room_502_initialize_panels() {
+ for (int i = 0, curPuzzleSprite = 2, count = 1; i < 16; i++) {
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING)
+ _puzzlePictures[i] = _vm->getRandomNumber(1, 4);
+
+ curPuzzleSprite += (_puzzlePictures[i] * 3) - 3;
+ _puzzleSprites[i] = curPuzzleSprite;
+
+ int sprIdx;
+
+ switch (i) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ sprIdx = _globals._spriteIndexes[11];
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ sprIdx = _globals._spriteIndexes[12];
+ break;
+
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ sprIdx = _globals._spriteIndexes[13];
+ break;
+
+ default:
+ sprIdx = _globals._spriteIndexes[14];
+ break;
+ }
+
+ _globals._sequenceIndexes[15] = _scene->_sequences.addStampCycle(sprIdx, false, curPuzzleSprite);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 14);
+ _puzzleSequences[i] = _globals._sequenceIndexes[15];
+
+ ++count;
+ if (count >= 5)
+ count = 1;
+
+ switch (count) {
+ case 1:
+ curPuzzleSprite = 2;
+ break;
+
+ case 2:
+ curPuzzleSprite = 14;
+ break;
+
+ case 3:
+ curPuzzleSprite = 26;
+ break;
+
+ case 4:
+ curPuzzleSprite = 38;
+ break;
+ }
+ }
+}
+
+void Scene502::loadCyclingInfo() {
+ warning("TODO: loadCyclingInfo");
+}
+
+void Scene502::animateFireBursts() {
+ int rndTrigger;
+
+ if (_acceleratedFireActivationFl)
+ rndTrigger = _vm->getRandomNumber(1, 50);
+ else
+ rndTrigger = _vm->getRandomNumber(1, 400);
+
+ if (rndTrigger == 1) {
+ rndTrigger = _vm->getRandomNumber(1, 4);
+
+ switch (rndTrigger) {
+ case 1:
+ if (!_fire1ActiveFl) {
+ _scene->_sequences.addTimer(_vm->getRandomNumber(300, 600), 60);
+ _fire1ActiveFl = true;
+ }
+ break;
+
+ case 2:
+ if (!_fire2ActiveFl) {
+ _scene->_sequences.addTimer(_vm->getRandomNumber(300, 600), 63);
+ _fire2ActiveFl = true;
+ }
+ break;
+
+ case 3:
+ if (!_fire3ActiveFl) {
+ _scene->_sequences.addTimer(_vm->getRandomNumber(300, 600), 66);
+ _fire3ActiveFl = true;
+ }
+ break;
+
+ case 4:
+ if (!_fire4ActiveFl) {
+ _scene->_sequences.addTimer(_vm->getRandomNumber(300, 600), 69);
+ _fire4ActiveFl = true;
+ }
+ break;
+ }
+ }
+
+ switch (_game._trigger) {
+ case 60:
+ if ((_game._player._playerPos.x < 198) || (_game._player._playerPos.y > 150)) {
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 5, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 10);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ }
+ break;
+
+ case 61:
+ _fire1ActiveFl = false;
+ break;
+
+ case 63:
+ if ((_game._player._playerPos.x > 127) || (_game._player._playerPos.y < 150)) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 10);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 64);
+ }
+ break;
+
+ case 64:
+ _fire2ActiveFl = false;
+ break;
+
+ case 66:
+ if (_game._player._playerPos.x < 198) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 5, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 10);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 67);
+ }
+ break;
+
+ case 67:
+ _fire3ActiveFl = false;
+ break;
+
+ case 69:
+ if ((_game._player._playerPos.x > 110) || (_game._player._playerPos.y > 150)) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 5, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 10);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 70);
+ }
+ break;
+
+ case 70:
+ _fire4ActiveFl = false;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene502::setPaletteCycle() {
+ warning("TODO: setPaletteCycle");
+}
+
+void Scene502::getPanelInfo(Common::Point *walkToPos, int *panel, Common::Point mousePos, Common::Point *interimPos) {
+ walkToPos->y = 148;
+
+ if ((mousePos.x < 120) || (mousePos.y < 75) || (mousePos.y > 137))
+ return;
+
+ if (mousePos.x <= 139) {
+ interimPos->x = 129;
+ if (mousePos.y <= 90) {
+ *panel = 0;
+ interimPos->y = 90;
+ walkToPos->x = 107;
+ } else if (mousePos.y <= 106) {
+ *panel = 4;
+ interimPos->y = 106;
+ walkToPos->x = 107;
+ } else if (mousePos.y <= 122) {
+ *panel = 8;
+ interimPos->y = 122;
+ walkToPos->x = 107;
+ } else {
+ *panel = 12;
+ interimPos->y = 138;
+ walkToPos->x = 107;
+ }
+ } else if (mousePos.x <= 159) {
+ interimPos->x = 149;
+ if (mousePos.y <= 90) {
+ *panel = 1;
+ interimPos->y = 90;
+ walkToPos->x = 127;
+ } else if (mousePos.y <= 106) {
+ *panel = 5;
+ interimPos->y = 106;
+ walkToPos->x = 127;
+ } else if (mousePos.y <= 122) {
+ *panel = 9;
+ interimPos->y = 122;
+ walkToPos->x = 127;
+ } else {
+ *panel = 13;
+ interimPos->y = 138;
+ walkToPos->x = 127;
+ }
+ } else if (mousePos.x <= 179) {
+ interimPos->x = 169;
+ if (mousePos.y <= 90) {
+ *panel = 2;
+ interimPos->y = 90;
+ walkToPos->x = 147;
+ } else if (mousePos.y <= 106) {
+ *panel = 6;
+ interimPos->y = 106;
+ walkToPos->x = 147;
+ } else if (mousePos.y <= 122) {
+ *panel = 10;
+ interimPos->y = 122;
+ walkToPos->x = 147;
+ } else {
+ *panel = 14;
+ interimPos->y = 138;
+ walkToPos->x = 147;
+ }
+ } else if (mousePos.x <= 199) {
+ interimPos->x = 189;
+ if (mousePos.y <= 90) {
+ *panel = 3;
+ interimPos->y = 90;
+ walkToPos->x = 167;
+ } else if (mousePos.y <= 106) {
+ *panel = 7;
+ interimPos->y = 106;
+ walkToPos->x = 167;
+ } else if (mousePos.y <= 122) {
+ *panel = 11;
+ interimPos->y = 122;
+ walkToPos->x = 167;
+ } else {
+ *panel = 15;
+ interimPos->y = 138;
+ walkToPos->x = 167;
+ }
+ }
+}
+
+void Scene502::handlePanelAnimation() {
+ int puzzleSolvedFl = true;
+
+ switch (_game._trigger) {
+ case 110:
+ _vm->_sound->command(65);
+ _scene->deleteSequence(_puzzleSequences[_panelPushedNum]);
+ switch (_panelPushedNum) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, _puzzleSprites[_panelPushedNum] - 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+ _scene->_sequences.addTimer(5, 111);
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, _puzzleSprites[_panelPushedNum] - 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+ _scene->_sequences.addTimer(5, 111);
+ break;
+
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ _globals._sequenceIndexes[13] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[13], false, _puzzleSprites[_panelPushedNum] - 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 14);
+ _scene->_sequences.addTimer(5, 111);
+ break;
+
+ default:
+ _globals._sequenceIndexes[14] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[14], false, _puzzleSprites[_panelPushedNum] - 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 14);
+ _scene->_sequences.addTimer(5, 111);
+ break;
+ }
+ break;
+
+ case 111:
+ switch (_panelPushedNum) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ _scene->deleteSequence(_globals._sequenceIndexes[11]);
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ break;
+
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ _scene->deleteSequence(_globals._sequenceIndexes[13]);
+ break;
+
+ default:
+ _scene->deleteSequence(_globals._sequenceIndexes[14]);
+ break;
+ }
+
+ _globals._sequenceIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[16], false, 5, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[16], 14);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[16], _nextPos);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[16], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[16], SEQUENCE_TRIGGER_EXPIRE, 0, 112);
+ break;
+
+ case 112: {
+ int idx = _globals._sequenceIndexes[16];
+ int newSprId = _puzzleSprites[_panelPushedNum] + 4;
+
+ switch (_panelPushedNum) {
+ case 0:
+ case 4:
+ case 8:
+ case 12:
+ if (newSprId > 12)
+ newSprId = 3;
+ break;
+
+ case 1:
+ case 5:
+ case 9:
+ case 13:
+ if (newSprId > 24)
+ newSprId = 15;
+ break;
+
+ case 2:
+ case 6:
+ case 10:
+ case 14:
+ if (newSprId > 36)
+ newSprId = 27;
+ break;
+
+ default:
+ if (newSprId > 48)
+ newSprId = 39;
+ break;
+ }
+
+ switch (_panelPushedNum) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[11], SYNC_SEQ, idx);
+ _scene->_sequences.addTimer(5, 113);
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[12], SYNC_SEQ, idx);
+ _scene->_sequences.addTimer(5, 113);
+ break;
+
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ _globals._sequenceIndexes[13] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[13], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[13], SYNC_SEQ, idx);
+ _scene->_sequences.addTimer(5, 113);
+ break;
+
+ default:
+ _globals._sequenceIndexes[14] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[14], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 14);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[14], SYNC_SEQ, idx);
+ _scene->_sequences.addTimer(5, 113);
+ break;
+ }
+ }
+ break;
+
+ case 113: {
+ switch (_panelPushedNum) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ _scene->deleteSequence(_globals._sequenceIndexes[11]);
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ _scene->deleteSequence(_globals._sequenceIndexes[12]);
+ break;
+
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ _scene->deleteSequence(_globals._sequenceIndexes[13]);
+ break;
+
+ default:
+ _scene->deleteSequence(_globals._sequenceIndexes[14]);
+ break;
+ }
+
+ int newSprId = _puzzleSprites[_panelPushedNum] + 3;
+
+ switch (_panelPushedNum) {
+ case 0:
+ case 4:
+ case 8:
+ case 12:
+ if (newSprId > 12)
+ newSprId = 2;
+ break;
+
+ case 1:
+ case 5:
+ case 9:
+ case 13:
+ if (newSprId > 24)
+ newSprId = 14;
+ break;
+
+ case 2:
+ case 6:
+ case 10:
+ case 14:
+ if (newSprId > 36)
+ newSprId = 26;
+ break;
+
+ default:
+ if (newSprId > 48)
+ newSprId = 38;
+ break;
+ }
+ _puzzleSprites[_panelPushedNum] = newSprId;
+ ++_puzzlePictures[_panelPushedNum];
+ if (_puzzlePictures[_panelPushedNum] >= 5)
+ _puzzlePictures[_panelPushedNum] = 1;
+
+ switch (_panelPushedNum) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ _globals._sequenceIndexes[11] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[11], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 14);
+ _puzzleSequences[_panelPushedNum] = _globals._sequenceIndexes[11];
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ _globals._sequenceIndexes[12] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[12], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 14);
+ _puzzleSequences[_panelPushedNum] = _globals._sequenceIndexes[12];
+ break;
+
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ _globals._sequenceIndexes[13] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[13], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 14);
+ _puzzleSequences[_panelPushedNum] = _globals._sequenceIndexes[13];
+ break;
+
+ default:
+ _globals._sequenceIndexes[14] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[14], false, newSprId);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 14);
+ _puzzleSequences[_panelPushedNum] = _globals._sequenceIndexes[14];
+ break;
+ }
+
+ for (int i = 0; i < 16; i++) {
+ if (_puzzlePictures[i] != 1)
+ puzzleSolvedFl = false;
+ }
+
+ if (puzzleSolvedFl && !_trapDoorHotspotEnabled) {
+ _trapDoorHotspotEnabled = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[6]);
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('t', 1), 80);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene504::Scene504(MADSEngine *vm) : Scene5xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _anim5ActvFl = false;
+ _playingMusicFl = false;
+ _chairDialogDoneFl = false;
+ _fireBreathFl = false;
+
+ _songNum = -1;
+ _input3Count = -1;
+ _playCount = -1;
+ _listenStatus = -1;
+ _listenFrame = -1;
+ _chairStatus = -1;
+ _chairFrame = -1;
+ _playStatus = -1;
+ _playFrame = -1;
+ _phantomStatus = -1;
+ _phantomFrame = -1;
+ _christineTalkCount = -1;
+ _deathCounter = -1;
+}
+
+void Scene504::synchronize(Common::Serializer &s) {
+ Scene5xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_anim3ActvFl);
+ s.syncAsByte(_anim4ActvFl);
+ s.syncAsByte(_anim5ActvFl);
+ s.syncAsByte(_playingMusicFl);
+ s.syncAsByte(_chairDialogDoneFl);
+ s.syncAsByte(_fireBreathFl);
+
+ s.syncAsSint16LE(_songNum);
+ s.syncAsSint16LE(_input3Count);
+ s.syncAsSint16LE(_playCount);
+ s.syncAsSint16LE(_listenStatus);
+ s.syncAsSint16LE(_listenFrame);
+ s.syncAsSint16LE(_chairStatus);
+ s.syncAsSint16LE(_chairFrame);
+ s.syncAsSint16LE(_playStatus);
+ s.syncAsSint16LE(_playFrame);
+ s.syncAsSint16LE(_phantomStatus);
+ s.syncAsSint16LE(_phantomFrame);
+ s.syncAsSint16LE(_christineTalkCount);
+ s.syncAsSint16LE(_deathCounter);
+}
+
+void Scene504::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_PHANTOM);
+ _scene->addActiveVocab(NOUN_CHRISTINE);
+}
+
+void Scene504::enter() {
+ _vm->_disableFastwalk = true;
+
+ _input3Count = 0;
+ _deathCounter = 0;
+ _anim2ActvFl = false;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _playCount = 0;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim3ActvFl = false;
+ _anim4ActvFl = false;
+ _anim5ActvFl = false;
+ _playingMusicFl = false;
+ _fireBreathFl = false;
+ _chairDialogDoneFl = false;
+ _songNum = 0;
+ _phantomStatus = 0;
+ }
+
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+
+ if (!_globals[kRightDoorIsOpen504]) {
+ _vm->_gameConv->get(19);
+ _vm->_gameConv->get(27);
+ } else
+ _vm->_gameConv->get(21);
+
+ _vm->_gameConv->get(26);
+
+ _globals._spriteIndexes[14] = _scene->_sprites.addSprites("*RDR_9");
+ _globals._spriteIndexes[15] = _scene->_sprites.addSprites(formAnimName('x', 8));
+
+ if (!_game._objects.isInRoom(OBJ_MUSIC_SCORE)) {
+ _globals._sequenceIndexes[15] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[15], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 14);
+ _scene->_hotspots.activate(NOUN_MUSIC_SCORE, false);
+ }
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 7), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ if (_globals[kFightStatus] == 0)
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3));
+
+ if ((_scene->_priorSceneId == 505) || ((_scene->_priorSceneId == 504) && _globals[kRightDoorIsOpen504])) {
+ if ((_globals[kFightStatus] == 0) && (_globals[kCoffinStatus] == 2)) {
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+
+ _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 7), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 0));
+
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_6", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACERAL", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEXDFR", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEPHN", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 5));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('a', 3), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 6), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 7), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 0), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('p', 1), 0);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_PHANTOM, VERB_LOOK_AT, SYNTAX_MASC_NOT_PROPER, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(-2, -2), FACING_NONE);
+
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 4);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 8);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 13);
+
+ _phantomStatus = 0;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _anim3ActvFl = true;
+ } else {
+ if (_globals[kFightStatus])
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+
+ if (_globals[kCoffinStatus] != 2) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ }
+
+ _game._player._playerPos = Common::Point(317, 115);
+ _game._player._facing = FACING_SOUTHWEST;
+ _game._player.walk(Common::Point(279, 121), FACING_SOUTHWEST);
+
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+
+ if (!_game._visitedScenes.exists(506) && (_globals[kCoffinStatus] == 2)) {
+ _scene->changeVariant(1);
+
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ _anim5ActvFl = true;
+
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_2");
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACERAL", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEXDFR",PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEPHN", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('p', 3), 0);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _phantomStatus = 5;
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->setAnimFrame(_globals._animationIndexes[3], 79);
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(66, 119), FACING_NORTHWEST);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 0);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 1);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 2);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 3);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 4);
+ }
+ }
+ } else if (_scene->_priorSceneId == 506) {
+ _game._player._playerPos = Common::Point(0, 109);
+ _game._player._facing = FACING_SOUTHEAST;
+ _game._player.walk(Common::Point(39, 118), FACING_SOUTHEAST);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ } else if (_scene->_priorSceneId == 504) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+
+ _game._player._playerPos = Common::Point(147, 131);
+ _game._player._facing = FACING_EAST;
+ } else if ((_scene->_priorSceneId == 502) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('t', 1), 60);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _game._player._playerPos = Common::Point(147, 131);
+ _game._player._facing = FACING_EAST;
+ }
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (!_globals[kRightDoorIsOpen504]) {
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ }
+
+ if (_vm->_gameConv->_restoreRunning == 19) {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 67);
+ _anim0ActvFl = true;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _game._player._playerPos = Common::Point(286, 120);
+ _game._player._facing = FACING_EAST;
+ _listenStatus = 0;
+ _scene->setAnimFrame(_globals._animationIndexes[0], 8);
+ _vm->_gameConv->run(19);
+ _vm->_gameConv->exportValue(_game._difficulty);
+ } else if (_vm->_gameConv->_restoreRunning == 27) {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('o', 1), 100);
+
+ _scene->setAnimFrame(_globals._animationIndexes[1], 22);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _playingMusicFl = false;
+ _anim1ActvFl = true;
+ _playStatus = 0;
+ _vm->_gameConv->run(27);
+ } else if ((_globals[kFightStatus] <= 1) && (_globals[kCoffinStatus] == 2)) {
+ if ((_phantomStatus == 1) || (_phantomStatus == 2)) {
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 0));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_6", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACERAL", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEXDFR", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEPHN", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 5));
+ _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('a', 3), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 6), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 7), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 0), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('p', 1), 0);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_PHANTOM, VERB_LOOK_AT, SYNTAX_MASC_NOT_PROPER, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(-2, -2), FACING_NONE);
+
+ if (_phantomStatus == 1)
+ _scene->setAnimFrame(_globals._animationIndexes[3], _vm->getRandomNumber(109, 112));
+ else if (_phantomStatus == 2) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], _vm->getRandomNumber(148, 150));
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ }
+
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 4);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 8);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 13);
+
+ _game._player._visible = false;
+ _anim3ActvFl = true;
+
+ if (_vm->_gameConv->_restoreRunning == 21) {
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(21);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_MUSIC_SCORE));
+ }
+ } else if (_phantomStatus == 4) {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_3");
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACERAL", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEXDFR", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEPHN", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 8), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('p', 2), 130);
+ _scene->setAnimFrame(_globals._animationIndexes[3], 159);
+
+ _game._player._playerPos = Common::Point(130, 135);
+ _game._player._facing = FACING_NORTHEAST;
+ _game._player._visible = true;
+ _anim4ActvFl = true;
+
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(21);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_MUSIC_SCORE));
+ }
+ } else if (_globals[kFightStatus] == 2) {
+ if (!_game._visitedScenes.exists(506)) {
+ _scene->changeVariant(1);
+
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ _anim5ActvFl = true;
+
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_3");
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACERAL", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEXDFR",PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*FACEPHN", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('p', 3), 0);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _phantomStatus = 5;
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->setAnimFrame(_globals._animationIndexes[3], 79);
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(66, 119), FACING_NORTHWEST);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 0);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 1);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 2);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 3);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 4);
+ } else {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ }
+ } else {
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ if (!_globals[kHeListened])
+ _scene->_sequences.addTimer(30, 62);
+ }
+ }
+
+ sceneEntrySound();
+}
+
+void Scene504::step() {
+ if (_anim0ActvFl)
+ handleListenAnimation();
+
+ if (_anim1ActvFl)
+ handleOrganAnimation();
+
+ if (_anim2ActvFl)
+ handleChairAnimation();
+
+ if (_anim3ActvFl)
+ handlePhantomAnimation1();
+
+ if (_anim4ActvFl)
+ handlePhantomAnimation2();
+
+ if (_anim5ActvFl)
+ handlePhantomAnimation3();
+
+ if (_game._trigger == 120) {
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(21);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_MUSIC_SCORE));
+ _vm->_gameConv->exportValue(1);
+ _globals[kFightStatus] = 1;
+ }
+
+ if (_game._trigger == 60) {
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->drawToBackground(_globals._spriteIndexes[0], 1, Common::Point(-32000, -32000), 0, 100);
+ _scene->_sequences.addTimer(30, 61);
+ }
+
+ if (_game._trigger == 61) {
+ _game._player._stepEnabled = true;
+ _scene->_sequences.addTimer(60, 62);
+ }
+
+ if (_game._trigger == 62) {
+ _globals[kHeListened] = true;
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(19);
+ _vm->_gameConv->exportValue(_game._difficulty);
+ }
+
+ if (_game._trigger == 80) {
+ _vm->_sound->command(73);
+ _globals[kRightDoorIsOpen504] = true;
+ _scene->deleteSequence(_globals._sequenceIndexes[2]);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 90);
+ }
+
+ if (_game._trigger == 90) {
+ _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 91);
+ }
+
+ if (_game._trigger == 91) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 92);
+ }
+
+ if (_game._trigger == 92)
+ _fireBreathFl = true;
+
+ if (_fireBreathFl) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, -2);
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, -2);
+ _fireBreathFl = false;
+ }
+
+ if (_game._trigger == 130) {
+ _scene->freeAnimation(_globals._animationIndexes[3]);
+ _scene->_sprites.remove(_globals._spriteIndexes[12]);
+
+ _anim4ActvFl = false;
+ _anim5ActvFl = true;
+
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_2", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_3", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ _scene->changeVariant(1);
+
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('p', 3), 0);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(66, 119), FACING_NORTHWEST);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 0);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 1);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 2);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 3);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[3], 4);
+ }
+
+ if (_game._trigger == 67) {
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _anim0ActvFl = false;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ }
+
+ if (_game._trigger == 136)
+ _scene->_nextSceneId = 506;
+
+ if (_game._trigger == 100) {
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ _game._player._playerPos = Common::Point(156, 114);
+ _game._player._visible = true;
+ _anim1ActvFl = false;
+ _game._player.resetFacing(FACING_EAST);
+ _scene->_sequences.addTimer(10, 101);
+ }
+
+ if (_game._trigger == 101) {
+ _game._player._stepEnabled = true;
+ _scene->_sprites.remove(_globals._spriteIndexes[5]);
+ _scene->_sprites.remove(_globals._spriteIndexes[4]);
+ }
+}
+
+void Scene504::actions() {
+ if (_vm->_gameConv->_running == 26) {
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_SIT_IN, NOUN_LARGE_CHAIR)) {
+ if (!_anim2ActvFl) {
+ _chairStatus = 0;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _anim2ActvFl = true;
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('c', 1), 0);
+ _game.syncTimers(SYNC_ANIM, _globals._animationIndexes[0], SYNC_PLAYER, 0);
+ } else
+ _vm->_dialogs->show(50436);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_game._trigger == 95) {
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 67);
+ _listenStatus = 0;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _anim0ActvFl = true;
+ _globals[kHeListened] = true;
+ _vm->_gameConv->run(19);
+ _vm->_gameConv->exportValue(_game._difficulty);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_game._trigger == 67) {
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _anim0ActvFl = false;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 19) {
+ handleListenConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 27) {
+ handlePlayConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 21) {
+ handleFightConversation();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_game._trigger == 100) {
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ _game._player._playerPos = Common::Point(156, 114);
+ _game._player._visible = true;
+ _anim1ActvFl = false;
+ _game._player.resetFacing(FACING_EAST);
+ _scene->_sequences.addTimer(10, 101);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_game._trigger == 101) {
+ _game._player._stepEnabled = true;
+ _scene->_sprites.remove(_globals._spriteIndexes[5]);
+ _scene->_sprites.remove(_globals._spriteIndexes[4]);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_SIT_ON, NOUN_ORGAN_BENCH)) {
+ if (_globals[kRightDoorIsOpen504])
+ _vm->_dialogs->show(50427);
+ else {
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('o', 1), 100);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _playingMusicFl = false;
+ _anim1ActvFl = true;
+ _playStatus = 0;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR) || _action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR)) {
+ if (_globals[kRightDoorIsOpen504]) {
+ if (_vm->_gameConv->_running == 26)
+ _vm->_gameConv->abortConv();
+
+ _scene->_nextSceneId = 505;
+ } else
+ _vm->_dialogs->show(50418);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_DOOR) || _action.isAction(VERB_OPEN, NOUN_LEFT_DOOR)) {
+ if (_globals[kFightStatus]) {
+ if (_game._visitedScenes.exists(506))
+ _scene->_nextSceneId = 506;
+ else if (!_game._objects.isInInventory(OBJ_MUSIC_SCORE))
+ _vm->_dialogs->show(50425);
+ else {
+ _phantomStatus = 6;
+ _game._player._stepEnabled = false;
+ }
+ } else
+ _vm->_dialogs->show(50418);
+
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_MUSIC_SCORE)) {
+ switch (_game._trigger) {
+ case (0):
+ if (_game._objects.isInRoom(OBJ_MUSIC_SCORE)) {
+ _globals[kPlayerScore] += 5;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[14] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[14], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[14], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[14], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[14], SEQUENCE_TRIGGER_SPRITE, 4, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[14], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ _action._inProgress = false;
+ return;
+ }
+ break;
+
+ case 1:
+ _globals._sequenceIndexes[15] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[15], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 14);
+ _scene->_hotspots.activate(NOUN_MUSIC_SCORE, false);
+ _game._objects.addToInventory(OBJ_MUSIC_SCORE);
+ _vm->_sound->command(26);
+ _action._inProgress = false;
+ return;
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[14]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ _action._inProgress = false;
+ return;
+ break;
+
+ case 3:
+ _vm->_dialogs->showItem(OBJ_MUSIC_SCORE, 820, 0);
+ _game._player._stepEnabled = true;
+ _action._inProgress = false;
+ return;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(50410);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(50411);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(50412);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ORGAN)) {
+ _vm->_dialogs->show(50413);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_ORGAN_BENCH)) {
+ _vm->_dialogs->show(50414);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_MUSIC_SCORE) && _game._objects.isInRoom(OBJ_MUSIC_SCORE)) {
+ _vm->_dialogs->show(50415);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LEFT_DOOR)) {
+ _vm->_dialogs->show(50416);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RIGHT_DOOR)) {
+ _vm->_dialogs->show(_globals[kRightDoorIsOpen504] ? 50434 : 50417);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TABLE)) {
+ _vm->_dialogs->show(50419);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(50420);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LARGE_CHAIR)) {
+ _vm->_dialogs->show(50422);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHRISTINE)) {
+ _vm->_dialogs->show(_globals[kFightStatus] ? 50426 : 50429);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_PHANTOM)) {
+ _vm->_dialogs->show(50428);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_TRAP_DOOR)) {
+ _vm->_dialogs->show(50421);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE) && _action.isObject(NOUN_RIGHT_DOOR) && !_globals[kRightDoorIsOpen504]) {
+ _vm->_dialogs->show(50433);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_CLOSE) && _action.isObject(NOUN_LEFT_DOOR) && !_globals[kFightStatus] && !_game._visitedScenes.exists(506)) {
+ _vm->_dialogs->show(50433);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_anim3ActvFl && (_action.isAction(VERB_TAKE, NOUN_SWORD) || _action.isAction(VERB_ATTACK, NOUN_PHANTOM))) {
+ _game._player._stepEnabled = false;
+ _input3Count = 0;
+ _phantomStatus = 4;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_CHRISTINE)) {
+ _vm->_gameConv->run(21);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_MUSIC_SCORE));
+ _vm->_gameConv->exportValue(0);
+ _phantomStatus = 7;
+ _christineTalkCount = 0;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_PHANTOM)) {
+ _vm->_dialogs->show(50431);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHRISTINE)) {
+ _vm->_dialogs->show(50435);
+ _action._inProgress = false;
+ return;
+ }
+}
+
+void Scene504::preActions() {
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR) || _action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR)) {
+ if (_globals[kRightDoorIsOpen504]) {
+ if ((_globals[kFightStatus] == 2) && !_game._visitedScenes.exists(506)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player.walk(Common::Point(317, 115), FACING_NORTHEAST);
+ _game._player._readyToWalk = false;
+ _game._player._needToWalk = false;
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(2);
+ _scene->_sequences.addTimer(6, 1);
+ break;
+
+ case 1:
+ if (_vm->_gameConv->_running >= 0)
+ _scene->_sequences.addTimer(6, 1);
+ else {
+ _game._player._stepEnabled = true;
+ _action._inProgress = true;
+ _game._player._needToWalk = true;
+ _game._player._readyToWalk = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else
+ _game._player.walk(Common::Point(317, 115), FACING_NORTHEAST);
+ } else if (_globals[kHeListened] || (_globals[kFightStatus] == 0))
+ _game._player.walk(Common::Point(286, 120), FACING_NORTHEAST);
+ }
+
+ if (_anim2ActvFl && !_action.isAction(VERB_SIT_IN) && _game._player._needToWalk) {
+ _chairStatus = 1;
+ _game._player._stepEnabled = false;
+ _game._player._readyToWalk = false;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_DOOR) || _action.isAction(VERB_OPEN, NOUN_LEFT_DOOR)) {
+ if ((_globals[kFightStatus] == 0) && (_globals[kCoffinStatus] == 2) && !_game._visitedScenes.exists(506)) {
+ _vm->_dialogs->show(50432);
+ _game._player.cancelCommand();
+ return;
+ } else if (_game._visitedScenes.exists(506))
+ _game._player.walk(Common::Point(0, 109), FACING_NORTHWEST);
+ else if (!_game._objects.isInInventory(OBJ_MUSIC_SCORE) || (_globals[kFightStatus] == 0))
+ _game._player.walk(Common::Point(33, 116), FACING_NORTHWEST);
+ }
+
+ if ((_globals[kFightStatus] == 0) && (_globals[kCoffinStatus] == 2) && !_game._visitedScenes.exists(506)
+ && !_action.isAction(VERB_LOOK) && !_action.isAction(VERB_LOOK_AT) && !_action.isAction(VERB_ATTACK)
+ && !_action.isAction(VERB_TAKE, NOUN_SWORD) && !_action.isAction(VERB_TALK_TO, NOUN_PHANTOM)) {
+ _vm->_dialogs->show(50430);
+ _game._player.cancelCommand();
+ }
+}
+
+void Scene504::handleListenAnimation() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ if (curFrame == _listenFrame)
+ return;
+
+ _listenFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_listenFrame) {
+ case 8:
+ _vm->_gameConv->release();
+ break;
+
+ case 9:
+ resetFrame = (_listenStatus == 0) ? 8 : 9;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _listenFrame = resetFrame;
+ }
+}
+
+void Scene504::handleOrganAnimation() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ if (curFrame == _playFrame)
+ return;
+
+ _playFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_playFrame) {
+ case 22:
+ _game._player._stepEnabled = true;
+ _vm->_gameConv->run(27);
+ break;
+
+ case 23:
+ if (_playStatus == 0)
+ resetFrame = 22;
+ else {
+ _game._player._stepEnabled = false;
+ if (_songNum == 5) {
+ _playingMusicFl = false;
+ _fireBreathFl = false;
+ resetFrame = 104;
+ }
+ }
+ break;
+
+ case 28:
+ if (!_playingMusicFl) {
+ _playingMusicFl = true;
+ _fireBreathFl = true;
+ _game._player._stepEnabled = false;
+
+ switch (_songNum) {
+ case 1:
+ _vm->_sound->command(34);
+ break;
+
+ case 2:
+ _vm->_sound->command(37);
+ break;
+
+ case 3:
+ _vm->_sound->command(35);
+ break;
+
+ case 4:
+ _vm->_sound->command(36);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case 69:
+ if ((_globals[kRightDoorIsOpen504]) && (_playCount >= 2)) {
+ _playCount = 0;
+ resetFrame = 102;
+ _vm->_sound->command(2);
+ _vm->_sound->command(16);
+ } else if (_songNum != _globals[kMusicSelected]) {
+ _vm->_sound->command(2);
+ _fireBreathFl = true;
+ resetFrame = 75;
+ } else {
+ resetFrame = 25;
+ ++_playCount;
+ if (!_globals[kRightDoorIsOpen504]) {
+ _scene->_sequences.addTimer(1, 80);
+ _globals[kPlayerScore] += 5;
+ }
+ }
+ break;
+
+ case 76:
+ _scene->playSpeech(7);
+ break;
+
+ case 90:
+ _vm->_sound->command(27);
+ break;
+
+ case 102:
+ ++_deathCounter;
+ if (_deathCounter >= 17)
+ _scene->_reloadSceneFlag = true;
+ else
+ resetFrame = 101;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _playFrame = resetFrame;
+ }
+}
+
+void Scene504::handlePhantomAnimation1() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame();
+ if (curFrame == _phantomFrame)
+ return;
+
+ _phantomFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_phantomFrame) {
+ case 41:
+ _vm->_gameConv->run(21);
+ _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_MUSIC_SCORE));
+ _vm->_gameConv->exportValue(0);
+ break;
+
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ resetFrame = (_phantomStatus == 0) ? _vm->getRandomNumber(51, 54) : 55;
+ break;
+
+ case 78:
+ _vm->_gameConv->release();
+ break;
+
+ case 110:
+ case 111:
+ case 112:
+ case 113:
+ resetFrame = (_phantomStatus == 1) ? _vm->getRandomNumber(109, 112) : 113;
+ break;
+
+ case 142:
+ _scene->drawToBackground(_globals._spriteIndexes[13], 1, Common::Point(-32000, -32000), 0, 100);
+ break;
+
+ case 143:
+ _game._player._stepEnabled = true;
+ break;
+
+ case 149:
+ case 150:
+ case 151:
+ ++_input3Count;
+
+ if (_phantomStatus == 4) {
+ _game._player._stepEnabled = false;
+ resetFrame = 200;
+ } else if (_input3Count >= 9) {
+ _game._player._stepEnabled = false;
+ resetFrame = 151;
+ } else if (_phantomStatus == 2)
+ resetFrame = _vm->getRandomNumber(148, 150);
+ break;
+
+ case 169:
+ _vm->_sound->command(1);
+ _scene->playSpeech(7);
+ break;
+
+ case 180:
+ _vm->_sound->command(27);
+ break;
+
+ case 187:
+ _deathCounter = 0;
+ break;
+
+ case 189:
+ ++_deathCounter;
+ if (_deathCounter >= 29)
+ _scene->_reloadSceneFlag = true;
+ else
+ resetFrame = 188;
+ break;
+
+ case 227:
+
+ _scene->freeAnimation(_globals._animationIndexes[3]);
+ _scene->_sprites.remove(_globals._spriteIndexes[9]);
+ _scene->_sprites.remove(_globals._spriteIndexes[8]);
+ _scene->_sprites.remove(_globals._spriteIndexes[7]);
+ _scene->_sprites.remove(_globals._spriteIndexes[10]);
+ _scene->_sprites.remove(_globals._spriteIndexes[11]);
+
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_3", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 8), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._animationIndexes[3] = _scene->loadAnimation(formAnimName('p', 2), 130);
+
+ _scene->setAnimFrame(_globals._animationIndexes[3], 27);
+ resetFrame = -1;
+ _anim3ActvFl = false;
+ _anim4ActvFl = true;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], resetFrame);
+ _phantomFrame = resetFrame;
+ }
+}
+
+void Scene504::handlePhantomAnimation2() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame();
+ if (curFrame == _phantomFrame)
+ return;
+
+ _phantomFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_phantomFrame) {
+ case 78:
+ _scene->playSpeech(9);
+ break;
+
+ case 119:
+ _game._player._playerPos = Common::Point(114, 137);
+ _game._player._facing = FACING_WEST;
+ _game._player._visible = true;
+ _globals[kPlayerScore] += 5;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[3]);
+ _game._player.walk(Common::Point(130, 135), FACING_NORTHEAST);
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+ _game._player.setWalkTrigger(120);
+ _vm->_sound->command(1);
+ break;
+
+ case 150:
+ _vm->_sound->command(16);
+ break;
+
+ case 160:
+ switch (_playStatus) {
+ case 5:
+ resetFrame = 164;
+ break;
+
+ case 7:
+ resetFrame = 160;
+ break;
+
+ default:
+ resetFrame = 159;
+ break;
+ }
+ break;
+
+ case 161:
+ case 162:
+ case 163:
+ case 164:
+ resetFrame = (_phantomStatus == 5) ? 159 : _vm->getRandomNumber(160, 162);
+
+ ++_christineTalkCount;
+ if (_christineTalkCount > 10) {
+ resetFrame = 159;
+ if (_phantomStatus != 5)
+ _phantomStatus = 4;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], resetFrame);
+ _phantomFrame = resetFrame;
+ }
+}
+
+void Scene504::handlePhantomAnimation3() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[3]]->getCurrentFrame();
+ if (curFrame == _phantomFrame)
+ return;
+
+ _phantomFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_phantomFrame) {
+ case 58:
+ _game._player._stepEnabled = true;
+ break;
+
+ case 80:
+ if (_phantomStatus == 7)
+ resetFrame = 116;
+ else if (_phantomStatus != 6)
+ resetFrame = 79;
+ break;
+
+ case 115:
+ _game._player.walk(Common::Point(0, 109), FACING_NORTHWEST);
+ _game._player.setWalkTrigger(136);
+ break;
+
+ case 116:
+ resetFrame = 115;
+ break;
+
+ case 117:
+ case 118:
+ case 119:
+ resetFrame = _vm->getRandomNumber(116, 118);
+ ++_christineTalkCount;
+ if (_christineTalkCount > 10) {
+ resetFrame = 79;
+ if (_phantomStatus != 6)
+ _phantomStatus = 5;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[3], resetFrame);
+ _phantomFrame = resetFrame;
+ }
+}
+
+void Scene504::handleChairAnimation() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ if (curFrame == _chairFrame)
+ return;
+
+ _chairFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_chairFrame) {
+ case 24:
+ _game._player._stepEnabled = true;
+ break;
+
+ case 25:
+ case 26:
+ case 30:
+ case 31:
+ if (!_chairDialogDoneFl) {
+ _chairDialogDoneFl = true;
+ _vm->_dialogs->show(50424);
+ }
+
+ if (_chairStatus == 0) {
+ if (_vm->getRandomNumber(1,5) == 1)
+ resetFrame = _vm->getRandomNumber(24, 30);
+ else
+ resetFrame = _chairFrame - 1;
+ } else
+ resetFrame = 31;
+ break;
+
+ case 47:
+ resetFrame = -1;
+ _game._player._stepEnabled = true;
+ _game._player._visible = true;
+ _game._player._readyToWalk = true;
+ _anim2ActvFl = false;
+ _chairDialogDoneFl = false;
+ _scene->freeAnimation(_globals._animationIndexes[2]);
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], resetFrame);
+ _chairFrame = resetFrame;
+ }
+}
+
+void Scene504::handleListenConversation() {
+ if ((_action._activeAction._verbId == 2) && !_game._trigger) {
+ _game._player.walk(Common::Point(286, 120), FACING_EAST);
+ _game._player.setWalkTrigger(95);
+ }
+
+ if (_action._activeAction._verbId == 12)
+ _listenStatus = 1;
+}
+
+void Scene504::handlePlayConversation() {
+ switch (_action._activeAction._verbId) {
+ case 2:
+ *_vm->_gameConv->_nextStartNode = 1;
+ _vm->_gameConv->abortConv();
+ _playStatus = 1;
+ _songNum = 1;
+ break;
+
+ case 3:
+ *_vm->_gameConv->_nextStartNode = 1;
+ _vm->_gameConv->abortConv();
+ _playStatus = 1;
+ _songNum = 2;
+ break;
+
+ case 4:
+ *_vm->_gameConv->_nextStartNode = 1;
+ _vm->_gameConv->abortConv();
+ _playStatus = 1;
+ _songNum = 3;
+ break;
+
+ case 5:
+ *_vm->_gameConv->_nextStartNode = 1;
+ _vm->_gameConv->abortConv();
+ _playStatus = 1;
+ _songNum = 4;
+ break;
+
+ case 6:
+ *_vm->_gameConv->_nextStartNode = 1;
+ _vm->_gameConv->abortConv();
+ _playStatus = 1;
+ _songNum = 5;
+ break;
+
+ case 8:
+ *_vm->_gameConv->_nextStartNode = 1;
+ _vm->_gameConv->abortConv();
+ _playStatus = 1;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene504::handleFightConversation() {
+ switch (_action._activeAction._verbId) {
+ case 3:
+ _vm->_gameConv->hold();
+ _phantomStatus = 1;
+ break;
+
+ case 8:
+ _phantomStatus = 2;
+ break;
+
+ case 10:
+ case 11:
+ case 12:
+ case 15:
+ _vm->_gameConv->setInterlocutorTrigger(145);
+ break;
+
+ case 14:
+ case 17:
+ _phantomStatus = 5;
+ _globals[kFightStatus] = 2;
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_game._trigger == 145) && (_phantomStatus != 5)) {
+ _phantomStatus = 7;
+ _christineTalkCount = 0;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene505::Scene505(MADSEngine *vm) : Scene5xx(vm) {
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _checkFrame106 = false;
+ _leaveRoomFl = false;
+ _partedFl = false;
+
+ _raoulStatus = -1;
+ _raoulFrame = -1;
+ _raoulCount = -1;
+ _bothStatus = -1;
+ _bothFrame = -1;
+ _bothCount = -1;
+ _partStatus = -1;
+ _partFrame = -1;
+ _partCount = -1;
+}
+
+void Scene505::synchronize(Common::Serializer &s) {
+ Scene5xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_anim1ActvFl);
+ s.syncAsByte(_anim2ActvFl);
+ s.syncAsByte(_checkFrame106);
+ s.syncAsByte(_leaveRoomFl);
+ s.syncAsByte(_partedFl);
+
+ s.syncAsSint16LE(_raoulStatus);
+ s.syncAsSint16LE(_raoulFrame);
+ s.syncAsSint16LE(_raoulCount);
+ s.syncAsSint16LE(_bothStatus);
+ s.syncAsSint16LE(_bothFrame);
+ s.syncAsSint16LE(_bothCount);
+ s.syncAsSint16LE(_partStatus);
+ s.syncAsSint16LE(_partFrame);
+ s.syncAsSint16LE(_partCount);
+}
+
+void Scene505::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ if ((_globals[kCoffinStatus] == 2) && (!_globals[kChrisLeft505]))
+ _scene->_variant = 1;
+
+ _scene->addActiveVocab(NOUN_CHRISTINE);
+}
+
+void Scene505::enter() {
+ _vm->_disableFastwalk = true;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _partedFl = false;
+ _leaveRoomFl = false;
+ _anim0ActvFl = false;
+ _anim1ActvFl = false;
+ _anim2ActvFl = false;
+ _checkFrame106 = false;
+ }
+
+ _vm->_gameConv->get(20);
+ _scene->_hotspots.activateAtPos(NOUN_LID, false, Common::Point(216, 44));
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('x', 6));
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 4));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 5));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 4));
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ if (_vm->_gameConv->_restoreRunning == 20) {
+ _scene->_hotspots.activate(NOUN_LID, false);
+ _scene->_hotspots.activateAtPos(NOUN_LID, true, Common::Point(216, 44));
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, 12);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('c', 1), 65);
+ _scene->setAnimFrame(_globals._animationIndexes[1], 109);
+ _anim1ActvFl = true;
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _bothStatus = 3;
+
+ _vm->_gameConv->run(20);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ } else if (_partedFl && (_globals[kFightStatus] == 0)) {
+ _scene->_hotspots.activate(NOUN_LID, false);
+ _scene->_hotspots.activateAtPos(NOUN_LID, true, Common::Point(216, 44));
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, 12);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+
+ _anim2ActvFl = true;
+ _bothStatus = 3;
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('b', 1), 0);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(91, 108), FACING_NORTHWEST);
+ _scene->setAnimFrame(_globals._animationIndexes[2], 89);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[2], 3);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[2], 4);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[2], 5);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[2], 6);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[2], 7);
+ } else if (_globals[kFightStatus]) {
+ _scene->_hotspots.activate(NOUN_LID, false);
+ _scene->_hotspots.activateAtPos(NOUN_LID, true, Common::Point(216, 44));
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, 12);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+ } else {
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('c', 1), 65);
+ _anim1ActvFl = true;
+ _bothStatus = 0;
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ }
+ }
+
+ if ((_scene->_priorSceneId == 504) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(5, 87);
+ _game._player._facing = FACING_EAST;
+ _game._player._stepEnabled = false;
+ _game._player.walk(Common::Point(58, 104), FACING_SOUTHEAST);
+ if (_globals[kCoffinStatus] != 2) {
+ _game._player.setWalkTrigger(70);
+ _anim1ActvFl = true;
+ _bothStatus = 0;
+ _scene->_hotspots.activate(NOUN_CHRISTINE, true);
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('c', 1), 65);
+ } else {
+ _scene->_hotspots.activate(NOUN_LID, false);
+ _scene->_hotspots.activateAtPos(NOUN_LID, true, Common::Point(216, 44));
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, 12);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+ _game._player._stepEnabled = true;
+ }
+ }
+
+ sceneEntrySound();
+}
+
+void Scene505::step() {
+ if (_anim0ActvFl)
+ handleRaoulAnimation();
+
+ if (_anim1ActvFl)
+ handleBothanimation();
+
+ if (_anim2ActvFl)
+ handlePartedAnimation();
+
+ if (_game._trigger == 65) {
+ _scene->freeAnimation(_globals._animationIndexes[1]);
+ _vm->_sound->command(1);
+ _partedFl = true;
+ _anim2ActvFl = true;
+ _anim1ActvFl = false;
+ _globals._animationIndexes[2] = _scene->loadAnimation(formAnimName('b', 1), 0);
+
+ int hotspotIDx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(hotspotIDx, Common::Point(91, 108), FACING_NORTHWEST);
+ _scene->_dynamicHotspots[hotspotIDx]._articleNumber = PREP_ON;
+ _scene->setDynamicAnim(hotspotIDx, _globals._animationIndexes[2], 3);
+ _scene->setDynamicAnim(hotspotIDx, _globals._animationIndexes[2], 4);
+ _scene->setDynamicAnim(hotspotIDx, _globals._animationIndexes[2], 5);
+ _scene->setDynamicAnim(hotspotIDx, _globals._animationIndexes[2], 6);
+ _scene->setDynamicAnim(hotspotIDx, _globals._animationIndexes[2], 7);
+ }
+
+ if (_game._trigger == 70) {
+ _game._player._stepEnabled = true;
+ if (!_game._visitedScenes._sceneRevisited) {
+ _vm->_gameConv->run(20);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ }
+ }
+}
+
+void Scene505::actions() {
+ if (_game._trigger == 80) {
+ _bothStatus = 2;
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 20) {
+ handleCoffinDialog();
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TALK_TO, NOUN_CHRISTINE)) {
+ if (_globals[kCoffinStatus] != 2)
+ _vm->_dialogs->show(50536);
+ else {
+ _vm->_gameConv->run(20);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ _partStatus = 10;
+ _partCount = 0;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_UNLOCK, NOUN_SARCOPHAGUS) || _action.isAction(VERB_UNLOCK, NOUN_LID)) && !_globals[kLookedAtSkullFace]) {
+ _vm->_dialogs->show(50539);
+ _action._inProgress = false;
+ return;
+ }
+
+ if ((_action.isAction(VERB_UNLOCK, NOUN_SKULL_FACE) || _action.isAction(VERB_PUT, NOUN_KEY, NOUN_SKULL_FACE)) || ((_action.isAction(VERB_UNLOCK, NOUN_SARCOPHAGUS) || _action.isAction(VERB_UNLOCK, NOUN_LID)) && _globals[kLookedAtSkullFace])) {
+ if (_globals[kCoffinStatus] == 0) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[8], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 9, 95);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 96);
+ _action._inProgress = false;
+ return;
+
+ case 95:
+ _vm->_sound->command(76);
+ _vm->_dialogs->show(50528);
+ _action._inProgress = false;
+ return;
+
+ case 96:
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _globals[kCoffinStatus] = 1;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[8]);
+ _action._inProgress = false;
+ return;
+
+ default:
+ break;
+ }
+ } else {
+ _vm->_dialogs->show(50534);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_PUSH, NOUN_SKULL) && (_scene->_customDest.x >= 19)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], false, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 6, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ break;
+
+ case 1: {
+ int sprIdx;
+ _vm->_sound->command(77);
+ if (_scene->_customDest.x <= 44)
+ sprIdx = _globals._spriteIndexes[4];
+ else if (_scene->_customDest.x <= 58)
+ sprIdx = _globals._spriteIndexes[3];
+ else if (_scene->_customDest.x <= 71)
+ sprIdx = _globals._spriteIndexes[2];
+ else if (_scene->_customDest.x <= 84) {
+ sprIdx = _globals._spriteIndexes[1];
+ if (_globals[kCoffinStatus] == 1) {
+ _bothStatus = 1;
+ _scene->_hotspots.activate(NOUN_LID, false);
+ _scene->_hotspots.activate(NOUN_CHRISTINE, false);
+ _scene->_hotspots.activateAtPos(NOUN_LID, true, Common::Point(216, 44));
+ _scene->changeVariant(1);
+ }
+ } else if (_scene->_customDest.x <= 100)
+ sprIdx = _globals._spriteIndexes[5];
+ else
+ sprIdx = _globals._spriteIndexes[6];
+
+ int skullSeqIdx = _scene->_sequences.startPingPongCycle(sprIdx, false, 5, 2);
+ _scene->_sequences.setAnimRange(skullSeqIdx, -1, -2);
+ _scene->_sequences.setDepth(skullSeqIdx, 1);
+ }
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[0]);
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ if (_bothStatus == 1) {
+ _game._player.walk(Common::Point(136, 126), FACING_EAST);
+ _game._player.setWalkTrigger(80);
+ _game._player._stepEnabled = false;
+ }
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR)) {
+ if (_anim2ActvFl) {
+ _leaveRoomFl = true;
+ _game._player._stepEnabled = false;
+ } else {
+ _globals[kChrisLeft505] = true;
+ _scene->_nextSceneId = 504;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(50510);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(50511);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(50512);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SARCOPHAGUS)) {
+ _vm->_dialogs->show((_globals[kCoffinStatus] <= 1) ? 50513 : 50514);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SKULL_FACE)) {
+ _globals[kLookedAtSkullFace] = true;
+ _vm->_dialogs->show(50529);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ _vm->_dialogs->show(50519);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SKULL)) {
+ _vm->_dialogs->show((_scene->_customDest.x < 19) ? 50521 : 50520);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_SKULLS)) {
+ _vm->_dialogs->show(50521);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TOTEM)) {
+ _vm->_dialogs->show(50522);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DESK)) {
+ _vm->_dialogs->show(50523);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_POLE)) {
+ _vm->_dialogs->show(50524);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CURTAIN)) {
+ _vm->_dialogs->show(50525);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHRISTINE)) {
+ _vm->_dialogs->show((_globals[kCoffinStatus] == 2) ? 50530 : 50537);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_LID)) {
+ _vm->_dialogs->show((_globals[kCoffinStatus] == 2) ? 50531 : 50532);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_LOCK, NOUN_SARCOPHAGUS) || _action.isAction(VERB_LOCK, NOUN_LID) || _action.isAction(VERB_LOCK, NOUN_SKULL_FACE)) {
+ _vm->_dialogs->show(50535);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_OPEN, NOUN_SARCOPHAGUS) || _action.isAction(VERB_OPEN, NOUN_LID)) {
+ if (_globals[kCoffinStatus] == 2)
+ _vm->_dialogs->show(50533);
+ else if (_globals[kCoffinStatus] == 1)
+ _vm->_dialogs->show(50518);
+ else
+ _vm->_dialogs->show(50515);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHRISTINE) && (_globals[kCoffinStatus] != 2)) {
+ _vm->_dialogs->show(50538);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHRISTINE)) {
+ _vm->_dialogs->show((_globals[kCoffinStatus] <= 1) ? 50538 : 50540);
+ _action._inProgress = false;
+ }
+}
+
+void Scene505::preActions() {
+ if ((_globals[kCoffinStatus] == 0) && (_action.isAction(VERB_UNLOCK, NOUN_SKULL_FACE) || _action.isAction(VERB_UNLOCK, NOUN_SARCOPHAGUS) || _action.isAction(VERB_PUT, NOUN_KEY, NOUN_SKULL_FACE) || _action.isAction(VERB_UNLOCK, NOUN_LID))) {
+ if (_action.isObject(NOUN_SKULL_FACE) || _globals[kLookedAtSkullFace])
+ _game._player.walk(Common::Point(279, 150), FACING_SOUTHWEST);
+ }
+
+ if (_action.isObject(NOUN_SKULL_FACE) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)))
+ _game._player.walk(Common::Point(279, 150), FACING_SOUTHWEST);
+
+ if (_action.isObject(NOUN_CURTAIN) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)))
+ _game._player._needToWalk = true;
+
+ if (_action.isObject(NOUN_SKULL) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)))
+ _game._player._needToWalk = true;
+}
+
+void Scene505::handleCoffinDialog() {
+ int interlocutorFl = false;
+ int heroFl = false;
+
+ switch (_action._activeAction._verbId) {
+ case 8:
+ heroFl = true;
+ interlocutorFl = true;
+ _bothStatus = 6;
+ break;
+
+ case 14:
+ heroFl = true;
+ interlocutorFl = true;
+ if (!_checkFrame106)
+ _vm->_gameConv->hold();
+ break;
+
+ case 17:
+ heroFl = true;
+ interlocutorFl = true;
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _raoulStatus = 2;
+ }
+ break;
+
+ case 20:
+ heroFl = true;
+ interlocutorFl = true;
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _game._player.walk(Common::Point(244, 130), FACING_SOUTHWEST);
+ _game._player.setWalkTrigger(71);
+ }
+ break;
+
+ case 22:
+ heroFl = true;
+ interlocutorFl = true;
+ if (!_game._trigger) {
+ _vm->_gameConv->hold();
+ _bothStatus = 7;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_game._trigger) {
+ case 70:
+ case 76:
+ _vm->_gameConv->release();
+ break;
+
+ case 71:
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 75);
+ _anim0ActvFl = true;
+ _raoulStatus = 0;
+ _raoulCount = 0;
+ _game._player._visible = false;
+ break;
+
+ case 75:
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ _scene->_sequences.addTimer(10, 76);
+ break;
+
+ case 85:
+ if ((_bothStatus != 6) && (_bothStatus != 0))
+ _bothStatus = 5;
+ break;
+
+ case 90:
+ if ((_bothStatus != 6) && (_bothStatus != 0))
+ _bothStatus = 4;
+ break;
+
+ default:
+ break;
+ }
+
+ if (!heroFl)
+ _vm->_gameConv->setHeroTrigger(85);
+
+ if (!interlocutorFl)
+ _vm->_gameConv->setInterlocutorTrigger(90);
+
+ _bothCount = 0;
+}
+
+void Scene505::handleRaoulAnimation() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ if (curFrame == _raoulFrame)
+ return;
+
+ _raoulFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_raoulFrame) {
+ case 3:
+ _vm->_gameConv->release();
+ break;
+
+ case 4:
+ case 5:
+ case 6:
+ if (_raoulStatus == 0) {
+ resetFrame = _vm->getRandomNumber(3, 5);
+ ++_raoulCount;
+ if (_raoulCount > 20) {
+ _raoulStatus = 1;
+ resetFrame = 3;
+ }
+ break;
+ }
+
+ if (_raoulStatus == 1)
+ resetFrame = 3;
+
+ if (_raoulStatus == 2)
+ resetFrame = 6;
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _raoulFrame = resetFrame;
+ }
+}
+
+void Scene505::handleBothanimation() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame();
+ if (curFrame == _bothFrame)
+ return;
+
+ _bothFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_bothFrame) {
+ case 1:
+ case 20:
+ case 39:
+ if (_bothStatus == 0) {
+ if (_vm->getRandomNumber(1, 35) == 1) {
+ if (_vm->getRandomNumber(1, 2) == 1)
+ resetFrame = 1;
+ else
+ resetFrame = 20;
+ } else
+ resetFrame = 0;
+ } else if (_bothStatus == 1)
+ resetFrame = 39;
+ else
+ resetFrame = 0;
+ break;
+
+ case 14:
+ if (_vm->getRandomNumber(1, 3) == 1)
+ resetFrame = 8;
+ break;
+
+ case 32:
+ if (_vm->getRandomNumber(1, 2) == 1)
+ resetFrame = 28;
+ break;
+
+ case 41:
+ _vm->_sound->command(39);
+ break;
+
+ case 51:
+ _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, 12);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1);
+ _globals[kCoffinStatus] = 2;
+ break;
+
+ case 66:
+ _game._player._stepEnabled = false;
+ _vm->_gameConv->run(20);
+ _vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
+ break;
+
+ case 67:
+ if (_bothStatus == 1)
+ resetFrame = 66;
+ break;
+
+ case 68:
+ _game._player._visible = false;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ case 106:
+ _checkFrame106 = true;
+ _vm->_gameConv->release();
+ break;
+
+ case 109:
+ case 130:
+ _vm->_gameConv->release();
+ break;
+
+ case 110:
+ case 111:
+ case 112:
+ case 113:
+ case 114:
+ case 115:
+ case 131:
+ switch (_bothStatus) {
+ case 4:
+ resetFrame = _vm->getRandomNumber(112, 114);
+ ++_bothCount;
+ if (_bothCount > 20) {
+ _bothStatus = 3;
+ resetFrame = 109;
+ }
+ break;
+
+ case 5:
+ resetFrame = _vm->getRandomNumber(109, 111);
+ ++_bothCount;
+ if (_bothCount > 20) {
+ _bothStatus = 3;
+ resetFrame = 109;
+ }
+ break;
+
+ case 6:
+ resetFrame = 131;
+ _bothStatus = 8;
+ _game._player._stepEnabled = false;
+ break;
+
+ case 7:
+ resetFrame = 115;
+ _bothStatus = 3;
+ break;
+
+ default:
+ resetFrame = 109;
+ break;
+ }
+ break;
+
+ case 127:
+ _vm->_sound->command(26);
+ _game._objects.addToInventory(OBJ_WEDDING_RING);
+ _vm->_dialogs->showItem(OBJ_WEDDING_RING, 821, 0);
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame);
+ _bothFrame = resetFrame;
+ }
+}
+
+void Scene505::handlePartedAnimation() {
+ int curFrame = _scene->_animation[_globals._animationIndexes[2]]->getCurrentFrame();
+ if (curFrame == _partFrame)
+ return;
+
+ _partFrame = curFrame;
+ int resetFrame = -1;
+
+ switch (_partFrame) {
+ case 20:
+ _vm->_sound->command(16);
+ break;
+
+ case 25:
+ _game._player._playerPos = Common::Point(93, 133);
+ _game._player.resetFacing(FACING_WEST);
+ _game._player._visible = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[2]);
+ break;
+
+ case 70:
+ _game._player._stepEnabled = true;
+ break;
+
+ case 90:
+ if (_partStatus == 10)
+ resetFrame = 146;
+ else if (!_leaveRoomFl)
+ resetFrame = 89;
+ break;
+
+ case 145:
+ _scene->_nextSceneId = 504;
+ break;
+
+ case 147:
+ case 148:
+ case 149:
+ resetFrame = _vm->getRandomNumber(146, 148);
+ ++_partCount;
+ if (_partCount > 10) {
+ resetFrame = 89;
+ _partStatus = 8;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[2], resetFrame);
+ _partFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+Scene506::Scene506(MADSEngine *vm) : Scene5xx(vm) {
+ _anim0ActvFl = false;
+ _skipFl = false;
+ _ascendingFl = false;
+}
+
+void Scene506::synchronize(Common::Serializer &s) {
+ Scene5xx::synchronize(s);
+
+ s.syncAsByte(_anim0ActvFl);
+ s.syncAsByte(_skipFl);
+ s.syncAsByte(_ascendingFl);
+}
+
+void Scene506::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+
+ _scene->addActiveVocab(NOUN_CHRISTINE);
+ _scene->addActiveVocab(VERB_LOOK_AT);
+
+ if (!_globals[kChristineIsInBoat])
+ _scene->_variant = 1;
+}
+
+void Scene506::enter() {
+ _vm->_disableFastwalk = true;
+
+ if (_scene->_priorSceneId != RETURNING_FROM_LOADING) {
+ _anim0ActvFl = false;
+ _skipFl = false;
+ _ascendingFl = false;
+ }
+
+ _vm->_gameConv->get(26);
+
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3));
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('p', 0));
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 0), PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RDR_9");
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_6", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_3", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*CHR_2", PALFLAG_ALL_TO_CLOSEST | PALFLAG_ANY_TO_CLOSEST);
+
+ if (_game._objects.isInRoom(OBJ_OAR)) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
+ } else
+ _scene->_hotspots.activate(NOUN_OAR, false);
+
+ _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 0);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2);
+
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2);
+
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2);
+
+ if (_scene->_priorSceneId == RETURNING_FROM_LOADING) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ if (!_globals[kChristineIsInBoat]) {
+ _anim0ActvFl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 239);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(79, 133), FACING_SOUTHWEST);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[0], 6);
+ }
+ } else if (_scene->_priorSceneId == 504) {
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ if (_game._visitedScenes._sceneRevisited) {
+ _game._player._playerPos = Common::Point(189, 123);
+ _game._player._facing = FACING_SOUTHWEST;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+
+ if (!_globals[kChristineIsInBoat]) {
+ _anim0ActvFl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 239);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(79, 133), FACING_SOUTHWEST);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[0], 6);
+ }
+ _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('r', 2), 95);
+ } else {
+ _game._player._playerPos = Common::Point(186, 122);
+ _game._player._facing = FACING_SOUTHWEST;
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _anim0ActvFl = true;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('r', 1), 0);
+ int hotspotIdx = _scene->_dynamicHotspots.add(NOUN_CHRISTINE, VERB_WALK_TO, SYNTAX_SINGULAR_FEM, EXT_NONE, Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots[hotspotIdx]._articleNumber = PREP_ON;
+ _scene->_dynamicHotspots.setPosition(hotspotIdx, Common::Point(79, 133), FACING_SOUTHWEST);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[0], 2);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[0], 3);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[0], 4);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[0], 5);
+ _scene->setDynamicAnim(hotspotIdx, _globals._animationIndexes[0], 6);
+ }
+ } else if ((_scene->_priorSceneId == 501) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
+ _game._player._playerPos = Common::Point(0, 142);
+ _game._player._facing = FACING_EAST;
+ _game._player._stepEnabled = false;
+ _game._player.walk(Common::Point(23, 145), FACING_EAST);
+ _game._player.setWalkTrigger(60);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene506::step() {
+ switch (_game._trigger) {
+ case 60:
+ _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 6, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
+ break;
+
+ case 61:
+ _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _game._player._stepEnabled = true;
+ break;
+
+ case 95:
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[1]);
+ break;
+
+ default:
+ break;
+ }
+
+ if (_anim0ActvFl) {
+ int curFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ if ((curFrame == 141) && !_skipFl) {
+ _game._player._visible = true;
+ _skipFl = true;
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_ANIM, _globals._animationIndexes[0]);
+ }
+
+ if (curFrame == 240)
+ _scene->setAnimFrame(_globals._animationIndexes[0], 239);
+
+ if (curFrame == 300)
+ _scene->setAnimFrame(_globals._animationIndexes[0], 239);
+
+ if (curFrame == 168)
+ _game._player._stepEnabled = true;
+
+ if (curFrame == 289)
+ _scene->_nextSceneId = 501;
+ }
+
+ if (_ascendingFl && (_vm->_gameConv->_running != 26)) {
+ _ascendingFl = false;
+ _game._player._stepEnabled = false;
+ }
+}
+
+void Scene506::actions() {
+ if (_action.isAction(VERB_TALK_TO, NOUN_CHRISTINE)) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(1);
+ _scene->setAnimFrame(_globals._animationIndexes[0], 290);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_OAR)) {
+ switch (_game._trigger) {
+ case (0):
+ if (_game._objects.isInRoom(OBJ_OAR)) {
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[4] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[4], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[4], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 4, 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
+ }
+ break;
+
+ case 1:
+ _scene->deleteSequence(_globals._sequenceIndexes[5]);
+ _scene->_hotspots.activate(NOUN_OAR, false);
+ _game._objects.addToInventory(OBJ_OAR);
+ _vm->_sound->command(26);
+ break;
+
+ case 2:
+ _game.syncTimers(SYNC_PLAYER, 0, SYNC_SEQ, _globals._sequenceIndexes[4]);
+ _game._player._visible = true;
+ _scene->_sequences.addTimer(20, 3);
+ break;
+
+ case 3:
+ _vm->_dialogs->showItem(OBJ_OAR, 824, 0);
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+
+ if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ if (_scene->_customDest.x < 150) {
+ switch (_game._trigger) {
+ case (0):
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[4] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[4], true, 5, 2);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 4);
+ _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[4], true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 4, 65);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 67);
+ break;
+
+ case 65:
+ _scene->deleteSequence(_globals._sequenceIndexes[3]);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 66);
+ _vm->_sound->command(24);
+ break;
+
+ case 66:
+ _game._player.walk(Common::Point(0, 142), FACING_WEST);
+ _game._player.setWalkTrigger(68);
+ break;
+
+ case 67:
+ _game._player._visible = true;
+ break;
+
+ case 68:
+ if (_globals[kChristineIsInBoat])
+ _scene->_nextSceneId = 501;
+ else
+ _scene->setAnimFrame(_globals._animationIndexes[0], 241);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_game._trigger) {
+ case (0):
+ if (!_globals[kChristineIsInBoat]) {
+ _vm->_gameConv->run(26);
+ _vm->_gameConv->exportValue(2);
+ int curFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ if (curFrame == 240 || curFrame == 239)
+ _scene->setAnimFrame(_globals._animationIndexes[0], 290);
+ _ascendingFl = true;
+ }
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 5, 1);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], -1, -2);
+ _game.syncTimers(SYNC_SEQ, _globals._sequenceIndexes[7], SYNC_PLAYER, 0);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 90);
+ break;
+
+ case 90:
+ _vm->_gameConv->abortConv();
+ _scene->_nextSceneId = 504;
+ break;
+
+ default:
+ break;
+ }
+ }
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_vm->_gameConv->_running == 26) {
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action._lookFlag) {
+ _vm->_dialogs->show(50610);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) {
+ if (_action.isObject(NOUN_FLOOR)) {
+ _vm->_dialogs->show(50611);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_WALL)) {
+ _vm->_dialogs->show(50612);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_TORCH)) {
+ _vm->_dialogs->show(50613);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_COLUMN)) {
+ _vm->_dialogs->show(50614);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CEILING)) {
+ _vm->_dialogs->show(50615);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_RAMP)) {
+ _vm->_dialogs->show(50616);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_DOOR)) {
+ if (_scene->_customDest.x < 150)
+ _vm->_dialogs->show(50617);
+ else
+ _vm->_dialogs->show(50618);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_OAR) && _game._objects.isInRoom(OBJ_OAR)) {
+ _vm->_dialogs->show(50619);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isObject(NOUN_CHRISTINE)) {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() < 235)
+ _vm->_dialogs->show(50621);
+ else
+ _vm->_dialogs->show(50620);
+ _action._inProgress = false;
+ return;
+ }
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_TORCH)) {
+ _vm->_dialogs->show(50613);
+ _action._inProgress = false;
+ return;
+ }
+
+ if (_action.isAction(VERB_TAKE, NOUN_CHRISTINE)) {
+ _vm->_dialogs->show(50622);
+ _action._inProgress = false;
+ }
+}
+
+void Scene506::preActions() {
+ if (_action.isAction(VERB_UNLOCK, NOUN_DOOR) || _action.isAction(VERB_LOCK, NOUN_DOOR))
+ _game._player.walk(Common::Point(33, 142), FACING_NORTHWEST);
+
+ if (_action.isAction(VERB_OPEN, NOUN_DOOR)) {
+ if (_scene->_customDest.x < 150)
+ _game._player.walk(Common::Point(33, 142), FACING_NORTHWEST);
+ else
+ _game._player.walk(Common::Point(191, 118), FACING_EAST);
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+} // End of namespace Phantom
+} // End of namespace MADS
diff --git a/engines/mads/phantom/phantom_scenes5.h b/engines/mads/phantom/phantom_scenes5.h
new file mode 100644
index 0000000000..33478304f3
--- /dev/null
+++ b/engines/mads/phantom/phantom_scenes5.h
@@ -0,0 +1,219 @@
+/* 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 MADS_PHANTOM_SCENES5_H
+#define MADS_PHANTOM_SCENES5_H
+
+#include "common/scummsys.h"
+#include "common/serializer.h"
+#include "mads/game.h"
+#include "mads/scene.h"
+#include "mads/phantom/phantom_scenes.h"
+
+namespace MADS {
+
+namespace Phantom {
+
+class Scene5xx : public PhantomScene {
+protected:
+ /**
+ * Plays an appropriate sound when entering a scene
+ */
+ void sceneEntrySound();
+
+ /**
+ *Sets the AA file to use for the scene
+ */
+ void setAAName();
+
+ /**
+ * Updates the prefix used for getting player sprites for the scene
+ */
+ void setPlayerSpritesPrefix();
+public:
+ Scene5xx(MADSEngine *vm) : PhantomScene(vm) {}
+};
+
+class Scene501 : public Scene5xx {
+private:
+ bool _anim0ActvFl;
+ bool _skipFl;
+
+public:
+ Scene501(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene502 : public Scene5xx {
+private:
+ bool _fire1ActiveFl;
+ bool _fire2ActiveFl;
+ bool _fire3ActiveFl;
+ bool _fire4ActiveFl;
+ bool _panelTurningFl;
+ bool _trapDoorHotspotEnabled;
+ bool _acceleratedFireActivationFl;
+
+ int _panelPushedNum;
+ int _puzzlePictures[16];
+ int _puzzleSprites[16];
+ int _puzzleSequences[16];
+ int _messageLevel;
+ int _cycleStage;
+
+ Common::Point _nextPos;
+
+ uint32 _lastFrameTime;
+ uint32 _timer;
+ uint32 _deathTimer;
+
+ byte *_cyclePointer;
+
+ void room_502_initialize_panels();
+ void loadCyclingInfo();
+ void animateFireBursts();
+ void setPaletteCycle();
+ void handlePanelAnimation();
+ void getPanelInfo(Common::Point *walkToPos, int *panel, Common::Point mousePos, Common::Point *interimPos);
+
+public:
+ Scene502(MADSEngine *vm);
+ ~Scene502();
+
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene504 : public Scene5xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _anim3ActvFl;
+ bool _anim4ActvFl;
+ bool _anim5ActvFl;
+ bool _playingMusicFl;
+ bool _chairDialogDoneFl;
+ bool _fireBreathFl;
+
+ int _songNum;
+ int _input3Count;
+ int _playCount;
+ int _listenStatus;
+ int _listenFrame;
+ int _chairStatus;
+ int _chairFrame;
+ int _playStatus;
+ int _playFrame;
+ int _phantomStatus;
+ int _phantomFrame;
+ int _christineTalkCount;
+ int _deathCounter;
+
+ void handleListenAnimation();
+ void handleOrganAnimation();
+ void handleChairAnimation();
+ void handlePhantomAnimation1();
+ void handlePhantomAnimation2();
+ void handlePhantomAnimation3();
+ void handleListenConversation();
+ void handlePlayConversation();
+ void handleFightConversation();
+
+public:
+ Scene504(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene505 : public Scene5xx {
+private:
+ bool _anim0ActvFl;
+ bool _anim1ActvFl;
+ bool _anim2ActvFl;
+ bool _checkFrame106;
+ bool _leaveRoomFl;
+ bool _partedFl;
+
+ int _raoulStatus;
+ int _raoulFrame;
+ int _raoulCount;
+ int _bothStatus;
+ int _bothFrame;
+ int _bothCount;
+ int _partStatus;
+ int _partFrame;
+ int _partCount;
+
+ void handleRaoulAnimation();
+ void handleBothanimation();
+ void handlePartedAnimation();
+ void handleCoffinDialog();
+
+public:
+ Scene505(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+class Scene506 : public Scene5xx {
+private:
+ bool _anim0ActvFl;
+ bool _skipFl;
+ bool _ascendingFl;
+
+public:
+ Scene506(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
+
+} // End of namespace Phantom
+} // End of namespace MADS
+
+#endif /* MADS_PHANTOM_SCENES5_H */
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index bb747f4b52..09a961825e 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -56,7 +56,6 @@ Player::Player(MADSEngine *vm)
_special = 0;
_ticksAmount = 0;
_priorTimer = 0;
- _trigger = 0;
_scalingVelocity = false;
_spritesChanged = false;
_forceRefresh = false;
@@ -80,6 +79,10 @@ Player::Player(MADSEngine *vm)
_moving = false;
_walkOffScreen = 0;
_walkOffScreenSceneId = -1;
+ _forcePrefix = false;
+ _commandsAllowed = false;
+ _enableAtTarget = false;
+ _walkTrigger = 0;
Common::fill(&_stopWalkerList[0], &_stopWalkerList[12], 0);
Common::fill(&_stopWalkerTrigger[0], &_stopWalkerTrigger[12], 0);
@@ -186,8 +189,10 @@ void Player::changeFacing() {
(Facing)_directionListIndexes[_facing + 10];
selectSeries();
- if ((_facing == _turnToFacing) && !_moving)
+ if ((_facing == _turnToFacing) && !_moving) {
updateFrame();
+ activateTrigger();
+ }
_priorTimer += 1;
}
@@ -242,8 +247,8 @@ void Player::updateFrame() {
Scene &scene = _vm->_game->_scene;
assert(scene._sprites[idx] != nullptr);
SpriteAsset &spriteSet = *scene._sprites[idx];
-
- // WORKAROUND: Certain cutscenes set up player sprites that don't have any
+
+ // WORKAROUND: Certain cutscenes set up player sprites that don't have any
// character info. In such cases, simply ignore player updates
if (!spriteSet._charInfo)
return;
@@ -278,6 +283,16 @@ void Player::updateFrame() {
_forceRefresh = true;
}
+void Player::activateTrigger() {
+ // TODO: Finish this!
+ // TODO: Also sync _walkTrigger, if necessary
+
+ if (_walkTrigger) {
+ _vm->_game->_trigger = _walkTrigger;
+ _walkTrigger = 0;
+ }
+}
+
void Player::update() {
Scene &scene = _vm->_game->_scene;
@@ -289,7 +304,7 @@ void Player::update() {
int newDepth = 1;
int yp = MIN(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1));
- for (int idx = 1; idx < 15; ++idx) {
+ for (int idx = 1; idx < DEPTH_BANDS_SIZE; ++idx) {
if (scene._sceneInfo->_depthList[newDepth] >= yp)
newDepth = idx + 1;
}
@@ -441,10 +456,12 @@ void Player::move() {
if (newFacing && _moving)
startMovement();
- if (_turnToFacing != _facing)
+ if (_turnToFacing != _facing) {
changeFacing();
- else if (!_moving)
+ } else if (!_moving) {
updateFrame();
+ activateTrigger();
+ }
int velocity = _velocity;
if (_scalingVelocity && (_totalDistance > 0)) {
@@ -797,4 +814,26 @@ void Player::removePlayerSprites() {
_visible = false;
}
+void Player::firstWalk(Common::Point fromPos, Facing fromFacing, Common::Point destPos, Facing destFacing, bool enableFl) {
+ _playerPos = fromPos;
+ _facing = fromFacing;
+
+ walk(destPos, destFacing);
+ _walkAnywhere = true;
+
+ _commandsAllowed = false;
+ _enableAtTarget = enableFl;
+}
+
+void Player::setWalkTrigger(int val) {
+ _walkTrigger = val;
+ warning("TODO: Player::setWalkTrigger");
+}
+
+void Player::resetFacing(Facing facing) {
+ _facing = facing;
+ _turnToFacing = facing;
+ selectSeries();
+}
+
} // End of namespace MADS
diff --git a/engines/mads/player.h b/engines/mads/player.h
index e5765a9bca..55000047fb 100644
--- a/engines/mads/player.h
+++ b/engines/mads/player.h
@@ -95,6 +95,8 @@ private:
void startMovement();
void changeFacing();
+
+ void activateTrigger();
public:
MADSAction *_action;
@@ -131,13 +133,17 @@ public:
int _trigger;
bool _scalingVelocity;
bool _forceRefresh;
+ bool _forcePrefix;
bool _needToWalk;
bool _readyToWalk;
+ bool _commandsAllowed;
+ bool _enableAtTarget;
int _stopWalkerIndex;
int _centerOfGravity;
int _currentDepth;
int _currentScale;
Common::String _spritesPrefix;
+ int _walkTrigger;
public:
Player(MADSEngine *vm);
@@ -221,6 +227,13 @@ public:
}
void removePlayerSprites();
+
+ void firstWalk(Common::Point fromPos, Facing fromFacing, Common::Point destPos, Facing destFacing, bool enableFl);
+
+ void setWalkTrigger(int val);
+
+ void resetFacing(Facing facing);
+
};
} // End of namespace MADS
diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp
index 9b2ec71de6..ee0ca98cd3 100644
--- a/engines/mads/rails.cpp
+++ b/engines/mads/rails.cpp
@@ -274,4 +274,18 @@ void Rails::synchronize(Common::Serializer &s) {
}
}
+void Rails::disableNode(int nodeIndex) {
+ _nodes[nodeIndex]._active = false;
+
+ for (uint16 i = 0; i < _nodes.size(); i++) {
+ if (i != nodeIndex)
+ disableLine(i, nodeIndex);
+ }
+}
+
+void Rails::disableLine(int from, int to) {
+ _nodes[from]._distances[to] = 0x3FFF;
+ _nodes[to]._distances[from] = 0x3FFF;
+}
+
} // End of namespace MADS
diff --git a/engines/mads/rails.h b/engines/mads/rails.h
index c95f5c47a6..ea12177038 100644
--- a/engines/mads/rails.h
+++ b/engines/mads/rails.h
@@ -127,6 +127,10 @@ public:
* Synchronize the data for the route
*/
void synchronize(Common::Serializer &s);
+
+ void disableNode(int idx);
+ void disableLine(int from, int to);
+
};
} // End of namespace MADS
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index ee5f1a5440..da62a6335e 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -24,6 +24,7 @@
#include "mads/scene.h"
#include "mads/compression.h"
#include "mads/mads.h"
+#include "mads/audio.h"
#include "mads/dragonsphere/dragonsphere_scenes.h"
#include "mads/nebular/nebular_scenes.h"
#include "mads/phantom/phantom_scenes.h"
@@ -49,7 +50,8 @@ Scene::Scene(MADSEngine *vm)
_reloadSceneFlag = false;
_freeAnimationFlag = false;
_animationData = nullptr;
- _activeAnimation = nullptr;
+ for (int i = 0; i < 10; i++)
+ _animation[i] = nullptr;
_textSpacing = -1;
_frameStartTime = 0;
_mode = SCREENMODE_VGA;
@@ -60,6 +62,8 @@ Scene::Scene(MADSEngine *vm)
_spritesCount = 0;
_variant = 0;
+ _speechReady = -1;
+
_paletteUsageF.push_back(PaletteUsage::UsageEntry(0xF));
// Set up a scene surface that maps to our physical screen drawing surface
@@ -150,6 +154,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
_sequences.clear();
_kernelMessages.clear();
_vm->_palette->_paletteUsage.load(&_scenePaletteUsage);
+ setCamera(Common::Point(0, 0));
int flags = SCENEFLAG_LOAD_SHADOW;
if (_vm->_dithering)
@@ -385,6 +390,7 @@ void Scene::doFrame() {
!_vm->_game->_fx);
}
+ _vm->_game->camUpdate();
if (_action._selectedAction && player._stepEnabled && !player._needToWalk &&
!_vm->_game->_trigger && !player._trigger) {
_action.startAction();
@@ -430,8 +436,7 @@ void Scene::doFrame() {
_sequences.tick();
// Handle any active animation
- if (_activeAnimation)
- _activeAnimation->update();
+ animations_tick();
}
// If the debugget flag is set, show the mouse position
@@ -480,8 +485,10 @@ void Scene::doFrame() {
_vm->_game->_fx = kTransitionNone;
// Handle freeing animation if necessary
- if (_activeAnimation && _activeAnimation->freeFlag())
- _freeAnimationFlag = true;
+ for (int i = 0; i < 10; i++) {
+ if (_animation[i] && _animation[i]->freeFlag())
+ _freeAnimationFlag = true;
+ }
if (_freeAnimationFlag)
freeAnimation();
}
@@ -605,19 +612,29 @@ void Scene::checkKeyboard() {
}
}
-void Scene::loadAnimation(const Common::String &resName, int trigger) {
+int Scene::loadAnimation(const Common::String &resName, int trigger) {
// WORKAROUND: If there's already a previous active animation used by the
// scene, then free it before we create the new one
- if (_activeAnimation)
- freeAnimation();
+ if ((_vm->getGameID() == GType_RexNebular) && _animation[0])
+ freeAnimation(0);
DepthSurface depthSurface;
UserInterface interfaceSurface(_vm);
- _activeAnimation = Animation::init(_vm, this);
- _activeAnimation->load(interfaceSurface, depthSurface, resName,
- _vm->_dithering ? ANIMFLAG_DITHER : 0, nullptr, nullptr);
- _activeAnimation->startAnimation(trigger);
+ for (int i = 0; i < 10; i++) {
+ if (!_animation[i]) {
+ _animation[i] = Animation::init(_vm, this);
+ _animation[i]->load(interfaceSurface, depthSurface, resName,
+ _vm->_dithering ? ANIMFLAG_DITHER : 0, nullptr, nullptr);
+ _animation[i]->startAnimation(trigger);
+
+ return i;
+ }
+ }
+
+ error("Unable to find an available animation slot");
+
+ return -1;
}
void Scene::updateCursor() {
@@ -658,9 +675,12 @@ void Scene::freeCurrentScene() {
delete _animationData;
_animationData = nullptr;
}
- if (_activeAnimation) {
- delete _activeAnimation;
- _activeAnimation = nullptr;
+
+ for (int i = 0; i < 10; i++) {
+ if (_animation[i]) {
+ delete _animation[i];
+ _animation[i] = nullptr;
+ }
}
_vm->_palette->_paletteUsage.load(nullptr);
@@ -692,33 +712,40 @@ void Scene::resetScene() {
}
void Scene::freeAnimation() {
- if (_activeAnimation) {
- Player &player = _vm->_game->_player;
+ for (int j = 0; j < 10; j++)
+ freeAnimation(j);
- if (!_freeAnimationFlag) {
- _spriteSlots.fullRefresh(true);
- _sequences.scan();
- }
+ _freeAnimationFlag = false;
+}
+
+void Scene::freeAnimation(int idx) {
+ if (_animation[idx]) {
+ if (idx == 0) {
+ Player &player = _vm->_game->_player;
+
+ if (!_freeAnimationFlag) {
+ _spriteSlots.fullRefresh(true);
+ _sequences.scan();
+ }
- // Refresh the player
- if (player._visible) {
- player._forceRefresh = true;
- player.update();
+ // Refresh the player
+ if (player._visible) {
+ player._forceRefresh = true;
+ player.update();
+ }
}
// Remove any kernel messages in use by the animation
- for (uint i = 0; i < _activeAnimation->_messages.size(); ++i) {
- int msgIndex = _activeAnimation->_messages[i]._kernelMsgIndex;
+ for (uint i = 0; i < _animation[idx]->_messages.size(); ++i) {
+ int msgIndex = _animation[idx]->_messages[i]._kernelMsgIndex;
if (msgIndex >= 0)
_kernelMessages.remove(msgIndex);
}
// Delete the animation
- delete _activeAnimation;
- _activeAnimation = nullptr;
+ delete _animation[idx];
+ _animation[idx] = nullptr;
}
-
- _freeAnimationFlag = false;
}
void Scene::synchronize(Common::Serializer &s) {
@@ -729,7 +756,107 @@ void Scene::synchronize(Common::Serializer &s) {
s.syncAsByte(_roomChanged);
s.syncAsUint16LE(_nextSceneId);
s.syncAsUint16LE(_priorSceneId);
+ s.syncAsSint16LE(_variant);
_dynamicHotspots.synchronize(s);
}
+void Scene::setAnimFrame(int id, int val) {
+ if ((id >= 0) && _animation[id])
+ _animation[id]->setCurrentFrame(val);
+}
+
+int Scene::getAnimFrame(int id) {
+ if ((id >= 0) && _animation[id])
+ return _animation[id]->getCurrentFrame();
+
+ return -1;
+}
+
+void Scene::setDynamicAnim(int id, int anim_id, int segment) {
+ if (id >= 0 && id <= DYNAMIC_HOTSPOTS_SIZE && _animation[anim_id]) {
+ _animation[anim_id]->_dynamicHotspotIndex = id;
+ if (_dynamicHotspots[id]._animIndex < 0)
+ _dynamicHotspots[id]._active = false;
+ _dynamicHotspots[id]._animIndex = anim_id;
+
+ // TODO: Anim segments
+
+ // NOTE: Only remove the TODO below when _dynamicHotspotIndex
+ // in the Animation class is actually used in the engine!
+
+ warning("TODO: Scene::setDynamicAnim");
+ }
+}
+
+void Scene::setCamera(Common::Point pos) {
+ _posAdjust = pos;
+ warning("setCamera: Incomplete function");
+}
+
+void Scene::drawToBackground(int spriteId, int frameId, Common::Point pos, int depth, int scale) {
+ SpriteAsset &asset = *_sprites[spriteId];
+
+ if (pos.x == -32000)
+ pos.x = asset.getFramePos(frameId - 1).x;
+ if (pos.y == -32000)
+ pos.y = asset.getFramePos(frameId - 1).y;
+
+ int slotIndex = _spriteSlots.add();
+ SpriteSlot &slot = _spriteSlots[slotIndex];
+ slot._spritesIndex = spriteId;
+ slot._frameNumber = frameId;
+ slot._seqIndex = 1;
+ slot._position = pos;
+ slot._depth = depth;
+ slot._scale = scale;
+ slot._flags = IMG_DELTA;
+}
+
+void Scene::deleteSequence(int idx) {
+ if (_sequences[idx]._active && _sequences[idx]._dynamicHotspotIndex >= 0)
+ _dynamicHotspots.remove(_sequences[idx]._dynamicHotspotIndex);
+
+ _sequences[idx]._active = false;
+
+ if (!_sequences[idx]._doneFlag) {
+ warning("TODO: deleteSequence: Sequence %d not done", idx);
+ // TODO: This is wrong, and crashes Phantom at scene 102 when the door is opened
+ //doFrame(); // FIXME/CHECKME: Is this correct?
+ } else {
+ _sequences.remove(idx);
+ }
+}
+
+void Scene::loadSpeech(int idx) {
+ _vm->_audio->setDefaultSoundGroup();
+ // NOTE: The original actually preloads the speech sample here, but the samples
+ // are so small that it's not really worth it...
+
+ // TODO: As the speech samples aren't cached anymore, _speechReady should be remove
+ _speechReady = idx;
+}
+
+void Scene::playSpeech(int idx) {
+ _vm->_audio->stop();
+ _vm->_audio->playSound(idx - 1);
+}
+
+void Scene::sceneScale(int yFront, int maxScale, int yBack, int minScale) {
+ _sceneInfo->_yBandsEnd = yFront;
+ _sceneInfo->_maxScale = maxScale;
+ _sceneInfo->_yBandsStart = yBack;
+ _sceneInfo->_minScale = minScale;
+
+ _bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart;
+ _scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale;
+}
+
+void Scene::animations_tick() {
+ //warning("TODO: Implement _animations as an AnimationList and refactor (and check implementation)");
+ for (int i = 0; i < 10; i++) {
+ if (_animation[i])
+ _animation[i]->update();
+ }
+}
+
} // End of namespace MADS
diff --git a/engines/mads/scene.h b/engines/mads/scene.h
index c0784c3812..79e0fd4029 100644
--- a/engines/mads/scene.h
+++ b/engines/mads/scene.h
@@ -111,7 +111,7 @@ public:
Common::Array<PaletteCycle> _paletteCycles;
Common::StringArray _vocabStrings;
Animation *_animationData;
- Animation *_activeAnimation;
+ Animation *_animation[10];
bool _freeAnimationFlag;
int _depthStyle;
int _bandsRange;
@@ -128,7 +128,6 @@ public:
Common::Point _customDest;
Common::Array<PaletteUsage::UsageEntry> _paletteUsageF;
Common::Array<PaletteUsage::UsageEntry> _scenePaletteUsage;
-
/**
* Constructor
*/
@@ -214,7 +213,7 @@ public:
/**
* Load an animation
*/
- void loadAnimation(const Common::String &resName, int trigger = 0);
+ int loadAnimation(const Common::String &resName, int trigger = 0);
/**
* Returns a vocab entry
@@ -245,9 +244,28 @@ public:
void freeAnimation();
/**
+ * Frees any given active animation for the scene
+ */
+ void freeAnimation(int idx);
+
+ /**
* Synchronize the game
*/
void synchronize(Common::Serializer &s);
+
+ void setAnimFrame(int id, int val);
+ int getAnimFrame(int id);
+
+ void setDynamicAnim(int id, int anim_id, int segment);
+ void setCamera(Common::Point pos);
+ void drawToBackground(int spriteId, int frameId, Common::Point pos, int depth, int scale);
+ void deleteSequence(int idx);
+ void loadSpeech(int idx);
+ void playSpeech(int idx);
+ void sceneScale(int yFront, int maxScale, int yBack, int minScale);
+ void animations_tick();
+
+ int _speechReady;
};
} // End of namespace MADS
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index e48bcd8c6f..2211430267 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -108,7 +108,7 @@ SceneInfo::SceneInfo(MADSEngine *vm) : _vm(vm) {
_minScale = 0;
_field4A = 0;
_usageIndex = 0;
- for (int i = 0; i < 15; ++i)
+ for (int i = 0; i < DEPTH_BANDS_SIZE; ++i)
_depthList[i] = 0;
}
@@ -145,6 +145,15 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
// Read in basic data
Common::SeekableReadStream *infoStream = infoPack.getItemStream(0);
+
+ /*
+ byte *data = new byte[infoStream->size()];
+ infoStream->read(data, infoStream->size());
+ Common::hexdump(data, infoStream->size());
+ infoStream->seek(0);
+ delete[] data;
+ */
+
if (_vm->getGameID() == GType_RexNebular) {
_sceneId = infoStream->readUint16LE();
} else {
@@ -161,22 +170,28 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
_height = infoStream->readUint16LE();
infoStream->skip(24);
-
- nodeCount = infoStream->readUint16LE();
- _yBandsEnd = infoStream->readUint16LE();
- _yBandsStart = infoStream->readUint16LE();
- _maxScale = infoStream->readUint16LE();
- _minScale = infoStream->readUint16LE();
- for (int i = 0; i < DEPTH_BANDS_SIZE; ++i)
- _depthList[i] = infoStream->readUint16LE();
- _field4A = infoStream->readUint16LE();
} else {
_artFileNum = sceneId;
_depthStyle = 0;
_width = 320;
_height = 156;
- infoStream->skip(140);
+ infoStream->skip(98);
+ }
+
+ nodeCount = infoStream->readUint16LE();
+ _yBandsEnd = infoStream->readUint16LE();
+ _yBandsStart = infoStream->readUint16LE();
+ _maxScale = infoStream->readUint16LE();
+ _minScale = infoStream->readUint16LE();
+ for (int i = 0; i < DEPTH_BANDS_SIZE; ++i)
+ _depthList[i] = infoStream->readUint16LE();
+ _field4A = infoStream->readUint16LE();
+
+ // HACK for V2 games
+ if (_vm->getGameID() != GType_RexNebular) {
+ _minScale = _maxScale = 100;
+ memset(_depthList, 0, DEPTH_BANDS_SIZE * sizeof(int));
}
// Load the scene's walk nodes
@@ -184,27 +199,29 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
WalkNode node;
node.load(infoStream);
- if (i < nodeCount)
+ if (i < nodeCount) {
_nodes.push_back(node);
+ //debug("Node %d: %d,%d", i, node._walkPos.x, node._walkPos.y);
+ }
}
- int spriteSetsCount = infoStream->readUint16LE();
- int spriteInfoCount = infoStream->readUint16LE();
-
- // Load in sprite sets
Common::StringArray setNames;
- for (int i = 0; i < 10; ++i) {
- char name[64];
- infoStream->read(name, 64);
-
- if (i < spriteSetsCount)
- setNames.push_back(Common::String(name));
- }
-
- // Load in sprite draw information
Common::Array<SpriteInfo> spriteInfo;
- // TODO: The following isn't quite right for V2 games
+
if (_vm->getGameID() == GType_RexNebular) {
+ int spriteSetsCount = infoStream->readUint16LE();
+ int spriteInfoCount = infoStream->readUint16LE();
+
+ // Load in sprite sets
+ for (int i = 0; i < 10; ++i) {
+ char name[64];
+ infoStream->read(name, 64);
+
+ if (i < spriteSetsCount)
+ setNames.push_back(Common::String(name));
+ }
+
+ // Load in sprite draw information
for (int i = 0; i < 50; ++i) {
SpriteInfo info;
info.load(infoStream);
@@ -212,6 +229,12 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
if (i < spriteInfoCount)
spriteInfo.push_back(info);
}
+ } else {
+ uint16 shadowColors = infoStream->readUint16LE();
+ uint16 shadowR = infoStream->readUint16LE();
+ uint16 shadowG = infoStream->readUint16LE();
+ uint16 shadowB = infoStream->readUint16LE();
+ debug("Shadow colors: %d (%d, %d, %d)", shadowColors, shadowR, shadowG, shadowB);
}
delete infoStream;
@@ -422,6 +445,18 @@ void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName,
assert(screenWidth == _width);
assert(screenHeight <= _height);
+ // Resize the background surface to hold all of the tiles
+ uint16 newWidth = bgSurface.w;
+ uint16 newHeight = bgSurface.h;
+
+ if (tileWidth < screenWidth && bgSurface.w != tileCount * tileWidth)
+ newWidth = tileCount * tileWidth;
+ if (tileHeight < screenHeight && bgSurface.h != tileCount * tileHeight)
+ newHeight = tileCount * tileHeight;
+
+ if (bgSurface.w != newWidth || bgSurface.h != newHeight)
+ bgSurface.setSize(newWidth, newHeight);
+
// --------------------------------------------------------------------------------
// Get tile data
diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp
index 3c27001ae0..c9f5df8b98 100644
--- a/engines/mads/screen.cpp
+++ b/engines/mads/screen.cpp
@@ -732,7 +732,7 @@ void ScreenSurface::panTransition(MSurface &newScreen, byte *palData, int entryS
srcPos.x + xAt + 1, srcPos.y + size.y));
} else {
newScreen.copyRectToSurface(*this, xAt, destPos.y,
- Common::Rect(srcPos.x + xAt, srcPos.y,
+ Common::Rect(srcPos.x + xAt, srcPos.y,
srcPos.x + xAt + 1, srcPos.y + size.y));
}
@@ -778,8 +778,8 @@ void ScreenSurface::swapForeground(byte newPalette[PALETTE_SIZE], byte *paletteM
Common::Rect oldClip = _clipBounds;
resetClipBounds();
-
- copyRectTranslate(*this, oldMap, Common::Point(0, 0),
+
+ copyRectTranslate(*this, oldMap, Common::Point(0, 0),
Common::Rect(0, 0, MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT));
palette.setFullPalette(oldPalette);
@@ -789,9 +789,9 @@ void ScreenSurface::swapForeground(byte newPalette[PALETTE_SIZE], byte *paletteM
/**
* Translates a given palette into a mapping table.
* Palettes consist of 128 RGB entries for the foreground and background
- * respectively, with the two interleaved together. So the start
+ * respectively, with the two interleaved together. So the start
*/
-void ScreenSurface::swapPalette(const byte *palData, byte swapTable[PALETTE_COUNT],
+void ScreenSurface::swapPalette(const byte *palData, byte swapTable[PALETTE_COUNT],
bool foreground) {
int start = foreground ? 1 : 0;
const byte *dynamicList = &palData[start * RGB_SIZE];
@@ -807,7 +807,7 @@ void ScreenSurface::swapPalette(const byte *palData, byte swapTable[PALETTE_COUN
// Handle the 128 palette entries for the foreground or background
for (int idx = 0; idx < (PALETTE_COUNT / 2); ++idx) {
if (start >= PALETTE_START && start <= PALETTE_END) {
- swapTable[start] = Palette::closestColor(dynamicList, staticList,
+ swapTable[start] = Palette::closestColor(dynamicList, staticList,
2 * RGB_SIZE, PALETTE_COUNT / 2) * 2 + staticStart;
}
diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp
index e5bf1631c2..50b37de7ea 100644
--- a/engines/mads/sequence.cpp
+++ b/engines/mads/sequence.cpp
@@ -259,7 +259,7 @@ bool SequenceList::loadSprites(int seqIndex) {
}
if (seqEntry._flags & 2) {
- // Check for object having moved off-scren
+ // Check for object having moved off-screen
if ((pt.x + width) < 0 || (pt.x + width) >= MADS_SCREEN_WIDTH ||
pt.y < 0 || (pt.y - height) >= MADS_SCENE_HEIGHT) {
result = true;
@@ -550,4 +550,26 @@ void SequenceList::setMotion(int seqIndex, int flags, int deltaX, int deltaY) {
se._posAccum.x = se._posAccum.y = 0;
}
+int SequenceList::addStampCycle(int srcSpriteIdx, bool flipped, int sprite) {
+ int id;
+
+ id = addSpriteCycle(srcSpriteIdx, flipped, 32767, 0, 0, 0);
+ if (id >= 0) {
+ setAnimRange(id, sprite, sprite);
+ _entries[id]._animType = ANIMTYPE_STAMP;
+ }
+ return (id);
+}
+
+void SequenceList::setSeqPlayer(int idx, bool flag) {
+ Player &player = _vm->_game->_player;
+ int yp = player._playerPos.y + (player._centerOfGravity * player._currentScale) / 100;
+ setPosition(idx, Common::Point(player._playerPos.x, yp));
+ setDepth(idx, player._currentDepth);
+ setScale(idx, player._currentScale);
+
+ if (flag)
+ _vm->_game->syncTimers(SYNC_SEQ, idx, SYNC_PLAYER, 0);
+}
+
} // End of namespace
diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h
index c3a277c5a5..05a7b616aa 100644
--- a/engines/mads/sequence.h
+++ b/engines/mads/sequence.h
@@ -38,7 +38,7 @@ enum SequenceTrigger {
SEQUENCE_TRIGGER_SPRITE = 2 // Trigger when sequence reaches specific sprite
};
-enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_PING_PONG = 2 };
+enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_PING_PONG = 2, ANIMTYPE_STAMP = 9 };
#define SEQUENCE_ENTRY_SUBSET_MAX 5
@@ -125,6 +125,9 @@ public:
void setMsgLayout(int seqIndex);
void setDone(int seqIndex);
void setMotion(int seqIndex, int flags, int deltaX, int deltaY);
+
+ int addStampCycle(int srcSpriteIdx, bool flipped, int sprite);
+ void setSeqPlayer(int idx, bool flag);
};
} // End of namespace MADS
diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp
index 4a35edb80f..c96fd01882 100644
--- a/engines/mads/sound.cpp
+++ b/engines/mads/sound.cpp
@@ -39,6 +39,8 @@ SoundManager::SoundManager(MADSEngine *vm, Audio::Mixer *mixer) {
_newSoundsPaused = false;
_masterVolume = 255;
+ _preferRoland = false;
+
_opl = OPL::Config::create();
_opl->init();
diff --git a/engines/mads/sound.h b/engines/mads/sound.h
index 9882f65e5a..a9cdeddb37 100644
--- a/engines/mads/sound.h
+++ b/engines/mads/sound.h
@@ -48,6 +48,8 @@ public:
SoundManager(MADSEngine *vm, Audio::Mixer *mixer);
~SoundManager();
+ bool _preferRoland;
+
/**
* Initializes the sound driver for a given game section
*/
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp
index 62fd036c03..e4b09ff54c 100644
--- a/engines/mads/user_interface.cpp
+++ b/engines/mads/user_interface.cpp
@@ -733,7 +733,7 @@ void UserInterface::loadElements() {
_categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1;
for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) {
Hotspot &hs = scene._hotspots[hotspotIdx];
- ScreenObject *so = _vm->_game->_screenObjects.add(hs._bounds, SCREENMODE_VGA,
+ ScreenObject *so = _vm->_game->_screenObjects.add(hs._bounds, SCREENMODE_VGA,
CAT_HOTSPOT, hotspotIdx);
so->_active = hs._active;
}
diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h
index 1366aa2c32..60cc1f736d 100644
--- a/engines/mads/user_interface.h
+++ b/engines/mads/user_interface.h
@@ -191,8 +191,6 @@ private:
*/
void writeVocab(ScrCategory category, int id);
- void refresh();
-
void updateRect(const Common::Rect &bounds);
public:
MSurface _surface;
@@ -304,6 +302,8 @@ public:
* Synchronize the data
*/
void synchronize(Common::Serializer &s);
+
+ void refresh();
};
} // End of namespace MADS