diff options
author | Colin Snover | 2016-06-27 20:58:22 -0500 |
---|---|---|
committer | Colin Snover | 2016-06-30 14:04:57 -0500 |
commit | 4ee1901706e6e92d8c27f3acb9c4be75eaca5a3f (patch) | |
tree | 2a8643c359716762dde0bd9874082222abd95275 | |
parent | e89bdf536d0c8f7e89840c7225032c79ddb4015f (diff) | |
download | scummvm-rg350-4ee1901706e6e92d8c27f3acb9c4be75eaca5a3f.tar.gz scummvm-rg350-4ee1901706e6e92d8c27f3acb9c4be75eaca5a3f.tar.bz2 scummvm-rg350-4ee1901706e6e92d8c27f3acb9c4be75eaca5a3f.zip |
SCI32: Add transparent pic plane type
It is not clear if this is ever actually used by game scripts,
though.
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/plane32.cpp | 43 | ||||
-rw-r--r-- | engines/sci/graphics/plane32.h | 20 |
3 files changed, 47 insertions, 20 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 62a77da5ef..fd37020896 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -700,6 +700,8 @@ void GfxFrameout::calcLists(ScreenItemListList &drawLists, EraseListList &eraseL const Plane *outerPlane = _planes[outerPlaneIndex]; const Plane *visiblePlane = _visiblePlanes.findByObject(outerPlane->_object); + // NOTE: SSCI only ever checks for kPlaneTypeTransparent here, even + // though kPlaneTypeTransparentPicture is also a transparent plane if (outerPlane->_type == kPlaneTypeTransparent) { foundTransparentPlane = true; } @@ -890,6 +892,8 @@ void GfxFrameout::calcLists(ScreenItemListList &drawLists, EraseListList &eraseL } } + // NOTE: SSCI only looks for kPlaneTypeTransparent, not + // kPlaneTypeTransparentPicture if (foundTransparentPlane) { for (PlaneList::size_type planeIndex = 0; planeIndex < planeCount; ++planeIndex) { for (PlaneList::size_type i = planeIndex + 1; i < planeCount; ++i) { diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp index 021ac523b8..175875c414 100644 --- a/engines/sci/graphics/plane32.cpp +++ b/engines/sci/graphics/plane32.cpp @@ -163,11 +163,15 @@ void Plane::printDebugInfo(Console *con) const { void Plane::addPicInternal(const GuiResourceId pictureId, const Common::Point *position, const bool mirrorX) { uint16 celCount = 1000; + bool transparent = true; for (uint16 celNo = 0; celNo < celCount; ++celNo) { CelObjPic *celObj = new CelObjPic(pictureId, celNo); if (celCount == 1000) { celCount = celObj->_celCount; } + if (!celObj->_transparent) { + transparent = false; + } ScreenItem *screenItem = new ScreenItem(_object, celObj->_info); screenItem->_pictureId = pictureId; @@ -184,6 +188,7 @@ void Plane::addPicInternal(const GuiResourceId pictureId, const Common::Point *p delete screenItem->_celObj; screenItem->_celObj = celObj; } + _type = transparent ? kPlaneTypeTransparentPicture : kPlaneTypePicture; } void Plane::addPic(const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX) { @@ -196,7 +201,7 @@ void Plane::addPic(const GuiResourceId pictureId, const Common::Point &position, void Plane::changePic() { _pictureChanged = false; - if (_type != kPlaneTypePicture) { + if (_type != kPlaneTypePicture && _type != kPlaneTypeTransparentPicture) { return; } @@ -245,7 +250,10 @@ void Plane::breakDrawListByPlanes(DrawList &drawList, const PlaneList &planeList for (DrawList::size_type i = 0; i < drawList.size(); ++i) { for (PlaneList::size_type j = nextPlaneIndex; j < planeCount; ++j) { - if (planeList[j]->_type != kPlaneTypeTransparent) { + if ( + planeList[j]->_type != kPlaneTypeTransparent && + planeList[j]->_type != kPlaneTypeTransparentPicture + ) { Common::Rect outRects[4]; int splitCount = splitRects(drawList[i]->rect, planeList[j]->_screenRect, outRects); if (splitCount != -1) { @@ -268,7 +276,10 @@ void Plane::breakEraseListByPlanes(RectList &eraseList, const PlaneList &planeLi for (RectList::size_type i = 0; i < eraseList.size(); ++i) { for (PlaneList::size_type j = nextPlaneIndex; j < planeCount; ++j) { - if (planeList[j]->_type != kPlaneTypeTransparent) { + if ( + planeList[j]->_type != kPlaneTypeTransparent && + planeList[j]->_type != kPlaneTypeTransparentPicture + ) { Common::Rect outRects[4]; int splitCount = splitRects(*eraseList[i], planeList[j]->_screenRect, outRects); if (splitCount != -1) { @@ -555,7 +566,7 @@ void Plane::decrementScreenItemArrayCounts(Plane *visiblePlane, const bool force void Plane::filterDownEraseRects(DrawList &drawList, RectList &eraseList, RectList &higherEraseList) const { const RectList::size_type higherEraseCount = higherEraseList.size(); - if (_type == kPlaneTypeTransparent) { + if (_type == kPlaneTypeTransparent || _type == kPlaneTypeTransparentPicture) { for (RectList::size_type i = 0; i < higherEraseCount; ++i) { const Common::Rect &r = *higherEraseList[i]; const ScreenItemList::size_type screenItemCount = _screenItemList.size(); @@ -727,14 +738,24 @@ void Plane::redrawAll(Plane *visiblePlane, const PlaneList &planeList, DrawList } void Plane::setType() { - if (_pictureId == kPlanePicOpaque) { - _type = kPlaneTypeOpaque; - } else if (_pictureId == kPlanePicTransparent) { - _type = kPlaneTypeTransparent; - } else if (_pictureId == kPlanePicColored) { + switch (_pictureId) { + case kPlanePicColored: _type = kPlaneTypeColored; - } else { - _type = kPlaneTypePicture; + break; + case kPlanePicTransparent: + _type = kPlaneTypeTransparent; + break; + case kPlanePicOpaque: + _type = kPlaneTypeOpaque; + break; + case kPlanePicTransparentPicture: + _type = kPlaneTypeTransparentPicture; + break; + default: + if (_type != kPlaneTypeTransparentPicture) { + _type = kPlaneTypePicture; + } + break; } } diff --git a/engines/sci/graphics/plane32.h b/engines/sci/graphics/plane32.h index 20cff40814..acd535e75a 100644 --- a/engines/sci/graphics/plane32.h +++ b/engines/sci/graphics/plane32.h @@ -32,19 +32,21 @@ namespace Sci { enum PlaneType { - kPlaneTypeColored = 0, - kPlaneTypePicture = 1, - kPlaneTypeTransparent = 2, - kPlaneTypeOpaque = 3 + kPlaneTypeColored = 0, + kPlaneTypePicture = 1, + kPlaneTypeTransparent = 2, + kPlaneTypeOpaque = 3, + kPlaneTypeTransparentPicture = 4 }; enum PlanePictureCodes { - // NOTE: Any value at or below 65532 means the plane + // NOTE: Any value at or below 65531 means the plane // is a kPlaneTypePicture. - kPlanePic = 65532, - kPlanePicOpaque = 65533, - kPlanePicTransparent = 65534, - kPlanePicColored = 65535 + kPlanePic = 65531, + kPlanePicTransparentPicture = 65532, + kPlanePicOpaque = 65533, + kPlanePicTransparent = 65534, + kPlanePicColored = 65535 }; #pragma mark - |