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

Strangerke noreply at scummvm.org
Fri Oct 25 22:24:53 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:
fa23c25218 M4: RIDDLE: partial implementation of room 207 (preload, init, pre-parser)


Commit: fa23c25218ba9ddb51eb797e8bcfbb46aee785ff
    https://github.com/scummvm/scummvm/commit/fa23c25218ba9ddb51eb797e8bcfbb46aee785ff
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-10-26T00:24:23+01:00

Commit Message:
M4: RIDDLE: partial implementation of room 207 (preload, init, pre-parser)

Changed paths:
    engines/m4/riddle/rooms/section2/room207.cpp
    engines/m4/riddle/rooms/section2/room207.h
    engines/m4/riddle/rooms/section2/section2.cpp
    engines/m4/riddle/rooms/section2/section2.h


diff --git a/engines/m4/riddle/rooms/section2/room207.cpp b/engines/m4/riddle/rooms/section2/room207.cpp
index f5fe1734f33..a0bec85130c 100644
--- a/engines/m4/riddle/rooms/section2/room207.cpp
+++ b/engines/m4/riddle/rooms/section2/room207.cpp
@@ -20,6 +20,10 @@
  */
 
 #include "m4/riddle/rooms/section2/room207.h"
+#include "m4/riddle/rooms/section2/section2.h"
+
+#include "m4/adv_r/adv_file.h"
+#include "m4/adv_r/other.h"
 #include "m4/graphics/gr_series.h"
 #include "m4/riddle/vars.h"
 
