[Scummvm-git-logs] scummvm master -> a58a442075f16736343d04eb338856f4b470851a
dreammaster
noreply at scummvm.org
Sat May 23 09:56:35 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
d6a0c2d8a3 MADS: DRAGONSPHERE: Shift Phantom ASound into phantom/ folder
a58a442075 MADS: DRAGONSPHERE: Added section 6 rooms
Commit: d6a0c2d8a3f421407bc32b5755a351e012c39fc4
https://github.com/scummvm/scummvm/commit/d6a0c2d8a3f421407bc32b5755a351e012c39fc4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-23T19:56:23+10:00
Commit Message:
MADS: DRAGONSPHERE: Shift Phantom ASound into phantom/ folder
Unfortunately, it looks like the sound driver for Dragonsphere
had some non-trivial refactorings done in it, that will
require it's own re-implementation from scratch. So for now,
I'm setting up a placeholder dragon/asound.h that aliases
to the Phantom version, so that the placeholder section
sound classes can still compile.
Changed paths:
A engines/mads/madsv2/dragonsphere/asound.cpp
A engines/mads/madsv2/dragonsphere/asound.h
A engines/mads/madsv2/phantom/asound.cpp
A engines/mads/madsv2/phantom/asound.h
R engines/mads/madsv2/core/asound.cpp
R engines/mads/madsv2/core/asound.h
engines/mads/madsv2/dragonsphere/sound_dragonsphere.h
engines/mads/madsv2/phantom/sound_phantom.h
engines/mads/module.mk
diff --git a/engines/mads/madsv2/dragonsphere/asound.cpp b/engines/mads/madsv2/dragonsphere/asound.cpp
new file mode 100644
index 00000000000..35dd5af3d7e
--- /dev/null
+++ b/engines/mads/madsv2/dragonsphere/asound.cpp
@@ -0,0 +1,35 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/endian.h"
+#include "common/file.h"
+#include "common/md5.h"
+#include "common/textconsole.h"
+#include "mads/madsv2/dragonsphere/asound.h"
+
+namespace MADS {
+namespace MADSV2 {
+namespace Dragonsphere {
+
+
+} // namespace Dragonsphere
+} // namespace MADSV2
+} // namespace MADS
diff --git a/engines/mads/madsv2/dragonsphere/asound.h b/engines/mads/madsv2/dragonsphere/asound.h
new file mode 100644
index 00000000000..b33f2cf3187
--- /dev/null
+++ b/engines/mads/madsv2/dragonsphere/asound.h
@@ -0,0 +1,39 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef MADS_DRAGONSPHERE_ASOUND_H
+#define MADS_DRAGONSPHERE_ASOUND_H
+
+#include "mads/madsv2/phantom/asound.h"
+
+namespace MADS {
+namespace MADSV2 {
+namespace Dragonsphere {
+
+using Phantom::ASound;
+using Phantom::AdlibChannel;
+using Phantom::AdlibSample;
+
+} // namespace Dragonsphere
+} // namespace MADSV2
+} // namespace MADS
+
+#endif
diff --git a/engines/mads/madsv2/dragonsphere/sound_dragonsphere.h b/engines/mads/madsv2/dragonsphere/sound_dragonsphere.h
index 2955781d638..0476d3632be 100644
--- a/engines/mads/madsv2/dragonsphere/sound_dragonsphere.h
+++ b/engines/mads/madsv2/dragonsphere/sound_dragonsphere.h
@@ -22,7 +22,7 @@
#ifndef MADS_DRAGONSPHERE_SOUND_H
#define MADS_DRAGONSPHERE_SOUND_H
-#include "mads/madsv2/core/asound.h"
+#include "mads/madsv2/dragonsphere/asound.h"
namespace MADS {
namespace MADSV2 {
diff --git a/engines/mads/madsv2/core/asound.cpp b/engines/mads/madsv2/phantom/asound.cpp
similarity index 99%
rename from engines/mads/madsv2/core/asound.cpp
rename to engines/mads/madsv2/phantom/asound.cpp
index bfe5908ff5e..d6bca98f7c8 100644
--- a/engines/mads/madsv2/core/asound.cpp
+++ b/engines/mads/madsv2/phantom/asound.cpp
@@ -20,10 +20,11 @@
*/
#include "audio/fmopl.h"
-#include "mads/madsv2/core/asound.h"
+#include "mads/madsv2/phantom/asound.h"
namespace MADS {
namespace MADSV2 {
+namespace Phantom {
bool AdlibChannel::_isDisabled;
@@ -1890,5 +1891,6 @@ uint16 ASound::readWord_impl() {
return lo | (hi << 8);
}
+} // namespace Phantom
} // namespace MADSV2
} // namespace MADS
diff --git a/engines/mads/madsv2/core/asound.h b/engines/mads/madsv2/phantom/asound.h
similarity index 97%
rename from engines/mads/madsv2/core/asound.h
rename to engines/mads/madsv2/phantom/asound.h
index 8b4e5e31161..726dd7c9d50 100644
--- a/engines/mads/madsv2/core/asound.h
+++ b/engines/mads/madsv2/phantom/asound.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef MADS_CORE_ASOUND_H
-#define MADS_CORE_ASOUND_H
+#ifndef MADS_PHANTOM_ASOUND_H
+#define MADS_PHANTOM_ASOUND_H
#include "common/mutex.h"
#include "common/queue.h"
@@ -29,6 +29,7 @@
namespace MADS {
namespace MADSV2 {
+namespace Phantom {
#define ADLIB_CHANNEL_COUNT 9
@@ -122,7 +123,8 @@ struct AdlibSample {
uint16 _freqBase = 0;
uint16 _outerLoopPtr = 0;
- AdlibSample() {}
+ AdlibSample() {
+ }
AdlibSample(Common::SeekableReadStream &s);
};
@@ -359,10 +361,10 @@ protected:
*/
int command0();
- /*
- * Fade out all channels (calls command2 + command4 via
- * the command3/command5 helpers that enable pending-stop on each channel).
- */
+ /*
+ * Fade out all channels (calls command2 + command4 via
+ * the command3/command5 helpers that enable pending-stop on each channel).
+ */
int command1();
/**
@@ -444,7 +446,8 @@ public:
/**
* Destructor
*/
- ~ASound() override {}
+ ~ASound() override {
+ }
/**
* Stop all currently playing sounds
@@ -467,6 +470,7 @@ public:
}
};
+} // namespace Phantom
} // namespace MADSV2
} // namespace MADS
diff --git a/engines/mads/madsv2/phantom/sound_phantom.h b/engines/mads/madsv2/phantom/sound_phantom.h
index b95542a8dcd..ebe3f92c4a7 100644
--- a/engines/mads/madsv2/phantom/sound_phantom.h
+++ b/engines/mads/madsv2/phantom/sound_phantom.h
@@ -22,7 +22,7 @@
#ifndef MADS_PHANTOM_SOUND_H
#define MADS_PHANTOM_SOUND_H
-#include "mads/madsv2/core/asound.h"
+#include "mads/madsv2/phantom/asound.h"
namespace MADS {
namespace MADSV2 {
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index 27e8f8ec714..91beb0be5f8 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -62,7 +62,6 @@ MODULE_OBJS += \
madsv2/animview/functions.o \
madsv2/textview/textview.o \
madsv2/core/anim.o \
- madsv2/core/asound.o \
madsv2/core/attr.o \
madsv2/core/buffer.o \
madsv2/core/camera.o \
@@ -175,18 +174,13 @@ MODULE_OBJS += \
madsv2/phantom/rooms/room505.o \
madsv2/phantom/rooms/room506.o \
madsv2/phantom/phantom.o \
+ madsv2/phantom/asound.o \
madsv2/phantom/catacombs.o \
madsv2/phantom/global.o \
madsv2/phantom/main_menu.o \
madsv2/phantom/menus.o \
madsv2/phantom/main.o \
madsv2/phantom/sound_phantom.o \
- madsv2/dragonsphere/dragonsphere.o \
- madsv2/dragonsphere/global.o \
- madsv2/dragonsphere/main.o \
- madsv2/dragonsphere/main_menu.o \
- madsv2/dragonsphere/menus.o \
- madsv2/dragonsphere/sound_dragonsphere.o \
madsv2/dragonsphere/mads/mads.o \
madsv2/dragonsphere/rooms/section1.o \
madsv2/dragonsphere/rooms/room101.o \
@@ -259,6 +253,13 @@ MODULE_OBJS += \
madsv2/dragonsphere/rooms/room613.o \
madsv2/dragonsphere/rooms/room614.o \
madsv2/dragonsphere/rooms/room909.o \
+ madsv2/dragonsphere/dragonsphere.o \
+ madsv2/dragonsphere/asound.o \
+ madsv2/dragonsphere/global.o \
+ madsv2/dragonsphere/main.o \
+ madsv2/dragonsphere/main_menu.o \
+ madsv2/dragonsphere/menus.o \
+ madsv2/dragonsphere/sound_dragonsphere.o \
madsv2/forest/forest.o
endif
Commit: a58a442075f16736343d04eb338856f4b470851a
https://github.com/scummvm/scummvm/commit/a58a442075f16736343d04eb338856f4b470851a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-23T19:56:23+10:00
Commit Message:
MADS: DRAGONSPHERE: Added section 6 rooms
Changed paths:
engines/mads/madsv2/dragonsphere/mads/conv.h
engines/mads/madsv2/dragonsphere/mads/inventory.h
engines/mads/madsv2/dragonsphere/mads/quotes.h
engines/mads/madsv2/dragonsphere/mads/sounds.h
engines/mads/madsv2/dragonsphere/mads/words.h
engines/mads/madsv2/dragonsphere/rooms/room116.cpp
engines/mads/madsv2/dragonsphere/rooms/room601.cpp
engines/mads/madsv2/dragonsphere/rooms/room603.cpp
engines/mads/madsv2/dragonsphere/rooms/room604.cpp
engines/mads/madsv2/dragonsphere/rooms/room605.cpp
engines/mads/madsv2/dragonsphere/rooms/room606.cpp
engines/mads/madsv2/dragonsphere/rooms/room607.cpp
engines/mads/madsv2/dragonsphere/rooms/room609.cpp
engines/mads/madsv2/dragonsphere/rooms/room612.cpp
engines/mads/madsv2/dragonsphere/rooms/room613.cpp
engines/mads/madsv2/dragonsphere/rooms/room614.cpp
diff --git a/engines/mads/madsv2/dragonsphere/mads/conv.h b/engines/mads/madsv2/dragonsphere/mads/conv.h
index b5c5b86a378..018ed111345 100644
--- a/engines/mads/madsv2/dragonsphere/mads/conv.h
+++ b/engines/mads/madsv2/dragonsphere/mads/conv.h
@@ -187,6 +187,21 @@ enum {
conv028_exit_b_b = 26
};
+enum {
+ conv031_hello_only = 0,
+ conv031_whoare_only = 1,
+ conv031_wellwell_b_b = 3,
+ conv031_wellwell = 4,
+ conv031_exit_b_b = 11
+};
+
+enum {
+ conv032_pid_dies_b_b = 5,
+ conv032_pain_b_b = 14,
+ conv032_pain = 15,
+ conv032_pid_death_b_b = 20
+};
+
enum {
conv033_six_only = 4,
conv033_exit_b_b = 7
@@ -207,6 +222,13 @@ enum {
conv035_exit_b_b = 3
};
+enum {
+ conv036_question2_b_b = 7,
+ conv036_question3_b_b = 15,
+ conv036_die_b_b = 24,
+ conv036_ok_b_b = 26
+};
+
enum {
conv037_next_b_b = 2,
conv037_exit_b_b = 5
diff --git a/engines/mads/madsv2/dragonsphere/mads/inventory.h b/engines/mads/madsv2/dragonsphere/mads/inventory.h
index 167e5720cdc..d05e940b1df 100644
--- a/engines/mads/madsv2/dragonsphere/mads/inventory.h
+++ b/engines/mads/madsv2/dragonsphere/mads/inventory.h
@@ -51,15 +51,22 @@ enum {
amulet = 19,
mud = 20,
feathers = 21,
+ torch = 22,
+ flask = 23,
flask_full_of_acid = 24,
+ rope = 25,
+ power_vacuum_stone = 26,
dead_rat = 27,
+ map = 28,
crystal_ball = 29,
black_sphere = 30,
soptus_soporific = 31,
shifter_ring = 32,
medicine_bundle = 33,
partly_built_bundle = 34,
+ ratsicle = 35,
tentacle_parts = 36,
+ teleport_door = 37,
rare_coin = 38,
crystal_flower = 39,
ruby_ring = 41,
diff --git a/engines/mads/madsv2/dragonsphere/mads/quotes.h b/engines/mads/madsv2/dragonsphere/mads/quotes.h
index 533e6cd4d4b..0e4f55ce069 100644
--- a/engines/mads/madsv2/dragonsphere/mads/quotes.h
+++ b/engines/mads/madsv2/dragonsphere/mads/quotes.h
@@ -82,7 +82,54 @@ enum {
quote_poem_sixteen_sun = 124,
quote_poem_seventeen_thee = 125,
quote_poem_seventeen_land = 126,
- quote_poem_seventeen_oh = 127
+ quote_poem_seventeen_oh = 127,
+
+ quote_vine_1_a = 128,
+ quote_vine_1_b = 129,
+ quote_vine_1_c = 130,
+ quote_vine_1_d = 131,
+ quote_vine_1_d1 = 132,
+ quote_vine_1_e = 133,
+ quote_vine_1_f = 134,
+ quote_vine_1_g = 135,
+ quote_vine_1_h = 136,
+ quote_vine_1_i = 137,
+ quote_vine_1_i1 = 138,
+ quote_vine_1_j = 139,
+ quote_vine_1_k = 140,
+ quote_vine_1_k1 = 141,
+ quote_vine_1_l = 142,
+
+ quote_vine_2_a = 143,
+ quote_vine_2_a1 = 144,
+ quote_vine_2_b = 145,
+ quote_vine_2_b1 = 146,
+ quote_vine_2_c = 147,
+ quote_vine_2_d = 148,
+ quote_vine_2_d1 = 149,
+ quote_vine_2_d2 = 150,
+ quote_vine_2_e = 151,
+ quote_vine_2_e1 = 152,
+ quote_vine_2_f = 153,
+ quote_vine_2_g = 154,
+ quote_vine_2_g1 = 155,
+ quote_vine_2_h = 156,
+ quote_vine_2_i = 157,
+ quote_vine_2_i1 = 158,
+
+ quote_vine_3_a = 159,
+ quote_vine_3_a1 = 160,
+ quote_vine_3_b = 161,
+ quote_vine_3_b1 = 162,
+ quote_vine_3_c = 163,
+ quote_vine_3_d = 164,
+ quote_vine_3_d1 = 165,
+ quote_vine_3_e = 166,
+ quote_vine_3_f = 167,
+ quote_vine_3_f1 = 168,
+ quote_vine_3_g = 169,
+ quote_vine_3_h = 170,
+ quote_vine_3_i = 171
};
} // namespace Dragonsphere
diff --git a/engines/mads/madsv2/dragonsphere/mads/sounds.h b/engines/mads/madsv2/dragonsphere/mads/sounds.h
index a6a9d2c6e6e..29eeaf614ec 100644
--- a/engines/mads/madsv2/dragonsphere/mads/sounds.h
+++ b/engines/mads/madsv2/dragonsphere/mads/sounds.h
@@ -125,7 +125,25 @@ enum {
N_Bk612Music = 38,
N_WaterFlows = 39,
N_Bk614Music = 40,
+ N_006Waterfall = 64,
+ N_TurnPetcock = 65,
+ N_CastleDoorMorphs = 69,
+ N_CatchStone = 70,
+ N_EyeZap = 73,
+ N_MudInTheEye = 74,
+ N_AcidDrips = 75,
+ N_ElevatorButton = 78,
+ N_ElevatorOn = 79,
+ N_ElevatorOff = 80,
+ N_AcidBurnsFloor = 85,
+ N_AppearInHotRoom = 89,
+ N_MeltInHotRoom = 90,
+ N_MachineClank = 93,
+ N_MachineZap = 94,
+ N_MachineMist = 95,
N_EerieSounds = 96,
+ N_MeltInGlowingFloor = 97,
+ N_CreakyCastleDoor = 98,
// Section 9/General
N_AllFade = 1,
diff --git a/engines/mads/madsv2/dragonsphere/mads/words.h b/engines/mads/madsv2/dragonsphere/mads/words.h
index 1999084579b..9fda1d1ce24 100644
--- a/engines/mads/madsv2/dragonsphere/mads/words.h
+++ b/engines/mads/madsv2/dragonsphere/mads/words.h
@@ -46,6 +46,7 @@ enum {
words_rug = 18,
words_carpet = 19,
words_wall = 20,
+ words_chest = 23,
words_window = 24,
words_tapestry = 26,
words_walk_behind = 28,
@@ -79,6 +80,9 @@ enum {
words_heal_self = 70,
words_polystone = 71,
words_mimic = 72,
+ words_red_powerstone = 73,
+ words_yellow_powerstone = 74,
+ words_blue_powerstone = 75,
words_key_crown = 76,
words_wear = 77,
words_dates = 78,
@@ -171,6 +175,7 @@ enum {
words_ceiling = 196,
words_door_to_hallway = 197,
words_table = 198,
+ words_bookshelf = 199,
words_chair = 202,
words_guard_stool = 206,
words_rocks = 207,
@@ -187,7 +192,7 @@ enum {
words_crank = 224,
words_bucket = 225,
words_jump_down = 226,
- words_door_to_darkness = 228,
+ words_doorway_to_south = 228,
words_pedestal = 229,
words_door_to_north = 230,
words_painting = 231,
@@ -198,6 +203,7 @@ enum {
words_council_table = 236,
words_candlestick = 237,
words_desk = 238,
+ words_turn = 239,
words_door_to_meeting_room = 249,
words_door_to_ballroom = 250,
words_flowers = 251,
@@ -279,25 +285,89 @@ enum {
words_sit_on = 363,
words_stranger = 364,
words_tower_door = 365,
+ words_doorway_to_east = 369,
+ words_doorway_to_west = 370,
+ words_skull = 371,
+ words_door_to_magic_room = 372,
+ words_ancient_barrel = 373,
+ words_cobwebs = 374,
+ words_shelf = 375,
+ words_musty_chart = 376,
+ words_lab_table = 377,
+ words_petcock = 378,
+ words_nozzle = 379,
+ words_tubing = 380,
+ words_flame = 382,
+ words_metal_plate = 383,
+ words_shaft_of_light = 384,
+ words_cabinet = 385,
+ words_balance = 386,
+ words_cage = 387,
words_freezer = 388,
+ words_contents_of_freezer = 389,
+ words_door_to_south = 391,
+ words_trail_of_green_slime = 392,
+ words_neck_lock = 393,
+ words_bench = 394,
+ words_skeleton = 395,
+ words_leg_lock = 397,
+ words_waist_lock = 398,
words_Ner_Tom = 399,
words_belt = 400,
+ words_closet = 402,
+ words_door_to_eye_chamber = 403,
+ words_dresser = 404,
+ words_scroll = 405,
+ words_witch_paraphernalia = 406,
+ words_shelves = 407,
+ words_magic_tomes = 408,
+ words_magic_paraphernalia = 409,
+ words_book_of_magic = 410,
+ words_hourglass = 411,
+ words_stone_sphere = 412,
+ words_shadow_of_window = 413,
words_music_box = 414,
+ words_large_spider_web = 415,
+ words_infernal_machine = 416,
+ words_water_source = 417,
+ words_retort = 419,
+ words_doorway_to_corridor = 420,
+ words_telescope = 421,
+ words_strange_map = 422,
words_circle_of_spheres = 423,
+ words_stone_bed = 424,
+ words_dragon_sculpture = 425,
words_rat = 426,
+ words_rat_cage = 427,
words_door_frame = 431,
+ words_doorway_to_dark_room = 434,
+ words_big_skull = 435,
+ words_button = 437,
+ words_top_button = 438,
+ words_bottom_button = 439,
words_teleportal = 440,
+ words_eye_chamber_doorway = 441,
+ words_machine_room_doorway = 442,
words_glowing_floor = 443,
words_Soptus_Ecliptus = 448,
+ words_tower = 449,
+ words_path_behind_tower = 451,
words_Slathan_ni_Patan = 453,
+ words_path_around_tower = 455,
words_spirit_plane = 457,
words_spirit_tree = 458,
+ words_remains = 460,
+ words_dragon_door = 462,
+ words_dragon_bones = 463,
+ words_iron_floor = 464,
+ words_hole = 465,
words_desert_to_west = 473,
words_cross = 474,
words_desert_to_east = 475,
words_desert_to_south = 476,
words_desert_to_north = 477,
words_desert = 478,
+ words_powerstone = 479,
words_bones = 480,
words_tent = 481,
words_bush = 482,
@@ -315,6 +385,7 @@ enum {
words_lean_to = 500,
words_trader = 501,
words_sign = 502,
+ words_water_flow = 503,
words_floating_disk = 504,
words_gnarled_root = 505,
words_snake_pit = 506,
@@ -366,7 +437,8 @@ enum {
words_topiary_dragon = 566,
words_guardian = 567,
words_Butterfly_King = 568,
- words_Dragonsphere = 571
+ words_Dragonsphere = 571,
+ words_path_to_Hightower = 572
};
} // namespace Dragonsphere
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room116.cpp b/engines/mads/madsv2/dragonsphere/rooms/room116.cpp
index 327aaf10368..d75a78bd5e5 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room116.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room116.cpp
@@ -556,9 +556,9 @@ static void room_116_parser() {
goto handled;
}
- if (player_parse(words_walk_through, words_door_to_darkness, 0) ||
- player_parse(words_open, 228, 0) ||
- player_parse(words_pull, 228, 0)) {
+ if (player_parse(words_walk_through, words_doorway_to_south, 0) ||
+ player_parse(words_open, words_doorway_to_south, 0) ||
+ player_parse(words_pull, words_doorway_to_south, 0)) {
if (global[king_status] == KING_WITH_SOUL && !global[king_is_in_stairwell]) {
conv_run(CONVERSATION_WITH_KING);
conv_export_value(global[king_status] == KING_WITH_SOUL ? 1 : 0);
@@ -783,7 +783,7 @@ static void room_116_parser() {
} else if (player_parse(words_door_to_north, 0)) {
text_show(11605);
goto handled;
- } else if (player_parse(words_door_to_darkness, 0)) {
+ } else if (player_parse(words_doorway_to_south, 0)) {
text_show(11606);
goto handled;
} else if (player_parse(words_king, 0) && global[king_status] == KING_CAPTIVE) {
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room601.cpp b/engines/mads/madsv2/dragonsphere/rooms/room601.cpp
index 816617aea16..f81c5bde9ed 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room601.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room601.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* 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
@@ -19,14 +19,21 @@
*
*/
+#include "mads/madsv2/core/camera.h"
+#include "mads/madsv2/core/config.h"
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/quote.h"
#include "mads/madsv2/core/sound.h"
+#include "mads/madsv2/core/speech.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
#include "mads/madsv2/dragonsphere/mads/inventory.h"
+#include "mads/madsv2/dragonsphere/mads/quotes.h"
#include "mads/madsv2/dragonsphere/mads/sounds.h"
#include "mads/madsv2/dragonsphere/mads/words.h"
#include "mads/madsv2/dragonsphere/global.h"
@@ -39,33 +46,1688 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[7];
+
+ int16 mount_left_base;
+ int16 dyn_mount_left;
+
+ int16 sky_mid_left_base;
+ int16 dyn_sky_mid_left;
+
+ int16 mount_right_base;
+ int16 dyn_mount_right;
+
+ int16 sky_mid_bot_right_base;
+ int16 dyn_sky_mid_bot_right;
+
+ int16 rock_base;
+ int16 dyn_rock;
+
+ int16 panning;
+ int16 prevent;
+ int16 prevent_1;
+ int16 vine_talk;
+
+ int32 update_clock;
+
+ int16 king_0_frame;
+ int16 anim_0_running;
+
+ int16 king_1_frame;
+ int16 king_1_action;
+ int16 king_1_talk_count;
+ int16 anim_1_running;
+
+ int16 vine_1_frame;
+ int16 vine_1_action;
+ int16 vine_1_talk_count;
+ int16 anim_2_running;
+
+ int16 vine_2_frame;
+ int16 vine_2_action;
+ int16 vine_2_talk_count;
+ int16 anim_3_running;
+
+ int16 vine_3_frame;
+ int16 vine_3_action;
+ int16 vine_3_talk_count;
+ int16 anim_4_running;
+
+ int16 vine_4_frame;
+ int16 vine_4_action;
+ int16 vine_4_talk_count;
+ int16 anim_5_running;
+
+ int16 king_2_frame;
+ int16 king_2_action;
+ int16 king_2_talk_count;
+ int16 anim_6_running;
+
+ int16 door_is_open;
};
-#define local (&scratch)
+#define local ((Scratch *)(&game.scratch[0]))
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_single_morph 0
+#define fx_mount_left 1
+#define fx_sky_mid_left 2
+#define fx_mount_right 3
+#define fx_sky_mid_bot_right 4
+#define fx_vine_block 5
+#define fx_door 6
+#define fx_morph 7
+#define fx_rock 8
+
+#define ROOM_601_COMMANDS_ALLOWED 60
+#define ROOM_601_RUN_VINE_ANIM 70
+#define ROOM_601_YOU_TALK 80
+#define ROOM_601_ME_TALK 82
+#define ROOM_601_DOOR_OPENS 84
+#define ROOM_601_DOOR_CLOSES 90
+#define MUSIC 100
+
+#define PLAYER_X_FROM_508 -15
+#define PLAYER_Y_FROM_508 140
+#define WALK_TO_X_FROM_508 20
+#define WALK_TO_Y_FROM_508 140
+
+#define PLAYER_X_FROM_603 480
+#define PLAYER_Y_FROM_603 127
+#define WALK_TO_X_FROM_603 480
+#define WALK_TO_Y_FROM_603 140
+
+#define camera_ratio_1 1
+#define camera_ratio_2 3
+
+#define CAMERA_MIDDLE 326
+#define CAMERA_LEFT 0
+#define CAMERA_RIGHT 640
+
+#define WALK_TO_RIGHT_X_1 783
+#define WALK_TO_RIGHT_Y_1 101
+#define WALK_TO_RIGHT_X_2 805
+#define WALK_TO_RIGHT_Y_2 117
+
+#define WALK_TO_LEFT_X_1 161
+#define WALK_TO_LEFT_Y_1 101
+#define WALK_TO_LEFT_X_2 136
+#define WALK_TO_LEFT_Y_2 120
+
+#define PANNING_RIGHT 1
+#define PANNING_LEFT 2
+
+#define TOWER_DOOR_X 465
+#define TOWER_DOOR_Y 140
+
+#define ROCK_BLOCK_X 404
+#define ROCK_BLOCK_Y 149
+#define ROCK_X 438
+#define ROCK_Y 147
+
+#define WALK_VINE_LEFT_X 380
+#define WALK_VINE_LEFT_Y 148
+
+#define WALK_VINE_RIGHT_X 425
+#define WALK_VINE_RIGHT_Y 146
+
+#define NOTHING 0
+#define TALK 1
+#define DROP 2
+#define STRUGGLE 3
+#define DIE 4
+
+#define CAUGHT_X 549
+#define CAUGHT_Y 136
+
+#define CONV36_VINE 36
+
+#define SECOND_SET 1
+#define THIRD_SET 2
+
+#define RESTART_X 630
+#define RESTART_Y 141
+
+
+static void clear_all() {
+ local->vine_1_talk_count = 0;
+ local->vine_2_talk_count = 0;
+ local->vine_3_talk_count = 0;
+ local->vine_4_talk_count = 0;
+
+ local->vine_1_action = NOTHING;
+ local->vine_2_action = NOTHING;
+ local->vine_3_action = NOTHING;
+ local->vine_4_action = NOTHING;
+}
+
+static void handle_animation_king_0() {
+ int16 king_0_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->king_0_frame) {
+ local->king_0_frame = kernel_anim[aa[0]].frame;
+ king_0_reset_frame = -1;
+
+ switch (local->king_0_frame) {
+ case 71:
+ kernel_abort_animation(aa[0]);
+
+ aa[2] = kernel_run_animation(kernel_name('t', 1), 0);
+ local->anim_2_running = true;
+ local->vine_1_action = TALK;
+
+ aa[3] = kernel_run_animation(kernel_name('t', 2), 0);
+ local->anim_3_running = true;
+ local->vine_2_action = NOTHING;
+
+ aa[4] = kernel_run_animation(kernel_name('t', 3), 0);
+ local->anim_4_running = true;
+ local->vine_3_action = NOTHING;
+
+ aa[5] = kernel_run_animation(kernel_name('t', 4), 0);
+ local->anim_5_running = true;
+ local->vine_4_action = NOTHING;
+
+ local->anim_0_running = false;
+ aa[1] = kernel_run_animation(kernel_name('v', 2), 0);
+ local->anim_1_running = true;
+ local->king_1_action = STRUGGLE;
+ king_0_reset_frame = -1;
+ kernel_synch(KERNEL_ANIM, aa[1], KERNEL_NOW, 0);
+ kernel_reset_animation(aa[1], 71);
+ kernel_timing_trigger(ONE_SECOND, 1);
+ break;
+ }
+
+ if (king_0_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], king_0_reset_frame);
+ local->king_0_frame = king_0_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_king_1() {
+ int16 king_1_reset_frame;
+
+ if (kernel_anim[aa[1]].frame != local->king_1_frame) {
+ local->king_1_frame = kernel_anim[aa[1]].frame;
+ king_1_reset_frame = -1;
+
+ switch (local->king_1_frame) {
+ case 71:
+ case 72:
+ case 73:
+ case 74:
+ case 75:
+ case 76:
+ case 77:
+ switch (local->king_1_action) {
+ case STRUGGLE:
+ king_1_reset_frame = imath_random(70, 73);
+ break;
+
+ case DROP:
+ kernel_abort_animation(aa[1]);
+ local->anim_1_running = false;
+
+ kernel_abort_animation(aa[5]);
+ local->anim_5_running = false;
+ kernel_abort_animation(aa[4]);
+ local->anim_4_running = false;
+ kernel_abort_animation(aa[3]);
+ local->anim_3_running = false;
+ kernel_abort_animation(aa[2]);
+ local->anim_2_running = false;
+
+ global[vine_will_grab] = false;
+ global[player_score] += 3;
+ local->anim_6_running = true;
+ king_1_reset_frame = -1;
+ aa[6] = kernel_run_animation(kernel_name('v', 3), 0);
+ kernel_synch(KERNEL_ANIM, aa[6], KERNEL_NOW, 0);
+ kernel_reset_animation(aa[6], 18);
+ camera_x.pan_mode = CAMERA_PLAYER;
+ break;
+
+ case DIE:
+ kernel_abort_animation(aa[1]);
+ local->anim_1_running = false;
+ aa[6] = kernel_run_animation(kernel_name('v', 3), 0);
+ local->anim_6_running = true;
+ king_1_reset_frame = -1;
+ kernel_synch(KERNEL_ANIM, aa[6], KERNEL_NOW, 0);
+ break;
+
+ case TALK:
+ king_1_reset_frame = imath_random(74, 76);
+ ++local->king_1_talk_count;
+ if (local->king_1_talk_count > 10) {
+ local->king_1_action = STRUGGLE;
+ local->king_1_talk_count = 0;
+ king_1_reset_frame = 72;
+ }
+ break;
+ }
+ break;
+ }
+
+ if (king_1_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], king_1_reset_frame);
+ local->king_1_frame = king_1_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_king_2() {
+ int16 king_2_reset_frame;
+
+ if (kernel_anim[aa[6]].frame != local->king_2_frame) {
+ local->king_2_frame = kernel_anim[aa[6]].frame;
+ king_2_reset_frame = -1;
+
+ switch (local->king_2_frame) {
+ case 10:
+ global_speech_go(2);
+ break;
+
+ case 17:
+ if (game.difficulty == EASY_MODE) {
+ text_show(60118);
+ } else {
+ text_show(45);
+ }
+ kernel.force_restart = true;
+ global[vines_have_player] = false;
+ break;
+
+ case 39:
+ sound_play(N_BackgroundMus);
+ global[vines_have_player] = false;
+ kernel_abort_animation(aa[6]);
+ local->anim_6_running = false;
+ player.commands_allowed = true;
+ player.walker_visible = true;
+ local->door_is_open = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ sound_play(N_CreakyCastleDoor);
+ kernel_seq_delete(seq[fx_door]);
+ seq[fx_door] = kernel_seq_forward(ss[fx_door], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_door], 2);
+ kernel_seq_range(seq[fx_door], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_door], KERNEL_TRIGGER_EXPIRE, 0, ROOM_601_DOOR_OPENS);
+ break;
+ }
+
+ if (king_2_reset_frame >= 0) {
+ kernel_reset_animation(aa[6], king_2_reset_frame);
+ local->king_2_frame = king_2_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_vine_1() {
+ int16 vine_1_reset_frame;
+
+ if (kernel_anim[aa[2]].frame != local->vine_1_frame) {
+ local->vine_1_frame = kernel_anim[aa[2]].frame;
+ vine_1_reset_frame = -1;
+
+ if (local->vine_1_action == TALK) {
+ ++local->vine_1_talk_count;
+ if (local->vine_1_talk_count >= imath_random(30, 35)) {
+ local->vine_1_action = NOTHING;
+ vine_1_reset_frame = 0;
+ } else {
+ vine_1_reset_frame = imath_random(1, 5);
+ }
+ } else {
+ vine_1_reset_frame = 0;
+ }
+
+ if (vine_1_reset_frame >= 0) {
+ kernel_reset_animation(aa[2], vine_1_reset_frame);
+ local->vine_1_frame = vine_1_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_vine_2() {
+ int16 vine_2_reset_frame;
+
+ if (kernel_anim[aa[3]].frame != local->vine_2_frame) {
+ local->vine_2_frame = kernel_anim[aa[3]].frame;
+ vine_2_reset_frame = -1;
+
+ if (local->vine_2_action == TALK) {
+ ++local->vine_2_talk_count;
+ if (local->vine_2_talk_count >= imath_random(30, 35)) {
+ local->vine_2_action = NOTHING;
+ vine_2_reset_frame = 0;
+ } else {
+ vine_2_reset_frame = imath_random(1, 5);
+ }
+ } else {
+ vine_2_reset_frame = 0;
+ }
+
+ if (vine_2_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], vine_2_reset_frame);
+ local->vine_2_frame = vine_2_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_vine_3() {
+ int16 vine_3_reset_frame;
+
+ if (kernel_anim[aa[4]].frame != local->vine_3_frame) {
+ local->vine_3_frame = kernel_anim[aa[4]].frame;
+ vine_3_reset_frame = -1;
+
+ if (local->vine_3_action == TALK) {
+ ++local->vine_3_talk_count;
+ if (local->vine_3_talk_count >= imath_random(30, 35)) {
+ local->vine_3_action = NOTHING;
+ vine_3_reset_frame = 0;
+ } else {
+ vine_3_reset_frame = imath_random(1, 5);
+ }
+ } else {
+ vine_3_reset_frame = 0;
+ }
+
+ if (vine_3_reset_frame >= 0) {
+ kernel_reset_animation(aa[4], vine_3_reset_frame);
+ local->vine_3_frame = vine_3_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_vine_4() {
+ int16 vine_4_reset_frame;
-void room_601_init() {
+ if (kernel_anim[aa[5]].frame != local->vine_4_frame) {
+ local->vine_4_frame = kernel_anim[aa[5]].frame;
+ vine_4_reset_frame = -1;
+ if (local->vine_4_action == TALK) {
+ ++local->vine_4_talk_count;
+ if (local->vine_4_talk_count >= imath_random(30, 35)) {
+ local->vine_4_action = NOTHING;
+ vine_4_reset_frame = 0;
+ } else {
+ vine_4_reset_frame = imath_random(1, 5);
+ }
+ } else {
+ vine_4_reset_frame = 0;
+ }
+
+ if (vine_4_reset_frame >= 0) {
+ kernel_reset_animation(aa[5], vine_4_reset_frame);
+ local->vine_4_frame = vine_4_reset_frame;
+ }
+ }
}
-void room_601_daemon() {
+static void set_rockk_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int y;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_rock] >= 0) {
+ kernel_seq_delete(seq[fx_rock]);
+ }
+
+ difference = center - local->rock_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ x = local->rock_base + displace - 1;
+ y = series_list[ss[fx_rock]]->index[0].ys + 126;
+ xs = series_list[ss[fx_rock]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_rock] = -1;
+ } else {
+ seq[fx_rock] = kernel_seq_stamp(ss[fx_rock], false, 1);
+ kernel_seq_loc(seq[fx_rock], x, y);
+ kernel_seq_depth(seq[fx_rock], 1);
+ }
}
-void room_601_pre_parser() {
+static void set_mount_left_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_mount_left] >= 0) {
+ kernel_seq_delete(seq[fx_mount_left]);
+ }
+ difference = center - local->mount_left_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / 2);
+ displace = sgn_in(displace, direction);
+
+ x = local->mount_left_base - displace - 1;
+ xs = series_list[ss[fx_mount_left]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_mount_left] = -1;
+ } else {
+ seq[fx_mount_left] = kernel_seq_stamp(ss[fx_mount_left], false, 1);
+ kernel_seq_loc(seq[fx_mount_left], x, 130);
+ kernel_seq_depth(seq[fx_mount_left], 15);
+ }
}
-void room_601_parser() {
+static void set_sky_mid_left_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_sky_mid_left] >= 0) {
+ kernel_seq_delete(seq[fx_sky_mid_left]);
+ }
+
+ difference = center - local->sky_mid_left_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / 3);
+ displace = sgn_in(displace, direction);
+
+ x = local->sky_mid_left_base - displace - 1;
+ xs = series_list[ss[fx_sky_mid_left]]->index[0].xs;
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_sky_mid_left] = -1;
+ } else {
+ seq[fx_sky_mid_left] = kernel_seq_stamp(ss[fx_sky_mid_left], false, 1);
+ kernel_seq_loc(seq[fx_sky_mid_left], x, 44);
+ kernel_seq_depth(seq[fx_sky_mid_left], 15);
+ }
+}
+
+static void set_mount_right_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_mount_right] >= 0) {
+ kernel_seq_delete(seq[fx_mount_right]);
+ }
+
+ difference = center - local->mount_right_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / 2);
+ displace = sgn_in(displace, direction);
+
+ x = local->mount_right_base - displace - 1;
+ xs = series_list[ss[fx_mount_right]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_mount_right] = -1;
+ } else {
+ seq[fx_mount_right] = kernel_seq_stamp(ss[fx_mount_right], false, 1);
+ kernel_seq_loc(seq[fx_mount_right], x, 155);
+ kernel_seq_depth(seq[fx_mount_right], 15);
+ }
+}
+
+static void set_sky_mid_bot_right_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_sky_mid_bot_right] >= 0) {
+ kernel_seq_delete(seq[fx_sky_mid_bot_right]);
+ }
+
+ difference = center - local->sky_mid_bot_right_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / 3);
+ displace = sgn_in(displace, direction);
+
+ x = local->sky_mid_bot_right_base - displace - 1;
+ xs = series_list[ss[fx_sky_mid_bot_right]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_sky_mid_bot_right] = -1;
+ } else {
+ seq[fx_sky_mid_bot_right] = kernel_seq_stamp(ss[fx_sky_mid_bot_right], false, 1);
+ kernel_seq_loc(seq[fx_sky_mid_bot_right], x, 60);
+ kernel_seq_depth(seq[fx_sky_mid_bot_right], 15);
+ }
+}
+
+static void process_conv_vine() {
+ int you_trig_flag = false;
+ int me_trig_flag = false;
+
+ if (player_verb == conv036_question2_b_b) {
+ conv_hold();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->vine_talk = SECOND_SET;
+ }
+
+ if (player_verb == conv036_question3_b_b) {
+ conv_hold();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->vine_talk = THIRD_SET;
+ }
+
+ if (player_verb == conv036_die_b_b) {
+ conv_abort();
+ conv_reset(CONV36_VINE);
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->king_1_action = DIE;
+ }
+
+ if (player_verb == conv036_ok_b_b) {
+ conv_abort();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->king_1_action = DROP;
+ }
+
+ if (kernel.trigger == ROOM_601_YOU_TALK) {
+ local->king_1_action = STRUGGLE;
+ local->vine_1_action = TALK;
+ local->vine_2_action = TALK;
+ local->vine_3_action = TALK;
+ local->vine_4_action = TALK;
+ }
+
+ if (kernel.trigger == ROOM_601_ME_TALK) {
+ local->king_1_action = TALK;
+ local->vine_1_action = NOTHING;
+ local->vine_2_action = NOTHING;
+ local->vine_3_action = NOTHING;
+ local->vine_4_action = NOTHING;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_601_YOU_TALK);
+ }
+
+ if (!me_trig_flag) {
+ conv_me_trigger(ROOM_601_ME_TALK);
+ }
+
+ local->vine_1_talk_count = 0;
+ local->vine_2_talk_count = 0;
+ local->vine_3_talk_count = 0;
+ local->vine_4_talk_count = 0;
+ local->king_1_talk_count = 0;
+}
+
+static void room_601_init() {
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ local->anim_2_running = false;
+ local->anim_3_running = false;
+ local->anim_4_running = false;
+ local->anim_5_running = false;
+ local->anim_6_running = false;
+ local->prevent_1 = false;
+ local->door_is_open = false;
+ }
+
+ local->king_1_talk_count = 0;
+ local->vine_1_talk_count = 0;
+ local->vine_2_talk_count = 0;
+ local->vine_3_talk_count = 0;
+ local->vine_4_talk_count = 0;
+ local->vine_talk = 0;
+
+ kernel.disable_fastwalk = true;
+ local->panning = false;
+ local->prevent = false;
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ kernel.quotes = quote_load(
+ quote_vine_1_a,
+ quote_vine_1_b,
+ quote_vine_1_c,
+ quote_vine_1_d,
+ quote_vine_1_d1,
+ quote_vine_1_e,
+ quote_vine_1_f,
+ quote_vine_1_g,
+ quote_vine_1_h,
+ quote_vine_1_i,
+ quote_vine_1_i1,
+ quote_vine_1_j,
+ quote_vine_1_k,
+ quote_vine_1_k1,
+ quote_vine_1_l,
+
+ quote_vine_2_a,
+ quote_vine_2_a1,
+ quote_vine_2_b,
+ quote_vine_2_b1,
+ quote_vine_2_c,
+ quote_vine_2_d,
+ quote_vine_2_d1,
+ quote_vine_2_d2,
+ quote_vine_2_e,
+ quote_vine_2_e1,
+ quote_vine_2_f,
+ quote_vine_2_g,
+ quote_vine_2_g1,
+ quote_vine_2_h,
+ quote_vine_2_i,
+ quote_vine_2_i1,
+
+ quote_vine_3_a,
+ quote_vine_3_a1,
+ quote_vine_3_b,
+ quote_vine_3_b1,
+ quote_vine_3_c,
+ quote_vine_3_d,
+ quote_vine_3_d1,
+ quote_vine_3_e,
+ quote_vine_3_f,
+ quote_vine_3_f1,
+ quote_vine_3_g,
+ quote_vine_3_h,
+ quote_vine_3_i, 0);
+ }
+
+ ss[fx_door] = kernel_load_series(kernel_name('y', 0), false);
+
+ if (previous_room == 603 || previous_room == 614 || local->door_is_open) {
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_door], 3);
+ } else if (global[player_persona] == PLAYER_IS_KING) {
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_door], 3);
+ }
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ ss[fx_vine_block] = kernel_load_series(kernel_name('z', 1), false);
+ seq[fx_vine_block] = kernel_seq_stamp(ss[fx_vine_block], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_vine_block], 3);
+ } else {
+ kernel_flip_hotspot(words_tangle, false);
+ kernel_flip_hotspot_loc(words_rock, false, ROCK_BLOCK_X, ROCK_BLOCK_Y);
+ kernel_flip_hotspot_loc(words_rock, true, ROCK_X, ROCK_Y);
+ }
+
+ ss[fx_rock] = kernel_load_series(kernel_name('r', 1), false);
+ ss[fx_mount_left] = kernel_load_series(kernel_name('x', 1), false);
+ ss[fx_sky_mid_left] = kernel_load_series(kernel_name('c', 1), false);
+ ss[fx_mount_right] = kernel_load_series(kernel_name('x', 2), false);
+ ss[fx_sky_mid_bot_right] = kernel_load_series(kernel_name('c', 5), false);
+
+ if (global[player_persona] == PLAYER_IS_PID) {
+ ss[fx_single_morph] = kernel_load_series(kernel_name('x', 0), false);
+ ss[fx_morph] = kernel_load_series(kernel_name('x', 3), false);
+ }
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ conv_get(CONV36_VINE);
+ }
+
+ if (previous_room == KERNEL_RESTORING_GAME) {
+ if (conv_restore_running == CONV36_VINE) {
+ aa[2] = kernel_run_animation(kernel_name('t', 1), 0);
+ local->anim_2_running = true;
+ local->vine_1_action = NOTHING;
+
+ aa[3] = kernel_run_animation(kernel_name('t', 2), 0);
+ local->anim_3_running = true;
+ local->vine_2_action = NOTHING;
+
+ aa[4] = kernel_run_animation(kernel_name('t', 3), 0);
+ local->anim_4_running = true;
+ local->vine_3_action = NOTHING;
+
+ aa[5] = kernel_run_animation(kernel_name('t', 4), 0);
+ local->anim_5_running = true;
+ local->vine_4_action = NOTHING;
+
+ aa[1] = kernel_run_animation(kernel_name('v', 2), 0);
+ local->anim_1_running = true;
+ local->king_1_action = STRUGGLE;
+ kernel_reset_animation(aa[1], 72);
+
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ conv_run(CONV36_VINE);
+ }
+ }
+
+ if (previous_room == 601) {
+ camera_jump_to(400, 0);
+ player.x = RESTART_X;
+ player.y = RESTART_Y;
+ player.facing = FACING_WEST;
+
+ } else if (previous_room == 603 || previous_room == 614) {
+ camera_jump_to(CAMERA_MIDDLE, 0);
+ player.x = PLAYER_X_FROM_603;
+ player.y = PLAYER_Y_FROM_603;
+ player.facing = FACING_SOUTH;
+ player.commands_allowed = false;
+ player_walk(WALK_TO_X_FROM_603, WALK_TO_Y_FROM_603, FACING_SOUTH);
+ player_walk_trigger(ROOM_601_DOOR_CLOSES);
+
+ } else if (previous_room == 508 || previous_room != KERNEL_RESTORING_GAME) {
+ player_first_walk(PLAYER_X_FROM_508, PLAYER_Y_FROM_508, FACING_EAST,
+ WALK_TO_X_FROM_508, WALK_TO_Y_FROM_508, FACING_EAST, true);
+ }
+
+ if (global[player_persona] == PLAYER_IS_PID && previous_room != 614) {
+ seq[fx_single_morph] = kernel_seq_stamp(ss[fx_single_morph], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_single_morph], 3);
+ kernel_flip_hotspot(words_tower_door, false);
+ }
+
+ seq[fx_mount_left] = -1;
+ local->dyn_mount_left = -1;
+ local->mount_left_base = -24;
+
+ seq[fx_sky_mid_left] = -1;
+ local->dyn_sky_mid_left = -1;
+ local->sky_mid_left_base = 23;
+
+ seq[fx_mount_right] = -1;
+ local->dyn_mount_right = -1;
+ local->mount_right_base = 951;
+
+ seq[fx_sky_mid_bot_right] = -1;
+ local->dyn_sky_mid_bot_right = -1;
+ local->sky_mid_bot_right_base = 913;
+
+ seq[fx_rock] = -1;
+ local->dyn_rock = -1;
+ local->rock_base = 100;
+
+ local->update_clock = kernel.clock;
+
+ set_mount_left_position();
+ set_sky_mid_left_position();
+ set_mount_right_position();
+ set_sky_mid_bot_right_position();
+ set_rockk_position();
+
+ section_6_music();
+}
+
+static void room_601_daemon() {
+ int temp;
+ int dist;
+ int time;
+
+ if (local->anim_0_running) {
+ handle_animation_king_0();
+ }
+
+ if (local->anim_1_running) {
+ handle_animation_king_1();
+ }
+
+ if (local->anim_2_running) {
+ handle_animation_vine_1();
+ }
+
+ if (local->anim_3_running) {
+ handle_animation_vine_2();
+ }
+
+ if (local->anim_4_running) {
+ handle_animation_vine_3();
+ }
+
+ if (local->anim_5_running) {
+ handle_animation_vine_4();
+ }
+
+ if (local->anim_6_running) {
+ handle_animation_king_2();
+ }
+
+ if (local->panning && !camera_x.panning) {
+ if (local->panning == PANNING_RIGHT) {
+ player_demand_location(WALK_TO_RIGHT_X_1, WALK_TO_RIGHT_Y_1);
+ player_walk(WALK_TO_RIGHT_X_2, WALK_TO_RIGHT_Y_2, FACING_SOUTHWEST);
+
+ } else if (local->panning == PANNING_LEFT) {
+ player_demand_location(WALK_TO_LEFT_X_1, WALK_TO_LEFT_Y_1);
+ player_walk(WALK_TO_LEFT_X_2, WALK_TO_LEFT_Y_2, FACING_SOUTHEAST);
+ }
+
+ local->panning = false;
+ local->prevent = false;
+ camera_x.pan_mode = CAMERA_PLAYER;
+ player_walk_trigger(ROOM_601_COMMANDS_ALLOWED);
+ }
+
+ if (kernel.trigger == ROOM_601_COMMANDS_ALLOWED) {
+ player.commands_allowed = true;
+ }
+
+ if (local->panning == PANNING_RIGHT &&
+ !local->prevent && picture_view_x > 160) {
+ local->prevent = true;
+ if (!sound_off) {
+ sound_queue(N_006Waterfall, 42);
+ }
+ }
+
+ if (local->panning == PANNING_LEFT &&
+ !local->prevent && picture_view_x < 160) {
+ local->prevent = true;
+ if (!sound_off) {
+ sound_queue(N_006Waterfall, 90);
+ }
+ }
+
+ if (kernel.clock >= local->update_clock && !local->panning) {
+ dist = 127 - ((imath_hypot(player.x - 143, player.y - 107) * 127) / 378);
+ if (!sound_off) {
+ if (player.x > 395) {
+ sound_queue(N_006Waterfall, 42);
+ } else {
+ sound_queue(N_006Waterfall, dist);
+ }
+ }
+ local->update_clock = kernel.clock + player.frame_delay;
+ }
+
+ if (camera_x.pan_this_frame) {
+ set_mount_left_position();
+ set_mount_right_position();
+ set_sky_mid_left_position();
+ set_sky_mid_bot_right_position();
+ set_rockk_position();
+ }
+
+ if (player.x > 520 && player.x < 620 && player.y > 130 && global[vine_will_grab] &&
+ !local->prevent_1) {
+
+ local->prevent_1 = true;
+ player.commands_allowed = false;
+ player_walk(CAUGHT_X, CAUGHT_Y, FACING_WEST);
+ player_walk_trigger(ROOM_601_RUN_VINE_ANIM);
+ camera_pan_to(&camera_x, 400);
+ }
+
+ if (kernel.trigger == ROOM_601_RUN_VINE_ANIM) {
+ aa[0] = kernel_run_animation(kernel_name('v', 1), 0);
+ local->anim_0_running = true;
+ player.walker_visible = false;
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_PLAYER, 0);
+ }
+
+ switch (local->vine_talk) {
+ case SECOND_SET:
+ kernel_timing_trigger(HALF_SECOND, 14);
+ local->vine_talk = 0;
+ break;
+
+ case THIRD_SET:
+ kernel_timing_trigger(HALF_SECOND, 24);
+ local->vine_talk = 0;
+ break;
+ }
+
+ switch (kernel.trigger) {
+ case 1:
+ time = 100;
+ global_speech_go(8);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_a),
+ 33, 22, MESSAGE_COLOR, time, 2, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 2:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(9);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_b),
+ 218, 38, MESSAGE_COLOR, time, 3, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 3:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(10);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_c),
+ 206, 5, MESSAGE_COLOR, time, 4, 0);
+ clear_all();
+ local->vine_3_action = TALK;
+ break;
+
+ case 4:
+ time = 160;
+ kernel_message_purge();
+ global_speech_go(11);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_d),
+ 218, 28, MESSAGE_COLOR, time, 5, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_d1),
+ 218, 43, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 5:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(12);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_e),
+ 171, 6, MESSAGE_COLOR, time, 6, 0);
+ clear_all();
+ local->vine_2_action = TALK;
+ break;
+
+ case 6:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(13);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_f),
+ 206, 5, MESSAGE_COLOR, time, 7, 0);
+ clear_all();
+ local->vine_3_action = TALK;
+ break;
+
+ case 7:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(14);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_g),
+ 53, 24, MESSAGE_COLOR, time, 8, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 8:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(15);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_h),
+ 91, 21, MESSAGE_COLOR, time, 9, 0);
+ clear_all();
+ local->vine_2_action = TALK;
+ break;
+
+ case 9:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(16);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_i),
+ 218, 23, MESSAGE_COLOR, time, 10, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_i1),
+ 218, 38, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 10:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(17);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_j),
+ 27, 32, MESSAGE_COLOR, time, 11, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 11:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(18);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_k),
+ 219, 19, MESSAGE_COLOR, time, 12, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_k1),
+ 219, 34, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 12:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(19);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_1_l),
+ 91, 21, MESSAGE_COLOR, time, 13, 0);
+ clear_all();
+ local->vine_2_action = TALK;
+ break;
+
+ case 13:
+ conv_run(CONV36_VINE);
+ global[vines_have_player] = true;
+ break;
+
+ case 14:
+ time = 140;
+ kernel_message_purge();
+ global_speech_go(20);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_a),
+ 17, 22, MESSAGE_COLOR, time, 15, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_a1),
+ 17, 37, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 15:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(21);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_b),
+ 218, 22, MESSAGE_COLOR, time, 16, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_b1),
+ 218, 37, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 16:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(22);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_c),
+ 206, 5, MESSAGE_COLOR, time, 17, 0);
+ clear_all();
+ local->vine_3_action = TALK;
+ break;
+
+ case 17:
+ time = 190;
+ kernel_message_purge();
+ global_speech_go(23);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_d),
+ 218, 21, MESSAGE_COLOR, time, 18, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_d1),
+ 218, 36, MESSAGE_COLOR, time, 0, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_d2),
+ 218, 51, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 18:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(24);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_e),
+ 120, 21, MESSAGE_COLOR, time, 19, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_e1),
+ 120, 36, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_2_action = TALK;
+ break;
+
+ case 19:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(25);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_f),
+ 206, 5, MESSAGE_COLOR, time, 20, 0);
+ clear_all();
+ local->vine_3_action = TALK;
+ break;
+
+ case 20:
+ time = 180;
+ kernel_message_purge();
+ global_speech_go(26);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_g),
+ 23, 24, MESSAGE_COLOR, time, 21, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_g1),
+ 3, 39, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 21:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(27);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_h),
+ 166, 5, MESSAGE_COLOR, time, 22, 0);
+ clear_all();
+ local->vine_2_action = TALK;
+ break;
+
+ case 22:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(28);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_i),
+ 218, 23, MESSAGE_COLOR, time, 23, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_2_i1),
+ 218, 38, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 23:
+ conv_release();
+ break;
+
+ case 24:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(29);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_a),
+ 23, 22, MESSAGE_COLOR, time, 25, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_a1),
+ 23, 37, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 25:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(30);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_b),
+ 218, 22, MESSAGE_COLOR, time, 26, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_b1),
+ 218, 37, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 26:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(31);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_c),
+ 23, 22, MESSAGE_COLOR, time, 27, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 27:
+ time = 160;
+ kernel_message_purge();
+ global_speech_go(32);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_d),
+ 218, 28, MESSAGE_COLOR, time, 28, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_d1),
+ 218, 43, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 28:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(33);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_e),
+ 91, 21, MESSAGE_COLOR, time, 29, 0);
+ clear_all();
+ local->vine_2_action = TALK;
+ break;
+
+ case 29:
+ time = 160;
+ kernel_message_purge();
+ global_speech_go(34);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_f),
+ 206, 5, MESSAGE_COLOR, time, 30, 0);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_f1),
+ 206, 20, MESSAGE_COLOR, time, 0, 0);
+ clear_all();
+ local->vine_3_action = TALK;
+ break;
+
+ case 30:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(35);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_g),
+ 3, 24, MESSAGE_COLOR, time, 31, 0);
+ clear_all();
+ local->vine_1_action = TALK;
+ break;
+
+ case 31:
+ time = 100;
+ kernel_message_purge();
+ global_speech_go(36);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_h),
+ 200, 4, MESSAGE_COLOR, time, 32, 0);
+ clear_all();
+ local->vine_3_action = TALK;
+ break;
+
+ case 32:
+ time = 200;
+ kernel_message_purge();
+ global_speech_go(37);
+ kernel_message_add(quote_string(kernel.quotes, quote_vine_3_i),
+ 218, 33, MESSAGE_COLOR, time, 33, 0);
+ clear_all();
+ local->vine_4_action = TALK;
+ break;
+
+ case 33:
+ conv_release();
+ break;
+ }
+
+ if (kernel.trigger == ROOM_601_DOOR_OPENS) {
+ temp = seq[fx_door];
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_door], 2);
+ kernel_synch(KERNEL_SERIES, seq[fx_door], KERNEL_SERIES, temp);
+ }
+
+ if (kernel.trigger == ROOM_601_DOOR_CLOSES) {
+ if (global[player_persona] == PLAYER_IS_PID) {
+ kernel_load_variant(1);
+ }
+ sound_play(N_CreakyCastleDoor);
+ kernel_seq_delete(seq[fx_door]);
+ seq[fx_door] = kernel_seq_backward(ss[fx_door], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_door], 3);
+ kernel_seq_range(seq[fx_door], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_door], KERNEL_TRIGGER_EXPIRE, 0, ROOM_601_DOOR_CLOSES + 1);
+ }
+
+ if (kernel.trigger == ROOM_601_DOOR_CLOSES + 1) {
+ if (global[player_persona] == PLAYER_IS_PID) {
+ sound_play(N_CastleDoorMorphs);
+ seq[fx_morph] = kernel_seq_forward(ss[fx_morph], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_morph], 3);
+ kernel_seq_range(seq[fx_morph], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_morph], KERNEL_TRIGGER_EXPIRE, 0, ROOM_601_DOOR_CLOSES + 2);
+ kernel_synch(KERNEL_SERIES, seq[fx_morph], KERNEL_SERIES, seq[fx_door]);
+ } else {
+ temp = seq[fx_door];
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_door], 3);
+ kernel_synch(KERNEL_SERIES, seq[fx_door], KERNEL_SERIES, temp);
+ player.commands_allowed = true;
+ }
+ }
+
+ if (kernel.trigger == ROOM_601_DOOR_CLOSES + 2) {
+ temp = seq[fx_morph];
+ seq[fx_morph] = kernel_seq_stamp(ss[fx_morph], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_morph], 3);
+ kernel_synch(KERNEL_SERIES, seq[fx_morph], KERNEL_SERIES, temp);
+
+ kernel_flip_hotspot(words_tower_door, false);
+ player.commands_allowed = true;
+ }
+
+ if (kernel.trigger == MUSIC) {
+ if (global[vines_have_player]) {
+ sound_play(N_EerieSounds);
+ } else {
+ sound_play(N_BackgroundMus);
+ }
+ }
+}
+
+static void room_601_pre_parser() {
+ if (player_said_2(walk_to, tangle)) {
+ if (player.x <= 385) {
+ player_walk(WALK_VINE_LEFT_X, WALK_VINE_LEFT_Y, 5);
+ } else {
+ player_walk(WALK_VINE_RIGHT_X, WALK_VINE_RIGHT_Y, 5);
+ }
+ }
+
+ if (player_said_2(walk_to, rock) && global[player_persona] == PLAYER_IS_KING &&
+ (inter_point_x >= 386 && inter_point_x <= 422) &&
+ (inter_point_y >= 141 && inter_point_y <= 155)) {
+
+ if (player.x <= 385) {
+ player_walk(WALK_VINE_LEFT_X, WALK_VINE_LEFT_Y, 5);
+ } else {
+ player_walk(WALK_VINE_RIGHT_X, WALK_VINE_RIGHT_Y, 5);
+ }
+
+ } else if ((player_said_1(walk_to) || player_said_1(walk_down) || player_said_1(walk_through)) &&
+ global[player_persona] == PLAYER_IS_KING) {
+ if (player.x <= 385) {
+ if (inter_point_x >= 423) {
+ switch (kernel.trigger) {
+ case 0:
+ player_walk(WALK_VINE_LEFT_X, WALK_VINE_LEFT_Y, 5);
+ player_walk_trigger(1);
+ break;
+
+ case 1:
+ if (!player_said_1(tangle)) {
+ text_show(60114);
+ }
+ player_cancel_command();
+ break;
+ }
+ }
+
+ } else {
+ if (inter_point_x <= 422) {
+ switch (kernel.trigger) {
+ case 0:
+ player_walk(WALK_VINE_RIGHT_X, WALK_VINE_RIGHT_Y, 5);
+ player_walk_trigger(1);
+ break;
+
+ case 1:
+ if (!player_said_1(tangle)) {
+ text_show(60114);
+ }
+ player_cancel_command();
+ break;
+ }
+ }
+ }
+ }
+
+ if (player_said_2(walk_down, path_to_Hightower)) {
+ player.walk_off_edge_to_room = 508;
+ }
+
+ if (player_said_2(walk_through, tower_door) || player_said_2(open, tower_door) ||
+ player_said_2(pull, tower_door)) {
+ if (local->door_is_open) {
+ player_walk(PLAYER_X_FROM_603, PLAYER_Y_FROM_603, FACING_NORTH);
+ }
+ }
+}
+
+static void room_601_parser() {
+ int temp;
+
+ if (conv_control.running == CONV36_VINE) {
+ process_conv_vine();
+ player.command_ready = false;
+ return;
+ }
+
+ switch (kernel.trigger) {
+ case ROOM_601_DOOR_OPENS:
+ player_walk(PLAYER_X_FROM_603, PLAYER_Y_FROM_603, FACING_NORTH);
+ player_walk_trigger(ROOM_601_DOOR_OPENS + 1);
+ temp = seq[fx_door];
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_door], 3);
+ kernel_synch(KERNEL_SERIES, seq[fx_door], KERNEL_SERIES, temp);
+ player.command_ready = false;
+ return;
+
+ case ROOM_601_DOOR_OPENS + 1:
+ sound_play(N_CreakyCastleDoor);
+ kernel_seq_delete(seq[fx_door]);
+ seq[fx_door] = kernel_seq_backward(ss[fx_door], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_door], 2);
+ kernel_seq_range(seq[fx_door], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_door], KERNEL_TRIGGER_EXPIRE, 0, ROOM_601_DOOR_OPENS + 2);
+ player.command_ready = false;
+ return;
+
+ case ROOM_601_DOOR_OPENS + 2:
+ temp = seq[fx_door];
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_door], 1);
+ kernel_synch(KERNEL_SERIES, seq[fx_door], KERNEL_SERIES, temp);
+ new_room = 603;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, tower_door) || player_said_2(open, tower_door) ||
+ player_said_2(pull, tower_door)) {
+
+ if (global[vine_will_grab]) {
+ player.command_ready = false;
+ return;
+ }
+
+ if (local->door_is_open) {
+ kernel_timing_trigger(1, ROOM_601_DOOR_OPENS + 1);
+ } else {
+ sound_play(N_CreakyCastleDoor);
+ kernel_seq_delete(seq[fx_door]);
+ seq[fx_door] = kernel_seq_forward(ss[fx_door], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_door], 3);
+ kernel_seq_range(seq[fx_door], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_door], KERNEL_TRIGGER_EXPIRE, 0, ROOM_601_DOOR_OPENS);
+ }
+ player.commands_allowed = false;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_down, path_behind_tower)) {
+ camera_x.pan_mode = CAMERA_MANUAL;
+ if (inter_point_x < 300) {
+ player.commands_allowed = false;
+ local->panning = PANNING_RIGHT;
+ camera_pan_to(&camera_x, CAMERA_RIGHT);
+ } else {
+ player.commands_allowed = false;
+ local->panning = PANNING_LEFT;
+ camera_pan_to(&camera_x, CAMERA_LEFT);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player.look_around) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(60101);
+ } else {
+ text_show(60111);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(tower_door)) {
+ text_show(60102);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(tower)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(60104);
+ } else {
+ text_show(60111);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(path_behind_tower)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(60116);
+ } else {
+ text_show(60112);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(mountainside)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(60105);
+ } else {
+ text_show(60113);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(waterfall)) {
+ text_show(60106);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(path_to_Hightower)) {
+ text_show(60108);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(path_around_tower)) {
+ text_show(60109);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(tangle)) {
+ text_show(60114);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(talk_to, tower_door)) {
+ text_show(60103);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_3(fill, goblet, waterfall) ||
+ player_said_3(put, goblet, waterfall)) {
+ text_show(60117);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(put, waterfall)) {
+ text_show(60107);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(talk_to, tangle)) {
+ if (!global[vine_will_grab]) {
+ text_show(60110);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust)) {
+
+ if (player_said_1(tangle)) {
+ text_show(60115);
+ player.command_ready = false;
+ return;
+ }
+ }
}
void room_601_synchronize(Common::Serializer &s) {
-
+ for (int i = 0; i < 15; i++) s.syncAsSint16LE(local->sprite[i]);
+ for (int i = 0; i < 15; i++) s.syncAsSint16LE(local->sequence[i]);
+ for (int i = 0; i < 7; i++) s.syncAsSint16LE(local->animation[i]);
+ s.syncAsSint16LE(local->mount_left_base);
+ s.syncAsSint16LE(local->dyn_mount_left);
+ s.syncAsSint16LE(local->sky_mid_left_base);
+ s.syncAsSint16LE(local->dyn_sky_mid_left);
+ s.syncAsSint16LE(local->mount_right_base);
+ s.syncAsSint16LE(local->dyn_mount_right);
+ s.syncAsSint16LE(local->sky_mid_bot_right_base);
+ s.syncAsSint16LE(local->dyn_sky_mid_bot_right);
+ s.syncAsSint16LE(local->rock_base);
+ s.syncAsSint16LE(local->dyn_rock);
+ s.syncAsSint16LE(local->panning);
+ s.syncAsSint16LE(local->prevent);
+ s.syncAsSint16LE(local->prevent_1);
+ s.syncAsSint16LE(local->vine_talk);
+ s.syncAsSint32LE(local->update_clock);
+ s.syncAsSint16LE(local->king_0_frame);
+ s.syncAsSint16LE(local->anim_0_running);
+ s.syncAsSint16LE(local->king_1_frame);
+ s.syncAsSint16LE(local->king_1_action);
+ s.syncAsSint16LE(local->king_1_talk_count);
+ s.syncAsSint16LE(local->anim_1_running);
+ s.syncAsSint16LE(local->vine_1_frame);
+ s.syncAsSint16LE(local->vine_1_action);
+ s.syncAsSint16LE(local->vine_1_talk_count);
+ s.syncAsSint16LE(local->anim_2_running);
+ s.syncAsSint16LE(local->vine_2_frame);
+ s.syncAsSint16LE(local->vine_2_action);
+ s.syncAsSint16LE(local->vine_2_talk_count);
+ s.syncAsSint16LE(local->anim_3_running);
+ s.syncAsSint16LE(local->vine_3_frame);
+ s.syncAsSint16LE(local->vine_3_action);
+ s.syncAsSint16LE(local->vine_3_talk_count);
+ s.syncAsSint16LE(local->anim_4_running);
+ s.syncAsSint16LE(local->vine_4_frame);
+ s.syncAsSint16LE(local->vine_4_action);
+ s.syncAsSint16LE(local->vine_4_talk_count);
+ s.syncAsSint16LE(local->anim_5_running);
+ s.syncAsSint16LE(local->king_2_frame);
+ s.syncAsSint16LE(local->king_2_action);
+ s.syncAsSint16LE(local->king_2_talk_count);
+ s.syncAsSint16LE(local->anim_6_running);
+ s.syncAsSint16LE(local->door_is_open);
}
void room_601_preload() {
@@ -74,8 +1736,14 @@ void room_601_preload() {
room_parser_code_pointer = room_601_parser;
room_daemon_code_pointer = room_601_daemon;
+ if (global[player_persona] == PLAYER_IS_PID && room_id != 614) {
+ kernel_initial_variant = 1;
+ }
+
section_6_walker();
section_6_interface();
+
+ vocab_make_active(words_rat);
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room603.cpp b/engines/mads/madsv2/dragonsphere/rooms/room603.cpp
index c20ed7f99c1..dde78d4090e 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room603.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room603.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* 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
@@ -22,7 +22,9 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,33 +41,647 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+
+ int32 clock;
+ int32 blink_timer;
+ int32 blink_max;
+ int16 blinking;
+
+ int16 zapping;
+ int16 number_of_zaps;
+ int16 zap_x;
+ int16 zap_frame;
+ int16 prevent;
+ int16 distance_to_eye;
};
-#define local (&scratch)
+#define local ((Scratch *)(&game.scratch[0]))
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_fire_0 0
+#define fx_fire_1 1
+#define fx_fire_2 2
+#define fx_fire_3 3
+#define fx_fire_4 4
+#define fx_fire_5 5
+#define fx_fire_6 6
+#define fx_throw 7
+#define fx_blink 8
+#define fx_discharge 9
+#define fx_zap 10
+#define fx_death 11
+#define fx_mud 12
+
+#define ROOM_603_DONE_BLINKING 65
+#define ROOM_603_ZAP 70
+#define ROOM_603_WALK_TO_ZAP 80
+
+#define THROW_X 196
+#define THROW_Y 134
+
+#define PLAYER_X_FROM_604 260
+#define PLAYER_Y_FROM_604 100
+#define WALK_TO_X_FROM_604 223
+#define WALK_TO_Y_FROM_604 100
+
+#define PLAYER_X_FROM_606 37
+#define PLAYER_Y_FROM_606 106
+#define WALK_TO_X_FROM_606 75
+#define WALK_TO_Y_FROM_606 106
+
+#define PLAYER_X_FROM_601 176
+#define PLAYER_Y_FROM_601 148
+
+#define START_ZAP_X 218
+#define START_ZAP_Y 109
+
+#define FAR 0
+#define NEAR 1
+#define TOO_CLOSE 2
+
+#define ZAP_X 121
+#define ZAP_Y 128
+
+
+static void zap_player() {
+ int temp;
+
+ if (player.y <= ZAP_Y && !local->zapping) {
+ local->zapping = true;
+ player.commands_allowed = false;
+ local->number_of_zaps = ((START_ZAP_X - player.x) - 20) / 10;
+
+ if (player.x < ZAP_X) {
+ player_walk(ZAP_X, player.y, FACING_EAST);
+ player_walk_trigger(ROOM_603_WALK_TO_ZAP);
+ local->distance_to_eye = FAR;
+
+ } else {
+ if ((player.x >= 193) && (player.x < 205)) {
+ local->distance_to_eye = NEAR;
+ local->number_of_zaps = 1;
+
+ } else if (local->number_of_zaps <= 0) {
+ local->distance_to_eye = TOO_CLOSE;
+
+ } else {
+ local->distance_to_eye = FAR;
+ kernel_timing_trigger(1, ROOM_603_ZAP + 2);
+ }
+
+ player_cancel_walk();
+ sound_play(N_EyeZap);
+ seq[fx_discharge] = kernel_seq_forward(ss[fx_discharge], false, 4, 0, 0, 1);
+ kernel_seq_depth(seq[fx_discharge], 5);
+ kernel_seq_range(seq[fx_discharge], KERNEL_FIRST, KERNEL_LAST);
+
+ if (local->distance_to_eye == TOO_CLOSE ||
+ local->distance_to_eye == NEAR) {
+ kernel_seq_trigger(seq[fx_discharge], KERNEL_TRIGGER_SPRITE, 5, ROOM_603_ZAP);
+ kernel_seq_trigger(seq[fx_discharge], KERNEL_TRIGGER_SPRITE, 14, ROOM_603_ZAP + 4);
+ } else {
+ kernel_seq_trigger(seq[fx_discharge], KERNEL_TRIGGER_SPRITE, 14, ROOM_603_ZAP + 4);
+ }
+ }
+ }
+
+ if (kernel.trigger == ROOM_603_WALK_TO_ZAP) {
+ sound_play(N_EyeZap);
+ local->number_of_zaps = ((START_ZAP_X - player.x) - 20) / 10;
+ seq[fx_discharge] = kernel_seq_forward(ss[fx_discharge], false, 4, 0, 0, 1);
+ kernel_seq_depth(seq[fx_discharge], 5);
+ kernel_seq_range(seq[fx_discharge], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_discharge], KERNEL_TRIGGER_SPRITE, 14, ROOM_603_ZAP + 4);
+
+ player.walker_visible = false;
+ seq[fx_death] = kernel_seq_forward(ss[fx_death], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_death], 4);
+ kernel_seq_scale(seq[fx_death], 73);
+ kernel_seq_loc(seq[fx_death], player.x - 31, player.y + 5);
+ kernel_synch(KERNEL_SERIES, seq[fx_death], KERNEL_PLAYER, 0);
+ kernel_seq_range(seq[fx_death], 3, 5);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_EXPIRE, 0, ROOM_603_ZAP + 3);
+ }
-void room_603_init() {
+ if (kernel.trigger == ROOM_603_ZAP) {
+ player.walker_visible = false;
+ seq[fx_death] = kernel_seq_forward(ss[fx_death], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_death], 4);
+ kernel_seq_scale(seq[fx_death], 73);
+ kernel_seq_loc(seq[fx_death], player.x - 31, player.y + 5);
+ kernel_synch(KERNEL_SERIES, seq[fx_death], KERNEL_PLAYER, 0);
+ kernel_seq_range(seq[fx_death], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_EXPIRE, 0, ROOM_603_ZAP + 5);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_SPRITE, 35, ROOM_603_ZAP + 8);
+ }
+ if (kernel.trigger == ROOM_603_ZAP + 4) {
+
+ if (local->distance_to_eye == TOO_CLOSE) {
+ if (player.x <= 224) {
+ seq[fx_zap] = kernel_seq_forward(ss[fx_zap], false, 1, 0, 0, 1);
+ kernel_seq_range(seq[fx_zap], 4, 5);
+ kernel_seq_depth(seq[fx_zap], 4);
+ kernel_seq_loc(seq[fx_zap], START_ZAP_X + 20, START_ZAP_Y);
+ }
+
+ } else {
+ seq[fx_zap] = kernel_seq_stamp(ss[fx_zap], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_zap], 2);
+ kernel_seq_loc(seq[fx_zap], local->zap_x, START_ZAP_Y);
+ kernel_timing_trigger(1, ROOM_603_ZAP + 1);
+ }
+ }
+
+ if (kernel.trigger == ROOM_603_ZAP + 1) {
+ kernel_seq_delete(seq[fx_zap]);
+
+ local->zap_x += -10;
+ --local->number_of_zaps;
+ ++local->zap_frame;
+ if (local->zap_frame == 4) {
+ local->zap_frame = 1;
+ }
+
+ if (local->number_of_zaps >= 0) {
+ seq[fx_zap] = kernel_seq_stamp(ss[fx_zap], false, local->zap_frame);
+ kernel_seq_depth(seq[fx_zap], 2);
+ kernel_seq_loc(seq[fx_zap], local->zap_x, START_ZAP_Y);
+ kernel_timing_trigger(1, ROOM_603_ZAP + 1);
+
+ if (local->number_of_zaps == 0) {
+ if (local->distance_to_eye == FAR) {
+ kernel_seq_delete(seq[fx_death]);
+ seq[fx_death] = kernel_seq_forward(ss[fx_death], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_death], 4);
+ kernel_seq_range(seq[fx_death], 6, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_EXPIRE, 0, ROOM_603_ZAP + 5);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_SPRITE, 35, ROOM_603_ZAP + 8);
+ kernel_seq_scale(seq[fx_death], 73);
+ kernel_seq_loc(seq[fx_death], player.x - 31, player.y + 5);
+ }
+ }
+
+ } else {
+ seq[fx_zap] = kernel_seq_forward(ss[fx_zap], false, 1, 0, 0, 1);
+ kernel_seq_range(seq[fx_zap], 4, 5);
+ kernel_seq_depth(seq[fx_zap], 4);
+ kernel_seq_loc(seq[fx_zap], local->zap_x, START_ZAP_Y);
+ }
+ }
+
+ if (kernel.trigger == ROOM_603_ZAP + 8) {
+ sound_play(N_PlayerDies);
+ }
+
+ if (kernel.trigger == ROOM_603_ZAP + 2) {
+ player.walker_visible = false;
+ seq[fx_death] = kernel_seq_forward(ss[fx_death], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_death], 4);
+ kernel_seq_range(seq[fx_death], 1, 5);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_EXPIRE, 0, ROOM_603_ZAP + 3);
+ kernel_seq_scale(seq[fx_death], 73);
+ kernel_seq_loc(seq[fx_death], player.x - 31, player.y + 5);
+ kernel_synch(KERNEL_SERIES, seq[fx_death], KERNEL_PLAYER, 0);
+ }
+
+ if (kernel.trigger == ROOM_603_ZAP + 3) {
+ temp = seq[fx_death];
+ seq[fx_death] = kernel_seq_stamp(ss[fx_death], false, 5);
+ kernel_seq_depth(seq[fx_death], 4);
+ kernel_seq_scale(seq[fx_death], 73);
+ kernel_seq_loc(seq[fx_death], player.x - 31, player.y + 5);
+ kernel_synch(KERNEL_SERIES, seq[fx_death], KERNEL_SERIES, temp);
+ }
+
+ if (kernel.trigger == ROOM_603_ZAP + 5) {
+ temp = seq[fx_death];
+ seq[fx_death] = kernel_seq_backward(ss[fx_death], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_death], 4);
+ kernel_seq_range(seq[fx_death], 35, 39);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_EXPIRE, 0, ROOM_603_ZAP + 6);
+ kernel_seq_scale(seq[fx_death], 73);
+ kernel_seq_loc(seq[fx_death], player.x - 31, player.y + 5);
+ kernel_synch(KERNEL_SERIES, seq[fx_death], KERNEL_SERIES, temp);
+ }
+
+ if (kernel.trigger == ROOM_603_ZAP + 6) {
+ if (game.difficulty == EASY_MODE) {
+ text_show(60330);
+ } else {
+ text_show(45);
+ }
+ kernel.force_restart = true;
+ }
}
-void room_603_daemon() {
+static void room_603_init() {
+ local->zap_x = START_ZAP_X;
+ local->zap_frame = 1;
+ local->zapping = false;
+ local->blinking = false;
+ local->blink_timer = 0;
+ local->clock = 0;
+ local->blink_max = imath_random(100, 1000);
+ local->prevent = false;
+ kernel.disable_fastwalk = true;
+
+ ss[fx_fire_0] = kernel_load_series(kernel_name('y', 0), false);
+ ss[fx_fire_1] = kernel_load_series(kernel_name('y', 1), false);
+ ss[fx_fire_2] = kernel_load_series(kernel_name('y', 2), false);
+ ss[fx_fire_3] = kernel_load_series(kernel_name('y', 3), false);
+ ss[fx_fire_4] = kernel_load_series(kernel_name('y', 4), false);
+ ss[fx_fire_5] = kernel_load_series(kernel_name('y', 5), false);
+ ss[fx_fire_6] = kernel_load_series(kernel_name('y', 6), false);
+
+ if (player_has(mud)) {
+ ss[fx_throw] = kernel_load_series("*KGTHW_8", false);
+ }
+
+ if (!global[mud_is_in_eye_603]) {
+ ss[fx_blink] = kernel_load_series(kernel_name('x', 0), false);
+ ss[fx_discharge] = kernel_load_series(kernel_name('x', 1), false);
+ ss[fx_zap] = kernel_load_series(kernel_name('x', 2), false);
+ ss[fx_death] = kernel_load_series(kernel_name('a', 0), false);
+ }
+
+ ss[fx_mud] = kernel_load_series(kernel_name('x', 3), false);
+
+ if (global[mud_is_in_eye_603]) {
+ seq[fx_mud] = kernel_seq_stamp(ss[fx_mud], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_mud], 3);
+ }
+
+ seq[fx_fire_0] = kernel_seq_forward(ss[fx_fire_0], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_0], 1);
+ kernel_seq_range(seq[fx_fire_0], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_1] = kernel_seq_forward(ss[fx_fire_1], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_1], 1);
+ kernel_seq_range(seq[fx_fire_1], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_2] = kernel_seq_forward(ss[fx_fire_2], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_2], 1);
+ kernel_seq_range(seq[fx_fire_2], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_3] = kernel_seq_forward(ss[fx_fire_3], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_3], 1);
+ kernel_seq_range(seq[fx_fire_3], KERNEL_FIRST, KERNEL_LAST);
+ seq[fx_fire_4] = kernel_seq_forward(ss[fx_fire_4], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_4], 1);
+ kernel_seq_range(seq[fx_fire_4], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_5] = kernel_seq_forward(ss[fx_fire_5], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_5], 1);
+ kernel_seq_range(seq[fx_fire_5], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_6] = kernel_seq_forward(ss[fx_fire_6], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_6], 1);
+ kernel_seq_range(seq[fx_fire_6], KERNEL_FIRST, KERNEL_LAST);
+
+ if (previous_room == 606) {
+ player_first_walk(PLAYER_X_FROM_606, PLAYER_Y_FROM_606, FACING_EAST,
+ WALK_TO_X_FROM_606, WALK_TO_Y_FROM_606, FACING_EAST, true);
+
+ } else if (previous_room == 604) {
+ player_first_walk(PLAYER_X_FROM_604, PLAYER_Y_FROM_604, FACING_WEST,
+ WALK_TO_X_FROM_604, WALK_TO_Y_FROM_604, FACING_WEST, true);
+
+ } else if (previous_room == 601 || previous_room != KERNEL_RESTORING_GAME) {
+ player.x = PLAYER_X_FROM_601;
+ player.y = PLAYER_Y_FROM_601;
+ player.facing = FACING_NORTH;
+ }
+
+ section_6_music();
}
-void room_603_pre_parser() {
+static void room_603_daemon() {
+ int32 dif;
+ if (!global[mud_is_in_eye_603] && !local->blinking) {
+ dif = kernel.clock - local->clock;
+ if ((dif >= 0) && (dif <= 4)) {
+ local->blink_timer += dif;
+ } else {
+ local->blink_timer += 1;
+ }
+ local->clock = kernel.clock;
+
+ if (local->blink_timer >= local->blink_max) {
+ local->blinking = true;
+ seq[fx_blink] = kernel_seq_pingpong(ss[fx_blink], false, 6, 0, 0, 2);
+ kernel_seq_depth(seq[fx_blink], 5);
+ kernel_seq_range(seq[fx_blink], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_blink],
+ KERNEL_TRIGGER_EXPIRE, 0, ROOM_603_DONE_BLINKING);
+ }
+ }
+
+ if (kernel.trigger == ROOM_603_DONE_BLINKING) {
+ local->blinking = false;
+ local->blink_timer = 0;
+ local->blink_max = imath_random(300, 1000);
+ }
+
+ if (!global[mud_is_in_eye_603]) {
+ zap_player();
+ }
+
+ if (player.x < ZAP_X && !global[mud_is_in_eye_603]) {
+ if (player.walking) {
+ if (player.next_special_code > 0) {
+ player_cancel_command();
+ player_start_walking(ZAP_X, ZAP_Y, FACING_EAST);
+ player_walk_trigger(ROOM_603_WALK_TO_ZAP);
+ player.next_special_code = 0;
+ }
+ }
+ }
}
-void room_603_parser() {
+static void room_603_pre_parser() {
+ if (player_said_3(throw, mud, eye) && player_has(mud)) {
+ player_walk(THROW_X, THROW_Y, FACING_EAST);
+ }
+
+ if (player_said_1(doorway_to_east) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+
+ if (player_said_1(doorway_to_west) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+}
+
+static void room_603_parser() {
+ int temp;
+
+ if (local->zapping) {
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, doorway_to_east)) {
+ new_room = 604;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, doorway_to_west)) {
+ new_room = 606;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, tower_door) || player_said_2(open, tower_door) ||
+ player_said_2(pull, tower_door)) {
+ new_room = 601;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_3(throw, mud, eye)) {
+ switch (kernel.trigger) {
+ case 0:
+ global[player_score] += 2;
+ player_demand_facing(FACING_NORTH);
+ global[mud_is_in_eye_603] = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_throw] = kernel_seq_forward(ss[fx_throw], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_throw], 1);
+ kernel_seq_range(seq[fx_throw], 4, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_throw], KERNEL_TRIGGER_SPRITE, 12, 2);
+ kernel_seq_trigger(seq[fx_throw], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_seq_scale(seq[fx_throw], 73);
+ kernel_seq_loc(seq[fx_throw], player.x + 1, player.y + 6);
+ kernel_synch(KERNEL_SERIES, seq[fx_throw], KERNEL_PLAYER, 0);
+ break;
+
+ case 1:
+ player.walker_visible = true;
+ player_demand_location(player.x + 1, player.y - 2);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_throw]);
+ break;
+
+ case 2:
+ inter_move_object(mud, NOWHERE);
+ seq[fx_mud] = kernel_seq_forward(ss[fx_mud], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_mud], 3);
+ kernel_seq_range(seq[fx_mud], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_mud], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ kernel_seq_trigger(seq[fx_mud], KERNEL_TRIGGER_SPRITE, 6, 4);
+ break;
+
+ case 3:
+ temp = seq[fx_mud];
+ seq[fx_mud] = kernel_seq_stamp(ss[fx_mud], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_mud], 2);
+ kernel_synch(KERNEL_SERIES, seq[fx_mud], KERNEL_SERIES, temp);
+ player.commands_allowed = true;
+ text_show(60316);
+ break;
+
+ case 4:
+ sound_play(N_MudInTheEye);
+ break;
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player.look_around) {
+ text_show(60301);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(skull)) {
+ text_show(60302);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(doorway_to_east)) {
+ if (player_has_been_in_room(604)) {
+ text_show(60304);
+ } else {
+ text_show(60303);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(doorway_to_west)) {
+ if (player_has_been_in_room(606)) {
+ text_show(60306);
+ } else {
+ text_show(60305);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(eye)) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60322);
+ } else {
+ if (game.difficulty == HARD_MODE) {
+ text_show(60308);
+ } else {
+ text_show(60307);
+ }
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(statue)) {
+ if (player.main_object_source == STROKE_INTERFACE) {
+ text_show(60309);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_1(pillar)) {
+ text_show(60310);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(tower_door)) {
+ text_show(60311);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(floor)) {
+ text_show(60312);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_3(sword, attack, eye) ||
+ player_said_3(sword, carve_up, eye)) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60323);
+ } else {
+ text_show(60313);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_3(sword, thrust, eye)) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60323);
+ } else {
+ text_show(60314);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(throw, eye)) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60323);
+ } else if (player_said_1(shieldstone)) {
+ text_show(60320);
+ } else {
+ text_show(60315);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(put, eye)) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60323);
+ } else {
+ text_show(60321);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if ((player_said_1(take) || player_said_1(pull)) &&
+ (player_said_1(skull) || player_said_1(pillar))) {
+ text_show(60317);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(push, statue)) {
+ text_show(60318);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(eye) && (player_said_1(take) || player_said_1(pull))) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60323);
+ } else {
+ text_show(60319);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(close, eye)) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60327);
+ } else {
+ text_show(60324);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(open, eye)) {
+ if (global[mud_is_in_eye_603]) {
+ text_show(60323);
+ } else {
+ text_show(60325);
+ }
+ player.command_ready = false;
+ return;
+ }
+ if (player_said_2(talk_to, eye)) {
+ text_show(60328);
+ player.command_ready = false;
+ return;
+ }
}
void room_603_synchronize(Common::Serializer &s) {
-
+ for (int i = 0; i < 15; i++) s.syncAsSint16LE(local->sprite[i]);
+ for (int i = 0; i < 15; i++) s.syncAsSint16LE(local->sequence[i]);
+ for (int i = 0; i < 4; i++) s.syncAsSint16LE(local->animation[i]);
+ s.syncAsSint32LE(local->clock);
+ s.syncAsSint32LE(local->blink_timer);
+ s.syncAsSint32LE(local->blink_max);
+ s.syncAsSint16LE(local->blinking);
+ s.syncAsSint16LE(local->zapping);
+ s.syncAsSint16LE(local->number_of_zaps);
+ s.syncAsSint16LE(local->zap_x);
+ s.syncAsSint16LE(local->zap_frame);
+ s.syncAsSint16LE(local->prevent);
+ s.syncAsSint16LE(local->distance_to_eye);
}
void room_603_preload() {
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room604.cpp b/engines/mads/madsv2/dragonsphere/rooms/room604.cpp
index 3c97e7657e6..d90e0e9f115 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room604.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room604.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* 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
@@ -22,7 +22,10 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,33 +42,350 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+ int16 prevent;
};
-#define local (&scratch)
+#define local ((Scratch *)(&game.scratch[0]))
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_box 0
+#define fx_stone 1
+#define fx_take 2
+#define fx_fire 3
-void room_604_init() {
+#define ROOM_604_DOOR_CLOSES 60
-}
+#define PLAYER_X_FROM_605 315
+#define PLAYER_Y_FROM_605 111
+#define WALK_TO_X_FROM_605 282
+#define WALK_TO_Y_FROM_605 112
+
+#define PLAYER_X_FROM_603 -15
+#define PLAYER_Y_FROM_603 107
+#define WALK_TO_X_FROM_603 15
+#define WALK_TO_Y_FROM_603 107
+
+
+static void room_604_init() {
+ local->prevent = false;
+
+ ss[fx_fire] = kernel_load_series(kernel_name('y', 0), false);
+ seq[fx_fire] = kernel_seq_forward(ss[fx_fire], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire], 12);
+ kernel_seq_range(seq[fx_fire], KERNEL_FIRST, KERNEL_LAST);
+
+ if (object_is_here(magic_music_box) || object_is_here(power_vacuum_stone)) {
+ ss[fx_take] = kernel_load_series("*KGDRM_9", false);
+ }
+
+ if (object_is_here(magic_music_box)) {
+ ss[fx_box] = kernel_load_series(kernel_name('p', 0), false);
+ seq[fx_box] = kernel_seq_stamp(ss[fx_box], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_box], 4);
+ } else {
+ kernel_flip_hotspot(words_music_box, false);
+ }
+
+ if (object_is_here(power_vacuum_stone)) {
+ ss[fx_stone] = kernel_load_series(kernel_name('p', 1), false);
+ seq[fx_stone] = kernel_seq_stamp(ss[fx_stone], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_stone], 14);
+ } else {
+ kernel_flip_hotspot(words_vortex_stone, false);
+ }
+
+ if (previous_room == 603) {
+ player_first_walk(PLAYER_X_FROM_603, PLAYER_Y_FROM_603, FACING_EAST,
+ WALK_TO_X_FROM_603, WALK_TO_Y_FROM_603, FACING_EAST, true);
+
+ } else if (previous_room == 605 || previous_room != KERNEL_RESTORING_GAME) {
+ player_first_walk(PLAYER_X_FROM_605, PLAYER_Y_FROM_605, FACING_WEST,
+ WALK_TO_X_FROM_605, WALK_TO_Y_FROM_605, FACING_WEST, true);
+ }
-void room_604_daemon() {
+ section_6_music();
+}
+static void room_604_daemon() {
}
-void room_604_pre_parser() {
+static void room_604_pre_parser() {
+ if (player_said_2(walk_through, door_to_eye_chamber) || player_said_2(open, door_to_eye_chamber) ||
+ player_said_2(pull, door_to_eye_chamber)) {
+ player.walk_off_edge_to_room = 603;
+ }
+ if (player_said_1(doorway_to_east) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
}
-void room_604_parser() {
+static void room_604_parser() {
+ if (player_said_2(walk_through, doorway_to_east)) {
+ new_room = 605;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(take, music_box)) {
+ switch (kernel.trigger) {
+ case 0:
+ if (!player_has(magic_music_box)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 6, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 2);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take], true);
+ kernel_seq_loc(seq[fx_take], player.x - 3, player.y + 6);
+ player.command_ready = false;
+ return;
+ }
+ break;
+
+ case 1:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_box]);
+ kernel_flip_hotspot(words_music_box, false);
+ global[player_score] += 5;
+ inter_give_to_player(magic_music_box);
+ sound_play(N_TakeObjectSnd);
+ sound_play(N_MusicBoxOn);
+ object_examine(magic_music_box, 60420, 0);
+ sound_play(N_MusicBoxOff);
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(take, vortex_stone)) {
+ switch (kernel.trigger) {
+ case 0:
+ if (!player_has(power_vacuum_stone)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 6, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 2);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take], true);
+ kernel_seq_loc(seq[fx_take], player.x - 3, player.y + 5);
+ player.command_ready = false;
+ return;
+ }
+ break;
+
+ case 1:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_stone]);
+ kernel_flip_hotspot(words_vortex_stone, false);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(power_vacuum_stone);
+ object_examine(power_vacuum_stone, 60405, 0);
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player.look_around) {
+ text_show(60401);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(magic_tomes)) {
+ text_show(60402);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(dresser)) {
+ if (object_is_here(power_vacuum_stone)) {
+ text_show(60403);
+ } else {
+ text_show(60429);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(stone_sphere)) {
+ text_show(60415);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(doorway_to_east)) {
+ text_show(60406);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(magic_paraphernalia)) {
+ text_show(60407);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(scroll)) {
+ text_show(60408);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(shadow_of_window)) {
+ text_show(60411);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(hourglass)) {
+ text_show(60412);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(witch_paraphernalia)) {
+ text_show(60409);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(door_to_eye_chamber)) {
+ text_show(60413);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(book_of_magic)) {
+ text_show(60414);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(shelves)) {
+ text_show(60416);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(pedestal)) {
+ if (object_is_here(magic_music_box)) {
+ text_show(60417);
+ } else {
+ text_show(60418);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(closet)) {
+ text_show(60421);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(music_box) && object_is_here(magic_music_box)) {
+ text_show(60419);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(vortex_stone) && object_is_here(power_vacuum_stone)) {
+ text_show(60404);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(wall)) {
+ text_show(60422);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_1(take)) {
+ if (!player_said_1(music_box) && !player_said_1(vortex_stone)) {
+ text_show(60423);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(open, book_of_magic)) {
+ text_show(60424);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(open, dresser)) {
+ text_show(60424);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(push, pedestal)) {
+ text_show(60425);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(put, pedestal)) {
+ if (player_said_1(red_powerstone) ||
+ player_said_1(yellow_powerstone) ||
+ player_said_1(blue_powerstone)) {
+ text_show(60427);
+ } else {
+ text_show(60426);
+ }
+ player.command_ready = false;
+ return;
+ }
+ if (player_said_2(put, torch)) {
+ text_show(60428);
+ player.command_ready = false;
+ return;
+ }
}
void room_604_synchronize(Common::Serializer &s) {
-
+ for (int i = 0; i < 15; i++) s.syncAsSint16LE(local->sprite[i]);
+ for (int i = 0; i < 15; i++) s.syncAsSint16LE(local->sequence[i]);
+ for (int i = 0; i < 4; i++) s.syncAsSint16LE(local->animation[i]);
+ s.syncAsSint16LE(local->prevent);
}
void room_604_preload() {
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room605.cpp b/engines/mads/madsv2/dragonsphere/rooms/room605.cpp
index 379765a6f3e..ebcdca10437 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room605.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room605.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* 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
@@ -22,7 +22,11 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
+#include "mads/madsv2/core/pal.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,33 +43,1551 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[23];
+ int16 sequence[23];
+ int16 animation[4];
+
+ int16 rope_frame;
+ int16 rope_action;
+ int16 rope_talk_count;
+ int16 anim_0_running;
+
+ int16 rat_frame;
+ int16 anim_1_running;
+
+ int16 pid_frame;
+ int16 pid_action;
+ int16 pid_talk_count;
+ int16 anim_2_running;
+
+ int16 rat_cage_frame;
+ int16 rat_cage_talk_count;
+ int16 anim_3_running;
+
+ int16 rope_id;
+ int16 prevent;
+ int16 prevent_2;
};
-#define local (&scratch)
+#define local ((Scratch *)(&game.scratch[0]))
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_fire_l 0
+#define fx_fire_r 1
+#define fx_flask_l 2
+#define fx_flask_r 3
+#define fx_rope 4
+#define fx_take 5
+#define fx_dead_rat 6
+#define fx_lid_open 7
+#define fx_lid_closed 8
+#define fx_take_rat 9
+#define fx_flask_empty 10
+#define fx_flask_full 11
+#define fx_flask_end 12
+#define fx_take_flask 13
+#define fx_turn_petcock 14
+#define fx_fluid_left 15
+#define fx_fluid_right 16
+#define fx_drip 17
+#define fx_end_flow_left 18
+#define fx_end_flow_right 19
+#define fx_object_in_freezer 20
+#define fx_reach_into_freezer 21
+
+#define ROOM_605_FLUID_LEFT 60
+#define ROOM_605_FLUID_RIGHT 62
+#define ROOM_605_CLOSE_PETCOCKS 65
+#define ROOM_605_PUT_IN_FREEZER 75
+#define ROOM_605_TAKE_CONTENTS 80
+#define ROOM_605_DRIP_SOUND 85
+#define ROOM_605_RUN_ANIM 95
+#define ROOM_605_NEW_ROOM 98
+
+#define PLAYER_X_FROM_604 -15
+#define PLAYER_Y_FROM_604 138
+#define WALK_TO_X_FROM_604 16
+#define WALK_TO_Y_FROM_604 138
+
+#define ROPE_FREEZE 0
+#define ROPE_STRIKE 1
+#define ROPE_ZAP 2
+
+#define PID_FREEZE 0
+#define PID_ZAP 1
+#define PID_LEAVE 2
+
+#define ROPE_X 39
+#define ROPE_Y 130
+
+#define FLASK_END_X 86
+#define FLASK_END_Y 100
+
+#define FLASK_EMPTY_X 123
+#define FLASK_EMPTY_Y 100
+
+#define TAKE_STUFF_X 239
+#define TAKE_STUFF_Y 129
+
+#define OBJECTS_MAX 47
+
+static void handle_animation_rope() {
+ int rope_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->rope_frame) {
+ local->rope_frame = kernel_anim[aa[0]].frame;
+ rope_reset_frame = -1;
+
+ switch (local->rope_frame) {
+ case 17:
+ player.commands_allowed = true;
+ break;
+
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ switch (local->rope_action) {
+ case ROPE_FREEZE:
+ rope_reset_frame = imath_random(18, 20);
+ break;
+
+ case ROPE_STRIKE:
+ player.walker_visible = false;
+ rope_reset_frame = 21;
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_PLAYER, 0);
+ break;
+
+ case ROPE_ZAP:
+ player.walker_visible = false;
+ rope_reset_frame = 52;
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_PLAYER, 0);
+ break;
+ }
+ break;
+
+ case 52:
+ if (game.difficulty == EASY_MODE) {
+ text_show(60581);
+ } else {
+ text_show(45);
+ }
+ kernel.force_restart = true;
+ break;
+
+ case 97:
+ rope_reset_frame = 96;
+ break;
+ }
+
+ if (rope_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], rope_reset_frame);
+ local->rope_frame = rope_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_rat() {
+ int rat_reset_frame;
+
+ if (kernel_anim[aa[1]].frame != local->rat_frame) {
+ local->rat_frame = kernel_anim[aa[1]].frame;
+ rat_reset_frame = -1;
+
+ switch (local->rat_frame) {
-void room_605_init() {
+ case 1:
+ kernel_seq_delete(seq[fx_lid_closed]);
+ break;
+ case 28:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[1]);
+ break;
+
+ case 50:
+ local->anim_1_running = false;
+ rat_reset_frame = -1;
+ seq[fx_lid_open] = kernel_seq_stamp(ss[fx_lid_open], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_lid_open], 2);
+ text_show(60569);
+ kernel_flip_hotspot(words_dead_rat, true);
+ break;
+ }
+
+ if (rat_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], rat_reset_frame);
+ local->rat_frame = rat_reset_frame;
+ }
+ }
}
-void room_605_daemon() {
+static void handle_animation_pid() {
+ int pid_reset_frame;
+ int tmp;
+
+ if (kernel_anim[aa[2]].frame != local->pid_frame) {
+ local->pid_frame = kernel_anim[aa[2]].frame;
+ pid_reset_frame = -1;
+
+ switch (local->pid_frame) {
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ switch (local->pid_action) {
+ case PID_FREEZE:
+ ++local->pid_talk_count;
+ if (local->pid_talk_count > 10) {
+ tmp = imath_random(1, 3);
+ local->pid_talk_count = 0;
+
+ if (tmp == 1) {
+ pid_reset_frame = local->pid_frame - 2;
+ } else if (tmp == 2) {
+ pid_reset_frame = local->pid_frame - 1;
+ }
+
+ if ((local->pid_frame == 5) && (tmp == 1)) {
+ pid_reset_frame = 4;
+ }
+
+ if ((local->pid_frame == 10) && (tmp == 3)) {
+ pid_reset_frame = 9;
+ }
+
+ } else {
+ pid_reset_frame = local->pid_frame - 1;
+ }
+ break;
+
+ case PID_ZAP:
+ pid_reset_frame = 10;
+ break;
+
+ case PID_LEAVE:
+ pid_reset_frame = 42;
+ break;
+ }
+ break;
+
+ case 17:
+ kernel_reset_animation(aa[0], 96);
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_ANIM, aa[2]);
+ break;
+
+ case 42:
+ case 48:
+ kernel_abort_animation(aa[2]);
+ local->anim_2_running = false;
+ pid_reset_frame = -1;
+
+ if (player_said_2(take_magic_from, rope)) {
+ player.walker_visible = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ sound_play(N_Bk605Music);
+ kernel_abort_animation(aa[0]);
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ global[rope_is_alive] = false;
+ local->anim_0_running = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ kernel_flip_hotspot(words_rope, true);
+ global[player_score] += 2;
+
+ } else if (player_said_2(walk_through, door_to_magic_room) || player_said_2(open, door_to_magic_room) ||
+ player_said_2(pull, door_to_magic_room)) {
+ player.walker_visible = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ player_first_walk(player.x, player.y, FACING_EAST,
+ PLAYER_X_FROM_604, PLAYER_Y_FROM_604, FACING_WEST, false);
+ player_walk_trigger(ROOM_605_NEW_ROOM);
+
+ } else {
+ kernel_reset_animation(aa[0], 22);
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_NOW, 0);
+ }
+ break;
+ }
+
+ if (pid_reset_frame >= 0) {
+ kernel_reset_animation(aa[2], pid_reset_frame);
+ local->pid_frame = pid_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_rat_cage() {
+ int rat_cage_reset_frame;
+
+ if (kernel_anim[aa[3]].frame != local->rat_cage_frame) {
+ local->rat_cage_frame = kernel_anim[aa[3]].frame;
+ rat_cage_reset_frame = -1;
+
+ switch (local->rat_cage_frame) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ ++local->rat_cage_talk_count;
+ if (local->rat_cage_talk_count > imath_random(2, 5)) {
+ rat_cage_reset_frame = imath_random(0, 3);
+ local->rat_cage_talk_count = 0;
+ } else {
+ rat_cage_reset_frame = local->rat_cage_frame - 1;
+ }
+ break;
+ }
+
+ if (rat_cage_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], rat_cage_reset_frame);
+ local->rat_cage_frame = rat_cage_reset_frame;
+ }
+ }
+}
+
+static void room_605_init() {
+ int count;
+ int shit_here = false;
+
+ kernel_flip_hotspot(words_flask, false);
+ kernel_flip_hotspot(words_flask_full_of_acid, false);
+
+ local->prevent = false;
+ local->prevent_2 = false;
+ local->pid_talk_count = 0;
+
+ if (kernel.teleported_in) {
+ inter_give_to_player(power_vacuum_stone);
+ }
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ local->anim_2_running = false;
+ local->anim_3_running = false;
+ }
+ ss[fx_flask_l] = kernel_load_series(kernel_name('x', 0), false);
+ ss[fx_flask_r] = kernel_load_series(kernel_name('x', 1), false);
+ ss[fx_fire_l] = kernel_load_series(kernel_name('x', 4), false);
+ ss[fx_fire_r] = kernel_load_series(kernel_name('x', 5), false);
+
+ ss[fx_flask_empty] = kernel_load_series(kernel_name('y', 3), false);
+ ss[fx_flask_full] = kernel_load_series(kernel_name('y', 4), false);
+
+ ss[fx_turn_petcock] = kernel_load_series(kernel_name('a', 1), false);
+ ss[fx_fluid_left] = kernel_load_series(kernel_name('x', 2), false);
+ ss[fx_fluid_right] = kernel_load_series(kernel_name('x', 3), false);
+ ss[fx_drip] = kernel_load_series(kernel_name('x', 6), false);
+
+ ss[fx_end_flow_right] = kernel_load_series(kernel_name('y', 6), false);
+ ss[fx_end_flow_left] = kernel_load_series(kernel_name('y', 7), false);
+
+ ss[fx_object_in_freezer] = kernel_load_series(kernel_name('y', 5), false);
+ ss[fx_reach_into_freezer] = kernel_load_series(kernel_name('a', 0), false);
+
+ for (count = 10; count < 33; count++) {
+ flag_used[count] = false;
+ }
+
+ if (global[object_is_in_freezer_605] == HAS_USED_FREEZER) {
+ seq[fx_object_in_freezer] = kernel_seq_stamp(ss[fx_object_in_freezer], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_object_in_freezer], 14);
+ }
+
+ if (object_is_here(flask)) {
+ ss[fx_flask_end] = kernel_load_series(kernel_name('p', 9), false);
+ seq[fx_flask_end] = kernel_seq_stamp(ss[fx_flask_end], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_flask_end], 5);
+ kernel_flip_hotspot_loc(words_flask, true, FLASK_END_X, FLASK_END_Y);
+ }
+
+ if (global[flask_on_plate] == YES_EMPTY) {
+ kernel_flip_hotspot_loc(words_flask, true, FLASK_EMPTY_X, FLASK_EMPTY_Y);
+ seq[fx_flask_empty] = kernel_seq_stamp(ss[fx_flask_empty], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_flask_empty], 5);
+
+ } else if (global[flask_on_plate] == YES_ACID) {
+ kernel_flip_hotspot(words_flask_full_of_acid, true);
+ seq[fx_flask_full] = kernel_seq_stamp(ss[fx_flask_full], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_flask_full], 5);
+ }
+
+ ss[fx_lid_open] = kernel_load_series(kernel_name('y', 0), false);
+
+ if (global[rat_cage_is_open]) {
+ seq[fx_lid_open] = kernel_seq_stamp(ss[fx_lid_open], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_lid_open], 2);
+ } else {
+ ss[fx_lid_closed] = kernel_load_series(kernel_name('y', 2), false);
+ seq[fx_lid_closed] = kernel_seq_stamp(ss[fx_lid_closed], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_lid_closed], 5);
+ }
+
+ if (object_is_here(dead_rat)) {
+ ss[fx_take_rat] = kernel_load_series(kernel_name('a', 5), false);
+ ss[fx_dead_rat] = kernel_load_series(kernel_name('y', 1), false);
+ seq[fx_dead_rat] = kernel_seq_stamp(ss[fx_dead_rat], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_dead_rat], 2);
+ } else {
+ kernel_flip_hotspot(words_dead_rat, false);
+ }
+
+ if (!global[rat_cage_is_open]) {
+ kernel_flip_hotspot(words_dead_rat, false);
+ }
+
+ ss[fx_take_flask] = kernel_load_series("*KGDRM_9", false);
+ ss[fx_rope] = kernel_load_series(kernel_name('x', 9), false);
+
+ if (global[fluid_is_dripping]) {
+ seq[fx_fluid_left] = kernel_seq_pingpong(ss[fx_fluid_left], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fluid_left], 5);
+ kernel_seq_range(seq[fx_fluid_left], 16, KERNEL_LAST);
+
+ seq[fx_fluid_right] = kernel_seq_pingpong(ss[fx_fluid_right], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fluid_right], 5);
+ kernel_seq_range(seq[fx_fluid_right], 16, KERNEL_LAST);
+ }
+
+ if (!global[rat_cage_is_open]) {
+ aa[3] = kernel_run_animation(kernel_name('r', 3), 0);
+ local->anim_3_running = true;
+ }
+
+ if (global[rope_is_alive]) {
+ aa[0] = kernel_run_animation(kernel_name('r', 1), 0);
+ local->anim_0_running = true;
+ local->rope_action = ROPE_FREEZE;
+ player.commands_allowed = false;
+ local->rope_id = kernel_add_dynamic(words_rope, words_walk_to, SYNTAX_SINGULAR, KERNEL_NONE,
+ 0, 0, 0, 0);
+ kernel_dynamic_hot[local->rope_id].prep = PREP_ON;
+ kernel_dynamic_anim(local->rope_id, aa[0], 0);
+ kernel_dynamic_anim(local->rope_id, aa[0], 1);
+
+ if (previous_room == KERNEL_RESTORING_GAME) {
+ aa[2] = kernel_run_animation(kernel_name('p', 1), 0);
+ local->anim_2_running = true;
+ local->pid_action = PID_FREEZE;
+ player.commands_allowed = true;
+ player.walker_visible = false;
+ kernel_reset_animation(aa[2], 5);
+ kernel_reset_animation(aa[0], 19);
+
+ } else {
+ player_first_walk(PLAYER_X_FROM_604, PLAYER_Y_FROM_604, FACING_EAST,
+ ROPE_X, ROPE_Y, FACING_EAST, false);
+ player_walk_trigger(ROOM_605_RUN_ANIM);
+ }
+
+ } else if (previous_room == 604 || previous_room != KERNEL_RESTORING_GAME) {
+ player_first_walk(PLAYER_X_FROM_604, PLAYER_Y_FROM_604, FACING_EAST,
+ WALK_TO_X_FROM_604, WALK_TO_Y_FROM_604, FACING_EAST, true);
+ }
+
+ if (object_is_here(rope)) {
+ seq[fx_rope] = kernel_seq_stamp(ss[fx_rope], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_rope], 14);
+
+ } else {
+ kernel_flip_hotspot(words_rope, false);
+ }
+
+ seq[fx_fire_l] = kernel_seq_forward(ss[fx_fire_l], false, 8, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_l], 5);
+ kernel_seq_range(seq[fx_fire_l], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_r] = kernel_seq_forward(ss[fx_fire_r], false, 8, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_r], 5);
+ kernel_seq_range(seq[fx_fire_r], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_flask_l] = kernel_seq_forward(ss[fx_flask_l], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_flask_l], 5);
+ kernel_seq_range(seq[fx_flask_l], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_flask_r] = kernel_seq_forward(ss[fx_flask_r], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_flask_r], 5);
+ kernel_seq_range(seq[fx_flask_r], KERNEL_FIRST, KERNEL_LAST);
+
+ for (count = 0; count < OBJECTS_MAX; count++) {
+ if (object[count].location == FREEZER) {
+ shit_here = true;
+ }
+ }
+
+ if (!shit_here) {
+ kernel_flip_hotspot(words_contents_of_freezer, false);
+ }
+
+ section_6_music();
}
-void room_605_pre_parser() {
+static void room_605_daemon() {
+ if (local->anim_0_running) {
+ handle_animation_rope();
+ }
+
+ if (local->anim_1_running) {
+ handle_animation_rat();
+ }
+
+ if (local->anim_2_running) {
+ handle_animation_pid();
+ }
+
+ if (local->anim_3_running) {
+ handle_animation_rat_cage();
+ }
+
+ if (global[fluid_is_dripping] && !local->prevent_2) {
+ seq[fx_drip] = kernel_seq_forward(ss[fx_drip], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_drip], 5);
+ kernel_seq_range(seq[fx_drip], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_drip], KERNEL_TRIGGER_SPRITE, 8, ROOM_605_DRIP_SOUND);
+ local->prevent_2 = true;
+ }
+ if (kernel.trigger == ROOM_605_DRIP_SOUND) {
+ sound_play(N_AcidDrips);
+ }
+
+ if (kernel.trigger == ROOM_605_NEW_ROOM) {
+ new_room = 604;
+ }
+
+ if (kernel.trigger == ROOM_605_RUN_ANIM) {
+ player.walker_visible = false;
+ aa[2] = kernel_run_animation(kernel_name('p', 1), 0);
+ local->anim_2_running = true;
+ local->pid_action = PID_FREEZE;
+ kernel_synch(KERNEL_ANIM, aa[2], KERNEL_PLAYER, 0);
+ }
}
-void room_605_parser() {
+static void room_605_pre_parser() {
+ int count;
+ int stuff_still_here = false;
+
+ if (player_said_1(door_to_magic_room) && player.need_to_walk) {
+ if (!player_said_1(walk_through) && !player_said_1(open) &&
+ !player_said_1(pull)) {
+ player.need_to_walk = false;
+ }
+ }
+
+ if (player_said_2(walk_through, door_to_magic_room) || player_said_2(open, door_to_magic_room) ||
+ player_said_2(pull, door_to_magic_room)) {
+ for (count = 0; count < OBJECTS_MAX; count++) {
+ if (object[count].location == FREEZER) {
+ stuff_still_here = true;
+ }
+ }
+
+ if (stuff_still_here) {
+ text_show(60579);
+ player_cancel_command();
+
+ } else {
+ player.walk_off_edge_to_room = 604;
+ }
+ }
+
+ if (player_said_2(take, contents_of_freezer)) {
+ player_walk(TAKE_STUFF_X, TAKE_STUFF_Y, FACING_NORTHEAST);
+ }
+ if (local->anim_2_running) {
+
+ if (player_said_2(take_magic_from, rope) && global[rope_is_alive]) {
+ local->pid_action = PID_ZAP;
+ player.commands_allowed = false;
+ player.need_to_walk = false;
+ player_cancel_command();
+
+ } else if (player.need_to_walk) {
+ if (player_said_1(wave) ||
+ player_said_3(give, torch, rope) ||
+ player_said_3(put, torch, rope) ||
+ player_said_3(throw, torch, rope)) {
+ text_show(60568);
+
+ } else {
+ local->pid_action = PID_LEAVE;
+ player.commands_allowed = false;
+ }
+ player.need_to_walk = false;
+ player_cancel_command();
+ }
+ }
}
+static void room_605_parser() {
+ int id;
+ int count;
+ int removed = 0;
+ int last_removed = 0;
+ int was_rat_removed;
+ int are_any_inorganic;
+ int are_any_organic;
+ int temp;
+ int stuff_still_here = false;
+
+ if (player_said_1(wave) ||
+ player_said_3(give, torch, rope) ||
+ player_said_3(put, torch, rope) ||
+ player_said_3(throw, torch, rope)) {
+ text_show(60568);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(invoke, signet_ring)) {
+ for (count = 0; count < OBJECTS_MAX; count++) {
+ if (object[count].location == FREEZER) {
+ stuff_still_here = true;
+ }
+ }
+
+ if (stuff_still_here) {
+ text_show(60579);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ switch (kernel.trigger) {
+ case ROOM_605_CLOSE_PETCOCKS:
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_turn_petcock] = kernel_seq_pingpong(ss[fx_turn_petcock], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_SPRITE, 6, ROOM_605_CLOSE_PETCOCKS + 2);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_EXPIRE, 0, ROOM_605_CLOSE_PETCOCKS + 3);
+ kernel_seq_player(seq[fx_turn_petcock], true);
+ kernel_seq_depth(seq[fx_turn_petcock], 1);
+ kernel_seq_range(seq[fx_turn_petcock], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_scale(seq[fx_turn_petcock], 100);
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_CLOSE_PETCOCKS + 1:
+ if (local->prevent) {
+ sound_play(N_TurnPetcock);
+ kernel_seq_delete(seq[fx_fluid_left]);
+ seq[fx_end_flow_left] = kernel_seq_forward(ss[fx_end_flow_left], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_end_flow_left], 5);
+ kernel_seq_range(seq[fx_end_flow_left], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_end_flow_left], KERNEL_TRIGGER_EXPIRE, 0, ROOM_605_CLOSE_PETCOCKS + 6);
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_CLOSE_PETCOCKS + 2:
+ if (local->prevent) {
+ sound_play(N_TurnPetcock);
+ if (global[fluid_is_dripping]) {
+ kernel_seq_delete(seq[fx_drip]);
+ global[fluid_is_dripping] = false;
+ local->prevent_2 = false;
+ }
+ kernel_seq_delete(seq[fx_fluid_right]);
+ seq[fx_end_flow_right] = kernel_seq_forward(ss[fx_end_flow_right], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_end_flow_right], 5);
+ kernel_seq_range(seq[fx_end_flow_right], KERNEL_FIRST, KERNEL_LAST);
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_CLOSE_PETCOCKS + 3:
+ kernel_timing_trigger(TENTH_SECOND, ROOM_605_CLOSE_PETCOCKS + 4);
+ player.walker_visible = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_turn_petcock]);
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_CLOSE_PETCOCKS + 4:
+ player.walker_visible = false;
+ seq[fx_turn_petcock] = kernel_seq_pingpong(ss[fx_turn_petcock], true, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_SPRITE, 6, ROOM_605_CLOSE_PETCOCKS + 1);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_EXPIRE, 0, ROOM_605_CLOSE_PETCOCKS + 5);
+ kernel_seq_player(seq[fx_turn_petcock], true);
+ kernel_seq_depth(seq[fx_turn_petcock], 1);
+ kernel_seq_range(seq[fx_turn_petcock], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_scale(seq[fx_turn_petcock], 100);
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_CLOSE_PETCOCKS + 5:
+ player.walker_visible = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_turn_petcock]);
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_CLOSE_PETCOCKS + 6:
+ text_show(60515);
+ player.commands_allowed = true;
+ player.command_ready = false;
+ return;
+ }
+
+ if (kernel.trigger == ROOM_605_FLUID_LEFT) {
+ temp = seq[fx_fluid_left];
+ seq[fx_fluid_left] = kernel_seq_pingpong(ss[fx_fluid_left], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fluid_left], 5);
+ kernel_seq_range(seq[fx_fluid_left], 16, KERNEL_LAST);
+ player.command_ready = false;
+ return;
+ }
+
+ if (kernel.trigger == ROOM_605_FLUID_RIGHT) {
+ temp = seq[fx_fluid_right];
+ seq[fx_fluid_right] = kernel_seq_pingpong(ss[fx_fluid_right], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fluid_right], 5);
+ kernel_seq_range(seq[fx_fluid_right], 16, KERNEL_LAST);
+
+ if (!global[flask_on_plate]) {
+ player.commands_allowed = true;
+ }
+
+ text_show(60514);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(open, rat_cage)) {
+ if (!global[rat_cage_is_open]) {
+ kernel_abort_animation(aa[3]);
+ local->anim_3_running = false;
+ aa[1] = kernel_run_animation(kernel_name('r', 2), 0);
+ local->anim_1_running = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ global[rat_cage_is_open] = true;
+ kernel_synch(KERNEL_ANIM, aa[1], KERNEL_PLAYER, 0);
+ kernel_synch(KERNEL_ANIM, aa[3], KERNEL_ANIM, aa[1]);
+
+ id = kernel_add_dynamic(words_rat, words_walk_to, SYNTAX_SINGULAR, KERNEL_NONE,
+ 0, 0, 0, 0);
+ kernel_dynamic_hot[id].prep = PREP_ON;
+ kernel_dynamic_anim(id, aa[1], 1);
+
+ } else {
+ text_show(60548);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(close, rat_cage)) {
+ if (global[rat_cage_is_open]) {
+ text_show(60577);
+ } else {
+ text_show(60548);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(take, rope)) {
+ switch (kernel.trigger) {
+ case 0:
+ if (!player_has(rope)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ ss[fx_take] = kernel_load_series("*KGDRD_7", false);
+ seq[fx_take] = kernel_seq_forward(ss[fx_take], false, 7, 0, 0, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 12, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 13, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_take], 2);
+ kernel_seq_player(seq[fx_take], true);
+ player.command_ready = false;
+ return;
+ }
+ break;
+
+ case 1:
+ kernel_seq_delete(seq[fx_rope]);
+ player.command_ready = false;
+ return;
+
+ case 2:
+ kernel_load_variant(0);
+ kernel_flip_hotspot(words_rope, false);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(rope);
+ object_examine(rope, 60505, 0);
+ player.command_ready = false;
+ return;
+
+ case 3:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ matte_deallocate_series(ss[fx_take], true);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(take, dead_rat)) {
+ switch (kernel.trigger) {
+ case 0:
+ if (!player_has(dead_rat)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take_rat] = kernel_seq_pingpong(ss[fx_take_rat], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take_rat], KERNEL_TRIGGER_SPRITE, 3, 2);
+ kernel_seq_trigger(seq[fx_take_rat], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ kernel_seq_depth(seq[fx_take_rat], 1);
+ kernel_seq_range(seq[fx_take_rat], KERNEL_FIRST, KERNEL_LAST);
+ player.command_ready = false;
+ return;
+ }
+ break;
+
+ case 2:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_dead_rat]);
+ kernel_flip_hotspot(words_dead_rat, false);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(dead_rat);
+ object_examine(dead_rat, 60507, 0);
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case 3:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take_rat]);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(take, flask) ||
+ player_said_2(take, flask_full_of_acid)) {
+ switch (kernel.trigger) {
+ case 0:
+ if ((!player_has(flask_full_of_acid)) || (!player_has(flask))) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take_flask] = kernel_seq_pingpong(ss[fx_take_flask], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take_flask], KERNEL_TRIGGER_SPRITE, 6, 2);
+ kernel_seq_trigger(seq[fx_take_flask], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ kernel_seq_depth(seq[fx_take_flask], 1);
+ kernel_seq_range(seq[fx_take_flask], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take_flask], true);
+ kernel_seq_loc(seq[fx_take_flask], player.x - 3, player.y + 7);
+ player.command_ready = false;
+ return;
+ }
+ break;
+
+ case 2:
+ if (local->prevent) {
+ if (inter_point_x < 92) {
+ kernel_seq_delete(seq[fx_flask_end]);
+ kernel_flip_hotspot_loc(words_flask, false, FLASK_END_X, FLASK_END_Y);
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(flask);
+ object_examine(flask, 60509, 0);
+
+ } else {
+ if (player_said_1(flask_full_of_acid)) {
+ kernel_seq_delete(seq[fx_flask_full]);
+ kernel_flip_hotspot(words_flask_full_of_acid, false);
+ inter_give_to_player(flask_full_of_acid);
+ sound_play(N_TakeObjectSnd);
+ object_examine(flask_full_of_acid, 60571, 0);
+
+ } else {
+ kernel_seq_delete(seq[fx_flask_empty]);
+ kernel_flip_hotspot(words_flask, false);
+ inter_give_to_player(flask);
+ }
+ }
+ }
+ global[flask_on_plate] = NONE;
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case 3:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take_flask]);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_3(put, teleport_door, freezer) ||
+ player_said_3(throw, teleport_door, freezer)) {
+ id = object_named(player_second_noun);
+ if (id == teleport_door) {
+ text_show(60582);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_3(put, flask, metal_plate)) {
+ switch (kernel.trigger) {
+ case 0:
+ if (player_has(flask)) {
+ if (global[fluid_is_dripping]) {
+ text_show(60511);
+ player.command_ready = false;
+ return;
+
+ } else {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take_flask] = kernel_seq_pingpong(ss[fx_take_flask], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take_flask], KERNEL_TRIGGER_SPRITE, 6, 2);
+ kernel_seq_trigger(seq[fx_take_flask], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ kernel_seq_depth(seq[fx_take_flask], 1);
+ kernel_seq_range(seq[fx_take_flask], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take_flask], true);
+ kernel_seq_loc(seq[fx_take_flask], player.x - 3, player.y + 7);
+ player.command_ready = false;
+ return;
+ }
+ }
+ break;
+
+ case 2:
+ if (local->prevent) {
+ seq[fx_flask_empty] = kernel_seq_stamp(ss[fx_flask_empty], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_flask_empty], 5);
+ kernel_flip_hotspot(words_flask, false);
+ kernel_flip_hotspot_loc(words_flask, true, FLASK_EMPTY_X, FLASK_EMPTY_Y);
+ inter_move_object(flask, NOWHERE);
+ global[flask_on_plate] = YES_EMPTY;
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case 3:
+ text_show(60510);
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take_flask]);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(close, petcock)) {
+ if (global[fluid_is_dripping]) {
+ kernel_timing_trigger(1, ROOM_605_CLOSE_PETCOCKS);
+ } else {
+ text_show(60574);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(turn, petcock) || player_said_2(open, petcock)) {
+ if (player_said_2(turn, petcock) && global[fluid_is_dripping] && !kernel.trigger) {
+ kernel_timing_trigger(1, ROOM_605_CLOSE_PETCOCKS);
+ player.command_ready = false;
+ return;
+
+ } else if (player_said_1(open) && global[fluid_is_dripping] && !kernel.trigger) {
+ text_show(60575);
+ player.command_ready = false;
+ return;
+
+ } else if (global[flask_on_plate] == YES_ACID && !kernel.trigger) {
+ text_show(60578);
+ player.command_ready = false;
+ return;
+
+ } else {
+ switch (kernel.trigger) {
+ case 0:
+ if (global[flask_on_plate] == NONE) {
+ global[fluid_is_dripping] = true;
+ }
+
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ if (inter_point_x < 116) {
+ seq[fx_turn_petcock] = kernel_seq_pingpong(ss[fx_turn_petcock], true, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_SPRITE, 6, 1);
+ } else {
+ seq[fx_turn_petcock] = kernel_seq_pingpong(ss[fx_turn_petcock], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_SPRITE, 6, 2);
+ }
+ kernel_seq_player(seq[fx_turn_petcock], true);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ kernel_seq_depth(seq[fx_turn_petcock], 1);
+ kernel_seq_range(seq[fx_turn_petcock], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_scale(seq[fx_turn_petcock], 100);
+ if (!(global[player_score_flags] & SCORE_MAKE_ACID_DRIP_605)) {
+ global[player_score_flags] = global[player_score_flags] | SCORE_MAKE_ACID_DRIP_605;
+ global[player_score] += 1;
+ }
+ player.command_ready = false;
+ return;
+
+ case 1:
+ if (local->prevent) {
+ sound_play(N_TurnPetcock);
+ seq[fx_fluid_left] = kernel_seq_forward(ss[fx_fluid_left], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_fluid_left], 5);
+ kernel_seq_range(seq[fx_fluid_left], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_fluid_left],
+ KERNEL_TRIGGER_EXPIRE, 0, ROOM_605_FLUID_LEFT);
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case 2:
+ if (local->prevent) {
+ sound_play(N_TurnPetcock);
+ seq[fx_fluid_right] = kernel_seq_forward(ss[fx_fluid_right], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_fluid_right], 5);
+ kernel_seq_range(seq[fx_fluid_right], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_fluid_right],
+ KERNEL_TRIGGER_EXPIRE, 0, ROOM_605_FLUID_RIGHT);
+ }
+ local->prevent = true;
+ player.command_ready = false;
+ return;
+
+ case 3:
+ kernel_timing_trigger(TENTH_SECOND, 4);
+ player.walker_visible = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_turn_petcock]);
+ player.command_ready = false;
+ return;
+
+ case 4:
+ player.walker_visible = false;
+
+ if (inter_point_x > 116) {
+ seq[fx_turn_petcock] = kernel_seq_pingpong(ss[fx_turn_petcock], true, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_SPRITE, 6, 1);
+
+ } else {
+ seq[fx_turn_petcock] = kernel_seq_pingpong(ss[fx_turn_petcock], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_SPRITE, 6, 2);
+ }
+ kernel_seq_player(seq[fx_turn_petcock], true);
+ kernel_seq_trigger(seq[fx_turn_petcock], KERNEL_TRIGGER_EXPIRE, 0, 5);
+ kernel_seq_depth(seq[fx_turn_petcock], 1);
+ kernel_seq_range(seq[fx_turn_petcock], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_scale(seq[fx_turn_petcock], 100);
+ player.command_ready = false;
+ return;
+
+ case 5:
+ player.walker_visible = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_turn_petcock]);
+
+ if (global[flask_on_plate] == YES_EMPTY) {
+ kernel_seq_delete(seq[fx_flask_empty]);
+ seq[fx_flask_full] = kernel_seq_stamp(ss[fx_flask_full], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_flask_full], 5);
+ kernel_flip_hotspot(words_flask, false);
+ kernel_flip_hotspot(words_flask_full_of_acid, true);
+ global[flask_on_plate] = YES_ACID;
+ kernel_timing_trigger(FOUR_SECONDS, 6);
+ }
+ player.command_ready = false;
+ return;
+
+ case 6:
+ ++global[player_score];
+ text_show(60570);
+ kernel_timing_trigger(TENTH_SECOND, ROOM_605_CLOSE_PETCOCKS);
+ player.command_ready = false;
+ return;
+ }
+ }
+ }
+
+ if (player_said_2(put, freezer) && !kernel.trigger) {
+ if (player_said_1(ratsicle)) {
+ text_show(60562);
+ player.command_ready = false;
+ return;
+
+ } else {
+ id = object_named(player_main_noun);
+ if (player_has(id)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_reach_into_freezer] = kernel_seq_pingpong(ss[fx_reach_into_freezer], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_reach_into_freezer], KERNEL_TRIGGER_SPRITE, 8, ROOM_605_PUT_IN_FREEZER);
+ kernel_seq_trigger(seq[fx_reach_into_freezer], KERNEL_TRIGGER_EXPIRE, 0, ROOM_605_PUT_IN_FREEZER + 1);
+ kernel_seq_range(seq[fx_reach_into_freezer], KERNEL_FIRST, KERNEL_LAST);
+ player.command_ready = false;
+ return;
+ }
+ }
+ }
+
+ switch (kernel.trigger) {
+ case ROOM_605_PUT_IN_FREEZER:
+ id = object_named(player_main_noun);
+ kernel_flip_hotspot(words_contents_of_freezer, true);
+ inter_move_object(id, FREEZER);
+ if (id == dead_rat) {
+ ++global[player_score];
+ }
+ if (global[object_is_in_freezer_605] != HAS_USED_FREEZER) {
+ seq[fx_object_in_freezer] = kernel_seq_stamp(ss[fx_object_in_freezer], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_object_in_freezer], 14);
+ }
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_PUT_IN_FREEZER + 1:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_reach_into_freezer]);
+
+ if (player_said_1(bone) || player_said_1(fruit) || player_said_1(flies) ||
+ player_said_1(feathers) || player_said_1(dead_rat) || player_said_1(partly_built_bundle) ||
+ player_said_1(dates) || player_said_1(tentacle_parts)) {
+ text_show(60553);
+
+ } else if (!player_said_1(bone) && !player_said_1(fruit) && !player_said_1(flies) &&
+ !player_said_1(feathers) && !player_said_1(dead_rat) && !player_said_1(partly_built_bundle) &&
+ !player_said_1(dates) && !player_said_1(tentacle_parts)) {
+
+ if (global[object_is_in_freezer_605] == NEVER_USED_FREEZER ||
+ game.difficulty == HARD_MODE) {
+ text_show(60551);
+
+ } else if ((global[object_is_in_freezer_605] != NEVER_USED_FREEZER) &&
+ (game.difficulty == EASY_MODE)) {
+ text_show(60554);
+ }
+ }
+ global[object_is_in_freezer_605] = HAS_USED_FREEZER;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(take, contents_of_freezer) && !kernel.trigger) {
+ if (global[object_is_in_freezer_605] == HAS_USED_FREEZER) {
+ player.walker_visible = false;
+ seq[fx_reach_into_freezer] = kernel_seq_pingpong(ss[fx_reach_into_freezer], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_reach_into_freezer], KERNEL_TRIGGER_SPRITE, 8, ROOM_605_TAKE_CONTENTS);
+ kernel_seq_trigger(seq[fx_reach_into_freezer], KERNEL_TRIGGER_EXPIRE, 0, ROOM_605_TAKE_CONTENTS + 1);
+ kernel_seq_range(seq[fx_reach_into_freezer], KERNEL_FIRST, KERNEL_LAST);
+ } else {
+ text_show(60576);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ switch (kernel.trigger) {
+ case ROOM_605_TAKE_CONTENTS:
+ global[object_is_in_freezer_605] = HAS_USED_AND_EMPTY;
+ was_rat_removed = false;
+ are_any_inorganic = false;
+ are_any_organic = false;
+
+ kernel_flip_hotspot(words_contents_of_freezer, false);
+
+ for (count = 0; count < OBJECTS_MAX; count++) {
+ if (object[count].location == FREEZER) {
+ ++removed;
+ last_removed = count;
+
+ if (count == dead_rat) {
+ was_rat_removed = true;
+ inter_give_to_player(ratsicle);
+ inter_move_object(dead_rat, NOWHERE);
+ } else {
+ inter_give_to_player(count);
+ }
+
+ if (last_removed == bone || last_removed == fruit || last_removed == bottle_of_flies ||
+ last_removed == feathers || last_removed == dead_rat || last_removed == partly_built_bundle ||
+ last_removed == dates || last_removed == tentacle_parts) {
+ are_any_organic = true;
+
+ } else {
+ are_any_inorganic = true;
+ }
+ }
+ }
+
+ if (removed == 1) {
+ if (last_removed == bone || last_removed == fruit || last_removed == bottle_of_flies ||
+ last_removed == feathers || last_removed == partly_built_bundle ||
+ last_removed == dates || last_removed == tentacle_parts) {
+ text_show(60555);
+
+ } else if (last_removed == dead_rat) {
+ text_show(60556);
+
+ } else if (last_removed != bone && last_removed != fruit && last_removed != bottle_of_flies &&
+ last_removed != feathers && last_removed != dead_rat && last_removed != partly_built_bundle &&
+ last_removed != dates && last_removed != tentacle_parts) {
+ text_show(60552);
+ }
+
+ } else if (!are_any_inorganic && !was_rat_removed) {
+ text_show(60558);
+
+ } else if (!are_any_inorganic && was_rat_removed) {
+ text_show(60559);
+
+ } else if (are_any_inorganic && are_any_organic &&
+ !was_rat_removed && game.difficulty == HARD_MODE) {
+ text_show(60560);
+
+ } else if (are_any_inorganic && are_any_organic &&
+ !was_rat_removed && game.difficulty == EASY_MODE) {
+ text_show(60563);
+
+ } else if (are_any_inorganic && are_any_organic &&
+ was_rat_removed) {
+ text_show(60561);
+
+ } else if (are_any_inorganic && !are_any_organic &&
+ !was_rat_removed) {
+ text_show(60557);
+ }
+
+ kernel_seq_delete(seq[fx_object_in_freezer]);
+ player.command_ready = false;
+ return;
+
+ case ROOM_605_TAKE_CONTENTS + 1:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_reach_into_freezer]);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player.look_around) {
+ text_show(60501);
+ if (global[rope_is_alive]) {
+ text_show(60502);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(rope) && object_is_here(rope)) {
+ if (global[rope_is_alive]) {
+ text_show(60503);
+ } else {
+ text_show(60504);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(rat_cage)) {
+ if (global[rat_cage_is_open]) {
+ if (player_has(dead_rat)) {
+ text_show(60536);
+ } else {
+ text_show(60535);
+ }
+ } else {
+ text_show(60534);
+ }
+
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(flask) && player.main_object_source == STROKE_INTERFACE) {
+ if (inter_point_x < 118) {
+ text_show(60508);
+ } else {
+ text_show(60573);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(flask_full_of_acid) && object_is_here(flask_full_of_acid)) {
+ text_show(60572);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(petcock)) {
+ if (global[fluid_is_dripping]) {
+ text_show(60513);
+ } else {
+ text_show(60512);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(flame)) {
+ text_show(60516);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(cobwebs)) {
+ text_show(60517);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(nozzle)) {
+ if (global[fluid_is_dripping]) {
+ text_show(60519);
+ } else {
+ text_show(60518);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(retort)) {
+ if (game.difficulty == HARD_MODE) {
+ text_show(60521);
+ } else {
+ text_show(60520);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(shaft_of_light)) {
+ text_show(60522);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(metal_plate)) {
+ if (global[fluid_is_dripping]) {
+ text_show(60526);
+ } else {
+ text_show(60525);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(musty_chart)) {
+ if (game.difficulty == HARD_MODE) {
+ text_show(60528);
+ } else {
+ text_show(60527);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(ancient_barrel)) {
+ text_show(60529);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(contents_of_freezer)) {
+ if (global[object_is_in_freezer_605] == HAS_USED_FREEZER) {
+ text_show(60524);
+ } else {
+ text_show(60523);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(cage)) {
+ text_show(60530);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(balance)) {
+ text_show(60531);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(dead_rat) && !player_has(dead_rat)) {
+ text_show(60506);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(shelf)) {
+ text_show(60532);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(tubing)) {
+ text_show(60533);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(door_to_magic_room)) {
+ text_show(60537);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(freezer)) {
+ text_show(60538);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(cabinet)) {
+ text_show(60539);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(lab_table)) {
+ text_show(60540);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_1(push) || player_said_1(pull) || player_said_1(take)) {
+ if (player_said_1(lab_table) || player_said_1(freezer)) {
+ text_show(60549);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(take, rat_cage)) {
+ if (player_has(dead_rat)) {
+ text_show(60544);
+ } else {
+ text_show(60543);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(take, retort)) {
+ text_show(60541);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(throw, rope) && global[rope_is_alive]) {
+ if (player_said_1(shieldstone)) {
+ text_show(60565);
+
+ } else {
+ text_show(60567);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(open) || player_said_1(close)) {
+ if (player_said_1(freezer)) {
+ if (global[object_is_in_freezer_605] == NEVER_USED_FREEZER) {
+ text_show(60545);
+ } else {
+ text_show(60546);
+ }
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(take, balance) ||
+ player_said_2(take, musty_chart) ||
+ player_said_2(take, cage)) {
+ text_show(60542);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(open) || player_said_1(close)) {
+ if (player_said_1(cage)) {
+ text_show(60547);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_3(put, flask, metal_plate)) {
+ if (global[flask_on_plate] == YES_EMPTY) {
+ text_show(60583);
+ player.command_ready = false;
+ return;
+
+ } else if (!player_has(flask)) {
+ text_show(60580);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_3(put, goblet, metal_plate)) {
+ text_show(60566);
+ player.command_ready = false;
+ return;
+ }
+}
+
+
void room_605_synchronize(Common::Serializer &s) {
-
+ for (int i = 0; i < 23; i++) s.syncAsSint16LE(local->sprite[i]);
+ for (int i = 0; i < 23; i++) s.syncAsSint16LE(local->sequence[i]);
+ for (int i = 0; i < 4; i++) s.syncAsSint16LE(local->animation[i]);
+ s.syncAsSint16LE(local->rope_frame);
+ s.syncAsSint16LE(local->rope_action);
+ s.syncAsSint16LE(local->rope_talk_count);
+ s.syncAsSint16LE(local->anim_0_running);
+ s.syncAsSint16LE(local->rat_frame);
+ s.syncAsSint16LE(local->anim_1_running);
+ s.syncAsSint16LE(local->pid_frame);
+ s.syncAsSint16LE(local->pid_action);
+ s.syncAsSint16LE(local->pid_talk_count);
+ s.syncAsSint16LE(local->anim_2_running);
+ s.syncAsSint16LE(local->rat_cage_frame);
+ s.syncAsSint16LE(local->rat_cage_talk_count);
+ s.syncAsSint16LE(local->anim_3_running);
+ s.syncAsSint16LE(local->rope_id);
+ s.syncAsSint16LE(local->prevent);
+ s.syncAsSint16LE(local->prevent_2);
}
void room_605_preload() {
@@ -74,8 +1596,14 @@ void room_605_preload() {
room_parser_code_pointer = room_605_parser;
room_daemon_code_pointer = room_605_daemon;
+ if (!player_has(rope)) {
+ kernel_initial_variant = 1;
+ }
+
section_6_walker();
section_6_interface();
+
+ vocab_make_active(words_rat);
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room606.cpp b/engines/mads/madsv2/dragonsphere/rooms/room606.cpp
index 6ba562e1b3d..a65cdb77ab7 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room606.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room606.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* 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
@@ -19,10 +19,14 @@
*
*/
+#include "mads/madsv2/core/camera.h"
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,33 +43,1124 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[22];
+ int16 sequence[22];
+ int16 animation[4];
+ int16 on_floor;
+
+ int16 up_frame;
+ int16 anim_0_running;
+
+ int16 down_frame;
+ int16 anim_1_running;
+
+ int16 suction_frame;
+ int16 anim_3_running;
+
+ int16 top_base;
+ int16 dyn_top;
+
+ int16 bottom_base;
+ int16 dyn_bottom;
+
+ int16 blue_stone_base;
+ int16 dyn_blue_stone;
};
-#define local (&scratch)
+#define local ((Scratch *)(&game.scratch[0]))
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_push_high 0
+#define fx_but_top 1
+#define fx_but_bottom 2
+#define fx_but_middle_high 3
+#define fx_but_middle_low 4
+#define fx_elevator 5
+#define fx_scroll_top 6
+#define fx_scroll_left 7
+#define fx_scroll_right 8
+#define fx_scroll_bottom 9
+#define fx_push_low 10
+#define fx_fire_1 11
+#define fx_fire_2 12
+#define fx_fire_3 13
+#define fx_fire_4 14
+#define fx_fire_5 15
+#define fx_door 16
+#define fx_cool_door 17
+#define fx_blue_glow 18
+#define fx_light 19
+#define fx_blue_stone 20
+#define fx_cool_floor 21
+
+#define ROOM_606_LOAD_VARIANT 60
+#define ROOM_606_RAT_DEATH 80
+#define ROOM_606_RAT_TEXT 90
+
+#define PLAYER_X_FROM_603 264
+#define PLAYER_Y_FROM_603 377
+#define WALK_TO_X_FROM_603 228
+#define WALK_TO_Y_FROM_603 377
+
+#define PLAYER_X_FROM_609 169
+#define PLAYER_Y_FROM_609 568
+#define WALK_TO_X_FROM_609 169
+#define WALK_TO_Y_FROM_609 582
+
+#define PLAYER_X_FROM_612 131
+#define PLAYER_Y_FROM_612 103
+#define WALK_TO_X_FROM_612 172
+#define WALK_TO_Y_FROM_612 110
+
+#define PLAYER_X_FROM_607 166
+#define PLAYER_Y_FROM_607 351
+#define WALK_TO_X_FROM_607 152
+#define WALK_TO_Y_FROM_607 364
+
+#define PLAYER_X_FROM_613 261
+#define PLAYER_Y_FROM_613 125
+#define WALK_TO_X_FROM_613 230
+#define WALK_TO_Y_FROM_613 125
+
+#define TOP_FLOOR 0
+#define MIDDLE_FLOOR 256
+#define BOTTOM_FLOOR 468
+
+#define ELEV_TOP_X 99
+#define ELEV_TOP_Y 122
+
+#define ELEV_MIDDLE_X 99
+#define ELEV_MIDDLE_Y 375
+
+#define ELEV_BOTTOM_X 99
+#define ELEV_BOTTOM_Y 590
+
+#define KING_MIDDLE_ELEV_X 99
+#define KING_MIDDLE_ELEV_Y 368
+
+#define KING_TOP_ELEV_X 99
+#define KING_TOP_ELEV_Y 115
+
+#define KING_BOTTOM_ELEV_X 99
+#define KING_BOTTOM_ELEV_Y 584
+
+#define camera_ratio_1 1
+#define camera_ratio_2 3
+
+#define RAT_X 221
+#define RAT_Y 125
+
+
+static void set_top_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int y;
+ int ys;
+
+ center = picture_view_y + (video_y >> 1);
+
+ if (seq[fx_scroll_top] >= 0) {
+ kernel_seq_delete(seq[fx_scroll_top]);
+ }
+
+ difference = center - local->top_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ y = local->top_base + displace - 1;
+ ys = series_list[ss[fx_scroll_top]]->index[0].ys;
+
+ if (((y - ((ys >> 1) + 1)) >= (picture_view_y + video_y)) ||
+ ((y + ((ys >> 1) + 1)) < picture_view_y)) {
+ seq[fx_scroll_top] = -1;
+
+ } else {
+ seq[fx_scroll_top] = kernel_seq_stamp(ss[fx_scroll_top], false, 1);
+ kernel_seq_loc(seq[fx_scroll_top], 161, y);
+ kernel_seq_depth(seq[fx_scroll_top], 1);
+ }
+}
+
+static void set_bottom_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int y;
+ int ys;
+
+ center = picture_view_y + (video_y >> 1);
+
+ if (seq[fx_scroll_bottom] >= 0) {
+ kernel_seq_delete(seq[fx_scroll_bottom]);
+ }
+
+ difference = center - local->bottom_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ y = local->bottom_base + displace - 1;
+ ys = series_list[ss[fx_scroll_bottom]]->index[0].ys;
+
+ if (((y - ((ys >> 1) + 1)) >= (picture_view_y + video_y)) ||
+ ((y + ((ys >> 1) + 1)) < picture_view_y)) {
+ seq[fx_scroll_bottom] = -1;
+
+ } else {
+ seq[fx_scroll_bottom] = kernel_seq_stamp(ss[fx_scroll_bottom], false, 1);
+ kernel_seq_loc(seq[fx_scroll_bottom], 160, y);
+ kernel_seq_depth(seq[fx_scroll_bottom], 1);
+ }
+}
+
+static void set_stone_position() {
+ int difference;
+ int y;
+
+ difference = (468 - picture_view_y) / 6;
+ y = (series_list[ss[fx_blue_stone]]->index[0].y + 460) - difference;
+ kernel_seq_delete(seq[fx_blue_stone]);
+ seq[fx_blue_stone] = kernel_seq_stamp(ss[fx_blue_stone], false, 1);
+ kernel_seq_loc(seq[fx_blue_stone], 160, y);
+ kernel_seq_depth(seq[fx_blue_stone], 4);
+}
+
+static void handle_anim_up() {
+ int up_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->up_frame) {
+ local->up_frame = kernel_anim[aa[0]].frame;
+ up_reset_frame = -1;
+
+ switch (local->up_frame) {
+
+ case 290:
+ camera_pan_to(&camera_y, picture_view_y - 155);
+ break;
+
+ case 81:
+ camera_pan_to(&camera_y, picture_view_y - 155);
+ break;
+
+ case 184:
+ camera_pan_to(&camera_y, MIDDLE_FLOOR);
+ break;
+
+ case 420:
+ camera_pan_to(&camera_y, TOP_FLOOR);
+ break;
+
+ case 1:
+ case 217:
+ kernel_seq_delete(seq[fx_elevator]);
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_NOW, 0);
+ break;
+
+ case 469:
+ sound_play(N_ElevatorOff);
+ kernel_abort_animation(aa[0]);
+ local->on_floor = 3;
+ local->anim_0_running = false;
+ player.walker_visible = true;
+ up_reset_frame = -1;
+ player_demand_location(KING_TOP_ELEV_X, KING_TOP_ELEV_Y);
+ player_demand_facing(FACING_SOUTH);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+
+ kernel_room_scale(145, 85, 103, 67);
+
+ seq[fx_elevator] = kernel_seq_stamp(ss[fx_elevator], false, 1);
+ kernel_seq_depth(seq[fx_elevator], 14);
+ kernel_seq_loc(seq[fx_elevator], ELEV_TOP_X, ELEV_TOP_Y);
+ kernel_synch(KERNEL_SERIES, seq[fx_elevator], KERNEL_NOW, 0);
+ kernel_timing_trigger(TENTH_SECOND, ROOM_606_LOAD_VARIANT);
+
+ if (global[rat_cage_is_open] && !global[rat_melted]) {
+ aa[2] = kernel_run_animation(kernel_name('r', 1), ROOM_606_RAT_DEATH);
+ } else {
+ player.commands_allowed = true;
+ }
+ break;
+
+ case 215:
+ sound_play(N_ElevatorOff);
+ kernel_abort_animation(aa[0]);
+ local->on_floor = 2;
+ local->anim_0_running = false;
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ up_reset_frame = -1;
+ player_demand_location(KING_MIDDLE_ELEV_X, KING_MIDDLE_ELEV_Y);
+ player_demand_facing(FACING_SOUTH);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+
+ kernel_room_scale(401, 85, 359, 67);
+
+ seq[fx_elevator] = kernel_seq_stamp(ss[fx_elevator], false, 1);
+ kernel_seq_depth(seq[fx_elevator], 14);
+ kernel_seq_loc(seq[fx_elevator], ELEV_MIDDLE_X, ELEV_MIDDLE_Y);
+ kernel_synch(KERNEL_SERIES, seq[fx_elevator], KERNEL_NOW, 0);
+ kernel_timing_trigger(TENTH_SECOND, ROOM_606_LOAD_VARIANT);
+ break;
+ }
+
+ if (up_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], up_reset_frame);
+ local->up_frame = up_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_down() {
+ int down_reset_frame;
+
+ if (kernel_anim[aa[1]].frame != local->down_frame) {
+ local->down_frame = kernel_anim[aa[1]].frame;
+ down_reset_frame = -1;
+
+ switch (local->down_frame) {
+
+ case 21:
+ camera_pan_to(&camera_y, picture_view_y + 100);
+ break;
+
+ case 113:
+ camera_pan_to(&camera_y, BOTTOM_FLOOR);
+ break;
+
+ case 245:
+ camera_pan_to(&camera_y, picture_view_y + 120);
+ break;
+
+ case 370:
+ camera_pan_to(&camera_y, MIDDLE_FLOOR);
+ break;
+
+ case 217:
+ case 1:
+ kernel_seq_delete(seq[fx_elevator]);
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_NOW, 0);
+ break;
+
+ case 470:
+ sound_play(N_ElevatorOff);
+ kernel_abort_animation(aa[1]);
+ local->on_floor = 2;
+ local->anim_1_running = false;
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ down_reset_frame = -1;
+ player_demand_location(KING_MIDDLE_ELEV_X, KING_MIDDLE_ELEV_Y);
+ player_demand_facing(FACING_SOUTH);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+
+ kernel_room_scale(401, 85, 359, 67);
+
+ seq[fx_elevator] = kernel_seq_stamp(ss[fx_elevator], false, 1);
+ kernel_seq_depth(seq[fx_elevator], 14);
+ kernel_seq_loc(seq[fx_elevator], ELEV_MIDDLE_X, ELEV_MIDDLE_Y);
+ kernel_synch(KERNEL_SERIES, seq[fx_elevator], KERNEL_NOW, 0);
+ kernel_timing_trigger(TENTH_SECOND, ROOM_606_LOAD_VARIANT);
+ break;
+
+ case 216:
+ sound_play(N_ElevatorOff);
+ kernel_abort_animation(aa[1]);
+ local->on_floor = 1;
+ local->anim_1_running = false;
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ down_reset_frame = -1;
+ player_demand_location(KING_BOTTOM_ELEV_X, KING_BOTTOM_ELEV_Y);
+ player_demand_facing(FACING_SOUTH);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+
+ kernel_room_scale(613, 85, 571, 67);
+
+ seq[fx_elevator] = kernel_seq_stamp(ss[fx_elevator], false, 1);
+ kernel_seq_depth(seq[fx_elevator], 14);
+ kernel_seq_loc(seq[fx_elevator], ELEV_BOTTOM_X, ELEV_BOTTOM_Y);
+ kernel_synch(KERNEL_SERIES, seq[fx_elevator], KERNEL_NOW, 0);
+ kernel_timing_trigger(TENTH_SECOND, ROOM_606_LOAD_VARIANT);
+ break;
+ }
+
+ if (down_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], down_reset_frame);
+ local->down_frame = down_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_suction() {
+ int suction_reset_frame;
+
+ if (kernel_anim[aa[3]].frame != local->suction_frame) {
+ local->suction_frame = kernel_anim[aa[3]].frame;
+ suction_reset_frame = -1;
+
+ switch (local->suction_frame) {
+ case 11:
+ kernel_seq_delete(seq[fx_cool_door]);
+ kernel_seq_delete(seq[fx_door]);
+ kernel_flip_hotspot(words_teleportal, false);
+ kernel_flip_hotspot(words_door_frame, false);
+ break;
+
+ case 46:
+ inter_give_to_player(teleport_door);
+ object_examine(teleport_door, 60629, 0);
+ kernel_abort_animation(aa[3]);
+ global[player_score] += 1;
+ suction_reset_frame = -1;
+ player.commands_allowed = true;
+ player.walker_visible = true;
+ local->anim_3_running = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ break;
+ }
+
+ if (suction_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], suction_reset_frame);
+ local->suction_frame = suction_reset_frame;
+ }
+ }
+}
+
+static void room_606_init() {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ local->anim_3_running = false;
+
+ ss[fx_cool_door] = kernel_load_series(kernel_name('z', 0), false);
+
+ if (object_is_here(teleport_door)) {
+ if (global[door_is_cool]) {
+ seq[fx_cool_door] = kernel_seq_stamp(ss[fx_cool_door], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_cool_door], 8);
+ }
+ }
+
+ if (global[floor_is_cool]) {
+ ss[fx_cool_floor] = kernel_load_series(kernel_name('x', 7), false);
+ seq[fx_cool_floor] = kernel_seq_stamp(ss[fx_cool_floor], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_cool_floor], 14);
+ }
+
+ ss[fx_fire_1] = kernel_load_series(kernel_name('y', 0), false);
+ ss[fx_fire_2] = kernel_load_series(kernel_name('y', 1), false);
+ ss[fx_fire_3] = kernel_load_series(kernel_name('y', 2), false);
+ ss[fx_fire_4] = kernel_load_series(kernel_name('y', 3), false);
+ ss[fx_fire_5] = kernel_load_series(kernel_name('y', 4), false);
-void room_606_init() {
+ seq[fx_fire_1] = kernel_seq_forward(ss[fx_fire_1], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_1], 14);
+ kernel_seq_range(seq[fx_fire_1], KERNEL_FIRST, KERNEL_LAST);
+ seq[fx_fire_2] = kernel_seq_forward(ss[fx_fire_2], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_2], 14);
+ kernel_seq_range(seq[fx_fire_2], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_3] = kernel_seq_forward(ss[fx_fire_3], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_3], 14);
+ kernel_seq_range(seq[fx_fire_3], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_4] = kernel_seq_forward(ss[fx_fire_4], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_4], 14);
+ kernel_seq_range(seq[fx_fire_4], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_5] = kernel_seq_forward(ss[fx_fire_5], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_5], 14);
+ kernel_seq_range(seq[fx_fire_5], KERNEL_FIRST, KERNEL_LAST);
+
+ ss[fx_elevator] = kernel_load_series(kernel_name('x', 4), false);
+ ss[fx_push_high] = kernel_load_series(kernel_name('a', 0), false);
+ ss[fx_push_low] = kernel_load_series(kernel_name('a', 1), false);
+ ss[fx_but_top] = kernel_load_series(kernel_name('x', 0), false);
+ ss[fx_but_bottom] = kernel_load_series(kernel_name('x', 3), false);
+ ss[fx_but_middle_high] = kernel_load_series(kernel_name('x', 1), false);
+ ss[fx_but_middle_low] = kernel_load_series(kernel_name('x', 2), false);
+
+ ss[fx_scroll_top] = kernel_load_series(kernel_name('r', 0), false);
+ ss[fx_scroll_bottom] = kernel_load_series(kernel_name('r', 1), false);
+
+ if (global[torch_is_in_609]) {
+ ss[fx_light] = kernel_load_series(kernel_name('x', 6), false);
+ seq[fx_light] = kernel_seq_stamp(ss[fx_light], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_light], 9);
+ }
+
+ if (!player_has(blue_powerstone)) {
+ ss[fx_blue_stone] = kernel_load_series(kernel_name('p', 3), false);
+ ss[fx_blue_glow] = kernel_load_series(kernel_name('p', 1), false);
+ seq[fx_blue_glow] = kernel_seq_stamp(ss[fx_blue_glow], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_blue_glow], 10);
+ }
+
+ if (object_is_here(teleport_door)) {
+ ss[fx_door] = kernel_load_series(kernel_name('p', 0), false);
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_door], 9);
+
+ } else {
+ kernel_flip_hotspot(words_teleportal, false);
+ kernel_flip_hotspot(words_door_frame, false);
+ }
+
+ seq[fx_elevator] = kernel_seq_stamp(ss[fx_elevator], false, 1);
+ kernel_seq_depth(seq[fx_elevator], 14);
+
+ if (previous_room == 612) {
+ player.x = PLAYER_X_FROM_612;
+ player.y = PLAYER_Y_FROM_612;
+ player.facing = FACING_EAST;
+
+ player_walk(WALK_TO_X_FROM_612, WALK_TO_Y_FROM_612, FACING_SOUTH);
+ camera_jump_to(0, TOP_FLOOR);
+ kernel_room_scale(145, 85, 103, 67);
+ local->on_floor = 3;
+ kernel_seq_loc(seq[fx_elevator], ELEV_TOP_X, ELEV_TOP_Y);
+
+ } else if (previous_room == 603) {
+ player_first_walk(PLAYER_X_FROM_603, PLAYER_Y_FROM_603, FACING_WEST,
+ WALK_TO_X_FROM_603, WALK_TO_Y_FROM_603, FACING_WEST, true);
+ camera_jump_to(0, MIDDLE_FLOOR);
+ kernel_room_scale(401, 85, 359, 67);
+ local->on_floor = 2;
+ kernel_seq_loc(seq[fx_elevator], ELEV_MIDDLE_X, ELEV_MIDDLE_Y);
+
+ } else if (previous_room == 607) {
+ player_first_walk(PLAYER_X_FROM_607, PLAYER_Y_FROM_607, FACING_SOUTH,
+ WALK_TO_X_FROM_607, WALK_TO_Y_FROM_607, FACING_SOUTH, true);
+ camera_jump_to(0, MIDDLE_FLOOR);
+ kernel_room_scale(401, 85, 359, 67);
+ local->on_floor = 2;
+ kernel_seq_loc(seq[fx_elevator], ELEV_MIDDLE_X, ELEV_MIDDLE_Y);
+
+ } else if (previous_room == 613) {
+ if (!object_is_here(teleport_door)) {
+ if (!global[floor_is_cool]) {
+ player.x = WALK_TO_X_FROM_613;
+ player.y = WALK_TO_Y_FROM_613;
+ player.facing = FACING_WEST;
+
+ } else {
+ player_first_walk(PLAYER_X_FROM_613, PLAYER_Y_FROM_613, FACING_WEST,
+ WALK_TO_X_FROM_613, WALK_TO_Y_FROM_613, FACING_WEST, true);
+ }
+ }
+ camera_jump_to(0, TOP_FLOOR);
+ kernel_room_scale(145, 85, 103, 67);
+ local->on_floor = 3;
+ kernel_seq_loc(seq[fx_elevator], ELEV_TOP_X, ELEV_TOP_Y);
+ kernel_timing_trigger(1, ROOM_606_RAT_TEXT);
+
+ } else if ((previous_room == 609) || (previous_room != KERNEL_RESTORING_GAME)) {
+ player_first_walk(PLAYER_X_FROM_609, PLAYER_Y_FROM_609, FACING_SOUTH,
+ WALK_TO_X_FROM_609, WALK_TO_Y_FROM_609, FACING_SOUTH, true);
+ camera_jump_to(0, BOTTOM_FLOOR);
+ kernel_room_scale(613, 85, 571, 67);
+ local->on_floor = 1;
+ kernel_seq_loc(seq[fx_elevator], ELEV_BOTTOM_X, ELEV_BOTTOM_Y);
+
+ } else if (previous_room == KERNEL_RESTORING_GAME) {
+
+ if (local->on_floor == 2) {
+ camera_jump_to(0, MIDDLE_FLOOR);
+ kernel_room_scale(401, 85, 359, 67);
+ kernel_seq_loc(seq[fx_elevator], ELEV_MIDDLE_X, ELEV_MIDDLE_Y);
+
+ } else if (local->on_floor == 3) {
+ camera_jump_to(0, TOP_FLOOR);
+ kernel_room_scale(145, 85, 103, 67);
+ kernel_seq_loc(seq[fx_elevator], ELEV_TOP_X, ELEV_TOP_Y);
+
+ } else {
+ camera_jump_to(0, BOTTOM_FLOOR);
+ kernel_room_scale(613, 85, 571, 67);
+ kernel_seq_loc(seq[fx_elevator], ELEV_BOTTOM_X, ELEV_BOTTOM_Y);
+ }
+ }
+
+ seq[fx_scroll_top] = -1;
+ local->dyn_top = -1;
+ local->top_base = 68;
+
+ seq[fx_scroll_bottom] = -1;
+ local->dyn_bottom = -1;
+ local->bottom_base = 610;
+
+ seq[fx_blue_stone] = -1;
+ local->dyn_blue_stone = -1;
+ local->blue_stone_base = 540;
+
+ if (!player_has(blue_powerstone)) {
+ seq[fx_blue_stone] = kernel_seq_stamp(ss[fx_blue_stone], false, 1);
+ kernel_seq_loc(seq[fx_blue_stone], 160, 550);
+ kernel_seq_depth(seq[fx_blue_stone], 4);
+ }
+
+ set_top_position();
+ set_bottom_position();
+
+ section_6_music();
}
-void room_606_daemon() {
+static void room_606_daemon() {
+ if (local->anim_0_running) {
+ handle_anim_up();
+ }
+
+ if (local->anim_1_running) {
+ handle_anim_down();
+ }
+ if (local->anim_3_running) {
+ handle_anim_suction();
+ }
+
+ if (kernel.trigger == ROOM_606_LOAD_VARIANT) {
+ kernel_load_variant(0);
+ }
+
+ if (camera_y.pan_this_frame) {
+ set_top_position();
+ set_bottom_position();
+ if (!player_has(blue_powerstone)) {
+ set_stone_position();
+ }
+ }
+
+ if (kernel.trigger == ROOM_606_RAT_DEATH) {
+ new_room = 613;
+ }
+
+ if (kernel.trigger == ROOM_606_RAT_TEXT) {
+ if (global[rat_melted]) {
+ text_show(60624);
+ global[rat_melted] = 1;
+ }
+ }
}
-void room_606_pre_parser() {
+static void room_606_pre_parser() {
+ if (player_said_2(walk_through, doorway_to_dark_room)) {
+ if (!player_has(torch) && !global[torch_is_in_609]) {
+ text_show(60644);
+ player_cancel_command();
+ }
+ }
+
+ if (player_said_1(doorway) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+ if (player_said_1(doorway_to_cell) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+
+ if (player_said_1(machine_room_doorway) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+
+ if (player_said_1(doorway_to_dark_room) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+
+ if (player_said_1(eye_chamber_doorway) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
}
-void room_606_parser() {
+static void room_606_parser() {
+ int id;
+
+ if (player_said_3(put, ratsicle, door_frame)) {
+ switch (kernel.trigger) {
+ case 0:
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ aa[2] = kernel_run_animation(kernel_name('w', 1), 1);
+ kernel_synch(KERNEL_ANIM, aa[2], KERNEL_PLAYER, 0);
+ player.command_ready = false;
+ return;
+
+ case 1:
+ kernel_abort_animation(aa[2]);
+ seq[fx_cool_door] = kernel_seq_stamp(ss[fx_cool_door], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_cool_door], 8);
+ kernel_synch(KERNEL_SERIES, seq[fx_cool_door], KERNEL_NOW, 0);
+ global[player_score] += 5;
+ global[door_is_cool] = true;
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ inter_move_object(ratsicle, NOWHERE);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ text_show(60633);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(take, teleportal) ||
+ player_said_2(pull, teleportal) ||
+ player_said_2(take, door_frame) ||
+ player_said_2(pull, door_frame)) {
+ if (global[door_is_cool]) {
+ text_show(60628);
+ player.command_ready = false;
+ return;
+
+ } else {
+ text_show(60614);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_3(put, tentacle_parts, teleportal) ||
+ player_said_3(put, tentacle_parts, door_frame)) {
+ if (global[door_is_cool]) {
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ local->anim_3_running = true;
+ aa[3] = kernel_run_animation(kernel_name('t', 1), 0);
+ global[player_score] += 5;
+ kernel_synch(KERNEL_ANIM, aa[3], KERNEL_PLAYER, 0);
+ player.command_ready = false;
+ return;
+
+ } else {
+ text_show(60635);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(walk_through, doorway_to_dark_room)) {
+ if (!(global[player_score_flags] & SCORE_ENTER_609)) {
+ global[player_score_flags] = global[player_score_flags] | SCORE_ENTER_609;
+ global[player_score] += 1;
+ }
+
+ new_room = 609;
+ player.command_ready = false;
+ return;
+ }
+ if (player_said_2(walk_through, eye_chamber_doorway)) {
+ new_room = 603;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, machine_room_doorway)) {
+ new_room = 612;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, doorway_to_cell)) {
+ new_room = 607;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, doorway)) {
+ new_room = 613;
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(walk_through, teleportal)) {
+ switch (kernel.trigger) {
+ case 0:
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ aa[2] = kernel_run_animation(kernel_name('k', 1), 1);
+ kernel_synch(KERNEL_ANIM, aa[2], KERNEL_PLAYER, 0);
+ break;
+
+ case 1:
+ new_room = 613;
+ break;
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (local->on_floor == 1) {
+ if (player_said_2(push, button)) {
+ switch (kernel.trigger) {
+ case 0:
+ kernel_load_variant(1);
+ global[used_elevator] = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_push_high] = kernel_seq_pingpong(ss[fx_push_high], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_push_high], 2);
+ kernel_seq_range(seq[fx_push_high], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_push_high], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_seq_trigger(seq[fx_push_high], KERNEL_TRIGGER_SPRITE, 6, 2);
+ kernel_seq_player(seq[fx_push_high], false);
+ kernel_synch(KERNEL_SERIES, seq[fx_push_high], KERNEL_PLAYER, 0);
+ break;
+
+ case 1:
+ if (!global[platform_clicked_606]) {
+ text_show(60610);
+ }
+ sound_play(N_ElevatorOn);
+ global[platform_clicked_606] = true;
+ local->anim_0_running = true;
+ aa[0] = kernel_run_animation(kernel_name('u', 1), 0);
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_SERIES, seq[fx_push_high]);
+ break;
+
+ case 2:
+ sound_play(N_ElevatorButton);
+ seq[fx_but_bottom] = kernel_seq_pingpong(ss[fx_but_bottom], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_but_bottom], 10);
+ kernel_seq_range(seq[fx_but_bottom], KERNEL_FIRST, KERNEL_LAST);
+ break;
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ } else if (local->on_floor == 2) {
+ if (player_said_2(push, top_button)) {
+ switch (kernel.trigger) {
+ case 0:
+ kernel_load_variant(1);
+ global[used_elevator] = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_push_high] = kernel_seq_pingpong(ss[fx_push_high], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_push_high], 2);
+ kernel_seq_range(seq[fx_push_high], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_push_high], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_seq_trigger(seq[fx_push_high], KERNEL_TRIGGER_SPRITE, 6, 2);
+ kernel_seq_player(seq[fx_push_high], false);
+ kernel_synch(KERNEL_SERIES, seq[fx_push_high], KERNEL_PLAYER, 0);
+ break;
+
+ case 1:
+ if (!global[platform_clicked_606]) {
+ text_show(60610);
+ }
+ sound_play(N_ElevatorOn);
+ global[platform_clicked_606] = true;
+ local->anim_0_running = true;
+ aa[0] = kernel_run_animation(kernel_name('u', 1), 0);
+ kernel_reset_animation(aa[0], 217);
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_SERIES, seq[fx_push_high]);
+ break;
+
+ case 2:
+ sound_play(N_ElevatorButton);
+ seq[fx_but_middle_high] = kernel_seq_pingpong(ss[fx_but_middle_high], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_but_middle_high], 10);
+ kernel_seq_range(seq[fx_but_middle_high], KERNEL_FIRST, KERNEL_LAST);
+ break;
+ }
+ player.command_ready = false;
+ return;
+
+ } else if (player_said_2(push, bottom_button)) {
+ switch (kernel.trigger) {
+ case 0:
+ kernel_load_variant(1);
+ global[used_elevator] = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_push_low] = kernel_seq_pingpong(ss[fx_push_low], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_push_low], 2);
+ kernel_seq_range(seq[fx_push_low], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_push_low], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_seq_trigger(seq[fx_push_low], KERNEL_TRIGGER_SPRITE, 6, 2);
+ kernel_seq_player(seq[fx_push_low], false);
+ kernel_synch(KERNEL_SERIES, seq[fx_push_low], KERNEL_PLAYER, 0);
+ break;
+
+ case 1:
+ if (!global[platform_clicked_606]) {
+ text_show(60610);
+ }
+ sound_play(N_ElevatorOn);
+ global[platform_clicked_606] = true;
+ local->anim_1_running = true;
+ aa[1] = kernel_run_animation(kernel_name('d', 1), 0);
+ kernel_synch(KERNEL_ANIM, aa[1], KERNEL_SERIES, seq[fx_push_low]);
+ break;
+
+ case 2:
+ sound_play(N_ElevatorButton);
+ seq[fx_but_middle_low] = kernel_seq_pingpong(ss[fx_but_middle_low], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_but_middle_low], 10);
+ kernel_seq_range(seq[fx_but_middle_low], KERNEL_FIRST, KERNEL_LAST);
+ break;
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ } else if (local->on_floor == 3) {
+ if (player_said_2(push, button)) {
+ switch (kernel.trigger) {
+ case 0:
+ kernel_load_variant(1);
+ global[used_elevator] = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_push_high] = kernel_seq_pingpong(ss[fx_push_high], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_push_high], 2);
+ kernel_seq_range(seq[fx_push_high], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_push_high], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_seq_trigger(seq[fx_push_high], KERNEL_TRIGGER_SPRITE, 6, 2);
+ kernel_seq_player(seq[fx_push_high], false);
+ kernel_synch(KERNEL_SERIES, seq[fx_push_high], KERNEL_PLAYER, 0);
+ break;
+
+ case 1:
+ if (!global[platform_clicked_606]) {
+ text_show(60610);
+ }
+ sound_play(N_ElevatorOn);
+ global[platform_clicked_606] = true;
+ local->anim_1_running = true;
+ aa[1] = kernel_run_animation(kernel_name('d', 1), 0);
+ kernel_reset_animation(aa[1], 217);
+ kernel_synch(KERNEL_ANIM, aa[1], KERNEL_SERIES, seq[fx_push_high]);
+ break;
+
+ case 2:
+ sound_play(N_ElevatorButton);
+ seq[fx_but_top] = kernel_seq_pingpong(ss[fx_but_top], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_but_top], 10);
+ kernel_seq_range(seq[fx_but_top], KERNEL_FIRST, KERNEL_LAST);
+ break;
+ }
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player.look_around) {
+ switch (local->on_floor) {
+ case 1:
+ if (global[torch_is_in_609] || player_has(torch)) {
+ text_show(60602);
+ } else {
+ text_show(60601);
+ }
+ break;
+
+ case 2:
+ if (global[used_elevator]) {
+ text_show(60627);
+ } else {
+ text_show(60603);
+ }
+ break;
+
+ case 3:
+ if (object_is_here(teleport_door) && global[door_is_cool]) {
+ text_show(60605);
+ } else if (object_is_here(teleport_door) && !global[door_is_cool]) {
+ text_show(60604);
+ } else if (!object_is_here(teleport_door)) {
+ text_show(60606);
+ }
+ break;
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(eye_chamber_doorway)) {
+ text_show(60607);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(doorway)) {
+ text_show(60642);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(button) ||
+ player_said_1(top_button) ||
+ player_said_1(bottom_button)) {
+
+ if (global[used_elevator]) {
+ text_show(60609);
+ } else {
+ text_show(60608);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(big_skull)) {
+ text_show(60640);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(skull)) {
+ text_show(60613);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(machine_room_doorway)) {
+ text_show(60619);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(doorway_to_cell)) {
+ text_show(60620);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(window)) {
+ text_show(60621);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(teleportal)) {
+ if (global[rat_cage_is_open]) {
+ text_show(60626);
+ } else {
+ text_show(60625);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(door_frame)) {
+ if (global[door_is_cool]) {
+ text_show(60631);
+ } else {
+ text_show(60630);
+ }
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_1(doorway_to_dark_room)) {
+ if (global[torch_is_in_609] || player_has(torch)) {
+ text_show(60637);
+ } else {
+ text_show(60636);
+ }
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_1(big_skull) ||
+ player_said_1(skull)) {
+ text_show(60612);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust)) {
+
+ if (player_said_1(button) ||
+ player_said_1(top_button) ||
+ player_said_1(bottom_button)) {
+
+ text_show(60611);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(open, window)) {
+ text_show(60622);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_2(throw, window)) {
+ text_show(60623);
+ player.command_ready = false;
+ return;
+ }
+
+ if (player_said_3(put, flask_of_acid, door_frame) ||
+ player_said_2(pour_contents_of, door_frame)) {
+ text_show(60639);
+ player.command_ready = false;
+ return;
+ }
+
+ id = object_named(player_main_noun);
+
+ if (player_said_2(put, door_frame) && player_has(id)) {
+ if (!global[door_is_cool]) {
+ text_show(60645);
+ player.command_ready = false;
+ return;
+ }
+ }
+
+ if (player_said_2(put, teleportal)) {
+ text_show(60643);
+ player.command_ready = false;
+ return;
+ }
}
void room_606_synchronize(Common::Serializer &s) {
-
+ for (int i = 0; i < 22; i++) s.syncAsSint16LE(local->sprite[i]);
+ for (int i = 0; i < 22; i++) s.syncAsSint16LE(local->sequence[i]);
+ for (int i = 0; i < 4; i++) s.syncAsSint16LE(local->animation[i]);
+ s.syncAsSint16LE(local->on_floor);
+ s.syncAsSint16LE(local->up_frame);
+ s.syncAsSint16LE(local->anim_0_running);
+ s.syncAsSint16LE(local->down_frame);
+ s.syncAsSint16LE(local->anim_1_running);
+ s.syncAsSint16LE(local->suction_frame);
+ s.syncAsSint16LE(local->anim_3_running);
+ s.syncAsSint16LE(local->top_base);
+ s.syncAsSint16LE(local->dyn_top);
+ s.syncAsSint16LE(local->bottom_base);
+ s.syncAsSint16LE(local->dyn_bottom);
+ s.syncAsSint16LE(local->blue_stone_base);
+ s.syncAsSint16LE(local->dyn_blue_stone);
}
void room_606_preload() {
@@ -76,6 +1171,8 @@ void room_606_preload() {
section_6_walker();
section_6_interface();
+
+ player.walker_must_reload = true;
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room607.cpp b/engines/mads/madsv2/dragonsphere/rooms/room607.cpp
index 1a5b808661f..dc050acc5eb 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room607.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room607.cpp
@@ -22,7 +22,10 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,6 +42,13 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15]; /* Sprite series handles */
+ int16 sequence[15]; /* Sequence handles */
+ int16 animation[4]; /* Animation handles */
+
+ int16 pour_frame; /* animation frame being held for pour stuff */
+ int16 anim_0_running;
+ int16 prevent;
};
#define local (&scratch)
@@ -46,36 +56,643 @@ struct Scratch {
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
-void room_607_init() {
+/* ========================= Sprite Series =================== */
+
+#define fx_hole 0 /* rm607h0 */
+#define fx_rope 1 /* rm607x0 */
+#define fx_look 2 /* rm607a1 */
+#define fx_tie 3 /* rm607a2 */
+#define fx_down 4 /* rm607a3 */
+#define fx_fire_1 5 /* rm607x1 */
+#define fx_take 6 /* trchgt */
+#define fx_trap 7 /* rm607t0 */
+
+
+/* ========================= Triggers ======================== */
+
+#define ROOM_607_DONE_UP 60
+
+
+/* ========================= Other Macros ==================== */
+
+#define PLAYER_X_FROM_606 171
+#define PLAYER_Y_FROM_606 149
+
+#define POUR_X 92
+#define POUR_Y 139
+
+#define LOOK_X 70
+#define LOOK_Y 130
+
+#define TIE_X 44
+#define TIE_Y 144
+
+#define DOWN_X 46
+#define DOWN_Y 141
+
+#define TORCH_HS_X 60
+#define TORCH_HS_Y 80
+
+#define TORCH_X 70
+#define TORCH_Y 128
+
+static Scratch scratch;
+
+
+static void room_607_init() {
+ int count;
+
+ local->anim_0_running = false;
+ local->prevent = false;
+
+ ss[fx_look] = kernel_load_series(kernel_name('a', 1), false);
+ ss[fx_rope] = kernel_load_series(kernel_name('x', 0), false);
+ ss[fx_hole] = kernel_load_series(kernel_name('h', 0), false);
+ ss[fx_tie] = kernel_load_series(kernel_name('a', 2), false);
+ ss[fx_down] = kernel_load_series(kernel_name('a', 3), false);
+ ss[fx_trap] = kernel_load_series(kernel_name('t', 0), false);
+
+ if (object_is_here(torch)) {
+ ss[fx_take] = kernel_load_series("*TRCHGT", false);
+ ss[fx_fire_1] = kernel_load_series(kernel_name('x', 1), false);
+ seq[fx_fire_1] = kernel_seq_forward(ss[fx_fire_1], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_1], 10);
+ kernel_seq_range(seq[fx_fire_1], KERNEL_FIRST, KERNEL_LAST);
+ } else {
+ kernel_flip_hotspot_loc(words_torch, false, TORCH_HS_X, TORCH_HS_Y);
+ }
+
+ if (!global[hole_is_in_607]) {
+ if (game.difficulty == HARD_MODE) {
+ seq[fx_hole] = kernel_seq_stamp(ss[fx_hole], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_hole], 14);
+ kernel_flip_hotspot(words_hole, false);
+ kernel_flip_hotspot(words_trap_door, false);
+ } else {
+ seq[fx_trap] = kernel_seq_stamp(ss[fx_trap], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_trap], 8);
+ kernel_flip_hotspot(words_hole, false);
+ }
+
+ } else {
+ kernel_flip_hotspot(words_trap_door, false);
+ }
+
+ if (global[rope_is_hanging_in_607]) {
+
+ if (previous_room != 609) {
+ seq[fx_rope] = kernel_seq_stamp(ss[fx_rope], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_rope], 5);
+ }
+
+ for (count = 0; count < room_num_spots; count++) {
+ if (room_spots[count].vocab == words_hole) {
+ room_spots[count].cursor_number = 3;
+ room_spots[count].verb = words_climb_through;
+ }
+ }
+
+ } else {
+ kernel_flip_hotspot(words_rope, false);
+ }
+ /* ========================= Previous Rooms ================== */
+
+ if (previous_room == 609) {
+ player.x = DOWN_X;
+ player.y = DOWN_Y;
+ player.facing = FACING_NORTH;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_down] = kernel_seq_backward(ss[fx_down], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_down], 2);
+ kernel_seq_range(seq[fx_down], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_down], KERNEL_TRIGGER_EXPIRE, 0, ROOM_607_DONE_UP);
+
+ } else if (previous_room == 604 || previous_room != KERNEL_RESTORING_GAME) {
+ player.x = PLAYER_X_FROM_606;
+ player.y = PLAYER_Y_FROM_606;
+ player.facing = FACING_NORTH;
+ }
+
+ section_6_music();
}
-void room_607_daemon() {
+static void handle_animation_pour() {
+ int pour_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->pour_frame) {
+ local->pour_frame = kernel_anim[aa[0]].frame;
+ pour_reset_frame = -1;
+
+ switch (local->pour_frame) {
+ case 10:
+ sound_play(N_AcidBurnsFloor);
+ break;
+
+ case 16: /* well into acid pouring onto floor/trapdoor */
+ if (game.difficulty == HARD_MODE) {
+ kernel_seq_delete(seq[fx_hole]);
+
+ } else if (game.difficulty != HARD_MODE) {
+ kernel_seq_delete(seq[fx_trap]);
+ }
+ break;
+
+ case 20:
+ player.walker_visible = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[0]);
+ break;
+ }
+
+ if (pour_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], pour_reset_frame);
+ local->pour_frame = pour_reset_frame;
+ }
+ }
+}
+
+static void room_607_daemon() {
+ if (local->anim_0_running) {
+ handle_animation_pour();
+ }
+
+ if (kernel.trigger == ROOM_607_DONE_UP) {
+ seq[fx_rope] = kernel_seq_stamp(ss[fx_rope], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_rope], 6);
+
+ kernel_synch(KERNEL_SERIES, seq[fx_rope], KERNEL_SERIES, seq[fx_down]);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_down]);
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ }
}
-void room_607_pre_parser() {
+static void room_607_pre_parser() {
+ if (player_said_2(pour_contents_of, floor) ||
+ player_said_2(pour_contents_of, trap_door)) {
+ player_walk(POUR_X, POUR_Y, FACING_SOUTHWEST);
+ }
+ if ((player_said_3(tie, rope, manacles) ||
+ player_said_3(put, rope, manacles)) &&
+ player_has(rope) && global[hole_is_in_607] &&
+ inter_point_x < 50) {
+ player_walk(TIE_X, TIE_Y, FACING_NORTHWEST);
+ }
+
+ if (player_said_2(look, hole)) {
+ player_walk(LOOK_X, LOOK_Y, FACING_SOUTH);
+ }
+
+ if (player_said_2(take, torch) && object_is_here(torch)) {
+ player_walk(TORCH_X, TORCH_Y, FACING_NORTHWEST);
+ }
+
+ if (player_said_2(climb_through, hole) && global[rope_is_hanging_in_607]) {
+ player_walk(DOWN_X, DOWN_Y, FACING_NORTH);
+ }
}
-void room_607_parser() {
+static void room_607_parser() {
+ int count;
+
+ if (player_said_2(take, torch)) {
+ switch (kernel.trigger) {
+ case 0:
+ if (!player_has(torch)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 4, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 2);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take], true);
+ goto handled;
+ }
+ break;
+
+ case 1:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_fire_1]);
+ kernel_flip_hotspot_loc(words_torch, false, TORCH_HS_X, TORCH_HS_Y);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(torch);
+ object_examine(torch, 60728, 0);
+ }
+ local->prevent = true;
+ goto handled;
+ break;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ goto handled;
+ break;
+ }
+ }
+
+ if (player_said_2(pour_contents_of, floor) && global[hole_is_in_607]) {
+ text_show(60743);
+ goto handled;
+
+ } else if ((player_said_2(pour_contents_of, floor) ||
+ player_said_2(pour_contents_of, trap_door)) && !global[hole_is_in_607]) {
+ switch (kernel.trigger) {
+ case 0:
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ local->anim_0_running = true;
+ aa[0] = kernel_run_animation(kernel_name('p', 1), 1);
+ goto handled;
+ break;
+
+ case 1:
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[0]);
+ kernel_flip_hotspot(words_hole, true);
+ kernel_flip_hotspot(words_trap_door, false);
+ kernel_load_variant(1);
+ inter_move_object(flask_full_of_acid, NOWHERE);
+ inter_give_to_player(flask);
+ local->anim_0_running = false;
+ player.commands_allowed = true;
+ global[hole_is_in_607] = true;
+ global[player_score] += 5;
+
+ if (game.difficulty == HARD_MODE) {
+ text_show(60722);
+ } else {
+ if (player_has_been_in_room(609)) {
+ text_show(60724);
+ } else {
+ text_show(60723);
+ }
+ }
+ goto handled;
+ break;
+ }
+ }
+
+ if (player_said_2(look, hole)) {
+ switch (kernel.trigger) {
+ case 0:
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_look] = kernel_seq_pingpong(ss[fx_look], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_look], 2);
+ kernel_seq_range(seq[fx_look], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_look], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_seq_player(seq[fx_look], true);
+ kernel_seq_loc(seq[fx_look], LOOK_X, LOOK_Y + 3);
+ goto handled;
+ break;
+
+ case 1:
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_look]);
+ player.walker_visible = true;
+ player.commands_allowed = true;
+
+ if (game.difficulty == HARD_MODE) {
+ if (player_has(blue_powerstone)) {
+ text_show(60748);
+ } else {
+ text_show(60702);
+ }
+
+ } else {
+ if (player_has(blue_powerstone)) {
+ text_show(60748);
+
+ } else if (player_has_been_in_room(609)) {
+ text_show(60725);
+
+ } else {
+ text_show(60703);
+ }
+ }
+ goto handled;
+ break;
+ }
+ }
+
+ if (player_said_2(climb_through, hole) && global[rope_is_hanging_in_607]) {
+ if (global[torch_is_in_609]) {
+ if (!player_has(blue_powerstone)) {
+ switch (kernel.trigger) {
+ case 0:
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ kernel_seq_delete(seq[fx_rope]);
+ seq[fx_down] = kernel_seq_forward(ss[fx_down], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_down], 2);
+ kernel_seq_range(seq[fx_down], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_down], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ goto handled;
+ break;
+
+ case 1:
+ new_room = 609;
+ goto handled;
+ break;
+ }
+
+ } else {
+ text_show(60745);
+ goto handled;
+ }
+
+ } else {
+ text_show(60747);
+ goto handled;
+ }
+ }
+
+ if ((player_said_3(tie, rope, manacles) ||
+ player_said_3(put, rope, manacles)) && player_has(rope) && !global[hole_is_in_607]) {
+ text_show(60752);
+ goto handled;
+ }
+
+ if ((player_said_3(tie, rope, manacles) ||
+ player_said_3(put, rope, manacles)) && player_has(rope) && global[hole_is_in_607]) {
+ if (inter_point_x < 50) {
+ switch (kernel.trigger) {
+ case 0:
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_tie] = kernel_seq_forward(ss[fx_tie], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_tie], 2);
+ kernel_seq_range(seq[fx_tie], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_tie], KERNEL_TRIGGER_SPRITE, 21, 1);
+ kernel_seq_trigger(seq[fx_tie], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ goto handled;
+ break;
+
+ case 1:
+ seq[fx_rope] = kernel_seq_stamp(ss[fx_rope], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_rope], 5);
+ kernel_flip_hotspot(words_rope, true);
+ goto handled;
+ break;
+
+ case 2:
+ inter_move_object(rope, NOWHERE);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_tie]);
+ kernel_load_variant(2);
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ global[rope_is_hanging_in_607] = true;
+ global[player_score] += 3;
+ text_show(60726);
+
+ for (count = 0; count < room_num_spots; count++) {
+ if (room_spots[count].vocab == words_hole) {
+ room_spots[count].cursor_number = 3;
+ room_spots[count].verb = words_climb_through;
+ }
+ }
+ goto handled;
+ break;
+ }
+
+ } else {
+ text_show(60737);
+ goto handled;
+ /* you dont have enough rope to tie it there */
+ }
+ }
+
+ if (player_said_2(take, rope) && !player_has(rope)) {
+ text_show(60739);
+ goto handled;
+ /* there is no need to take the rope */
+ }
+
+ if (player_said_2(walk_through, door_to_south)) {
+ new_room = 606;
+ goto handled;
+ }
+
+ if (player.look_around) {
+ text_show(60701);
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(torch) && object_is_here(torch)) {
+ text_show(60704);
+ goto handled;
+ }
+
+ if (player_said_1(wall)) {
+ text_show(60705);
+ goto handled;
+ }
+
+ if (player_said_1(manacles)) {
+ text_show(60706);
+ goto handled;
+ }
+
+ if (player_said_1(leg_lock)) {
+ text_show(60707);
+ goto handled;
+ }
+
+ if (player_said_1(neck_lock)) {
+ text_show(60708);
+ goto handled;
+ }
+
+ if (player_said_1(bench)) {
+ text_show(60709);
+ goto handled;
+ }
+
+ if (player_said_1(skeleton)) {
+ text_show(60710);
+ goto handled;
+ }
+
+ if (player_said_1(shaft_of_light)) {
+ text_show(60711);
+ goto handled;
+ }
+
+ if (player_said_1(waist_lock)) {
+ text_show(60712);
+ goto handled;
+ }
+
+ if (player_said_1(window)) {
+ text_show(60713);
+ goto handled;
+ }
+
+ if (player_said_1(door_to_south)) {
+ text_show(60714);
+ goto handled;
+ }
+
+ if (player_said_1(trail_of_green_slime)) {
+ if (game.difficulty == HARD_MODE) {
+ text_show(60715);
+ } else {
+ text_show(60716);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(ceiling)) {
+ text_show(60717);
+ goto handled;
+ }
+
+ if (player_said_1(floor)) {
+ if (global[hole_is_in_607]) {
+ text_show(60751);
+
+ } else if (game.difficulty == HARD_MODE) {
+ text_show(60718);
+
+ } else {
+ text_show(60719);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(trap_door)) {
+ text_show(60720);
+ goto handled;
+ }
+
+ if (player_said_1(rope)) {
+ if (global[rope_is_hanging_in_607]) {
+ text_show(60744);
+ goto handled;
+ }
+ }
+ }
+
+ if (player_said_2(pull, manacles)) {
+ text_show(60721);
+ goto handled;
+ }
+
+ if (player_said_1(open) || player_said_1(close)) {
+ if (player_said_1(leg_lock) || player_said_1(neck_lock) || player_said_1(waist_lock) ||
+ player_said_1(manacles)) {
+ text_show(60729);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(push, bench)) {
+ text_show(60730);
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, skeleton)) {
+ text_show(60731);
+ goto handled;
+ }
+
+ if (player_said_2(give, skeleton)) {
+ if (!player_said_1(bone)) {
+ text_show(60732);
+ goto handled;
+ }
+ }
+
+ if (player_said_3(sword, attack, floor) ||
+ player_said_3(sword, carve_up, floor) ||
+ player_said_3(sword, thrust, floor)) {
+ text_show(60733);
+ goto handled;
+ }
+
+ if (player_said_3(give, bone, skeleton)) {
+ text_show(60734);
+ goto handled;
+ }
+
+ if (player_said_1(hole)) {
+ if (player_said_1(throw) || player_said_1(put)) {
+ text_show(60735);
+ goto handled;
+ }
+ }
+
+ if (player_said_3(put, torch, wall)) {
+ if (player_has(torch)) {
+ text_show(60736);
+ goto handled;
+ }
+ }
+
+ if (player_said_3(sword, attack, rope) ||
+ player_said_3(sword, carve_up, rope) ||
+ player_said_3(sword, thrust, rope)) {
+ if (!player_has(rope)) {
+ text_show(60741);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(open, trap_door)) {
+ text_show(60749);
+ goto handled;
+ }
+
+ if (player_said_2(take, trail_of_green_slime) ||
+ player_said_3(put, trail_of_green_slime, goblet) ||
+ player_said_3(fill, trail_of_green_slime, goblet)) {
+ if (player_has(goblet)) {
+ text_show(60750);
+ goto handled;
+ }
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
}
void room_607_synchronize(Common::Serializer &s) {
}
-void room_607_preload() {
+void room_607_preload(void) {
room_init_code_pointer = room_607_init;
room_pre_parser_code_pointer = room_607_pre_parser;
room_parser_code_pointer = room_607_parser;
room_daemon_code_pointer = room_607_daemon;
+ if (room_id == 609) {
+ global[no_load_walker] = false;
+ }
+
+ if (global[rope_is_hanging_in_607]) {
+ kernel_initial_variant = 2;
+ } else if (global[hole_is_in_607]) {
+ kernel_initial_variant = 1;
+ }
+
section_6_walker();
section_6_interface();
+
+ player.walker_must_reload = true;
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room609.cpp b/engines/mads/madsv2/dragonsphere/rooms/room609.cpp
index 0eda14525be..8b0d1dc169a 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room609.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room609.cpp
@@ -22,7 +22,10 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,6 +42,17 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15]; /* Sprite series handles */
+ int16 sequence[15]; /* Sequence handles */
+ int16 animation[4]; /* Animation handles */
+
+ int16 king_frame; /* animation frame being held for king stuff */
+ int16 anim_0_running;
+
+ int16 down_frame; /* animation frame being held for down stuff */
+ int16 anim_1_running;
+
+ int16 prevent;
};
#define local (&scratch)
@@ -46,22 +60,402 @@ struct Scratch {
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
-void room_609_init() {
+/* ========================= Sprite Series =================== */
+
+#define fx_chunks 0 /* rm609x0 */
+#define fx_torch 1 /* rm609x1 */
+#define fx_stone_gone 2 /* rm609p0 */
+#define fx_death 3 /* rm609a2 */
+#define fx_rope 4 /* rm609x3 */
+
+
+/* ========================= Triggers ======================== */
+
+#define ROOM_609_DONE_TORCH 60
+#define ROOM_609_DONE_WALK 70
+
+
+/* ========================= Other Macros ==================== */
+
+#define PLAYER_X_FROM_606 241
+#define PLAYER_Y_FROM_606 151
+
+#define PLAYER_X_AFTER_TORCH 287
+#define PLAYER_Y_AFTER_TORCH 154
+
+#define DEATH_X 164
+#define DEATH_Y 134
+
+static Scratch scratch;
+
+
+static void room_609_init() {
+ kernel.disable_fastwalk = true;
+ local->prevent = false;
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ }
+
+ if (previous_room != 607) {
+ ss[fx_death] = kernel_load_series(kernel_name('a', 2), false);
+ }
+
+ if (previous_room == 607) {
+ kernel_load_series(kernel_name('a', 3), false);
+ /* to prevent palette fuck up */
+ }
+
+ if (global[rope_is_hanging_in_607] && previous_room != 607) {
+ ss[fx_rope] = kernel_load_series(kernel_name('x', 3), false);
+ seq[fx_rope] = kernel_seq_stamp(ss[fx_rope], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_rope], 1);
+ } else {
+ kernel_flip_hotspot(words_rope, false);
+ }
+
+
+ ss[fx_stone_gone] = kernel_load_series(kernel_name('p', 0), false);
+ ss[fx_torch] = kernel_load_series(kernel_name('y', 9), false);
+
+ if (object_is_here(blue_powerstone)) {
+ seq[fx_stone_gone] = kernel_seq_stamp(ss[fx_stone_gone], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_stone_gone], 1);
+ } else {
+ kernel_flip_hotspot(words_powerstone, false);
+ }
+
+ if (global[torch_is_in_609]) {
+ seq[fx_torch] = kernel_seq_forward(ss[fx_torch], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_torch], 2);
+ kernel_seq_range(seq[fx_torch], KERNEL_FIRST, KERNEL_LAST);
+ }
+
+
+ /* ========================= Previous Rooms ================== */
+
+ if (previous_room == 607) {
+ viewing_at_y = ((video_y - display_y) >> 1);
+ kernel_init_dialog(); /* clear interface */
+ kernel_set_interface_mode(INTER_LIMITED_SENTENCES);
+
+ player.x = 280; /* so death does not come */
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ aa[1] = kernel_run_animation(kernel_name('d', 1), 1);
+ local->anim_1_running = true;
+ kernel_flip_hotspot(words_torch, false);
+
+ } else if (previous_room == 606 || previous_room != KERNEL_RESTORING_GAME) {
+ if (global[torch_is_in_609]) {
+ player.x = PLAYER_X_FROM_606;
+ player.y = PLAYER_Y_FROM_606;
+ player.facing = FACING_NORTH;
+
+ } else {
+ global[torch_is_in_609] = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ aa[0] = kernel_run_animation(kernel_name('t', 1), ROOM_609_DONE_TORCH);
+ local->anim_0_running = true;
+ player.x = PLAYER_X_AFTER_TORCH;
+ player.y = PLAYER_Y_AFTER_TORCH;
+ player.facing = FACING_NORTHWEST;
+ }
+ }
}
-void room_609_daemon() {
+static void handle_animation_king() {
+ int king_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->king_frame) {
+ local->king_frame = kernel_anim[aa[0]].frame;
+ king_reset_frame = -1;
+
+ switch (local->king_frame) {
+ case 21:
+ seq[fx_torch] = kernel_seq_forward(ss[fx_torch], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_torch], 2);
+ kernel_seq_range(seq[fx_torch], KERNEL_FIRST, KERNEL_LAST);
+ inter_move_object(torch, 509);
+ break;
+ }
+ if (king_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], king_reset_frame);
+ local->king_frame = king_reset_frame;
+ }
+ }
}
-void room_609_pre_parser() {
+static void handle_animation_down() {
+ int down_reset_frame;
+
+ if (kernel_anim[aa[1]].frame != local->down_frame) {
+ local->down_frame = kernel_anim[aa[1]].frame;
+ down_reset_frame = -1;
+
+ switch (local->down_frame) {
+ case 45:
+ kernel_seq_delete(seq[fx_stone_gone]);
+ kernel_flip_hotspot(words_powerstone, false);
+ global[player_score] += 5;
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(blue_powerstone);
+ object_examine(blue_powerstone, 60922, 0);
+ break;
+ }
+ if (down_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], down_reset_frame);
+ local->down_frame = down_reset_frame;
+ }
+ }
}
-void room_609_parser() {
+static void room_609_daemon() {
+ if (local->anim_0_running) {
+ handle_animation_king();
+ }
+
+ if (local->anim_1_running) {
+ handle_animation_down();
+ }
+
+ if (kernel.trigger == ROOM_609_DONE_TORCH) {
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[0]);
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->anim_0_running = false;
+ }
+
+ if (kernel.trigger == 1) {
+ kernel_abort_animation(aa[1]);
+ local->anim_1_running = false;
+ aa[2] = kernel_run_animation(kernel_name('u', 1), 2);
+ kernel_synch(KERNEL_ANIM, aa[2], KERNEL_NOW, 0);
+ }
+
+ if (kernel.trigger == 2) {
+ new_room = 607;
+ }
+ if (player.special_code > 0) {
+ if (!local->prevent) {
+ player.commands_allowed = false;
+ local->prevent = true;
+ player_walk(DEATH_X, DEATH_Y, FACING_WEST);
+ player_walk_trigger(ROOM_609_DONE_WALK);
+ /* error_watch_point ("you're dead", kernel.trigger, kernel.trigger); */
+ }
+ }
+
+ if (kernel.trigger == ROOM_609_DONE_WALK) {
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ seq[fx_death] = kernel_seq_forward(ss[fx_death], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_death], 1);
+ kernel_seq_range(seq[fx_death], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_EXPIRE, 0, ROOM_609_DONE_WALK + 1);
+ kernel_seq_trigger(seq[fx_death], KERNEL_TRIGGER_SPRITE, 25, ROOM_609_DONE_WALK + 2);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_death]);
+ sound_play(N_MeltInGlowingFloor);
+ }
+
+ if (kernel.trigger == ROOM_609_DONE_WALK + 1) {
+ if (game.difficulty == EASY_MODE) {
+ text_show(60931);
+ } else {
+ text_show(45);
+ }
+ kernel.force_restart = true;
+ }
+
+ if (kernel.trigger == ROOM_609_DONE_WALK + 2) {
+ sound_play(N_PlayerDies);
+ }
+}
+
+static void room_609_pre_parser() {
+ if (player_said_1(pedestal) || (player_said_1(powerstone) && object_is_here(blue_powerstone))) {
+ if (game.difficulty == EASY_MODE) {
+ if (player_said_1(take) || player_said_1(push) ||
+ player_said_1(pull) || player_said_1(put) ||
+ player_said_1(open) || player_said_1(close)) {
+ text_show(60911);
+ player_cancel_command();
+ }
+
+ } else if (player_said_1(push) ||
+ player_said_1(pull) || player_said_1(put) ||
+ player_said_1(open) || player_said_1(close)) {
+ text_show(60911);
+ player_cancel_command();
+ }
+ }
+
+ if (player_said_1(take_magic_from)) {
+ player.need_to_walk = false;
+ }
+}
+
+static void room_609_parser() {
+ if (local->prevent) {
+ goto handled;
+ }
+
+ if (player_said_2(walk_through, doorway_to_south)) {
+ new_room = 606;
+ goto handled;
+ }
+
+ if (player.look_around) {
+ if (global[rope_is_hanging_in_607]) {
+ text_show(60903);
+ } else if (global[hole_is_in_607]) {
+ text_show(60902);
+ } else {
+ text_show(60901);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+
+ if (player_said_1(floor)) {
+ text_show(60905);
+ goto handled;
+ }
+
+ if (player_said_1(glowing_floor)) {
+ text_show(60906);
+ goto handled;
+ }
+
+ if (player_said_1(pedestal)) {
+ if (object_is_here(blue_powerstone)) {
+ text_show(60909);
+ } else {
+ text_show(60910);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(large_spider_web)) {
+ text_show(60915);
+ goto handled;
+ }
+
+ if (player_said_1(trail_of_green_slime)) {
+ if (game.difficulty == HARD_MODE) {
+ text_show(60918);
+ } else {
+ text_show(60917);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(doorway_to_south)) {
+ text_show(60919);
+ goto handled;
+ }
+
+ if (player_said_1(wall)) {
+ text_show(60920);
+ goto handled;
+ }
+
+ if (player_said_1(powerstone)) {
+ if (object_is_here(blue_powerstone)) {
+ text_show(60921);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(torch)) {
+ text_show(60929);
+ goto handled;
+ }
+
+ if (player_said_1(rope)) {
+ text_show(60903);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(glowing_floor)) {
+ if (player_said_1(put) || player_said_1(throw)) {
+ text_show(60907);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(pour_contents_of, glowing_floor)) {
+ text_show(60908);
+ goto handled;
+ }
+
+ if (player_said_1(pedestal) || (player_said_1(blue_powerstone) && object_is_here(blue_powerstone))) {
+ if (player_said_1(throw)) {
+ if (player_said_1(shieldstone)) {
+ text_show(60913);
+ } else if (player_said_1(teleport_door)) {
+ text_show(60914);
+ } else {
+ text_show(60912);
+ }
+ goto handled;
+ }
+ }
+
+ if (player_said_1(large_spider_web)) {
+ if (!player_said_1(walk_to)) {
+ text_show(60916);
+ goto handled;
+ }
+ }
+
+ /* if (player_said_1 (throw)) {
+ if (player_said_1 (hole_in_ceiling) || player_said_1 (hole_in_trapdoor)) {
+ text_show (60926);
+ goto handled;
+ }
+ }
+ */
+
+ if (player_said_2(take, rope)) {
+ if (global[rope_is_hanging_in_607]) {
+ text_show(60928);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(throw, rope)) {
+ if (player_said_1(pedestal) || (player_said_1(blue_powerstone) && object_is_here(blue_powerstone))) {
+ text_show(60927);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(take, torch)) {
+ text_show(60930);
+ goto handled;
+ }
+
+ if (player_said_2(take_magic_from, glowing_floor)) {
+ text_show(963);
+ goto handled;
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
}
void room_609_synchronize(Common::Serializer &s) {
@@ -74,8 +468,14 @@ void room_609_preload() {
room_parser_code_pointer = room_609_parser;
room_daemon_code_pointer = room_609_daemon;
+ if (room_id == 607) {
+ global[no_load_walker] = true;
+ }
+
section_6_walker();
section_6_interface();
+
+ player.walker_must_reload = true;
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room612.cpp b/engines/mads/madsv2/dragonsphere/rooms/room612.cpp
index 335a9cb9f59..688cf5db454 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room612.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room612.cpp
@@ -22,6 +22,7 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
@@ -39,6 +40,15 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15]; /* Sprite series handles */
+ int16 sequence[15]; /* Sequence handles */
+ int16 animation[4]; /* Animation handles */
+ int16 last_arc;
+
+ int16 tele_frame; /* animation frame being held for tele stuff */
+ int16 anim_0_running;
+
+ int16 count;
};
#define local (&scratch)
@@ -46,22 +56,378 @@ struct Scratch {
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
-void room_612_init() {
+/* ========================= Sprite Series =================== */
+
+#define fx_gear_1 0 /* rm612x4 */
+#define fx_gear_2 1 /* rm612x5 */
+#define fx_ghost_1 2 /* rm612x1 */
+#define fx_ghost_2 3 /* rm612x2 */
+#define fx_ghost_3 4 /* rm612x3 */
+#define fx_ladder 5 /* rm612x0 */
+#define fx_arc 6 /* rm612x6 */
+#define fx_sparkle 7 /* rm612x7 */
+#define fx_fire_1 8 /* rm612y0 */
+#define fx_fire_2 9 /* rm612y1 */
+#define fx_fire_3 10 /* rm612y2 */
+#define fx_fire_4 11 /* rm612y3 */
+
+/* ========================= Triggers ======================== */
+
+#define CLANK 60
+
+/* ========================= Other Macros ==================== */
+
+#define PLAYER_X_FROM_606 137
+#define PLAYER_Y_FROM_606 151
+
+#define PLAYER_BEGIN_X 65
+#define PLAYER_BEGIN_Y 149
+
+#define PLAYER_END_X 73
+#define PLAYER_END_Y 153
+
+static Scratch scratch;
+
+
+static void room_612_init() {
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ }
+
+ local->count = 0;
+
+ /* ===================== Load Sprite Series ================== */
+
+ ss[fx_fire_1] = kernel_load_series(kernel_name('y', 0), false);
+ ss[fx_fire_2] = kernel_load_series(kernel_name('y', 1), false);
+ ss[fx_fire_3] = kernel_load_series(kernel_name('y', 2), false);
+ ss[fx_fire_4] = kernel_load_series(kernel_name('y', 3), false);
+
+ seq[fx_fire_1] = kernel_seq_forward(ss[fx_fire_1], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_1], 12);
+ kernel_seq_range(seq[fx_fire_1], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_2] = kernel_seq_forward(ss[fx_fire_2], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_2], 12);
+ kernel_seq_range(seq[fx_fire_2], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_3] = kernel_seq_forward(ss[fx_fire_3], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_3], 12);
+ kernel_seq_range(seq[fx_fire_3], KERNEL_FIRST, KERNEL_LAST);
+ seq[fx_fire_4] = kernel_seq_forward(ss[fx_fire_4], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_4], 12);
+ kernel_seq_range(seq[fx_fire_4], KERNEL_FIRST, KERNEL_LAST);
+
+
+ ss[fx_gear_1] = kernel_load_series(kernel_name('x', 4), false);
+ ss[fx_gear_2] = kernel_load_series(kernel_name('x', 5), false);
+ ss[fx_ghost_1] = kernel_load_series(kernel_name('x', 1), false);
+ ss[fx_ghost_2] = kernel_load_series(kernel_name('x', 2), false);
+ ss[fx_ghost_3] = kernel_load_series(kernel_name('x', 3), false);
+ ss[fx_ladder] = kernel_load_series(kernel_name('x', 0), false);
+ ss[fx_arc] = kernel_load_series(kernel_name('x', 6), false);
+ ss[fx_sparkle] = kernel_load_series(kernel_name('x', 7), false);
+
+ seq[fx_arc] = kernel_seq_stamp(ss[fx_arc], false, 1);
+ kernel_seq_depth(seq[fx_arc], 10);
+ kernel_timing_trigger(7, 10); /* activate arcs */
+
+ kernel_timing_trigger(imath_random(100, 500), 1); /* activate ghosts */
+ kernel_timing_trigger(imath_random(100, 500), 3);
+ kernel_timing_trigger(imath_random(100, 500), 5);
+
+ kernel_timing_trigger(1, 7); /* activate jacob's ladder */
+
+ seq[fx_sparkle] = kernel_seq_forward(ss[fx_sparkle], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_sparkle], 10);
+ kernel_seq_range(seq[fx_sparkle], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_gear_1] = kernel_seq_forward(ss[fx_gear_1], false, 8, 0, 0, 0);
+ kernel_seq_depth(seq[fx_gear_1], 10);
+ kernel_seq_range(seq[fx_gear_1], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_gear_2] = kernel_seq_forward(ss[fx_gear_2], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_gear_2], 10);
+ kernel_seq_range(seq[fx_gear_2], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_gear_2], KERNEL_TRIGGER_SPRITE, 2, CLANK);
+
+
+ /* ========================= Previous Rooms ================== */
+
+ if (previous_room == 613) { /* return from flood of 613 */
+ player.x = PLAYER_END_X;
+ player.y = PLAYER_END_Y;
+ player.facing = FACING_EAST;
+ local->anim_0_running = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ aa[0] = kernel_run_animation(kernel_name('w', 1), 0);
+ kernel_reset_animation(aa[0], 37);
+
+ } else if ((previous_room == 606) || (previous_room != KERNEL_RESTORING_GAME)) {
+ player.x = PLAYER_X_FROM_606;
+ player.y = PLAYER_Y_FROM_606;
+ player.facing = FACING_NORTH;
+ }
+
+ section_6_music();
}
-void room_612_daemon() {
+static void handle_animation_tele() {
+ int tele_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->tele_frame) {
+ local->tele_frame = kernel_anim[aa[0]].frame;
+ tele_reset_frame = -1;
+
+ switch (local->tele_frame) {
+ case 21: /* start of putting up teleporter door */
+ inter_move_object(teleport_door, NOWHERE);
+ global[player_score] += 5;
+ break;
+
+ case 36: /* end of putting up teleporter door in window */
+ new_room = 613;
+ break;
+
+ case 37:
+ ++local->count;
+ if (local->count < 10) {
+ tele_reset_frame = 36;
+ }
+ break;
+
+ case 56: /* just after teleporter falls out window */
+ text_show(61206);
+ break;
+ case 86: /* end of walking out of water */
+ kernel_abort_animation(aa[0]);
+ tele_reset_frame = -1;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ break;
+ }
+
+ if (tele_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], tele_reset_frame);
+ local->tele_frame = tele_reset_frame;
+ }
+ }
}
-void room_612_pre_parser() {
+static void room_612_daemon() {
+ int tmp;
+
+ if (local->anim_0_running) {
+ handle_animation_tele();
+ }
+
+ switch (kernel.trigger) {
+ case 1:
+ seq[fx_ghost_1] = kernel_seq_forward(ss[fx_ghost_1], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ghost_1], 10);
+ kernel_seq_range(seq[fx_ghost_1], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_ghost_1], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ sound_play(N_MachineMist);
+ break;
+
+ case 2:
+ kernel_timing_trigger(imath_random(250, 500), 1);
+ break;
+ }
+
+ switch (kernel.trigger) {
+ case 3:
+ seq[fx_ghost_2] = kernel_seq_forward(ss[fx_ghost_2], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ghost_2], 10);
+ kernel_seq_range(seq[fx_ghost_2], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_ghost_2], KERNEL_TRIGGER_EXPIRE, 0, 4);
+ sound_play(N_MachineMist);
+ break;
+
+ case 4:
+ kernel_timing_trigger(imath_random(250, 500), 3);
+ break;
+ }
+
+ switch (kernel.trigger) {
+ case 5:
+ seq[fx_ghost_3] = kernel_seq_forward(ss[fx_ghost_3], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ghost_3], 10);
+ kernel_seq_range(seq[fx_ghost_3], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_ghost_3], KERNEL_TRIGGER_EXPIRE, 0, 6);
+ sound_play(N_MachineMist);
+ break;
+
+ case 6:
+ kernel_timing_trigger(imath_random(250, 500), 5);
+ break;
+ }
+
+ switch (kernel.trigger) {
+ case 7:
+ seq[fx_ladder] = kernel_seq_forward(ss[fx_ladder], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ladder], 10);
+ kernel_seq_range(seq[fx_ladder], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_ladder], KERNEL_TRIGGER_EXPIRE, 0, 8);
+ sound_play(N_MachineZap);
+ break;
+ case 8:
+ kernel_timing_trigger(imath_random(10, 25), 7);
+ break;
+ }
+
+ switch (kernel.trigger) {
+ case 10:
+ kernel_seq_delete(seq[fx_arc]);
+ tmp = imath_random(1, 3);
+ while (tmp == local->last_arc) {
+ tmp = imath_random(1, 3);
+ }
+ local->last_arc = tmp;
+ seq[fx_arc] = kernel_seq_stamp(ss[fx_arc], false, local->last_arc);
+ kernel_seq_depth(seq[fx_arc], 10);
+ kernel_timing_trigger(7, 10);
+ break;
+ }
+
+ if (kernel.trigger == CLANK) {
+ sound_play(N_MachineClank);
+ }
}
-void room_612_parser() {
+static void room_612_pre_parser() {
+ if (player_said_3(put, teleport_door, window) ||
+ player_said_3(put, teleport_door, water_source) ||
+ player_said_3(put, teleport_door, water_flow)) {
+ player_walk(PLAYER_BEGIN_X, PLAYER_BEGIN_Y, FACING_NORTHWEST);
+ }
+}
+
+static void room_612_parser() {
+ if (player_said_3(put, teleport_door, window) ||
+ player_said_3(put, teleport_door, water_source) ||
+ player_said_3(put, teleport_door, water_flow)) {
+ local->anim_0_running = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ aa[0] = kernel_run_animation(kernel_name('w', 1), 0);
+ kernel_synch(KERNEL_ANIM, aa[0], KERNEL_PLAYER, 0);
+ player_demand_location(PLAYER_END_X, PLAYER_END_Y);
+ player_demand_facing(FACING_EAST);
+ goto handled;
+ }
+
+ if (player_said_2(walk_through, doorway_to_south)) {
+ new_room = 606;
+ goto handled;
+ }
+
+ if (player.look_around) {
+ text_show(61201);
+ goto handled;
+ }
+
+ if (player_said_2(take_magic_from, infernal_machine)) {
+ text_show(963);
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(floor)) {
+ text_show(61202);
+ goto handled;
+ }
+
+ if (player_said_1(window)) {
+ text_show(61203);
+ goto handled;
+ }
+ if (player_said_1(water_flow) || player_said_1(water_source)) {
+ text_show(61209);
+ goto handled;
+ }
+
+ if (player_said_1(doorway_to_south)) {
+ text_show(61212);
+ goto handled;
+ }
+
+ if (player_said_1(infernal_machine)) {
+ text_show(61213);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(window)) {
+ if (player_said_1(open) || player_said_1(close)) {
+ text_show(61204);
+ goto handled;
+
+ } else if (player_said_1(put)) {
+ text_show(61207);
+ goto handled;
+
+ } else if (player_said_1(throw)) {
+ text_show(61208);
+ goto handled;
+ }
+ }
+
+ if (player_said_3(fill, goblet, water_source) ||
+ player_said_3(fill, goblet, water_flow) ||
+ player_said_3(put, goblet, water_source) ||
+ player_said_3(put, goblet, water_flow)) {
+ text_show(61218);
+ goto handled;
+ }
+
+ if (player_said_2(put, water_flow) ||
+ player_said_2(put, water_source)) {
+ text_show(61211);
+ goto handled;
+ }
+
+ if (player_said_1(water_source)) {
+ if (player_said_1(push) || player_said_1(pull)) {
+ text_show(61210);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(infernal_machine)) {
+ if (player_said_1(open) || player_said_1(close)) {
+ text_show(61214);
+ goto handled;
+
+ } else if (player_said_1(push) || player_said_1(pull)) {
+ text_show(61215);
+ goto handled;
+
+ } else if (player_said_1(throw) || player_said_1(put)) {
+ text_show(61217);
+ goto handled;
+
+ } else if (player_said_1(talk_to)) {
+ text_show(61216);
+ goto handled;
+ }
+ }
+
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
}
void room_612_synchronize(Common::Serializer &s) {
@@ -76,6 +442,8 @@ void room_612_preload() {
section_6_walker();
section_6_interface();
+
+ player.walker_must_reload = true;
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room613.cpp b/engines/mads/madsv2/dragonsphere/rooms/room613.cpp
index 3e109ecdec4..6e8b04e9203 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room613.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room613.cpp
@@ -19,10 +19,13 @@
*
*/
+#include "mads/madsv2/core/camera.h"
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,6 +42,15 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15]; /* Sprite series handles */
+ int16 sequence[15]; /* Sequence handles */
+ int16 animation[4]; /* Animation handles */
+
+ int16 water_frame; /* animation frame being held for water stuff */
+ int16 anim_0_running;
+
+ int16 old_x;
+ int16 old_y;
};
#define local (&scratch)
@@ -46,22 +58,360 @@ struct Scratch {
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+/* ========================= Sprite Series =================== */
+
+#define fx_fire_1 0 /* rm613x1 */
+#define fx_fire_2 1 /* rm613x2 */
+#define fx_fire_3 2 /* rm613x3 */
+#define fx_fire_4 3 /* rm613x4 */
+#define fx_fire_5 4 /* rm613x5 */
+#define fx_fire_6 5 /* rm613x6 */
+#define fx_left_coal 6 /* rm613c0 */
+#define fx_right_coal 7 /* rm613c1 */
+#define fx_king_melt 8 /* rm613a1 */
+#define fx_door 9 /* rm613x0 */
+
+/* ========================= Triggers ======================== */
+
+
+
+/* ========================= Other Macros ==================== */
+
+#define PLAYER_X_FROM_606 25
+#define PLAYER_Y_FROM_606 132
+#define WALK_TO_X_FROM_606 61
+#define WALK_TO_Y_FROM_606 132
+
+#define PLAYER_X_FROM_614 613
+#define PLAYER_Y_FROM_614 132
+#define WALK_TO_X_FROM_614 578
+#define WALK_TO_Y_FROM_614 132
+
+#define RIGHT_HALF 320
+
+static Scratch scratch;
+
+
+static void room_613_init() {
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ }
+
+ ss[fx_fire_1] = kernel_load_series(kernel_name('x', 1), false);
+ ss[fx_fire_2] = kernel_load_series(kernel_name('x', 2), false);
+ ss[fx_fire_3] = kernel_load_series(kernel_name('x', 3), false);
+ ss[fx_fire_4] = kernel_load_series(kernel_name('x', 4), false);
+ ss[fx_fire_5] = kernel_load_series(kernel_name('x', 5), false);
+ ss[fx_fire_6] = kernel_load_series(kernel_name('x', 6), false);
+
+ seq[fx_fire_1] = kernel_seq_forward(ss[fx_fire_1], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_1], 1);
+ kernel_seq_range(seq[fx_fire_1], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_2] = kernel_seq_forward(ss[fx_fire_2], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_2], 1);
+ kernel_seq_range(seq[fx_fire_2], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_3] = kernel_seq_forward(ss[fx_fire_3], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_3], 1);
+ kernel_seq_range(seq[fx_fire_3], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_4] = kernel_seq_forward(ss[fx_fire_4], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_4], 1);
+ kernel_seq_range(seq[fx_fire_4], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_5] = kernel_seq_forward(ss[fx_fire_5], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_5], 1);
+ kernel_seq_range(seq[fx_fire_5], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_fire_6] = kernel_seq_forward(ss[fx_fire_6], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_fire_6], 1);
+ kernel_seq_range(seq[fx_fire_6], KERNEL_FIRST, KERNEL_LAST);
+
+
+
+ /* ========================= Previous Rooms ================== */
+
+ if (previous_room == 612) {
+
+ camera_x.pan_mode = CAMERA_MANUAL;
+ viewing_at_y = ((video_y - display_y) >> 1);
+
+ aa[0] = kernel_run_animation(kernel_name('w', 1), 0);
+ global[floor_is_cool] = true;
+ local->anim_0_running = true;
+ player.walker_visible = false;
+ player.commands_allowed = false;
+
+ } else if (previous_room == 614) {
+ player.x = WALK_TO_X_FROM_614;
+ player.y = WALK_TO_Y_FROM_614;
+ player.facing = FACING_EAST;
+ camera_jump_to(RIGHT_HALF, 0);
+
+ if (global[has_red]) inter_give_to_player(red_powerstone);
+ if (global[has_yellow]) inter_give_to_player(yellow_powerstone);
+ if (global[has_blue]) inter_give_to_player(blue_powerstone);
+ if (global[object_imitated] >= 0) inter_give_to_player(polystone);
+
+ ss[fx_left_coal] = kernel_load_series(kernel_name('c', 0), false);
+ seq[fx_left_coal] = kernel_seq_stamp(ss[fx_left_coal], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_left_coal], 14);
+
+ ss[fx_right_coal] = kernel_load_series(kernel_name('c', 1), false);
+ seq[fx_right_coal] = kernel_seq_stamp(ss[fx_right_coal], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_right_coal], 14);
+
+ } else if ((previous_room == 606) || (previous_room != KERNEL_RESTORING_GAME)) {
+
+ if (global[floor_is_cool]) {
+ ss[fx_left_coal] = kernel_load_series(kernel_name('c', 0), false);
+ seq[fx_left_coal] = kernel_seq_stamp(ss[fx_left_coal], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_left_coal], 14);
+
+ ss[fx_right_coal] = kernel_load_series(kernel_name('c', 1), false);
+ seq[fx_right_coal] = kernel_seq_stamp(ss[fx_right_coal], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_right_coal], 14);
+
+ player_first_walk(PLAYER_X_FROM_606, PLAYER_Y_FROM_606, FACING_EAST,
+ WALK_TO_X_FROM_606, WALK_TO_Y_FROM_606, FACING_EAST, true);
+
+ } else {
+
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ local->old_x = player.x;
+ local->old_y = player.y;
+ player.x = 50;
+
+ if (player_has(teleport_door)) {
+ kernel_timing_trigger(HALF_SECOND, 4);
+
+ } else if (!global[rat_melted] && global[rat_cage_is_open]) {
+ viewing_at_y = ((video_y - display_y) >> 1);
+ kernel_timing_trigger(HALF_SECOND, 3);
+ global[rat_melted] = true;
-void room_613_init() {
+ } else {
+ viewing_at_y = ((video_y - display_y) >> 1);
+ ss[fx_king_melt] = kernel_load_series(kernel_name('a', 1), false);
+ kernel_timing_trigger(HALF_SECOND, 2);
+ }
+ if (!player_has(teleport_door)) {
+ ss[fx_door] = kernel_load_series(kernel_name('x', 0), false);
+ seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_door], 3);
+ }
+ }
+
+ } else { /* RESTORING GAME */
+ ss[fx_left_coal] = kernel_load_series(kernel_name('c', 0), false);
+ seq[fx_left_coal] = kernel_seq_stamp(ss[fx_left_coal], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_left_coal], 14);
+
+ ss[fx_right_coal] = kernel_load_series(kernel_name('c', 1), false);
+ seq[fx_right_coal] = kernel_seq_stamp(ss[fx_right_coal], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_right_coal], 14);
+ }
+
+ section_6_music();
}
-void room_613_daemon() {
+static void handle_animation_water() {
+ int water_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->water_frame) {
+ local->water_frame = kernel_anim[aa[0]].frame;
+ water_reset_frame = -1;
+
+ switch (local->water_frame) {
+ case 39: /* end of steam at left screen */
+ camera_pan_to(&camera_x, 320);
+ break;
+
+ case 90: /* end of anim */
+ if (camera_x.panning) {
+ water_reset_frame = 70;
+
+ } else {
+ camera_x.pan_mode = CAMERA_PLAYER;
+ global[no_load_walker] = false;
+ new_room = 612;
+ }
+ break;
+ }
+
+ if (water_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], water_reset_frame);
+ local->water_frame = water_reset_frame;
+ }
+ }
}
-void room_613_pre_parser() {
+static void room_613_daemon() {
+ if (local->anim_0_running) {
+ handle_animation_water();
+ }
+
+ switch (kernel.trigger) {
+ case 1:
+ player.x = local->old_x;
+ player.y = local->old_y;
+ new_room = 606;
+ break;
+
+ case 10:
+ /* if (game.difficulty == EASY_MODE) { */
+ /* text_show (61316); */
+ /* } */
+ player.x = local->old_x;
+ player.y = local->old_y;
+ new_room = 606;
+ break;
+ case 2:
+ seq[fx_king_melt] = kernel_seq_forward(ss[fx_king_melt], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_king_melt], 3);
+ kernel_seq_range(seq[fx_king_melt], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_king_melt], KERNEL_TRIGGER_SPRITE, 46, 5);
+ kernel_seq_trigger(seq[fx_king_melt], KERNEL_TRIGGER_SPRITE, 3, 6);
+ kernel_seq_trigger(seq[fx_king_melt], KERNEL_TRIGGER_EXPIRE, 0, 10);
+ break;
+
+ case 3:
+ aa[0] = kernel_run_animation(kernel_name('r', 1), 1);
+ break;
+
+ case 4:
+ aa[0] = kernel_run_animation(kernel_name('k', 1), 1);
+ break;
+
+ case 5:
+ sound_play(N_MeltInHotRoom);
+ break;
+
+ case 6:
+ sound_play(N_AppearInHotRoom);
+ break;
+ }
}
-void room_613_parser() {
+static void room_613_pre_parser() {
+ if (player_said_1(doorway_to_west) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+ if (player_said_1(dragon_door) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+}
+
+static void room_613_parser() {
+ if (player_said_2(walk_through, doorway_to_west)) {
+ new_room = 606;
+ goto handled;
+ }
+
+ if (player_said_2(walk_through, dragon_door)) {
+ new_room = 614;
+ goto handled;
+ }
+
+ if (player.look_around) {
+ text_show(61301);
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(remains)) {
+ text_show(61302);
+ goto handled;
+ }
+
+ if (player_said_1(window)) {
+ text_show(61306);
+ goto handled;
+ }
+
+ if (player_said_1(iron_floor)) {
+ text_show(61309);
+ goto handled;
+ }
+
+ if (player_said_1(dragon_bones)) {
+ text_show(61312);
+ goto handled;
+ }
+
+ if (player_said_1(doorway_to_west)) {
+ text_show(61314);
+ goto handled;
+ }
+
+ if (player_said_1(dragon_door)) {
+ text_show(61315);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(take, remains)) {
+ text_show(61303);
+ goto handled;
+ }
+
+ if (player_said_2(push, remains)) {
+ text_show(61304);
+ goto handled;
+ }
+
+ if (player_said_2(put_magic_into, remains)) {
+ text_show(61305);
+ goto handled;
+ }
+
+ if (player_said_2(open, window) ||
+ player_said_2(close, window)) {
+ text_show(61307);
+ goto handled;
+ }
+
+ if (player_said_2(put, window) ||
+ player_said_2(throw, window)) {
+ text_show(61308);
+ goto handled;
+ }
+
+ if (player_said_2(open, iron_floor) ||
+ player_said_2(close, iron_floor)) {
+ text_show(61310);
+ goto handled;
+ }
+
+ if (player_said_2(put, iron_floor)) {
+ text_show(61311);
+ goto handled;
+ }
+
+ if (player_said_2(take, dragon_bones) ||
+ player_said_2(push, dragon_bones) ||
+ player_said_2(pull, dragon_bones)) {
+ text_show(61313);
+ goto handled;
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
}
void room_613_synchronize(Common::Serializer &s) {
@@ -74,8 +424,14 @@ void room_613_preload() {
room_parser_code_pointer = room_613_parser;
room_daemon_code_pointer = room_613_daemon;
+ if (room_id == 612) {
+ global[no_load_walker] = true;
+ }
+
section_6_walker();
section_6_interface();
+
+ player.walker_must_reload = true;
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room614.cpp b/engines/mads/madsv2/dragonsphere/rooms/room614.cpp
index 4c1ce3f1f94..afabd081df7 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room614.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room614.cpp
@@ -22,7 +22,10 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,6 +42,55 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[19]; /* Sprite series handles */
+ int16 sequence[19]; /* Sequence handles */
+ int16 animation[8]; /* Animation handles */
+
+ int16 prevent;
+ int16 doofus;
+ int16 stone_taking_count;
+
+ int16 king_enter_frame; /* animation frame being held for king_enter stuff */
+ int16 king_enter_action; /* Type of action to run for king_enter animation */
+ int16 king_enter_talk_count; /* counter for king_enter talking */
+ int16 anim_0_running;
+
+ int16 king_float_frame; /* animation frame being held for king_float stuff */
+ int16 king_float_action; /* Type of action to run for king_float animation */
+ int16 king_float_talk_count; /* counter for king_float talking */
+ int16 anim_1_running;
+
+ int16 pid_float_frame; /* animation frame being held for pid_float stuff */
+ int16 pid_float_action; /* Type of action to run for pid_float animation */
+ int16 pid_float_talk_count; /* counter for pid_float talking */
+ int16 anim_2_running;
+
+ int16 wiz_float_frame; /* animation frame being held for wiz_float stuff */
+ int16 wiz_float_action; /* Type of action to run for wiz_float animation */
+ int16 wiz_float_talk_count; /* counter for wiz_float talking */
+ int16 anim_3_running;
+
+ int16 wiz_zap_frame; /* animation frame being held for wiz_zap stuff */
+ int16 wiz_zap_action; /* Type of action to run for wiz_zap animation */
+ int16 anim_4_running;
+
+ int16 wiz_murder_frame; /* animation frame being held for wiz_murder stuff */
+ int16 wiz_murder_action; /* Type of action to run for wiz_murder animation */
+ int16 anim_5_running;
+
+ int16 wiz_ice_frame; /* animation frame being held for wiz_ice stuff */
+ int16 wiz_ice_action; /* Type of action to run for wiz_ice animation */
+ int16 anim_6_running;
+
+ int16 wiz_end_frame; /* animation frame being held for wiz_end stuff */
+ int16 wiz_end_action; /* Type of action to run for wiz_end animation */
+ int16 anim_7_running;
+
+ long clock;
+ long death_timer; /* when this counter reaches max sec, kill pid */
+ int16 activate_timer; /* If T, will start counting death_timer */
+
+ int16 did_not_throw;
};
#define local (&scratch)
@@ -46,22 +98,1734 @@ struct Scratch {
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
-void room_614_init() {
+/* ========================= Sprite Series =================== */
+
+#define fx_bundle 0 /* rm614p1 */
+#define fx_ball 1 /* rm614p0 */
+#define fx_map 2 /* rm614p2 */
+#define fx_take 3 /* @kgrd_7 */
+#define fx_take_high 4 /* @kgrh_9 */
+#define fx_power_ball 5 /* rm614x9 */
+#define fx_atom_1 6 /* rm614y0 */
+#define fx_atom_2 7 /* rm614y1 */
+#define fx_atom_3 8 /* rm614y2 */
+#define fx_atom_4 9 /* rm614y3 */
+#define fx_stone_to_wiz 10 /* rm614x6 */
+#define fx_stone_to_sphere 11 /* rm614x5 */
+#define fx_ball_fly_1 12 /* rm614z2 */
+#define fx_ball_fly_2 13 /* rm614z3 */
+#define fx_ball_fly_3 14 /* rm614z4 */
+#define fx_ball_fly_4 15 /* rm614z5 */
+#define fx_single_ball 16 /* rm614z6 */
+#define fx_sphere_base 17 /* rm614z7 */
+
+
+/* ========================= Triggers ======================== */
+
+#define ROOM_614_ME_TALK 60
+#define ROOM_614_YOU_TALK 62
+#define ROOM_614_DONE_ZAPPING 64
+#define ROOM_614_STONE_TO_WIZ 68
+#define ROOM_614_STAMP_BALL 75
+
+
+/* ========================= Other Macros ==================== */
+
+#define CONV_31_WIZARD 31
+#define CONV_32_WIZARD 32
+
+#define PLAYER_X_FROM_613 0
+#define PLAYER_Y_FROM_613 104
+
+#define WALK_TO_X_FROM_613 37
+#define WALK_TO_Y_FROM_613 105
+
+#define BALL_X 179
+#define BALL_Y 109
+
+#define LENGTH_OF_LIFE 1300
+
+#define FLOAT_UP 0
+#define TALK 1
+#define FREEZE 2
+#define MORPH 3
+#define THROW 4
+#define DIE 5
+#define RELEASE 6
+#define UNCOVER_EYES 7
+#define RAISE_KING 8
+#define HAND_CHIN 9
+#define KILL_PID 10
+#define WAITING_FOR_STONE 11
+#define ICE_UP 12
+#define BACK_TO_CAMERA 13
+#define TURN_TO_PID 14
+
+#define CIRCLE_X 256
+#define CIRCLE_Y 61
+
+static Scratch scratch;
+
+
+static void room_614_init() {
+ if (player_has(red_powerstone)) global[has_red] = true;
+ if (player_has(yellow_powerstone)) global[has_yellow] = true;
+ if (player_has(blue_powerstone)) global[has_blue] = true;
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ local->anim_2_running = false;
+ local->anim_3_running = false;
+ local->anim_4_running = false;
+ local->anim_5_running = false;
+ local->anim_6_running = false;
+ local->anim_7_running = false;
+ local->death_timer = 0;
+ local->clock = 0;
+ local->activate_timer = false;
+ local->doofus = false;
+ local->did_not_throw = true;
+ local->stone_taking_count = 0;
+ }
+
+ if (global[player_persona] == PLAYER_IS_PID) {
+ kernel_flip_hotspot(words_Sanwe, false);
+ kernel_flip_hotspot_loc(words_circle_of_spheres, false, CIRCLE_X, CIRCLE_Y);
+ }
+
+ local->prevent = false;
+ local->king_enter_talk_count = 0;
+ local->king_float_talk_count = 0;
+ local->pid_float_talk_count = 0;
+ local->wiz_float_talk_count = 0;
+
+ if (!global[wizard_dead]) {
+ conv_get(CONV_31_WIZARD);
+ conv_get(CONV_32_WIZARD);
+
+ kernel_load_series(kernel_name('a', 6), false);
+ kernel_load_series(kernel_name('x', 8), false);
+ /* to prevent palette flashing */
+
+ ss[fx_stone_to_wiz] = kernel_load_series(kernel_name('x', 6), false);
+ ss[fx_stone_to_sphere] = kernel_load_series(kernel_name('x', 5), false);
+ }
+
+ /* This is to prevent pallette frag */
+ kernel_load_series(kernel_name('b', 0), false);
+
+ ss[fx_sphere_base] = kernel_load_series(kernel_name('z', 7), false);
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ ss[fx_ball_fly_1] = kernel_load_series(kernel_name('z', 2), false);
+ ss[fx_ball_fly_2] = kernel_load_series(kernel_name('z', 3), false);
+ ss[fx_ball_fly_3] = kernel_load_series(kernel_name('z', 4), false);
+ ss[fx_ball_fly_4] = kernel_load_series(kernel_name('z', 5), false);
+
+ ss[fx_atom_1] = kernel_load_series(kernel_name('y', 0), false);
+ ss[fx_atom_2] = kernel_load_series(kernel_name('y', 1), false);
+ ss[fx_atom_3] = kernel_load_series(kernel_name('y', 2), false);
+ ss[fx_atom_4] = kernel_load_series(kernel_name('y', 3), false);
+
+ seq[fx_atom_1] = kernel_seq_forward(ss[fx_atom_1], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_atom_1], 1);
+ kernel_seq_range(seq[fx_atom_1], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_atom_2] = kernel_seq_forward(ss[fx_atom_2], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_atom_2], 1);
+ kernel_seq_range(seq[fx_atom_2], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_atom_3] = kernel_seq_forward(ss[fx_atom_3], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_atom_3], 1);
+ kernel_seq_range(seq[fx_atom_3], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_atom_4] = kernel_seq_forward(ss[fx_atom_4], false, 5, 0, 0, 0);
+ kernel_seq_depth(seq[fx_atom_4], 1);
+ kernel_seq_range(seq[fx_atom_4], KERNEL_FIRST, KERNEL_LAST);
+
+ ss[fx_power_ball] = kernel_load_series(kernel_name('x', 9), false);
+ seq[fx_power_ball] = kernel_seq_stamp(ss[fx_power_ball], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_power_ball], 3);
+
+ } else {
+ seq[fx_sphere_base] = kernel_seq_stamp(ss[fx_sphere_base], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_sphere_base], 1);
+ /* after explosion, stamp bottom of sphere (just a chunk of it) */
+ }
+
+
+ /* ===================== Load Sprite Series ================== */
+
+ if (object_is_here(crystal_ball) || object_is_here(medicine_bundle) ||
+ object_is_here(black_sphere)) {
+ ss[fx_take] = kernel_load_series("*PDDRL_9", false);
+ }
+
+ if (object_is_here(black_sphere)) {
+ ss[fx_single_ball] = kernel_load_series(kernel_name('z', 6), false);
+ if (global[wizard_dead]) {
+ seq[fx_single_ball] = kernel_seq_stamp(ss[fx_single_ball], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_single_ball], 14);
+ } else {
+ kernel_flip_hotspot(words_black_sphere, false);
+ }
+ } else {
+ kernel_flip_hotspot(words_black_sphere, false);
+ }
+
+ if (object_is_here(crystal_ball)) {
+ ss[fx_ball] = kernel_load_series(kernel_name('p', 0), false);
+ seq[fx_ball] = kernel_seq_stamp(ss[fx_ball], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_ball], 14);
+ } else {
+ kernel_flip_hotspot(words_crystal_ball, false);
+ }
+
+ if (object_is_here(map)) {
+ ss[fx_take_high] = kernel_load_series("*PDDRM_8", false);
+ ss[fx_map] = kernel_load_series(kernel_name('p', 2), false);
+ seq[fx_map] = kernel_seq_stamp(ss[fx_map], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_map], 6);
+ } else {
+ kernel_flip_hotspot(words_map, false);
+ }
+
+ if (object_is_here(medicine_bundle)) {
+ ss[fx_bundle] = kernel_load_series(kernel_name('p', 1), false);
+ seq[fx_bundle] = kernel_seq_stamp(ss[fx_bundle], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_bundle], 14);
+ } else {
+ kernel_flip_hotspot(words_spirit_bundle, false);
+ }
+
+
+ /* ========================= Previous Rooms ================== */
+
+ if (previous_room == KERNEL_RESTORING_GAME) {
+ if (!global[wizard_dead]) {
+ player.walker_visible = false;
+ local->death_timer = 0;
+ local->clock = 0;
+
+ if (local->anim_6_running) {
+ aa[2] = kernel_run_animation(kernel_name('p', 1), 0);
+ aa[6] = kernel_run_animation(kernel_name('w', 4), 0);
+ kernel_reset_animation(aa[6], 31);
+ /* now it's time to mimic stone */
+
+ } else {
+ aa[2] = kernel_run_animation(kernel_name('p', 1), 0);
+ aa[3] = kernel_run_animation(kernel_name('w', 1), 0);
+ kernel_reset_animation(aa[3], 5);
+ /* now it's time to throw stone at circle of spheres */
+ }
+ }
+
+ } else if (previous_room == 106) {
+ player.x = WALK_TO_X_FROM_613;
+ player.y = WALK_TO_Y_FROM_613;
+ player.facing = FACING_EAST;
+
+ } else if ((previous_room == 613) || (previous_room != KERNEL_RESTORING_GAME)) {
+ player.walker_visible = false;
+ player.commands_allowed = false;
+
+ kernel_init_dialog();
+ kernel_set_interface_mode(INTER_LIMITED_SENTENCES);
+
+ aa[3] = kernel_run_animation(kernel_name('w', 1), 0);
+ local->anim_3_running = true;
+ local->wiz_float_action = FREEZE;
+
+ aa[0] = kernel_run_animation(kernel_name('k', 1), 0);
+ local->anim_0_running = true;
+ local->king_enter_action = FREEZE;
+ }
+
+ section_6_music();
+}
+
+static void handle_animation_king_enter() {
+ int king_enter_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->king_enter_frame) {
+ local->king_enter_frame = kernel_anim[aa[0]].frame;
+ king_enter_reset_frame = -1;
+
+ switch (local->king_enter_frame) {
+
+ case 25: /* almost end of king coming into room */
+ local->wiz_float_action = TALK;
+ break;
+
+ case 26: /* at end of king walking into room */
+ case 27: /* at end of king talking */
+ case 28: /* at end of king talking */
+ case 29: /* at end of king talking */
+ case 30: /* at end of king talking */
+ case 31: /* at end of king talking */
+ case 32: /* at end of king talking */
+ case 33: /* at end of king talking */
+ case 34: /* at end of king talking */
+ switch (local->king_enter_action) {
+ case FREEZE:
+ king_enter_reset_frame = 25;
+ break;
+
+ case TALK:
+ king_enter_reset_frame = imath_random(26, 33);
+ ++local->king_enter_talk_count;
+ if (local->king_enter_talk_count > 15) {
+ local->king_enter_action = FREEZE;
+ local->king_enter_talk_count = 0;
+ king_enter_reset_frame = 25; /* make king_enter shut up */
+ }
+ break;
+ }
+ break;
+ }
+
+ if (king_enter_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], king_enter_reset_frame);
+ local->king_enter_frame = king_enter_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_king_float() {
+ int king_float_reset_frame;
+ int tmp;
+
+ if (kernel_anim[aa[1]].frame != local->king_float_frame) {
+ local->king_float_frame = kernel_anim[aa[1]].frame;
+ king_float_reset_frame = -1;
+
+ switch (local->king_float_frame) {
+ case 11: /* at end of king floating up */
+ case 12: /* at end of king floating */
+ case 13: /* at end of king floating */
+ case 14: /* at end of king floating */
+ case 15: /* at end of king floating */
+ switch (local->king_float_action) {
+ case FREEZE:
+ tmp = imath_random(1, 3);
+ if (tmp == 1) {
+ king_float_reset_frame = local->king_float_frame - 2;
+ if (king_float_reset_frame < 10) {
+ king_float_reset_frame = 10;
+ }
+
+ } else if (tmp == 2) {
+ king_float_reset_frame = local->king_float_frame - 1;
+ }
+
+ if (local->king_float_frame == 15) {
+ if (king_float_reset_frame == -1) {
+ king_float_reset_frame = 14;
+ }
+ }
+ break;
+
+ case MORPH:
+ king_float_reset_frame = 15;
+ break;
+ }
+ break;
+ case 47:
+ king_float_reset_frame = 46;
+ local->wiz_zap_action = FREEZE;
+ break;
+ }
+
+ if (king_float_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], king_float_reset_frame);
+ local->king_float_frame = king_float_reset_frame;
+ }
+ }
}
-void room_614_daemon() {
+static void handle_animation_pid_float() {
+ int pid_float_reset_frame;
+ int tmp;
+
+ if (kernel_anim[aa[2]].frame != local->pid_float_frame) {
+ local->pid_float_frame = kernel_anim[aa[2]].frame;
+ pid_float_reset_frame = -1;
+
+ switch (local->pid_float_frame) {
+ case 1: /* at end of pid floating */
+ case 2: /* at end of pid floating */
+ case 3: /* at end of pid floating */
+ case 31: /* at end of pid throwing */
+ switch (local->pid_float_action) {
+ case FREEZE:
+ tmp = imath_random(1, 3);
+ if (tmp == 1) {
+ pid_float_reset_frame = local->pid_float_frame - 2;
+ if (pid_float_reset_frame < 0) {
+ pid_float_reset_frame = 0;
+ }
+
+ } else if (tmp == 2) {
+ pid_float_reset_frame = local->pid_float_frame - 1;
+ }
+
+ if (local->pid_float_frame >= 3) {
+ if (pid_float_reset_frame == -1) {
+ pid_float_reset_frame = 2;
+ }
+ }
+ break;
+
+ case THROW:
+ pid_float_reset_frame = 17;
+ local->pid_float_action = FREEZE;
+ break;
+
+ case ICE_UP:
+ kernel_abort_animation(aa[3]); /* abort wizard */
+ kernel_abort_animation(aa[2]); /* abort pid */
+ aa[7] = kernel_run_animation(kernel_name('w', 5), 0);
+ kernel_synch(KERNEL_ANIM, aa[7], KERNEL_NOW, 0);
+ local->anim_2_running = false;
+ local->anim_3_running = false;
+ local->anim_7_running = true;
+ pid_float_reset_frame = -1;
+ break;
+
+ case DIE:
+ pid_float_reset_frame = 3;
+ break;
+
+ case RELEASE:
+ player.commands_allowed = false;
+ pid_float_reset_frame = 31;
+ break;
+ }
+ break;
+
+ case 17: /* end of pid dieing */
+ sound_play(N_PlayerDies);
+ if (game.difficulty == EASY_MODE) {
+ text_show(61471);
+ } else {
+ text_show(45);
+ }
+ conv_reset(CONV_31_WIZARD);
+ conv_reset(CONV_32_WIZARD);
+ global[no_load_walker] = false;
+ new_room = 613;
+ break;
+
+ case 46: /* at end of dropping and shielding eyes */
+ switch (local->pid_float_action) {
+ case RELEASE:
+ pid_float_reset_frame = 45;
+ break;
+
+ case UNCOVER_EYES:
+ pid_float_reset_frame = 46;
+ break;
+ }
+ break;
+
+ case 50: /* end of uncovering eyes */
+ new_room = 106;
+ break;
+ }
+ if (pid_float_reset_frame >= 0) {
+ kernel_reset_animation(aa[2], pid_float_reset_frame);
+ local->pid_float_frame = pid_float_reset_frame;
+ }
+ }
}
-void room_614_pre_parser() {
+static void handle_animation_wiz_float() {
+ int wiz_float_reset_frame;
+ int tmp;
+ if (kernel_anim[aa[3]].frame != local->wiz_float_frame) {
+ local->wiz_float_frame = kernel_anim[aa[3]].frame;
+ wiz_float_reset_frame = -1;
+
+ switch (local->wiz_float_frame) {
+ case 20:
+ kernel_abort_animation(aa[0]);
+ aa[1] = kernel_run_animation(kernel_name('k', 2), 0);
+ kernel_synch(KERNEL_ANIM, aa[1], KERNEL_NOW, 0);
+
+ local->anim_0_running = false;
+ local->anim_1_running = true;
+ local->king_float_action = FREEZE;
+ player.commands_allowed = false;
+ break;
+
+ case 1:
+ if (local->wiz_float_action == FREEZE) {
+ wiz_float_reset_frame = 0;
+ } else {
+ local->wiz_float_action = FREEZE;
+ }
+ break;
+
+ case 4: /* end of wiz turning around to view king */
+ case 27: /* end of wiz raising king into air */
+ conv_run(CONV_31_WIZARD);
+ conv_export_value(game.difficulty);
+ break;
+
+ case 5: /* end of wiz floating */
+ case 6: /* end of wiz floating */
+ case 7: /* end of wiz floating */
+ case 15: /* end of wiz talking */
+ case 28: /* end of wiz raising king */
+ switch (local->wiz_float_action) {
+ case KILL_PID:
+ kernel_abort_animation(aa[3]);
+ aa[5] = kernel_run_animation(kernel_name('w', 3), 0);
+ local->anim_3_running = false;
+ local->anim_5_running = true;
+ kernel_synch(KERNEL_ANIM, aa[5], KERNEL_NOW, 0);
+ break;
+
+ case WAITING_FOR_STONE:
+ kernel_abort_animation(aa[3]);
+ aa[6] = kernel_run_animation(kernel_name('w', 4), 0);
+ local->anim_3_running = false;
+ local->anim_6_running = true;
+ kernel_synch(KERNEL_ANIM, aa[6], KERNEL_NOW, 0);
+ break;
+
+ case MORPH:
+ wiz_float_reset_frame = 29;
+ aa[4] = kernel_run_animation(kernel_name('w', 2), ROOM_614_DONE_ZAPPING);
+ local->anim_4_running = true;
+ local->wiz_zap_action = HAND_CHIN;
+ kernel_synch(KERNEL_ANIM, aa[4], KERNEL_ANIM, aa[3]);
+ break;
+
+ case FREEZE:
+ wiz_float_reset_frame = imath_random(4, 6);
+ break;
+
+ case RAISE_KING:
+ wiz_float_reset_frame = 15;
+ local->wiz_float_action = FREEZE;
+ break;
+
+ case BACK_TO_CAMERA:
+ kernel_abort_animation(aa[3]);
+ aa[6] = kernel_run_animation(kernel_name('w', 4), 0);
+ local->anim_3_running = false;
+ local->anim_6_running = true;
+ kernel_synch(KERNEL_ANIM, aa[6], KERNEL_NOW, 0);
+ kernel_reset_animation(aa[6], 25); /* make wiz turn back to camera */
+ break;
+
+ case TALK:
+ tmp = imath_random(1, 2);
+ if (tmp == 1) {
+ wiz_float_reset_frame = 7; /* new node */
+ } else {
+ wiz_float_reset_frame = 28; /* new node */
+ }
+ break;
+ }
+ break;
+
+ case 8: /* end of wiz coming to talk */
+ case 9: /* end of wiz talking */
+ case 10: /* end of wiz talking */
+ case 11: /* end of wiz talking */
+ switch (local->wiz_float_action) {
+ case TALK:
+ wiz_float_reset_frame = imath_random(8, 10);
+ ++local->wiz_float_talk_count;
+ if (local->wiz_float_talk_count > 15) {
+ if (local->wiz_float_action != BACK_TO_CAMERA) {
+ local->wiz_float_action = FREEZE;
+ }
+ local->wiz_float_talk_count = 0;
+ wiz_float_reset_frame = 14; /* make wiz_float shut up */
+ }
+ break;
+
+ default:
+ wiz_float_reset_frame = 14; /* new node */
+ break;
+ }
+ break;
+
+ case 29: /* end of wiz coming to talk */
+ case 12: /* end of wiz talking */
+ case 13: /* end of wiz talking */
+ case 14: /* end of wiz talking */
+ switch (local->wiz_float_action) {
+ case TALK:
+ wiz_float_reset_frame = imath_random(11, 13);
+ ++local->wiz_float_talk_count;
+ if (local->wiz_float_talk_count > 15) {
+ if (local->wiz_float_action != BACK_TO_CAMERA) {
+ local->wiz_float_action = FREEZE;
+ }
+ local->wiz_float_talk_count = 0;
+ wiz_float_reset_frame = 14; /* make wiz_float shut up */
+ }
+ break;
+
+ default:
+ wiz_float_reset_frame = 14; /* new node */
+ break;
+ }
+ break;
+
+ case 30:
+ wiz_float_reset_frame = 29;
+ break;
+ }
+
+ if (wiz_float_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], wiz_float_reset_frame);
+ local->wiz_float_frame = wiz_float_reset_frame;
+ }
+ }
}
-void room_614_parser() {
+static void handle_animation_wiz_zap() {
+ int wiz_zap_reset_frame;
+ int count = 0;
+
+ if (kernel_anim[aa[4]].frame != local->wiz_zap_frame) {
+ local->wiz_zap_frame = kernel_anim[aa[4]].frame;
+ wiz_zap_reset_frame = -1;
+ switch (local->wiz_zap_frame) {
+ case 9:
+ kernel_reset_animation(aa[1], 16);
+ break;
+
+ case 34:
+ if (local->wiz_zap_action == HAND_CHIN) {
+ wiz_zap_reset_frame = 33;
+ }
+ break;
+
+ case 40:
+ kernel_abort_animation(aa[4]); /* wiz_zap */
+ kernel_abort_animation(aa[1]); /* king float */
+ kernel_abort_animation(aa[3]); /* wiz_float */
+ local->anim_4_running = false;
+ local->anim_1_running = false;
+
+ aa[2] = kernel_run_animation(kernel_name('p', 1), 0);
+ local->anim_2_running = true;
+ local->pid_float_action = FREEZE;
+ kernel_synch(KERNEL_ANIM, aa[2], KERNEL_NOW, 0);
+
+ aa[3] = kernel_run_animation(kernel_name('w', 1), 0);
+ local->wiz_float_action = FREEZE;
+ kernel_reset_animation(aa[3], 5);
+ kernel_synch(KERNEL_ANIM, aa[3], KERNEL_NOW, 0);
+
+ conv_run(CONV_32_WIZARD);
+ conv_export_value(game.difficulty);
+ if (global[object_imitated] == 10 || global[object_imitated] == 11 ||
+ global[object_imitated] == 12) {
+ conv_export_value(1);
+ } else {
+ conv_export_value(0);
+ }
+ conv_export_value(local->did_not_throw);
+ if (player_has(red_powerstone)) ++count;
+ if (player_has(blue_powerstone)) ++count;
+ if (player_has(yellow_powerstone)) ++count;
+ conv_export_value(count);
+ break;
+ }
+
+ if (wiz_zap_reset_frame >= 0) {
+ kernel_reset_animation(aa[4], wiz_zap_reset_frame);
+ local->wiz_zap_frame = wiz_zap_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_wiz_murder() {
+ int wiz_murder_reset_frame;
+
+ if (kernel_anim[aa[5]].frame != local->wiz_murder_frame) {
+ local->wiz_murder_frame = kernel_anim[aa[5]].frame;
+ wiz_murder_reset_frame = -1;
+
+ switch (local->wiz_murder_frame) {
+ case 9:
+ local->pid_float_action = DIE;
+ break;
+
+ case 15:
+ wiz_murder_reset_frame = 14;
+ break;
+ }
+
+ if (wiz_murder_reset_frame >= 0) {
+ kernel_reset_animation(aa[5], wiz_murder_reset_frame);
+ local->wiz_murder_frame = wiz_murder_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_wiz_ice() {
+ int wiz_ice_reset_frame;
+
+ if (kernel_anim[aa[6]].frame != local->wiz_ice_frame) {
+ local->wiz_ice_frame = kernel_anim[aa[6]].frame;
+ wiz_ice_reset_frame = -1;
+
+ switch (local->wiz_ice_frame) {
+ case 7:
+ sound_play(N_CatchStone);
+ seq[fx_stone_to_wiz] = kernel_seq_forward(ss[fx_stone_to_wiz], false, 9, 0, 0, 1);
+ kernel_seq_depth(seq[fx_stone_to_wiz], 2);
+ kernel_seq_range(seq[fx_stone_to_wiz], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_stone_to_wiz],
+ KERNEL_TRIGGER_EXPIRE, 0, ROOM_614_STONE_TO_WIZ);
+
+ ++local->stone_taking_count;
+
+ if (local->stone_taking_count < 3) {
+ if (player_has(red_powerstone)) {
+ inter_move_object(red_powerstone, NOWHERE);
+
+ } else if (player_has(yellow_powerstone)) {
+ inter_move_object(yellow_powerstone, NOWHERE);
+
+ } else if (player_has(blue_powerstone)) {
+ inter_move_object(blue_powerstone, NOWHERE);
+
+ } else if (player_has(polystone)) {
+ if (player_has(polystone)) {
+ if (global[object_imitated] == 10 ||
+ global[object_imitated] == 11 ||
+ global[object_imitated] == 12) {
+ inter_move_object(polystone, NOWHERE);
+ }
+ }
+ }
+
+ } else {
+ if (player_has(polystone)) {
+ if (global[object_imitated] == 10 ||
+ global[object_imitated] == 11 ||
+ global[object_imitated] == 12) {
+ inter_move_object(polystone, NOWHERE);
+ }
+
+ } else if (player_has(red_powerstone)) {
+ inter_move_object(red_powerstone, NOWHERE);
+
+ } else if (player_has(yellow_powerstone)) {
+ inter_move_object(yellow_powerstone, NOWHERE);
+
+ } else if (player_has(blue_powerstone)) {
+ inter_move_object(blue_powerstone, NOWHERE);
+ }
+ }
+ break;
+
+ case 8: /* end of waiting for stone */
+ if (local->wiz_ice_action == WAITING_FOR_STONE) {
+ wiz_ice_reset_frame = 7;
+ }
+ break;
+
+ case 20: /* end of crushing stone */
+ kernel_abort_animation(aa[6]);
+ local->anim_6_running = false;
+
+ aa[3] = kernel_run_animation(kernel_name('w', 1), 0);
+ local->wiz_float_action = FREEZE;
+ local->anim_3_running = true;
+
+ kernel_reset_animation(aa[3], 5);
+ kernel_synch(KERNEL_ANIM, aa[3], KERNEL_NOW, 0);
+
+ conv_run(CONV_32_WIZARD);
+ conv_export_value(game.difficulty);
+ if (global[object_imitated] == 10 || global[object_imitated] == 11 ||
+ global[object_imitated] == 12) {
+ conv_export_value(1);
+ } else {
+ conv_export_value(0);
+ }
+ conv_export_value(local->did_not_throw);
+ break;
+
+ case 29:
+ player.commands_allowed = true;
+ break;
+
+ case 30: /* end of wiz floating with back to camera */
+ case 31: /* end of wiz floating with back to camera */
+ case 32: /* end of wiz floating with back to camera */
+ case 33: /* end of wiz floating with back to camera */
+
+ switch (local->wiz_ice_action) {
+ case TURN_TO_PID:
+ wiz_ice_reset_frame = 64;
+ break;
+
+ case BACK_TO_CAMERA:
+ wiz_ice_reset_frame = imath_random(29, 32);
+ break;
+ }
+ break;
+
+ case 69: /* end of turning to pid (after crushing stones) */
+ switch (local->wiz_ice_action) {
+ case KILL_PID:
+ kernel_abort_animation(aa[6]);
+ aa[5] = kernel_run_animation(kernel_name('w', 3), 0);
+ local->anim_6_running = false;
+ local->anim_5_running = true;
+ kernel_synch(KERNEL_ANIM, aa[5], KERNEL_NOW, 0);
+ break;
+
+ case TURN_TO_PID:
+ wiz_ice_reset_frame = 68;
+ break;
+ }
+ break;
+ }
+
+ if (wiz_ice_reset_frame >= 0) {
+ kernel_reset_animation(aa[6], wiz_ice_reset_frame);
+ local->wiz_ice_frame = wiz_ice_reset_frame;
+ }
+ }
+}
+
+static void handle_animation_wiz_end() {
+ int wiz_end_reset_frame;
+
+ if (kernel_anim[aa[7]].frame != local->wiz_end_frame) {
+ local->wiz_end_frame = kernel_anim[aa[7]].frame;
+ wiz_end_reset_frame = -1;
+
+ switch (local->wiz_end_frame) {
+ case 10: /* just threw stone */
+ inter_move_object(blue_powerstone, NOWHERE);
+ break;
+
+ case 16: /* make conv run just before explosion */
+ local->activate_timer = true;
+ local->death_timer = LENGTH_OF_LIFE + 1;
+ break;
+
+ case 25: /* explosion starts */
+ kernel_seq_delete(seq[fx_atom_1]);
+ kernel_seq_delete(seq[fx_atom_2]);
+ kernel_seq_delete(seq[fx_atom_3]);
+ kernel_seq_delete(seq[fx_atom_4]);
+ kernel_seq_delete(seq[fx_power_ball]);
+
+ seq[fx_ball_fly_1] = kernel_seq_forward(ss[fx_ball_fly_1], false, 5, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ball_fly_1], 2);
+ kernel_seq_range(seq[fx_ball_fly_1], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_ball_fly_1], KERNEL_TRIGGER_EXPIRE, 0, ROOM_614_STAMP_BALL);
+
+ seq[fx_ball_fly_2] = kernel_seq_forward(ss[fx_ball_fly_2], false, 5, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ball_fly_2], 2);
+ kernel_seq_range(seq[fx_ball_fly_2], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_ball_fly_3] = kernel_seq_forward(ss[fx_ball_fly_3], false, 5, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ball_fly_3], 2);
+ kernel_seq_range(seq[fx_ball_fly_3], KERNEL_FIRST, KERNEL_LAST);
+
+ seq[fx_ball_fly_4] = kernel_seq_forward(ss[fx_ball_fly_4], false, 5, 0, 0, 1);
+ kernel_seq_depth(seq[fx_ball_fly_4], 2);
+ kernel_seq_range(seq[fx_ball_fly_4], KERNEL_FIRST, KERNEL_LAST);
+ break;
+
+ case 49: /* just when wizard is going to shatter */
+ if (conv_control.running == CONV_32_WIZARD) {
+ conv_abort();
+ }
+ break;
+
+ case 73:
+ local->anim_7_running = false;
+ global[wizard_dead] = true;
+ global[player_persona] = PLAYER_IS_PID;
+ global[dragon_high_scene] = 0;
+ global[wins_in_desert] = 0;
+ global[player_score] += 10;
+ new_room = 106;
+ text_show(61437);
+ /* go to cut scene */
+ break;
+ }
+
+ if (wiz_end_reset_frame >= 0) {
+ kernel_reset_animation(aa[7], wiz_end_reset_frame);
+ local->wiz_end_frame = wiz_end_reset_frame;
+ }
+ }
+}
+
+static void room_614_daemon() {
+ long dif; /* for timer stuff */
+
+ if (local->anim_0_running) {
+ handle_animation_king_enter();
+ }
+
+ if (local->anim_1_running) {
+ handle_animation_king_float();
+ }
+
+ if (local->anim_2_running) {
+ handle_animation_pid_float();
+ }
+
+ if (local->anim_3_running) {
+ handle_animation_wiz_float();
+ }
+
+ if (local->anim_4_running) {
+ handle_animation_wiz_zap();
+ }
+
+ if (local->anim_5_running) {
+ handle_animation_wiz_murder();
+ }
+
+ if (local->anim_6_running) {
+ handle_animation_wiz_ice();
+ }
+
+ if (local->anim_7_running) {
+ handle_animation_wiz_end();
+ }
+
+ if (kernel.trigger == ROOM_614_STONE_TO_WIZ) {
+ local->wiz_ice_action = FREEZE;
+ }
+
+ if (kernel.trigger == ROOM_614_STAMP_BALL) {
+ seq[fx_single_ball] = kernel_seq_stamp(ss[fx_single_ball], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_single_ball], 14);
+ kernel_synch(KERNEL_SERIES, seq[fx_single_ball], KERNEL_SERIES, seq[fx_ball_fly_1]);
+ }
+
+ if (local->activate_timer) {
+ if (local->death_timer == 0) {
+ kernel_set_interface_mode(INTER_BUILDING_SENTENCES);
+ }
+
+ dif = kernel.clock - local->clock;
+ if ((dif >= 0) && (dif <= 4)) {
+ local->death_timer += dif;
+ } else {
+ local->death_timer += 1;
+ }
+ local->clock = kernel.clock;
+
+ if (local->death_timer >= LENGTH_OF_LIFE) {
+ local->wiz_ice_action = TURN_TO_PID;
+ player.commands_allowed = false;
+ /* turn back to kill pid or just kill him */
+ local->activate_timer = false;
+
+ kernel_init_dialog();
+ kernel_set_interface_mode(INTER_LIMITED_SENTENCES);
+ conv_run(CONV_32_WIZARD);
+ conv_export_value(game.difficulty);
+ if (global[object_imitated] == 10 || global[object_imitated] == 11 ||
+ global[object_imitated] == 12) {
+ conv_export_value(1);
+ } else {
+ conv_export_value(0);
+ }
+ conv_export_value(local->did_not_throw);
+ }
+ }
+
+ if (global[object_imitated] == 10 || /* red */
+ global[object_imitated] == 11 || /* yellow */
+ global[object_imitated] == 12) { /* blue */
+
+ if (local->activate_timer && !local->doofus) {
+ kernel_init_dialog();
+ kernel_set_interface_mode(INTER_LIMITED_SENTENCES);
+ local->death_timer = LENGTH_OF_LIFE + 1;
+ }
+ }
+}
+
+static void process_conv_31() {
+ int you_trig_flag = false;
+
+ switch (player_verb) {
+ case conv031_hello_only:
+ case conv031_whoare_only:
+ if (!kernel.trigger) {
+ conv_me_trigger(ROOM_614_ME_TALK);
+ }
+ break;
+
+ case conv031_wellwell_b_b:
+ *conv_my_next_start = conv031_wellwell;
+ local->wiz_float_action = RAISE_KING;
+ you_trig_flag = true;
+ conv_abort();
+ break;
+
+ case conv031_exit_b_b:
+ local->wiz_float_action = MORPH;
+ you_trig_flag = true;
+ conv_abort();
+ break;
+ }
+
+ if (kernel.trigger == ROOM_614_ME_TALK) {
+ local->king_enter_action = TALK;
+ }
+
+ if (kernel.trigger == ROOM_614_YOU_TALK) {
+ local->wiz_float_action = TALK;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_614_YOU_TALK);
+ } /* if you_trig_flag == true, then a you trigger is called from above, not here. */
+
+
+ local->king_enter_talk_count = 0;
+ local->wiz_float_talk_count = 0;
+}
+
+static void process_conv_32() {
+ int you_trig_flag = false;
+
+ switch (player_verb) {
+ case conv032_pid_dies_b_b:
+ conv_abort();
+ local->wiz_float_action = KILL_PID;
+ local->wiz_ice_action = KILL_PID;
+ break;
+
+ case conv032_pid_death_b_b:
+ conv_abort();
+ local->wiz_float_action = KILL_PID;
+ break;
+
+ case 7:
+ *conv_my_next_start = 8;
+ conv_abort();
+ local->wiz_ice_action = WAITING_FOR_STONE;
+ local->wiz_float_action = WAITING_FOR_STONE;
+ break;
+
+ case 10:
+ *conv_my_next_start = 11;
+ conv_abort();
+ local->wiz_ice_action = WAITING_FOR_STONE;
+ local->wiz_float_action = WAITING_FOR_STONE;
+ break;
+
+ case 17:
+ *conv_my_next_start = 18;
+ conv_abort();
+ local->activate_timer = true;
+ player.commands_allowed = true;
+ break;
+
+ case 22:
+ *conv_my_next_start = 23;
+ conv_abort();
+ local->wiz_ice_action = WAITING_FOR_STONE;
+ local->wiz_float_action = WAITING_FOR_STONE;
+ break;
+
+ case conv032_pain_b_b:
+ *conv_my_next_start = conv032_pain;
+ conv_abort();
+ local->activate_timer = true;
+ player.commands_allowed = true;
+ break;
+ }
+
+ if (kernel.trigger == ROOM_614_ME_TALK) {
+ local->king_enter_action = TALK;
+ }
+
+ if (kernel.trigger == ROOM_614_YOU_TALK) {
+ local->wiz_float_action = TALK;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_614_YOU_TALK);
+ } /* if you_trig_flag == true, then a you trigger is called from above, not here. */
+
+ local->king_enter_talk_count = 0;
+ local->wiz_float_talk_count = 0;
+}
+
+static void room_614_pre_parser() {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ player.need_to_walk = false;
+ }
+
+ if (player_said_1(doorway_to_corridor) && player.need_to_walk) {
+ if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+
+ if (player_said_2(walk_through, doorway_to_corridor)) {
+ if (global[player_persona] == PLAYER_IS_PID) {
+ if (object_is_here(medicine_bundle) ||
+ object_is_here(black_sphere) ||
+ object_is_here(crystal_ball) ||
+ object_is_here(map)) {
+ text_show(61459);
+ player_cancel_command();
+ }
+ }
+ }
+}
+
+static void room_614_parser() {
+ if (conv_control.running == CONV_31_WIZARD) {
+ process_conv_31();
+ goto handled;
+ }
+
+ if (conv_control.running == CONV_32_WIZARD) {
+ process_conv_32();
+ goto handled;
+ }
+
+ if (kernel.trigger == ROOM_614_DONE_ZAPPING) {
+ local->anim_4_running = false;
+ goto handled;
+ }
+
+ if (player_said_2(take, crystal_ball)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(61433);
+ goto handled;
+
+ } else switch (kernel.trigger) {
+ case 0:
+ if (!player_has(crystal_ball)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 2, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 3);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, 3);
+ kernel_seq_player(seq[fx_take], true);
+ goto handled;
+ }
+ break;
+
+ case 1:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_ball]);
+ kernel_flip_hotspot(words_crystal_ball, false);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(crystal_ball);
+ object_examine(crystal_ball, 61458, 0);
+ }
+ local->prevent = true;
+ goto handled;
+ break;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ goto handled;
+ break;
+ }
+ }
+
+ if (player_said_2(take, black_sphere)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(61433);
+ goto handled;
+
+ } else switch (kernel.trigger) {
+ case 0:
+ if (!player_has(black_sphere)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 4, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 3);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, 5);
+ kernel_seq_player(seq[fx_take], true);
+ goto handled;
+ }
+ break;
+
+ case 1:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_single_ball]);
+ kernel_flip_hotspot(words_black_sphere, false);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(black_sphere);
+ if (game.difficulty == HARD_MODE) {
+ object_examine(black_sphere, 61453, 0);
+ } else {
+ object_examine(black_sphere, 61454, 0);
+ }
+ }
+ local->prevent = true;
+ goto handled;
+ break;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ goto handled;
+ break;
+ }
+ }
+
+ if (player_said_2(take, map)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(61433);
+ goto handled;
+
+ } else switch (kernel.trigger) {
+ case 0:
+ if (!player_has(map)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take_high] = kernel_seq_pingpong(ss[fx_take_high], true, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take_high], KERNEL_TRIGGER_SPRITE, 3, 1);
+ kernel_seq_trigger(seq[fx_take_high], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take_high], 3);
+ kernel_seq_range(seq[fx_take_high], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take_high], true);
+ goto handled;
+ }
+ break;
+
+ case 1:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_map]);
+ kernel_flip_hotspot(words_map, false);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(map);
+ object_examine(map, 61451, 0);
+ }
+ local->prevent = true;
+ goto handled;
+ break;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take_high]);
+ goto handled;
+ break;
+ }
+ }
+
+ if (player_said_2(take, spirit_bundle)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(61433);
+ goto handled;
+
+ } else {
+ switch (kernel.trigger) {
+ case 0:
+ if (!player_has(medicine_bundle)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 2, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 3);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, 3);
+ kernel_seq_player(seq[fx_take], true);
+ goto handled;
+ }
+ break;
+
+ case 1:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_bundle]);
+ kernel_flip_hotspot(words_spirit_bundle, false);
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(medicine_bundle);
+ object_examine(medicine_bundle, 61456, 0);
+ global[had_spirit_bundle] = true;
+ }
+ local->prevent = true;
+ goto handled;
+ break;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ goto handled;
+ break;
+ }
+ }
+ }
+
+ if (player_said_2(walk_through, doorway_to_corridor)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(61413);
+ } else {
+ text_show(61460);
+ new_room = 601;
+ }
+ goto handled;
+ }
+
+ if (player.look_around) {
+ if (local->anim_2_running) {
+ if (game.difficulty == HARD_MODE) {
+ text_show(61401);
+ } else {
+ text_show(61402);
+ }
+ } else {
+ text_show(61438);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(chest)) {
+ if (local->anim_2_running) {
+ text_show(61403);
+ } else {
+ if (object_is_here(medicine_bundle) && !object_is_here(crystal_ball)) {
+ text_show(61466);
+ } else if (!object_is_here(medicine_bundle) && object_is_here(crystal_ball)) {
+ text_show(61466);
+ } else if (!object_is_here(medicine_bundle) && !object_is_here(crystal_ball)) {
+ text_show(61467);
+ } else {
+ text_show(61439);
+ }
+ }
+ goto handled;
+ }
+
+ if (player_said_1(telescope)) {
+ if (local->anim_2_running) {
+ text_show(61404);
+ } else {
+ text_show(61440);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(wall)) {
+ if (local->anim_2_running) {
+ text_show(61405);
+ } else {
+ text_show(61441);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(dragon_sculpture)) {
+ if (local->anim_2_running) {
+ text_show(61406);
+ } else {
+ text_show(61442);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(circle_of_spheres)) {
+ if (local->anim_2_running) {
+ if (game.difficulty == HARD_MODE) {
+ text_show(61407);
+ } else {
+ text_show(61408);
+ }
+ } else if (player_has(black_sphere)) {
+ text_show(61463);
+ } else {
+ text_show(61443);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(scroll)) {
+ if (local->anim_2_running) {
+ text_show(61409);
+ } else {
+ if (inter_point_x > 295 && inter_point_y < 53) {
+ text_show(61474);
+ } else {
+ text_show(61444);
+ }
+ }
+ goto handled;
+ }
+
+ if (player_said_1(window)) {
+ if (local->anim_2_running) {
+ text_show(61410);
+ } else {
+ text_show(61445);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(bookshelf)) {
+ if (local->anim_2_running) {
+ text_show(61411);
+ } else {
+ text_show(61446);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(stone_bed)) {
+ if (local->anim_2_running) {
+ text_show(61412);
+ } else {
+ text_show(61447);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(doorway_to_corridor)) {
+ if (local->anim_2_running) {
+ text_show(61413);
+ } else {
+ text_show(61448);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(strange_map)) {
+ if (local->anim_2_running) {
+ if (game.difficulty == HARD_MODE) {
+ text_show(61414);
+ } else {
+ text_show(61415);
+ }
+ } else {
+ text_show(61461);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(floor)) {
+ text_show(61416);
+ goto handled;
+ }
+
+ if (player_said_1(map) && object_is_here(map)) {
+ text_show(61450);
+ goto handled;
+ }
+
+ if (player_said_1(black_sphere) && object_is_here(black_sphere)) {
+ text_show(61452);
+ goto handled;
+ }
+
+ if (player_said_1(spirit_bundle) && object_is_here(medicine_bundle)) {
+ text_show(61455);
+ goto handled;
+ }
+
+ if (player_said_1(crystal_ball) && object_is_here(crystal_ball)) {
+ text_show(61457);
+ goto handled;
+ }
+
+ if (player_said_1(Sanwe)) {
+ if (local->anim_6_running) {
+ text_show(61465);
+ } else {
+ text_show(61464);
+ }
+ goto handled;
+ }
+ }
+
+ if (player_said_2(invoke, signet_ring)) {
+ if (global[wizard_dead]) {
+ if (object_is_here(medicine_bundle) ||
+ object_is_here(black_sphere) ||
+ object_is_here(crystal_ball) ||
+ object_is_here(map)) {
+ text_show(61459);
+ goto handled;
+ }
+
+ } else if (local->anim_2_running) {
+ text_show(61418);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(make_noise, birdcall)) {
+ if (local->anim_6_running) {
+ text_show(61431);
+ goto handled;
+
+ } else if (local->anim_2_running) {
+ text_show(61419);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust)) {
+
+ if (local->anim_6_running) {
+ text_show(61432);
+ goto handled;
+
+ } else if (local->anim_2_running) {
+ text_show(61420);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(drink_from, goblet) ||
+ player_said_2(eat, fruit) ||
+ player_said_2(gnaw, bone)) {
+ if (local->anim_2_running) {
+ text_show(61421);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(invoke, amulet)) {
+ text_show(61424);
+ goto handled;
+ }
+
+ if (player_said_2(wave, torch)) {
+ text_show(61425);
+ goto handled;
+ }
+
+ if (player_said_2(pour, flask_full_of_acid)) {
+ if (local->anim_2_running) {
+ text_show(61426);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(drink, flask_of_acid)) {
+ if (local->anim_2_running) {
+ text_show(61427);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(polish)) {
+ if (player_said_1(blue_powerstone) ||
+ player_said_1(red_powerstone) ||
+ player_said_1(yellow_powerstone)) {
+ text_show(61423);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(throw, circle_of_spheres) ||
+ player_said_2(give, circle_of_spheres) ||
+ player_said_2(put, circle_of_spheres)) {
+
+ if (player_said_1(blue_stone)) {
+ if (local->wiz_ice_action == BACK_TO_CAMERA) {
+ local->pid_float_action = ICE_UP;
+ local->did_not_throw = false;
+ player.commands_allowed = false;
+ local->activate_timer = false;
+ kernel_init_dialog();
+ kernel_set_interface_mode(INTER_LIMITED_SENTENCES);
+ goto handled;
+
+ } else if (game.difficulty == EASY_MODE) {
+ text_show(61472);
+ goto handled;
+ }
+
+ } else if (player_has(object_named(player_main_noun))) {
+ text_show(61436);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(throw, blue_stone) || player_said_2(put, blue_stone) ||
+ player_said_2(give, blue_stone)) {
+ if (!player_said_1(circle_of_spheres) && !player_said_1(Sanwe)) {
+ if (local->wiz_ice_action == BACK_TO_CAMERA) {
+ text_show(61470);
+ goto handled;
+ }
+
+ } else if (player_said_1(Sanwe)) {
+ text_show(61462);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(give) || player_said_1(put) || player_said_1(throw)) {
+ if (player_said_1(Sanwe)) {
+ text_show(61435);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(talk_to, Sanwe)) {
+ text_show(61434);
+ goto handled;
+ }
+
+ if (player_said_1(take) ||
+ player_said_1(open) ||
+ player_said_1(close) ||
+ player_said_1(push) ||
+ player_said_1(pull)) {
+
+ if (local->anim_6_running) {
+ text_show(61433);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(walk_across) ||
+ player_said_1(walk_to)) {
+
+ if (local->wiz_ice_action == BACK_TO_CAMERA) {
+ text_show(61473);
+ goto handled;
+
+ } else if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(61417);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(throw) && global[player_persona] == PLAYER_IS_KING) {
+ if (player_has(object_named(player_main_noun)) ||
+ player_has(object_named(player_second_noun))) {
+ text_show(61417);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(take) ||
+ player_said_1(give) ||
+ player_said_1(talk_to) ||
+ player_said_1(put) ||
+ player_said_1(open) ||
+ player_said_1(close) ||
+ player_said_1(push) ||
+ player_said_1(pull)) {
+
+ if (local->anim_2_running) {
+ text_show(61417);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(drink, goblet)) {
+ if (local->anim_2_running) {
+ text_show(61421);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(polish, blue_stone)) {
+ if (local->anim_2_running) {
+ text_show(61423);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(pour_contents_of)) {
+ if (local->anim_2_running) {
+ text_show(61426);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(drink, flask_full_of_acid)) {
+ if (local->anim_2_running) {
+ text_show(61427);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(tie, rope)) {
+ if (local->anim_2_running) {
+ text_show(61428);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(vortex_stone)) {
+ if (local->anim_2_running) {
+ text_show(61429);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(open, chest)) {
+ if (!local->anim_2_running) {
+ text_show(61468);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(close, chest)) {
+ if (!local->anim_2_running) {
+ text_show(61469);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(speak_words_on, parchment)) {
+ if (local->anim_2_running) {
+ text_show(61430);
+ goto handled;
+ }
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
}
void room_614_synchronize(Common::Serializer &s) {
@@ -74,6 +1838,12 @@ void room_614_preload() {
room_parser_code_pointer = room_614_parser;
room_daemon_code_pointer = room_614_daemon;
+ if (global[wizard_dead]) {
+ global[no_load_walker] = false;
+ } else {
+ global[no_load_walker] = true;
+ }
+
section_6_walker();
section_6_interface();
}
More information about the Scummvm-git-logs
mailing list