aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Hamm2002-03-05 21:03:32 +0000
committerVincent Hamm2002-03-05 21:03:32 +0000
commit09ff3af07fb007e539f95e24186b3c762f923c53 (patch)
treebd633a171306b0524f7fb3c49dfd0530b6b425d0
parentc0b0afa68a6f0643e1ee94f8d1c5ff98f557db25 (diff)
downloadscummvm-rg350-09ff3af07fb007e539f95e24186b3c762f923c53.tar.gz
scummvm-rg350-09ff3af07fb007e539f95e24186b3c762f923c53.tar.bz2
scummvm-rg350-09ff3af07fb007e539f95e24186b3c762f923c53.zip
Fixed struct ImageHeader for v7 implementation
svn-id: r3652
-rw-r--r--object.cpp33
-rw-r--r--scumm.h50
-rw-r--r--verbs.cpp9
3 files changed, 59 insertions, 33 deletions
diff --git a/object.cpp b/object.cpp
index 8205af8192..2cb64af9a3 100644
--- a/object.cpp
+++ b/object.cpp
@@ -149,8 +149,13 @@ void Scumm::getObjectXYPos(int object) {
}
assert(ptr);
imhd = (ImageHeader*)findResourceData(MKID('IMHD'), ptr);
- x = od->x_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].x);
- y = od->y_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].y);
+ if( _features & GF_AFTER_V7) {
+ x = od->x_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].x);
+ y = od->y_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].y);
+ } else {
+ x = od->x_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].x);
+ y = od->y_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].y);
+ }
} else {
x = (int16)READ_LE_UINT16(&od->walk_x);
y = (int16)READ_LE_UINT16(&od->walk_y);
@@ -400,7 +405,10 @@ void Scumm::loadRoomObjects() {
error("Room %d missing image blocks(s)", _roomResource);
imhd = (ImageHeader*)findResourceData(MKID('IMHD'), ptr);
- obim_id = READ_LE_UINT16(&imhd->obj_id);
+ if (_features & GF_AFTER_V7)
+ obim_id = READ_LE_UINT16(&imhd->v7.obj_id);
+ else
+ obim_id = READ_LE_UINT16(&imhd->old.obj_id);
for(j=1; j<=_numObjectsInRoom; j++) {
if (_objs[j].obj_nr==obim_id)
@@ -752,6 +760,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
RoomHeader *roomhdr;
ImageHeader *imhd;
int id2;
+ int id3;
if (findWhat&foCheckAlreadyLoaded && getObjectIndex(id) != -1) {
fo->obcd = obcdptr = getOBCDFromObject(id);
@@ -829,7 +838,11 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
break;
}
} else {
- if (READ_LE_UINT16(&imhd->obj_id) == (uint16)id) {
+ if(_features & GF_AFTER_V7)
+ id3 = READ_LE_UINT16(&imhd->v7.obj_id);
+ else
+ id3 = READ_LE_UINT16(&imhd->old.obj_id);
+ if (id3 == (uint16)id) {
fo->obim = obimptr;
fo->imhd = imhd;
break;
@@ -1022,9 +1035,15 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) {
findObjectInRoom(&foir, foCodeHeader | foImageHeader | foCheckAlreadyLoaded, img, room);
- setCursorHotspot2(
- READ_LE_UINT16(&foir.imhd->hotspot[0].x),
- READ_LE_UINT16(&foir.imhd->hotspot[0].y));
+ if(_features & GF_AFTER_V7)
+ setCursorHotspot2(
+ READ_LE_UINT16(&foir.imhd->v7.hotspot[0].x),
+ READ_LE_UINT16(&foir.imhd->v7.hotspot[0].y));
+ else
+ setCursorHotspot2(
+ READ_LE_UINT16(&foir.imhd->old.hotspot[0].x),
+ READ_LE_UINT16(&foir.imhd->old.hotspot[0].y));
+
#if !defined(FULL_THROTTLE)
w = READ_LE_UINT16(&foir.cdhd->v6.w)>>3;
diff --git a/scumm.h b/scumm.h
index 98ccf6e732..16ff38beb2 100644
--- a/scumm.h
+++ b/scumm.h
@@ -145,32 +145,34 @@ struct CodeHeader {
};
} GCC_PACK;
-#if defined(FULL_THROTTLE)
struct ImageHeader { /* file format */
- uint32 version;
- uint16 obj_id;
- uint16 unk[1];
- int16 x_pos,y_pos;
- uint16 width,height;
- byte unk2[3];
- byte actordir;
- uint16 unk_2;
- struct {
- int16 x,y;
- } hotspot[15];
-} GCC_PACK;
-#else
-struct ImageHeader { /* file format */
- uint16 obj_id;
- uint16 unk[5];
- uint16 width;
- uint16 height;
- uint16 unk_2;
- struct {
- int16 x,y;
- } hotspot[15];
+ union {
+ struct {
+ uint16 obj_id;
+ uint16 unk[5];
+ uint16 width;
+ uint16 height;
+ uint16 unk_2;
+ struct {
+ int16 x,y;
+ } hotspot[15];
+ } old;
+
+ struct {
+ uint32 version;
+ uint16 obj_id;
+ uint16 unk[1];
+ int16 x_pos,y_pos;
+ uint16 width,height;
+ byte unk2[3];
+ byte actordir;
+ uint16 unk_2;
+ struct {
+ int16 x,y;
+ } hotspot[15];
+ } v7;
+ };
} GCC_PACK;
-#endif
#pragma END_PACK_STRUCTS
struct AdjustBoxResult {
diff --git a/verbs.cpp b/verbs.cpp
index 42dc115cf5..246ce69664 100644
--- a/verbs.cpp
+++ b/verbs.cpp
@@ -194,8 +194,13 @@ void Scumm::drawVerbBitmap(int vrb, int x, int y) {
imptr = (obim+8);
} else {
imhd = (ImageHeader*)findResourceData(MKID('IMHD'), obim);
- imgw = READ_LE_UINT16(&imhd->width) >> 3;
- imgh = READ_LE_UINT16(&imhd->height) >> 3;
+ if (_features & GF_AFTER_V7) {
+ imgw = READ_LE_UINT16(&imhd->v7.width) >> 3;
+ imgh = READ_LE_UINT16(&imhd->v7.height) >> 3;
+ } else {
+ imgw = READ_LE_UINT16(&imhd->old.width) >> 3;
+ imgh = READ_LE_UINT16(&imhd->old.height) >> 3;
+ }
imptr = findResource(MKID('IM01'), obim);
if (!imptr)