X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=1b2a41f46679848cd852454466cabcfd5252fdd2;hb=92534b4d22c4042737e2cbc50b487980759cf6a8;hp=97b4269c054c911a72dfaaa69528b79a7da9a8c7;hpb=a30a27ce6c313e56cc92dc7183d599f63f8ca1f2;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index 97b4269c..1b2a41f4 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -449,7 +449,8 @@ void SetDrawBackgroundMask(int draw_background_mask) gfx.draw_background_mask = draw_background_mask; } -static void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) +void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask, + int x, int y, int width, int height) { if (background_bitmap_tile != NULL) gfx.background_bitmap_mask |= mask; @@ -460,40 +461,19 @@ static void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) return; if (mask == REDRAW_ALL) - BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0, + BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, + x, y, width, height, 0, 0, video.width, video.height); else if (mask == REDRAW_FIELD) - BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0, + BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, + x, y, width, height, gfx.real_sx, gfx.real_sy, gfx.full_sxsize, gfx.full_sysize); else if (mask == REDRAW_DOOR_1) - BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0, + BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, + x, y, width, height, gfx.dx, gfx.dy, gfx.dxsize, gfx.dysize); } -void SetWindowBackgroundBitmap(Bitmap *background_bitmap_tile) -{ - // remove every mask before setting mask for window - // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!) - SetBackgroundBitmap(NULL, 0xffff); // !!! FIX THIS !!! - SetBackgroundBitmap(background_bitmap_tile, REDRAW_ALL); -} - -void SetMainBackgroundBitmap(Bitmap *background_bitmap_tile) -{ - // remove window area mask before setting mask for main area - // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!) - SetBackgroundBitmap(NULL, REDRAW_ALL); // !!! FIX THIS !!! - SetBackgroundBitmap(background_bitmap_tile, REDRAW_FIELD); -} - -void SetDoorBackgroundBitmap(Bitmap *background_bitmap_tile) -{ - // remove window area mask before setting mask for door area - // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!) - SetBackgroundBitmap(NULL, REDRAW_ALL); // !!! FIX THIS !!! - SetBackgroundBitmap(background_bitmap_tile, REDRAW_DOOR_1); -} - // ============================================================================ // video functions @@ -690,8 +670,7 @@ void SetRedrawMaskFromArea(int x, int y, int width, int height) redraw_mask = REDRAW_ALL; } -static boolean CheckDrawingArea(int x, int y, int width, int height, - int draw_mask) +static boolean CheckDrawingArea(int x, int y, int draw_mask) { if (draw_mask == REDRAW_NONE) return FALSE; @@ -725,15 +704,15 @@ boolean DrawingDeactivatedField(void) return FALSE; } -boolean DrawingDeactivated(int x, int y, int width, int height) +boolean DrawingDeactivated(int x, int y) { - return CheckDrawingArea(x, y, width, height, gfx.draw_deactivation_mask); + return CheckDrawingArea(x, y, gfx.draw_deactivation_mask); } boolean DrawingOnBackground(int x, int y) { - return (CheckDrawingArea(x, y, 1, 1, gfx.background_bitmap_mask) && - CheckDrawingArea(x, y, 1, 1, gfx.draw_background_mask)); + return (CheckDrawingArea(x, y, gfx.background_bitmap_mask) && + CheckDrawingArea(x, y, gfx.draw_background_mask)); } static boolean InClippedRectangle(Bitmap *bitmap, int *x, int *y, @@ -802,7 +781,7 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, if (src_bitmap == NULL || dst_bitmap == NULL) return; - if (DrawingDeactivated(dst_x, dst_y, width, height)) + if (DrawingDeactivated(dst_x, dst_y)) return; if (!InClippedRectangle(src_bitmap, &src_x, &src_y, &width, &height, FALSE) || @@ -909,7 +888,7 @@ void FillRectangle(Bitmap *bitmap, int x, int y, int width, int height, if (program.headless) return; - if (DrawingDeactivated(x, y, width, height)) + if (DrawingDeactivated(x, y)) return; if (!InClippedRectangle(bitmap, &x, &y, &width, &height, TRUE)) @@ -936,7 +915,7 @@ void BlitBitmapMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap, int src_x, int src_y, int width, int height, int dst_x, int dst_y) { - if (DrawingDeactivated(dst_x, dst_y, width, height)) + if (DrawingDeactivated(dst_x, dst_y)) return; sysCopyArea(src_bitmap, dst_bitmap, src_x, src_y, width, height, @@ -1718,7 +1697,7 @@ void CheckQuitEvent(void) program.exit_function(0); } -Key GetEventKey(KeyEvent *event, boolean with_modifiers) +Key GetEventKey(KeyEvent *event) { // key up/down events in SDL2 do not return text characters anymore return event->keysym.sym;