diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 741501744c6..9d2d94c4a91 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -106,6 +106,7 @@ void GfxFrameout::kernelFrameout() { int16 planePictureCel; int16 planePriority; int16 planeTop, planeLeft; + int16 planeResY, planeResX; reg_t itemObject; reg_t itemPlane; @@ -132,6 +133,8 @@ void GfxFrameout::kernelFrameout() { planeTop = GET_SEL32V(_segMan, planeObject, top); planeLeft = GET_SEL32V(_segMan, planeObject, left); + planeResY = GET_SEL32V(_segMan, planeObject, resY); + planeResX = GET_SEL32V(_segMan, planeObject, resX); // Fill our itemlist for this plane itemCount = 0; @@ -148,12 +151,18 @@ void GfxFrameout::kernelFrameout() { itemEntry->y = GET_SEL32V(_segMan, itemObject, y); itemEntry->z = GET_SEL32V(_segMan, itemObject, z); itemEntry->priority = GET_SEL32V(_segMan, itemObject, priority); + itemEntry->signal = GET_SEL32V(_segMan, itemObject, signal); itemEntry->scaleX = GET_SEL32V(_segMan, itemObject, scaleX); itemEntry->scaleY = GET_SEL32V(_segMan, itemObject, scaleY); itemEntry->object = itemObject; - itemEntry->x += planeLeft; itemEntry->y += planeTop; + itemEntry->x += planeLeft; + itemEntry->y = ((itemEntry->y * _screen->getHeight()) / planeResY); + itemEntry->x = ((itemEntry->x * _screen->getWidth()) / planeResX); + + if (itemEntry->priority == 0) + itemEntry->priority = itemEntry->y; itemList.push_back(itemEntry); itemEntry++; @@ -181,9 +190,9 @@ void GfxFrameout::kernelFrameout() { if (itemEntry->viewId != 0xFFFF) { View *view = _cache->getView(itemEntry->viewId); - if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128)) + if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128)) { view->getCelRect(itemEntry->loopNo, itemEntry->celNo, itemEntry->x, itemEntry->y, itemEntry->z, &itemEntry->celRect); - else + } 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()) { diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index bd5c13b2da7..ce2e9bcf19a 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -35,6 +35,7 @@ struct FrameoutEntry { int16 celNo; int16 x, y, z; int16 priority; + uint16 signal; uint16 scaleSignal; int16 scaleX; int16 scaleY; diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index 61add8a8cd9..f06f783853f 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -64,13 +64,21 @@ void SciGui32::init() { } void SciGui32::globalToLocal(int16 *x, int16 *y, reg_t planeObj) { - *x = *x - GET_SEL32V(_s->_segMan, planeObj, left); - *y = *y - GET_SEL32V(_s->_segMan, planeObj, top); + //int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY); + //int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX); + //*x = ( *x * _screen->getWidth()) / resX; + //*y = ( *y * _screen->getHeight()) / resY; + *x -= GET_SEL32V(_s->_segMan, planeObj, left); + *y -= GET_SEL32V(_s->_segMan, planeObj, top); } void SciGui32::localToGlobal(int16 *x, int16 *y, reg_t planeObj) { - *x = *x + GET_SEL32V(_s->_segMan, planeObj, left); - *y = *y + GET_SEL32V(_s->_segMan, planeObj, top); + //int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY); + //int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX); + *x += GET_SEL32V(_s->_segMan, planeObj, left); + *y += GET_SEL32V(_s->_segMan, planeObj, top); + //*x = ( *x * resX) / _screen->getWidth(); + //*y = ( *y * resY) / _screen->getHeight(); } void SciGui32::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {