[Scummvm-git-logs] scummvm master -> 1749dbc5585b67199fc2542188a325fd39074ec5

dreammaster noreply at scummvm.org
Mon Aug 5 01:55:41 UTC 2024


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

Summary:
1749dbc558 M4: RIDDLE: In progress room 305 parser


Commit: 1749dbc5585b67199fc2542188a325fd39074ec5
    https://github.com/scummvm/scummvm/commit/1749dbc5585b67199fc2542188a325fd39074ec5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-08-04T18:55:36-07:00

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

Changed paths:
    engines/m4/graphics/krn_pal.cpp
    engines/m4/graphics/krn_pal.h
    engines/m4/riddle/rooms/section3/room305.cpp
    engines/m4/riddle/rooms/section3/room305.h


diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index c53ff8cf3a4..e508982635a 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -46,6 +46,10 @@ namespace M4 {
 #define FREE_END     255
 #define NUM_FREE     FREE_END-(FREE_START)+1
 
+static HotkeyCB remember_esc_key;
+static bool examining_inventory_object;
+static HotSpotRec *exam_saved_hotspots;
+
 void krn_pal_game_task() {
 	g_engine->pal_game_task();
 }
@@ -111,10 +115,6 @@ static void create_luminance_map(RGB8 *pal) {
 	}
 }
 
-
-static HotkeyCB remember_esc_key;
-
-
 // finds the best macthes for the in the greys in the grey ramp range using the free range greys
 // used to map greys out of the grey ramp area, and then again to map the grey ramp out of the grey ramp area!
 static void make_translation_table(RGB8 *pal) {
@@ -228,7 +228,6 @@ void krn_fade_to_grey(RGB8 *pal, int32 steps, int32 delay) {
 	RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
 }
 
-
 void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
 	uint8 *tempPtr;
 	int32 i;
@@ -289,7 +288,59 @@ void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
 	gr_pal_set(_G(master_palette));
 }
 
-bool examining_inventory_object = false;
+void kernel_examine_inventory_object(const char *picName, RGB8 *pal, int steps, int delay,
+	int32 x, int32 y, int32 triggerNum, const char *digiName, int32 digiTrigger) {
+
+	remember_esc_key = GetSystemHotkey(KEY_ESCAPE);
+	RemoveSystemHotkey(KEY_ESCAPE);
+
+	interface_hide();
+
+	exam_saved_hotspots = _G(currentSceneDef).hotspots;
+	_G(currentSceneDef).hotspots = nullptr;
+
+	_GP(myFadeTrigger) = kernel_trigger_create(triggerNum);
+
+	krn_fade_to_grey(pal, steps, delay);
+
+	_GP(seriesHash) = series_load(picName, -1, pal);                    // preload sprite so we can unload it
+	gr_pal_set_range(pal, FREE_START, 197);                                  // set that series colors into VGA
+	RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
+
+	Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
+	krn_SetGreyVideoMode(
+		// Grey rectangle
+		0, 0, MAX_VIDEO_X, screen_height(grey_screen) + _G(kernel).letter_box_y,
+
+		// Color rectangle
+		x, y, x + ws_get_sprite_width(_GP(seriesHash), 0) - 1, y + ws_get_sprite_height(_GP(seriesHash), 0) - 1);
+	_G(gameDrawBuff)->release();
+
+	// Play the sprite series as a loop
+	int32 status;
+	ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+	_GP(seriesAnim8) = series_play_xy(picName, -1, FORWARD,
+		x - game_buff_ptr->x1, y - game_buff_ptr->y1, 100, 0, 7, -1);
+
+	if (digiName) {
+		digi_play(digiName, 1, 255, digiTrigger);
+	}
+
+	player_set_commands_allowed(true);
+
+	cycleEngines(_G(game_bgBuff)->get_buffer(),
+		&(_G(currentSceneDef).depth_table[0]),
+		_G(screenCodeBuff)->get_buffer(),
+		(uint8 *)&_G(master_palette)[0],
+		_G(inverse_pal)->get_ptr(), true);
+
+	game_pause(true);
+
+	_G(inverse_pal)->release();
+	_G(game_bgBuff)->release();
+
+	pauseEngines();
+}
 
 void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
 	if (!_GP(seriesAnim8) || _GP(seriesHash) < 0)
