ASYLUM: add debug output to special::check[Other]Object and test for kObjectInvalid

This commit is contained in:
Alex Bevilacqua 2015-04-08 21:33:34 -04:00 committed by Eugene Sandulenko
parent b374c59bdf
commit 5dd9d33d2c
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -1445,12 +1445,16 @@ uint32 Special::getCounter(ActorIndex index) const {
}
void Special::checkObject(Object *object, GameFlag flagToSet, GameFlag flagToClear, ObjectId objectId) {
if (object->getFrameIndex() == 15) {
if (objectId != kObjectInvalid && object->getFrameIndex() == 15) {
Object *otherObject = getWorld()->getObjectById(objectId);
debugC(kDebugLevelObjects, "[checkObject] %s -> %s (flags: set %d, clear %d)",
object->getName(), otherObject->getName(), flagToSet, flagToClear);
_vm->setGameFlag(flagToSet);
_vm->clearGameFlag(flagToClear);
if (objectId != kObjectNone)
getWorld()->getObjectById(objectId)->setFrameIndex(0);
otherObject->setFrameIndex(0);
else
object->setFrameIndex(0);
}
@ -1459,6 +1463,9 @@ void Special::checkObject(Object *object, GameFlag flagToSet, GameFlag flagToCle
void Special::checkOtherObject(Object *object, ObjectId otherObjectId, GameFlag flagToClear, GameFlag flagToSet) {
Object *otherObject = getWorld()->getObjectById(otherObjectId);
debugC(kDebugLevelObjects, "[checkOtherObject] %s -> %s (flags: set %d, clear %d)",
object->getName(), otherObject->getName(), flagToSet, flagToClear);
if (!otherObject->getFrameIndex() && !object->getFrameIndex()) {
_vm->clearGameFlag(flagToClear);
_vm->setGameFlag(flagToSet);