aboutsummaryrefslogtreecommitdiff
path: root/object.cpp
diff options
context:
space:
mode:
authorJames Brown2002-04-03 16:20:17 +0000
committerJames Brown2002-04-03 16:20:17 +0000
commit7afd2a11dbac5098b672fa7f43f6f1d49df205f7 (patch)
tree4df61b3c8bd3adc36321614b40520320c5508fbf /object.cpp
parentaa160c52c051445b94a8ff0232dba79029a433c3 (diff)
downloadscummvm-rg350-7afd2a11dbac5098b672fa7f43f6f1d49df205f7.tar.gz
scummvm-rg350-7afd2a11dbac5098b672fa7f43f6f1d49df205f7.tar.bz2
scummvm-rg350-7afd2a11dbac5098b672fa7f43f6f1d49df205f7.zip
Fix removal of objects in Zak/Indy3/Loom
svn-id: r3852
Diffstat (limited to 'object.cpp')
-rw-r--r--object.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/object.cpp b/object.cpp
index 3f291cf8f1..ae25a4ef53 100644
--- a/object.cpp
+++ b/object.cpp
@@ -25,31 +25,41 @@
bool Scumm::getClass(int obj, int cls) {
checkRange(_numGlobalObjects-1, 0, obj, "Object %d out of range in getClass");
-
-
+ cls &= 0x7F;
checkRange(32,1,cls,"Class %d out of range in getClass");
+
if (_features && GF_SMALL_HEADER) {
byte *oldClass = (byte*)&_classData[obj];
if (cls == 32) // CLASS_TOUCHABLE
cls = 23;
return (oldClass[cls/8] & bit_table[cls&0x07]) != 0;
- } else {
- cls &= 0x7F;
+ } else {
return (_classData[obj] & (1<<(cls-1))) != 0;
}
}
void Scumm::putClass(int obj, int cls, bool set) {
checkRange(_numGlobalObjects-1, 0, obj, "Object %d out of range in putClass");
-
cls &= 0x7F;
checkRange(32,1,cls,"Class %d out of range in getClass");
- if (set)
- _classData[obj] |= (1<<(cls-1));
- else
- _classData[obj] &= ~(1<<(cls-1));
+ if (_features && GF_SMALL_HEADER) {
+ byte *oldClass = (byte*)&_classData[obj];
+ if (cls == 32) // CLASS_TOUCHABLE
+ cls = 23;
+
+ if (set)
+ oldClass[cls/8] |= bit_table[cls&0x07];
+ else
+ oldClass[cls/8] &= bit_table[cls&0x07]^0xff;
+
+ } else {
+ if (set)
+ _classData[obj] |= (1<<(cls-1));
+ else
+ _classData[obj] &= ~(1<<(cls-1));
+ }
}
int Scumm::getOwner(int obj) {
@@ -782,6 +792,10 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
}
fo->roomptr = roomptr = getResourceAddress(rtRoom, room);
+ if (!roomptr) { // FIXME: ZAK256 AIRPORT WORKAROUND (buying book from devotee)
+ warning("findObjectInRoom: failed getting roomptr to %d", room);
+ return;
+ }
roomhdr = (RoomHeader*)findResourceData(MKID('RMHD'), roomptr);
if(_features & GF_AFTER_V7)