@@ -329,7 +380,7 @@ void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
 
 
 // This is an inplace remap
-// _GP(fadeToMe) must already have been set up to correspond to the image on the screen
+// fadeToMe must already have been set up to correspond to the image on the screen
 void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2, int32 y2) {
 	uint8 *ptr;
 	int32 x, y;
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 9bc673031a0..ebda617268f 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -118,6 +118,9 @@ void pal_fx_update();
  */
 void DAC_tint_range(const RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent);
 
+void kernel_examine_inventory_object(const char *picName, RGB8 *pal,
+	int steps, int delay, int32 x, int32 y, int32 trigger,
+	const char *digiName, int32 digiTrigger);
 void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay);
 
 void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2, int32 y2);
diff --git a/engines/m4/riddle/rooms/section3/room305.cpp b/engines/m4/riddle/rooms/section3/room305.cpp
index 6a93692851f..6f00a6dbc8d 100644
--- a/engines/m4/riddle/rooms/section3/room305.cpp
+++ b/engines/m4/riddle/rooms/section3/room305.cpp
@@ -295,6 +295,9 @@ void Room305::parser() {
 	bool lookFlag = player_said_any("look", "look at");
 	bool takeFlag = player_said("take");
 	bool useFlag = player_said_any("push", "pull", "gear", "open", "close");
+	bool itemFlag = false;
+	bool chiselFlag = false;
+	bool caseFlag = false;
 
 	if (player_said("conv305a")) {
 		conv305a();
@@ -341,12 +344,333 @@ void Room305::parser() {
 		conv_play();
 		_val7 = 1;
 		_conv1 = 0;
+	} else if (_G(kernel).trigger == 747) {
+		_val7 = 4;
+		_conv1 = 7;
+	} else if (player_said("close", "drawer")) {
+		switch (_G(kernel).trigger) {
+		case -1:
+			if (inv_object_is_here("TURTLE TREATS"))
+				terminateMachineAndNull(_openDrawerTreats);
+
+			terminateMachineAndNull(_openDrawer);
+			hotspot_restore_all();
+
+			if (_G(flags)[V000]) {
+				sendWSMessage_120000(1);
+			} else {
+				sendWSMessage_10000(1, _rip6, _rip4, 5, 1, 1, _rip4, 1, 1, 0);
+			}
+			break;
+
+		case 1:
+			if (_G(flags)[V000]) {
+				sendWSMessage_150000(-1);
+			} else {
+				terminateMachineAndNull(_rip6);
+				terminateMachineAndNull(_rip5);
+				ws_unhide_walker();
+			}
+			kernel_timing_trigger(1, 2);
+			break;
+
+		case 2:
+			series_unload(_rip4);
+			player_set_commands_allowed(true);
+			_val4 = 0;
+			break;
+
+
+
+		}
+	} else if (useFlag && player_said("drawer")) {
+		switch (_G(kernel).trigger) {
+		case -1:
+			player_set_commands_allowed(false);
+			player_update_info();
+
+			if (_G(flags)[V000]) {
+				_rip4 = series_load("RIP TREK MED REACH HAND POS1");
+				setGlobals1(1, 5, 5, 5, 0, 5, 1, 1, 1);
+				sendWSMessage_110000(1);
+			} else {
+				ws_hide_walker();
+				_rip4 = series_load("SUIT RIP REACHES FOR DRAWER");
+				_rip5 = series_show("ripsh1", 0xf00, 128, -1, -1, 0,
+					_G(player_info).scale, _G(player_info).x, _G(player_info).y);
+				_rip6 = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 0, 0, 100, 0xf00, false,
+					triggerMachineByHashCallbackNegative, "rip reach");
+
+				sendWSMessage_10000(1, _rip6, _rip4, 1, 5, 1, _rip4, 5, 5, 0);
+			}
+			break;
+
+		case 1:
+			hotspot_hide_all();
+			intr_cancel_sentence();
+			mouse_set_sprite(0);
+			hotspot_add_dynamic("LOOK AT", " ", 0, 0, 1500, 374, 0);
+
+			if (inv_object_is_here("TURTLE TREATS")) {
+				hotspot_add_dynamic("LOOK AT", "TURTLE TREATS", 1105, 208, 1175, 266, 6);
+				hotspot_add_dynamic("LOOK AT", "TURTLE TREATS", 1052, 230, 1147, 296, 6);
+			}
+
+			_val4 = 1;
+			_openDrawer = series_show_sprite("open drawer", 0, 0);
+
+			if (inv_object_is_here("TURTLE TREATS")) {
+				_openDrawerTreats = series_show_sprite("open drawer with treats", 0, 0);
+			}
+
+			player_set_commands_allowed(true);
+			digi_play("305_s02", 2);
+			break;
+
+		default:
+			break;
+		}
+	} else if (takeFlag && player_said("turtle treats") && _G(kernel).trigger == -1
+			&& inv_object_is_here("TURTLE TREATS")) {
+		terminateMachineAndNull(_openDrawerTreats);
+		terminateMachineAndNull(_openDrawer);
+		hotspot_restore_all();
+
+		if (_G(flags)[V000])
+			sendWSMessage_120000(1);
+		else
+			sendWSMessage_10000(1, _rip6, _rip4, 5, 1, 1, _rip4, 1, 1, 0);
+
+		digi_play("305r20", 1);
+
+	} else if (takeFlag && player_said("turtle treats") && _G(kernel).trigger == 1) {
+		inv_give_to_player("TURTLE TREATS");
+		terminateMachineAndNull(_rip6);
+		terminateMachineAndNull(_rip5);
+		ws_unhide_walker();
+		kernel_timing_trigger(1, 2);
+
+	} else if (takeFlag && player_said("turtle treats") && _G(kernel).trigger == 2) {
+		series_unload(_rip4);
+		player_set_commands_allowed(true);
+		_val4 = 0;
+
+	} else if (takeFlag && player_said("turtle")) {
+		if (_G(flags)[GLB_TEMP_12]) {
+			digi_play("305r55", 1);
+		} else {
+			switch (_G(kernel).trigger) {
+			case -1:
+				if (inv_object_is_here("TURTLE")) {
+					player_set_commands_allowed(false);
+					g_engine->camera_shift_xy(640, 0);
+					setGlobals1(_ripLooksDown, 1, 9, 9, 9);
+					sendWSMessage_110000(1);
+				} else {
+					goto next1;
+				}
+				break;
+
+			case 1:
+				kernel_examine_inventory_object("ping turtle",
+					_G(master_palette), 5, 1, 407, 25, 2,
+					"305R19", -1);
+				terminateMachineAndNull(_turtle);
+				break;
+
+			case 2:
+				inv_give_to_player("TURTLE");
+				sendWSMessage_140000(3);
+				break;
+
+			case 3:
+				hotspot_set_active("turtle", false);
+				player_set_commands_allowed(true);
+				break;
+			default:
+				goto next1;
+				break;
+			}
+		}
+	} else {
+		goto next1;
 	}
-	// TODO
-	else {
-		return;
+	goto exit;
+
+next1:
+	if (player_said_any("SHRUNKEN HEAD", "INCENSE BURNER",
+			"CRYSTAL SKULL", "ROMANOV EMERALD", "WHALE BONE HORN",
+			"WHEELED TOY")) {
+		if (player_said("DISPLAY CASE"))
+			itemFlag = true;
 	}
 
+	if (itemFlag || (takeFlag && player_said_any("SHRUNKEN HEAD",
+			"INCENSE BURNER", "CRYSTAL SKULL", "ROMANOV EMERALD",
+			"WHALE BONE HORN"))) {
+		switch (_G(kernel).trigger) {
+		case -1:
+			if ((itemFlag && inv_player_has(_G(player).verb)) || takeFlag) {
+				if (itemFlag) {
+					if (!walkToObject())
+						goto next2;
+				} else {
+					kernel_timing_trigger(1, 1);
+				}
+			}
+			break;
+
+		default:
+			break;
+		}
+	} else {
+		goto next2;
+	}
+	goto exit;
+
+next2:
+	chiselFlag = player_said("CHISEL") && player_said("DISPLAY CASE");
+	if (chiselFlag || (takeFlag && player_said("CHISEL"))) {
+		switch (_G(kernel).trigger) {
+		case -1:
+			if ((chiselFlag && inv_player_has(_G(player).verb)) ||
+				(takeFlag && inv_object_is_here(_G(player).noun))) {
+				if (chiselFlag) {
+					if (player_said("CHISEL")) {
+						ws_walk(186, 279, 0, 1, 10);
+					}
+				} else {
+					kernel_timing_trigger(1, 1);
+				}
+			}
+			break;
+
+		case 1:
+			player_set_commands_allowed(false);
+			setGlobals1(_ripMedHigh, 1, 12, 12, 12);
+			sendWSMessage_110000(3);
+			break;
+
+		case 3:
+			if (chiselFlag) {
+				hotspot_set_active(_G(player).verb, false);
+
+				if (player_said("CHISEL")) {
+					_knife2 = series_show_sprite("DISPLAY CASE YETI HANDLED KNIFE", 0, 0xf00);
+					inv_move_object("CHISEL", 305);
+				}
+			} else {
+				hotspot_set_active(_G(player).noun, false);
+
+				if (player_said("CHISEL")) {
+					terminateMachineAndNull(_knife2);
+					inv_give_to_player("CHISEL");
+				}
+			}
+
+			sendWSMessage_140000(5);
+			break;
+
+		case 5:
+			player_set_commands_allowed(true);
+			break;
+
+		default:
+			goto next3;
+			break;
+		}
+	} else {
+		goto next3;
+	}
+	goto exit;
+
+next3:
+	caseFlag = player_said_any("GERMAN BANKNOTE", "REBUS AMULET", "SILVER BUTTERFLY",
+		"POSTAGE STAMP", "STICK AND SHELL MAP") && player_said("DISPLAY CASE");
+	// The second or parameter looks redundant, but I'm keeping it in as a reminder,
+	// just in case there's something actually different in the original disassembly
+	if (caseFlag || (takeFlag && caseFlag)) {
+		switch (_G(kernel).trigger) {
+		case -1:
+			if ((caseFlag && inv_player_has(_G(player).verb)) ||
+					(takeFlag && inv_object_is_here(_G(player).noun))) {
+				if (caseFlag) {
+					if (player_said("GERMAN BANKNOTE"))
+						ws_walk(88, 305, nullptr, 1, 10);
+					else if (player_said("REBUS AMULET"))
+						ws_walk(66, 319, nullptr, 1, 10);
+					else if (player_said("SILVER BUTTERFLY"))
+						ws_walk(124, 302, nullptr, 1, 10);
+					else if (player_said("POSTAGE STAMP"))
+						ws_walk(164, 288, nullptr, 1, 10);
+					else if (player_said("STICK AND SHELL MAP"))
+						ws_walk(120, 299, nullptr, 1, 10);
+				} else {
+					kernel_timing_trigger(1, 1);
+				}
+			}
+			break;
+
+		case 1:
+			player_set_commands_allowed(false);
+			_rip4 = series_load("RIP HIGH REACHER POS2");
+
+			if (player_said_any("REBUS AMULET", "SILVER BUTTERFLY"))
+				setGlobals1(_rip4, 1, 7, 7, 7);
+			else
+				setGlobals1(_rip4, 1, 14, 14, 14);
+
+			sendWSMessage_110000(3);
+			break;
+
+		case 3:
+			if (useFlag) {
+				hotspot_set_active(_G(player).verb, true);
+
+#define DROP(FIELD, NAME, CASE) if (player_said(NAME)) { \
+	FIELD = series_show_sprite(CASE, 0, 0xf00); \
+		inv_move_object(NAME, 305); }
+				DROP(_amulet2, "REBUS AMULET", "DISPLAY CASE AMULET")
+				DROP(_butterfly2, "SILVER BUTTERFLY", "DISPLAY CASE BUTTERFLY")
+				DROP(_banknote2, "GERMAN BANKNOTE", "DISPLAY CASE GERMAN BANKNOTE")
+				DROP(_stamp2, "POSTAGE STAMP", "DISPLAY CASE CHEAPEST STAMP")
+				DROP(_map2, "STICK AND SHELL MAP", "DISPLAY CASE QUARRY STICK MAP")
+#undef ITEM
+				sendWSMessage_140000(3);
+
+			} else {
+				hotspot_set_active(_G(player).noun, false);
+
+#define TAKE(FIELD, NAME) if (player_said(NAME)) { \
+	terminateMachineAndNull(FIELD); inv_give_to_player(NAME); }
+				TAKE(_amulet2, "REBUS AMULET")
+				TAKE(_butterfly2, "SILVER BUTTERFLY")
+				TAKE(_banknote2, "GERMAN BANKNOTE")
+				TAKE(_stamp2, "POSTAGE STAMP")
+				TAKE(_map2, "STICK AND SHELL MAP")
+#undef TAKE
+
+				sendWSMessage_140000(5);
+			}
+			break;
+
+		case 5:
+			series_unload(_rip4);
+			player_set_commands_allowed(true);
+			break;
+
+		default:
+			goto next4;
+			break;
+		}
+	} else {
+		goto next4;
+	}
+	goto exit;
+
+next4:
+	// TODO
+exit:
 	_G(player).command_ready = false;
 }
 
