Forum archive
Fadeouts, Polymost and nVidia
- In Unkillable, I have the fade routines (in/out) break out if Rendermode is nonzero, which would imply it's running in Polymost. This makes the game perfectly playable on nVidia adapters, but is there a way to do fades into a certain color (black, red) in Polymost that could actually work on an nVidia?
- setpalettefade() does that. Instead of tweaking the game palette yourself and using setbrightness() to update it, use setpalettefade() and give it the RGB and fade opacity value, and it'll do the job in 8-bit and OpenGL modes. Don;t pay much attention to setpalettefadeclamps() because I'm very likely going to remove that function when I sort out Duke's palette stuff.
Jonathon - Then why does, in my splash screen...
...that last, commented-out SetPaletteFade cause the screen to go black for the rest of the game on nVidias? It worked on my old compy...void Kawa_NerrdScreen()
{
char nerrdpal[768];
long fil;
OSD_Printf("Kawa_NerrdScreen()...\n");
if ((fil = kopen4load("p_nerrd.dat",0)) == -1) return;
kread(fil,nerrdpal,768);
kclose(fil);
setbrightness(brightness,(char *)&nerrdpal[0],0);
rotatesprite(0,0,65536L,0,NERRDLOGO,0,0,2+16+64,0L,0L,xdim-1L,ydim-1L);
nextpage();
fadein();
SOUND_DISKSYS;
while(1)
{
handleevents();
if(keystatus[0x1c]) { keystatus[0x1c]=0; goto CleanUp; }
if(keystatus[0x39]) { keystatus[0x39]=0; goto CleanUp; }
if(keystatus[0x01]) { keystatus[0x01]=0; goto CleanUp; }
}
CleanUp:
stopsound(16);
fadeout();
rotatesprite(0,0,65536L,0,EMPTYMENUSCREEN,0,1,2+16+64,0L,0L,xdim-1L,ydim-1L);
setbrightness(brightness,(char *)&palette[0],0);
//setpalettefade(0,0,0,64);
}
Also...
...with fadeIN basically the same, but in reverse.void fadeout()
{
int j;
if (getrendermode()) return; //don't do it in PolyMost mode
for(j=0;j<63;j+=1)
{
setpalettefade(0,0,0,(char)j);
nextpage();
}
} - There is no palette in OpenGL mode, so you can't tweak palette registers to make the palette change. You have to redraw the screen and then fade it, which setpalettefade() does by setting Polymost to draw a polygon over the whole screen of the given colour and opacity before it flips the frame in nextpage(). So, to do a fade out to black in GL Polymost, you would do something like:
opacity=0;
while (opacity < 64) {
drawthescreen();
setpalettefade(0,0,0,opacity);
opacity++;
nextpage();
waitatic();
}
Jonathon