X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_tools.c;h=44fb257c855cea163f2f250e47083d2a9df7a653;hb=6d26e1e4259343003f378829a3f18ee5f7e7cdcd;hp=3fb8b4bb64da0b2f7e4e6a284c683368dcd6f510;hpb=a30a27ce6c313e56cc92dc7183d599f63f8ca1f2;p=rocksndiamonds.git diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index 3fb8b4bb..44fb257c 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -75,7 +75,9 @@ void DrawGraphic_MM(int x, int y, int graphic) } #endif - DrawGraphicExt_MM(drawto_field, cFX + x * TILEX, cFY + y * TILEY, graphic); + int frame = getGraphicAnimationFrameXY(graphic, x, y); + + DrawGraphicAnimation_MM(x, y, graphic, frame); MarkTileDirty(x, y); } @@ -90,7 +92,7 @@ void DrawGraphicExt_MM(DrawBuffer *d, int x, int y, int graphic) BlitBitmap(bitmap, d, src_x, src_y, TILEX, TILEY, x, y); } -void DrawGraphicThruMask_MM(int x, int y, int graphic) +void DrawGraphicThruMask_MM(int x, int y, int graphic, int frame) { #if DEBUG if (!IN_SCR_FIELD(x,y)) @@ -104,13 +106,13 @@ void DrawGraphicThruMask_MM(int x, int y, int graphic) #endif DrawGraphicThruMaskExt_MM(drawto_field, cFX + x * TILEX, cFY + y * TILEY, - graphic); + graphic, frame); MarkTileDirty(x,y); } void DrawGraphicThruMaskExt_MM(DrawBuffer *d, int dest_x, int dest_y, - int graphic) + int graphic, int frame) { int src_x, src_y; Bitmap *src_bitmap; @@ -118,7 +120,7 @@ void DrawGraphicThruMaskExt_MM(DrawBuffer *d, int dest_x, int dest_y, if (graphic == IMG_EMPTY) return; - getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y); + getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y); BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dest_x, dest_y); } @@ -284,7 +286,7 @@ void DrawScreenElementExt_MM(int x, int y, int dx, int dy, int element, if (dx || dy) DrawGraphicShifted_MM(x, y, dx, dy, graphic, cut_mode, mask_mode); else if (mask_mode == USE_MASKING) - DrawGraphicThruMask_MM(x, y, graphic); + DrawGraphicThruMask_MM(x, y, graphic, 0); else DrawGraphic_MM(x, y, graphic); } @@ -396,6 +398,11 @@ void DrawField_MM(int x, int y) int element = Tile[x][y]; DrawElement_MM(x, y, element); + + // old game versions randomly changed colors of bonus light balls + if (game.engine_version < VERSION_IDENT(4,3,3,0) && + element == EL_LIGHTBALL && game_mm.lightball_rnd) + RND(3); } void DrawLevel_MM(void) @@ -522,6 +529,12 @@ void DrawElement_MM(int x, int y, int element) laser.fuse_x == x && laser.fuse_y == y) DrawGraphic_MM(x, y, IMG_MM_FUSE); + else if (element == EL_GRAY_BALL_OPENING) + DrawGraphic_MM(x, y, el_act2gfx(EL_BALL_GRAY, MM_ACTION_OPENING)); + else if (element == EL_BOMB_ACTIVE) + DrawGraphic_MM(x, y, el_act2gfx(EL_BOMB, MM_ACTION_ACTIVE)); + else if (element == EL_MINE_ACTIVE) + DrawGraphic_MM(x, y, el_act2gfx(EL_MINE, MM_ACTION_ACTIVE)); else DrawGraphic_MM(x, y, el2gfx(element)); } @@ -1287,16 +1300,12 @@ static int map_element(int element) int el2gfx(int element) { - element = map_element(element); - - switch (element) - { - case EL_LIGHTBALL: - return IMG_MM_LIGHTBALL_RED + RND(3); + return el2img_mm(map_element(element)); +} - default: - return el2img_mm(element); - } +int el_act2gfx(int element, int action) +{ + return el_act2img_mm(map_element(element), action); } void RedrawPlayfield_MM(void)