void ScreenEffects::stepBlendedPalette() { if (_blendedPaletteStatus._active && _blendedPaletteStatus._value < _blendedPaletteStatus._maxValue) { setBlendedPalette(_blendedPaletteStatus._palette, _blendedPaletteStatus._newPalette, _blendedPaletteStatus._colorCount, _blendedPaletteStatus._value, _blendedPaletteStatus._maxValue); if (_blendedPaletteStatus._value == _blendedPaletteStatus._maxValue) _blendedPaletteStatus._value++; else _blendedPaletteStatus._value = MIN<int16>(_blendedPaletteStatus._value + _blendedPaletteStatus._incr, _blendedPaletteStatus._maxValue); } }
// "Checkerboard" effect void ScreenEffects::vfx09(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { for (int i = 0; i < 8; i++) { copyFxRect(surface, 0, 0, 320, 200); // We set the final palette here, once setBlendedPalette(palette, newPalette, colorCount, i * 4 + 3, 32); // The original behavior follows - the end result is the same, though //for (int j = 0; j < 4; j++) // setBlendedPalette(palette, newPalette, colorCount, i * 4 + j, 32); _screen->updateScreenAndWait(25); } setPalette(palette); }
// Palette fadeout/fadein void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { byte tempPalette[768]; bool savedPaletteLock = _screen->isPaletteLocked(); _screen->setPaletteLock(false); memcpy(tempPalette, palette, 768); // We reduce the number of palette updates by the following factor (e.g. a factor of 5 would mean 5 // times less updates). This is done to reduce CPU load while performing the very expensive full // screen palette changes. The original behavior is to set factor to 1. int factor = 5; // Fade out to black memset(palette, 0, 768); for (int i = 0; i < 50 / factor; i++) { setBlendedPalette(palette, newPalette, colorCount, i * factor, 50); _screen->updateScreenAndWait(25 * factor); } _screen->setRGBPalette(palette, 0, colorCount); memcpy(palette, tempPalette, 768); _screen->showWorkScreen(); // Fade from black to palette memset(newPalette, 0, 768); for (int i = 0; i < 50 / factor; i++) { setBlendedPalette(palette, newPalette, colorCount, i * factor, 50); _screen->updateScreenAndWait(25 * factor); } _screen->setRGBPalette(palette, 0, colorCount); _screen->setPaletteLock(savedPaletteLock); }