From: Holger Schemel Date: Tue, 2 May 2006 00:21:47 +0000 (+0200) Subject: rnd-20060502-2-src X-Git-Tag: 3.2.0^2~23 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9a3b7326f0a20338806bcdc48fe52eb7c2dcaa8e;p=rocksndiamonds.git rnd-20060502-2-src * fixed bug with title (cross)fading in/out when using fullscreen mode --- diff --git a/ChangeLog b/ChangeLog index d384efea..fe3a3bf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-05-02 + * fixed bug with title (cross)fading in/out when using fullscreen mode + 2006-04-30 * fixed bug that forced re-defining of menu settings in local graphics config file which are already defined in existing base config file diff --git a/src/conftime.h b/src/conftime.h index b1391284..2af8db3c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-05-02 01:42]" +#define COMPILE_DATE_STRING "[2006-05-02 02:18]" diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 14dac929..df3a0e34 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -275,11 +275,44 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, static SDL_Surface *surface_black = NULL; SDL_Surface *surface_screen = backbuffer->surface; SDL_Surface *surface_cross; /* initialized later */ - boolean fade_reverse; /* initialized later */ + SDL_Rect src_rect, dst_rect; + int src_x = 0, src_y = 0; + int dst_x = 0, dst_y = 0; + boolean fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE); unsigned int time_last, time_current; float alpha; int alpha_final; + src_rect.x = src_x; + src_rect.y = src_y; + src_rect.w = video.width; + src_rect.h = video.height; + +#ifdef FULLSCREEN_BUG + dst_x += video_xoffset; + dst_y += video_yoffset; +#endif + + dst_rect.x = dst_x; + dst_rect.y = dst_y; + dst_rect.w = video.width; + dst_rect.h = video.height; + +#if 0 + if (!initialization_needed) + { + /* check if screen size has changed (can happen when toggling fullscreen) */ + if (surface_screen_copy->w != surface_screen->w || + surface_screen_copy->h != surface_screen->h) + { + SDL_FreeSurface(surface_screen_copy); + SDL_FreeSurface(surface_black); + + initialization_needed = TRUE; + } + } +#endif + if (initialization_needed) { unsigned int flags = SDL_SRCALPHA; @@ -293,8 +326,13 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, /* create surface for temporary copy of screen buffer */ if ((surface_screen_copy = SDL_CreateRGBSurface(flags, +#if 1 + video.width, + video.height, +#else surface_screen->w, surface_screen->h, +#endif surface_screen->format->BitsPerPixel, surface_screen->format->Rmask, surface_screen->format->Gmask, @@ -305,8 +343,13 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, /* create black surface for fading from/to black */ if ((surface_black = SDL_CreateRGBSurface(flags, +#if 1 + video.width, + video.height, +#else surface_screen->w, surface_screen->h, +#endif surface_screen->format->BitsPerPixel, surface_screen->format->Rmask, surface_screen->format->Gmask, @@ -322,9 +365,8 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, } /* copy the current screen backbuffer to the temporary screen copy buffer */ - SDL_BlitSurface(surface_screen, NULL, surface_screen_copy, NULL); + SDL_BlitSurface(surface_screen, &dst_rect, surface_screen_copy, &src_rect); - fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE); surface_cross = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_cross->surface : surface_black); @@ -339,11 +381,11 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, alpha_final = MIN(MAX(0, alpha_final), 255); /* draw existing image to screen buffer */ - SDL_BlitSurface(surface_screen_copy, NULL, surface_screen, NULL); + SDL_BlitSurface(surface_screen_copy, &src_rect, surface_screen, &dst_rect); /* draw new image to screen buffer using alpha blending */ SDL_SetAlpha(surface_cross, SDL_SRCALPHA, alpha_final); - SDL_BlitSurface(surface_cross, NULL, surface_screen, NULL); + SDL_BlitSurface(surface_cross, &src_rect, surface_screen, &dst_rect); /* draw screen buffer to visible display */ SDL_Flip(surface_screen);