@@ -27,7 +31,239 @@ namespace M4 {
 namespace Riddle {
 namespace Rooms {
 
+void Room207::preload() {
+	LoadWSAssets("OTHER SCRIPT", _G(master_palette));
+	_G(player).walker_type = WALKER_ALT;
+	_G(player).shadow_type = SHADOW_ALT;
+}
+
 void Room207::init() {
+	if (_G(flags[V061]) == 0)
+		kernel_load_variant("207lock1");
+
+	if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
+		_fieldCA = 0;
+		_fieldBE = 0;
+		_field96 = 0;
+		_field9E = -1;
+		_field88 = 2;
+		_field89 = 2;
+		_fieldA2 = 0;
+		_fieldA4 = 0;
+		_fieldA6 = 0;
+		_fieldA8 = 0;
+		_fieldAA = 0;
+		_fieldAE = 1;
+		_fieldB2 = 0;
+	}
+
+	_fieldB6 = 0;
+	digi_preload("950_s02", -1);
+	digi_preload("950_s03", -1);
+	digi_preload("950_s04", -1);
+	_peskyBegLoopSeries = series_load("pesky beg loop", -1, nullptr);
+
+	if (inv_player_has("LEAD PIPE")) {
+		hotspot_set_active(_G(currentSceneDef).hotspots, "PIPES", false);
+	} else {
+		_leadPipeSeries = series_load("lead pipe", -1, nullptr);
+		_leadPipeMach = series_show_sprite("lead pipe", 0, 3840);
+	}
+
+	_oneFrameMoneySpriteSeries = series_load("one frame money sprite", -1, nullptr);
+	if (_G(flags[V058]) == 0) {
+		_metalRimSeries = series_load("metal rim", -1, nullptr);
+		_sevenSpokesSeries = series_load("SEVEN spokes", -1, nullptr);
+		_woodenRimSeries = series_load("wooden rim", -1, nullptr);
+
+		hotspot_set_active(_G(currentSceneDef).hotspots, "metal rim", false);
+		hotspot_set_active(_G(currentSceneDef).hotspots, "SEVEN spokes", false);
+		hotspot_set_active(_G(currentSceneDef).hotspots, "wooden rim", false);
+
+		_wheelSeries = series_load("wheel", -1, nullptr);
+		_wheelMach = series_show_sprite("wheel", 0, 3840);
+
+	} else {
+		hotspot_set_active(_G(currentSceneDef).hotspots, "WHEEL", false);
+		if (inv_player_has("METAL RIM")) {
+			hotspot_set_active(_G(currentSceneDef).hotspots, "METAL RIM", false);
+		} else {
+			_metalRimSeries = series_load("metal rim", -1, nullptr);
+			_metalRimMach = series_show_sprite("metal rim", 0, 3840);
+		}
+
+		if (inv_object_is_here("SEVEN SPOKES")) {
+			_sevenSpokesSeries = series_load("SEVEN spokes", -1, nullptr);
+			_sevenSpokesMach = series_show_sprite("SEVEN spokes", 0, 3840);
+		} else {
+			hotspot_set_active(_G(currentSceneDef).hotspots, "SEVEN SPOKES", false);
+		}
+
+		if (inv_player_has("WOODEN RIM")) {
+			hotspot_set_active(_G(currentSceneDef).hotspots, "WOODEN RIM", false);
+		} else {
+			_woodenRimSeries = series_load("wooden rim", -1, nullptr);
+			series_show_sprite("wooden rim", 0, 3840);
+		}
+	}
+
+	if (inv_object_is_here("REBUS AMULET")) {
+		hotspot_set_active(_G(currentSceneDef).hotspots, "REBUS AMULET", false);
+	} else {
+		_rebusAmuletSeries = series_load("rebus amulet", -1, nullptr);
+		_rebusAmuletMach = series_show_sprite("rebus amulet", 0, 3840);
+
+		if (_G(flags[V063]) == 0)
+			hotspot_set_active(_G(currentSceneDef).hotspots, "REBUS AMULET", false);
+	}
+
+	if (_G(flags[V061]) == 0) {
+		_peasantSquatTo9Series = series_load("peasant squat to 9", -1, nullptr);
+		_shadowPeskyFrom9ToSquatSeries = series_load("shadow pesky from 9 to squat", -1, nullptr);
+		_peskyRockLoopSeries = series_load("pesky rock loop", -1, nullptr);
+		_ppShowsAmuletTakesMoneySeries = series_load("pp shows amulet takes money", -1, nullptr);
+		_withoutAmuletSeries = series_load("without amulet", -1, nullptr);
+	} else {
+		hotspot_set_active(_G(currentSceneDef).hotspots, "PEASANT", false);
+	}
+
+	if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
+		ws_demand_location(_G(my_walker), 375, 347);
+		ws_demand_facing(_G(my_walker), 10);
+		if (_G(flags[V061]) == 0) {
+			player_set_commands_allowed(false);
+			_peasant3ToSquatSeries = series_load("peasant 3 to squat", -1, nullptr);
+			ws_walk_load_walker_series(S2_DIRS1, S2_NAMES1, false);
+			ws_walk_load_walker_series(S2_DIRS2, S2_NAMES2, false);
+			_ppWalkerMach = triggerMachineByHash_3000(8, 6, *S2_DIRS1, *S2_DIRS2, 660, 367, 9, triggerMachineByHashCallback3000, "pp walker");
+			sendWSMessage_10000(_ppWalkerMach, 562, 359, 9, 10, 1);
+		}
+
+	} else { // KERNEL_RESTORING_GAME
+		series_play_xy("shadow pesky rock loop", -1, 0, 514, 367, 97, 3849, 300, -1);
+		_ppSquatMach = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 614, 367, 97, 3840, false, triggerMachineByHashCallback, "pp squat");
+
+		if (inv_player_has("LEAD PIPE")) {
+			_peskyPointsRipForegroundSeries = series_load("pesky points at rip foreground", -1, nullptr);
+			sendWSMessage_10000(1, _ppSquatMach, 1, _peskyPointsRipForegroundSeries, 19, 100, _peskyPointsRipForegroundSeries, 19, 19, 0);
+		} else if (inv_player_has("METAL RIM")) {
+			_peskyPointsRipBackgroundSeries = series_load("pesky points at rip background", -1, nullptr);
+			sendWSMessage_10000(1, _ppSquatMach, 1, _peskyPointsRipBackgroundSeries, 19, 100, _peskyPointsRipBackgroundSeries, 19, 19, 0);
+		} else
+			sendWSMessage_10000(1, _ppSquatMach, 1, _peskyRockLoopSeries, 20, 101, _peskyRockLoopSeries, 20, 20, 0);
+	}
+
+	digi_play("950_s02", 3, 30, -1, -1);
+	kernel_timing_trigger(1500, 1, nullptr);
+}
+
+void Room207::pre_parser() {
+	bool ecx = player_said("take");
+	bool esi = player_said_any("look", "look at");
+
+	if (esi && player_said(" ")) {
+		_G(player).need_to_walk = false;
+		_G(player).ready_to_walk = true;
+		_G(player).waiting_for_walk = false;
+	}
+
+	if (_fieldAA) {
+		_G(player).need_to_walk = false;
+		_G(player).ready_to_walk = true;
+		_G(player).waiting_for_walk = false;
+
+		if (!_fieldAC) {
+			if (player_said(" ") && player_said_any("exit", "walk to")) {
+				other_save_game_for_resurrection();
+				player_set_commands_allowed(false);
+				_G(kernel).trigger_mode = KT_PARSE;
+				disable_player_commands_and_fade_init(203);
+				_G(flags[V067]) = 1;
+			} else if (player_said("take", "METAL RIM") && inv_player_has("METAL RIM")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said("take", "PIPES") && inv_object_is_here("LEAD PIPE")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said("take", "SEVEN SPOKES") && inv_object_is_here("SEVEN SPOKES")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said("take", "REBUS AMULET") && inv_object_is_here("REBUS AMULET")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said(" ", "METAL RIM")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "METAL RIM");
+				_fieldB2 = 0;
+			}
+		}
+
+		if (_fieldAC == 1) {
+			if (player_said(" ") && player_said_any("exit", "walk to")) {
+				other_save_game_for_resurrection();
+				player_set_commands_allowed(false);
+				_G(kernel).trigger_mode = KT_PARSE;
+				disable_player_commands_and_fade_init(203);
+				_G(flags[V067]) = 1;
+			} else if (player_said("take", "PIPES") && inv_player_has("LEAD PIPE")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said("take", "METAL RIM") && inv_object_is_here("METAL RIM")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said(" ", "WHEEL")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "METAL RIM");
+			} else if (player_said("take", "SEVEN SPOKES") && inv_object_is_here("SEVEN SPOKES")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said("take", "REBUS AMULET") && inv_object_is_here("REBUS AMULET")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "SPLEEN");
+			} else if (player_said("LEAD PIPE", "PIPES") || player_said("LEAD PIPE", " ")) {
+				Common::strcpy_s(_G(player).verb, "take");
+				Common::strcpy_s(_G(player).noun, "pipes");
+				_fieldB2 = 0;
+			}
+
+		}
+	} // if (_fieldAA)
+
+	if (ecx && player_said("PIPES") && inv_object_is_here("LEAD PIPE") && _G(flags[V061]) == 0) {
+		_G(player).need_to_walk = false;
+		_G(kernel).trigger_mode = KT_PARSE;
+		kernel_timing_trigger(1, 1, nullptr);
+	}
+
+	if (ecx && player_said("REBUS AMULET") && inv_object_is_here("REBUS AMULET") && _G(flags[V061]) != 0) {
+		_G(player).need_to_walk = false;
+		_G(kernel).trigger_mode = KT_PARSE;
+		kernel_timing_trigger(1, 1, nullptr);
+	}
+
+	if (player_said("CHINESE YUAN", "PEASANT") || player_said("US DOLLARS", "PEASANT")) {
+		if (!inv_object_is_here("REBUS AMULET")) {
+			_G(player).need_to_walk = false;
+			_G(player).ready_to_walk = true;
+			_G(player).waiting_for_walk = false;
+			Common::strcpy_s(_G(player).verb, "handout");
+		} else if (_G(flags[V063]) == 0) {
+			_G(player).need_to_walk = false;
+			_G(player).ready_to_walk = true;
+			_G(player).waiting_for_walk = false;
+			Common::strcpy_s(_G(player).verb, "handout");
+		} else {
+			if (player_said("US DOLLARS"))
+				_fieldBE = 1;
+
+			Common::strcpy_s(_G(player).verb, "give");
+			Common::strcpy_s(_G(player).noun, "money");
+			_G(player).need_to_walk = false;
+		}
+	}
+}
+
+void Room207::parser() {
 }
 
 void Room207::daemon() {
diff --git a/engines/m4/riddle/rooms/section2/room207.h b/engines/m4/riddle/rooms/section2/room207.h
index 3f67f47b65d..a2a50e7e6fb 100644
--- a/engines/m4/riddle/rooms/section2/room207.h
+++ b/engines/m4/riddle/rooms/section2/room207.h
@@ -33,8 +33,54 @@ public:
 	Room207() : Room() {}
 	~Room207() override {}
 
+	void preload() override;
 	void init() override;
+	void pre_parser() override;
+	void parser() override;
 	void daemon() override;
+
+private:
+	int32 _field88 = 0;
+	int32 _field89 = 0;
+	int32 _field96 = 0;
+	int32 _field9E = 0;
+	int32 _fieldA2 = 0;
+	int32 _fieldA4 = 0;
+	int32 _fieldA6 = 0;
+	int32 _fieldA8 = 0;
+	int32 _fieldAA = 0;
+	int32 _fieldAC = 0;
+	int32 _fieldAE = 0;
+	int32 _fieldB2 = 0;
+	int32 _fieldB6 = 0;
+	int32 _fieldBE = 0;
+	int32 _fieldCA = 0;
+
+	int32 _leadPipeSeries = 0;
+	int32 _metalRimSeries = 0;
+	int32 _oneFrameMoneySpriteSeries = 0;
+	int32 _peasant3ToSquatSeries = 0;
+	int32 _peasantSquatTo9Series = 0;
+	int32 _peskyBegLoopSeries = 0;
+	int32 _peskyPointsRipBackgroundSeries = 0;
+	int32 _peskyPointsRipForegroundSeries = 0;
+	int32 _peskyRockLoopSeries = 0;
+	int32 _ppShowsAmuletTakesMoneySeries = 0;
+	int32 _rebusAmuletSeries = 0;
+	int32 _sevenSpokesSeries = 0;
+	int32 _shadowPeskyFrom9ToSquatSeries = 0;
+	int32 _wheelSeries = 0;
+	int32 _withoutAmuletSeries = 0;
+	int32 _woodenRimSeries = 0;
+
+	machine *_leadPipeMach = nullptr;
+	machine *_metalRimMach = nullptr;
+	machine *_ppWalkerMach = nullptr;
+	machine *_rebusAmuletMach = nullptr;
+	machine *_sevenSpokesMach = nullptr;
+	machine *_wheelMach = nullptr;
+	machine *_ppSquatMach = nullptr;
+
 };
 
 } // namespace Rooms
