[Scummvm-git-logs] scummvm master -> 37afcbc2aa06a291ddeded8e5d12c9b18b650e27

OMGPizzaGuy noreply at scummvm.org
Sat Jan 28 20:13:36 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:
37afcbc2aa ULTIMA8: Move inventory sort item rule down and make consistent.


Commit: 37afcbc2aa06a291ddeded8e5d12c9b18b650e27
    https://github.com/scummvm/scummvm/commit/37afcbc2aa06a291ddeded8e5d12c9b18b650e27
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-01-28T14:13:21-06:00

Commit Message:
ULTIMA8: Move inventory sort item rule down and make consistent.

Changed paths:
    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 06a77c35e92..97bb2e65ebd 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -392,15 +392,7 @@ inline bool SortItem::below(const SortItem &si2) const {
 	if (si1._sprite != si2._sprite)
 		return si1._sprite < si2._sprite;
 
-	// Inv items always drawn first if their z-bottom is equal or higher.
-	// This is a bit of a hack as 2 places in Crusader there are keycards
-	// on tables but their z position is the bottom z of the table.
-	if (si1._invitem) {
-		if (si1._z >= si2._z)
-			return false;
-	}
-
-	// Clearly in z with at least one non-flat?
+	// Clearly in z and lower is non-flat?
 	if (si1._z < si2._z && si1._zTop <= si2._z)
 		return true;
 
@@ -428,6 +420,13 @@ 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) 
+		return si1._invitem < si2._invitem;
+
 	// Flat always gets drawn before
 	if (si1._flat != si2._flat)
 		return si1._flat > si2._flat;




More information about the Scummvm-git-logs mailing list