aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorMartin Kiewitz2010-10-26 20:19:17 +0000
committerMartin Kiewitz2010-10-26 20:19:17 +0000
commitd078a4d235117696d889a6f52a0b2c6a0569d6ea (patch)
tree40d4b1da9464fb8da4f5b975c0ca3f35ce552031 /engines/sci/graphics
parentd3523a604071eae4f78f879f9d42a81f29b9121f (diff)
downloadscummvm-rg350-d078a4d235117696d889a6f52a0b2c6a0569d6ea.tar.gz
scummvm-rg350-d078a4d235117696d889a6f52a0b2c6a0569d6ea.tar.bz2
scummvm-rg350-d078a4d235117696d889a6f52a0b2c6a0569d6ea.zip
SCI: fix gfx issues when giving out cards hoyle4
bit 2 actually triggers special drawing of cels in sierra sci svn-id: r53855
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/animate.cpp22
-rw-r--r--engines/sci/graphics/animate.h6
-rw-r--r--engines/sci/graphics/view.cpp10
-rw-r--r--engines/sci/graphics/view.h1
4 files changed, 27 insertions, 12 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 8aa6f5284f..159f791ebd 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -283,17 +283,21 @@ void GfxAnimate::fill(byte &old_picNotValid) {
if ((signal & kSignalHidden) && !(signal & kSignalAlwaysUpdate))
setNsRect = false;
} else {
- view->getCelRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
+ // This special handling is not included in the other SCI1.1 interpreters and MUST NOT be
+ // checked in those cases, otherwise we will break games (e.g. EcoQuest 2, room 200)
+ if ((g_sci->getGameId() == GID_HOYLE4) && (it->scaleSignal & kScaleSignalHoyle4SpecialHandling)) {
+ view->getCelRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
+ it->celRect.left = readSelectorValue(_s->_segMan, curObject, SELECTOR(nsLeft));
+ it->celRect.top = readSelectorValue(_s->_segMan, curObject, SELECTOR(nsTop));
+ it->celRect.right = readSelectorValue(_s->_segMan, curObject, SELECTOR(nsRight));
+ it->celRect.bottom = readSelectorValue(_s->_segMan, curObject, SELECTOR(nsBottom));
+ view->getCelSpecialHoyle4Rect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
+ setNsRect = false;
+ } else {
+ view->getCelRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
+ }
}
- // Checking for this bit must be here for Hoyle4, otherwise cards are unclickable.
- // This feature is not included in the other SCI1.1 interpreters and MUST NOT be
- // checked in those cases, otherwise we will break games (e.g. EcoQuest 2, room 200)
- // TODO: hoyle 4 has different code inside kAnimate and even special code, when bit 0 is not
- // set, but bit 2 is
- if ((g_sci->getGameId() == GID_HOYLE4) && (it->scaleSignal & kScaleSignalHoyle4DontSetNsrect))
- setNsRect = false;
-
if (setNsRect) {
writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsLeft), it->celRect.left);
writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsTop), it->celRect.top);
diff --git a/engines/sci/graphics/animate.h b/engines/sci/graphics/animate.h
index 04e6b36dcf..7b5ec8ee9b 100644
--- a/engines/sci/graphics/animate.h
+++ b/engines/sci/graphics/animate.h
@@ -51,9 +51,9 @@ enum ViewSignals {
};
enum ViewScaleSignals {
- kScaleSignalDoScaling = 0x0001, // enables scaling when drawing that cel (involves scaleX and scaleY)
- kScaleSignalGlobalScaling = 0x0002, // means that global scaling shall get applied on that cel (sets scaleX/scaleY)
- kScaleSignalHoyle4DontSetNsrect = 0x0004 // HOYLE4-exclusive: do not set nsRect inside kAnimate(); for a test case see bug #3038424
+ kScaleSignalDoScaling = 0x0001, // enables scaling when drawing that cel (involves scaleX and scaleY)
+ kScaleSignalGlobalScaling = 0x0002, // means that global scaling shall get applied on that cel (sets scaleX/scaleY)
+ kScaleSignalHoyle4SpecialHandling = 0x0004 // HOYLE4-exclusive: special handling inside kAnimate, is used when giving out cards
};
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 20ebb9b937..36d48fe3c9 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -354,6 +354,16 @@ void GfxView::getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, C
outRect.top = outRect.bottom - celInfo->height;
}
+void GfxView::getCelSpecialHoyle4Rect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const {
+ const CelInfo *celInfo = getCelInfo(loopNo, celNo);
+ int16 adjustY = y - celInfo->height + celInfo->displaceY + 1;
+ int16 adjustX = x - ((celInfo->width - 1) >> 1) + celInfo->displaceX;
+ outRect.top += adjustY;
+ outRect.bottom += adjustY;
+ outRect.left += adjustX;
+ outRect.right += adjustX;
+}
+
void GfxView::getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect &outRect) const {
int16 scaledDisplaceX, scaledDisplaceY;
int16 scaledWidth, scaledHeight;
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 990a7e2f71..f785e3c475 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -66,6 +66,7 @@ public:
int16 getHeight(int16 loopNo, int16 celNo) const;
const CelInfo *getCelInfo(int16 loopNo, int16 celNo) const;
void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
+ void getCelSpecialHoyle4Rect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect &outRect) const;
const byte *getBitmap(int16 loopNo, int16 celNo);
void draw(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires);