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->putClass(obj, kObjectClassUntouchable, 1);
_vm->putState(obj, 1);
_vm->forceObjectRedraw(obj);
_vm->markObjectRectAsDirty(obj);
_vm->clearDrawObjectQueue();
_vm->runInventoryScript(obj);
} 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
* 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);
}
}

View file

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

View file

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

View file

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

View file

@ -672,7 +672,7 @@ protected:
byte _numObjectsInRoom;
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 nukeFlObjects(int min, int max);
int findFlObjectSlot();