aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2016-03-07 23:39:39 +0100
committerWillem Jan Palenstijn2016-03-07 23:41:06 +0100
commit8be1ff109f21e061259af397480624b251ed7fab (patch)
treed34316e62313fe6ccb599c17e729710ced43b8e4
parent86592b82a569f30d5f536343adffc4341db249d1 (diff)
downloadscummvm-rg350-8be1ff109f21e061259af397480624b251ed7fab.tar.gz
scummvm-rg350-8be1ff109f21e061259af397480624b251ed7fab.tar.bz2
scummvm-rg350-8be1ff109f21e061259af397480624b251ed7fab.zip
SCI32: Fix adding too many items to drawlist
-rw-r--r--engines/sci/graphics/plane32.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index 6961a9ac1a..09d8dc0b96 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -382,6 +382,10 @@ void Plane::calcLists(Plane &visiblePlane, const PlaneList &planeList, DrawList
breakEraseListByPlanes(eraseList, planeList);
breakDrawListByPlanes(drawList, planeList);
+ // We store the current size of the drawlist, as we want to loop
+ // over the currently inserted entries later.
+ DrawList::size_type drawListSizePrimary = drawList.size();
+
// NOTE: Setting this to true fixes the menu bars in GK1
if (/* TODO: dword_C6288 */ false) { // "high resolution pictures"????
_screenItemList.sort();
@@ -437,8 +441,12 @@ void Plane::calcLists(Plane &visiblePlane, const PlaneList &planeList, DrawList
}
if (/* TODO: g_Remap_numActiveRemaps == 0 */ true) { // no remaps active?
// Add all items that overlap with items in the drawlist and have higher
- // priority
- for (DrawList::size_type i = 0; i < drawList.size(); ++i) {
+ // priority.
+
+ // We only loop over "primary" items in the draw list, skipping
+ // those that were added because of the erase list in the previous loop,
+ // or those to be added in this loop.
+ for (DrawList::size_type i = 0; i < drawListSizePrimary; ++i) {
DrawItem *dli = drawList[i];
for (PlaneList::size_type j = 0; j < planeItemCount; ++j) {