USHORT clut[65537][21];
int clutx, cluty;
for (clutx=0; clutx<65536; clutx++)
{
for (cluty=0; cluty<20; cluty++)
{
clut[clutx][cluty] =(int) (clutx * (float)(cluty/20));
}
}
Here's the function that does the lookup and does the fade.
void ApplyFade(int pct, USHORT* fadebuffer, int pitch)
{
int x, y;
USHORT* temp = fadebuffer;
int jump = pitch - 200;
int index;
for (y=0; y<200; y++)
{
for (x=0; x<200; x++, temp++) // move pointer to next pixel each time
{
index=pct/5;
*temp = clut[*temp][index];
}
// move pointer to beginning of next line
temp+=jump;
}
}
All that happens is it crashes back to windows when I perform the fade. Is this code anywhere near correct?
Need help? Well, go FAQ yourself. What a plight we who try to make a story-based game have...writers of conventional media have words, we have but binary numbers Edited by - Nazrix on February 17, 2001 6:41:06 PM