X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=2395cd042813bc7c043cbdb734eb44ca94380ec8;hb=e05dda5c8cc6687dcbc59e182a81aed627e262d0;hp=0b49269361786c66a276d69c78be4d887c238d6a;hpb=342de2ef2eff4f6936541b70d1eabf01f315fa47;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 0b492693..2395cd04 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -1,7 +1,7 @@ /*********************************************************** * Artsoft Retro-Game Library * *----------------------------------------------------------* -* (c) 1994-2002 Artsoft Entertainment * +* (c) 1994-2006 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -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);