[Scummvm-git-logs] scummvm master -> 66b21a6cc9518515df021093cc86682a9b0d5468

dreammaster noreply at scummvm.org
Sat Jul 27 22:38:18 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:
dfe2806093 M4: RIDDLE: Added kernel_load_variant function
11cf964796 M4: RIDDLE: Support functions needed by room 303 init
66b21a6cc9 TITANIC: Fix emoticon check


Commit: dfe2806093c52d3650653b8cf39d20c93235aa35
    https://github.com/scummvm/scummvm/commit/dfe2806093c52d3650653b8cf39d20c93235aa35
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-07-27T15:38:12-07:00

Commit Message:
M4: RIDDLE: Added kernel_load_variant function

Changed paths:
    engines/m4/adv_r/adv_file.cpp
    engines/m4/adv_r/adv_file.h
    engines/m4/riddle/rooms/section3/room303.cpp
    engines/m4/riddle/rooms/section3/room303.h


diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index a5038067c26..4c53bde75e7 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -30,6 +30,7 @@
 #include "m4/core/errors.h"
 #include "m4/core/imath.h"
 #include "m4/fileio/extensions.h"
+#include "m4/fileio/info.h"
 #include "m4/graphics/gr_pal.h"
 #include "m4/gui/gui_buffer.h"
 #include "m4/gui/gui_vmng.h"
@@ -189,6 +190,50 @@ bool kernel_load_room(int minPalEntry, int maxPalEntry, SceneDef *rdef, GrBuff *
 	return true;
 }
 
+bool kernel_load_variant(const char *variant) {
+	auto &sceneDef = _G(currentSceneDef);
+	auto *codeBuff = _G(screenCodeBuff);
+	Common::String filename;
+
+	if (!codeBuff)
+		return false;
+
+	if (_G(kernel).hag_mode) {
+		filename = f_extension_new(variant, "COD");
+	} else {
+		char lastChar = variant[strlen(variant) - 1];
+
+		char *base = env_find(sceneDef.art_base);
+		char *dotPos = strchr(base, '.');
+		if (!dotPos)
+			return false;
+
+		*dotPos++ = lastChar;
+		*dotPos++ = '.';
+		filename = f_extension_new(base, "COD");
+
+		if (!f_info_exists(Common::Path(filename)))
+			return false;
+	}
+
+	SysFile code_file(filename);
+	if (!code_file.exists())
+		error("Failed to load variant %s", filename.c_str());
+
+	// TODO: This is just copied from the room loading code,
+	// rather than disassembling the reset of the original method.
+	// Need to determine whether this is correct or not
+	GrBuff *scr_orig_data = load_codes(&code_file);
+
+	code_file.close();
+
+	if (scr_orig_data) {
+		Buffer *scr_orig_data_buffer = scr_orig_data->get_buffer();
+		RestoreEdgeList(scr_orig_data_buffer);
+		scr_orig_data->release();
+	}	
+}
+
 GrBuff *load_codes(SysFile *code_file) {
 	// No this is not a cheat to allow bugs to live,
 	// if there is no code file, then we don't need a code buffer, either.
diff --git a/engines/m4/adv_r/adv_file.h b/engines/m4/adv_r/adv_file.h
index 925a8966210..440c64a1a67 100644
--- a/engines/m4/adv_r/adv_file.h
+++ b/engines/m4/adv_r/adv_file.h
@@ -43,7 +43,7 @@ bool kernel_load_game(int slot);
 bool kernel_save_game_exists(int32 slot);
 int32 extract_room_num(const Common::String &name);
 
-bool kernel_load_variant(char *variant);
+bool kernel_load_variant(const char *variant);
 GrBuff *load_codes(SysFile *code_file);
 bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette);
 
