X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=354f196c48797f47612d8157fa2650029fa848c5;hb=4be46f1030df4cb7db0ce7c46d2518334861731a;hp=2f3ce540b2998eec2afea3d59f8c38cb023cb204;hpb=c4e2a358613670823800b1bfe5bee211e62dc7b2;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 2f3ce540..354f196c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -362,13 +362,25 @@ void FadeToFront() BackToFront(); } +void SetMainBackgroundImage(int graphic) +{ + SetMainBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL : + new_graphic_info[graphic].bitmap ? + new_graphic_info[graphic].bitmap : + new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap); +} + +void SetDoorBackgroundImage(int graphic) +{ + SetDoorBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL : + new_graphic_info[graphic].bitmap ? + new_graphic_info[graphic].bitmap : + new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap); +} + void DrawBackground(int dest_x, int dest_y, int width, int height) { - if (DrawingOnBackground(dest_x, dest_y) && game_status != PLAYING) - BlitBitmap(gfx.background_bitmap, backbuffer, dest_x, dest_y, - width, height, dest_x, dest_y); - else - ClearRectangle(backbuffer, dest_x, dest_y, width, height); + ClearRectangleOnBackground(backbuffer, dest_x, dest_y, width, height); redraw_mask |= REDRAW_FIELD; } @@ -392,6 +404,37 @@ void ClearWindow() } } +void MarkTileDirty(int x, int y) +{ + int xx = redraw_x1 + x; + int yy = redraw_y1 + y; + + if (!redraw[xx][yy]) + redraw_tiles++; + + redraw[xx][yy] = TRUE; + redraw_mask |= REDRAW_TILES; +} + +void SetBorderElement() +{ + int x, y; + + BorderElement = EL_EMPTY; + + for(y=0; y= delay) @@ -776,28 +824,6 @@ void DrawPlayer(struct PlayerInfo *player) MarkTileDirty(sx,sy); } -void DrawGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y, - int graphic, int mask_mode) -{ - int frame = getGraphicAnimationFrame(graphic, -1); - - if (mask_mode == USE_MASKING) - DrawGraphicThruMaskExt(dst_bitmap, x, y, graphic, frame); - else - DrawGraphicExt(dst_bitmap, x, y, graphic, frame); -} - -void DrawGraphicAnimation(int x, int y, int graphic) -{ - if (!IN_SCR_FIELD(x, y) || - (FrameCounter % new_graphic_info[graphic].anim_delay) != 0) - return; - - DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY, - graphic, NO_MASKING); - MarkTileDirty(x, y); -} - #if 0 void getOldGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { @@ -1295,7 +1321,11 @@ inline static int getFramePosition(int x, int y) else if (IS_MOVING(x, y) || CAN_MOVE(element) || CAN_FALL(element)) frame_pos = ABS(MovPos[x][y]) / (TILEX / 8); #else + frame_pos = ABS(MovPos[x][y]) / (TILEX / 8); + + frame_pos = GfxFrame[x][y]; + #endif return frame_pos; @@ -1754,6 +1784,7 @@ void DrawLevel() { int x,y; + SetDrawBackgroundMask(REDRAW_NONE); ClearWindow(); for(x=BX1; x<=BX2; x++) @@ -2948,9 +2979,9 @@ int el2gfx(int element) #if DEBUG int graphic_OLD = el2gfx_OLD(element); - if (element >= MAX_ELEMENTS) + if (element >= MAX_NUM_ELEMENTS) { - Error(ERR_WARN, "el2gfx: element == %d >= MAX_ELEMENTS", element); + Error(ERR_WARN, "el2gfx: element == %d >= MAX_NUM_ELEMENTS", element); } if (graphic_NEW != graphic_OLD)