From: Holger Schemel Date: Tue, 22 Mar 2016 09:21:58 +0000 (+0100) Subject: added drawing global borders when fading screens X-Git-Tag: 4.0.0.0-rc1~33 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2178db0a0652bc87717aa1a55c888258ad6701e5;p=rocksndiamonds.git added drawing global borders when fading screens --- diff --git a/src/init.c b/src/init.c index 149b4ef2..943839ed 100644 --- a/src/init.c +++ b/src/init.c @@ -5325,6 +5325,8 @@ void InitGfx() InitGfxDrawGlobalAnimFunction(DrawGlobalAnim); InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToTarget); + gfx.fade_border_source_status = global.border_status; + gfx.fade_border_target_status = global.border_status; gfx.masked_border_bitmap_ptr = backbuffer; /* use copy of busy animation to prevent change while reloading artwork */ diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 6b38ce15..2e03378d 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -1148,16 +1148,23 @@ void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, { SDL_BlitSurface(surface_cross, &src_rect, surface_source, &src_rect); SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect); + + draw_global_border_function(DRAW_BORDER_TO_FADE_SOURCE); + draw_global_border_function(DRAW_BORDER_TO_FADE_TARGET); } else if (fade_mode & FADE_TYPE_FADE_IN) { SDL_BlitSurface(surface_black, &src_rect, surface_source, &src_rect); SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect); + + draw_global_border_function(DRAW_BORDER_TO_FADE_TARGET); } else /* FADE_TYPE_FADE_OUT */ { SDL_BlitSurface(surface_screen, &dst_rect, surface_source, &src_rect); SDL_BlitSurface(surface_black, &src_rect, surface_target, &src_rect); + + draw_global_border_function(DRAW_BORDER_TO_FADE_SOURCE); } time_current = SDL_GetTicks(); diff --git a/src/libgame/system.h b/src/libgame/system.h index 7e6bcc1f..98aa9c73 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -172,6 +172,8 @@ /* values for drawing target for global border */ #define DRAW_BORDER_TO_BACKBUFFER 0 #define DRAW_BORDER_TO_SCREEN 1 +#define DRAW_BORDER_TO_FADE_SOURCE 2 +#define DRAW_BORDER_TO_FADE_TARGET 3 /* values for move directions and special "button" key bitmasks */ #define MV_NONE 0 @@ -819,6 +821,8 @@ struct GfxInfo Bitmap *fade_bitmap_target; Bitmap *fade_bitmap_black; + int fade_border_source_status; + int fade_border_target_status; Bitmap *masked_border_bitmap_ptr; #if USE_FINAL_SCREEN_BITMAP diff --git a/src/tools.c b/src/tools.c index d72c99d0..3dcf88af 100644 --- a/src/tools.c +++ b/src/tools.c @@ -384,7 +384,30 @@ void DrawMaskedBorder(int redraw_mask) void DrawMaskedBorderToTarget(int draw_target) { - DrawMaskedBorderExt(REDRAW_ALL, draw_target); + if (draw_target == DRAW_BORDER_TO_SCREEN) + { + DrawMaskedBorderExt(REDRAW_ALL, draw_target); + } + else + { + int last_border_status = global.border_status; + + if (draw_target == DRAW_BORDER_TO_FADE_SOURCE) + { + global.border_status = gfx.fade_border_source_status; + gfx.masked_border_bitmap_ptr = gfx.fade_bitmap_source; + } + else + { + global.border_status = gfx.fade_border_target_status; + gfx.masked_border_bitmap_ptr = gfx.fade_bitmap_target; + } + + DrawMaskedBorderExt(REDRAW_ALL, draw_target); + + global.border_status = last_border_status; + gfx.masked_border_bitmap_ptr = backbuffer; + } } void BlitScreenToBitmap_RND(Bitmap *target_bitmap) @@ -689,6 +712,9 @@ static void SetScreenStates_BeforeFadingIn() static void SetScreenStates_AfterFadingIn() { + // store new source screen (to use correct masked border for fading) + gfx.fade_border_source_status = global.border_status; + global.anim_status = global.anim_status_next; // force update of global animation status in case of rapid screen changes @@ -698,6 +724,9 @@ static void SetScreenStates_AfterFadingIn() static void SetScreenStates_BeforeFadingOut() { + // store new target screen (to use correct masked border for fading) + gfx.fade_border_target_status = game_status; + global.anim_status = GAME_MODE_PSEUDO_FADING; }