aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/wage/util.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp
index f2073ac140..74f2cf5c18 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);
}