changes for v2 resources

svn-id: r7053
This commit is contained in:
Paweł Kołodziejski 2003-04-21 11:19:56 +00:00
parent d7deee507a
commit d9adc5d71a
2 changed files with 46 additions and 21 deletions

View file

@ -634,21 +634,26 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr) {
od->y_pos = ((*(ptr + 10)) & 0x7F) << 3; od->y_pos = ((*(ptr + 10)) & 0x7F) << 3;
od->width = *(ptr + 11) << 3; od->width = *(ptr + 11) << 3;
od->height = *(ptr + 17) & 0xf8;
if (*(ptr + 10) & 0x80) {
od->parentstate = 1; // it's 0x10 in the original code
} else {
od->parentstate = 0;
}
od->parent = *(ptr + 12); od->parent = *(ptr + 12);
if (_features & GF_AFTER_V3) {
od->walk_x = *(ptr + 13);
od->walk_y = *(ptr + 14);
od->actordir = (*(ptr + 15)) & 7;
od->height = *(ptr + 15) & 0xf8;
od->parentstate = (*(ptr + 10) & 0x80) >> 4;
} else {
od->walk_x = READ_LE_UINT16(ptr + 13); od->walk_x = READ_LE_UINT16(ptr + 13);
od->walk_y = READ_LE_UINT16(ptr + 15); od->walk_y = READ_LE_UINT16(ptr + 15);
od->actordir = (*(ptr + 17)) & 7; od->actordir = (*(ptr + 17)) & 7;
od->height = *(ptr + 17) & 0xf8;
if (*(ptr + 10) & 0x80) {
od->parentstate = 1;
} else {
od->parentstate = 0;
}
}
return; return;
} }

View file

@ -905,7 +905,7 @@ void Scumm::initRoomSubBlocks() {
// //
// Find the room image data // Find the room image data
// //
if (_features & GF_OLD_BUNDLE) if (_features & GF_AFTER_V2)
_IM00_offs = READ_LE_UINT16(roomptr + 0x0A); _IM00_offs = READ_LE_UINT16(roomptr + 0x0A);
else if (_features & GF_SMALL_HEADER) else if (_features & GF_SMALL_HEADER)
_IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr; _IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr;
@ -926,7 +926,9 @@ void Scumm::initRoomSubBlocks() {
// //
// Look for an exit script // Look for an exit script
// //
if (_features & GF_OLD_BUNDLE) if (_features & GF_AFTER_V2)
_EXCD_offs = READ_LE_UINT16(roomptr + 0x18);
else if (_features & GF_OLD_BUNDLE)
_EXCD_offs = READ_LE_UINT16(roomptr + 0x19); _EXCD_offs = READ_LE_UINT16(roomptr + 0x19);
else { else {
ptr = findResourceData(MKID('EXCD'), roomResPtr); ptr = findResourceData(MKID('EXCD'), roomResPtr);
@ -939,7 +941,9 @@ void Scumm::initRoomSubBlocks() {
// //
// Look for an entry script // Look for an entry script
// //
if (_features & GF_OLD_BUNDLE) if (_features & GF_AFTER_V2)
_ENCD_offs = READ_LE_UINT16(roomptr + 0x1C);
else if (_features & GF_OLD_BUNDLE)
_ENCD_offs = READ_LE_UINT16(roomptr + 0x1B); _ENCD_offs = READ_LE_UINT16(roomptr + 0x1B);
else { else {
ptr = findResourceData(MKID('ENCD'), roomResPtr); ptr = findResourceData(MKID('ENCD'), roomResPtr);
@ -953,7 +957,9 @@ void Scumm::initRoomSubBlocks() {
// Load box data // Load box data
// //
if (_features & GF_SMALL_HEADER) { if (_features & GF_SMALL_HEADER) {
if (_features & GF_OLD_BUNDLE) if (_features & GF_AFTER_V2)
ptr = roomptr + *(roomptr + 0x15);
else if (_features & GF_OLD_BUNDLE)
ptr = roomptr + READ_LE_UINT16(roomptr + 0x15); ptr = roomptr + READ_LE_UINT16(roomptr + 0x15);
else else
ptr = findResourceData(MKID('BOXD'), roomptr); ptr = findResourceData(MKID('BOXD'), roomptr);
@ -968,7 +974,9 @@ void Scumm::initRoomSubBlocks() {
createResource(rtMatrix, 2, size); createResource(rtMatrix, 2, size);
memcpy(getResourceAddress(rtMatrix, 2), ptr, size); memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
ptr += size; ptr += size;
if (_features & GF_OLD_BUNDLE) if (_features & GF_AFTER_V2)
size = (READ_LE_UINT16(roomptr + 0x0A) - *(roomptr + 0x15)) - size;
else if (_features & GF_OLD_BUNDLE)
// FIXME. This is an evil HACK!!! // FIXME. This is an evil HACK!!!
size = (READ_LE_UINT16(roomptr + 0x0A) - READ_LE_UINT16(roomptr + 0x15)) - size; size = (READ_LE_UINT16(roomptr + 0x0A) - READ_LE_UINT16(roomptr + 0x15)) - size;
else else
@ -1043,11 +1051,23 @@ void Scumm::initRoomSubBlocks() {
if (_features & GF_OLD_BUNDLE) { if (_features & GF_OLD_BUNDLE) {
int num_objects = *(roomResPtr + 20); int num_objects = *(roomResPtr + 20);
int num_sounds = *(roomResPtr + 23); int num_sounds;
int num_scripts = *(roomResPtr + 24); int num_scripts;
ptr = roomptr + 29 + num_objects * 4 + num_sounds + num_scripts;
if ((_gameId != GID_MANIAC) && (_gameId != GID_ZAK)) { if (_features & GF_AFTER_V2) {
num_sounds = *(roomResPtr + 22);
num_scripts = *(roomResPtr + 23);
ptr = roomptr + 28 + num_objects * 4;
while (num_sounds--)
loadResource(rtSound, *ptr++);
while (num_scripts--)
loadResource(rtScript, *ptr++);
}
if (!(_features & GF_AFTER_V2)) {
num_sounds = *(roomResPtr + 23);
num_scripts = *(roomResPtr + 24);
ptr = roomptr + 29 + num_objects * 4 + num_sounds + num_scripts;
while (*ptr) { while (*ptr) {
int id = *ptr; int id = *ptr;