diff options
Diffstat (limited to 'engines/neverhood')
-rw-r--r-- | engines/neverhood/neverhood.cpp | 8 | ||||
-rw-r--r-- | engines/neverhood/resource.cpp | 29 | ||||
-rw-r--r-- | engines/neverhood/resource.h | 5 | ||||
-rw-r--r-- | engines/neverhood/sprite.cpp | 4 |
4 files changed, 22 insertions, 24 deletions
diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 631b0506b1..1a738c1ba9 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -251,15 +251,15 @@ void NeverhoodEngine::dumpAllResources() { anim.load(entry.archiveEntry->fileHash); for (uint frameIndex = 0; frameIndex < anim.getFrameCount(); frameIndex++) { const AnimFrameInfo &frameInfo = anim.getFrameInfo(frameIndex); - int16 width = (frameInfo.rect.width + 3) & 0xFFFC; - byte *pixels = new byte[width * frameInfo.rect.height]; - memset(pixels, 0, width * frameInfo.rect.height); + int16 width = (frameInfo.drawOffset.width + 3) & 0xFFFC; + byte *pixels = new byte[width * frameInfo.drawOffset.height]; + memset(pixels, 0, width * frameInfo.drawOffset.height); anim.draw(frameIndex, pixels, width, false, false); Common::String filename = frameInfo.frameHash != 0 ? Common::String::format("%08X_%03d_%08X.tga", entry.archiveEntry->fileHash, frameIndex, frameInfo.frameHash) : Common::String::format("%08X_%03d.tga", entry.archiveEntry->fileHash, frameIndex); - writeTga(filename.c_str(), pixels, vgaPalette, width, frameInfo.rect.height); + writeTga(filename.c_str(), pixels, vgaPalette, width, frameInfo.drawOffset.height); delete[] pixels; } } diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp index aff3528b45..1246472926 100644 --- a/engines/neverhood/resource.cpp +++ b/engines/neverhood/resource.cpp @@ -160,8 +160,8 @@ AnimResource::~AnimResource() { void AnimResource::draw(uint frameIndex, byte *dest, int destPitch, bool flipX, bool flipY) { const AnimFrameInfo frameInfo = _frames[frameIndex]; _currSpriteData = _spriteData + frameInfo.spriteDataOffs; - _width = frameInfo.rect.width; - _height = frameInfo.rect.height; + _width = frameInfo.drawOffset.width; + _height = frameInfo.drawOffset.height; if (_replEnabled && _replOldColor != _replNewColor) unpackSpriteRle(_currSpriteData, _width, _height, dest, destPitch, flipX, flipY, _replOldColor, _replNewColor); else @@ -235,24 +235,23 @@ bool AnimResource::load(uint32 fileHash) { AnimFrameInfo frameInfo; frameInfo.frameHash = READ_LE_UINT32(frameList); frameInfo.counter = READ_LE_UINT16(frameList + 4); - frameInfo.rect.x = READ_LE_UINT16(frameList + 6); - frameInfo.rect.y = READ_LE_UINT16(frameList + 8); - frameInfo.rect.width = READ_LE_UINT16(frameList + 10); - frameInfo.rect.height = READ_LE_UINT16(frameList + 12); + frameInfo.drawOffset.x = READ_LE_UINT16(frameList + 6); + frameInfo.drawOffset.y = READ_LE_UINT16(frameList + 8); + frameInfo.drawOffset.width = READ_LE_UINT16(frameList + 10); + frameInfo.drawOffset.height = READ_LE_UINT16(frameList + 12); frameInfo.deltaX = READ_LE_UINT16(frameList + 14); frameInfo.deltaY = READ_LE_UINT16(frameList + 16); - frameInfo.deltaRect.x = READ_LE_UINT16(frameList + 18); - frameInfo.deltaRect.y = READ_LE_UINT16(frameList + 20); - frameInfo.deltaRect.width = READ_LE_UINT16(frameList + 22); - frameInfo.deltaRect.height = READ_LE_UINT16(frameList + 24); - frameInfo.field_1A = READ_LE_UINT16(frameList + 26); + frameInfo.collisionBoundsOffset.x = READ_LE_UINT16(frameList + 18); + frameInfo.collisionBoundsOffset.y = READ_LE_UINT16(frameList + 20); + frameInfo.collisionBoundsOffset.width = READ_LE_UINT16(frameList + 22); + frameInfo.collisionBoundsOffset.height = READ_LE_UINT16(frameList + 24); frameInfo.spriteDataOffs = READ_LE_UINT32(frameList + 28); - debug(8, "frameHash = %08X; counter = %d; rect = (%d,%d,%d,%d); deltaX = %d; deltaY = %d; deltaRect = (%d,%d,%d,%d); field_1A = %04X; spriteDataOffs = %08X", + debug(8, "frameHash = %08X; counter = %d; rect = (%d,%d,%d,%d); deltaX = %d; deltaY = %d; collisionBoundsOffset = (%d,%d,%d,%d); spriteDataOffs = %08X", frameInfo.frameHash, frameInfo.counter, - frameInfo.rect.x, frameInfo.rect.y, frameInfo.rect.width, frameInfo.rect.height, + frameInfo.drawOffset.x, frameInfo.drawOffset.y, frameInfo.drawOffset.width, frameInfo.drawOffset.height, frameInfo.deltaX, frameInfo.deltaY, - frameInfo.deltaRect.x, frameInfo.deltaRect.y, frameInfo.deltaRect.width, frameInfo.deltaRect.height, - frameInfo.field_1A, frameInfo.spriteDataOffs); + frameInfo.collisionBoundsOffset.x, frameInfo.collisionBoundsOffset.y, frameInfo.collisionBoundsOffset.width, frameInfo.collisionBoundsOffset.height, + frameInfo.spriteDataOffs); frameList += 32; _frames.push_back(frameInfo); } diff --git a/engines/neverhood/resource.h b/engines/neverhood/resource.h index b49ee883b7..50a49e3bdc 100644 --- a/engines/neverhood/resource.h +++ b/engines/neverhood/resource.h @@ -68,10 +68,9 @@ protected: struct AnimFrameInfo { uint32 frameHash; int16 counter; - NDrawRect rect; + NDrawRect drawOffset; int16 deltaX, deltaY; - NDrawRect deltaRect; - uint16 field_1A; + NDrawRect collisionBoundsOffset; uint32 spriteDataOffs; }; diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index 0696aa6714..40b651e53b 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -408,10 +408,10 @@ void AnimatedSprite::updateFrameInfo() { debug(8, "AnimatedSprite::updateFrameInfo()"); const AnimFrameInfo &frameInfo = _animResource.getFrameInfo(_currFrameIndex); _frameChanged = true; - _drawOffset = frameInfo.rect; + _drawOffset = frameInfo.drawOffset; _deltaX = frameInfo.deltaX; _deltaY = frameInfo.deltaY; - _collisionBoundsOffset = frameInfo.deltaRect; + _collisionBoundsOffset = frameInfo.collisionBoundsOffset; _currFrameTicks = frameInfo.counter; updateBounds(); _needRefresh = true; |