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

tag2015 noreply at scummvm.org
Wed Jun 4 11:14:45 UTC 2025


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

Summary:
9f6edc0440 AGS: Updated build version (3.6.1.33 P11)
42f7dc4148 AGS: Engine: fixed loading 3.4 - 3.4.1 saves with custom properties
21eee750e3 AGS: Engine: fix a breaking cutscene in KQ4 remake
ce2cb2f07c AGS: Engine: fix pre-3.6.0 text on GUI misaligned when centered


Commit: 9f6edc044052c850df1fa4f7aa763a04ce721b10
    https://github.com/scummvm/scummvm/commit/9f6edc044052c850df1fa4f7aa763a04ce721b10
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2025-06-04T13:06:23+02:00

Commit Message:
AGS: Updated build version (3.6.1.33 P11)

Partially from upstream 2c92a6140ca50099133ad85dd7d4abf4a54c5a0d

Changed paths:
    engines/ags/shared/core/def_version.h


diff --git a/engines/ags/shared/core/def_version.h b/engines/ags/shared/core/def_version.h
index 87ca448cef1..13dd7e2d59f 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,13 +22,13 @@
 #ifndef AGS_SHARED_CORE_DEFVERSION_H
 #define AGS_SHARED_CORE_DEFVERSION_H
 
-#define ACI_VERSION_STR      "3.6.1.32"
+#define ACI_VERSION_STR      "3.6.1.33"
 #if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF  3.6.1.32
+#define ACI_VERSION_MSRC_DEF  3.6.1.33
 #endif
 
 #define SPECIAL_VERSION ""
 
-#define ACI_COPYRIGHT_YEARS "2011-2024"
+#define ACI_COPYRIGHT_YEARS "2011-2025"
 
 #endif


Commit: 42f7dc4148d757be4584be0c46e575ec7e92bebb
    https://github.com/scummvm/scummvm/commit/42f7dc4148d757be4584be0c46e575ec7e92bebb
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2025-06-04T13:06:23+02:00

Commit Message:
AGS: Engine: fixed loading 3.4 - 3.4.1 saves with custom properties

Was broken since commit fe13f61
>From upstream 2260770dfd1872e9bf879f2fe999ddb172b4d871

Changed paths:
    engines/ags/engine/ac/room_status.cpp
    engines/ags/shared/game/custom_properties.cpp
    engines/ags/shared/game/custom_properties.h
    engines/ags/shared/util/string_utils.cpp
    engines/ags/shared/util/string_utils.h


diff --git a/engines/ags/engine/ac/room_status.cpp b/engines/ags/engine/ac/room_status.cpp
index 1c2b0309b76..10e73ed8fe2 100644
--- a/engines/ags/engine/ac/room_status.cpp
+++ b/engines/ags/engine/ac/room_status.cpp
@@ -108,12 +108,12 @@ void RoomStatus::ReadFromSavegame_v321(Stream *in, GameDataVersion data_ver) {
 	in->ReadArrayOfInt32(interactionVariableValues, MAX_GLOBAL_VARIABLES);
 
 	if (data_ver >= kGameVersion_340_4) {
-		Properties::ReadValues(roomProps, in);
+		Properties::ReadValues(roomProps, in, true /* aligned */);
 		for (int i = 0; i < MAX_ROOM_HOTSPOTS; ++i) {
-			Properties::ReadValues(hsProps[i], in);
+			Properties::ReadValues(hsProps[i], in, true /* aligned */);
 		}
 		for (auto &props : objProps) {
-			Properties::ReadValues(props, in);
+			Properties::ReadValues(props, in, true /* aligned */);
 		}
 	}
 }
diff --git a/engines/ags/shared/game/custom_properties.cpp b/engines/ags/shared/game/custom_properties.cpp
index ff2e10f25b1..ff11d94ecb5 100644
--- a/engines/ags/shared/game/custom_properties.cpp
+++ b/engines/ags/shared/game/custom_properties.cpp
@@ -83,7 +83,7 @@ void WriteSchema(const PropertySchema &schema, Stream *out) {
 	}
 }
 
