diff options
-rw-r--r-- | scumm/intern.h | 18 | ||||
-rw-r--r-- | scumm/object.cpp | 60 | ||||
-rw-r--r-- | scumm/scumm.h | 2 |
3 files changed, 40 insertions, 40 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 539e7cce2b..ca923e6814 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -197,6 +197,16 @@ protected: void readMAXS(); void readGlobalObjects(); + + void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL); +}; + +class ScummEngine_v4 : public ScummEngine_v3 { +public: + ScummEngine_v4(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v3(detector, syst, gs, md5sum) {} + +protected: + void loadCharset(int no); }; class ScummEngine_v2 : public ScummEngine_v3 { @@ -326,14 +336,6 @@ protected: byte VAR_BACKUP_VERB; }; -class ScummEngine_v4 : public ScummEngine_v3 { -public: - ScummEngine_v4(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v3(detector, syst, gs, md5sum) {} - -protected: - void loadCharset(int no); -}; - class ScummEngine_v6 : public ScummEngine { friend class Insane; 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; diff --git a/scumm/scumm.h b/scumm/scumm.h index bd7f8a153a..e02c250e88 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -724,7 +724,7 @@ protected: ObjectIDMap _objectIDMap; int _numObjectsInRoom; - void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL); + virtual void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL); void markObjectRectAsDirty(int obj); void loadFlObject(uint object, uint room); void nukeFlObjects(int min, int max); |