[Scummvm-git-logs] scummvm master -> e7a8def2521a44be4ac625467dafbaee7ce1b309
OMGPizzaGuy
noreply at scummvm.org
Fri Sep 22 21:08:10 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:
e7a8def252 ULTIMA8: Fix paint order issue for flat objects in center of wall.
Commit: e7a8def2521a44be4ac625467dafbaee7ce1b309
https://github.com/scummvm/scummvm/commit/e7a8def2521a44be4ac625467dafbaee7ce1b309
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-22T16:07:44-05:00
Commit Message:
ULTIMA8: Fix paint order issue for flat objects in center of wall.
Misplaced item was not visible in original game but caused a paint dependency loop by our ruleset.
Changed paths:
engines/ultima/ultima8/world/sort_item.h
test/engines/ultima/ultima8/world/sort_item.h
diff --git a/engines/ultima/ultima8/world/sort_item.h b/engines/ultima/ultima8/world/sort_item.h
index 67fc157fbd4..29c16c8284f 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -495,17 +495,23 @@ inline bool SortItem::below(const SortItem &si2) const {
if (si1._roof != si2._roof)
return si1._roof > si2._roof;
- // X-Flat gets drawn after
+ // X-Flat gets drawn after when past center point
bool xFlat1 = si1._xLeft == si1._x;
bool xFlat2 = si2._xLeft == si2._x;
- if (xFlat1 != xFlat2)
- return xFlat1 < xFlat2;
+ if (xFlat1 != xFlat2) {
+ int32 xCenter1 = (si1._xLeft + si1._x) / 2;
+ int32 xCenter2 = (si2._xLeft + si2._x) / 2;
+ return xFlat1 ? xCenter1 <= xCenter2 : xCenter1 < xCenter2;
+ }
- // Y-Flat gets drawn after
+ // Y-Flat gets drawn after when past center point
bool yFlat1 = si1._yFar == si1._y;
bool yFlat2 = si2._yFar == si2._y;
- if (yFlat1 != yFlat2)
- return yFlat1 < yFlat2;
+ if (yFlat1 != yFlat2) {
+ int32 yCenter1 = (si1._yFar + si1._y) / 2;
+ int32 yCenter2 = (si2._yFar + si2._y) / 2;
+ return yFlat1 ? yCenter1 <= yCenter2 : yCenter1 < yCenter2;
+ }
// Partial in X + Y front
if (si1._x + si1._y != si2._x + si2._y)
diff --git a/test/engines/ultima/ultima8/world/sort_item.h b/test/engines/ultima/ultima8/world/sort_item.h
index 7d5fb9deeac..a33ad13ca89 100644
--- a/test/engines/ultima/ultima8/world/sort_item.h
+++ b/test/engines/ultima/ultima8/world/sort_item.h
@@ -281,6 +281,27 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
TS_ASSERT(!si2.below(si1));
}
+ /**
+ * Overlapping x-flat vs non-flat items but the flat item was misplaced
+ * Test case for rendering issue at MainActor::teleport 41 19411 15787 48
+ */
+ void test_misplaced_flat_bug() {
+ Ultima::Ultima8::SortItem si1;
+ Ultima::Ultima8::SortItem si2;
+
+ Ultima::Ultima8::Box b1(19199, 15871, 88, 64, 128, 16);
+ si1.setBoxBounds(b1, 0, 0);
+ si1._solid = true;
+ si1._occl = true;
+ si1._land = true;
+
+ Ultima::Ultima8::Box b2(19167, 15775, 56, 0, 128, 40);
+ si2.setBoxBounds(b2, 0, 0);
+
+ TS_ASSERT(!si1.below(si2));
+ TS_ASSERT(si2.below(si1));
+ }
+
/**
* Overlapping y-flat vs non-flat items
* Test case for rendering issue at MainActor::teleport 41 20063 13887 48
More information about the Scummvm-git-logs
mailing list