[Scummvm-cvs-logs] SF.net SVN: scummvm: [27140] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Jun 6 18:37:11 CEST 2007


Revision: 27140
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27140&view=rev
Author:   thebluegr
Date:     2007-06-06 09:37:10 -0700 (Wed, 06 Jun 2007)

Log Message:
-----------
Added sanity checks for hitzones in SAGA, after discussing with h00ligan and sev. Removed a hack for IHNM which is not needed anymore and removed a redundant check for zero object types

Modified Paths:
--------------
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/objectmap.h
    scummvm/trunk/engines/saga/saga.cpp
    scummvm/trunk/engines/saga/script.cpp
    scummvm/trunk/engines/saga/sfuncs.cpp

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2007-06-06 14:00:11 UTC (rev 27139)
+++ scummvm/trunk/engines/saga/interface.cpp	2007-06-06 16:37:10 UTC (rev 27140)
@@ -1289,6 +1289,10 @@
 		switch (objectTypeId(obj)) {
 		case kGameObjectHitZone:
 			hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(obj));
+
+			if (hitZone == NULL)
+				return;
+
 			if (hitZone->getFlags() & kHitZoneExit)
 				script = hitZone->getScriptNumber();
 			break;

Modified: scummvm/trunk/engines/saga/objectmap.h
===================================================================
--- scummvm/trunk/engines/saga/objectmap.h	2007-06-06 14:00:11 UTC (rev 27139)
+++ scummvm/trunk/engines/saga/objectmap.h	2007-06-06 16:37:10 UTC (rev 27140)
@@ -110,12 +110,7 @@
 	int hitTest(const Point& testPoint);
 	HitZone *getHitZone(int16 index) {
 		if ((index < 0) || (index >= _hitZoneListCount)) {
-			// HACK: If we get a wrong hitzone, return the last hitzone in the list
-			// Normally, we don't get wrong hitzones in ITE, however IHNM still seems
-			// to have problems with some, therefore just throw a warning for now and
-			// continue with a valid hitzone
-			warning("ObjectMap::getHitZone wrong index 0x%X, adjusting it to 0x%X", index, _hitZoneListCount - 1);
-			index = _hitZoneListCount - 1;
+			return NULL;
 		}
 		return _hitZoneList[index];
 	}

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2007-06-06 14:00:11 UTC (rev 27139)
+++ scummvm/trunk/engines/saga/saga.cpp	2007-06-06 16:37:10 UTC (rev 27140)
@@ -352,6 +352,10 @@
 		return _actor->_actorsStrings.getString(actor->_nameIndex);
 	case kGameObjectHitZone:
 		hitZone = _scene->_objectMap->getHitZone(objectIdToIndex(objectId));
+
+		if (hitZone == NULL)
+			return "";
+
 		return _scene->_sceneStrings.getString(hitZone->getNameIndex());
 	}
 	warning("SagaEngine::getObjectName name not found for 0x%X", objectId);

Modified: scummvm/trunk/engines/saga/script.cpp
===================================================================
--- scummvm/trunk/engines/saga/script.cpp	2007-06-06 14:00:11 UTC (rev 27139)
+++ scummvm/trunk/engines/saga/script.cpp	2007-06-06 16:37:10 UTC (rev 27140)
@@ -469,6 +469,10 @@
 		else if (objectType == kGameObjectHitZone) {
 			scriptModuleNumber = _vm->_scene->getScriptModuleNumber();
 			hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[0]));
+
+			if (hitZone == NULL)
+				return;
+
 			if ((hitZone->getFlags() & kHitZoneExit) == 0) {
 				scriptEntrypointNumber = hitZone->getScriptNumber();
 			}

Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp	2007-06-06 14:00:11 UTC (rev 27139)
+++ scummvm/trunk/engines/saga/sfuncs.cpp	2007-06-06 16:37:10 UTC (rev 27140)
@@ -386,13 +386,14 @@
 			break;
 		case kGameObjectHitZone:
 		case kGameObjectStepZone:
-			if (objectTypeId(objectId) == 0)
-				return;
-			else if (objectTypeId(objectId) == kGameObjectHitZone)
+			if (objectTypeId(objectId) == kGameObjectHitZone)
 				hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(objectId));
 			else
 				hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
 
+			if (hitZone == NULL)
+				return;
+
 			scriptEntryPointNumber = hitZone->getScriptNumber();
 			moduleNumber = _vm->_scene->getScriptModuleNumber();
 			break;
@@ -731,14 +732,6 @@
 	int16 flag = thread->pop();
 	HitZone *hitZone;
 
-	// HACK: Don't disable the tear in scene 14, to keep the staircase functioning
-	// FIXME: Investigate why this hack is needed and remove it
-	if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 1 &&
-		_vm->_scene->currentSceneNumber() == 14) {
-		warning("sfEnableZone: HACK: Prevent unusable staircase");
-		return;		// Do nothing
-	}
-
 	if (objectTypeId(objectId) == 0)
 		return;
 	else if (objectTypeId(objectId) == kGameObjectHitZone)
@@ -746,6 +739,9 @@
 	else
 		hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
 
+	if (hitZone == NULL)
+		return;
+
 	if (flag) {
 		hitZone->setFlag(kHitZoneEnabled);
 	} else {


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