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

dreammaster noreply at scummvm.org
Sun Aug 18 01:41:17 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:
ad33aa6445 M4: RIDDLE: Added room 406 init
d3bb863084 M4: RIDDLE: Added room 406 pre-parser
d22f46a544 M4: RIDDLE: In progress room 406 parser


Commit: ad33aa644533d8d8a3cd938e0fc83cfff7351cd5
    https://github.com/scummvm/scummvm/commit/ad33aa644533d8d8a3cd938e0fc83cfff7351cd5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-08-17T18:41:11-07:00

Commit Message:
M4: RIDDLE: Added room 406 init

Changed paths:
    engines/m4/riddle/flags.h
    engines/m4/riddle/rooms/section4/room406.cpp
    engines/m4/riddle/rooms/section4/room406.h


diff --git a/engines/m4/riddle/flags.h b/engines/m4/riddle/flags.h
index 98bcdc67668..b4e22cff6d3 100644
--- a/engines/m4/riddle/flags.h
+++ b/engines/m4/riddle/flags.h
@@ -368,7 +368,7 @@ enum {
 	V330 = 330,
 	V331 = 331,
 	V332 = 332,
-	V333 = 333,
+	kPaintingOpen = 333,
 	V334 = 334,
 	V335 = 335,
 	V336 = 336,
diff --git a/engines/m4/riddle/rooms/section4/room406.cpp b/engines/m4/riddle/rooms/section4/room406.cpp
index 7f9a8df4088..9e093989a87 100644
--- a/engines/m4/riddle/rooms/section4/room406.cpp
+++ b/engines/m4/riddle/rooms/section4/room406.cpp
@@ -27,12 +27,253 @@ namespace M4 {
 namespace Riddle {
 namespace Rooms {
 
+void Room406::preload() {
+	_G(player).walker_type = 1;
+	_G(player).shadow_type = 1;
+	LoadWSAssets("OTHER SCRIPT");
+}
+
 void Room406::init() {
+	player_set_commands_allowed(false);
+
+	switch (_G(flags)[V312]) {
+	case 0:
+		hotspot_set_active("STAIRS", false);
+		hotspot_set_active("BILLIARD TABLE ", false);
+		break;
+
+	case 1:
+		_billiardTable = series_place_sprite("406 BILLIARD TABLE UNLATCHED",
+			0, 0, 0, 100, 0x200);
+		hotspot_set_active("STAIRS", false);
+		break;
+
+	case 2:
+		_billiardTable = series_place_sprite("406 BILLIARD TABLE UP",
+			0, 0, 0, 100, 0x200);
+		hotspot_set_active("BILLIARD TABLE", false);
+		hotspot_set_active("BILLIARD TABLE ", false);
+		break;
+
+	default:
+		break;
+	}
+
+	if (_G(flags)[kPaintingOpen]) {
+		_painting = series_place_sprite("406 PAINTING OPEN", 0, 0, 0, 100, 0xf00);
+		hotspot_set_active("PAINTING", false);
+		hotspot_set_active("SMOKING HUTCH", true);
+	} else {
+		_painting = series_place_sprite("406 PAINTING CLOSED", 0, 0, 0, 100, 0xf00);
+		hotspot_set_active("PAINTING", true);
+		hotspot_set_active("SMOKING HUTCH", false);
+	}
+
+	if (_G(flags)[V316]) {
+		hotspot_set_active("MIRROR", false);
+		_mirror = series_place_sprite("CRACKED MIRROR IN BILLIARD RM",
+			0, 0, 0, 100, 0xf00);
+	} else {
+		hotspot_set_active("BROKEN MIRROR", false);
+	}
+
+	if (_G(flags)[V310]) {
+		_cardDoor = series_place_sprite("406 CARD DOOR OPEN BY PICT",
+			0, 0, 0, 100, 0xf00);
+		hotspot_set_active("ACE OF SPADES", false);
+		hotspot_set_active("ACE OF SPADES ", true);
+		hotspot_set_active("SWITCH", true);
+	} else {
+		hotspot_set_active("ACE OF SPADES", true);
+		hotspot_set_active("ACE OF SPADES ", false);
+		hotspot_set_active("SWITCH", false);
+	}
+
+	if (_G(flags)[V306]) {
+		hotspot_set_active("GAMES CABINET", false);
+		_gamesCabinet = series_place_sprite("406 GAMES CABINET OPEN",
+			0, 0, 0, 100, 0xf00);
+	} else {
+		hotspot_set_active("GAMES CABINET ", false);
+		hotspot_set_active("GAMES CABINET DRAWER", false);
+		_gamesCabinet = series_place_sprite("406 GAMES CABINET CLOSED",
+			0, 0, 0, 100, 0xf00);
+	}
+
+	if (_G(flags)[V309]) {
+		hotspot_set_active("WRITING DESK", false);
+		_desk = series_place_sprite("406 DESK OPEN", 0, 0, 0, 100, 0x600);
+	} else {
+		hotspot_set_active("WRITING DESK ", false);
+		hotspot_set_active("WRITING DESK DRAWER", false);
+		_desk = series_place_sprite("406 DESK CLOSE", 0, 0, 0, 100, 0x600);
+	}
+
+	if (_G(flags)[V321]) {
+		_poolBall = series_place_sprite("406 POOL BALL IN CABINET",
+			0, 0, 0, 100, 0xf00);
+		hotspot_set_active("BILLIARD BALL", false);
+	} else if (!inv_player_has("BILLIARD BALL")) {
+		_poolBall = series_place_sprite("BILLIARD BALL", 0, 0, 0, 100, 0x200);
+	} else {
+		hotspot_set_active("BILLIARD BALL", false);
+	}
+
+	if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
+		_val1 = 1001;
+		_val2 = 1001;
+		hotspot_set_active("CABINET DRAWER OPEN", false);
+		hotspot_set_active("DESK DRAWER OPEN", false);
+		hotspot_set_active("MESSAGES", false);
+		hotspot_set_active("ENVELOPE", false);
+		hotspot_set_active("KEYS", false);
+	} else if (_val2 == 1000) {
+		ws_demand_facing(1);
+		_rptmhr = series_load("RPTMHR11");
+		setGlobals1(_rptmhr, 1, 5, 5, 5, 0, 5, 1, 1, 1);
+		sendWSMessage_110000(-1);
+		_emptyDrawer = series_place_sprite("406 DESK DRAWER EMPTY",
+			0, 0, 0, 100, 0x200);
+		disableHotspots();
+
+		hotspot_set_active(" ", true);
+		hotspot_set_active("DESK DRAWER OPEN", true);
+		hotspot_set_active("MESSAGES", true);
+
+		if (!inv_player_has("ENVELOPE")) {
+			_envelope = series_place_sprite("406 DESK DRAWER ENVELOPE",
+				0, 0, 0, 100, 0x200);
+			hotspot_set_active("ENVELOPE", true);
+		}
+
+		if (!inv_player_has("KEYS")) {
+			_keys = series_place_sprite("406 DESK DRAWER WITH KEYS",
+				0, 0, 0, 100, 0x200);
+			hotspot_set_active("KEYS", true);
+		}
+	} else if (_val1 == 1000) {
+		ws_demand_facing(11);
+		_ripReachHand = series_load("RIP TREK MED REACH HAND POS1");
+		setGlobals1(_ripReachHand, 1, 10, 10, 10, 0, 10, 1, 1, 1);
+		sendWSMessage_110000(-1);
+		_cards = series_place_sprite("406 GAMES DRAWER WITH CARDS",
+			0, 0, 0, 100, 0x100);
+		disableHotspots();
+
+		hotspot_set_active(" ", true);
+		hotspot_set_active("CABINET DRAWER OPEN", true);
+	} else {
+		disableHotspots();
+		setHotspots();
+	}
+
+	switch (_G(game).previous_room) {
+	case KERNEL_RESTORING_GAME:
+		player_set_commands_allowed(true);
+
+		if (_G(flags)[V322]) {
+			digi_preload("456_s03a");
+			digi_play_loop("456_s03a", 3, 255, -1, 456);
+		}
+		break;
+
+	case 456:
+		if (_G(flags)[V322])
+			digi_play_loop("456_s03a", 3, 255, -1, 456);
+
+		ws_demand_location(400, 340, 1);
+		_ripHiHand = series_load("rip trek hi 1 hand");
+		setGlobals1(_ripHiHand, 1, 5, 5, 5, 0, 5, 1, 1, 1);
+		sendWSMessage_110000(310);
+		break;
+
+	default:
+		if (_G(flags)[V322]) {
+			digi_preload("456_s03a");
+			digi_play_loop("456_s03a", 3, 255, -1, 456);
+		}
+
+		ws_demand_location(603, 327, 9);
+		ws_walk(530, 332, nullptr, 300, 9);
+		break;
+	}
 }
 
 void Room406::daemon() {
 }
 
+void Room406::pre_parser() {
+
+}
+
+void Room406::parser() {
+
+}
+
+void Room406::disableHotspots() {
+	for (auto *hs = _G(currentSceneDef).hotspots; hs; hs = hs->next)
+		hs->active = false;
+}
+
+void Room406::setHotspots() {
+	for (auto *hs = _G(currentSceneDef).hotspots; hs; hs = hs->next)
+		hs->active = true;
+
+	hotspot_set_active(_G(flags)[V316] ? "MIRROR" : "BROKEN MIRROR", false);
+
+	if (_G(flags)[V306]) {
+		hotspot_set_active("GAMES CABINET", false);
+	} else {
+		hotspot_set_active("GAMES CABINET ", false);
+		hotspot_set_active("GAMES CABINET DRAWER", false);
+	}
+
+	if (_G(flags)[V309]) {
+		hotspot_set_active("WRITING DESK", false);
+	} else {
+		hotspot_set_active("WRITING DESK ", false);
+		hotspot_set_active("WRITING DESK DRAWER", false);
+	}
+
+	if (inv_player_has("BILLIARD BALL") || _G(flags)[V321])
+		hotspot_set_active("BILLIARD BALL", false);
+
+	hotspot_set_active("CABINET DRAWER OPEN", false);
+	hotspot_set_active("DESK DRAWER OPEN", false);
+	hotspot_set_active("MESSAGES", false);
+	hotspot_set_active("ENVELOPE", false);
+	hotspot_set_active("KEYS", false);
+
+	if (_G(flags)[V310]) {
+		hotspot_set_active("ACE OF SPADES", false);
+	} else {
+		hotspot_set_active("ACE OF SPADES ", false);
+		hotspot_set_active("SWITCH", false);
+	}
+
+	switch (_G(flags)[V312]) {
+	case 0:
+		hotspot_set_active("STAIRS", false);
+		hotspot_set_active("BILLIARD TABLE ", false);
+		break;
+
+	case 1:
+		hotspot_set_active("STAIRS", false);
+		break;
+
+	case 2:
+		hotspot_set_active("BILLIARD TABLE", false);
+		hotspot_set_active("BILLIARD TABLE ", false);
+		break;
+
+	default:
+		break;
+	}
+
+	hotspot_set_active(_G(flags)[kPaintingOpen] ? "PAINTING" : "SMOKING HUTCH", false);
+	hotspot_set_active(_G(flags)[V316] ? "MIRROR" : "BROKEN MIRROR", false);
+}
+
 } // namespace Rooms
 } // namespace Riddle
 } // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room406.h b/engines/m4/riddle/rooms/section4/room406.h
