aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/script.cpp')
-rw-r--r--engines/sci/engine/script.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index fb96518f19..a38aa06bc4 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
#include "sci/sci.h"
@@ -383,6 +380,7 @@ void Script::relocateSci3(reg_t block) {
}
void Script::incrementLockers() {
+ assert(!_markedAsDeleted);
_lockers++;
}
@@ -396,6 +394,7 @@ int Script::getLockers() const {
}
void Script::setLockers(int lockers) {
+ assert(lockers == 0 || !_markedAsDeleted);
_lockers = lockers;
}
@@ -493,7 +492,7 @@ SegmentRef Script::dereference(reg_t pointer) {
return ret;
}
-void Script::initialiseLocals(SegManager *segMan) {
+void Script::initializeLocals(SegManager *segMan) {
LocalVariables *locals = segMan->allocLocalsSegment(this);
if (locals) {
if (getSciVersion() > SCI_VERSION_0_EARLY) {
@@ -509,7 +508,7 @@ void Script::initialiseLocals(SegManager *segMan) {
}
}
-void Script::initialiseClasses(SegManager *segMan) {
+void Script::initializeClasses(SegManager *segMan) {
const byte *seeker = 0;
uint16 mult = 0;
@@ -581,7 +580,7 @@ void Script::initialiseClasses(SegManager *segMan) {
}
}
-void Script::initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjectsSci0(SegManager *segMan, SegmentId segmentId) {
bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
// We need to make two passes, as the objects in the script might be in the
@@ -611,7 +610,7 @@ void Script::initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId) {
// #3150767.
// Same happens with script 764, it seems to
// contain junk towards its end.
- _objects.erase(addr.toUint16() + (getSciVersion() < SCI_VERSION_1_1) ? 8 : 0);
+ _objects.erase(addr.toUint16() - SCRIPT_OBJECT_MAGIC_OFFSET);
} else {
error("Failed to locate base object for object at %04X:%04X", PRINT_REG(addr));
}
@@ -633,7 +632,7 @@ void Script::initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId) {
relocateSci0Sci21(make_reg(segmentId, relocationBlock - getBuf() + 4));
}
-void Script::initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjectsSci11(SegManager *segMan, SegmentId segmentId) {
const byte *seeker = _heapStart + 4 + READ_SCI11ENDIAN_UINT16(_heapStart + 2) * 2;
while (READ_SCI11ENDIAN_UINT16(seeker) == SCRIPT_OBJECT_MAGIC_NUMBER) {
@@ -668,7 +667,7 @@ void Script::initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId) {
relocateSci0Sci21(make_reg(segmentId, READ_SCI11ENDIAN_UINT16(_heapStart)));
}
-void Script::initialiseObjectsSci3(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjectsSci3(SegManager *segMan, SegmentId segmentId) {
const byte *seeker = getSci3ObjectsPointer();
while (READ_SCI11ENDIAN_UINT16(seeker) == SCRIPT_OBJECT_MAGIC_NUMBER) {
@@ -682,13 +681,13 @@ void Script::initialiseObjectsSci3(SegManager *segMan, SegmentId segmentId) {
relocateSci3(make_reg(segmentId, 0));
}
-void Script::initialiseObjects(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjects(SegManager *segMan, SegmentId segmentId) {
if (getSciVersion() <= SCI_VERSION_1_LATE)
- initialiseObjectsSci0(segMan, segmentId);
+ initializeObjectsSci0(segMan, segmentId);
else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1)
- initialiseObjectsSci11(segMan, segmentId);
+ initializeObjectsSci11(segMan, segmentId);
else if (getSciVersion() == SCI_VERSION_3)
- initialiseObjectsSci3(segMan, segmentId);
+ initializeObjectsSci3(segMan, segmentId);
}
reg_t Script::findCanonicAddress(SegManager *segMan, reg_t addr) const {