aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/wsamovie.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2007-04-15 16:41:20 +0000
committerJohannes Schickel2007-04-15 16:41:20 +0000
commit21b2c7bceb5947e1eaa79890fe24f59def54aef9 (patch)
treed13d67e0c2c2db33651a51eb24679bac867a09d8 /engines/kyra/wsamovie.cpp
parente962db5b6d6856a31e52f7e3c4038a0f8f47e25d (diff)
downloadscummvm-rg350-21b2c7bceb5947e1eaa79890fe24f59def54aef9.tar.gz
scummvm-rg350-21b2c7bceb5947e1eaa79890fe24f59def54aef9.tar.bz2
scummvm-rg350-21b2c7bceb5947e1eaa79890fe24f59def54aef9.zip
Formatting/Cleanup.
svn-id: r26511
Diffstat (limited to 'engines/kyra/wsamovie.cpp')
-rw-r--r--engines/kyra/wsamovie.cpp62
1 files changed, 23 insertions, 39 deletions
diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp
index c682f4dc57..40023f169c 100644
--- a/engines/kyra/wsamovie.cpp
+++ b/engines/kyra/wsamovie.cpp
@@ -50,17 +50,15 @@ int WSAMovieV1::open(const char *filename, int offscreenDecode, uint8 *palBuf) {
_deltaBufferSize = READ_LE_UINT16(wsaData); wsaData += 2;
_offscreenBuffer = NULL;
_flags = 0;
- if (_vm->gameFlags().useAltShapeHeader) {
+ if (_vm->gameFlags().useAltShapeHeader)
flags = READ_LE_UINT16(wsaData); wsaData += 2;
- }
uint32 offsPal = 0;
if (flags & 1) {
offsPal = 0x300;
_flags |= WF_HAS_PALETTE;
- if (palBuf) {
+ if (palBuf)
memcpy(palBuf, wsaData + (_numFrames + 2) * 4, 0x300);
- }
}
if (offscreenDecode) {
@@ -107,9 +105,8 @@ int WSAMovieV1::open(const char *filename, int offscreenDecode, uint8 *palBuf) {
memcpy(_frameData, wsaData, frameDataSize);
// decode first frame
- if (firstFrame) {
+ if (firstFrame)
Screen::decodeFrame4(_frameData, _deltaBuffer, _deltaBufferSize);
- }
delete [] p;
_opened = true;
@@ -134,19 +131,17 @@ void WSAMovieV1::displayFrame(int frameNum) {
return;
uint8 *dst;
- if (_flags & WF_OFFSCREEN_DECODE) {
+ if (_flags & WF_OFFSCREEN_DECODE)
dst = _offscreenBuffer;
- } else {
+ else
dst = _vm->screen()->getPageRect(_drawPage, _x, _y, _width, _height);
- }
if (_currentFrame == _numFrames) {
if (!(_flags & WF_NO_FIRST_FRAME)) {
- if (_flags & WF_OFFSCREEN_DECODE) {
+ if (_flags & WF_OFFSCREEN_DECODE)
Screen::decodeFrameDelta(dst, _deltaBuffer);
- } else {
+ else
Screen::decodeFrameDeltaPage(dst, _deltaBuffer, _width, (_flags & WF_XOR) == 0);
- }
}
_currentFrame = 0;
}
@@ -157,11 +152,10 @@ void WSAMovieV1::displayFrame(int frameNum) {
int frameCount;
if (_currentFrame < frameNum) {
frameCount = _numFrames - frameNum + _currentFrame;
- if (diffCount > frameCount) {
+ if (diffCount > frameCount)
frameStep = -1;
- } else {
+ else
frameCount = diffCount;
- }
} else {
frameCount = _numFrames - _currentFrame + frameNum;
if (frameCount >= diffCount) {
@@ -176,16 +170,14 @@ void WSAMovieV1::displayFrame(int frameNum) {
while (frameCount--) {
cf += frameStep;
processFrame(cf, dst);
- if (cf == _numFrames) {
+ if (cf == _numFrames)
cf = 0;
- }
}
} else {
uint16 cf = _currentFrame;
while (frameCount--) {
- if (cf == 0) {
+ if (cf == 0)
cf = _numFrames;
- }
processFrame(cf, dst);
cf += frameStep;
}
@@ -193,9 +185,8 @@ void WSAMovieV1::displayFrame(int frameNum) {
// display
_currentFrame = frameNum;
- if (_flags & WF_OFFSCREEN_DECODE) {
+ if (_flags & WF_OFFSCREEN_DECODE)
_vm->screen()->copyBlockToPage(_drawPage, _x, _y, _width, _height, _offscreenBuffer);
- }
}
void WSAMovieV1::processFrame(int frameNum, uint8 *dst) {
@@ -205,11 +196,10 @@ void WSAMovieV1::processFrame(int frameNum, uint8 *dst) {
assert(frameNum <= _numFrames);
const uint8 *src = _frameData + _frameOffsTable[frameNum];
Screen::decodeFrame4(src, _deltaBuffer, _deltaBufferSize);
- if (_flags & WF_OFFSCREEN_DECODE) {
+ if (_flags & WF_OFFSCREEN_DECODE)
Screen::decodeFrameDelta(dst, _deltaBuffer);
- } else {
+ else
Screen::decodeFrameDeltaPage(dst, _deltaBuffer, _width, false);
- }
}
#pragma mark -
@@ -256,9 +246,8 @@ void WSAMovieAmiga::displayFrame(int frameNum) {
const uint8 *src = _buffer;
int size = _width * _height;
- for (int i = 0; i < size; ++i) {
+ for (int i = 0; i < size; ++i)
*dst++ ^= *src++;
- }
dst = _buffer;
} else {
@@ -274,11 +263,10 @@ void WSAMovieAmiga::displayFrame(int frameNum) {
int frameCount;
if (_currentFrame < frameNum) {
frameCount = _numFrames - frameNum + _currentFrame;
- if (diffCount > frameCount) {
+ if (diffCount > frameCount)
frameStep = -1;
- } else {
+ else
frameCount = diffCount;
- }
} else {
frameCount = _numFrames - _currentFrame + frameNum;
if (frameCount >= diffCount) {
@@ -293,16 +281,14 @@ void WSAMovieAmiga::displayFrame(int frameNum) {
while (frameCount--) {
cf += frameStep;
processFrame(cf, dst);
- if (cf == _numFrames) {
+ if (cf == _numFrames)
cf = 0;
- }
}
} else {
uint16 cf = _currentFrame;
while (frameCount--) {
- if (cf == 0) {
+ if (cf == 0)
cf = _numFrames;
- }
processFrame(cf, dst);
cf += frameStep;
}
@@ -310,9 +296,8 @@ void WSAMovieAmiga::displayFrame(int frameNum) {
// display
_currentFrame = frameNum;
- if (_flags & WF_OFFSCREEN_DECODE) {
+ if (_flags & WF_OFFSCREEN_DECODE)
_vm->screen()->copyBlockToPage(_drawPage, _x, _y, _width, _height, _offscreenBuffer);
- }
}
void WSAMovieAmiga::processFrame(int frameNum, uint8 *dst) {
@@ -340,9 +325,8 @@ void WSAMovieAmiga::processFrame(int frameNum, uint8 *dst) {
}
for (int y = 0; y < _height; ++y) {
- for (int x = 0; x < _width; ++x) {
+ for (int x = 0; x < _width; ++x)
*dst++ ^= *src++;
- }
dst += dstPitch - _width;
}
}
@@ -378,9 +362,8 @@ int WSAMovieV2::open(const char *filename, int unk1, uint8 *palBuf) {
if (flags & 1) {
offsPal = 0x300;
_flags |= WF_HAS_PALETTE;
- if (palBuf) {
+ if (palBuf)
memcpy(palBuf, wsaData + 8 + ((_numFrames << 2) & 0xFFFF), 0x300);
- }
}
if (flags & 2)
@@ -430,3 +413,4 @@ int WSAMovieV2::open(const char *filename, int unk1, uint8 *palBuf) {
}
} // end of namespace Kyra
+