[Scummvm-cvs-logs] SF.net SVN: scummvm:[50358] scummvm/trunk/engines/sci/engine

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Jun 27 01:48:27 CEST 2010


Revision: 50358
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50358&view=rev
Author:   thebluegr
Date:     2010-06-26 23:48:27 +0000 (Sat, 26 Jun 2010)

Log Message:
-----------
Removed the misleading getHeap() function (only valid for SCI0-SCI1), plus removed some unused defines

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/script.cpp
    scummvm/trunk/engines/sci/engine/segment.cpp
    scummvm/trunk/engines/sci/engine/segment.h
    scummvm/trunk/engines/sci/engine/vm.h

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-06-26 23:13:05 UTC (rev 50357)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-06-26 23:48:27 UTC (rev 50358)
@@ -191,11 +191,11 @@
 		uint16 curOffset = oldScriptHeader ? 2 : 0;
 
 		do {
-			objType = scr->getHeap(curOffset);
+			objType = READ_SCI11ENDIAN_UINT16(scr->_buf + curOffset);
 			if (!objType)
 				break;
 
-			objLength = scr->getHeap(curOffset + 2);
+			objLength = READ_SCI11ENDIAN_UINT16(scr->_buf + curOffset + 2);
 			curOffset += 4;		// skip header
 			addr = make_reg(seg, curOffset);;
 
@@ -204,7 +204,7 @@
 			case SCI_OBJ_CLASS:
 				if (pass == 0 && objType == SCI_OBJ_CLASS) {
 					int classpos = curOffset + 8;	// SCRIPT_OBJECT_MAGIC_OFFSET
-					int species = scr->getHeap(classpos);
+					int species = READ_SCI11ENDIAN_UINT16(scr->_buf + classpos);
 
 					if (species == (int)classTableSize()) {
 						// Happens in the LSL2 demo
@@ -335,20 +335,17 @@
 	do {
 		reg.offset += objLength; // Step over the last checked object
 
-		objType = scr->getHeap(reg.offset);
+		objType = READ_SCI11ENDIAN_UINT16(scr->_buf + reg.offset);
 		if (!objType)
 			break;
-		objLength = scr->getHeap(reg.offset + 2);  // use SEG_UGET_HEAP ??
+		objLength = READ_SCI11ENDIAN_UINT16(scr->_buf + reg.offset + 2);
 
 		reg.offset += 4; // Step over header
 
 		if ((objType == SCI_OBJ_OBJECT) || (objType == SCI_OBJ_CLASS)) { // object or class?
-			int superclass;
+			reg.offset += 8;	// magic offset (SCRIPT_OBJECT_MAGIC_OFFSET)
+			int superclass = READ_SCI11ENDIAN_UINT16(scr->_buf + reg.offset + 2);
 
-			reg.offset -= SCRIPT_OBJECT_MAGIC_OFFSET;
-
-			superclass = scr->getHeap(reg.offset + SCRIPT_SUPERCLASS_OFFSET); // Get superclass...
-
 			if (superclass >= 0) {
 				int superclass_script = segMan->getClass(superclass).script;
 

Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp	2010-06-26 23:13:05 UTC (rev 50357)
+++ scummvm/trunk/engines/sci/engine/segment.cpp	2010-06-26 23:48:27 UTC (rev 50358)
@@ -417,12 +417,6 @@
 	}
 }
 
-int16 Script::getHeap(uint16 offset) const {
-	assert(offset + 1 < (int)_bufSize);
-	return READ_SCI11ENDIAN_UINT16(_buf + offset);
-//	return (_buf[offset] | (_buf[offset+1]) << 8);
-}
-
 SegmentRef SegmentObj::dereference(reg_t pointer) {
 	error("Error: Trying to dereference pointer %04x:%04x to inappropriate segment",
 		          PRINT_REG(pointer));

Modified: scummvm/trunk/engines/sci/engine/segment.h
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.h	2010-06-26 23:13:05 UTC (rev 50357)
+++ scummvm/trunk/engines/sci/engine/segment.h	2010-06-26 23:48:27 UTC (rev 50358)
@@ -501,15 +501,7 @@
 	 */
 	void mcpyInOut(int dst, const void *src, size_t n);
 
-
 	/**
-	 * Retrieves a 16 bit value from within a script's heap representation.
-	 * @param offset	offset to read from
-	 * @return the value read from the specified location
-	 */
-	int16 getHeap(uint16 offset) const;
-
-	/**
 	 * Finds the pointer where a block of a specific type starts from
 	 */
 	byte *findBlock(int type);

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2010-06-26 23:13:05 UTC (rev 50357)
+++ scummvm/trunk/engines/sci/engine/vm.h	2010-06-26 23:48:27 UTC (rev 50358)
@@ -49,11 +49,6 @@
 /** Offset of this identifier */
 #define SCRIPT_OBJECT_MAGIC_OFFSET (getSciVersion() < SCI_VERSION_1_1 ? -8 : 0)
 
-/** Script-relative offset of the species ID */
-#define SCRIPT_SPECIES_OFFSET 8 -8
-
-#define SCRIPT_SUPERCLASS_OFFSET (getSciVersion() < SCI_VERSION_1_1 ? 10 -8 : 12)
-
 /** Stack pointer value: Use predecessor's value */
 #define CALL_SP_CARRY NULL
 


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