aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/celobj32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/celobj32.cpp')
-rw-r--r--engines/sci/graphics/celobj32.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 09ea05bd59..8540b636fc 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -21,6 +21,7 @@
*/
#include "sci/resource.h"
+#include "sci/engine/features.h"
#include "sci/engine/seg_manager.h"
#include "sci/engine/state.h"
#include "sci/graphics/celobj32.h"
@@ -175,6 +176,10 @@ struct SCALER_Scale {
// so just always make the reader decompress an entire
// line of source data when scaling
_reader(celObj, celObj._width) {
+#ifndef NDEBUG
+ assert(_minX <= _maxX);
+#endif
+
// In order for scaling ratios to apply equally across objects that
// start at different positions on the screen (like the cels of a
// picture), the pixels that are read from the source bitmap must all
@@ -772,6 +777,14 @@ void CelObj::drawUncompHzFlipNoMDNoSkip(Buffer &target, const Common::Rect &targ
}
void CelObj::scaleDrawNoMD(Buffer &target, const Ratio &scaleX, const Ratio &scaleY, const Common::Rect &targetRect, const Common::Point &scaledPosition) const {
+ // In SSCI the checks are > because their rects are BR-inclusive;
+ // our checks are >= because our rects are BR-exclusive
+ if (g_sci->_features->hasEmptyScaleDrawHack() &&
+ (targetRect.left >= targetRect.right ||
+ targetRect.top >= targetRect.bottom)) {
+ return;
+ }
+
if (_drawMirrored)
render<MAPPER_NoMD, SCALER_Scale<true, READER_Compressed> >(target, targetRect, scaledPosition, scaleX, scaleY);
else
@@ -779,6 +792,14 @@ void CelObj::scaleDrawNoMD(Buffer &target, const Ratio &scaleX, const Ratio &sca
}
void CelObj::scaleDrawUncompNoMD(Buffer &target, const Ratio &scaleX, const Ratio &scaleY, const Common::Rect &targetRect, const Common::Point &scaledPosition) const {
+ // In SSCI the checks are > because their rects are BR-inclusive;
+ // our checks are >= because our rects are BR-exclusive
+ if (g_sci->_features->hasEmptyScaleDrawHack() &&
+ (targetRect.left >= targetRect.right ||
+ targetRect.top >= targetRect.bottom)) {
+ return;
+ }
+
if (_drawMirrored) {
render<MAPPER_NoMD, SCALER_Scale<true, READER_Uncompressed> >(target, targetRect, scaledPosition, scaleX, scaleY);
} else {
@@ -949,6 +970,9 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
_width = READ_SCI11ENDIAN_UINT16(celHeader);
_height = READ_SCI11ENDIAN_UINT16(celHeader + 2);
_origin.x = _width / 2 - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
+ if (g_sci->_features->usesAlternateSelectors() && _mirrorX) {
+ _origin.x = _width - _origin.x - 1;
+ }
_origin.y = _height - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6) - 1;
_skipColor = celHeader[8];
_compressionType = (CelCompressionType)celHeader[9];