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

sev- sev at scummvm.org
Thu Aug 24 08:54:33 CEST 2017


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:
fd1ea78b35 WAGE: Read rectangles sanely


Commit: fd1ea78b35c88492f3d9ead9e2d2c4ccb6ab7d62
    https://github.com/scummvm/scummvm/commit/fd1ea78b35c88492f3d9ead9e2d2c4ccb6ab7d62
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-24T08:53:08+02:00

Commit Message:
WAGE: Read rectangles sanely

Changed paths:
    engines/wage/util.cpp


diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp
index f2073ac..74f2cf5 100644
--- a/engines/wage/util.cpp
+++ b/engines/wage/util.cpp
@@ -54,12 +54,24 @@ namespace Wage {
 Common::Rect *readRect(Common::SeekableReadStream *in) {
 	int x1, y1, x2, y2;
 
-	y1 = in->readUint16BE();
-	x1 = in->readUint16BE();
-	y2 = in->readUint16BE() + 4;
-	x2 = in->readUint16BE() + 4;
+	y1 = in->readSint16BE();
+	x1 = in->readSint16BE();
+	y2 = in->readSint16BE() + 4;
+	x2 = in->readSint16BE() + 4;
 
-	debug(9, "readRect: %d, %d, %d, %d", x1, y1, x2, y2);
+	bool normalized = false;
+
+	if (x1 > x2) {
+		SWAP(x1, x2);
+		normalized = true;
+	}
+
+	if (y1 > y2) {
+		SWAP(y1, y2);
+		normalized = true;
+	}
+
+	debug(9, "readRect: %s%d, %d, %d, %d", normalized ? "norm " : "", x1, y1, x2, y2);
 
 	return new Common::Rect(x1, y1, x2, y2);
 }





More information about the Scummvm-git-logs mailing list