aboutsummaryrefslogtreecommitdiff
path: root/scumm/object.cpp
diff options
context:
space:
mode:
authorMax Horn2004-01-11 20:42:40 +0000
committerMax Horn2004-01-11 20:42:40 +0000
commit7237b6a2ec6a83d2a421d8c990848dbadaa947f9 (patch)
tree8b2269b6f05513e2107cc3cd728ab87f8c3ddcd0 /scumm/object.cpp
parent0712cb95af1bbadb99aea44a53addc48c3f9a6ce (diff)
downloadscummvm-rg350-7237b6a2ec6a83d2a421d8c990848dbadaa947f9.tar.gz
scummvm-rg350-7237b6a2ec6a83d2a421d8c990848dbadaa947f9.tar.bz2
scummvm-rg350-7237b6a2ec6a83d2a421d8c990848dbadaa947f9.zip
changed the name of the former removeObjectFromRoom yet again, to markObjectRectAsDirty - that describes its functionality more accurately, I hope :-)
svn-id: r12326
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r--scumm/object.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index c64e3177f5..d7ea606902 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -851,25 +851,19 @@ void ScummEngine::clearOwnerOf(int obj) {
}
/**
- * Force a screen redraw at the location of the specifed object. This is
- * typically called when an object was just removed from the room, or when its
- * state changed.
+ * Mark the rectangle covered by the given object as dirty, thus eventually
+ * ensuring a redraw of that area. This function is typically invoked when an
+ * object gets removed from the current room, or when its state changed.
*/
-void ScummEngine::forceObjectRedraw(int obj) {
- int i, j, strip;
+void ScummEngine::markObjectRectAsDirty(int obj) {
+ int i, strip;
for (i = 1; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr == (uint16)obj) {
if (_objs[i].width != 0) {
- for (j = 0; j < _objs[i].width / 8; j++) {
- strip = (_objs[i].x_pos / 8) + j;
-
- // Clip value
- if (strip < _screenStartStrip)
- continue;
- if (strip > _screenEndStrip)
- break;
-
+ const int minStrip = MAX(_screenStartStrip, _objs[i].x_pos / 8);
+ const int maxStrip = MIN(_screenEndStrip+1, _objs[i].x_pos / 8 + _objs[i].width / 8);
+ for (strip = minStrip; strip < maxStrip; strip++) {
setGfxUsageBit(strip, USAGE_BIT_DIRTY);
}
}