mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-04 16:26:53 +00:00
SCI: support for hires views in gk1
svn-id: r50533
This commit is contained in:
parent
bff3e89e48
commit
4e999c8295
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user