mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
SCI: kCelWide/kCelHigh now adjust on hires views
somewhat fixes gk1 hires inventory issue svn-id: r51245
This commit is contained in:
parent
5a5f8387ad
commit
2047e75d2b
@ -436,15 +436,6 @@ reg_t kCelWide(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
celWidth = g_sci->_gfxCache->kernelViewGetCelWidth(viewId, loopNo, celNo);
|
||||
|
||||
#ifdef ENABLE_SCI32
|
||||
if (getSciVersion() == SCI_VERSION_2_1) {
|
||||
if (g_sci->_gfxScreen->getWidth() > 320)
|
||||
celWidth = celWidth / 2; // 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.
|
||||
#endif
|
||||
return make_reg(0, celWidth);
|
||||
}
|
||||
|
||||
@ -1159,6 +1150,8 @@ reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t kAddPlane(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t planeObj = argv[0];
|
||||
|
||||
warning("AddPlane %s", s->_segMan->getObjectName(argv[0]));
|
||||
|
||||
g_sci->_gfxFrameout->kernelAddPlane(planeObj);
|
||||
return NULL_REG;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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:
|
||||
|
@ -30,6 +30,7 @@ namespace Sci {
|
||||
|
||||
struct CelInfo {
|
||||
int16 width, height;
|
||||
int16 scriptWidth, scriptHeight;
|
||||
int16 displaceX;
|
||||
int16 displaceY;
|
||||
byte clearKey;
|
||||
|
Loading…
Reference in New Issue
Block a user