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

bgK bastien.bouclet at gmail.com
Tue Jul 10 19:09:50 CEST 2018


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:
e105c2a78a MOHAWK: RIVEN: Fix off-by-one ids in ospit for the 25th localized versions


Commit: e105c2a78ae14a0b3c6645fe98db98f3c299f13f
    https://github.com/scummvm/scummvm/commit/e105c2a78ae14a0b3c6645fe98db98f3c299f13f
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-07-10T19:09:30+02:00

Commit Message:
MOHAWK: RIVEN: Fix off-by-one ids in ospit for the 25th localized versions

Fixes Trac#10620.

Changed paths:
    engines/mohawk/resource.cpp
    engines/mohawk/resource.h
    engines/mohawk/riven.cpp


diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp
index ea44ca7..e8e382a 100644
--- a/engines/mohawk/resource.cpp
+++ b/engines/mohawk/resource.cpp
@@ -154,6 +154,25 @@ Common::Array<uint16> Archive::getResourceIDList(uint32 type) const {
 	return idList;
 }
 
+void Archive::offsetResourceIDs(uint32 type, uint16 startId, int16 increment) {
+	if (!_types.contains(type)) {
+		return;
+	}
+
+	const ResourceMap &oldResMap = _types[type];
+	ResourceMap newResMap;
+
+	for (ResourceMap::const_iterator it = oldResMap.begin(); it != oldResMap.end(); it++) {
+		if (it->_key >= startId) {
+			newResMap[it->_key + increment] = it->_value;
+		} else {
+			newResMap[it->_key] = it->_value;
+		}
+	}
+
+	_types[type] = newResMap;
+}
+
 // Mohawk Archive code
 
 struct FileTableEntry {
diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h
index 809c55d..426e022 100644
--- a/engines/mohawk/resource.h
+++ b/engines/mohawk/resource.h
@@ -145,6 +145,8 @@ public:
 	Common::Array<uint32> getResourceTypeList() const;
 	Common::Array<uint16> getResourceIDList(uint32 type) const;
 
+	/** Offset the resource ids for a resource type by the specified amount */
+	void offsetResourceIDs(uint32 type, uint16 startId, int16 increment);
 protected:
 	Common::SeekableReadStream *_stream;
 
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 57d7da3..4285ef7 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -400,8 +400,19 @@ void MohawkEngine_Riven::changeToStack(uint16 stackId) {
 	Common::String languageDatafile = getLanguageDatafile(prefix);
 	if (!languageDatafile.empty()) {
 		MohawkArchive *mhk = new MohawkArchive();
-		if (mhk->openFile(languageDatafile))
+		if (mhk->openFile(languageDatafile)) {
+
+			if (stackId == kStackOspit && (getLanguage() != Common::EN_ANY || getLanguage() != Common::RU_RUS)) {
+				// WORKAROUND: The international CD versions were repacked for the 25th anniversary release
+				// so they share the same resources as the English DVD version. The resource IDs for the DVD
+				// version resources have a delta of 1 in their numbering when compared the the CD version
+				// resources for Gehn's office. Unfortunately this delta was not compensated when repacking
+				// the archives. We need to do it here at run time...
+				mhk->offsetResourceIDs(ID_TBMP, 196, 1);
+			}
+
 			_mhk.push_back(mhk);
+		}
 		else
 			delete mhk;
 	}





More information about the Scummvm-git-logs mailing list