aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-05-20 20:25:28 -0500
committerColin Snover2017-05-20 21:14:18 -0500
commit71630a7cb242d208518bb9ff19e414211edae74c (patch)
tree2ea8f15425f0cfd4e74a66b4f7f8503910bbbcbd
parentbc9835ba5ee32679a715f4f5f734786b7120191f (diff)
downloadscummvm-rg350-71630a7cb242d208518bb9ff19e414211edae74c.tar.gz
scummvm-rg350-71630a7cb242d208518bb9ff19e414211edae74c.tar.bz2
scummvm-rg350-71630a7cb242d208518bb9ff19e414211edae74c.zip
SCI: Remove duplicate relocateBlock function
-rw-r--r--engines/sci/engine/object.cpp23
-rw-r--r--engines/sci/engine/script.cpp4
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)