@@ -420,6 +744,35 @@ void Room305::conv305a() {
 	}
 }
 
+bool Room305::walkToObject() {
+	if (player_said("SHRUNKEN HEAD")) {
+		ws_walk(98, 313, 0, 1, 10, 1);
+		return true;
+	} else if (player_said("INCENSE BURNER")) {
+		ws_walk(171, 285, 0, 1, 10, 1);
+		return true;
+	} else if (player_said("CRYSTAL SKULL")) {
+		ws_walk(70, 320, 0, 1, 10, 1);
+		return true;
+	} else if (player_said("WHALE BONE HORN")) {
+		ws_walk(116, 304, 0, 1, 10, 1);
+		return true;
+	} else if (player_said("WHEELED TOY")) {
+		ws_walk(151, 296, 0, 1, 10, 1);
+		return true;
+	} else if (player_said("ROMANOV EMERALD")) {
+		if (_G(flags)[V090] == 3) {
+			digi_play("305f08", 1, 255, 6);
+			_val7 = 2;
+		} else {
+			ws_walk(183, 288, 0, 1, 10, 1);
+		}
+		return true;
+	}
+
+	return false;
+}
+
 } // namespace Rooms
 } // namespace Riddle
 } // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room305.h b/engines/m4/riddle/rooms/section3/room305.h
index b48420ea741..f60fe6c8059 100644
--- a/engines/m4/riddle/rooms/section3/room305.h
+++ b/engines/m4/riddle/rooms/section3/room305.h
@@ -101,6 +101,7 @@ private:
 	void setupSign();
 	void setShadow5(bool active);
 	void conv305a();
+	bool walkToObject();
 
 public:
 	Room305() : Room() {}




More information about the Scummvm-git-logs mailing list