[Scummvm-cvs-logs] SF.net SVN: scummvm:[50533] scummvm/trunk/engines/sci/graphics
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Wed Jun 30 16:26:48 CEST 2010
Revision: 50533
http://scummvm.svn.sourceforge.net/scummvm/?rev=50533&view=rev
Author: m_kiewitz
Date: 2010-06-30 14:26:47 +0000 (Wed, 30 Jun 2010)
Log Message:
-----------
SCI: support for hires views in gk1
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/frameout.cpp
scummvm/trunk/engines/sci/graphics/view.cpp
scummvm/trunk/engines/sci/graphics/view.h
Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp 2010-06-30 13:49:05 UTC (rev 50532)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp 2010-06-30 14:26:47 UTC (rev 50533)
@@ -128,6 +128,8 @@
// 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 @@
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 @@
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 {
Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp 2010-06-30 13:49:05 UTC (rev 50532)
+++ scummvm/trunk/engines/sci/graphics/view.cpp 2010-06-30 14:26:47 UTC (rev 50533)
@@ -81,6 +81,7 @@
_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 @@
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 @@
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 @@
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);
Modified: scummvm/trunk/engines/sci/graphics/view.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.h 2010-06-30 13:49:05 UTC (rev 50532)
+++ scummvm/trunk/engines/sci/graphics/view.h 2010-06-30 14:26:47 UTC (rev 50533)
@@ -73,6 +73,8 @@
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 @@
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;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list