changed the name of the former removeObjectFromRoom yet again, to markObjectRectAsDirty - that describes its functionality more accurately, I hope :-)

svn-id: r12326
This commit is contained in:
Max Horn 2004-01-11 20:42:40 +00:00
parent 0712cb95af
commit 7237b6a2ec
6 changed files with 18 additions and 24 deletions

View file

@ -486,7 +486,7 @@ bool ScummDebugger::Cmd_Object(int argc, const char **argv) {
_vm->putOwner(obj, _vm->VAR(_vm->VAR_EGO)); _vm->putOwner(obj, _vm->VAR(_vm->VAR_EGO));
_vm->putClass(obj, kObjectClassUntouchable, 1); _vm->putClass(obj, kObjectClassUntouchable, 1);
_vm->putState(obj, 1); _vm->putState(obj, 1);
_vm->forceObjectRedraw(obj); _vm->markObjectRectAsDirty(obj);
_vm->clearDrawObjectQueue(); _vm->clearDrawObjectQueue();
_vm->runInventoryScript(obj); _vm->runInventoryScript(obj);
} else if (!strcmp(argv[2], "state")) { } else if (!strcmp(argv[2], "state")) {

View file

@ -851,25 +851,19 @@ void ScummEngine::clearOwnerOf(int obj) {
} }
/** /**
* Force a screen redraw at the location of the specifed object. This is * Mark the rectangle covered by the given object as dirty, thus eventually
* typically called when an object was just removed from the room, or when its * ensuring a redraw of that area. This function is typically invoked when an
* state changed. * object gets removed from the current room, or when its state changed.
*/ */
void ScummEngine::forceObjectRedraw(int obj) { void ScummEngine::markObjectRectAsDirty(int obj) {
int i, j, strip; int i, strip;
for (i = 1; i < _numLocalObjects; i++) { for (i = 1; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr == (uint16)obj) { if (_objs[i].obj_nr == (uint16)obj) {
if (_objs[i].width != 0) { if (_objs[i].width != 0) {
for (j = 0; j < _objs[i].width / 8; j++) { const int minStrip = MAX(_screenStartStrip, _objs[i].x_pos / 8);
strip = (_objs[i].x_pos / 8) + j; const int maxStrip = MIN(_screenEndStrip+1, _objs[i].x_pos / 8 + _objs[i].width / 8);
for (strip = minStrip; strip < maxStrip; strip++) {
// Clip value
if (strip < _screenStartStrip)
continue;
if (strip > _screenEndStrip)
break;
setGfxUsageBit(strip, USAGE_BIT_DIRTY); setGfxUsageBit(strip, USAGE_BIT_DIRTY);
} }
} }

View file

@ -468,14 +468,14 @@ void ScummEngine_v2::clearStateCommon(byte type) {
void ScummEngine_v2::o2_setState08() { void ScummEngine_v2::o2_setState08() {
int obj = getVarOrDirectWord(PARAM_1); int obj = getVarOrDirectWord(PARAM_1);
putState(obj, getState(obj) | 0x08); putState(obj, getState(obj) | 0x08);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
clearDrawObjectQueue(); clearDrawObjectQueue();
} }
void ScummEngine_v2::o2_clearState08() { void ScummEngine_v2::o2_clearState08() {
int obj = getVarOrDirectWord(PARAM_1); int obj = getVarOrDirectWord(PARAM_1);
putState(obj, getState(obj) & ~0x08); putState(obj, getState(obj) & ~0x08);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
clearDrawObjectQueue(); clearDrawObjectQueue();
} }
@ -1449,7 +1449,7 @@ void ScummEngine_v2::o2_pickupObject() {
return; /* object twice */ return; /* object twice */
addObjectToInventory(obj, _roomResource); addObjectToInventory(obj, _roomResource);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
putOwner(obj, VAR(VAR_EGO)); putOwner(obj, VAR(VAR_EGO));
putState(obj, getState(obj) | 0xA); putState(obj, getState(obj) | 0xA);
clearDrawObjectQueue(); clearDrawObjectQueue();

View file

@ -1592,7 +1592,7 @@ void ScummEngine_v5::o5_pickupObject() {
putOwner(obj, VAR(VAR_EGO)); putOwner(obj, VAR(VAR_EGO));
putClass(obj, kObjectClassUntouchable, 1); putClass(obj, kObjectClassUntouchable, 1);
putState(obj, 1); putState(obj, 1);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
clearDrawObjectQueue(); clearDrawObjectQueue();
runInventoryScript(1); runInventoryScript(1);
} }
@ -2174,7 +2174,7 @@ void ScummEngine_v5::o5_setState() {
obj = getVarOrDirectWord(PARAM_1); obj = getVarOrDirectWord(PARAM_1);
state = getVarOrDirectByte(PARAM_2); state = getVarOrDirectByte(PARAM_2);
putState(obj, state); putState(obj, state);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
if (_BgNeedsRedraw) if (_BgNeedsRedraw)
clearDrawObjectQueue(); clearDrawObjectQueue();
} }
@ -2911,7 +2911,7 @@ void ScummEngine_v5::o5_pickupObjectOld() {
// warning("adding %d from %d to inventoryOld", obj, _currentRoom); // warning("adding %d from %d to inventoryOld", obj, _currentRoom);
addObjectToInventory(obj, _roomResource); addObjectToInventory(obj, _roomResource);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
putOwner(obj, VAR(VAR_EGO)); putOwner(obj, VAR(VAR_EGO));
putClass(obj, kObjectClassUntouchable, 1); putClass(obj, kObjectClassUntouchable, 1);
putState(obj, 1); putState(obj, 1);

View file

@ -916,7 +916,7 @@ void ScummEngine_v6::o6_setState() {
} }
putState(obj, state); putState(obj, state);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
if (_BgNeedsRedraw) if (_BgNeedsRedraw)
clearDrawObjectQueue(); clearDrawObjectQueue();
} }
@ -1151,7 +1151,7 @@ void ScummEngine_v6::o6_pickupObject() {
putOwner(obj, VAR(VAR_EGO)); putOwner(obj, VAR(VAR_EGO));
putClass(obj, kObjectClassUntouchable, 1); putClass(obj, kObjectClassUntouchable, 1);
putState(obj, 1); putState(obj, 1);
forceObjectRedraw(obj); markObjectRectAsDirty(obj);
clearDrawObjectQueue(); clearDrawObjectQueue();
runInventoryScript(obj); /* Difference */ runInventoryScript(obj); /* Difference */
} }

View file

@ -672,7 +672,7 @@ protected:
byte _numObjectsInRoom; byte _numObjectsInRoom;
void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL); void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
void forceObjectRedraw(int obj); void markObjectRectAsDirty(int obj);
void loadFlObject(uint object, uint room); void loadFlObject(uint object, uint room);
void nukeFlObjects(int min, int max); void nukeFlObjects(int min, int max);
int findFlObjectSlot(); int findFlObjectSlot();