-PropertyError ReadValues(StringIMap &map, Stream *in) {
+PropertyError ReadValues(StringIMap &map, Stream *in, bool aligned) {
 	PropertyVersion version = (PropertyVersion)in->ReadInt32();
 	if (version < kPropertyVersion_Initial ||
 	        version > kPropertyVersion_Current) {
@@ -97,9 +97,16 @@ PropertyError ReadValues(StringIMap &map, Stream *in) {
 			map[name] = String::FromStream(in, LEGACY_MAX_CUSTOM_PROP_VALUE_LENGTH);
 		}
 	} else {
-		for (int i = 0; i < count; ++i) {
-			String name = StrUtil::ReadString(in);
-			map[name] = StrUtil::ReadString(in);
+		if (aligned) {
+			for (int i = 0; i < count; ++i) {
+				String name = StrUtil::ReadStringAligned(in);
+				map[name] = StrUtil::ReadStringAligned(in);
+			}
+		} else {
+			for (int i = 0; i < count; ++i) {
+				String name = StrUtil::ReadString(in);
+				map[name] = StrUtil::ReadString(in);
+			}
 		}
 	}
 	return kPropertyErr_NoError;
diff --git a/engines/ags/shared/game/custom_properties.h b/engines/ags/shared/game/custom_properties.h
index 7bede03f7e3..19bd2d32c7f 100644
--- a/engines/ags/shared/game/custom_properties.h
+++ b/engines/ags/shared/game/custom_properties.h
@@ -95,7 +95,8 @@ void WriteSchema(const PropertySchema &schema, Stream *out);
 
 // Reads property values from the stream and assign them to map.
 // The non-matching existing map items, if any, are NOT erased.
-PropertyError ReadValues(StringIMap &map, Stream *in);
+// NOTE: "aligned" parameter is for legacy saves support only.
+PropertyError ReadValues(StringIMap &map, Stream *in, bool aligned = false);
 // Writes property values chunk to the stream
 void WriteValues(const StringIMap &map, Stream *out);
 
diff --git a/engines/ags/shared/util/string_utils.cpp b/engines/ags/shared/util/string_utils.cpp
index a0f0813d0c6..9e54e7d1975 100644
--- a/engines/ags/shared/util/string_utils.cpp
+++ b/engines/ags/shared/util/string_utils.cpp
@@ -150,6 +150,17 @@ void StrUtil::ReadString(char **cstr, Stream *in) {
 	(*cstr)[len] = 0;
 }
 
+String StrUtil::ReadStringAligned(Stream *in) {
+	String s = ReadString(in);
+	size_t rem = s.GetLength() % sizeof(int32_t);
+	if (rem > 0) {
+		size_t pad = sizeof(int32_t) - rem;
+		for (size_t i = 0; i < pad; ++i)
+			in->ReadByte();
+	}
+	return s;
+}
+
 void StrUtil::SkipString(Stream *in) {
 	size_t len = in->ReadInt32();
 	in->Seek(len);
diff --git a/engines/ags/shared/util/string_utils.h b/engines/ags/shared/util/string_utils.h
index c0b196d98d1..69da1a0d3ee 100644
--- a/engines/ags/shared/util/string_utils.h
+++ b/engines/ags/shared/util/string_utils.h
@@ -71,6 +71,9 @@ String          ReadString(Stream *in);
 void            ReadString(char *cstr, Stream *in, size_t buf_limit);
 void            ReadString(char **cstr, Stream *in);
 void            ReadString(String &s, Stream *in);
+// Read a string and trailing padding, aligning total read data to int32
+// this is a special case used strictly for legacy save format
+String          ReadStringAligned(Stream *in);
 void            SkipString(Stream *in);
 void            WriteString(const String &s, Stream *out);
 void            WriteString(const char *cstr, Stream *out);


Commit: 21eee750e3c732428d19a17dc66ad145c29a860c
    https://github.com/scummvm/scummvm/commit/21eee750e3c732428d19a17dc66ad145c29a860c
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2025-06-04T13:06:23+02:00

Commit Message:
AGS: Engine: fix a breaking cutscene in KQ4 remake

This disables a smooth sequential walk transition.
Apparently such transition might break certain character coordinate expectations in game scripts.
>From upstream bf255fce912766c5ef61ec838b3d529d640c1fd8

Changed paths:
    engines/ags/engine/ac/character.cpp


diff --git a/engines/ags/engine/ac/character.cpp b/engines/ags/engine/ac/character.cpp
index fa5cc64fbf9..c9023035d02 100644
--- a/engines/ags/engine/ac/character.cpp
+++ b/engines/ags/engine/ac/character.cpp
@@ -1664,7 +1664,8 @@ void walk_character(int chac, int tox, int toy, int ignwal, bool autoWalkAnims)
 		_GP(mls)[mslot].direct = ignwal;
 		convert_move_path_to_room_resolution(&_GP(mls)[mslot]);
 
-		if (wasStepFrac > 0.f) {
+		// NOTE: unfortunately, some old game scripts might break because of smooth walk transition
+		if (wasStepFrac > 0.f && (_G(loaded_game_file_version) >= kGameVersion_361)) {
 			_GP(mls)[mslot].SetPixelUnitFraction(wasStepFrac);
 		}
 


Commit: ce2cb2f07cca9b9c98d472d01a0537ff6f85dde5
    https://github.com/scummvm/scummvm/commit/ce2cb2f07cca9b9c98d472d01a0537ff6f85dde5
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2025-06-04T13:06:24+02:00

Commit Message:
AGS: Engine: fix pre-3.6.0 text on GUI misaligned when centered

>From upstream 2f567461373011e3653b70e5f1c06cc5e93a8f4a

Changed paths:
    engines/ags/shared/font/fonts.cpp
    engines/ags/shared/font/fonts.h
    engines/ags/shared/gui/gui_main.cpp


diff --git a/engines/ags/shared/font/fonts.cpp b/engines/ags/shared/font/fonts.cpp
index b1a785d9971..6cd44ad20ba 100644
--- a/engines/ags/shared/font/fonts.cpp
+++ b/engines/ags/shared/font/fonts.cpp
@@ -218,6 +218,12 @@ int get_text_width_outlined(const char *text, size_t font_number) {
 	return MAX(self_width, outline_width);
 }
 
+int get_text_height(const char *text, size_t font_number) {
+	if (font_number >= _GP(fonts).size() || !_GP(fonts)[font_number].Renderer)
+		return 0;
+	return _GP(fonts)[font_number].Renderer->GetTextHeight(text, font_number);
+}
+
 int get_font_outline(size_t font_number) {
 	if (font_number >= _GP(fonts).size())
 		return FONT_OUTLINE_NONE;
diff --git a/engines/ags/shared/font/fonts.h b/engines/ags/shared/font/fonts.h
index 6cb82fc2071..cbfaec0b4db 100644
--- a/engines/ags/shared/font/fonts.h
+++ b/engines/ags/shared/font/fonts.h
@@ -90,8 +90,11 @@ void ensure_text_valid_for_font(char *text, size_t fontnum);
 int get_font_scaling_mul(size_t fontNumber);
 // Calculate actual width of a line of text
 int get_text_width(const char *texx, size_t fontNumber);
-// Get the maximal width of the given font, with corresponding outlining
+// Get the maximal width of the line of text, with corresponding outlining
 int get_text_width_outlined(const char *text, size_t font_number);
+// Get the maximal height of the line of text;
+// note that this won't be a nominal font's height, but the max of each met glyph's graphical height.
+int get_text_height(const char *text, size_t font_number);
 // Get font's height; this value is used for logical arrangement of UI elements;
 // note that this is a "formal" font height, that may have different value
 // depending on compatibility mode (used when running old games);
diff --git a/engines/ags/shared/gui/gui_main.cpp b/engines/ags/shared/gui/gui_main.cpp
index 56b82f0e181..807a9ea9a33 100644
--- a/engines/ags/shared/gui/gui_main.cpp
+++ b/engines/ags/shared/gui/gui_main.cpp
@@ -666,12 +666,22 @@ Line CalcFontGraphicalVExtent(int font) {
 	return Line(0, top, 0, bottom);
 }
 
+// When aligning the text on GUI we use one of the methods of finding its height,
+// depending on the loaded game version, for backwards compatibility.
+// < 3.6.0: use text height measurement provided by the font renderer;
+// 3.6.0.0 -> 3.6.0.21: font's height;
+// 3.6.0.21 onwards: full outlined font's height.
+inline int GetTextHeightForAlign(const char *text, int font, FrameAlignment align) {
+	if (_G(loaded_game_file_version) < kGameVersion_360)
+		return get_text_height(text, font) + ((align & kMAlignVCenter) ? 1 : 0);
+	else if (_G(loaded_game_file_version) < kGameVersion_360_21)
+		return get_font_height(font) + ((align & kMAlignVCenter) ? 1 : 0);
+	else
+		return get_font_height_outlined(font);
+}
+
 Point CalcTextPosition(const char *text, int font, const Rect &frame, FrameAlignment align, Rect *gr_rect) {
-	// When aligning we use the formal font's height, which in practice may not be
-	// its real graphical height (this is because of historical AGS's font behavior)
-	int use_height = (_G(loaded_game_file_version) < kGameVersion_360_21) ?
-		get_font_height(font) + ((align & kMAlignVCenter) ? 1 : 0) :
-		get_font_height_outlined(font);
+	const int use_height = GetTextHeightForAlign(text, font, align);
 	Rect rc = AlignInRect(frame, RectWH(0, 0, get_text_width_outlined(text, font), use_height), align);
 	if (gr_rect) {
 		Line vextent = CalcFontGraphicalVExtent(font);




More information about the Scummvm-git-logs mailing list