aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2012-06-15 22:24:35 +0300
committerFilippos Karapetis2012-06-15 22:32:17 +0300
commita0add53c6003a8ed42324d4bacc7f4745ee25543 (patch)
tree7156bda864a4c0fa0ee7845b418fd4cd826a124b /engines
parent8666a0528ff7f01acff97355df1bddf6136869b1 (diff)
downloadscummvm-rg350-a0add53c6003a8ed42324d4bacc7f4745ee25543.tar.gz
scummvm-rg350-a0add53c6003a8ed42324d4bacc7f4745ee25543.tar.bz2
scummvm-rg350-a0add53c6003a8ed42324d4bacc7f4745ee25543.zip
SCI: Change getClassAddress() to only require the caller segment
The caller offset is never actually used inside the function
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/object.cpp4
-rw-r--r--engines/sci/engine/script.cpp4
-rw-r--r--engines/sci/engine/seg_manager.cpp4
-rw-r--r--engines/sci/engine/seg_manager.h2
-rw-r--r--engines/sci/engine/vm.cpp4
5 files changed, 9 insertions, 9 deletions
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp
index 2a0ed38e61..de028392ea 100644
--- a/engines/sci/engine/object.cpp
+++ b/engines/sci/engine/object.cpp
@@ -153,7 +153,7 @@ void Object::initSpecies(SegManager *segMan, reg_t addr) {
if (speciesOffset == 0xffff) // -1
setSpeciesSelector(NULL_REG); // no species
else
- setSpeciesSelector(segMan->getClassAddress(speciesOffset, SCRIPT_GET_LOCK, addr));
+ setSpeciesSelector(segMan->getClassAddress(speciesOffset, SCRIPT_GET_LOCK, addr.segment));
}
void Object::initSuperClass(SegManager *segMan, reg_t addr) {
@@ -162,7 +162,7 @@ void Object::initSuperClass(SegManager *segMan, reg_t addr) {
if (superClassOffset == 0xffff) // -1
setSuperClassSelector(NULL_REG); // no superclass
else
- setSuperClassSelector(segMan->getClassAddress(superClassOffset, SCRIPT_GET_LOCK, addr));
+ setSuperClassSelector(segMan->getClassAddress(superClassOffset, SCRIPT_GET_LOCK, addr.segment));
}
bool Object::initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClass) {
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index d09b5ace80..d018872b43 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -653,7 +653,7 @@ void Script::initializeObjectsSci11(SegManager *segMan, SegmentId segmentId) {
// Copy base from species class, as we need its selector IDs
obj->setSuperClassSelector(
- segMan->getClassAddress(obj->getSuperClassSelector().offset, SCRIPT_GET_LOCK, NULL_REG));
+ segMan->getClassAddress(obj->getSuperClassSelector().offset, SCRIPT_GET_LOCK, 0));
// If object is instance, get -propDict- from class and set it for this
// object. This is needed for ::isMemberOf() to work.
@@ -686,7 +686,7 @@ void Script::initializeObjectsSci3(SegManager *segMan, SegmentId segmentId) {
reg_t reg = make_reg(segmentId, seeker - _buf);
Object *obj = scriptObjInit(reg);
- obj->setSuperClassSelector(segMan->getClassAddress(obj->getSuperClassSelector().offset, SCRIPT_GET_LOCK, NULL_REG));
+ obj->setSuperClassSelector(segMan->getClassAddress(obj->getSuperClassSelector().offset, SCRIPT_GET_LOCK, 0));
seeker += READ_SCI11ENDIAN_UINT16(seeker + 2);
}
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index eaa587e3f9..ac02022ee7 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -939,7 +939,7 @@ void SegManager::createClassTable() {
_resMan->unlockResource(vocab996);
}
-reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, reg_t caller) {
+reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, uint16 callerSegment) {
if (classnr == 0xffff)
return NULL_REG;
@@ -956,7 +956,7 @@ reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, reg_t caller
return NULL_REG;
}
} else
- if (caller.segment != the_class->reg.segment)
+ if (callerSegment != the_class->reg.segment)
getScript(the_class->reg.segment)->incrementLockers();
return the_class->reg;
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 62e711e686..356a1b04a7 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -125,7 +125,7 @@ private:
public:
// TODO: document this
- reg_t getClassAddress(int classnr, ScriptLoadType lock, reg_t caller);
+ reg_t getClassAddress(int classnr, ScriptLoadType lock, uint16 callerSegment);
/**
* Return a pointer to the specified script.
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 162dce9fcc..7dc397c11e 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -996,7 +996,7 @@ void run_vm(EngineState *s) {
case op_class: // 0x28 (40)
// Get class address
s->r_acc = s->_segMan->getClassAddress((unsigned)opparams[0], SCRIPT_GET_LOCK,
- s->xs->addr.pc);
+ s->xs->addr.pc.segment);
break;
case 0x29: // (41)
@@ -1021,7 +1021,7 @@ void run_vm(EngineState *s) {
case op_super: // 0x2b (43)
// Send to any class
- r_temp = s->_segMan->getClassAddress(opparams[0], SCRIPT_GET_LOAD, s->xs->addr.pc);
+ r_temp = s->_segMan->getClassAddress(opparams[0], SCRIPT_GET_LOAD, s->xs->addr.pc.segment);
if (!r_temp.isPointer())
error("[VM]: Invalid superclass in object");