[Scummvm-git-logs] scummvm master -> 88656e757c4d14a684a4965f5e288c5a1882cb1d
OMGPizzaGuy
noreply at scummvm.org
Thu Sep 28 02:34:06 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
24c75479d7 ULTIMA8: Revert screenspace calculation changes.
cd1fb3d80b ULTIMA8: Enable y-flat sort test with a better test and an exception for non-fixed items
88656e757c ULTIMA8: Adjust flat item rules based on more examples at map 37
Commit: 24c75479d787cbbf8b815e774ae03ca1c757c038
https://github.com/scummvm/scummvm/commit/24c75479d787cbbf8b815e774ae03ca1c757c038
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-27T21:33:40-05:00
Commit Message:
ULTIMA8: Revert screenspace calculation changes.
Precision loss from integer division is intention and switch back to calculation prior to 7fe6e2ec
Changed paths:
engines/ultima/ultima8/world/item_sorter.cpp
engines/ultima/ultima8/world/sort_item.h
test/engines/ultima/ultima8/world/sort_item.h
diff --git a/engines/ultima/ultima8/world/item_sorter.cpp b/engines/ultima/ultima8/world/item_sorter.cpp
index 605e92a89ec..f90e6d9246c 100644
--- a/engines/ultima/ultima8/world/item_sorter.cpp
+++ b/engines/ultima/ultima8/world/item_sorter.cpp
@@ -440,9 +440,11 @@ bool ItemSorter::PaintSortItem(RenderSurface *surf, SortItem *si, bool showFootp
// Draw wire frame footpads
if (showFootpad) {
uint32 color = TEX32_PACK_RGB(0xFF, 0xFF, 0xFF);
- int32 syLeftTop = (si->_xLeft + si->_y) / 8 - si->_zTop - _camSy;
- int32 syRightTop = (si->_x + si->_yFar) / 8 - si->_zTop - _camSy;
- int32 syNearTop = (si->_x + si->_y) / 8 - si->_zTop - _camSy;
+
+ // NOTE: Precision loss from integer division is intention
+ int32 syLeftTop = si->_xLeft / 8 + si->_y / 8 - si->_zTop - _camSy;
+ int32 syRightTop = si->_x / 8 + si->_yFar / 8 - si->_zTop - _camSy;
+ int32 syNearTop = si->_x / 8 + si->_y / 8 - si->_zTop - _camSy;
surf->drawLine32(color, si->_sxTop, si->_syTop, si->_sxLeft, syLeftTop);
surf->drawLine32(color, si->_sxTop, si->_syTop, si->_sxRight, syRightTop);
@@ -450,8 +452,8 @@ bool ItemSorter::PaintSortItem(RenderSurface *surf, SortItem *si, bool showFootp
surf->drawLine32(color, si->_sxBot, syNearTop, si->_sxRight, syRightTop);
if (si->_z < si->_zTop) {
- int32 syLeftBot = (si->_xLeft + si->_y) / 8 - si->_z - _camSy;
- int32 syRightBot = (si->_x + si->_yFar) / 8 - si->_z - _camSy;
+ int32 syLeftBot = si->_xLeft / 8 + si->_y / 8 - si->_z - _camSy;
+ int32 syRightBot = si->_x / 8 + si->_yFar / 8 - si->_z - _camSy;
surf->drawLine32(color, si->_sxLeft, syLeftTop, si->_sxLeft, syLeftBot);
surf->drawLine32(color, si->_sxRight, syRightTop, si->_sxRight, syRightBot);
surf->drawLine32(color, si->_sxBot, syNearTop, si->_sxBot, si->_syBot);
diff --git a/engines/ultima/ultima8/world/sort_item.h b/engines/ultima/ultima8/world/sort_item.h
index 83ca0c206c0..bb990574c11 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -265,20 +265,23 @@ inline void SortItem::setBoxBounds(const Box& box, int32 sx, int32 sy) {
_yFar = _y - box._yd;
_zTop = _z + box._zd;
+ // NOTE: Precision loss from integer division is intention to fix
+ // rendering issue at MainActor::teleport 37 18168 17656 104
+
// Screenspace bounding box left extent (LNT x coord)
- _sxLeft = (_xLeft - _y) / 4 - sx;
+ _sxLeft = _xLeft / 4 - _y / 4 - sx;
// Screenspace bounding box right extent (RFT x coord)
- _sxRight = (_x - _yFar) / 4 - sx;
+ _sxRight = _x / 4 - _yFar / 4 - sx;
// Screenspace bounding box top x coord (LFT x coord)
- _sxTop = (_xLeft - _yFar) / 4 - sx;
+ _sxTop = _xLeft / 4 - _yFar / 4 - sx;
// Screenspace bounding box top extent (LFT y coord)
- _syTop = (_xLeft + _yFar) / 8 - _zTop - sy;
+ _syTop = _xLeft / 8 + _yFar / 8 - _zTop - sy;
// Screenspace bounding box bottom x coord (RNB x coord)
- _sxBot = (_x - _y) / 4 - sx;
+ _sxBot = _x / 4 - _y / 4 - sx;
// Screenspace bounding box bottom extent (RNB y coord)
- _syBot = (_x + _y) / 8 - _z - sy;
+ _syBot = _x / 8 + _y / 8 - _z - sy;
// Screenspace rect - replace with shape frame calculations
_sr.left = _sxLeft;
diff --git a/test/engines/ultima/ultima8/world/sort_item.h b/test/engines/ultima/ultima8/world/sort_item.h
index f5c2456ad71..c20587c727c 100644
--- a/test/engines/ultima/ultima8/world/sort_item.h
+++ b/test/engines/ultima/ultima8/world/sort_item.h
@@ -15,9 +15,6 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
/**
* Floor tile placed in position not consistent with others nearby
* Test case for rendering issue at MainActor::teleport 37 18168 17656 104
- *
- * !TODO: One of the Y values will need to change by one to properly align.
- * The original game may have been more lossy when translating worldspace position to screenspace.
*/
void test_screenspace_position() {
Ultima::Ultima8::SortItem si1;
@@ -33,7 +30,7 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
Ultima::Ultima8::Box b1(18047, 17663, 104, 128, 128, 104);
si1.setBoxBounds(b1, 0, 0);
TS_ASSERT(si1._sxBot == 96);
- TS_ASSERT(si1._syBot == 4359);
+ TS_ASSERT(si1._syBot == 4358);
// Inconsistent placement
Ultima::Ultima8::Box b2(18168, 17656, 104, 128, 128, 104);
@@ -402,8 +399,10 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
si2.setBoxBounds(b2, 0, 0);
si2._solid = true;
- TS_ASSERT(si1.overlap(si2));
- TS_ASSERT(si2.overlap(si1));
+ // Due to screenspace calculation changes these no longer overlap
+ // !TODO: Investigate overlap as it slightly differs from contains
+ //TS_ASSERT(si1.overlap(si2));
+ //TS_ASSERT(si2.overlap(si1));
TS_ASSERT(si1.below(si2));
TS_ASSERT(!si2.below(si1));
Commit: cd1fb3d80b5a749e43f9bbc3d77bb5fbad7e9392
https://github.com/scummvm/scummvm/commit/cd1fb3d80b5a749e43f9bbc3d77bb5fbad7e9392
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-27T21:33:40-05:00
Commit Message:
ULTIMA8: Enable y-flat sort test with a better test and an exception for non-fixed items
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 bb990574c11..9ec31c22d2a 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -501,21 +501,20 @@ inline bool SortItem::below(const SortItem &si2) const {
// X-Flat gets drawn after when past center point
bool xFlat1 = si1._xLeft == si1._x;
bool xFlat2 = si2._xLeft == si2._x;
- if (xFlat1 != xFlat2) {
+ if (xFlat1 != xFlat2 && si1._fixed == si2._fixed) {
int32 xCenter1 = (si1._xLeft + si1._x) / 2;
int32 xCenter2 = (si2._xLeft + si2._x) / 2;
return xFlat1 ? xCenter1 <= xCenter2 : xCenter1 < xCenter2;
}
- // Disabled: Y-Flat gets drawn after when past center point
- // Not correct at starting area docks
- //bool yFlat1 = si1._yFar == si1._y;
- //bool yFlat2 = si2._yFar == si2._y;
- //if (yFlat1 != yFlat2) {
- // int32 yCenter1 = (si1._yFar + si1._y) / 2;
- // int32 yCenter2 = (si2._yFar + si2._y) / 2;
- // return yFlat1 ? yCenter1 <= yCenter2 : yCenter1 < yCenter2;
- //}
+ // Y-Flat gets drawn after when past center point
+ bool yFlat1 = si1._yFar == si1._y;
+ bool yFlat2 = si2._yFar == si2._y;
+ if (yFlat1 != yFlat2 && si1._fixed == si2._fixed) {
+ 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)
@@ -566,6 +565,8 @@ Common::String SortItem::dumpInfo() const {
info += "land ";
if (_noisy)
info += "noisy ";
+ if (_fixed)
+ info += "fixed ";
return info;
}
diff --git a/test/engines/ultima/ultima8/world/sort_item.h b/test/engines/ultima/ultima8/world/sort_item.h
index c20587c727c..9f3b370318d 100644
--- a/test/engines/ultima/ultima8/world/sort_item.h
+++ b/test/engines/ultima/ultima8/world/sort_item.h
@@ -309,9 +309,11 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
si1._solid = true;
si1._occl = true;
si1._land = true;
+ si1._fixed = true;
Ultima::Ultima8::Box b2(13244, 9876, 48, 0, 96, 40);
si2.setBoxBounds(b2, 0, 0);
+ si2._fixed = true;
TS_ASSERT(si1.below(si2));
TS_ASSERT(!si2.below(si1));
@@ -330,9 +332,11 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
si1._solid = true;
si1._occl = true;
si1._land = true;
+ si1._fixed = true;
Ultima::Ultima8::Box b2(19167, 15775, 56, 0, 128, 40);
si2.setBoxBounds(b2, 0, 0);
+ si2._fixed = true;
TS_ASSERT(!si1.below(si2));
TS_ASSERT(si2.below(si1));
@@ -340,19 +344,50 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
/**
* Overlapping y-flat vs non-flat items
- * Test case for rendering issue at MainActor::teleport 41 20063 13887 48
+ * Test case for rendering issue at MainActor::teleport 37 18992 17664 104
*/
void test_y_flat_sort() {
Ultima::Ultima8::SortItem si1;
Ultima::Ultima8::SortItem si2;
- Ultima::Ultima8::Box b1(64, 0, 16, 64, 0, 16);
+ Ultima::Ultima8::Box b1(19007, 17439, 104, 64, 32, 40);
si1.setBoxBounds(b1, 0, 0);
si1._solid = true;
+ si1._occl = true;
+ si1._land = true;
+ si1._fixed = true;
+
+ Ultima::Ultima8::Box b2(19008, 17432, 104, 96, 0, 40);
+ si2.setBoxBounds(b2, 0, 0);
+ si2._fixed = true;
+
+ TS_ASSERT(si1.overlap(si2));
+ TS_ASSERT(si2.overlap(si1));
+
+ TS_ASSERT(si1.below(si2));
+ TS_ASSERT(!si2.below(si1));
+ }
- Ultima::Ultima8::Box b2(64, 64, 0, 64, 64, 40);
+ /**
+ * Overlapping fixed y-flat vs non-fixed non-flat items where the flat should draw first
+ * Test case for rendering issue at MainActor::teleport 3 12355 5467 8
+ * Barrel at docks render after flat vines
+ */
+ void test_y_flat_exception_sort() {
+ Ultima::Ultima8::SortItem si1;
+ Ultima::Ultima8::SortItem si2;
+
+ Ultima::Ultima8::Box b1(12255, 5503, 0, 128, 0, 40);
+ si1.setBoxBounds(b1, 0, 0);
+ si1._fixed = true;
+
+ Ultima::Ultima8::Box b2(12260, 5532, 8, 64, 64, 16);
si2.setBoxBounds(b2, 0, 0);
si2._solid = true;
+ si2._land = true;
+
+ TS_ASSERT(si1.overlap(si2));
+ TS_ASSERT(si2.overlap(si1));
TS_ASSERT(si1.below(si2));
TS_ASSERT(!si2.below(si1));
Commit: 88656e757c4d14a684a4965f5e288c5a1882cb1d
https://github.com/scummvm/scummvm/commit/88656e757c4d14a684a4965f5e288c5a1882cb1d
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-27T21:33:40-05:00
Commit Message:
ULTIMA8: Adjust flat item rules based on more examples at map 37
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 9ec31c22d2a..b0335ed5a94 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -498,22 +498,42 @@ inline bool SortItem::below(const SortItem &si2) const {
if (si1._roof != si2._roof)
return si1._roof > si2._roof;
- // X-Flat gets drawn after when past center point
+ // X-Flat gets drawn after under specific conditions
bool xFlat1 = si1._xLeft == si1._x;
bool xFlat2 = si2._xLeft == si2._x;
if (xFlat1 != xFlat2 && si1._fixed == si2._fixed) {
- int32 xCenter1 = (si1._xLeft + si1._x) / 2;
- int32 xCenter2 = (si2._xLeft + si2._x) / 2;
- return xFlat1 ? xCenter1 <= xCenter2 : xCenter1 < xCenter2;
+ if (xFlat1) {
+ if (si2._x - 32 > si2._xLeft) {
+ int32 xCenter2 = (si2._xLeft + si2._x) / 2;
+ return si1._x <= xCenter2;
+ }
+ return false;
+ } else {
+ if (si1._x - 32 > si1._xLeft) {
+ int32 xCenter1 = (si1._xLeft + si1._x) / 2;
+ return xCenter1 < si2._x;
+ }
+ return true;
+ }
}
- // Y-Flat gets drawn after when past center point
+ // Y-Flat gets drawn after under specific conditions
bool yFlat1 = si1._yFar == si1._y;
bool yFlat2 = si2._yFar == si2._y;
if (yFlat1 != yFlat2 && si1._fixed == si2._fixed) {
- int32 yCenter1 = (si1._yFar + si1._y) / 2;
- int32 yCenter2 = (si2._yFar + si2._y) / 2;
- return yFlat1 ? yCenter1 <= yCenter2 : yCenter1 < yCenter2;
+ if (yFlat1) {
+ if (si2._y - 32 > si2._yFar) {
+ int32 yCenter2 = (si2._yFar + si2._y) / 2;
+ return si1._y <= yCenter2;
+ }
+ return false;
+ } else {
+ if (si1._y - 32 > si1._yFar) {
+ int32 yCenter1 = (si1._yFar + si1._y) / 2;
+ return yCenter1 < si2._y;
+ }
+ return true;
+ }
}
// Partial in X + Y front
diff --git a/test/engines/ultima/ultima8/world/sort_item.h b/test/engines/ultima/ultima8/world/sort_item.h
index 9f3b370318d..b37c52f51d1 100644
--- a/test/engines/ultima/ultima8/world/sort_item.h
+++ b/test/engines/ultima/ultima8/world/sort_item.h
@@ -319,6 +319,30 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
TS_ASSERT(!si2.below(si1));
}
+ /**
+ * Overlapping x-flat vs non-flat wall with x-flat far inside wall
+ * Test case for rendering issue at MainActor::teleport 37 17619 17767 104
+ * Tapestry should draw after wall again
+ */
+ void test_x_flat_vs_thin_wall_sort() {
+ Ultima::Ultima8::SortItem si1;
+ Ultima::Ultima8::SortItem si2;
+
+ Ultima::Ultima8::Box b1(17439, 17535, 104, 32, 128, 40);
+ si1.setBoxBounds(b1, 0, 0);
+ si1._solid = true;
+ si1._occl = true;
+ si1._land = true;
+ si1._fixed = true;
+
+ Ultima::Ultima8::Box b2(17410, 17502, 96, 0, 96, 40);
+ si2.setBoxBounds(b2, 0, 0);
+ si2._fixed = true;
+
+ TS_ASSERT(si1.below(si2));
+ 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
@@ -406,9 +430,11 @@ class U8SortItemTestSuite : public CxxTest::TestSuite {
si1._trans = true;
si1._solid = true;
si1._land = true;
+ si1._fixed = true;
Ultima::Ultima8::Box b2(20543, 9855, 48, 96, 0, 16);
si2.setBoxBounds(b2, 0, 0);
+ si2._fixed = true;
TS_ASSERT(si1.overlap(si2));
TS_ASSERT(si2.overlap(si1));
More information about the Scummvm-git-logs
mailing list