[Scummvm-cvs-logs] scummvm master -> 3b092e5d60760de81ceecdad0901c51883fe077e

m-kiewitz m_kiewitz at users.sourceforge.net
Sun May 17 18:50:29 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3b092e5d60 SCI: identifyOffsets() counter variables


Commit: 3b092e5d60760de81ceecdad0901c51883fe077e
    https://github.com/scummvm/scummvm/commit/3b092e5d60760de81ceecdad0901c51883fe077e
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-05-17T18:51:22+02:00

Commit Message:
SCI: identifyOffsets() counter variables

Changed paths:
    engines/sci/engine/script.cpp
    engines/sci/engine/script.h



diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 292c0e0..6034378 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -65,7 +65,11 @@ void Script::freeScript() {
 	_lockers = 1;
 	_markedAsDeleted = false;
 	_objects.clear();
+
 	_offsetLookupArray.clear();
+	_offsetLookupObjectCount = 0;
+	_offsetLookupStringCount = 0;
+	_offsetLookupSaidCount = 0;
 }
 
 void Script::load(int script_nr, ResourceManager *resMan, ScriptPatcher *scriptPatcher) {
@@ -227,6 +231,10 @@ void Script::identifyOffsets() {
 	uint16 blockSize = 0;
 
 	_offsetLookupArray.clear();
+	_offsetLookupObjectCount = 0;
+	_offsetLookupStringCount = 0;
+	_offsetLookupSaidCount = 0;
+
 	if (getSciVersion() < SCI_VERSION_1_1) {
 		// SCI0 + SCI1
 		scriptDataPtr  = _buf;
@@ -272,6 +280,7 @@ void Script::identifyOffsets() {
 				arrayEntry.offset     = scriptDataPtr - _buf + 8; // Calculate offset inside script data (VM uses +8)
 				arrayEntry.stringSize = 0;
 				_offsetLookupArray.push_back(arrayEntry);
+				_offsetLookupObjectCount++;
 				break;
 
 			case SCI_OBJ_STRINGS:
@@ -316,6 +325,7 @@ void Script::identifyOffsets() {
 					arrayEntry.offset     = stringStartPtr - _buf; // Calculate offset inside script data
 					arrayEntry.stringSize = stringDataPtr - stringStartPtr;
 					_offsetLookupArray.push_back(arrayEntry);
+					_offsetLookupStringCount++;
 				} while (1);
 				break;
 
@@ -365,6 +375,7 @@ void Script::identifyOffsets() {
 					arrayEntry.offset     = stringStartPtr - _buf; // Calculate offset inside script data
 					arrayEntry.stringSize = 0;
 					_offsetLookupArray.push_back(arrayEntry);
+					_offsetLookupSaidCount++;
 				} while (1);
 				break;
 
@@ -415,6 +426,7 @@ void Script::identifyOffsets() {
 			arrayEntry.offset     = scriptDataPtr - _buf - 2; // the VM uses a pointer to the Magic-Number
 			arrayEntry.stringSize = 0;
 			_offsetLookupArray.push_back(arrayEntry);
+			_offsetLookupObjectCount++;
 
 			if (scriptDataLeft < 2)
 				error("Script::identifyOffsets(): unexpected end of script in script %d", _nr);
@@ -467,6 +479,7 @@ void Script::identifyOffsets() {
 			arrayEntry.offset     = stringStartPtr - _buf; // Calculate offset inside script data
 			arrayEntry.stringSize = stringDataPtr - stringStartPtr;
 			_offsetLookupArray.push_back(arrayEntry);
+			_offsetLookupStringCount++;
 		} while (1);
 
 	} else if (getSciVersion() == SCI_VERSION_3) {
@@ -504,6 +517,7 @@ void Script::identifyOffsets() {
 			arrayEntry.offset     = scriptDataPtr - _buf - 2; // the VM uses a pointer to the Magic-Number
 			arrayEntry.stringSize = 0;
 			_offsetLookupArray.push_back(arrayEntry);
+			_offsetLookupObjectCount++;
 
 			if (scriptDataLeft < 2)
 				error("Script::identifyOffsets(): unexpected end of script in script %d", _nr);
@@ -570,6 +584,7 @@ void Script::identifyOffsets() {
 				arrayEntry.offset     = stringStartPtr - _buf; // Calculate offset inside script data
 				arrayEntry.stringSize = stringDataPtr - stringStartPtr;
 				_offsetLookupArray.push_back(arrayEntry);
+				_offsetLookupStringCount++;
 
 				// SCI3 seems to have aligned all string on DWORD boundaries
 				sci3BoundaryOffset = stringDataPtr - _buf; // Calculate current offset inside script data
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index abe6409..755e2f3 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -93,6 +93,11 @@ private:
 protected:
 	offsetLookupArrayType _offsetLookupArray; // Table of all elements of currently loaded script, that may get pointed to
 
+private:
+	uint16 _offsetLookupObjectCount;
+	uint16 _offsetLookupStringCount;
+	uint16 _offsetLookupSaidCount;
+
 public:
 	int getLocalsOffset() const { return _localsOffset; }
 	uint16 getLocalsCount() const { return _localsCount; }
@@ -270,6 +275,9 @@ public:
 	 * Get the offset array
 	 */
 	const offsetLookupArrayType *getOffsetArray() { return &_offsetLookupArray; };
+	uint16 getOffsetObjectCount() { return _offsetLookupObjectCount; };
+	uint16 getOffsetStringCount() { return _offsetLookupStringCount; };
+	uint16 getOffsetSaidCount() { return _offsetLookupSaidCount; };
 
 private:
 	/**






More information about the Scummvm-git-logs mailing list