[Scummvm-git-logs] scummvm master -> 515343766a8432ede6620d6db845e750ba05f7cd
mduggan
mgithub at guarana.org
Sat Apr 18 02:02:05 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cca3d27b6e ULTIMA8: Avoid going over end of string data
515343766a ULTIMA8: Slightly better paint order
Commit: cca3d27b6e7457938e3915a5755b28f669bc4824
https://github.com/scummvm/scummvm/commit/cca3d27b6e7457938e3915a5755b28f669bc4824
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-18T10:53:46+09:00
Commit Message:
ULTIMA8: Avoid going over end of string data
Changed paths:
engines/ultima/ultima8/audio/speech_flex.cpp
diff --git a/engines/ultima/ultima8/audio/speech_flex.cpp b/engines/ultima/ultima8/audio/speech_flex.cpp
index 6370c789ef..534b78a9be 100644
--- a/engines/ultima/ultima8/audio/speech_flex.cpp
+++ b/engines/ultima/ultima8/audio/speech_flex.cpp
@@ -41,7 +41,7 @@ SpeechFlex::SpeechFlex(Common::SeekableReadStream *rs) : SoundFlex(rs) {
// hold multiple null-terminated strings.
unsigned int off = 0;
while (off < size) {
- istring str(cbuf + off);
+ istring str(cbuf + off, size - off);
off += str.size() + 1;
TabsToSpaces(str, 1);
Commit: 515343766a8432ede6620d6db845e750ba05f7cd
https://github.com/scummvm/scummvm/commit/515343766a8432ede6620d6db845e750ba05f7cd
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-18T11:00:41+09:00
Commit Message:
ULTIMA8: Slightly better paint order
It's still not quite right - some cycles still appear in the dependency graph,
but at least with this logic the avatar's foot doesn't disappear during combat.
Changed paths:
engines/ultima/ultima8/world/item_sorter.cpp
diff --git a/engines/ultima/ultima8/world/item_sorter.cpp b/engines/ultima/ultima8/world/item_sorter.cpp
index 4de379a3d0..e493b20979 100644
--- a/engines/ultima/ultima8/world/item_sorter.cpp
+++ b/engines/ultima/ultima8/world/item_sorter.cpp
@@ -228,9 +228,7 @@ struct SortItem {
// Comparison for the sorted lists
inline bool ListLessThan(const SortItem *other) const {
- return _z < other->_z ||
- (_z == other->_z && _x < other->_x) ||
- (_z == other->_z && _x == other->_x && _y < other->_y);
+ return _z < other->_z || (_z == other->_z && _flat);
}
};
@@ -264,8 +262,8 @@ inline bool SortItem::overlap(const SortItem &si2) const {
const bool bot_right_clear = dot_bot_right >= 0;
const bool clear = right_clear || left_clear ||
- (bot_right_clear && bot_left_clear) ||
- (top_right_clear && top_left_clear);
+ (bot_right_clear || bot_left_clear) ||
+ (top_right_clear || top_left_clear);
return !clear;
}
@@ -333,34 +331,13 @@ inline bool SortItem::operator<(const SortItem &si2) const {
}
// Mixed, or non flat
else {
-
- // Clearly X, Y and Z (useful?)
- //if (si1._x <= si2._xLeft && si1._y <= si2._yFar && si1._zTop <= si2._z) return true;
- //else if (si1._xLeft >= si2._x && si1._yFar >= si2._y && si1._z >= si2._zTop) return false;
-
- //int front1 = si1._x + si1._y;
- //int rear1 = si1._xLeft + si1._yFar;
- //int front2 = si2._x + si2._y;
- //int rear2 = si2._xLeft + si2._yFar;
-
- // Rear of object is infront of other's front
- //if (front1 <= rear2) return true;
- //else if (rear1 >= front2) return false;
-
// Clearly in z
if (si1._zTop <= si2._z)
return true;
else if (si1._z >= si2._zTop)
return false;
-
- // Partial in z
- //if (si1._zTop != si2._zTop) return si1._zTop < si2._zTop;
}
- // Clearly in x and y? (useful?)
- //if (si1._x <= si2._xLeft && si1._y <= si2._yFar) return true;
- //else if (si1._xLeft >= si2._x && si1._yFar >= si2._y) return false;
-
// Clearly in x?
if (si1._x <= si2._xLeft) return true;
else if (si1._xLeft >= si2._x) return false;
@@ -402,7 +379,7 @@ inline bool SortItem::operator<(const SortItem &si2) const {
// Partial in y?
if (si1._y != si2._y) return si1._y < si2._y;
- // Just sort by _shape number - not a number any more (is a pointer)
+ // Just sort by shape number
if (si1._shapeNum != si2._shapeNum) return si1._shapeNum < si2._shapeNum;
// And then by _frame
@@ -702,6 +679,7 @@ void ItemSorter::AddItem(int32 x, int32 y, int32 z, uint32 shapeNum, uint32 fram
// Do Clipping here
si->_clipped = _surf->CheckClipped(Rect(si->_sx, si->_sy, _frame->_width, _frame->_height));
if (si->_clipped < 0)
+ // Clipped away entirely - don't add to the list.
return;
// These help out with sorting. We calc them now, so it will be faster
@@ -825,22 +803,31 @@ void ItemSorter::PaintDisplayList(bool item_highlight) {
}
}
+/**
+ * Recursively paint this item and all its dependencies.
+ * Returns true if recursion should stop.
+ */
bool ItemSorter::PaintSortItem(SortItem *si) {
- // Don't paint this, or dependencies if occluded
- if (si->_occluded) return false;
+ // Don't paint this, or dependencies (yet) if occluded
+ if (si->_occluded)
+ return false;
- // Resursion, detection
+ // Resursion detection
si->_order = -2;
// Iterate through our dependancies, and paint them, if possible
SortItem::DependsList::iterator it = si->_depends.begin();
SortItem::DependsList::iterator end = si->_depends.end();
while (it != end) {
- // Well, it can't. Implies infinite recursive sorting.
- //if ((*it)->_order == -2) CANT_HAPPEN_MSG("Detected cycle in the dependency graph");
-
- if ((*it)->_order == -1) if (PaintSortItem((*it))) return true;
-
+ if ((*it)->_order == -2) {
+ warning("cycle in paint dependency graph %d -> %d -> ... -> %d",
+ si->_shapeNum, (*it)->_shapeNum, si->_shapeNum);
+ break;
+ }
+ else if ((*it)->_order == -1) {
+ if (PaintSortItem((*it)))
+ return true;
+ }
++it;
}
More information about the Scummvm-git-logs
mailing list