Skip to content

Commit

Permalink
SCI32: Clean up Plane
Browse files Browse the repository at this point in the history
* Rewrap comments to 80 columns
* Clarify comments where possible
  • Loading branch information
csnover committed Oct 7, 2017
1 parent 1b42146 commit 31e1d09
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 188 deletions.
2 changes: 1 addition & 1 deletion engines/sci/engine/features.h
Expand Up @@ -128,7 +128,7 @@ class GameFeatures {
inline bool hasTransparentPicturePlanes() const {
const SciGameId &gid = g_sci->getGameId();

// NOTE: MGDX is assumed to not have transparent picture planes since it
// MGDX is assumed to not have transparent picture planes since it
// was released before SQ6, but this has not been verified since it
// cannot be disassembled at the moment (Phar Lap Windows-only release)
return getSciVersion() >= SCI_VERSION_2_1_MIDDLE &&
Expand Down
27 changes: 13 additions & 14 deletions engines/sci/graphics/plane32.cpp
Expand Up @@ -320,9 +320,9 @@ void Plane::calcLists(Plane &visiblePlane, const PlaneList &planeList, DrawList

for (ScreenItemList::size_type i = 0; i < screenItemCount; ++i) {
// Items can be added to ScreenItemList and we don't want to process
// those new items, but the list also can grow smaller, so we need
// to check that we are still within the upper bound of the list and
// quit if we aren't any more
// those new items, but the list also can grow smaller, so we need to
// check that we are still within the upper bound of the list and quit
// if we aren't any more
if (i >= _screenItemList.size()) {
break;
}
Expand All @@ -332,18 +332,17 @@ void Plane::calcLists(Plane &visiblePlane, const PlaneList &planeList, DrawList
continue;
}

// NOTE: The original engine used an array without bounds checking
// so could just get the visible screen item directly; we need to
// verify that the index is actually within the valid range for
// the visible plane before accessing the item to avoid a range
// error.
// SSCI used an array without bounds checking so could just get the
// visible screen item directly; we need to verify that the index is
// actually within the valid range for the visible plane before
// accessing the item to avoid a range error.
const ScreenItem *visibleItem = nullptr;
if (i < visiblePlaneItemCount) {
visibleItem = visiblePlane._screenItemList[i];
}

// Keep erase rects for this screen item from drawing outside
// of its owner plane
// Keep erase rects for this screen item from drawing outside of its
// owner plane
Common::Rect visibleItemScreenRect;
if (visibleItem != nullptr) {
visibleItemScreenRect = visibleItem->_screenRect;
Expand Down Expand Up @@ -427,8 +426,8 @@ 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.
// The current size of the draw list is stored here, as we need to loop over
// only the already-inserted entries later.
DrawList::size_type drawListSizePrimary = drawList.size();
const RectList::size_type eraseListCount = eraseList.size();

Expand Down Expand Up @@ -823,8 +822,8 @@ void Plane::sync(const Plane *other, const Common::Rect &screenRect) {

convertGameRectToPlaneRect();
_screenRect = _planeRect;
// NOTE: screenRect originally was retrieved through globals
// instead of being passed into the function
// screenRect was retrieved through globals in SSCI instead of being passed
// into the function. We don't do that just to avoid the extra indirection
clipScreenRect(screenRect);
}

Expand Down

0 comments on commit 31e1d09

Please sign in to comment.