[Scummvm-git-logs] scummvm master -> 6c3d960a90bda3c13353654bb829a974f9f4de73

sdelamarre noreply at scummvm.org
Tue Nov 21 12:30:55 UTC 2023


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:
6c3d960a90 GOB: Fix TOT text resources loading when no sprite resources are present


Commit: 6c3d960a90bda3c13353654bb829a974f9f4de73
    https://github.com/scummvm/scummvm/commit/6c3d960a90bda3c13353654bb829a974f9f4de73
Author: Simon Delamarre (simon.delamarre14 at gmail.com)
Date: 2023-11-21T13:28:24+01:00

Commit Message:
GOB: Fix TOT text resources loading when no sprite resources are present

This fixes the missing text in Bargon Attack/Atari intro scene.

Changed paths:
    engines/gob/resources.cpp


diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp
index 32ae5fef493..b7ce2efa3cb 100644
--- a/engines/gob/resources.cpp
+++ b/engines/gob/resources.cpp
@@ -240,42 +240,43 @@ bool Resources::loadTOTResourceTable() {
 
 	_totResStart = totProps.scriptEnd;
 
-	if ((totProps.resourcesOffset == 0xFFFFFFFF) ||
-	    (totProps.resourcesOffset == 0))
-		// No resources here
-		return false;
-
-	_totResourceTable = new TOTResourceTable;
+	if (totProps.resourcesOffset != 0xFFFFFFFF && totProps.resourcesOffset != 0) {
+		_totResourceTable = new TOTResourceTable;
 
-	stream->seek(totProps.resourcesOffset);
-	_totResourceTable->itemsCount = stream->readSint16LE();
+		stream->seek(totProps.resourcesOffset);
+		_totResourceTable->itemsCount = stream->readSint16LE();
 
-	uint32 resSize = _totResourceTable->itemsCount * kTOTResItemSize +
-	                 kTOTResTableSize;
+		uint32 resSize = _totResourceTable->itemsCount * kTOTResItemSize +
+						 kTOTResTableSize;
 
-	_totResourceTable->dataOffset = totProps.resourcesOffset + resSize;
+		_totResourceTable->dataOffset = totProps.resourcesOffset + resSize;
 
 
-	// Would the table actually fit into the TOT?
-	if ((totProps.resourcesOffset + resSize) > ((uint32) stream->size()))
-		return false;
+		// Would the table actually fit into the TOT?
+		if ((totProps.resourcesOffset + resSize) > ((uint32) stream->size()))
+			return false;
 
-	_totResourceTable->unknown = stream->readByte();
-	_totResourceTable->items = new TOTResourceItem[_totResourceTable->itemsCount];
+		_totResourceTable->unknown = stream->readByte();
+		_totResourceTable->items = new TOTResourceItem[_totResourceTable->itemsCount];
 
-	for (int i = 0; i < _totResourceTable->itemsCount; ++i) {
-		TOTResourceItem &item = _totResourceTable->items[i];
+		for (int i = 0; i < _totResourceTable->itemsCount; ++i) {
+			TOTResourceItem &item = _totResourceTable->items[i];
 
-		item.offset = stream->readSint32LE();
-		item.size   = stream->readUint16LE();
-		item.width  = stream->readSint16LE();
-		item.height = stream->readSint16LE();
+			item.offset = stream->readSint32LE();
+			item.size   = stream->readUint16LE();
+			item.width  = stream->readSint16LE();
+			item.height = stream->readSint16LE();
 
-		if (item.offset < 0) {
-			item.type = kResourceIM;
-			item.index = -item.offset - 1;
-		} else
-			item.type = kResourceTOT;
+			if (item.offset < 0) {
+				item.type = kResourceIM;
+				item.index = -item.offset - 1;
+			} else
+				item.type = kResourceTOT;
+		}
+	} else {
+		_totResourceTable = nullptr;
+		// Do not return yet: although there is no *sprite* resource table,
+		// a text table may still be present.
 	}
 
 	_totSize = stream->size() - _totResStart;




More information about the Scummvm-git-logs mailing list