aboutsummaryrefslogtreecommitdiff
path: root/scumm/object.cpp
diff options
context:
space:
mode:
authorMax Horn2005-04-01 13:05:40 +0000
committerMax Horn2005-04-01 13:05:40 +0000
commit9f01b54bcfd7871f4a4a4fb58a9df65e96aae5d0 (patch)
tree474c38dcf1f306f4376b74a48d9cec404303e091 /scumm/object.cpp
parent2eab3e51eb368122a80cba2f46e20f69c827755f (diff)
downloadscummvm-rg350-9f01b54bcfd7871f4a4a4fb58a9df65e96aae5d0.tar.gz
scummvm-rg350-9f01b54bcfd7871f4a4a4fb58a9df65e96aae5d0.tar.bz2
scummvm-rg350-9f01b54bcfd7871f4a4a4fb58a9df65e96aae5d0.zip
Turned setupRoomObject into a virtual method
svn-id: r17326
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r--scumm/object.cpp60
1 files changed, 29 insertions, 31 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index a1e3555702..3535b38fc2 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -725,46 +725,44 @@ void ScummEngine::loadRoomObjectsSmall() {
CHECK_HEAP
}
-void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr) {
- const CodeHeader *cdhd = NULL;
- const ImageHeader *imhd = NULL;
-
+void ScummEngine_v3::setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr) {
assert(room);
+ const byte *ptr = room + od->OBCDoffset;
- if (_features & GF_SMALL_HEADER) {
-
- const byte *ptr = room + od->OBCDoffset;
+ if (_features & GF_OLD_BUNDLE)
+ ptr -= 2;
- if (_features & GF_OLD_BUNDLE)
- ptr -= 2;
+ od->obj_nr = READ_LE_UINT16(ptr + 6);
- od->obj_nr = READ_LE_UINT16(ptr + 6);
+ od->x_pos = *(ptr + 9) * 8;
+ od->y_pos = ((*(ptr + 10)) & 0x7F) * 8;
- od->x_pos = *(ptr + 9) * 8;
- od->y_pos = ((*(ptr + 10)) & 0x7F) * 8;
+ od->parentstate = (*(ptr + 10) & 0x80) ? 1 : 0;
+ if (_version <= 2)
+ od->parentstate *= 8;
- od->parentstate = (*(ptr + 10) & 0x80) ? 1 : 0;
- if (_version <= 2)
- od->parentstate *= 8;
+ od->width = *(ptr + 11) * 8;
- od->width = *(ptr + 11) * 8;
+ od->parent = *(ptr + 12);
- od->parent = *(ptr + 12);
+ if (_version <= 2) {
+ od->walk_x = *(ptr + 13) * 8;
+ od->walk_y = (*(ptr + 14) & 0x1f) * 8;
+ od->actordir = (*(ptr + 15)) & 7;
+ od->height = *(ptr + 15) & 0xf8;
+ } else {
+ od->walk_x = READ_LE_UINT16(ptr + 13);
+ od->walk_y = READ_LE_UINT16(ptr + 15);
+ od->actordir = (*(ptr + 17)) & 7;
+ od->height = *(ptr + 17) & 0xf8;
+ }
+}
- if (_version <= 2) {
- od->walk_x = *(ptr + 13) * 8;
- od->walk_y = (*(ptr + 14) & 0x1f) * 8;
- od->actordir = (*(ptr + 15)) & 7;
- od->height = *(ptr + 15) & 0xf8;
- } else {
- od->walk_x = READ_LE_UINT16(ptr + 13);
- od->walk_y = READ_LE_UINT16(ptr + 15);
- od->actordir = (*(ptr + 17)) & 7;
- od->height = *(ptr + 17) & 0xf8;
- }
+void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr) {
+ const CodeHeader *cdhd = NULL;
+ const ImageHeader *imhd = NULL;
- return;
- }
+ assert(room);
if (searchptr == NULL) {
if (_version == 8)
@@ -791,7 +789,7 @@ void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte *
od->y_pos = (int)READ_LE_UINT32(&imhd->v8.y_pos);
od->width = (uint)READ_LE_UINT32(&imhd->v8.width);
od->height = (uint)READ_LE_UINT32(&imhd->v8.height);
- // HACK: This is done sinec an angle doesn't fit into a byte (360 > 256)
+ // HACK: This is done since an angle doesn't fit into a byte (360 > 256)
od->actordir = toSimpleDir(1, READ_LE_UINT32(&imhd->v8.actordir));
if (FROM_LE_32(imhd->v8.version) == 801)
od->flags = ((((byte)READ_LE_UINT32(&imhd->v8.flags)) & 16) == 0) ? Gdi::dbAllowMaskOr : 0;