[Scummvm-git-logs] scummvm master -> 88cdad7f84bf5e8ec29c5f90f1474b44894a8036

dreammaster paulfgilbert at gmail.com
Mon May 11 02:18:33 UTC 2020


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:
88cdad7f84 XEEN: Fix loading of wall items from savegame


Commit: 88cdad7f84bf5e8ec29c5f90f1474b44894a8036
    https://github.com/scummvm/scummvm/commit/88cdad7f84bf5e8ec29c5f90f1474b44894a8036
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-10T19:18:24-07:00

Commit Message:
XEEN: Fix loading of wall items from savegame

Changed paths:
    NEWS.md
    engines/xeen/map.cpp


diff --git a/NEWS.md b/NEWS.md
index 47fd61e6a5..fa3cf037e6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -39,6 +39,7 @@ For a more comprehensive changelog of the latest experimental code, see:
    - Fixed freeze due to bad mob data at the top of Witches Tower
    - Fix crash loading some savegames directly from the launcher
    - Fix curing the well in Nightshadow
+   - Fix loading of wall items from savegames
 
  Linux port:
    - Added option to use the system file browser instead of the ScummVM file browser.
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index 24062e67f0..110188fb69 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -303,7 +303,12 @@ MobStruct::MobStruct() {
 bool MobStruct::synchronize(XeenSerializer &s) {
 	s.syncAsSint8(_pos.x);
 	s.syncAsSint8(_pos.y);
-	s.syncAsByte(_id);
+
+	byte v = (_id == -1) ? 0xff : _id;
+	s.syncAsByte(v);
+	if (s.isLoading())
+		_id = (v == 0xff) ? -1 : v;
+
 	s.syncAsByte(_direction);
 
 	return _id != 0xff || _pos.x != -1 || _pos.y != -1;
@@ -480,7 +485,7 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData)
 			if (s.finished())
 				// WORKAROUND: If end of data abnormally reached
 				return;
-		} while (mobStruct._id != 255 || mobStruct._pos.x != -1);
+		} while (mobStruct._id != -1 || mobStruct._pos.x != -1);
 
 		// Load monsters
 		mobStruct.synchronize(s);
@@ -488,7 +493,7 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData)
 			// Empty array has a blank entry
 			mobStruct.synchronize(s);
 
-		while (mobStruct._id != 255 || mobStruct._pos.x != -1) {
+		while (mobStruct._id != -1 || mobStruct._pos.x != -1) {
 			if (s.finished())
 				// WORKAROUND: If end of data abnormally reached
 				return;
@@ -520,7 +525,7 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData)
 
 		// Load wall items. Unlike the previous two arrays, this has no dummy entry for an empty array
 		mobStruct.synchronize(s);
-		while (mobStruct._id != 255 || mobStruct._pos.x != -1) {
+		while (mobStruct._id != -1 || mobStruct._pos.x != -1) {
 			if (s.finished())
 				// WORKAROUND: If end of data abnormally reached
 				return;




More information about the Scummvm-git-logs mailing list