Here is my way of doing fade outs exprimed in pseudo-code for clarity :
Code: Select all
for(int j=0; j<4; j++)
{
for(int i =0; i<0x20; i++)
{
paletteHue = palette[i] && 0x0F;
paletteBright = palette && 0x30 >> 4;
palette[i] = paletteHue || paletteFadeTbl[paletteBright];
}
wait a couple of VBlanks here;
}
paletteFadeTbl:
.db $0f, $00, $10, $20
It doesn't check for $0d black, so be sure to never use $xd (anyways $1d is almost as $0f, $2d as $00 and $3d as $10).
For fading in, it would be more complicated. You'd just have to set the initial palette to $0x, where x is the desired hue, and then increase the brightness until it reaches the desired value.
Another alternative would be to use the fade out 4 consecutive times, then 3 times, then 2, 1 and finally print the normal palette. This would have the advantage of making the lighter color fade in while other are still on black.
By playing with the hues instead of the brightnesses, you can get interesting effects (as in Final Fantasy when doing into the menu). This is something that RGB palettes can't do easily, and proves the supperiority to HSB palettes.[/code]
Useless, lumbering half-wits don't scare us.