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

neuromancer noreply at scummvm.org
Wed Nov 12 19:50:57 UTC 2025


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

Summary:
9d6832b2be PRIVATE: Update casebook locations and inventory placement
f970cb684a PRIVATE: Display casebook locations in the order visited


Commit: 9d6832b2be3c7eba4956a6c4dd6398bce278f856
    https://github.com/scummvm/scummvm/commit/9d6832b2be3c7eba4956a6c4dd6398bce278f856
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-11-12T20:50:53+01:00

Commit Message:
PRIVATE: Update casebook locations and inventory placement

Casebook texts are now drawn in the same positions as the original.

Fixes "Delores Gonzales' Apartment", bug #15853

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 93b28c3ec92..5ea66f60176 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -2156,17 +2156,16 @@ void PrivateEngine::removeTimer() {
 
 void PrivateEngine::loadLocations(const Common::Rect &rect) {
 	uint32 i = 0;
-	int16 offset = 44;
+	int16 offset = 54;
 	for (NameList::const_iterator it = maps.locationList.begin(); it != maps.locationList.end(); ++it) {
 		const Private::Symbol *sym = maps.locations.getVal(*it);
 		i++;
 		if (sym->u.val) {
-			offset = offset + 22;
 			Common::String s =
 				Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i);
 
 			MaskInfo m;
-			loadMaskAndInfo(&m, s, rect.left + 120, rect.top + offset, true);
+			loadMaskAndInfo(&m, s, rect.left + 90, rect.top + offset, true);
 			m.cursor = g_private->getExitCursor();
 			m.nextSetting = getDiaryMiddleSetting();
 			m.flag1 = nullptr;
@@ -2174,6 +2173,7 @@ void PrivateEngine::loadLocations(const Common::Rect &rect) {
 			m.useBoxCollision = true;
 			_masks.push_front(m);
 			_locationMasks.push_back(m);
+			offset += 26;
 		}
 	}
 }
@@ -2181,10 +2181,10 @@ void PrivateEngine::loadLocations(const Common::Rect &rect) {
 void PrivateEngine::loadInventory(uint32 x, const Common::Rect &r1, const Common::Rect &r2) {
 	int16 offset = 0;
 	for (NameList::const_iterator it = inventory.begin(); it != inventory.end(); ++it) {
-		offset = offset + 22;
 		Graphics::Surface *surface = loadMask(*it, r1.left, r1.top + offset, true);
 		surface->free();
 		delete surface;
+		offset += 20;
 	}
 }
 


Commit: f970cb684afe0934b62a49ef0cf3191d1dff3293
    https://github.com/scummvm/scummvm/commit/f970cb684afe0934b62a49ef0cf3191d1dff3293
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-11-12T20:50:53+01:00

Commit Message:
PRIVATE: Display casebook locations in the order visited

Bug #15853

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 3b8dd74ed8d..7f92d02afaf 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -53,7 +53,12 @@ static void fChgMode(ArgArray args) {
 
 	if (args.size() == 3) {
 		Symbol *location = g_private->maps.lookupLocation(args[2].u.sym->name);
-		setSymbol(location, true);
+		if (location->u.val == 0) {
+			// visited locations have non-zero values.
+			// set to an incrementing value to record the order visited.
+			int maxLocationValue = g_private->getMaxLocationValue();
+			setSymbol(location, maxLocationValue + 1);
+		}
 	}
 
 	if (g_private->_mode == 0) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5ea66f60176..25928fde118 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -2155,26 +2155,50 @@ void PrivateEngine::removeTimer() {
 // Diary
 
 void PrivateEngine::loadLocations(const Common::Rect &rect) {
-	uint32 i = 0;
-	int16 offset = 54;
+	// Locations are displayed in the order they are visited.
+	// maps.locations and maps.locationList contain all locations.
+	// A non-zero symbol value indicates that a location has been
+	// visited and the order in which it was visited.
+
+	// Create an array of visited locations, sorted by order visited
+	Common::Array<const Symbol *> visitedLocations;
+	Common::HashMap<const Symbol *, int> locationIDs;
+	int locationID = 1; // one-based for image file names
 	for (NameList::const_iterator it = maps.locationList.begin(); it != maps.locationList.end(); ++it) {
 		const Private::Symbol *sym = maps.locations.getVal(*it);
-		i++;
-		if (sym->u.val) {
-			Common::String s =
-				Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i);
-
-			MaskInfo m;
-			loadMaskAndInfo(&m, s, rect.left + 90, rect.top + offset, true);
-			m.cursor = g_private->getExitCursor();
-			m.nextSetting = getDiaryMiddleSetting();
-			m.flag1 = nullptr;
-			m.flag2 = nullptr;
-			m.useBoxCollision = true;
-			_masks.push_front(m);
-			_locationMasks.push_back(m);
-			offset += 26;
+		if (sym->u.val != 0) {
+			visitedLocations.push_back(sym);
+			locationIDs[sym] = locationID;
 		}
+		locationID++;
+	}
+	Common::sort(visitedLocations.begin(), visitedLocations.end(), [&locationIDs](const Symbol *a, const Symbol *b) {
+		if (a->u.val != b->u.val) {
+			return a->u.val < b->u.val;
+		} else {
+			// backwards compatibility for older saves files that stored 1
+			// for visited locations and displayed them in a fixed order.
+			return locationIDs[a] < locationIDs[b];
+		}
+	});
+
+	// Load the sorted visited locations
+	int16 offset = 54;
+	for (uint i = 0; i < visitedLocations.size(); i++) {
+		const Private::Symbol *sym = visitedLocations[i];
+		Common::String s =
+			Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), locationIDs[sym]);
+
+		MaskInfo m;
+		loadMaskAndInfo(&m, s, rect.left + 90, rect.top + offset, true);
+		m.cursor = g_private->getExitCursor();
+		m.nextSetting = getDiaryMiddleSetting();
+		m.flag1 = nullptr;
+		m.flag2 = nullptr;
+		m.useBoxCollision = true;
+		_masks.push_front(m);
+		_locationMasks.push_back(m);
+		offset += 26;
 	}
 }
 
@@ -2219,4 +2243,13 @@ void PrivateEngine::loadMemories(const Common::Rect &rect, uint rightPageOffset,
 	}
 }
 
+int PrivateEngine::getMaxLocationValue() {
+	int maxValue = 0;
+	for (SymbolMap::iterator it = maps.locations.begin(); it != maps.locations.end(); ++it) {
+		Symbol *s = it->_value;
+		maxValue = MAX(maxValue, s->u.val);
+	}
+	return maxValue;
+}
+
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index de1437399ce..90494cb42aa 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -348,6 +348,7 @@ public:
 	Common::Array<MaskInfo> _locationMasks;
 	Common::Array<MaskInfo> _memoryMasks;
 	bool selectMemory(const Common::Point &mousePos);
+	int getMaxLocationValue();
 
 	// Save/Load games
 	MaskInfo _saveGameMask;




More information about the Scummvm-git-logs mailing list