aboutsummaryrefslogtreecommitdiff
path: root/engines/tucker/sequences.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-19 21:42:34 +0100
committerJohannes Schickel2011-02-19 21:46:45 +0100
commite21d6e0d1120e917a4a019a4070ec4db5e988b9b (patch)
tree1142828b72ccf17d513c621e108d749f148fd32b /engines/tucker/sequences.cpp
parent32d0e4c15fb33f80db194087850466664a43516a (diff)
parentb26f30b98793c522265a3eeb48fb3b41034663c6 (diff)
downloadscummvm-rg350-e21d6e0d1120e917a4a019a4070ec4db5e988b9b.tar.gz
scummvm-rg350-e21d6e0d1120e917a4a019a4070ec4db5e988b9b.tar.bz2
scummvm-rg350-e21d6e0d1120e917a4a019a4070ec4db5e988b9b.zip
Merge branch 'osystem-palette' of https://github.com/lordhoto/scummvm into master
Conflicts: backends/platform/android/android.cpp engines/sci/graphics/screen.cpp engines/sci/graphics/transitions.cpp
Diffstat (limited to 'engines/tucker/sequences.cpp')
-rw-r--r--engines/tucker/sequences.cpp33
1 files changed, 10 insertions, 23 deletions
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 40706aee0f..5e99e3ccef 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -677,14 +677,14 @@ void AnimationSequencePlayer::updateSounds() {
}
void AnimationSequencePlayer::fadeInPalette() {
- uint8 paletteBuffer[256 * 4];
+ uint8 paletteBuffer[256 * 3];
memset(paletteBuffer, 0, sizeof(paletteBuffer));
bool fadeColors = true;
for (int step = 0; step < 64; ++step) {
if (fadeColors) {
fadeColors = false;
- for (int i = 0; i < 1024; ++i) {
- if ((i & 3) != 3 && paletteBuffer[i] < _animationPalette[i]) {
+ for (int i = 0; i < 3*256; ++i) {
+ if (paletteBuffer[i] < _animationPalette[i]) {
const int color = paletteBuffer[i] + 4;
paletteBuffer[i] = MIN<int>(color, _animationPalette[i]);
fadeColors = true;
@@ -698,14 +698,14 @@ void AnimationSequencePlayer::fadeInPalette() {
}
void AnimationSequencePlayer::fadeOutPalette() {
- uint8 paletteBuffer[256 * 4];
- memcpy(paletteBuffer, _animationPalette, 1024);
+ uint8 paletteBuffer[256 * 3];
+ memcpy(paletteBuffer, _animationPalette, 3*256);
bool fadeColors = true;
for (int step = 0; step < 64; ++step) {
if (fadeColors) {
fadeColors = false;
- for (int i = 0; i < 1024; ++i) {
- if ((i & 3) != 3 && paletteBuffer[i] > 0) {
+ for (int i = 0; i < 3*256; ++i) {
+ if (paletteBuffer[i] > 0) {
const int color = paletteBuffer[i] - 4;
paletteBuffer[i] = MAX<int>(0, color);
fadeColors = true;
@@ -741,13 +741,7 @@ uint8 *AnimationSequencePlayer::loadPicture(const char *fileName) {
}
void AnimationSequencePlayer::getRGBPalette(int index) {
- const byte *rgbPalette = _flicPlayer[index].getPalette();
- for (int i = 0; i < 256; i++) {
- _animationPalette[i * 4 + 0] = rgbPalette[i * 3 + 0];
- _animationPalette[i * 4 + 1] = rgbPalette[i * 3 + 1];
- _animationPalette[i * 4 + 2] = rgbPalette[i * 3 + 2];
- _animationPalette[i * 4 + 3] = 0;
- }
+ memcpy(_animationPalette, _flicPlayer[index].getPalette(), 3 * 256);
}
void AnimationSequencePlayer::openAnimation(int index, const char *fileName) {
@@ -827,9 +821,7 @@ void AnimationSequencePlayer::displayLoadingScreen() {
if (f.open("graphics/loading.pic")) {
fadeOutPalette();
f.seek(32);
- for (int i = 0; i < 1024; i += 4) {
- f.read(_animationPalette + i, 3);
- }
+ f.read(_animationPalette, 3 * 256);
f.read(_offscreenBuffer, 64000);
_system->copyRectToScreen(_offscreenBuffer, 320, 0, 0, kScreenWidth, kScreenHeight);
fadeInPalette();
@@ -846,12 +838,7 @@ void AnimationSequencePlayer::initPicPart4() {
void AnimationSequencePlayer::drawPicPart4() {
static const uint8 offsets[] = { 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 };
if (_updateScreenIndex == -1) {
- for (int i = 0; i < 256; ++i) {
- if (memcmp(_animationPalette + i * 4, _picBufPtr + 32 + i * 3, 3) != 0) {
- memcpy(_animationPalette + i * 4, _picBufPtr + 32 + i * 3, 3);
- _animationPalette[i * 4 + 3] = 0;
- }
- }
+ memcpy(_animationPalette, _picBufPtr + 32, 3 * 256);
}
if (_updateScreenCounter == 0) {
static const uint8 counter[] = { 1, 2, 3, 4, 5, 35, 5, 4, 3, 2, 1 };