[Scummvm-cvs-logs] SF.net SVN: scummvm:[55414] scummvm/trunk/engines/mohawk

fuzzie at users.sourceforge.net fuzzie at users.sourceforge.net
Sat Jan 22 12:36:43 CET 2011


Revision: 55414
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55414&view=rev
Author:   fuzzie
Date:     2011-01-22 11:36:43 +0000 (Sat, 22 Jan 2011)

Log Message:
-----------
MOHAWK: Add some proper group removal logic to CSTime.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/cstime_view.cpp
    scummvm/trunk/engines/mohawk/cstime_view.h

Modified: scummvm/trunk/engines/mohawk/cstime_view.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/cstime_view.cpp	2011-01-22 10:09:01 UTC (rev 55413)
+++ scummvm/trunk/engines/mohawk/cstime_view.cpp	2011-01-22 11:36:43 UTC (rev 55414)
@@ -108,6 +108,7 @@
 	installFeatureShapes(regs, _numSCRBGroups, resourceId);
 	if (baseId == 0xffff)
 		baseId = resourceId;
+	_SCRBGroupResources[_numSCRBGroups] = resourceId; // TODO: Meh. This needs some rethinking.
 	installGroupOfSCRBs(false, baseId, size, count);
 }
 
@@ -121,9 +122,9 @@
 		return;
 
 	removeObjectsUsingBaseId(resourceId);
-	freeShapesUsingGroupId(groupId);
-	freeScriptsUsingGroupId(groupId);
-	adjustShapeGroups(groupId);
+	freeShapesUsingResourceId(resourceId);
+	freeScriptsUsingResourceId(resourceId);
+	// adjustShapeGroups(groupId); - TODO: unnecessary?
 }
 
 void CSTimeView::removeObjectsUsingBaseId(uint16 baseId) {
@@ -139,18 +140,52 @@
 	}
 }
 
-void CSTimeView::freeShapesUsingGroupId(uint16 groupId) {
-	_compoundSHAPGroups[groupId] = 0xffff; // FIXME
+void CSTimeView::freeShapesUsingResourceId(uint16 resourceId) {
+	// TODO: Meh. This needs some rethinking.
+	for (int i = _numSCRBGroups - 1; i >= 0; i--) {
+		if (_SCRBGroupResources[i] != resourceId)
+			continue;
+		for (uint j = i; j < 13; j++)
+			_compoundSHAPGroups[j] = _compoundSHAPGroups[j + 1];
+		_compoundSHAPGroups[13] = 0;
+		// TODO: deal with REGS
+	}
 }
 
-void CSTimeView::freeScriptsUsingGroupId(uint16 groupId) {
-	_SCRBGroupBases[groupId] = 0xffff; // FIXME
+void CSTimeView::freeScriptsUsingResourceId(uint16 resourceId) {
+	// TODO: Meh. This needs some rethinking.
+	for (int i = _numSCRBGroups - 1; i >= 0; i--) {
+		if (_SCRBGroupResources[i] == resourceId)
+			groupFreeScript(i);
+	}
 }
 
-void CSTimeView::adjustShapeGroups(uint16 groupId) {
-	// FIXME
+void CSTimeView::groupFreeScript(uint index) {
+	uint count = _SCRBGroupSizes[index];
+	_numSCRBGroups--;
+	for (uint i = index; i < _numSCRBGroups; i++) {
+		_SCRBGroupBases[i] = _SCRBGroupBases[i + 1];
+		_SCRBGroupSizes[i] = _SCRBGroupSizes[i + 1];
+		_SCRBGroupResources[i] = _SCRBGroupResources[i + 1]; // TODO: Meh. This needs some rethinking.
+	}
+	uint base = 0;
+	for (uint i = 0; i < index; i++)
+		base += _SCRBGroupSizes[i];
+	for (uint i = 0; i < count; i++)
+		_SCRBEntries.remove_at(base);
+	// TODO: kill any actual scripts
+	groupAdjustView(index, count);
 }
 
+void CSTimeView::groupAdjustView(uint index, uint count) {
+	for (Feature *node = _rootNode->_next; node->_next; node = node->_next) {
+		if (node->_data.compoundSHAPIndex < index)
+			continue;
+		node->_data.compoundSHAPIndex--;
+		node->_data.scrbIndex -= count;
+	}
+}
+
 void CSTimeView::loadBitmapCursors(uint16 baseId) {
 	// TODO
 }

Modified: scummvm/trunk/engines/mohawk/cstime_view.h
===================================================================
--- scummvm/trunk/engines/mohawk/cstime_view.h	2011-01-22 10:09:01 UTC (rev 55413)
+++ scummvm/trunk/engines/mohawk/cstime_view.h	2011-01-22 11:36:43 UTC (rev 55414)
@@ -84,10 +84,12 @@
 
 	uint16 _bitmapCursorId;
 
+	uint16 _SCRBGroupResources[14];
 	void removeObjectsUsingBaseId(uint16 baseId);
-	void freeShapesUsingGroupId(uint16 groupId);
-	void freeScriptsUsingGroupId(uint16 groupId);
-	void adjustShapeGroups(uint16 groupId);
+	void freeShapesUsingResourceId(uint16 resourceId);
+	void freeScriptsUsingResourceId(uint16 resourceId);
+	void groupFreeScript(uint index);
+	void groupAdjustView(uint index, uint count);
 
 	void finishDraw();
 };


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