UTLIMA8: Found test case to support the partial in front rule.

The rules that temporarily replaced this rule appear to only work well for x & y flats
This commit is contained in:
Matthew Jimenez 2023-10-04 15:35:34 -05:00
parent 4c1f8dfc59
commit 757e8343b7
2 changed files with 47 additions and 18 deletions

View File

@ -203,29 +203,31 @@ bool SortItem::below(const SortItem &si2) const {
if (si1._z != si2._z)
return si1._z < si2._z;
// Higher screenspace left drawn before?
if (si1._sxLeft != si2._sxLeft)
return si1._sxLeft > si2._sxLeft;
if (xFlat1 || xFlat2 || yFlat1 || yFlat2) {
// Higher screenspace left drawn before?
if (si1._sxLeft != si2._sxLeft)
return si1._sxLeft > si2._sxLeft;
// Lower screenspace bottom drawn before?
if (si1._syBot != si2._syBot)
return si1._syBot < si2._syBot;
// Lower screenspace bottom drawn before?
if (si1._syBot != si2._syBot)
return si1._syBot < si2._syBot;
}
//// Partial in X + Y front
//if (si1._x + si1._y != si2._x + si2._y)
// return (si1._x + si1._y < si2._x + si2._y);
// Partial in X + Y front
if (si1._x + si1._y != si2._x + si2._y)
return (si1._x + si1._y < si2._x + si2._y);
//// Partial in X + Y back
//if (si1._xLeft + si1._yFar != si2._xLeft + si2._yFar)
// return (si1._xLeft + si1._yFar < si2._xLeft + si2._yFar);
// Partial in X + Y back
if (si1._xLeft + si1._yFar != si2._xLeft + si2._yFar)
return (si1._xLeft + si1._yFar < si2._xLeft + si2._yFar);
//// Partial in y?
//if (si1._y != si2._y)
// return si1._y < si2._y;
// Partial in y?
if (si1._y != si2._y)
return si1._y < si2._y;
//// Partial in x?
//if (si1._x != si2._x)
// return si1._x < si2._x;
// Partial in x?
if (si1._x != si2._x)
return si1._x < si2._x;
// Just sort by shape number
if (si1._shapeNum != si2._shapeNum)

View File

@ -267,6 +267,33 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
TS_ASSERT(!si2.below(si1));
}
/**
* Overlapping non-flat items partially in front draw after
* Test case for rendering issue at MainActor::teleport 37 22730 18016 56
*/
void test_nonflat_partial_front_sort() {
Ultima::Ultima8::SortItem si1;
Ultima::Ultima8::SortItem si2;
Ultima::Ultima8::Box b1(22591, 17599, 56, 160, 160, 8);
si1.setBoxBounds(b1, 0, 0);
si1._solid = true;
si1._land = true;
si1._fixed = true;
Ultima::Ultima8::Box b2(22719, 17695, 56, 160, 160, 8);
si2.setBoxBounds(b2, 0, 0);
si2._solid = true;
si2._land = true;
si2._fixed = true;
TS_ASSERT(si1.overlap(si2));
TS_ASSERT(si2.overlap(si1));
TS_ASSERT(si1.below(si2));
TS_ASSERT(!si2.below(si1));
}
/**
* Overlapping lower Z position transparent non-solid draw after
* Test case for rendering issue at MainActor::teleport 50 2316 7812 48