reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) { reg_t obj = argv[0]; Clone *object = s->_segMan->getObject(obj); if (!object) { error("Attempt to dispose non-class/object at %04x:%04x", PRINT_REG(obj)); return s->r_acc; } // SCI uses this technique to find out, if it's a clone and if it's supposed to get freed // At least kq4early relies on this behavior. The scripts clone "Sound", then set bit 1 manually // and call kDisposeClone later. In that case we may not free it, otherwise we will run into issues // later, because kIsObject would then return false and Sound object wouldn't get checked. uint16 infoSelector = object->getInfoSelector().toUint16(); if ((infoSelector & 3) == kInfoFlagClone) object->markAsFreed(); return s->r_acc; }