aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorMartin Kiewitz2010-06-30 14:26:47 +0000
committerMartin Kiewitz2010-06-30 14:26:47 +0000
commit4e999c8295adeade2317d9c486b943d3fd290c2c (patch)
tree1d0aa507dbdf8cad7d731ec92e9572fbc6e1009c /engines/sci/graphics
parentbff3e89e48a6f819d5b23ba4cc848cbcf35aa965 (diff)
downloadscummvm-rg350-4e999c8295adeade2317d9c486b943d3fd290c2c.tar.gz
scummvm-rg350-4e999c8295adeade2317d9c486b943d3fd290c2c.tar.bz2
scummvm-rg350-4e999c8295adeade2317d9c486b943d3fd290c2c.zip
SCI: support for hires views in gk1
svn-id: r50533
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/frameout.cpp35
-rw-r--r--engines/sci/graphics/view.cpp9
-rw-r--r--engines/sci/graphics/view.h5
3 files changed, 45 insertions, 4 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 446db82566..48a7742f14 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -128,6 +128,8 @@ void GfxFrameout::kernelFrameout() {
// Allocate enough space for all screen items
FrameoutEntry *itemData = (FrameoutEntry *)malloc(_screenItems.size() * sizeof(FrameoutEntry));
+ const SciGameId gameId = g_sci->getGameId();
+
for (Common::List<reg_t>::iterator it = _planes.begin(); it != _planes.end(); it++) {
reg_t planeObject = *it;
uint16 planePriority = readSelectorValue(_segMan, planeObject, SELECTOR(priority));
@@ -189,6 +191,14 @@ void GfxFrameout::kernelFrameout() {
itemEntry->y = readSelectorValue(_segMan, itemObject, SELECTOR(y));
itemEntry->z = readSelectorValue(_segMan, itemObject, SELECTOR(z));
itemEntry->priority = readSelectorValue(_segMan, itemObject, SELECTOR(priority));
+ if (gameId == GID_GK1) {
+ if ((itemEntry->viewId == 11000) && (itemEntry->loopNo == 0) && (itemEntry->celNo == 0) && (itemEntry->priority == 1)) {
+ itemEntry->priority = 0; // HACK for gk1 hires main menu
+ }
+ if ((itemEntry->viewId == 10100) && (itemEntry->priority == 0)) {
+ itemEntry->priority = 1; // HACK for gk1 hires main menu
+ }
+ }
itemEntry->signal = readSelectorValue(_segMan, itemObject, SELECTOR(signal));
itemEntry->scaleX = readSelectorValue(_segMan, itemObject, SELECTOR(scaleX));
itemEntry->scaleY = readSelectorValue(_segMan, itemObject, SELECTOR(scaleY));
@@ -228,23 +238,40 @@ void GfxFrameout::kernelFrameout() {
if (itemEntry->viewId != 0xFFFF) {
GfxView *view = _cache->getView(itemEntry->viewId);
+ if (view->isSci2Hires())
+ _screen->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x);
+
if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
view->getCelRect(itemEntry->loopNo, itemEntry->celNo, itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->celRect);
else
view->getCelScaledRect(itemEntry->loopNo, itemEntry->celNo, itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->scaleX, itemEntry->scaleY, itemEntry->celRect);
- if (itemEntry->celRect.top < 0 || itemEntry->celRect.top >= _screen->getHeight())
+ int16 screenHeight = _screen->getHeight();
+ int16 screenWidth = _screen->getWidth();
+ if (view->isSci2Hires()) {
+ screenHeight = _screen->getDisplayHeight();
+ screenWidth = _screen->getDisplayWidth();
+ }
+
+ if (itemEntry->celRect.top < 0 || itemEntry->celRect.top >= screenHeight)
continue;
- if (itemEntry->celRect.left < 0 || itemEntry->celRect.left >= _screen->getWidth())
+ if (itemEntry->celRect.left < 0 || itemEntry->celRect.left >= screenWidth)
continue;
Common::Rect clipRect;
clipRect = itemEntry->celRect;
- clipRect.clip(planeRect);
+ if (view->isSci2Hires()) {
+ Common::Rect upscaledPlaneRect = planeRect;
+ _screen->adjustToUpscaledCoordinates(upscaledPlaneRect.top, upscaledPlaneRect.left);
+ _screen->adjustToUpscaledCoordinates(upscaledPlaneRect.bottom, upscaledPlaneRect.right);
+ clipRect.clip(upscaledPlaneRect);
+ } else {
+ clipRect.clip(planeRect);
+ }
if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
- view->draw(itemEntry->celRect, clipRect, clipRect, itemEntry->loopNo, itemEntry->celNo, 255, 0, false);
+ view->draw(itemEntry->celRect, clipRect, clipRect, itemEntry->loopNo, itemEntry->celNo, 255, 0, view->isSci2Hires());
else
view->drawScaled(itemEntry->celRect, clipRect, clipRect, itemEntry->loopNo, itemEntry->celNo, 255, itemEntry->scaleX, itemEntry->scaleY);
} else {
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 244114e866..816dad0cbb 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -81,6 +81,7 @@ void GfxView::initData(GuiResourceId resourceId) {
_loopCount = 0;
_embeddedPal = false;
_EGAmapping = NULL;
+ _isSci2Hires = false;
// 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
@@ -191,6 +192,7 @@ void GfxView::initData(GuiResourceId resourceId) {
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.
@@ -240,6 +242,9 @@ void GfxView::initData(GuiResourceId resourceId) {
cel->offsetEGA = 0;
cel->offsetRLE = READ_SCI11ENDIAN_UINT32(celData + 24);
cel->offsetLiteral = READ_SCI11ENDIAN_UINT32(celData + 28);
+ // GK1-hires content is actually uncompressed, we need to swap both so that we process it as such
+ if ((cel->offsetRLE) && (!cel->offsetLiteral))
+ SWAP(cel->offsetRLE, cel->offsetLiteral);
cel->rawBitmap = 0;
if (_loop[loopNo].mirrorFlag)
@@ -288,6 +293,10 @@ Palette *GfxView::getPalette() {
return _embeddedPal ? &_viewPalette : NULL;
}
+bool GfxView::isSci2Hires() {
+ return _isSci2Hires;
+}
+
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);
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 93239e7586..6eb1830b99 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -73,6 +73,8 @@ public:
uint16 getCelCount(int16 loopNo) const;
Palette *getPalette();
+ bool isSci2Hires();
+
private:
void initData(GuiResourceId resourceId);
void unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCount);
@@ -92,6 +94,9 @@ private:
bool _embeddedPal;
Palette _viewPalette;
+ // set for SCI2 views in gk1/windows, means that views are hires and should be handled accordingly
+ bool _isSci2Hires;
+
byte *_EGAmapping;
};