From a601eb5bd800d544e8a5154a7b4d2457d020cd3f Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 22 Feb 2017 19:57:12 +0100 Subject: [PATCH] replaced function to draw graphic animation (MM engine) --- src/game_mm/mm_tools.c | 49 ++++++------------------------------------ src/game_mm/mm_tools.h | 4 +--- 2 files changed, 7 insertions(+), 46 deletions(-) diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index e037aac9..9f52eb73 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -17,9 +17,6 @@ #include "mm_tools.h" -/* forward declaration for internal use */ -static int getGraphicAnimationPhase_MM(int, int, int); - void ClearWindow() { ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); @@ -29,49 +26,15 @@ void ClearWindow() redraw_mask |= REDRAW_FIELD; } -static int getGraphicAnimationPhase_MM(int frames, int delay, int mode) -{ - int phase; - - if (mode == ANIM_PINGPONG) - { - int max_anim_frames = 2 * frames - 2; - phase = (FrameCounter % (delay * max_anim_frames)) / delay; - phase = (phase < frames ? phase : max_anim_frames - phase); - } - else - phase = (FrameCounter % (delay * frames)) / delay; - - if (mode == ANIM_REVERSE) - phase = -phase; - - return(phase); -} - -void DrawGraphicAnimationExt_MM(int x, int y, int graphic, - int frames, int delay, int mode, int mask_mode) +void DrawGraphicAnimation_MM(int x, int y, int graphic, int frame) { - int phase = getGraphicAnimationPhase_MM(frames, delay, mode); - - if (!(FrameCounter % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) - { - if (mask_mode == USE_MASKING) - DrawGraphicThruMask_MM(SCREENX(x), SCREENY(y), graphic + phase); - else - DrawGraphic_MM(SCREENX(x), SCREENY(y), graphic + phase); - } -} + Bitmap *bitmap; + int src_x, src_y; -void DrawGraphicAnimation_MM(int x, int y, int graphic, - int frames, int delay, int mode) -{ - DrawGraphicAnimationExt_MM(x, y, graphic, frames, delay, mode, NO_MASKING); -} + getGraphicSource(graphic, frame, &bitmap, &src_x, &src_y); -void DrawGraphicAnimationThruMask_MM(int x, int y, int graphic, - int frames, int delay, int mode) -{ - DrawGraphicAnimationExt_MM(x, y, graphic, frames, delay, mode, USE_MASKING); + BlitBitmap(bitmap, drawto_field, src_x, src_y, TILEX, TILEY, + FX + x * TILEX, FY + y * TILEY); } void DrawGraphic_MM(int x, int y, int graphic) diff --git a/src/game_mm/mm_tools.h b/src/game_mm/mm_tools.h index 39c58a8b..3655ccf4 100644 --- a/src/game_mm/mm_tools.h +++ b/src/game_mm/mm_tools.h @@ -72,9 +72,7 @@ void MarkTileDirty(int, int); void DrawAllPlayers_MM(void); void DrawPlayerField_MM(int, int); void DrawPlayer_MM(struct PlayerInfo *); -void DrawGraphicAnimationExt_MM(int, int, int, int, int, int, int); -void DrawGraphicAnimation_MM(int, int, int, int, int, int); -void DrawGraphicAnimationThruMask_MM(int, int, int, int, int, int); +void DrawGraphicAnimation_MM(int, int, int, int); void DrawGraphic_MM(int, int, int); void DrawGraphicExt_MM(DrawBuffer *, int, int, int); -- 2.34.1