[Scummvm-cvs-logs] SF.net SVN: scummvm: [22067] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Thu Apr 20 23:38:03 CEST 2006


Revision: 22067
Author:   kirben
Date:     2006-04-20 23:37:28 -0700 (Thu, 20 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22067&view=rev

Log Message:
-----------
Split bitArrays into three separate arrays, like original. Also fixing load/save issue with bitArrayThree been off by one

Modified Paths:
--------------
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/saveload.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-21 04:36:26 UTC (rev 22066)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-21 06:37:28 UTC (rev 22067)
@@ -1365,22 +1365,26 @@
 
 void SimonEngine::o_b2Set() {
 	// 166: set bit2
-	setBitFlag(256 + getVarOrByte(), true);
+	uint bit = getVarOrByte();
+	_bitArrayTwo[bit / 16] |= (1 << (bit & 15));
 }
 
 void SimonEngine::o_b2Clear() {
 	// 167: clear bit2
-	setBitFlag(256 + getVarOrByte(), false);
+	uint bit = getVarOrByte();
+	_bitArrayTwo[bit / 16] &= ~(1 << (bit & 15));
 }
 
 void SimonEngine::o_b2Zero() {
 	// 168: is bit2 clear
-	setScriptCondition(!getBitFlag(256 + getVarOrByte()));
+	uint bit = getVarOrByte();
+	setScriptCondition((_bitArrayTwo[bit / 16] & (1 << (bit & 15))) == 0);
 }
 
 void SimonEngine::o_b2NotZero() {
 	// 169: is bit2 set
-	setScriptCondition(getBitFlag(256 + getVarOrByte()));
+	uint bit = getVarOrByte();
+	setScriptCondition((_bitArrayTwo[bit / 16] & (1 << (bit & 15))) != 0);
 }
 
 void SimonEngine::o_lockZones() {
@@ -2090,22 +2094,26 @@
 
 void SimonEngine::o3_b3Set() {
 	// 196: set bit3
-	setBitFlag(512 + getVarOrByte(), true);
+	uint bit = getVarOrByte();
+	_bitArrayThree[bit / 16] |= (1 << (bit & 15));
 }
 
 void SimonEngine::o3_b3Clear() {
 	// 197: clear bit3
-	setBitFlag(512 + getVarOrByte(), false);
+	uint bit = getVarOrByte();
+	_bitArrayThree[bit / 16] &= ~(1 << (bit & 15));
 }
 
 void SimonEngine::o3_b3Zero() {
 	// 198: is bit3 clear
-	setScriptCondition(!getBitFlag(512 + getVarOrByte()));
+	uint bit = getVarOrByte();
+	setScriptCondition((_bitArrayThree[bit / 16] & (1 << (bit & 15))) == 0);
 }
 
 void SimonEngine::o3_b3NotZero() {
 	// 199: is bit3 set
-	setScriptCondition(getBitFlag(512 + getVarOrByte()));
+	uint bit = getVarOrByte();
+	setScriptCondition((_bitArrayThree[bit / 16] & (1 << (bit & 15))) != 0);
 }
 
 // -----------------------------------------------------------------------

Modified: scummvm/trunk/engines/simon/saveload.cpp
===================================================================
--- scummvm/trunk/engines/simon/saveload.cpp	2006-04-21 04:36:26 UTC (rev 22066)
+++ scummvm/trunk/engines/simon/saveload.cpp	2006-04-21 06:37:28 UTC (rev 22067)
@@ -558,14 +558,18 @@
 		f->writeUint16BE(itemPtrToID(_itemStore[i]));
 	}
 
-	// Write the bits in array 1 & 2
-	for (i = 0; i != 32; i++)
+	// Write the bits in array 1
+	for (i = 0; i != 16; i++)
 		f->writeUint16BE(_bitArray[i]);
 
+	// Write the bits in array 2
+	for (i = 0; i != 16; i++)
+		f->writeUint16BE(_bitArrayTwo[i]);
+
 	// Write the bits in array 3
 	if (getGameType() == GType_FF) {
-		for (i = 33; i != 48; i++)
-			f->writeUint16BE(_bitArray[i]);
+		for (i = 0; i != 16; i++)
+			f->writeUint16BE(_bitArrayThree[i]);
 	}
 
 	f->flush();
@@ -688,14 +692,18 @@
 		_itemStore[i] = derefItem(f->readUint16BE());
 	}
 
-	// Read the bits in array 1 & 2
-	for (i = 0; i != 32; i++)
+	// Read the bits in array 1
+	for (i = 0; i != 16; i++)
 		_bitArray[i] = f->readUint16BE();
 
+	// Read the bits in array 2
+	for (i = 0; i != 16; i++)
+		_bitArrayTwo[i] = f->readUint16BE();
+
 	// Read the bits in array 3
 	if (getGameType() == GType_FF) {
-		for (i = 33; i != 48; i++)
-			_bitArray[i] = f->readUint16BE();
+		for (i = 0; i != 16; i++)
+			_bitArrayThree[i] = f->readUint16BE();
 	}
 
 	if (f->ioFailed()) {

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-21 04:36:26 UTC (rev 22066)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-21 06:37:28 UTC (rev 22067)
@@ -347,6 +347,8 @@
 	memset(_speechIdArray4, 0, sizeof(_speechIdArray4));
 
 	memset(_bitArray, 0, sizeof(_bitArray));
+	memset(_bitArrayTwo, 0, sizeof(_bitArrayTwo));
+	memset(_bitArrayThree, 0, sizeof(_bitArrayThree));
 
 	memset(_variableArray, 0, sizeof(_variableArray));
 	memset(_variableArray2, 0, sizeof(_variableArray2));

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-21 04:36:26 UTC (rev 22066)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-21 06:37:28 UTC (rev 22067)
@@ -384,7 +384,9 @@
 	uint16 _stringIdArray3[40];
 	uint16 _speechIdArray4[40];
 
-	uint16 _bitArray[48];
+	uint16 _bitArray[16];
+	uint16 _bitArrayTwo[16];
+	uint16 _bitArrayThree[16];
 	int16 _variableArray[256];
 	int16 _variableArray2[256];
 	int16 *_variableArrayPtr;


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