index 89e38a19e50..935269123d8 100644
--- a/engines/m4/riddle/rooms/section4/room406.h
+++ b/engines/m4/riddle/rooms/section4/room406.h
@@ -29,12 +29,36 @@ namespace Riddle {
 namespace Rooms {
 
 class Room406 : public Room {
+private:
+	machine *_billiardTable = nullptr;
+	machine *_painting = nullptr;
+	machine *_mirror = nullptr;
+	machine *_cardDoor = nullptr;
+	machine *_gamesCabinet = nullptr;
+	machine *_desk = nullptr;
+	machine *_poolBall = nullptr;
+	machine *_emptyDrawer = nullptr;
+	machine *_envelope = nullptr;
+	machine *_keys = nullptr;
+	machine *_cards = nullptr;
+	int _rptmhr = 0;
+	int _val1 = 0;
+	int _val2 = 0;
+	int _ripReachHand = 0;
+	int _ripHiHand = 0;
+
+	void disableHotspots();
+	void setHotspots();
+
 public:
 	Room406() : Room() {}
 	~Room406() override {}
 
+	void preload() override;
 	void init() override;
 	void daemon() override;
+	void pre_parser() override;
+	void parser() override;
 };
 
 } // namespace Rooms


Commit: d3bb863084d6aeb4f0b76738b6aadc8a42c2ffb3
    https://github.com/scummvm/scummvm/commit/d3bb863084d6aeb4f0b76738b6aadc8a42c2ffb3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-08-17T18:41:11-07:00

Commit Message:
M4: RIDDLE: Added room 406 pre-parser

Changed paths:
    engines/m4/adv_r/adv_player.cpp
    engines/m4/adv_r/adv_player.h
    engines/m4/riddle/rooms/section4/room406.cpp


diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index fddaf96d396..f04e260ac48 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -59,6 +59,12 @@ void Player::syncGame(Common::Serializer &s) {
 	s.syncAsSint32LE(click_y);
 }
 
+void Player::resetWalk() {
+	need_to_walk = false;
+	ready_to_walk = true;
+	waiting_for_walk = false;
+}
+
 void PlayerInfo::syncGame(Common::Serializer &s) {
 	s.syncAsSint32LE(x);
 	s.syncAsSint32LE(y);
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index ca9da9f1a60..fc4da64b47c 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -87,6 +87,8 @@ struct Player {
 	int32 click_x = 0, click_y = 0;
 
 	void syncGame(Common::Serializer &s);
+
+	void resetWalk();
 };
 
 struct PlayerInfo {
diff --git a/engines/m4/riddle/rooms/section4/room406.cpp b/engines/m4/riddle/rooms/section4/room406.cpp
index 9e093989a87..e5a326e9753 100644
--- a/engines/m4/riddle/rooms/section4/room406.cpp
+++ b/engines/m4/riddle/rooms/section4/room406.cpp
@@ -203,7 +203,61 @@ void Room406::daemon() {
 }
 
 void Room406::pre_parser() {
+	bool lookFlag = player_said_any("look", "look at");
+	bool takeFlag = player_said("take");
+	bool useFlag = player_said_any("push", "pull", "gear", "open", "close");
+
+	if (useFlag && player_said_any("BILLIARD TABLE", "BILLIARD TABLE ")) {
+		_G(player).resetWalk();
+		_G(kernel).trigger_mode = KT_PARSE;
+		kernel_timing_trigger(1, 69);
+		_G(kernel).trigger_mode = KT_PREPARSE;
+	}
+
+	if (player_said("BILLIARD BALL", "BILLIARD TABLE") &&
+			_G(kernel).trigger == -1) {
+		_G(player).resetWalk();
+		_G(kernel).trigger_mode = KT_PARSE;
+		kernel_timing_trigger(1, 69);
+		_G(kernel).trigger_mode = KT_PREPARSE;
+	}
+
+	if (_val1 == 1000) {
+		_G(player).resetWalk();
+
+		if (!player_said(" ") &&
+			!(lookFlag && player_said("MESSAGE LOG")) &&
+			!player_said("journal")) {
+			if (!useFlag || !player_said("CABINET DRAWER OPEN"))
+				return;
+		}
+
+		intr_cancel_sentence();
+		_val1 = 1001;
+		_G(kernel).trigger_mode = KT_DAEMON;
+		kernel_timing_trigger(1, 10);
+		_G(kernel).trigger_mode = KT_PARSE;
 
+	} else if (_val2 == 1000) {
+		_G(player).resetWalk();
+
+		if (!player_said(" ") &&
+			!(lookFlag && player_said("MESSAGE LOG")) &&
+			!player_said("journal")) {
+			if (!useFlag || !player_said("DESK DRAWER OPEN"))
+				return;
+		}
+
+		intr_cancel_sentence();
+		_val1 = 1001;
+		_G(kernel).trigger_mode = KT_DAEMON;
+		kernel_timing_trigger(1, 20);
+		_G(kernel).trigger_mode = KT_PARSE;
+
+	} else if (player_said("journal") && !takeFlag && !lookFlag &&
+			_G(kernel).trigger == -1) {
+		_G(player).resetWalk();
+	}
 }
 
 void Room406::parser() {


Commit: d22f46a5441468a61dec29d08ab0a752c0cf018d
    https://github.com/scummvm/scummvm/commit/d22f46a5441468a61dec29d08ab0a752c0cf018d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-08-17T18:41:11-07:00

Commit Message:
M4: RIDDLE: In progress room 406 parser

Changed paths:
    engines/m4/riddle/rooms/room.cpp
    engines/m4/riddle/rooms/room.h
    engines/m4/riddle/rooms/section4/room406.cpp
    engines/m4/riddle/rooms/section4/room406.h


diff --git a/engines/m4/riddle/rooms/room.cpp b/engines/m4/riddle/rooms/room.cpp
index d66fc144b73..138132fe07e 100644
--- a/engines/m4/riddle/rooms/room.cpp
+++ b/engines/m4/riddle/rooms/room.cpp
@@ -55,6 +55,10 @@ void Room::triggerMachineByHashCallbackNegative(frac16 myMessage, machine *) {
 		kernel_trigger_dispatchx(hi);
 }
 
+void Room::triggerMachineByHashCallbackAlways(frac16 myMessage, machine *sender) {
+	kernel_trigger_dispatchx(myMessage);
+}
+
 void Room::triggerMachineByHashCallback3000(frac16 myMessage, machine *sender) {
 	int triggerType = _G(globals)[GLB_TEMP_1] >> 16;
 	int param = _G(globals)[GLB_TEMP_2] >> 16;
diff --git a/engines/m4/riddle/rooms/room.h b/engines/m4/riddle/rooms/room.h
index 9618e3c6b9b..ac544abf7ab 100644
--- a/engines/m4/riddle/rooms/room.h
+++ b/engines/m4/riddle/rooms/room.h
@@ -41,6 +41,7 @@ protected:
 	static void triggerMachineByHashCallback(frac16 myMessage, machine *sender = nullptr);
 	static void triggerMachineByHashCallbackNegative(frac16 myMessage, machine *sender = nullptr);
 	static void triggerMachineByHashCallback3000(frac16 myMessage, machine *sender = nullptr);
+	static void triggerMachineByHashCallbackAlways(frac16 myMessage, machine *sender = nullptr);
 
 	void restoreAutosave();
 
diff --git a/engines/m4/riddle/rooms/section4/room406.cpp b/engines/m4/riddle/rooms/section4/room406.cpp
index e5a326e9753..57dd0f9cc25 100644
--- a/engines/m4/riddle/rooms/section4/room406.cpp
+++ b/engines/m4/riddle/rooms/section4/room406.cpp
@@ -261,7 +261,27 @@ void Room406::pre_parser() {
 }
 
 void Room406::parser() {
+	bool lookFlag = player_said_any("look", "look at");
+	bool takeFlag = player_said("take");
+	bool useFlag = player_said_any("push", "pull", "gear", "open", "close");
 
+	if (takeFlag && player_said("ENVELOPE")) {
+		// No implementation
+	} else if (takeFlag && player_said("KEYS") && takeKeys()) {
+		// No implementation
+	} else if (takeFlag && player_said("DESK DRAWER OPEN")) {
+		digi_play("406r17", 1);
+	} else if (takeFlag && player_said("CABINET DRAWER OPEN")) {
+		digi_play("406r24", 1);
+	} else if (takeFlag && player_said("BILLIARD BALL") && takeBilliardBall()) {
+		// No implementation
+	}
+	// TODO
+	else {
+		return;
+	}
+
+	_G(player).command_ready = false;
 }
 
 void Room406::disableHotspots() {
@@ -328,6 +348,51 @@ void Room406::setHotspots() {
 	hotspot_set_active(_G(flags)[V316] ? "MIRROR" : "BROKEN MIRROR", false);
 }
 
+bool Room406::takeKeys() {
+	switch (_G(kernel).trigger) {
+	case -1:
+		if (inv_object_is_here("KEYS")) {
+			inv_give_to_player("KEYS");
+			hotspot_set_active("KEYS", false);
+			terminateMachineAndNull(_keys);
+			kernel_examine_inventory_object("PING KEYS", _G(master_palette),
+				5, 1, 460, 265, 2, "406_s01", -1);
+			return true;
+		}
+		break;
+
+	case 2:
+		player_set_commands_allowed(true);
+		return true;
+
+	default:
+		break;
+	}
+
+	return false;
+}
+
+bool Room406::takeBilliardBall() {
+	switch (_G(kernel).trigger) {
+	case -1:
+		if (inv_object_is_here("BILLIARD BALL")) {
+			player_set_commands_allowed(false);
+			_pickupBall = series_load("406 RIP PICKUP BALL");
+			ws_hide_walker();
+
+			_ripPickupBall = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 0, 0, 100, 0, false,
+				triggerMachineByHashCallbackAlways, "RIP picks up ball");
+			// TODO
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	return false;
+}
+
 } // namespace Rooms
 } // namespace Riddle
 } // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room406.h b/engines/m4/riddle/rooms/section4/room406.h
index 935269123d8..9eda0652729 100644
--- a/engines/m4/riddle/rooms/section4/room406.h
+++ b/engines/m4/riddle/rooms/section4/room406.h
@@ -46,9 +46,13 @@ private:
 	int _val2 = 0;
 	int _ripReachHand = 0;
 	int _ripHiHand = 0;
+	int _pickupBall = 0;
+	machine *_ripPickupBall = nullptr;
 
 	void disableHotspots();
 	void setHotspots();
+	bool takeKeys();
+	bool takeBilliardBall();
 
 public:
 	Room406() : Room() {}




More information about the Scummvm-git-logs mailing list