SCI32: Extend scaler sanity checks to all SCI32 versions

Fixes QFG4 bug #10765. It's preferable to have sanity checks in the
code, rather than crashing due to invalid draw rectangles from buggy
game scripts. It's no use checking which specific interpreter versions
had sanity checks and trust the game scripts of the other interpreters.
Thus, it's easier and safer to always enable these sanity checks.
This commit is contained in:
Filippos Karapetis 2019-06-30 14:44:49 +03:00
parent bf92167007
commit 2fd416b0ac
2 changed files with 4 additions and 19 deletions

View file

@ -164,19 +164,6 @@ public:
inline bool usesAlternateSelectors() const { inline bool usesAlternateSelectors() const {
return g_sci->getGameId() == GID_PHANTASMAGORIA2; return g_sci->getGameId() == GID_PHANTASMAGORIA2;
} }
inline bool hasEmptyScaleDrawHack() const {
// Yes: KQ7 (all), PQ4CD, QFG4CD, SQ6, Phant1
// No: All SCI2, all SCI3, GK2, LSL6hires, PQ:SWAT, Torin
// Unknown: Hoyle5, MGDX, Shivers
const SciGameId &gid = g_sci->getGameId();
return getSciVersion() > SCI_VERSION_2 &&
getSciVersion() < SCI_VERSION_2_1_LATE &&
gid != GID_LSL6HIRES &&
gid != GID_GK2 &&
gid != GID_PQSWAT &&
gid != GID_TORIN;
}
#endif #endif
/** /**

View file

@ -857,9 +857,8 @@ 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 { 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 // In SSCI the checks are > because their rects are BR-inclusive; our checks
// are >= because our rects are BR-exclusive // are >= because our rects are BR-exclusive
if (g_sci->_features->hasEmptyScaleDrawHack() && if (targetRect.left >= targetRect.right ||
(targetRect.left >= targetRect.right || targetRect.top >= targetRect.bottom) {
targetRect.top >= targetRect.bottom)) {
return; return;
} }
@ -872,9 +871,8 @@ 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 { 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 // In SSCI the checks are > because their rects are BR-inclusive; our checks
// are >= because our rects are BR-exclusive // are >= because our rects are BR-exclusive
if (g_sci->_features->hasEmptyScaleDrawHack() && if (targetRect.left >= targetRect.right ||
(targetRect.left >= targetRect.right || targetRect.top >= targetRect.bottom) {
targetRect.top >= targetRect.bottom)) {
return; return;
} }