Ticket #6452: SCI-relative-nsRect.patch

File SCI-relative-nsRect.patch, 1.2 KB (added by SF/tkorvola, 11 years ago)
  • engines/sci/engine/kgraphics32.cpp

    diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
    index cd735d1..49678ae 100644
    a b reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {  
    142142        uint16 y = argv[1].toUint16();
    143143        reg_t targetObject = argv[2];
    144144        uint16 illegalBits = argv[3].getOffset();
    145         Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
     145        Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, false);
     146
     147        // Use these ancient fixes (from commits
     148        // ab558b45d252743797bca27d2240bf0e2057863f and
     149        // f403d0f806d56dbe2017374792e0697e6d46bc1f) instead of what is
     150        // built in getNSRect.  Hopefully that will make GK1 work again.
     151        uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
     152        uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
     153        // If top and left are negative, we need to adjust coordinates by the item's x and y
     154        if (nsRect.left < 0)
     155                nsRect.translate(itemX, 0);
     156        if (nsRect.top < 0)
     157                nsRect.translate(0, itemY);
     158        // End of resurrected GK1 fixes.
     159
    146160
    147161        // we assume that x, y are local coordinates
    148162