From: Holger Schemel Date: Wed, 8 Feb 2023 19:53:07 +0000 (+0100) Subject: moved code to separate function X-Git-Tag: 4.3.5.0~7 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4c3c742532e3bee341c909bad60fc417c7c8ed23;p=rocksndiamonds.git moved code to separate function --- diff --git a/src/anim.c b/src/anim.c index 50075c83..1fb0672e 100644 --- a/src/anim.c +++ b/src/anim.c @@ -636,11 +636,28 @@ void InitGlobalAnimations(void) InitGlobalAnimControls(); } -static void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) +static void BlitGlobalAnimation(struct GraphicInfo *g, Bitmap *src_bitmap, + int src_x, int src_y, int width, int height, + int dst_x, int dst_y, int drawing_target) { + void (*blit_bitmap)(Bitmap *, Bitmap *, int, int, int, int, int, int) = + (g->draw_masked ? BlitBitmapMasked : BlitBitmap); + void (*blit_screen)(Bitmap *, int, int, int, int, int, int) = + (g->draw_masked ? BlitToScreenMasked : BlitToScreen); Bitmap *fade_bitmap = (drawing_target == DRAW_TO_FADE_SOURCE ? gfx.fade_bitmap_source : drawing_target == DRAW_TO_FADE_TARGET ? gfx.fade_bitmap_target : NULL); + + if (drawing_target == DRAW_TO_SCREEN) + blit_screen(src_bitmap, src_x, src_y, width, height, + dst_x, dst_y); + else + blit_bitmap(src_bitmap, fade_bitmap, src_x, src_y, width, height, + dst_x, dst_y); +} + +static void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) +{ int game_mode_anim_action[NUM_GAME_MODES]; int mode_nr; @@ -793,10 +810,6 @@ static void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) int cut_y = 0; int sync_frame; int frame; - void (*blit_bitmap)(Bitmap *, Bitmap *, int, int, int, int, int, int) = - (g->draw_masked ? BlitBitmapMasked : BlitBitmap); - void (*blit_screen)(Bitmap *, int, int, int, int, int, int) = - (g->draw_masked ? BlitToScreenMasked : BlitToScreen); int last_anim_random_frame = gfx.anim_random_frame; if (!(part->state & ANIM_STATE_RUNNING)) @@ -851,12 +864,8 @@ static void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) src_x += cut_x; src_y += cut_y; - if (drawing_target == DRAW_TO_SCREEN) - blit_screen(src_bitmap, src_x, src_y, width, height, - dst_x, dst_y); - else - blit_bitmap(src_bitmap, fade_bitmap, src_x, src_y, width, height, - dst_x, dst_y); + BlitGlobalAnimation(g, src_bitmap, src_x, src_y, width, height, + dst_x, dst_y, drawing_target); } } }