[Scummvm-cvs-logs] SF.net SVN: scummvm:[50359] scummvm/trunk/engines/sci/engine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Jun 27 02:08:01 CEST 2010
Revision: 50359
http://scummvm.svn.sourceforge.net/scummvm/?rev=50359&view=rev
Author: thebluegr
Date: 2010-06-27 00:08:00 +0000 (Sun, 27 Jun 2010)
Log Message:
-----------
Cleanup
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/script.cpp
scummvm/trunk/engines/sci/engine/segment.cpp
Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp 2010-06-26 23:48:27 UTC (rev 50358)
+++ scummvm/trunk/engines/sci/engine/script.cpp 2010-06-27 00:08:00 UTC (rev 50359)
@@ -178,9 +178,10 @@
void SegManager::scriptInitialiseObjectsSci0(SegmentId seg) {
Script *scr = getScript(seg);
+ bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
+ const byte *seeker = 0;
int objType;
reg_t addr;
- bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
// The script is initialized in 2 passes.
// Pass 1: creates a lookup table of all used classes
@@ -188,23 +189,22 @@
for (uint16 pass = 0; pass <= 1; pass++) {
uint16 objLength = 0;
- uint16 curOffset = oldScriptHeader ? 2 : 0;
+ seeker = scr->_buf + (oldScriptHeader ? 2 : 0);
do {
- objType = READ_SCI11ENDIAN_UINT16(scr->_buf + curOffset);
+ objType = READ_SCI11ENDIAN_UINT16(seeker);
if (!objType)
break;
- objLength = READ_SCI11ENDIAN_UINT16(scr->_buf + curOffset + 2);
- curOffset += 4; // skip header
- addr = make_reg(seg, curOffset);;
+ objLength = READ_SCI11ENDIAN_UINT16(seeker + 2);
+ seeker += 4; // skip header
+ addr = make_reg(seg, seeker - scr->_buf);
switch (objType) {
case SCI_OBJ_OBJECT:
case SCI_OBJ_CLASS:
if (pass == 0 && objType == SCI_OBJ_CLASS) {
- int classpos = curOffset + 8; // SCRIPT_OBJECT_MAGIC_OFFSET
- int species = READ_SCI11ENDIAN_UINT16(scr->_buf + classpos);
+ int species = READ_SCI11ENDIAN_UINT16(seeker + 8); // SCRIPT_OBJECT_MAGIC_OFFSET
if (species == (int)classTableSize()) {
// Happens in the LSL2 demo
@@ -218,7 +218,7 @@
return;
}
- setClassOffset(species, make_reg(seg, classpos));
+ setClassOffset(species, make_reg(seg, seeker - scr->_buf + 8));
} else if (pass == 1) {
Object *obj = scr->scriptObjInit(addr);
obj->initSpecies(this, addr);
@@ -234,14 +234,14 @@
break;
}
- curOffset += objLength - 4;
- } while (objType != 0 && curOffset < scr->getScriptSize() - 2);
+ seeker += objLength - 4;
+ } while (objType != 0 && (uint32)(seeker - scr->_buf) < scr->getScriptSize() - 2);
} // for
}
void SegManager::scriptInitialiseObjectsSci11(SegmentId seg) {
Script *scr = getScript(seg);
- const byte *seeker = scr->_heapStart;;
+ const byte *seeker = scr->_heapStart;
uint16 entrySize = READ_SCI11ENDIAN_UINT16(seeker + 2) * 2;
seeker += entrySize; // skip first entry
seeker += 4; // skip header
Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp 2010-06-26 23:48:27 UTC (rev 50358)
+++ scummvm/trunk/engines/sci/engine/segment.cpp 2010-06-27 00:08:00 UTC (rev 50359)
@@ -588,12 +588,10 @@
void CloneTable::freeAtAddress(SegManager *segMan, reg_t addr) {
#ifdef GC_DEBUG
- Object *victim_obj;
+ // assert(addr.segment == _segId);
-// assert(addr.segment == _segId);
+ Object *victim_obj = &(_table[addr.offset]);
- victim_obj = &(_table[addr.offset]);
-
if (!(victim_obj->_flags & OBJECT_FLAG_FREED))
warning("[GC] Clone %04x:%04x not reachable and not freed (freeing now)", PRINT_REG(addr));
#ifdef GC_DEBUG_VERBOSE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list