diff --git a/engines/m4/riddle/rooms/section2/section2.cpp b/engines/m4/riddle/rooms/section2/section2.cpp
index f50eac469e2..667e6e71c0c 100644
--- a/engines/m4/riddle/rooms/section2/section2.cpp
+++ b/engines/m4/riddle/rooms/section2/section2.cpp
@@ -26,6 +26,13 @@ namespace M4 {
 namespace Riddle {
 namespace Rooms {
 
+const int16 S2_DIRS1[] = {240, -1};
+const char *S2_NAMES1[] = { "pesky walk pos3" };
+
+const int16 S2_DIRS2[] = {250, -1};
+const char *S2_NAMES2[] = { "shadow pesky walk pos3" };
+
+
 Section2::Section2() : Rooms::Section() {
 	add(201, &_room201);
 	add(202, &_room202);
diff --git a/engines/m4/riddle/rooms/section2/section2.h b/engines/m4/riddle/rooms/section2/section2.h
index badf3b34d46..99b5816f6f8 100644
--- a/engines/m4/riddle/rooms/section2/section2.h
+++ b/engines/m4/riddle/rooms/section2/section2.h
@@ -34,6 +34,12 @@ namespace M4 {
 namespace Riddle {
 namespace Rooms {
 
+extern const int16 S2_DIRS1[];
+extern const char *S2_NAMES1[];
+
+extern const int16 S2_DIRS2[];
+extern const char *S2_NAMES2[];
+
 class Section2 : public Section {
 private:
 	Room201 _room201;




More information about the Scummvm-git-logs mailing list