From: Holger Schemel Date: Wed, 16 Aug 2006 20:59:58 +0000 (+0200) Subject: rnd-20060816-4-src X-Git-Tag: 3.2.1^2~9 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=33816a6d8e5d9898e9cac269b6c5e647b03e5e85;p=rocksndiamonds.git rnd-20060816-4-src * code cleanup of new fading functions --- diff --git a/ChangeLog b/ChangeLog index 53c04a0a..c7fdd05a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-08-16 + * code cleanup of new fading functions + 2006-08-15 * changed behaviour after solved game -- do not immediately stop engine * added some more smooth screen fadings (game start, hall of fame etc.) diff --git a/src/conftime.h b/src/conftime.h index b6d2e6d0..d6874f3a 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-08-16 22:29]" +#define COMPILE_DATE_STRING "[2006-08-16 22:55]" diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 0b492693..a0232fc9 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -389,7 +389,6 @@ void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, SDL_Rect src_rect, dst_rect; int src_x = x, src_y = y; int dst_x = x, dst_y = y; - boolean fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE); unsigned int time_last, time_current; float alpha; int alpha_final; @@ -463,13 +462,18 @@ void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, /* copy source and target surfaces to temporary surfaces for fading */ if (fade_mode == FADE_MODE_CROSSFADE) { - SDL_BlitSurface(surface_cross, &src_rect, surface_source, &src_rect); + SDL_BlitSurface(surface_cross, &src_rect, surface_source, &src_rect); SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect); } - else + else if (fade_mode == FADE_MODE_FADE_IN) + { + SDL_BlitSurface(surface_black, &src_rect, surface_source, &src_rect); + SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect); + } + else /* FADE_MODE_FADE_OUT */ { SDL_BlitSurface(surface_screen, &dst_rect, surface_source, &src_rect); - SDL_BlitSurface(surface_black, &src_rect, surface_target, &src_rect); + SDL_BlitSurface(surface_black, &src_rect, surface_target, &src_rect); } time_current = SDL_GetTicks(); @@ -479,8 +483,7 @@ void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, time_last = time_current; time_current = SDL_GetTicks(); alpha += 255 * ((float)(time_current - time_last) / fade_delay); - alpha_final = (int)(fade_reverse ? 255.0 - alpha : alpha); - alpha_final = MIN(MAX(0, alpha_final), 255); + alpha_final = MIN(MAX(0, alpha), 255); /* draw existing (source) image to screen buffer */ SDL_BlitSurface(surface_source, &src_rect, surface_screen, &dst_rect);