[Scummvm-git-logs] scummvm master -> 555fe3d2031646a051bf2aace49770db3c1cdc54

dreammaster noreply at scummvm.org
Sun May 10 06:52:31 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:
6a188af777 MADS: DRAGONSPHERE: Added room 108
555fe3d203 MADS: DRAGONSPHERE: Added room 109


Commit: 6a188af777a02686fd21f1742b8a016e4ba616b8
    https://github.com/scummvm/scummvm/commit/6a188af777a02686fd21f1742b8a016e4ba616b8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-10T16:21:05+10:00

Commit Message:
MADS: DRAGONSPHERE: Added room 108

Changed paths:
    engines/mads/madsv2/dragonsphere/mads/words.h
    engines/mads/madsv2/dragonsphere/rooms/room108.cpp


diff --git a/engines/mads/madsv2/dragonsphere/mads/words.h b/engines/mads/madsv2/dragonsphere/mads/words.h
index ca35cd68311..252f47c8453 100644
--- a/engines/mads/madsv2/dragonsphere/mads/words.h
+++ b/engines/mads/madsv2/dragonsphere/mads/words.h
@@ -55,12 +55,19 @@ enum {
 	words_brazier              = 175,
 	words_door_to_throne_room  = 176,
 	words_dining_table         = 178,
+	words_dungeon_floor        = 182,
 	words_door_to_guardroom    = 189,
 	words_door_to_council_room = 190,
+	words_guard_station        = 191,
+	words_door_to_dungeon_cell = 192,
+	words_doorway_to_cell      = 193,
+	words_dungeon_wall         = 195,
 	words_ceiling              = 196,
 	words_door_to_hallway      = 197,
 	words_table                = 198,
 	words_chair                = 202,
+	words_guard_stool          = 206,
+	words_rocks                = 207,
 	words_dividing_wall        = 208,
 	words_bucket               = 225,
 	words_painting             = 231,
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room108.cpp b/engines/mads/madsv2/dragonsphere/rooms/room108.cpp
index d4a94d36c39..150b30fdaf1 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room108.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room108.cpp
@@ -25,6 +25,10 @@
 #include "mads/madsv2/core/kernel.h"
 #include "mads/madsv2/core/sound.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/sounds.h"
+#include "mads/madsv2/dragonsphere/mads/words.h"
 #include "mads/madsv2/dragonsphere/global.h"
 #include "mads/madsv2/dragonsphere/rooms/section1.h"
 #include "mads/madsv2/dragonsphere/rooms/room108.h"
@@ -34,32 +38,411 @@ namespace MADSV2 {
 namespace Dragonsphere {
 namespace Rooms {
 
-struct Scratch {
-};
-
 #define local (&scratch)
 #define ss    local->sprite
 #define seq   local->sequence
 #define aa    local->animation
 
-//static Scratch scratch;
+struct Scratch {
+	int16 sprite[15];       /* Sprite series handles */
+	int16 sequence[15];     /* Sequence handles      */
+	int16 animation[4];     /* Animation handles     */
+
+	int16 eye_frame;        /* Which animation frame is being held for blinking eyes */
+	int16 temp;             /* used for synching purposes */
+};
+
+/* ========================= Sprites ========================= */
+
+#define fx_door              1   /* rm108x2 */
+#define fx_fire_right        2   /* rm108x0 */
+#define fx_fire_left         3   /* rm108x1 */
+#define fx_eyes_0            4   /* rm108y0 */ 
+#define fx_eyes_1            5   /* rm108y1 */ 
+#define fx_eyes_2            6   /* rm108y2 */ 
+#define fx_eyes_3            7   /* rm108y3 */ 
+#define fx_eyes_4            8   /* rm108y4 */ 
+#define fx_eyes_5            9   /* rm108y5 */ 
+#define fx_go_downstairs     10  /* rm108a0 */
+#define fx_go_upstairs       11  /* rm108a1 */
+#define fx_open_door         12  /* kgdrd_8 */
+
+
+/* ======================== Triggers ========================= */
+
+#define ROOM_108_DOOR_CLOSES 70
+
+/* walk points */
+#define START_X_ROOM_107     33
+#define START_Y_ROOM_107     34
+#define START_X_ROOM_109     289
+#define START_Y_ROOM_109     98
+
+#define WALK_TO_X_FROM_107   50
+#define WALK_TO_Y_FROM_107   40
+
+#define OPEN_DOOR_X_ROOM_107 33
+#define OPEN_DOOR_Y_ROOM_107 40
+
+#define BOTTOM_OF_STAIRS_X   154
+#define BOTTOM_OF_STAIRS_Y   89
+
+static Scratch scratch;
+
+static void room_108_init() {
+	/* Load sprite series */
+	ss[fx_door] = kernel_load_series(kernel_name('x', 2), false);
+	ss[fx_fire_right] = kernel_load_series(kernel_name('x', 0), false);
+	ss[fx_fire_left] = kernel_load_series(kernel_name('x', 1), false);
+	ss[fx_go_downstairs] = kernel_load_series(kernel_name('a', 0), false);
+	ss[fx_go_upstairs] = kernel_load_series(kernel_name('a', 1), false);
+	ss[fx_open_door] = kernel_load_series("*KGDRD_8", false);
+
+	/* Start continuous sequences */
+
+	seq[fx_fire_left] = kernel_seq_forward(ss[fx_fire_left], false, 7, 0, 0, 0);
+	seq[fx_fire_right] = kernel_seq_forward(ss[fx_fire_right], false, 7, 3, 0, 0);
 
-void room_108_init() {
+	if (previous_room == 109) {               /* Player comes from dungeon */
+		player.x = START_X_ROOM_109;
+		player.y = START_Y_ROOM_109;
+		player.facing = FACING_SOUTHWEST;
+		seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+		kernel_seq_depth(seq[fx_door], 13);
 
+	} else if (previous_room != KERNEL_RESTORING_GAME) { /* Player comes from throne room rm107 */
+		seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_LAST);
+		kernel_seq_depth(seq[fx_door], 10);
+		player_first_walk(START_X_ROOM_107, START_Y_ROOM_107, FACING_SOUTH,
+			WALK_TO_X_FROM_107, WALK_TO_Y_FROM_107, FACING_EAST,
+			false);
+		player_walk_trigger(ROOM_108_DOOR_CLOSES);
+
+	} else {
+		seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+		kernel_seq_depth(seq[fx_door], 13);
+	}
+
+	aa[0] = kernel_run_animation(kernel_name('A', -1), 0);
+
+	section_1_music();
 }
 
-void room_108_daemon() {
+static void get_random_eyes(int16 *new_frame) {
+	int random;
+
+	random = imath_random(0, 15);
+	switch (random) {
+
+	case 0:
+		*new_frame = 0;
+		break;
+
+	case 1:
+		*new_frame = 5;
+		break;
+
+	case 2:
+		*new_frame = 10;
+		break;
+
+	case 3:
+		*new_frame = 15;
+		break;
+
+	case 4:
+		*new_frame = 20;
+		break;
+
+	case 5:
+		*new_frame = 25;
+		break;
+
+	case 6:
+		*new_frame = 30;
+		break;
+
+	case 7:
+		*new_frame = 35;
+		break;
+
+	case 8:
+		*new_frame = 40;
+		break;
+
+	case 9:
+		*new_frame = 45;
+		break;
+
+	case 10:
+		*new_frame = 50;
+		break;
+
+	case 11:
+		*new_frame = 55;
+		break;
+
+	case 12:
+		*new_frame = 60;
+		break;
+
+	case 13:
+		*new_frame = 65;
+		break;
 
+	case 14:
+		*new_frame = 70;
+		break;
+
+	case 15:
+		*new_frame = 75;
+		break;
+	}
+}
+
+static void room_108_daemon() {
+	int16 reset_frame;
+	int16 new_frame;
+
+	/* Randomly put different blinking eyes sequences up on screen */
+	if (kernel_anim[aa[0]].anim != NULL) {
+		if (kernel_anim[aa[0]].frame != local->eye_frame) {
+			local->eye_frame = kernel_anim[aa[0]].frame;
+			reset_frame = -1;
+
+			get_random_eyes(&new_frame);
+
+			switch (local->eye_frame) {
+			case  5:
+			case 10:
+			case 15:
+			case 20:
+			case 25:
+			case 30:
+			case 35:
+			case 40:
+			case 45:
+			case 50:
+			case 55:
+			case 60:
+			case 65:
+			case 70:
+			case 75:
+			case 80:
+				reset_frame = new_frame;
+				break;
+			}
+
+			if (reset_frame >= 0) {
+				if (reset_frame != kernel_anim[aa[0]].frame) {
+					kernel_reset_animation(aa[0], reset_frame);
+					local->eye_frame = reset_frame;
+				}
+			}
+		}
+	}
+
+	/* Close the door when player enters from 107 */
+	if (kernel.trigger >= ROOM_108_DOOR_CLOSES) {
+		switch (kernel.trigger) {
+		case ROOM_108_DOOR_CLOSES:
+			kernel_seq_delete(seq[fx_door]);
+			sound_play(N_DoorCloses);
+			seq[fx_door] = kernel_seq_backward(ss[fx_door], false,
+				6, 0, 0, 1);
+			kernel_seq_depth(seq[fx_door], 13);
+			kernel_seq_trigger(seq[fx_door],
+				KERNEL_TRIGGER_EXPIRE, 0, ROOM_108_DOOR_CLOSES + 1);
+			player.walker_visible = false;
+			aa[1] = kernel_run_animation(kernel_name('d', 1), ROOM_108_DOOR_CLOSES + 2);
+			kernel_synch(KERNEL_ANIM, aa[1], KERNEL_PLAYER, 0);
+			break;
+
+		case ROOM_108_DOOR_CLOSES + 1:
+			local->temp = seq[fx_door];
+			seq[fx_door] = kernel_seq_stamp(ss[fx_door], false, KERNEL_FIRST);
+			kernel_seq_depth(seq[fx_door], 13);
+			kernel_synch(KERNEL_SERIES, seq[fx_door], KERNEL_SERIES, local->temp);
+			break;
+
+		case ROOM_108_DOOR_CLOSES + 2:
+			player.x = BOTTOM_OF_STAIRS_X;
+			player.y = BOTTOM_OF_STAIRS_Y;
+			player.walker_visible = true;
+			player.commands_allowed = true;
+			player_demand_facing(FACING_EAST);
+			kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[1]);
+			break;
+		}
+	}
 }
 
-void room_108_pre_parser() {
+void room_108_pre_parser(void) {
+	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_2(walk_through, doorway_to_cell)) {
+		player.walk_off_edge_to_room = 109;
+	}
 }
 
-void room_108_parser() {
 
+void room_108_parser(void) {
+	int temp;
+
+	if (player.look_around) {
+		text_show(10801);
+		goto handled;
+	}
+
+	if (player_said_2(walk_through, door_to_council_room) || player_said_2(open, door_to_council_room) ||
+		player_said_2(pull, door_to_council_room)) {
+		switch (kernel.trigger) {
+		case 0:
+			player.commands_allowed = false;
+			player.walker_visible = false;
+			aa[1] = kernel_run_animation(kernel_name('u', 1), 1);
+			kernel_synch(KERNEL_ANIM, aa[1], KERNEL_PLAYER, 0);
+			break;
+
+		case 1:
+			player.x = WALK_TO_X_FROM_107;
+			player.y = WALK_TO_Y_FROM_107;
+			player_demand_facing(FACING_WEST);
+			player.walker_visible = true;
+			kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[1]);
+			player_walk(OPEN_DOOR_X_ROOM_107, OPEN_DOOR_Y_ROOM_107, FACING_NORTH);
+			player_walk_trigger(2);
+			break;
+
+		case 2:
+			player.walker_visible = false;
+			seq[fx_open_door] = kernel_seq_pingpong(ss[fx_open_door],
+				false, 8, 0, 0, 2);
+			kernel_seq_player(seq[fx_open_door], true);
+			kernel_seq_trigger(seq[fx_open_door],
+				KERNEL_TRIGGER_SPRITE, 2, 3);
+			kernel_seq_trigger(seq[fx_open_door],
+				KERNEL_TRIGGER_EXPIRE, 0, 4);
+			break;
+
+		case 3:
+			kernel_seq_delete(seq[fx_door]);
+			sound_play(N_DoorOpens);
+			seq[fx_door] = kernel_seq_forward(ss[fx_door], false,
+				6, 0, 0, 1);
+			kernel_seq_depth(seq[fx_door], 13);
+			break;
+
+		case 4:
+			player.walker_visible = true;
+			kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_open_door]);
+			kernel_timing_trigger(TENTH_SECOND, 5);
+			break;
+
+		case 5:
+			player_walk(START_X_ROOM_107, START_Y_ROOM_107, FACING_NORTH);
+			player_walk_trigger(6);
+			break;
+
+		case 6:
+			kernel_seq_delete(seq[fx_door]);
+			sound_play(N_DoorCloses);
+			seq[fx_door] = kernel_seq_backward(ss[fx_door], false, 7, 0, 0, 1);
+			kernel_seq_depth(seq[fx_door], 1);
+			kernel_seq_trigger(seq[fx_door], KERNEL_TRIGGER_EXPIRE, 0, 7);
+			break;
+
+		case 7:
+			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);
+			kernel_timing_trigger(6, 8);
+			break;
+
+		case 8:
+			new_room = 107;
+			break;
+		}
+		goto handled;
+	}
+
+	if (player_said_1(look) || player_said_1(look_at)) {
+		if (player_said_1(dungeon_floor)) {
+			text_show(10802);
+			goto handled;
+		}
+
+		if (player_said_1(dungeon_wall)) {
+			text_show(10803);
+			goto handled;
+		}
+
+		if (player_said_1(rocks)) {
+			text_show(10804);
+			goto handled;
+		}
+
+		if (player_said_1(doorway_to_cell)) {
+			text_show(10805);
+			goto handled;
+		}
+
+		if (player_said_1(guard_station)) {
+			text_show(10806);
+			goto handled;
+		}
+
+		if (player_said_1(guard_stool)) {
+			text_show(10807);
+			goto handled;
+		}
+
+		if (player_said_1(door_to_dungeon_cell)) {
+			text_show(10808);
+			goto handled;
+		}
+
+		if (player_said_1(door_to_council_room)) {
+			text_show(10809);
+			goto handled;
+		}
+
+		if (player_said_1(sconce)) {
+			text_show(10810);
+			goto handled;
+		}
+	}
+
+	if (player_said_2(open, door_to_dungeon_cell)) {
+		text_show(41);
+		goto handled;
+	}
+
+	if (player_said_2(close, door_to_dungeon_cell)) {
+		text_show(10812);
+		goto handled;
+	}
+
+	if (player_said_2(close, door_to_council_room)) {
+		text_show(44);
+		goto handled;
+	}
+
+	goto done;
+
+handled:
+	player.command_ready = false;
+
+done:
+	;
 }
 
+
 void room_108_synchronize(Common::Serializer &s) {
 	
 }


Commit: 555fe3d2031646a051bf2aace49770db3c1cdc54
    https://github.com/scummvm/scummvm/commit/555fe3d2031646a051bf2aace49770db3c1cdc54
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-10T16:52:20+10:00

Commit Message:
MADS: DRAGONSPHERE: Added room 109

Changed paths:
    engines/mads/madsv2/dragonsphere/mads/conv.h
    engines/mads/madsv2/dragonsphere/mads/words.h
    engines/mads/madsv2/dragonsphere/rooms/room107.cpp
    engines/mads/madsv2/dragonsphere/rooms/room108.cpp
    engines/mads/madsv2/dragonsphere/rooms/room109.cpp


diff --git a/engines/mads/madsv2/dragonsphere/mads/conv.h b/engines/mads/madsv2/dragonsphere/mads/conv.h
index b64f6ffcd08..dd07d1948e1 100644
--- a/engines/mads/madsv2/dragonsphere/mads/conv.h
+++ b/engines/mads/madsv2/dragonsphere/mads/conv.h
@@ -56,6 +56,10 @@ enum {
 	conv004_exit_b_b = 10
 };
 
+enum {
+	conv005_exit_b_b = 16
+};
+
 enum {
 	conv034_five_b_b = 4,
 	conv034_seven_only = 7,
diff --git a/engines/mads/madsv2/dragonsphere/mads/words.h b/engines/mads/madsv2/dragonsphere/mads/words.h
index 252f47c8453..26c66365870 100644
--- a/engines/mads/madsv2/dragonsphere/mads/words.h
+++ b/engines/mads/madsv2/dragonsphere/mads/words.h
@@ -56,6 +56,10 @@ enum {
 	words_door_to_throne_room  = 176,
 	words_dining_table         = 178,
 	words_dungeon_floor        = 182,
+	words_bedding              = 185,
+	words_floor_grate          = 186,
+	words_manacles             = 187,
+	words_calendar             = 188,
 	words_door_to_guardroom    = 189,
 	words_door_to_council_room = 190,
 	words_guard_station        = 191,
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room107.cpp b/engines/mads/madsv2/dragonsphere/rooms/room107.cpp
index 7eddaadfa93..4629b3c7840 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room107.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room107.cpp
@@ -721,7 +721,18 @@ done:
 }
 
 void room_107_synchronize(Common::Serializer &s) {
-	
+	for (int16 &v : scratch.sprite)    s.syncAsSint16LE(v);
+	for (int16 &v : scratch.sequence)  s.syncAsSint16LE(v);
+	for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+	s.syncAsSint16LE(scratch.temp);
+	s.syncAsSint16LE(scratch.qm_frame);
+	s.syncAsSint16LE(scratch.qm_action);
+	s.syncAsSint16LE(scratch.anim_0_running);
+	s.syncAsSint16LE(scratch.q_frame);
+	s.syncAsSint16LE(scratch.q_action);
+	s.syncAsSint16LE(scratch.q_talk_count);
+	s.syncAsSint16LE(scratch.anim_1_running);
+	s.syncAsSint16LE(scratch.prevent);
 }
 
 void room_107_preload() {
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room108.cpp b/engines/mads/madsv2/dragonsphere/rooms/room108.cpp
index 150b30fdaf1..e590bef94c5 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room108.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room108.cpp
@@ -444,7 +444,11 @@ done:
 
 
 void room_108_synchronize(Common::Serializer &s) {
-	
+	for (int16 &v : scratch.sprite)    s.syncAsSint16LE(v);
+	for (int16 &v : scratch.sequence)  s.syncAsSint16LE(v);
+	for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+	s.syncAsSint16LE(scratch.eye_frame);
+	s.syncAsSint16LE(scratch.temp);
 }
 
 void room_108_preload() {
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room109.cpp b/engines/mads/madsv2/dragonsphere/rooms/room109.cpp
index 2ff4a30960d..9d5f9967775 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room109.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room109.cpp
@@ -22,9 +22,14 @@
 #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"
+#include "mads/madsv2/dragonsphere/mads/conv.h"
+#include "mads/madsv2/dragonsphere/mads/inventory.h"
+#include "mads/madsv2/dragonsphere/mads/sounds.h"
+#include "mads/madsv2/dragonsphere/mads/words.h"
 #include "mads/madsv2/dragonsphere/global.h"
 #include "mads/madsv2/dragonsphere/rooms/section1.h"
 #include "mads/madsv2/dragonsphere/rooms/room109.h"
@@ -35,6 +40,19 @@ namespace Dragonsphere {
 namespace Rooms {
 
 struct Scratch {
+	int16 sprite[15];       /* Sprite series handles */
+	int16 sequence[15];     /* Sequence handles      */
+	int16 animation[4];     /* Animation handles     */
+
+	int16 seal_frame;       /* animation frame being held for seal stuff */
+	int16 seal_action;      /* Type of action to run for seal animation */
+	int16 seal_talk_count;  /* counter for seal talking */
+	int16 anim_0_running;
+
+	int16 queen_frame;      /* animation frame being held for queen stuff */
+	int16 queen_action;     /* Type of action to run for queen animation */
+	int16 queen_talk_count; /* counter for queen talking */
+	int16 anim_1_running;
 };
 
 #define local (&scratch)
@@ -42,26 +60,422 @@ struct Scratch {
 #define seq   local->sequence
 #define aa    local->animation
 
-//static Scratch scratch;
+static Scratch scratch;
+
+/* ========================= Sprites ========================= */
+
+#define fx_door             0   /* rm109x0 */
+
+
+/* ======================== Triggers ========================= */
+
+#define ROOM_109_YOU_TALK   60
+#define ROOM_109_ME_TALK    65
+
+/* ====================== Other macros ======================= */
+
+#define START_X_ROOM_108    79
+#define START_Y_ROOM_108    108
+
+#define SEAL_SHUT_UP        0
+#define SEAL_TALK           1
+#define SEAL_LEAVE          2
+
+
+#define QUEEN_INIT          0
+#define QUEEN_SHUT_UP       1
+#define QUEEN_TALK          2
+
+
+#define CONV_QUEEN          5
+
+
+static void room_109_init() {
+	if (previous_room != KERNEL_RESTORING_GAME) {
+		local->anim_0_running = false;
+		local->anim_1_running = false;
+	}
+
+	local->seal_talk_count = 0;
+	local->queen_talk_count = 0;
+
+	conv_get(CONV_QUEEN);
+
+	if (previous_room == 117 || local->anim_0_running) {
+		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], 14);
+		kernel_init_dialog();  /* clear interface */
+		kernel_set_interface_mode(INTER_CONVERSATION);
+		player.commands_allowed = false;
+		player.walker_visible = false;
+		aa[1] = kernel_run_animation(kernel_name('q', 1), 0);
+		local->anim_1_running = true;
+		local->queen_action = QUEEN_INIT;
+		if (conv_restore_running == CONV_QUEEN) {
+			aa[0] = kernel_run_animation(kernel_name('s', 1), 0);
+			kernel_reset_animation(aa[0], 13);
+			kernel_reset_animation(aa[1], 17);
+			local->anim_0_running = true;
+			local->seal_action = SEAL_SHUT_UP;
+			local->queen_action = QUEEN_SHUT_UP;
+			conv_run(CONV_QUEEN);
+		}
+
+	} else if (previous_room != KERNEL_RESTORING_GAME) { /* Player comes from Guardroom rm108 */
+		player.x = START_X_ROOM_108;
+		player.y = START_Y_ROOM_108;
+		player.facing = FACING_SOUTHEAST;
+	}
+
+	section_1_music();
+}
+
+static void handle_animation_seal() {
+	int seal_reset_frame;
+
+	if (kernel_anim[aa[0]].frame != local->seal_frame) {
+		local->seal_frame = kernel_anim[aa[0]].frame;
+		seal_reset_frame = -1;
+
+		switch (local->seal_frame) {
+		case 8:
+			conv_run(CONV_QUEEN);
+			local->queen_action = QUEEN_SHUT_UP;
+			break;
+
+		case 9:   /* end of coming into room */
+		case 10:  /* end talk 1              */
+		case 11:  /* end talk 2              */
+		case 12:  /* end talk 3              */
+		case 13:  /* end freeze 1            */
+		case 14:  /* end freeze 2            */
+			switch (local->seal_action) {
+			case SEAL_TALK:
+				seal_reset_frame = imath_random(9, 11);
+				++local->seal_talk_count;
+				if (local->seal_talk_count > 10) {
+					local->seal_action = SEAL_SHUT_UP;
+					local->seal_talk_count = 0;
+					seal_reset_frame = 12;
+				}
+				break;
+
+			case SEAL_SHUT_UP:
+				++local->seal_talk_count;
+				if (local->seal_talk_count > imath_random(3, 7)) {
+					local->seal_talk_count = 0;
+					seal_reset_frame = imath_random(12, 13);
+				} else {
+					seal_reset_frame = local->seal_frame - 1;
+				}
+				break;
+
+			case SEAL_LEAVE:
+				seal_reset_frame = 14;
+				break;
+			}
+			break;
+
+		case 21:  /* end of leaving */
+			new_room = 117;
+			break;
+		}
+
+		if (seal_reset_frame >= 0) {
+			kernel_reset_animation(aa[0], seal_reset_frame);
+			local->seal_frame = seal_reset_frame;
+		}
+	}
+}
+
+static void handle_animation_queen() {
+	int queen_reset_frame;
+	int random;
+
+	if (kernel_anim[aa[1]].frame != local->queen_frame) {
+		local->queen_frame = kernel_anim[aa[1]].frame;
+		queen_reset_frame = -1;
+
+		switch (local->queen_frame) {
+		case 12:
+			aa[0] = kernel_run_animation(kernel_name('s', 1), 0);
+			local->anim_0_running = true;
+			local->seal_action = SEAL_SHUT_UP;
+			break;
 
-void room_109_init() {
+		case 13:  /* end of queen signing */
+			if (local->queen_action == QUEEN_INIT) {
+				queen_reset_frame = 12; /* keep signing */
+			} /* else turn to see seal emerging from grate (new node) */
+			break;
 
+		case 17:  /* end of freeze                     */
+		case 18:  /* end of freeze                     */
+		case 19:  /* end of freeze and looking at seal */
+		case 26:  /* end talk 1                        */
+		case 37:  /* end talk 2                        */
+		case 51:  /* end talk 3                        */
+			switch (local->queen_action) {
+			case QUEEN_TALK:
+				random = imath_random(1, 3);
+				if (random == 1) {
+					queen_reset_frame = 19;  /* do talk 1 */
+					local->queen_action = QUEEN_SHUT_UP;
+				} else if (random == 2) {
+					queen_reset_frame = 26;  /* do talk 2 (new node) */
+				} else if (random == 3) {
+					queen_reset_frame = 37;  /* do talk 3 (new node) */
+				}
+				break;
+
+			case QUEEN_SHUT_UP:
+				++local->queen_talk_count;
+				if (local->queen_talk_count > imath_random(3, 7)) {
+					local->queen_talk_count = 0;
+					queen_reset_frame = imath_random(16, 18);
+				} else {
+					queen_reset_frame = local->queen_frame - 1; /* repeat this frame */
+				}
+				break;
+			}
+			break;
+
+		case 30:  /* end of coming to this node */
+		case 31:  /* end of talk frame          */
+		case 32:  /* end of talk frame          */
+		case 33:  /* end of talk frame          */
+			switch (local->queen_action) {
+			case QUEEN_TALK:
+				queen_reset_frame = imath_random(30, 32);  /* random talk frames */
+				++local->queen_talk_count;
+				if (local->queen_talk_count > 17) {
+					local->queen_action = QUEEN_SHUT_UP;
+					local->queen_talk_count = 0;
+					queen_reset_frame = 33;
+				}
+				break;
+
+			case QUEEN_SHUT_UP:
+				queen_reset_frame = 33;  /* end talking (new node) */
+				break;
+			}
+			break;
+
+		case 42:  /* end of coming to this node */
+		case 43:  /* end of talk frame          */
+		case 44:  /* end of talk frame          */
+		case 45:  /* end of talk frame          */
+
+			switch (local->queen_action) {
+
+			case QUEEN_TALK:
+				queen_reset_frame = imath_random(42, 44);   /* random talk frames */
+				++local->queen_talk_count;
+				if (local->queen_talk_count > 17) {
+					local->queen_action = QUEEN_SHUT_UP;
+					local->queen_talk_count = 0;
+					queen_reset_frame = 45;
+				}
+				break;
+
+			case QUEEN_SHUT_UP:
+				queen_reset_frame = 45;  /* end talking (new node) */
+				break;
+			}
+			break;
+		}
+
+		if (queen_reset_frame >= 0) {
+			kernel_reset_animation(aa[1], queen_reset_frame);
+			local->queen_frame = queen_reset_frame;
+		}
+	}
 }
 
-void room_109_daemon() {
+static void room_109_daemon() {
+	if (local->anim_0_running) {
+		handle_animation_seal();
+	}
 
+	if (local->anim_1_running) {
+		handle_animation_queen();
+	}
 }
 
-void room_109_pre_parser() {
+static void process_conversation_queen() {
+	int you_trig_flag = false;
+	int me_trig_flag = false;
+
+	if (player_verb == conv005_exit_b_b) {
+		local->seal_action = SEAL_LEAVE;
+		you_trig_flag = true;
+		me_trig_flag = true;
+	}
 
+	if (local->seal_action != SEAL_LEAVE) {
+		switch (kernel.trigger) {
+		case ROOM_109_ME_TALK:
+			local->seal_action = SEAL_TALK;
+			local->queen_action = QUEEN_SHUT_UP;
+			break;
+
+		case ROOM_109_YOU_TALK:
+			local->seal_action = SEAL_SHUT_UP;
+			local->queen_action = QUEEN_TALK;
+			break;
+		}
+	}
+
+	if (!me_trig_flag) {
+		conv_me_trigger(ROOM_109_ME_TALK);
+	} /* if me_trig_flag == true, then a me trigger is called from above, not here. */
+
+	if (!you_trig_flag) {
+		conv_you_trigger(ROOM_109_YOU_TALK);
+	} /* if you_trig_flag == true, then a you trigger is called from above, not here. */
+
+	local->seal_talk_count = 0;
+	local->queen_talk_count = 0;
 }
 
-void room_109_parser() {
 
+static void room_109_pre_parser() {
+	if (player_said_1(door_to_guardroom)) {
+		if (!player_said_1(walk_through)) {
+			player.need_to_walk = false;
+		}
+	}
+}
+
+static void room_109_parser() {
+	if (conv_control.running == CONV_QUEEN) {
+		process_conversation_queen();
+		goto handled;
+	}
+
+	if (player.look_around) {
+		if (global[player_persona] == PLAYER_IS_KING) {
+			text_show(10901);
+		} else {
+			text_show(10912);
+		}
+		goto handled;
+	}
+
+	if (player_said_2(close, door_to_guardroom)) {
+		text_show(10917);
+		goto handled;
+	}
+
+	if (player_said_2(walk_through, door_to_guardroom)) {
+		new_room = 108;
+		goto handled;
+	}
+
+	/* take out later */
+	if (player_said_2(talk_to, floor_grate)) {
+		new_room = 117;
+		goto handled;
+	}
+
+	if (player_said_1(look) || player_said_1(look_at)) {
+		if (player_said_1(dungeon_floor)) {
+			text_show(10902);
+			goto handled;
+		}
+
+		if (player_said_1(dungeon_wall)) {
+			text_show(10903);
+			goto handled;
+		}
+
+		if (player_said_1(floor_grate)) {
+			if (global[player_persona] == PLAYER_IS_KING) {
+				text_show(10904);
+			} else {
+				text_show(10913);
+			}
+			goto handled;
+		}
+
+		if (player_said_1(calendar)) {
+			text_show(10906);
+			goto handled;
+		}
+
+		if (player_said_1(bedding)) {
+			text_show(10907);
+			goto handled;
+		}
+
+		if (player_said_1(manacles)) {
+			text_show(10909);
+			goto handled;
+		}
+
+		if (player_said_1(door_to_guardroom)) {
+			text_show(10911);
+			goto handled;
+		}
+	}
+
+	if ((player_said_1(open) || player_said_1(pull) ||
+		player_said_1(push) || player_said_1(take)) &&
+		player_said_1(bedding)) {
+		/* if (player_not_seal) */
+		text_show(10908);
+		goto handled;
+	}
+
+	if (player_said_2(pull, manacles)) {
+		/* if (player_not_seal) */
+		text_show(10910);
+		goto handled;
+	}
+
+	if ((player_said_1(open) || player_said_1(pull) ||
+		player_said_1(push)) &&
+		player_said_1(floor_grate)) {
+		/* if (player_not_seal) */
+		text_show(10905);
+		/*  } else {
+		  text_show(10914);
+		  }*/
+		goto handled;
+	}
+
+	if (player_said_2(open, door_to_guardroom)) {
+		text_show(41);
+		goto handled;
+	}
+
+	if (player_said_2(close, door_to_guardroom)) {
+		text_show(44);
+		goto handled;
+	}
+
+	goto done;
+
+handled:
+	player.command_ready = false;
+
+done:
+	;
 }
 
 void room_109_synchronize(Common::Serializer &s) {
-	
+	for (int16 &v : scratch.sprite)    s.syncAsSint16LE(v);
+	for (int16 &v : scratch.sequence)  s.syncAsSint16LE(v);
+	for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+	s.syncAsSint16LE(scratch.seal_frame);
+	s.syncAsSint16LE(scratch.seal_action);
+	s.syncAsSint16LE(scratch.seal_talk_count);
+	s.syncAsSint16LE(scratch.anim_0_running);
+	s.syncAsSint16LE(scratch.queen_frame);
+	s.syncAsSint16LE(scratch.queen_action);
+	s.syncAsSint16LE(scratch.queen_talk_count);
+	s.syncAsSint16LE(scratch.anim_1_running);
 }
 
 void room_109_preload() {




More information about the Scummvm-git-logs mailing list