From 6cfb706faee5020fd6196889de27ddf3e07c4c80 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 7 Jun 2009 00:51:19 +0000 Subject: Fix WSA v2 code, now the automap remove WSA file in Lands of Lore plays correctly. svn-id: r41315 --- engines/kyra/wsamovie.cpp | 16 ++++++---------- engines/kyra/wsamovie.h | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp index fc33201d65..f7b4e9df1f 100644 --- a/engines/kyra/wsamovie.cpp +++ b/engines/kyra/wsamovie.cpp @@ -416,17 +416,13 @@ int WSAMovie_v2::open(const char *filename, int unk1, uint8 *palBuf) { for (int i = 1; i < _numFrames + 2; ++i) { _frameOffsTable[i] = READ_LE_UINT32(wsaData); + if (_frameOffsTable[i]) + _frameOffsTable[i] -= frameDataOffs; wsaData += 4; } - for (int i = 1; i < _numFrames; ++i) - _frameOffsTable[i] -= frameDataOffs; - - // WSA movies without last frame offset need special treatment - if (_frameOffsTable[_numFrames + 1]) - _frameOffsTable[_numFrames] -= frameDataOffs; - else - _frameOffsTable[_numFrames] = 0; + if (!_frameOffsTable[_numFrames + 1]) + _flags |= WF_NO_LAST_FRAME; // skip palette wsaData += offsPal; @@ -477,13 +473,13 @@ void WSAMovie_v2::displayFrame(int frameNum, int pageNum, int x, int y, ...) { int frameCount; if (_currentFrame < frameNum) { frameCount = _numFrames - frameNum + _currentFrame; - if (diffCount > frameCount) + if (diffCount > frameCount && !(_flags & WF_NO_LAST_FRAME)) frameStep = -1; else frameCount = diffCount; } else { frameCount = _numFrames - _currentFrame + frameNum; - if (frameCount >= diffCount) { + if (frameCount >= diffCount || (_flags & WF_NO_LAST_FRAME)) { frameStep = -1; frameCount = diffCount; } diff --git a/engines/kyra/wsamovie.h b/engines/kyra/wsamovie.h index ab6007f060..fdceca1cd8 100644 --- a/engines/kyra/wsamovie.h +++ b/engines/kyra/wsamovie.h @@ -80,6 +80,7 @@ public: enum WSAFlags { WF_OFFSCREEN_DECODE = 0x10, + WF_NO_LAST_FRAME = 0x20, WF_NO_FIRST_FRAME = 0x40, WF_HAS_PALETTE = 0x100, WF_XOR = 0x200 -- cgit v1.2.3