[Scummvm-git-logs] scummvm master -> b69d587feb1ab4668ca92b6d8d920722f90746e3

dreammaster noreply at scummvm.org
Wed Jan 17 02:08:54 UTC 2024


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e2ecea61f5 M4: RIDDLE: Init code for room 304
ad029b18cf M4: RIDDLE: Start of room 201
b69d587feb M4: Better skipping showing intro again after first time


Commit: e2ecea61f527ce11a3f34713ca80fd1343e0574f
    https://github.com/scummvm/scummvm/commit/e2ecea61f527ce11a3f34713ca80fd1343e0574f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-01-16T17:57:12-08:00

Commit Message:
M4: RIDDLE: Init code for room 304

Changed paths:
    engines/m4/platform/sound/midi.cpp
    engines/m4/platform/sound/midi.h
    engines/m4/riddle/rooms/room.h
    engines/m4/riddle/rooms/section3/room304.cpp
    engines/m4/riddle/rooms/section3/room304.h
    engines/m4/riddle/rooms/section4/room494.cpp
    engines/m4/riddle/rooms/section4/room494.h


diff --git a/engines/m4/platform/sound/midi.cpp b/engines/m4/platform/sound/midi.cpp
index 8f16c206335..780df227dd5 100644
--- a/engines/m4/platform/sound/midi.cpp
+++ b/engines/m4/platform/sound/midi.cpp
@@ -25,6 +25,10 @@
 namespace M4 {
 namespace Sound {
 
+void Midi::midi_play(const char *name, int volume, int loop, int trigger, int roomNum) {
+	warning("TODO: midi_play");
+}
+
 void Midi::task() {
 	// No implementation
 }
@@ -43,6 +47,10 @@ void Midi::set_overall_volume(int vol) {
 
 } // namespace Sound
 
+void midi_play(const char *name, int volume, int loop, int trigger, int roomNum) {
+	_G(midi).midi_play(name, volume, loop, trigger, roomNum);
+}
+
 void midi_loop() {
 	_G(midi).loop();
 }
diff --git a/engines/m4/platform/sound/midi.h b/engines/m4/platform/sound/midi.h
index ec75d692cc9..3997a408e0d 100644
--- a/engines/m4/platform/sound/midi.h
+++ b/engines/m4/platform/sound/midi.h
@@ -30,6 +30,7 @@ namespace Sound {
 
 class Midi {
 public:
+	void midi_play(const char *name, int volume, int loop, int trigger, int roomNum);
 	void task();
 	void loop();
 	void stop();
@@ -38,6 +39,7 @@ public:
 
 } // namespace Sound
 
+void midi_play(const char *name, int volume, int loop, int trigger, int roomNum);
 void midi_loop();
 void midi_stop();
 void midi_set_overall_volume(int vol);
diff --git a/engines/m4/riddle/rooms/room.h b/engines/m4/riddle/rooms/room.h
index b45e72c9e1f..0f4365ccbeb 100644
--- a/engines/m4/riddle/rooms/room.h
+++ b/engines/m4/riddle/rooms/room.h
@@ -34,7 +34,10 @@ namespace Rooms {
 
 class Room : public M4::Room {
 protected:
+	static void intrMsgNull(frac16 myMessage, struct machine *sender) {}
+
 	void restoreAutosave();
+	int _roomVal1 = 0;
 
 public:
 	Room() : M4::Room() {}
diff --git a/engines/m4/riddle/rooms/section3/room304.cpp b/engines/m4/riddle/rooms/section3/room304.cpp
index 92ea30fbbb7..1d29a9e70a4 100644
--- a/engines/m4/riddle/rooms/section3/room304.cpp
+++ b/engines/m4/riddle/rooms/section3/room304.cpp
@@ -19,18 +19,231 @@
  *
  */
 
-#include "m4/riddle/rooms/section3/room304.h"
 #include "m4/graphics/gr_series.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/platform/keys.h"
+#include "m4/riddle/rooms/section3/room304.h"
 #include "m4/riddle/vars.h"
+#include "m4/riddle/riddle.h"
 
 namespace M4 {
 namespace Riddle {
 namespace Rooms {
 
 void Room304::init() {
+	interface_show();
+	_val1 = 0;
+
+	if (_G(game).previous_room != KERNEL_RESTORING_GAME)
+		_roomVal1 = 0;
+
+	if (_G(game).previous_room == 303 && _G(flags)[V001])
+		_G(game).previous_room = 354;
+
+	if (_G(game).previous_room == KERNEL_RESTORING_GAME && _G(flags)[V001])
+		_G(game).previous_room = 354;
+
+	hotspot_set_active(_G(flags)[V001] ? "RUG" : "RUG ", false);
+
+	switch (_G(game).previous_room) {
+	case KERNEL_RESTORING_GAME:
+		if (_G(flags)[V001])
+			midi_play("thinker2", 255, 1, -1, 949);
+
+		if (_G(flags)[V084] == 2 || player_been_here(201))
+			_sword = series_show_sprite("one frame sword", 0, 0xa00);
+		else
+			hotspot_set_active("SAMURAI SWORD", false);
+		break;
+
+	case 303:
+		player_set_commands_allowed(false);
+		ws_demand_location(458, 263, 8);
+
+		if (_G(flags)[V084] == 2 || player_been_here(201)) {
+			_sword = series_show_sprite("one frame sword", 0, 0xa00);
+			kernel_timing_trigger(1, 51);
+		} else {
+			hotspot_set_active("SAMURAI SWORD", false);
+		}
+		break;
+
+	default:
+		AddSystemHotkey(KEY_ESCAPE, Hotkeys::escape_key_pressed);
+		AddSystemHotkey(KEY_F2, Hotkeys::saveGame);
+		AddSystemHotkey(KEY_F3, Hotkeys::loadGame);
+
+		if (_G(flags)[V001]) {
+			mouse_show();
+			_G(flags)[V001] = 1;
+			digi_preload("304r52");
+			digi_preload("304_s01");
+			digi_preload("304_s04");
+			player_set_commands_allowed(false);
+
+			_val2 = _val3 = _val4 = 0;
+			ws_demand_location(452, 285, 9);
+			kernel_timing_trigger(1, 49);
+			_trunk = series_show_sprite("one frame trunk", 0, 0);
+			_stick = series_show_sprite("one frame stick", 0, 0xf00);
+
+			LoadWSAssets("304 MC SCRIPT", _G(master_palette));
+
+			_mei1 = series_load("MEI STANDS AND LOOKS");
+			_G(globals)[GLB_TEMP_1] = _mei1 << 24;
+			_G(globals)[GLB_TEMP_2] = 0xf050000;
+
+			_mei2 = series_load("MEI TURNS INTO WALKER");
+			_G(globals)[GLB_TEMP_3] = _mei2 << 24;
+			_G(globals)[GLB_TEMP_4] = 0xf050000;
+
+			_mei3 = series_load("MEI CHEN NY WALKER POS4");
+			_G(globals)[GLB_TEMP_5] = _mei3 << 24;
+
+			_machine1 = TriggerMachineByHash(32, nullptr, -1, -1, intrMsgNull, false, "MACHINE mc");
+
+			LoadWSAssets("304 FL SN SCRIPT", _G(master_palette));
+			AddWSAssetCELS("test3", 2, nullptr);
+			AddWSAssetCELS("ripsh3", 12, nullptr);
+			_smoke = series_load("LF AND COBRA FIRE SMOKE", -1, _G(master_palette));
+			_G(globals)[GLB_TEMP_1] = _smoke << 24;
+			_G(globals)[GLB_TEMP_2] = 0x10000;
+
+			_machine2 = TriggerMachineByHash(45, nullptr, -1, -1, intrMsg, 0, "MACHINE fl snake rock");
+		}
+
+		_sword = series_show_sprite("one frame sword", 0, 0xa00);
+		break;
+	}
+
+	if (!_G(flags)[V001]) {
+		hotspot_set_active("MEI CHEN", false);
+		hotspot_set_active("FENG LI", false);
+
+		if (_G(flags)[V084] != 1 || player_been_here(301)) {
+			hotspot_set_active("HANDLING STICK", false);
+		} else {
+			_stick = series_show_sprite("one frame stick", 0, 0xf00);
+		}
+	}
 }
 
 void Room304::daemon() {
+	switch (_G(kernel).trigger) {
+	case 49:
+		ws_walk(387, 292, nullptr, 50, 9);
+		digi_play("304m01", 1, 255, 60);
+		break;
+
+	case 50:
+		player_set_commands_allowed(true);
+		break;
+
+	case 51:
+		ws_walk(431, 287, nullptr, 50, 8);
+		break;
+
+	case 60:
+		midi_play("thinker2", 255, 1, -1, 949);
+		break;
+
+	default:
+		break;
+	}
+}
+
+void Room304::pre_parser() {
+	bool takeFlag = player_said("take");
+	bool gearFlag = player_said("gear");
+
+	if (_roomVal1) {
+		terminateMachineAndNull(_machine3);
+		_roomVal1 = 0;
+		intr_cancel_sentence();
+		hotspot_restore_all();
+		interface_show();
+	}
+
+	if (_G(flags)[V001]) {
+		_G(player).need_to_walk = false;
+		_G(player).ready_to_walk = true;
+		_G(player).waiting_for_walk = false;
+
+		if ((takeFlag || gearFlag) && player_said("samurai sword")) {
+			player_set_commands_allowed(false);
+			_val2 = 1;
+			digi_preload("304_s10");
+			digi_preload("304_s05");
+			_cutSnake = series_load("CUT SNAKE");
+			sendWSMessage(0xa0000, 0, _machine2, 0, nullptr, 1);
+		}
+
+		if ((takeFlag || gearFlag) && player_said("handling stick")) {
+			digi_preload("304_s03");
+			digi_preload("304_s08");
+			digi_preload("304_s02");
+			digi_preload("304_s11");
+		}
+	}
+}
+
+void Room304::parser() {
+	// TODO: parser
+}
+
+void Room304::intrMsg(frac16 myMessage, struct machine *sender) {
+	Room304 *r = static_cast<Room304 *>(g_engine->_activeRoom);
+	auto oldMode = _G(kernel).trigger_mode;
+
+	if ((myMessage >> 16) == 57) {
+		if ((_G(globals)[GLB_TEMP_1] >> 16) == 1) {
+			player_set_commands_allowed(false);
+			terminateMachineAndNull(r->_machine2);
+			series_unload(r->_smoke);
+			r->_cobra = series_load("COBRA KILLS RIP AND LF");
+			digi_preload("304_s07");
+
+			_G(kernel).trigger_mode = KT_PARSE;
+			r->_machine2 = series_ranged_play("LF AND COBRA FIRE SMOKE", 1, 0, 25, 49, 100, 0x200, 5, 49);
+			_G(kernel).trigger_mode = oldMode;
+
+			digi_play("304_s06", 1);
+			r->_val4 = 1;
+			sendWSMessage(0x200000, 0, r->_machine1, 0, nullptr, 1);
+			return;
+		}
+
+		if (r->_val3) {
+			ws_demand_location(382, 295);
+			player_set_commands_allowed(false);
+			terminateMachineAndNull(r->_machine2);
+			terminateMachineAndNull(r->_stick);
+			digi_stop(1);
+			terminateMachineAndNull(r->_trunk);
+
+			r->_handle = series_stream("SNAKE HANDLE", 5, 0, 17);
+			series_stream_break_on_frame(r->_handle, 10, 13);
+			sendWSMessage(0x200000, 0, r->_machine1, 0, nullptr, 1);
+			_G(flags)[V084] = 2;
+			return;
+		}
+	}
+
+	if ((myMessage >> 16) == 58 && r->_val2) {
+		ws_demand_location(382, 295);
+		ws_hide_walker();
+		player_set_commands_allowed(false);
+		terminateMachineAndNull(r->_machine2);
+		series_unload(r->_smoke);
+		digi_stop(1);
+
+		_G(kernel).trigger_mode = KT_PARSE;
+		series_ranged_play("CUT SNAKE", 1, 0, 0, 10, 100, 0x200, 4, 11);
+		_G(kernel).trigger_mode = oldMode;
+
+		sendWSMessage(0x200000, 0, r->_machine1, 0, nullptr, 1);
+		_G(flags)[V084] = 1;
+	}
 }
 
 } // namespace Rooms
diff --git a/engines/m4/riddle/rooms/section3/room304.h b/engines/m4/riddle/rooms/section3/room304.h
index 5cdb1b74ade..8a326d30c01 100644
--- a/engines/m4/riddle/rooms/section3/room304.h
+++ b/engines/m4/riddle/rooms/section3/room304.h
@@ -29,12 +29,35 @@ namespace Riddle {
 namespace Rooms {
 
 class Room304 : public Room {
+private:
+	int _val1 = 0;
+	int _val2 = 0;
+	int _val3 = 0;
+	int _val4 = 0;
+	machine *_sword = nullptr;
+	machine *_trunk = nullptr;
+	machine *_stick = nullptr;
+	machine *_handle = nullptr;
+	int _smoke = -1;
+	machine *_machine1 = nullptr;
+	machine *_machine2 = nullptr;
+	machine *_machine3 = nullptr;
+	int _cutSnake = -1;
+	int _mei1 = -1;
+	int _mei2 = -1;
+	int _mei3 = -1;
+	int _cobra = -1;
+
+	static void intrMsg(frac16 myMessage, struct machine *sender);
+
 public:
 	Room304() : Room() {}
 	~Room304() override {}
 
 	void init() override;
 	void daemon() override;
+	void pre_parser() override;
+	void parser() override;
 };
 
 } // namespace Rooms
diff --git a/engines/m4/riddle/rooms/section4/room494.cpp b/engines/m4/riddle/rooms/section4/room494.cpp
index 7ec2f94362b..80b45667596 100644
--- a/engines/m4/riddle/rooms/section4/room494.cpp
+++ b/engines/m4/riddle/rooms/section4/room494.cpp
@@ -21,6 +21,7 @@
 
 #include "m4/graphics/gr_series.h"
 #include "m4/gui/gui_sys.h"
+#include "m4/platform/keys.h"
 #include "m4/riddle/rooms/section4/room494.h"
 #include "m4/riddle/vars.h"
 #include "m4/riddle/walker.h"
@@ -43,13 +44,13 @@ void Room494::init() {
 	midi_stop();
 	mouse_show();
 
-	_hotkey27 = GetSystemHotkey(27);
-	_hotkey316 = GetSystemHotkey(316);
-	_hotkey317 = GetSystemHotkey(317);
+	_hotkeyEscape = GetSystemHotkey(KEY_ESCAPE);
+	_hotkeySave = GetSystemHotkey(KEY_F2);
+	_hotkeyLoad = GetSystemHotkey(KEY_F3);
 
-	RemoveSystemHotkey(316);
-	AddSystemHotkey(27, escapeFn);
-	AddSystemHotkey(317, escapeFn);
+	RemoveSystemHotkey(KEY_F2);
+	AddSystemHotkey(KEY_ESCAPE, escapeFn);
+	AddSystemHotkey(KEY_F3, escapeFn);
 	_machine1 = _machine2 = 0;
 	_selectedBtn1 = _selectedBtn2 = -1;
 	midi_stop();
@@ -243,9 +244,9 @@ int Room494::getSelectedButton() const {
 }
 
 void Room494::restoreHotkeys() {
-	AddSystemHotkey(27, _hotkey27);
-	AddSystemHotkey(316, _hotkey316);
-	AddSystemHotkey(317, _hotkey317);
+	AddSystemHotkey(KEY_ESCAPE, _hotkeyEscape);
+	AddSystemHotkey(KEY_F2, _hotkeySave);
+	AddSystemHotkey(KEY_F3, _hotkeyLoad);
 }
 
 } // namespace Rooms
diff --git a/engines/m4/riddle/rooms/section4/room494.h b/engines/m4/riddle/rooms/section4/room494.h
index 98cbb013c2b..492c170ca91 100644
--- a/engines/m4/riddle/rooms/section4/room494.h
+++ b/engines/m4/riddle/rooms/section4/room494.h
@@ -41,9 +41,9 @@ private:
 	machine *_machine1 = nullptr;
 	machine *_machine2 = nullptr;
 	machine *_buttons[6];
-	HotkeyCB _hotkey27 = nullptr;
-	HotkeyCB _hotkey316 = nullptr;
-	HotkeyCB _hotkey317 = nullptr;
+	HotkeyCB _hotkeyEscape = nullptr;
+	HotkeyCB _hotkeySave = nullptr;
+	HotkeyCB _hotkeyLoad = nullptr;
 	bool _selectState = false;
 
 public:


Commit: ad029b18cf30e40f01bc6378c7e05de668919f47
    https://github.com/scummvm/scummvm/commit/ad029b18cf30e40f01bc6378c7e05de668919f47
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-01-16T17:57:12-08:00

Commit Message:
M4: RIDDLE: Start of room 201

Changed paths:
  A engines/m4/riddle/rooms/section2/section2_room.cpp
  A engines/m4/riddle/rooms/section2/section2_room.h
    engines/m4/graphics/gr_series.cpp
    engines/m4/graphics/gr_series.h
    engines/m4/module.mk
    engines/m4/riddle/rooms/room.cpp
    engines/m4/riddle/rooms/room.h
    engines/m4/riddle/rooms/section2/room201.cpp
    engines/m4/riddle/rooms/section2/room201.h
    engines/m4/wscript/ws_machine.cpp
    engines/m4/wscript/ws_machine.h


diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index b0dc4d3bf24..dad857e8243 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -241,6 +241,10 @@ machine *series_show(const char *seriesName, frac16 layer, uint32 flags, int16 t
 	return m;
 }
 
+machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer) {
+	return series_show(seriesName, layer, 0x40, -1, -1, index, s, x, y);
+}
+
 machine *series_show_sprite(const char *seriesName, int32 index, int32 layer) {
 	return series_show(seriesName, layer, 0x40, -1, -1, index);
 }
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 37b24cf8fd8..48ed2653e5c 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -94,7 +94,7 @@ void series_unload(int32 assetIndex);
 bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
 
 bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
-//machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer); // was series_show_sprite
+machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer);
 machine *series_show_sprite(const char *seriesName, int32 index, int32 layer);
 
 machine *series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index c893277fd8c..555de2f2b37 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -184,6 +184,7 @@ MODULE_OBJS = \
 	riddle/rooms/room.o \
 	riddle/rooms/section.o \
 	riddle/rooms/section2/section2.o \
+	riddle/rooms/section2/section2_room.o \
 	riddle/rooms/section2/room201.o \
 	riddle/rooms/section2/room202.o \
 	riddle/rooms/section2/room203.o \
diff --git a/engines/m4/riddle/rooms/room.cpp b/engines/m4/riddle/rooms/room.cpp
index debb96176c2..379e83701cb 100644
--- a/engines/m4/riddle/rooms/room.cpp
+++ b/engines/m4/riddle/rooms/room.cpp
@@ -39,6 +39,13 @@ void Room::restoreAutosave() {
 	}
 }
 
+void Room::triggerMachineByHashCallback(frac16 myMessage, machine *sender) {
+	int32 hi = myMessage >> 16;
+
+	if (hi >= 0)
+		kernel_trigger_dispatch_now(hi);
+}
+
 } // namespace Rooms
 } // namespace Riddle
 } // namespace M4
diff --git a/engines/m4/riddle/rooms/room.h b/engines/m4/riddle/rooms/room.h
index 0f4365ccbeb..0eb694d658f 100644
--- a/engines/m4/riddle/rooms/room.h
+++ b/engines/m4/riddle/rooms/room.h
@@ -34,7 +34,8 @@ namespace Rooms {
 
 class Room : public M4::Room {
 protected:
-	static void intrMsgNull(frac16 myMessage, struct machine *sender) {}
+	static void intrMsgNull(frac16 myMessage, machine *sender) {}
+	static void triggerMachineByHashCallback(frac16 myMessage, machine *sender);
 
 	void restoreAutosave();
 	int _roomVal1 = 0;
diff --git a/engines/m4/riddle/rooms/section2/room201.cpp b/engines/m4/riddle/rooms/section2/room201.cpp
index f1c45a66f46..85361416ae5 100644
--- a/engines/m4/riddle/rooms/section2/room201.cpp
+++ b/engines/m4/riddle/rooms/section2/room201.cpp
@@ -28,9 +28,86 @@ namespace Riddle {
 namespace Rooms {
 
 void Room201::init() {
+	if (keyCheck()) {
+		_flag1 = true;
+		player_set_commands_allowed(false);
+	} else {
+		_flag1 = false;
+	}
+
+	if (_G(game).previous_room != KERNEL_RESTORING_GAME)
+		_val1 = _val2 = 0;
+	_val3 = 0;
+
+	digi_preload("950_s02");
+	_nod = series_load("HEAD NOD Y/N");
+	_guyWriting = series_load("GUY WRITING");
+	_guyParcel = series_load("GUY TAKE PARCEL FROM RIPLEY");
+
+	if (_flag1) {
+		_series1 = series_load("GUY GET ATTENTION / WAVE");
+		_series2 = series_load("201rp99");
+		_series3 = series_load("201rp02");
+		_series4 = series_load("201mc01");
+	} else {
+		_series5 = series_load("GUY TAKE LETTER FROM RIPLEY");
+		_series6 = series_load("RIP TREK HAND TALK POS3");
+		_series7 = series_load("RIP TREK TELEGRAM DISPLACEMENT");
+		_series8 = series_load("GUY TELEGRAM FROM SLOT");
+	}
+
+	if (_G(game).previous_room != KERNEL_RESTORING_GAME)
+		_val4 = 0;
+	_val5 = 0;
+
+	kernel_timing_trigger(1, 507);
+	digi_play_loop("950_s02", 3, 50);
+
+	if (_flag1) {
+		_machine1 = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 0, 0, 100, 512, 0,
+			triggerMachineByHashCallback, "mc");
+		sendWSMessage(1, _machine1, _series4, 1, 1, -1, _series4, 1, 1, 0);
+
+		_machine2 = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 0, 0, 100, 512, 0,
+			triggerMachineByHashCallback, "rip");
+		sendWSMessage(1, _machine2, _series2, 1, 21, -1, _series2, 21, 21, 0);
+		kernel_timing_trigger(10, 100);
+
+	} else {
+		if (_val4 == 1)
+			_machine3 = series_place_sprite("201DOC", 0, 0, 0, 100, 0x410);
+
+		if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
+			if (_G(flags)[V053] == 1) {
+				_mei1 = series_load("MEI TREK HAND ON HIP POS4");
+				_mei2 = series_load("MEI TREK TALKER POS4");
+				_mei3 = series_load("MEI CHEN TREK WALK POS4");
+				_machine4 = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 200, 238, 73, 0x900, 0,
+					triggerMachineByHashCallback, "MC");
+				sendWSMessage(1, _machine4, _mei1, 22, 22, 2000, _mei1, 22, 22, 0);
+				_val5 = 2;
+				_val6 = 2;
+				_val7 = -1;
+				_val8 = -1;
+				_val9 = -1;
+
+			} else {
+				hotspot_set_active("MEI CHEN", false);
+			}
+			return;
+		}
+
+		player_set_commands_allowed(false);
+		ws_demand_location(79, 257, 3);
+
+		if (_G(flags)[V053] == 2) {
+			// TODO
+		}
+	}
 }
 
 void Room201::daemon() {
+	// TODO
 }
 
 } // namespace Rooms
diff --git a/engines/m4/riddle/rooms/section2/room201.h b/engines/m4/riddle/rooms/section2/room201.h
index 9bee1ed21dc..3906ed300df 100644
--- a/engines/m4/riddle/rooms/section2/room201.h
+++ b/engines/m4/riddle/rooms/section2/room201.h
@@ -22,15 +22,45 @@
 #ifndef M4_RIDDLE_ROOMS_SECTION2_ROOM201_H
 #define M4_RIDDLE_ROOMS_SECTION2_ROOM201_H
 
-#include "m4/riddle/rooms/room.h"
+#include "m4/riddle/rooms/section2/section2_room.h"
 
 namespace M4 {
 namespace Riddle {
 namespace Rooms {
 
-class Room201 : public Room {
+class Room201 : public Section2Room {
+private:
+	bool _flag1 = false;
+	int _val1 = 0;
+	int _val2 = 0;
+	int _val3 = 0;
+	int _val4 = 0;
+	int _val5 = 0;
+	int _val6 = 0;
+	int _val7 = 0;
+	int _val8 = 0;
+	int _val9 = 0;
+	int _nod = -1;
+	int _guyWriting = -1;
+	int _guyParcel = -1;
+	int _series1 = -1;
+	int _series2 = -2;
+	int _series3 = -1;
+	int _series4 = -1;
+	int _series5 = -1;
+	int _series6 = -2;
+	int _series7 = -1;
+	int _series8 = -1;
+	machine *_machine1 = nullptr;
+	machine *_machine2 = nullptr;
+	machine *_machine3 = nullptr;
+	machine *_machine4 = nullptr;
+	int _mei1 = -1;
+	int _mei2 = -1;
+	int _mei3 = -1;
+
 public:
-	Room201() : Room() {}
+	Room201() : Section2Room() {}
 	~Room201() override {}
 
 	void init() override;
diff --git a/engines/m4/riddle/rooms/section2/section2_room.cpp b/engines/m4/riddle/rooms/section2/section2_room.cpp
new file mode 100644
index 00000000000..4910bbaa73f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/section2_room.cpp
@@ -0,0 +1,36 @@
+/* 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 "m4/riddle/rooms/section2/section2.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+bool Section2Room::keyCheck() const {
+	return _G(flags)[V286] && _G(flags)[V288] && _G(flags)[V287] &&
+		inv_player_has("KEY");
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/section2_room.h b/engines/m4/riddle/rooms/section2/section2_room.h
new file mode 100644
index 00000000000..c1bb7900b64
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/section2_room.h
@@ -0,0 +1,44 @@
+/* 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 M4_RIDDLE_ROOMS_SECTION2_ROOM_H
+#define M4_RIDDLE_ROOMS_SECTION2_ROOM_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section2Room : public Room {
+protected:
+	bool keyCheck() const;
+
+public:
+	Section2Room() : Room() {}
+	~Section2Room() override {}
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 5840057cfd0..5ef0dcf1e14 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -1023,6 +1023,25 @@ machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash,
 	return m;
 }
 
+machine *TriggerMachineByHash(int32 val1, int32 val2, int32 val3, int32 val4, int32 val5, int32 val6,
+	int32 val7, int32 val8, int32 val9, int32 val10, bool flag,
+	MessageCB intrMsg, const char *machName) {
+	_G(globals)[GLB_TEMP_1] = val1 << 24;
+	_G(globals)[GLB_TEMP_2] = val2 << 16;
+	_G(globals)[GLB_TEMP_3] = val3 << 16;
+	_G(globals)[GLB_TEMP_4] = val4 << 16;
+
+	_G(globals)[GLB_TEMP_5] = (val5 << 16) / 100;
+	_G(globals)[GLB_TEMP_6] = val6 << 16;
+	_G(globals)[GLB_TEMP_7] = val7 << 16;
+	_G(globals)[GLB_TEMP_8] = val8 << 16;
+	_G(globals)[GLB_TEMP_9] = (val9 << 16) / 100;
+	_G(globals)[GLB_TEMP_10] = val10 << 16;
+	_G(globals)[GLB_TEMP_11] = flag ? 0xffff0000 : 0x10000;
+
+	return TriggerMachineByHash(40, nullptr, -1, -1, intrMsg, false, machName);
+}
+
 enum {
 	REGULAR_MSG = 0,
 	PERSISTENT_MSG
@@ -1234,4 +1253,22 @@ void sendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
 	}
 }
 
+void sendWSMessage(int32 val1, machine *recv, int32 val2, int32 val3, int32 val4,
+		int32 trigger, int val5, int32 val6, int32 val7, int32 val8) {
+	if (!trigger)
+		trigger = -1;
+
+	_G(globals)[GLB_TEMP_1] = val1 << 16;
+	_G(globals)[GLB_TEMP_2] = val3 << 24;
+	_G(globals)[GLB_TEMP_3] = val3 << 16;
+	_G(globals)[GLB_TEMP_4] = val4 << 16;
+	_G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
+	_G(globals)[GLB_TEMP_6] = val6 << 16;
+	_G(globals)[GLB_TEMP_7] = val7 << 16;
+	_G(globals)[GLB_TEMP_8] = val8 << 16;
+	_G(globals)[GLB_TEMP_9] = val5 << 16;
+
+	sendWSMessage(0x10000, 0, recv, 0, nullptr, 1);
+}
+
 } // End of namespace M4
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index 48ab78795df..1625ad6ce7d 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -196,12 +196,17 @@ int32 ws_KillMachines();
 void ws_StepWhile(machine *m, int32 pcOffset, int32 pcCount);
 void IntoTheState(machine *m);
 machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash, int32 dataRow, MessageCB CintrMsg, bool debug, const char *machName);
+machine *TriggerMachineByHash(int32 val1, int32 val2, int32 val3, int32 val4, int32 val5, int32 val6,
+	int32 val7, int32 val8, int32 val9, int32 val10, bool flag,
+	MessageCB intrMsg, const char *machName);
 
 /**
  * This proc is what allows a machine to send a message to another machine(s)
  */
 void sendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
 	uint32 machHash, machine *sendM, int32 msgCount);
+void sendWSMessage(int32 val1, machine *recv, int32 val2, int32 val3, int32 val4,
+	int32 trigger, int32 val5, int32 val6, int32 val7, int32 val8);
 
 #define kernel_spawn_machine(name,hash,callback) TriggerMachineByHash(hash, nullptr, -1, -1, callback, false, name)
 #define kernel_terminate_machine(m) terminateMachine(m)


Commit: b69d587feb1ab4668ca92b6d8d920722f90746e3
    https://github.com/scummvm/scummvm/commit/b69d587feb1ab4668ca92b6d8d920722f90746e3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-01-16T18:08:39-08:00

Commit Message:
M4: Better skipping showing intro again after first time

Changed paths:
    engines/m4/burger/rooms/section9/room903.cpp
    engines/m4/burger/vars.cpp


diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index feda05d059a..97a3b1754a3 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/config-manager.h"
 #include "m4/burger/rooms/section9/room903.h"
 #include "m4/adv_r/adv_control.h"
 #include "m4/adv_r/adv_trigger.h"
@@ -46,6 +47,12 @@ void Room903::preload() {
 
 void Room903::init() {
 	MenuRoom::init();
+
+	if (!ConfMan.getBool("seen_intro")) {
+		ConfMan.setBool("seen_intro", true);
+		ConfMan.flushToDisk();
+	}
+
 	player_set_commands_allowed(false);
 	_buttonsDrawn = false;
 
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index ed721eaa100..dcd184235d6 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/config-manager.h"
 #include "common/debug.h"
 #include "common/events.h"
 #include "m4/burger/vars.h"
@@ -119,7 +120,7 @@ void Vars::main_cold_data_init() {
 		break;
 
 	case WHOLE_GAME:
-		_game.setRoom(g_engine->autosaveExists() ? 903 : 951);
+		_game.setRoom(ConfMan.getBool("seen_intro") || g_engine->savesExist() ? 903 : 951);
 		break;
 	}
 




More information about the Scummvm-git-logs mailing list