mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 10:48:43 +00:00
NEVERHOOD: Fix palette fading
The palette didn't fade all the way to white when using the shrinking machine, which caused visible glitches. I've verified against a YouTube "Let's Play" that in the original it did fade all the way. Whether or not it did it in this exact way I do not know, but... close enough.
This commit is contained in:
parent
62246364c3
commit
cd2e204d99
@ -119,7 +119,7 @@ void Palette::startFadeToBlack(int counter) {
|
||||
_fadeToG = 0;
|
||||
_fadeToB = 0;
|
||||
_palCounter = counter;
|
||||
_fadeStep = 255 / counter;
|
||||
_fadeStep = calculateFadeStep(counter);
|
||||
_status = 1;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ void Palette::startFadeToWhite(int counter) {
|
||||
_fadeToG = 255;
|
||||
_fadeToB = 255;
|
||||
_palCounter = counter;
|
||||
_fadeStep = 255 / counter;
|
||||
_fadeStep = calculateFadeStep(counter);
|
||||
_status = 1;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ void Palette::startFadeToPalette(int counter) {
|
||||
if (counter == 0)
|
||||
counter = 1;
|
||||
_palCounter = counter;
|
||||
_fadeStep = 255 / counter;
|
||||
_fadeStep = calculateFadeStep(counter);
|
||||
_status = 2;
|
||||
}
|
||||
|
||||
@ -203,4 +203,11 @@ void Palette::fadeColor(byte *rgb, byte toR, byte toG, byte toB) {
|
||||
#undef FADE
|
||||
}
|
||||
|
||||
int Palette::calculateFadeStep(int counter) {
|
||||
int fadeStep = 255 / counter;
|
||||
if (255 % counter)
|
||||
fadeStep++;
|
||||
return fadeStep;
|
||||
}
|
||||
|
||||
} // End of namespace Neverhood
|
||||
|
@ -61,6 +61,7 @@ protected:
|
||||
int _fadeStep;
|
||||
void update();
|
||||
void fadeColor(byte *rgb, byte toR, byte toG, byte toB);
|
||||
int calculateFadeStep(int counter);
|
||||
};
|
||||
|
||||
} // End of namespace Neverhood
|
||||
|
Loading…
x
Reference in New Issue
Block a user