[Scummvm-git-logs] scummvm master -> 4ff10c525685b173e0a4d924b830c270123592b6
OMGPizzaGuy
noreply at scummvm.org
Sun Jan 29 00:06:23 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:
4ff10c5256 ULTIMA8: Add test case for inventory item sort rule
Commit: 4ff10c525685b173e0a4d924b830c270123592b6
https://github.com/scummvm/scummvm/commit/4ff10c525685b173e0a4d924b830c270123592b6
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-01-28T18:06:07-06:00
Commit Message:
ULTIMA8: Add test case for inventory item sort rule
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 97bb2e65ebd..64b36ee4316 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -421,10 +421,7 @@ inline bool SortItem::below(const SortItem &si2) const {
// Are overlapping in all 3 dimensions if we come here
// Inv items always drawn after
- // 2 places in Crusader have keycards on tables
- // but their z position is the bottom z of the table.
- // TODO: Find these cases and add unit test
- if (si1._invitem != si2._invitem)
+ if (si1._invitem != si2._invitem)
return si1._invitem < si2._invitem;
// Flat always gets drawn before
diff --git a/test/engines/ultima/ultima8/world/sort_item.h b/test/engines/ultima/ultima8/world/sort_item.h
index 715478955cc..d287ce37d41 100644
--- a/test/engines/ultima/ultima8/world/sort_item.h
+++ b/test/engines/ultima/ultima8/world/sort_item.h
@@ -6,11 +6,6 @@
*
* Be aware that the x and y coordinates go opposite to what you might expect,
* see the notes in sort_item.h
- *
- * Still TODO tests:
- * * overlapping in various dimensions
- * * flat (z == zTop) items with various flags
- * * special case for crusader inventory items
*/
class U8SortItemTestSuite : public CxxTest::TestSuite {
public:
@@ -80,6 +75,31 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
TS_ASSERT(!si2.below(si1));
}
+ /**
+ * Inventory items can have a z at the same z of the surface below them
+ * Test case for keycard rendering issue at MainActor::teleport 9 34174 41502 0
+ */
+ void test_inv_item_sort() {
+ Ultima::Ultima8::SortItem si1(nullptr);
+ Ultima::Ultima8::SortItem si2(nullptr);
+
+ Ultima::Ultima8::Box b1(34142, 41150, 0, 256, 64, 8);
+ si1.setBoxBounds(b1, 0, 0);
+ si2._solid = true;
+ si2._land = true;
+
+ Ultima::Ultima8::Box b2(34110, 41118, 0, 64, 64, 0);
+ si2.setBoxBounds(b2, 0, 0);
+ si2._flat = true;
+ si2._invitem = true;
+
+ TS_ASSERT(si1.overlap(si2));
+ TS_ASSERT(si2.overlap(si1));
+
+ TS_ASSERT(si1.below(si2));
+ TS_ASSERT(!si2.below(si1));
+ }
+
/* Overlapping flat items (generally the floor) follow a set of rules */
void test_flat_sort() {
Ultima::Ultima8::SortItem si1(nullptr);
More information about the Scummvm-git-logs
mailing list