diff --git a/engines/m4/riddle/rooms/section3/room303.cpp b/engines/m4/riddle/rooms/section3/room303.cpp
index 086d554d0eb..8fe457c76d6 100644
--- a/engines/m4/riddle/rooms/section3/room303.cpp
+++ b/engines/m4/riddle/rooms/section3/room303.cpp
@@ -27,7 +27,58 @@ namespace M4 {
 namespace Riddle {
 namespace Rooms {
 
+void Room303::preload() {
+	LoadWSAssets("OTHER SCRIPT");
+
+	if (_G(flags)[V000]) {
+		_G(art_base_override) = player_been_here(201) ?
+			"EXHIBIT HALL-TREK" : "EH TREK NO SNAKE";
+		_G(use_alternate_attribute_file) = true;
+		_G(player).walker_type = 1;
+		_G(player).shadow_type = 1;
+		_G(player).walker_in_this_scene = true;
+
+	} else {
+		_G(player).walker_type = 0;
+		_G(player).shadow_type = 0;
+		_G(player).walker_in_this_scene = true;
+
+		if (_G(game).room_id == 352) {
+			_G(player).walker_in_this_scene = false;
+			_G(player).disable_hyperwalk = true;
+		}
+	}
+}
+
 void Room303::init() {
+	_val1 = _val2 = 0;
+
+	if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
+		_val3 = 0;
+		_val4 = -1;
+		_triggerMode1 = _triggerMode2 = KT_DAEMON;
+		_val5 = 0;
+		_val6 = 0;
+		_val7 = 0;
+		_val8 = 0;
+	}
+
+	if (player_been_here(301)) {
+		hotspot_set_active("MEI CHEN", false);
+		hotspot_set_active("FENG LI", false);
+		hotspot_set_active("COVER", false);
+	}
+
+	if (_G(game).previous_room != 304) {
+		_door = series_show_sprite("DOOR", 0, 0xf05);
+	}
+
+	switch (_G(game).previous_room) {
+	case 301:
+		break;
+	default:
+		break;
+	}
 }
 
 void Room303::daemon() {
diff --git a/engines/m4/riddle/rooms/section3/room303.h b/engines/m4/riddle/rooms/section3/room303.h
index ab42340af44..f913b927fb3 100644
--- a/engines/m4/riddle/rooms/section3/room303.h
+++ b/engines/m4/riddle/rooms/section3/room303.h
@@ -29,10 +29,25 @@ namespace Riddle {
 namespace Rooms {
 
 class Room303 : public Room {
+private:
+	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;
+	KernelTriggerType _triggerMode1 = KT_DAEMON;
+	KernelTriggerType _triggerMode2 = KT_DAEMON;
+	machine *_door = nullptr;
+
 public:
 	Room303() : Room() {}
 	~Room303() override {}
 
+	void preload() override;
 	void init() override;
 	void daemon() override;
 };


Commit: 11cf964796878652f34b2b1cd11f045282451cfb
    https://github.com/scummvm/scummvm/commit/11cf964796878652f34b2b1cd11f045282451cfb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-07-27T15:38:12-07:00

Commit Message:
M4: RIDDLE: Support functions needed by room 303 init

Changed paths:
    engines/m4/riddle/rooms/section3/room303.cpp
    engines/m4/riddle/rooms/section3/room303.h


diff --git a/engines/m4/riddle/rooms/section3/room303.cpp b/engines/m4/riddle/rooms/section3/room303.cpp
index 8fe457c76d6..792c0045f71 100644
--- a/engines/m4/riddle/rooms/section3/room303.cpp
+++ b/engines/m4/riddle/rooms/section3/room303.cpp
@@ -84,6 +84,55 @@ void Room303::init() {
 void Room303::daemon() {
 }
 
+void Room303::loadHands() {
+	_hands1 = series_load("MC NY hands behind back pos4");
+	_hands2 = series_load("MC NY hand on hip pos4");
+	_hands3 = series_load("MC NY hand out talk pos4");
+	_hands4 = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 357, 255, 86, 0xf00, 0,
+		triggerMachineByHashCallbackNegative, "mc");
+
+	_G(kernel).trigger_mode = KT_DAEMON;
+	sendWSMessage_10000(1, _hands4, _hands1, 1, 1, 200,
+		_hands1, 1, 1, 0);
+	_val10 = _val11 = 0;
+}
+
+void Room303::loadClasped() {
+	_clasped1 = series_load("hands clasped pos5");
+	_clasped2 = series_load("shrug head shake pos5");
+	_clasped3 = series_load("hands clasped bow pos5");
+	_clasped4 = series_load("hands clasped flame loop pos5");
+}
+
+void Room303::setFengActive(bool flag) {
+	for (HotSpotRec *hotspot = _G(currentSceneDef).hotspots;
+		hotspot; hotspot = hotspot->next) {
+		if (!strcmp(hotspot->vocab, "FENG LI")) {
+			if (flag) {
+				hotspot->active = hotspot->lr_x < 600;
+			} else {
+				hotspot->active = hotspot->lr_x > 600;
+			}
+		}
+	}
+}
+
+void Room303::setShadow4(bool active) {
+	if (active) {
+		_shadow4 = series_place_sprite("candleman shadow4", 0, 360, 252, -86, 0xe06);
+	} else {
+		terminateMachineAndNull(_shadow4);
+	}
+}
+
+void Room303::setShadow5(bool active) {
+	if (active) {
+		_shadow5 = series_place_sprite("candleman shadow5", 0, 480, 256, -84, 0xe06);
+	} else {
+		terminateMachineAndNull(_shadow5);
+	}
+}
+
 } // namespace Rooms
 } // namespace Riddle
 } // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room303.h b/engines/m4/riddle/rooms/section3/room303.h
index f913b927fb3..30fc90aa4f0 100644
--- a/engines/m4/riddle/rooms/section3/room303.h
+++ b/engines/m4/riddle/rooms/section3/room303.h
@@ -39,9 +39,31 @@ private:
 	int _val7 = 0;
 	int _val8 = 0;
 	int _val9 = 0;
+	int _val10 = 0;
+	int _val11 = 0;
+	int _val12 = 0;
+	int _val13 = 0;
+	int _val14 = 0;
+	int _val15 = 0;
 	KernelTriggerType _triggerMode1 = KT_DAEMON;
 	KernelTriggerType _triggerMode2 = KT_DAEMON;
 	machine *_door = nullptr;
+	int _hands1 = 0;
+	int _hands2 = 0;
+	int _hands3 = 0;
+	machine *_hands4 = nullptr;
+	int _clasped1 = 0;
+	int _clasped2 = 0;
+	int _clasped3 = 0;
+	int _clasped4 = 0;
+	machine *_shadow4 = nullptr;
+	machine *_shadow5 = nullptr;
+
+	void loadHands();
+	void loadClasped();
+	void setFengActive(bool flag);
+	void setShadow4(bool active);
+	void setShadow5(bool active);
 
 public:
 	Room303() : Room() {}


Commit: 66b21a6cc9518515df021093cc86682a9b0d5468
    https://github.com/scummvm/scummvm/commit/66b21a6cc9518515df021093cc86682a9b0d5468
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-07-27T15:38:12-07:00

Commit Message:
TITANIC: Fix emoticon check

The original increments the source line index before calling
isEmoticon. What still seems weird is the explicit check for
the sequence starting with a '0', since most emoticons I'm
familiar with, like ':p' or ':-)' don't start with a zero.
But the zero check is legitimately that way in the original.

Changed paths:
    engines/titanic/true_talk/tt_parser.cpp


diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 52535112649..b81493cccb0 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -154,13 +154,14 @@ int TTparser::normalize(TTsentence *sentence) {
 		} else if (Common::isUpper(c)) {
 			(*destLine) += tolower(c);
 		} else if (Common::isDigit(c)) {
+			++index;
 			if (c == '0' && isEmoticon(srcLine, index)) {
 				sentence->set38(10);
 			} else {
 				// Iterate through all the digits of the number
 				(*destLine) += c;
-				while (Common::isDigit(srcLine[index + 1]))
-					(*destLine) += srcLine[++index];
+				while (Common::isDigit(srcLine[index]))
+					(*destLine) += srcLine[index++];
 			}
 		} else if (Common::isPunct(c)) {
 			bool flag = false;




More information about the Scummvm-git-logs mailing list