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

OMGPizzaGuy noreply at scummvm.org
Sat Sep 16 20:39:29 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:
f6acb92dac ULTIMA8: Fix paint order issue for flat objects slightly inside walls.


Commit: f6acb92dac1f783fae85344fc851ffd991ef96a3
    https://github.com/scummvm/scummvm/commit/f6acb92dac1f783fae85344fc851ffd991ef96a3
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-16T15:39:14-05:00

Commit Message:
ULTIMA8: Fix paint order issue for flat objects slightly inside walls.
This might need to be altered to check against center points.

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 220d312fc33..295791fc5d3 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -473,6 +473,18 @@ inline bool SortItem::below(const SortItem &si2) const {
 	if (si1._roof != si2._roof)
 		return si1._roof > si2._roof;
 
+	// X-Flat gets drawn after
+	bool xFlat1 = si1._xLeft == si1._x;
+	bool xFlat2 = si2._xLeft == si2._x;
+	if (xFlat1 != xFlat2)
+		return xFlat1 < xFlat2;
+
+	// Y-Flat gets drawn after
+	bool yFlat1 = si1._yFar == si1._y;
+	bool yFlat2 = si2._yFar == si2._y;
+	if (yFlat1 != yFlat2)
+		return yFlat1 < yFlat2;
+
 	// Partial in X + Y front
 	if (si1._x + si1._y != si2._x + si2._y)
 		return (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 4535f5f486b..ebca88ce183 100644
--- a/test/engines/ultima/ultima8/world/sort_item.h
+++ b/test/engines/ultima/ultima8/world/sort_item.h
@@ -222,6 +222,28 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
 		TS_ASSERT(!si2.below(si1));
 	}
 
+	/**
+	 * Overlapping x-flat vs non-flat items
+	 * Test case for rendering issue at MainActor::teleport 40 13103 9951 48
+	 * Tapestry should draw after wall
+	 */
+	void test_x_flat_sort() {
+		Ultima::Ultima8::SortItem si1;
+		Ultima::Ultima8::SortItem si2;
+
+		Ultima::Ultima8::Box b1(13247, 9983, 48, 32, 128, 40);
+		si1.setBoxBounds(b1, 0, 0);
+		si1._solid = true;
+		si1._occl = true;
+		si1._land = true;
+
+		Ultima::Ultima8::Box b2(13244, 9876, 48, 0, 96, 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