Fixed a couple of alignment issues

svn-id: r3521
This commit is contained in:
Ludvig Strigeus 2001-12-03 11:49:06 +00:00
parent 8c25be13e5
commit f01012c4e1
2 changed files with 9 additions and 9 deletions

View file

@ -122,7 +122,7 @@ void Scumm::akos_setPalette(AkosRenderer *ar, byte *palette) {
uint size, i; uint size, i;
akpl = findResource(MKID('AKPL'), ar->akos); akpl = findResource(MKID('AKPL'), ar->akos);
size = READ_BE_UINT32(akpl+4) - 8; size = READ_BE_UINT32_UNALIGNED(akpl+4) - 8;
akpl += 8; akpl += 8;
if (size > 256) if (size > 256)
@ -183,7 +183,7 @@ bool Scumm::akos_drawCostumeChannel(AkosRenderer *ar, int chan) {
if (code!=AKC_ComplexChan) { if (code!=AKC_ComplexChan) {
off = ar->akof + (code & 0xFFF); off = ar->akof + (code & 0xFFF);
assert( (code & 0xFFF)*6 < READ_BE_UINT32((byte*)ar->akof - 4)-8 ); assert( (code & 0xFFF)*6 < READ_BE_UINT32_UNALIGNED((byte*)ar->akof - 4)-8 );
assert( (code&0x7000) == 0); assert( (code&0x7000) == 0);
@ -469,7 +469,7 @@ void Scumm::akos_codec1(AkosRenderer *ar) {
ar->v1.scaletable = default_scale_table; ar->v1.scaletable = default_scale_table;
/* Setup color decoding variables */ /* Setup color decoding variables */
num_colors = READ_BE_UINT32(ar->akpl-4)-8; num_colors = READ_BE_UINT32_UNALIGNED(ar->akpl-4)-8;
if (num_colors == 32) { if (num_colors == 32) {
ar->v1.mask = (1<<3)-1; ar->v1.mask = (1<<3)-1;
ar->v1.shl = 3; ar->v1.shl = 3;
@ -767,7 +767,7 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
size = 0; size = 0;
if (akfo) { if (akfo) {
size = (READ_BE_UINT32(akfo)-8)>>1; size = (READ_BE_UINT32_UNALIGNED(akfo)-8)>>1;
akfo += 8; akfo += 8;
} }
@ -1039,4 +1039,4 @@ void Scumm::setAnimVar(Actor *a, byte var, int value) {
} }
#endif #endif

View file

@ -621,7 +621,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
if (findWhat&foCheckAlreadyLoaded && getObjectIndex(id) != -1) { if (findWhat&foCheckAlreadyLoaded && getObjectIndex(id) != -1) {
fo->obcd = obcdptr = getObjectAddress(id); fo->obcd = obcdptr = getObjectAddress(id);
assert((byte*)obcdptr > (byte*)256); assert((byte*)obcdptr > (byte*)256);
fo->obim = obimptr = obcdptr + READ_BE_UINT32(&((ImageHeader*)obcdptr)->size); fo->obim = obimptr = obcdptr + READ_BE_UINT32_UNALIGNED(&((ImageHeader*)obcdptr)->size);
fo->cdhd = (CodeHeader*)findResource(MKID('CDHD'), obcdptr); fo->cdhd = (CodeHeader*)findResource(MKID('CDHD'), obcdptr);
fo->imhd = (ImageHeader*)findResource(MKID('IMHD'), obimptr); fo->imhd = (ImageHeader*)findResource(MKID('IMHD'), obimptr);
return; return;
@ -841,7 +841,7 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) {
if (dataptr==NULL) if (dataptr==NULL)
error("setCursorImg: No such image"); error("setCursorImg: No such image");
size = READ_BE_UINT32(dataptr+4); size = READ_BE_UINT32_UNALIGNED(dataptr+4);
if (size > sizeof(_grabbedCursor)) if (size > sizeof(_grabbedCursor))
error("setCursorImg: Cursor image too large"); error("setCursorImg: Cursor image too large");
@ -1014,10 +1014,10 @@ void Scumm::loadFlObject(uint object, uint room) {
od = &_objs[_numObjectsInRoom]; od = &_objs[_numObjectsInRoom];
/* Setup sizes */ /* Setup sizes */
obcd_size = READ_BE_UINT32(foir.obcd + 4); obcd_size = READ_BE_UINT32_UNALIGNED(foir.obcd + 4);
od->offs_obcd_to_room = 8; od->offs_obcd_to_room = 8;
od->offs_obim_to_room = obcd_size + 8; od->offs_obim_to_room = obcd_size + 8;
obim_size = READ_BE_UINT32(foir.obim + 4); obim_size = READ_BE_UINT32_UNALIGNED(foir.obim + 4);
flob_size = obcd_size + obim_size + 8; flob_size = obcd_size + obim_size + 8;
/* Allocate slot & memory for floating object */ /* Allocate slot & memory for floating object */