SCI: Fix NS rect calculation in GK1 (and SCI32 in general)
This fixes the regressions caused by refactoring in SCI32. Thanks to Timo Korvola for tracking down the issue and providing an initial patch in bug #6452
This commit is contained in:
parent
9addca7287
commit
ed400d57fc
3 changed files with 11 additions and 11 deletions
|
@ -142,7 +142,15 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
|
|||
uint16 y = argv[1].toUint16();
|
||||
reg_t targetObject = argv[2];
|
||||
uint16 illegalBits = argv[3].getOffset();
|
||||
Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
|
||||
Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject);
|
||||
|
||||
uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
|
||||
uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
|
||||
// If top and left are negative, we need to adjust coordinates by the item's x and y
|
||||
if (nsRect.left < 0)
|
||||
nsRect.translate(itemX, 0);
|
||||
if (nsRect.top < 0)
|
||||
nsRect.translate(0, itemY);
|
||||
|
||||
// we assume that x, y are local coordinates
|
||||
|
||||
|
|
|
@ -241,21 +241,13 @@ void GfxCompare::kernelBaseSetter(reg_t object) {
|
|||
}
|
||||
}
|
||||
|
||||
Common::Rect GfxCompare::getNSRect(reg_t object, bool fixRect) {
|
||||
Common::Rect GfxCompare::getNSRect(reg_t object) {
|
||||
Common::Rect nsRect;
|
||||
nsRect.top = readSelectorValue(_segMan, object, SELECTOR(nsTop));
|
||||
nsRect.left = readSelectorValue(_segMan, object, SELECTOR(nsLeft));
|
||||
nsRect.bottom = readSelectorValue(_segMan, object, SELECTOR(nsBottom));
|
||||
nsRect.right = readSelectorValue(_segMan, object, SELECTOR(nsRight));
|
||||
|
||||
if (fixRect) {
|
||||
// nsRect top/left may be negative, adjust accordingly
|
||||
if (nsRect.top < 0)
|
||||
nsRect.top = 0;
|
||||
if (nsRect.left < 0)
|
||||
nsRect.left = 0;
|
||||
}
|
||||
|
||||
return nsRect;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
reg_t kernelCanBeHere(reg_t curObject, reg_t listReference);
|
||||
bool kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
|
||||
void kernelBaseSetter(reg_t object);
|
||||
Common::Rect getNSRect(reg_t object, bool fixRect = false);
|
||||
Common::Rect getNSRect(reg_t object);
|
||||
void setNSRect(reg_t object, Common::Rect nsRect);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue