diff options
author | Martin Kiewitz | 2010-07-24 15:15:38 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-07-24 15:15:38 +0000 |
commit | 2047e75d2b3ac553acd54e31fd9725d6821668ae (patch) | |
tree | 1fb9687d78408b6dd7af7c5cbfe8fc824b2d7f01 /engines/sci/graphics | |
parent | 5a5f8387addfc15d5b1f755b89e45ab046653742 (diff) | |
download | scummvm-rg350-2047e75d2b3ac553acd54e31fd9725d6821668ae.tar.gz scummvm-rg350-2047e75d2b3ac553acd54e31fd9725d6821668ae.tar.bz2 scummvm-rg350-2047e75d2b3ac553acd54e31fd9725d6821668ae.zip |
SCI: kCelWide/kCelHigh now adjust on hires views
somewhat fixes gk1 hires inventory issue
svn-id: r51245
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/cache.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/view.cpp | 38 | ||||
-rw-r--r-- | engines/sci/graphics/view.h | 1 |
3 files changed, 37 insertions, 6 deletions
diff --git a/engines/sci/graphics/cache.cpp b/engines/sci/graphics/cache.cpp index 8caa28b3a1..25475c727f 100644 --- a/engines/sci/graphics/cache.cpp +++ b/engines/sci/graphics/cache.cpp @@ -90,11 +90,11 @@ GfxView *GfxCache::getView(GuiResourceId viewId) { } int16 GfxCache::kernelViewGetCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo) { - return getView(viewId)->getCelInfo(loopNo, celNo)->width; + return getView(viewId)->getCelInfo(loopNo, celNo)->scriptWidth; } int16 GfxCache::kernelViewGetCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo) { - return getView(viewId)->getCelInfo(loopNo, celNo)->height; + return getView(viewId)->getCelInfo(loopNo, celNo)->scriptHeight; } int16 GfxCache::kernelViewGetLoopCount(GuiResourceId viewId) { diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 93df45820c..80778504ec 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -160,8 +160,8 @@ void GfxView::initData(GuiResourceId resourceId) { // For EGA // Width:WORD Height:WORD DisplaceX:BYTE DisplaceY:BYTE ClearKey:BYTE EGAData starts now directly cel = &_loop[loopNo].cel[celNo]; - cel->width = READ_LE_UINT16(celData); - cel->height = READ_LE_UINT16(celData + 2); + cel->scriptWidth = cel->width = READ_LE_UINT16(celData); + cel->scriptHeight = cel->height = READ_LE_UINT16(celData + 2); cel->displaceX = (signed char)celData[4]; cel->displaceY = celData[5]; cel->clearKey = celData[6]; @@ -231,8 +231,8 @@ void GfxView::initData(GuiResourceId resourceId) { _loop[loopNo].cel = new CelInfo[celCount]; for (celNo = 0; celNo < celCount; celNo++) { cel = &_loop[loopNo].cel[celNo]; - cel->width = READ_SCI11ENDIAN_UINT16(celData); - cel->height = READ_SCI11ENDIAN_UINT16(celData + 2); + cel->scriptWidth = cel->width = READ_SCI11ENDIAN_UINT16(celData); + cel->scriptHeight = cel->height = READ_SCI11ENDIAN_UINT16(celData + 2); cel->displaceX = READ_SCI11ENDIAN_UINT16(celData + 4); cel->displaceY = READ_SCI11ENDIAN_UINT16(celData + 6); @@ -253,6 +253,36 @@ void GfxView::initData(GuiResourceId resourceId) { celData += celSize; } } +#ifdef ENABLE_SCI32 + // adjust width/height returned to scripts + switch (getSciVersion()) { + case SCI_VERSION_2: + if (_isSci2Hires) { + for (loopNo = 0; loopNo < _loopCount; loopNo++) { + for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) { + _screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight); + } + } + } + break; + + case SCI_VERSION_2_1: + // half the width returned here, fixes lsl6 action icon placements + // the scripts work low-res and add the returned value from here to the coordinate + // TODO: check, if this is actually right. I'm slightly confused by this, but even GK1CD has some idivs in this + // code, so it seems plausible. + if (_screen->getDisplayWidth() > 320) { + for (loopNo = 0; loopNo < _loopCount; loopNo++) { + for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) { + _loop[loopNo].cel[celNo].scriptWidth /= 2; + _loop[loopNo].cel[celNo].scriptHeight /= 2; + } + } + } + default: + break; + } +#endif break; default: diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h index 6eb1830b99..bcfae8a112 100644 --- a/engines/sci/graphics/view.h +++ b/engines/sci/graphics/view.h @@ -30,6 +30,7 @@ namespace Sci { struct CelInfo { int16 width, height; + int16 scriptWidth, scriptHeight; int16 displaceX; int16 displaceY; byte clearKey; |