aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-08-02 21:04:09 +0000
committerMartin Kiewitz2010-08-02 21:04:09 +0000
commit09f4562551c6f26f5eac8a048051cd379ef93a2d (patch)
tree72e483ee185497cd73a480c95d017d9e3501bc6f
parente52128706303a3016e3ac0c69a88477c93bfc78c (diff)
downloadscummvm-rg350-09f4562551c6f26f5eac8a048051cd379ef93a2d.tar.gz
scummvm-rg350-09f4562551c6f26f5eac8a048051cd379ef93a2d.tar.bz2
scummvm-rg350-09f4562551c6f26f5eac8a048051cd379ef93a2d.zip
SCI: adding non-scaleable view capability
fixes laura bow 2 (especially floppy but CD is also affected somewhat by this) svn-id: r51660
-rw-r--r--engines/sci/graphics/animate.cpp7
-rw-r--r--engines/sci/graphics/view.cpp30
-rw-r--r--engines/sci/graphics/view.h7
3 files changed, 38 insertions, 6 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 521009eff6..df52ab9a7c 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -243,6 +243,13 @@ void GfxAnimate::fill(byte &old_picNotValid) {
}
}
+ if (!view->isScaleable()) {
+ // Laura Bow 2 (especially floppy) depends on this, some views are not supposed to be scaleable
+ // this "feature" was removed in later versions of SCI1.1
+ it->scaleSignal = 0;
+ it->scaleY = it->scaleX = 128;
+ }
+
bool setNsRect = true;
// Create rect according to coordinates and given cel
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 271730015d..1c865f6bcf 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -84,9 +84,10 @@ void GfxView::initData(GuiResourceId resourceId) {
_embeddedPal = false;
_EGAmapping = NULL;
_isSci2Hires = false;
+ _isScaleable = true;
// we adjust inside getCelRect for SCI0EARLY (that version didn't have the +1 when calculating bottom)
- adjustForSci0Early = getSciVersion() == SCI_VERSION_0_EARLY ? -1 : 0;
+ _adjustForSci0Early = getSciVersion() == SCI_VERSION_0_EARLY ? -1 : 0;
// If we find an SCI1/SCI1.1 view (not amiga), we switch to that type for
// EGA. This could get used to make view patches for EGA games, where the
@@ -192,15 +193,30 @@ void GfxView::initData(GuiResourceId resourceId) {
break;
case kViewVga11: // View-format SCI1.1+
- // HeaderSize:WORD LoopCount:BYTE Unknown:BYTE Version:WORD Unknown:WORD PaletteOffset:WORD
+ // HeaderSize:WORD LoopCount:BYTE Flags:BYTE Version:WORD Unknown:WORD PaletteOffset:WORD
headerSize = READ_SCI11ENDIAN_UINT16(_resourceData + 0) + 2; // headerSize is not part of the header, so it's added
assert(headerSize >= 16);
_loopCount = _resourceData[2];
assert(_loopCount);
_isSci2Hires = _resourceData[5] == 1 ? true : false;
palOffset = READ_SCI11ENDIAN_UINT32(_resourceData + 8);
- // FIXME: After LoopCount there is another byte and its set for view 50
- // within Laura Bow 2 CD, check what it means.
+ // flags is actually a bit-mask
+ // it seems it was only used for some early sci1.1 games (or even just laura bow 2)
+ // later interpreters dont support it at all anymore
+ // we assume that if flags is 0h the view does not support flags and default to scaleable
+ // if it's 1h then we assume that the view is not to be scaled
+ // if it's 40h then we assume that the view is scaleable
+ switch (_resourceData[3]) {
+ case 1:
+ _isScaleable = false;
+ break;
+ case 0x40:
+ case 0:
+ break; // don't do anything, we already have _isScaleable set
+ default:
+ error("unsupported flags byte inside sci1.1 view");
+ break;
+ }
loopData = _resourceData + headerSize;
loopSize = _resourceData[12];
@@ -321,11 +337,15 @@ bool GfxView::isSci2Hires() {
return _isSci2Hires;
}
+bool GfxView::isScaleable() {
+ return _isScaleable;
+}
+
void GfxView::getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const {
const CelInfo *celInfo = getCelInfo(loopNo, celNo);
outRect.left = x + celInfo->displaceX - (celInfo->width >> 1);
outRect.right = outRect.left + celInfo->width;
- outRect.bottom = y + celInfo->displaceY - z + 1 + adjustForSci0Early;
+ outRect.bottom = y + celInfo->displaceY - z + 1 + _adjustForSci0Early;
outRect.top = outRect.bottom - celInfo->height;
}
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 0853f2e5a6..990a7e2f71 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -74,6 +74,7 @@ public:
uint16 getCelCount(int16 loopNo) const;
Palette *getPalette();
+ bool isScaleable();
bool isSci2Hires();
private:
@@ -102,7 +103,11 @@ private:
byte *_EGAmapping;
// this is set for sci0early to adjust for the getCelRect() change
- int16 adjustForSci0Early;
+ int16 _adjustForSci0Early;
+
+ // this is not set for some views in laura bow 2 floppy and signals that the view shall never get scaled
+ // even if scaleX/Y are set (inside kAnimate)
+ bool _isScaleable;
};
} // End of namespace Sci