diff options
-rw-r--r-- | engines/sci/engine/object.cpp | 23 | ||||
-rw-r--r-- | engines/sci/engine/script.cpp | 4 |
2 files changed, 2 insertions, 25 deletions
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp index a09d530812..079106ff12 100644 --- a/engines/sci/engine/object.cpp +++ b/engines/sci/engine/object.cpp @@ -30,29 +30,8 @@ namespace Sci { -// This helper function is used by Script::relocateLocal and Object::relocate -// Duplicate in segment.cpp and script.cpp -static bool relocateBlock(Common::Array<reg_t> &block, int block_location, SegmentId segment, int location, size_t scriptSize) { - int rel = location - block_location; +extern bool relocateBlock(Common::Array<reg_t> &block, int block_location, SegmentId segment, int location, uint32 heapOffset); - if (rel < 0) - return false; - - uint idx = rel >> 1; - - if (idx >= block.size()) - return false; - - if (rel & 1) { - error("Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location); - return false; - } - block[idx].setSegment(segment); // Perform relocation - if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1_LATE) - block[idx].incOffset(scriptSize); - - return true; -} void Object::init(const SciSpan<const byte> &buf, reg_t obj_pos, bool initVariables) { const SciSpan<const byte> data = buf.subspan(obj_pos.getOffset()); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 7e3a661501..2f04534343 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -661,9 +661,7 @@ Object *Script::scriptObjInit(reg_t obj_pos, bool fullObjectInit) { return obj; } -// This helper function is used by Script::relocateLocal and Object::relocate -// Duplicate in segment.cpp and script.cpp -static bool relocateBlock(Common::Array<reg_t> &block, int block_location, SegmentId segment, int location, size_t scriptSize) { +bool relocateBlock(Common::Array<reg_t> &block, int block_location, SegmentId segment, int location, uint32 heapOffset) { int rel = location - block_location; if (rel < 0) |