Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
#define MAX_FPS 60
-static void fade_buf(SDL_Surface *screen, int amount)
+static void fade_buf(SDL_Surface *screen, double fade)
{
int i;
unsigned int *buf = screen->pixels;
unsigned char *b;
+ unsigned char amount;
+ static double threshold = 0;
+ threshold += fade;
+
+ if (threshold > 1) {
+ amount = threshold;
+ threshold -= amount;
+ } else {
+ return;
+ }
for (i = 0; i < screen->pitch * screen->h / sizeof(*buf); i ++) {
if (!buf[i])