aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/cstime_view.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2011-01-22 11:36:43 +0000
committerAlyssa Milburn2011-01-22 11:36:43 +0000
commit5f87a5b9a8667dd3c7beafb138278c6817ac08db (patch)
tree50e0052e7358901c0ba79df1b86df370e93248d2 /engines/mohawk/cstime_view.cpp
parent2fabd9093742ab3b3bcf68b15ce48aa16cf524ed (diff)
downloadscummvm-rg350-5f87a5b9a8667dd3c7beafb138278c6817ac08db.tar.gz
scummvm-rg350-5f87a5b9a8667dd3c7beafb138278c6817ac08db.tar.bz2
scummvm-rg350-5f87a5b9a8667dd3c7beafb138278c6817ac08db.zip
MOHAWK: Add some proper group removal logic to CSTime.
svn-id: r55414
Diffstat (limited to 'engines/mohawk/cstime_view.cpp')
-rw-r--r--engines/mohawk/cstime_view.cpp53
1 files changed, 44 insertions, 9 deletions
diff --git a/engines/mohawk/cstime_view.cpp b/engines/mohawk/cstime_view.cpp
index cef5ef48aa..cad44e3b30 100644
--- a/engines/mohawk/cstime_view.cpp
+++ b/engines/mohawk/cstime_view.cpp
@@ -108,6 +108,7 @@ void CSTimeView::installGroup(uint16 resourceId, uint size, uint count, bool reg
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 @@ void CSTimeView::removeGroup(uint16 resourceId) {
return;
removeObjectsUsingBaseId(resourceId);
- freeShapesUsingGroupId(groupId);
- freeScriptsUsingGroupId(groupId);
- adjustShapeGroups(groupId);
+ freeShapesUsingResourceId(resourceId);
+ freeScriptsUsingResourceId(resourceId);
+ // adjustShapeGroups(groupId); - TODO: unnecessary?
}
void CSTimeView::removeObjectsUsingBaseId(uint16 baseId) {
@@ -139,16 +140,50 @@ void CSTimeView::removeObjectsUsingBaseId(uint16 baseId) {
}
}
-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) {