aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-15 22:14:23 +0100
committerJohannes Schickel2011-02-15 22:16:48 +0100
commit83f66284a71b496f761b06d675dd9637d863809f (patch)
treecfde23e57dbc582180f679352ea722bd958f34d1 /engines
parent2e9bf212e889de78c66d9c4e3564327727389e6e (diff)
downloadscummvm-rg350-83f66284a71b496f761b06d675dd9637d863809f.tar.gz
scummvm-rg350-83f66284a71b496f761b06d675dd9637d863809f.tar.bz2
scummvm-rg350-83f66284a71b496f761b06d675dd9637d863809f.zip
SWORD1: Adapt to setPalette RGBA->RGB change.
Diffstat (limited to 'engines')
-rw-r--r--engines/sword1/animation.cpp2
-rw-r--r--engines/sword1/control.cpp20
-rw-r--r--engines/sword1/screen.cpp16
-rw-r--r--engines/sword1/screen.h4
4 files changed, 21 insertions, 21 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index fa876b565f..60176be1a9 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -174,7 +174,7 @@ void MoviePlayer::play() {
// previous location would be momentarily drawn, before switching to
// the new one. Work around this by setting the palette to black.
- byte pal[4 * 256];
+ byte pal[3 * 256];
memset(pal, 0, sizeof(pal));
_system->getPaletteManager()->setPalette(pal, 0, 256);
}
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index c61d0b7c85..d4f6bfd1fe 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -248,13 +248,13 @@ void Control::askForCd() {
fontId = CZECH_SR_FONT;
_font = (uint8*)_resMan->openFetchRes(fontId);
uint8 *pal = (uint8*)_resMan->openFetchRes(SR_PALETTE);
- uint8 *palOut = (uint8*)malloc(256 * 4);
+ uint8 *palOut = (uint8*)malloc(256 * 3);
for (uint16 cnt = 1; cnt < 256; cnt++) {
- palOut[cnt * 4 + 0] = pal[cnt * 3 + 0] << 2;
- palOut[cnt * 4 + 1] = pal[cnt * 3 + 1] << 2;
- palOut[cnt * 4 + 2] = pal[cnt * 3 + 2] << 2;
+ palOut[cnt * 3 + 0] = pal[cnt * 3 + 0] << 2;
+ palOut[cnt * 3 + 1] = pal[cnt * 3 + 1] << 2;
+ palOut[cnt * 3 + 2] = pal[cnt * 3 + 2] << 2;
}
- palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
+ palOut[0] = palOut[1] = palOut[2] = 0;
_resMan->resClose(SR_PALETTE);
_system->getPaletteManager()->setPalette(palOut, 0, 256);
free(palOut);
@@ -318,13 +318,13 @@ uint8 Control::runPanel() {
_redFont = (uint8*)_resMan->openFetchRes(redFontId);
uint8 *pal = (uint8*)_resMan->openFetchRes(SR_PALETTE);
- uint8 *palOut = (uint8*)malloc(256 * 4);
+ uint8 *palOut = (uint8*)malloc(256 * 3);
for (uint16 cnt = 1; cnt < 256; cnt++) {
- palOut[cnt * 4 + 0] = pal[cnt * 3 + 0] << 2;
- palOut[cnt * 4 + 1] = pal[cnt * 3 + 1] << 2;
- palOut[cnt * 4 + 2] = pal[cnt * 3 + 2] << 2;
+ palOut[cnt * 3 + 0] = pal[cnt * 3 + 0] << 2;
+ palOut[cnt * 3 + 1] = pal[cnt * 3 + 1] << 2;
+ palOut[cnt * 3 + 2] = pal[cnt * 3 + 2] << 2;
}
- palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
+ palOut[0] = palOut[1] = palOut[2] = 0;
_resMan->resClose(SR_PALETTE);
_system->getPaletteManager()->setPalette(palOut, 0, 256);
free(palOut);
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index 031ab74d9a..24fd5b502f 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -144,19 +144,19 @@ void Screen::fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp) {
}
for (uint32 cnt = 0; cnt < length; cnt++) {
- _targetPalette[(start + cnt) * 4 + 0] = palData[cnt * 3 + 0] << 2;
- _targetPalette[(start + cnt) * 4 + 1] = palData[cnt * 3 + 1] << 2;
- _targetPalette[(start + cnt) * 4 + 2] = palData[cnt * 3 + 2] << 2;
+ _targetPalette[(start + cnt) * 3 + 0] = palData[cnt * 3 + 0] << 2;
+ _targetPalette[(start + cnt) * 3 + 1] = palData[cnt * 3 + 1] << 2;
+ _targetPalette[(start + cnt) * 3 + 2] = palData[cnt * 3 + 2] << 2;
}
_resMan->resClose(id);
_isBlack = false;
if (fadeUp) {
_fadingStep = 1;
_fadingDirection = FADE_UP;
- memset(_currentPalette, 0, 256 * 4);
+ memset(_currentPalette, 0, 256 * 3);
_system->getPaletteManager()->setPalette(_currentPalette, 0, 256);
} else
- _system->getPaletteManager()->setPalette(_targetPalette + 4 * start, start, length);
+ _system->getPaletteManager()->setPalette(_targetPalette + 3 * start, start, length);
}
void Screen::fullRefresh() {
@@ -1125,11 +1125,11 @@ void Screen::flushPsxCache() {
void Screen::fadePalette() {
if (_fadingStep == 16)
- memcpy(_currentPalette, _targetPalette, 256 * 4);
+ memcpy(_currentPalette, _targetPalette, 256 * 3);
else if ((_fadingStep == 1) && (_fadingDirection == FADE_DOWN)) {
- memset(_currentPalette, 0, 4 * 256);
+ memset(_currentPalette, 0, 3 * 256);
} else
- for (uint16 cnt = 0; cnt < 256 * 4; cnt++)
+ for (uint16 cnt = 0; cnt < 256 * 3; cnt++)
_currentPalette[cnt] = (_targetPalette[cnt] * _fadingStep) >> 4;
_fadingStep += _fadingDirection;
diff --git a/engines/sword1/screen.h b/engines/sword1/screen.h
index fc998c6f28..88326a730e 100644
--- a/engines/sword1/screen.h
+++ b/engines/sword1/screen.h
@@ -161,8 +161,8 @@ private:
static RoomDef _roomDefTable[TOTAL_ROOMS]; // from ROOMS.C (not const, see fnSetParallax)
- uint8 _targetPalette[256 * 4];
- uint8 _currentPalette[256 * 4]; // for fading
+ uint8 _targetPalette[256 * 3];
+ uint8 _currentPalette[256 * 3]; // for fading
uint8 _fadingStep;
int8 _fadingDirection; // 1 for fade up, -1 for fade down
bool _isBlack; // if the logic already faded down the palette, this is set to show the