-void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic,
- int cut_mode, int mask_mode)
-{
- int width = TILEX, height = TILEY;
- int cx = 0, cy = 0;
- int src_x, src_y, dest_x, dest_y;
- int tile = graphic;
- Bitmap *src_bitmap;
- GC drawing_gc;
-
- if (graphic < 0)
- {
- DrawGraphic(x, y, graphic);
- return;
- }
-
- if (dx || dy) /* Verschiebung der Grafik? */
- {
- if (x < BX1) /* Element kommt von links ins Bild */
- {
- x = BX1;
- width = dx;
- cx = TILEX - dx;
- dx = 0;
- }
- else if (x > BX2) /* Element kommt von rechts ins Bild */
- {
- x = BX2;
- width = -dx;
- dx = TILEX + dx;
- }
- else if (x==BX1 && dx < 0) /* Element verläßt links das Bild */
- {
- width += dx;
- cx = -dx;
- dx = 0;
- }
- else if (x==BX2 && dx > 0) /* Element verläßt rechts das Bild */
- width -= dx;
- else if (dx) /* allg. Bewegung in x-Richtung */
- MarkTileDirty(x + SIGN(dx), y);
-
- if (y < BY1) /* Element kommt von oben ins Bild */
- {
- if (cut_mode==CUT_BELOW) /* Element oberhalb des Bildes */
- return;
-
- y = BY1;
- height = dy;
- cy = TILEY - dy;
- dy = 0;
- }
- else if (y > BY2) /* Element kommt von unten ins Bild */
- {
- y = BY2;
- height = -dy;
- dy = TILEY + dy;
- }
- else if (y==BY1 && dy < 0) /* Element verläßt oben das Bild */
- {
- height += dy;
- cy = -dy;
- dy = 0;
- }
- else if (dy > 0 && cut_mode == CUT_ABOVE)
- {
- if (y == BY2) /* Element unterhalb des Bildes */
- return;
-
- height = dy;
- cy = TILEY - dy;
- dy = TILEY;
- MarkTileDirty(x, y + 1);
- } /* Element verläßt unten das Bild */
- else if (dy > 0 && (y == BY2 || cut_mode == CUT_BELOW))
- height -= dy;
- else if (dy) /* allg. Bewegung in y-Richtung */
- MarkTileDirty(x, y + SIGN(dy));
- }
-
- getGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
- drawing_gc = src_bitmap->stored_clip_gc;
-
- src_x += cx;
- src_y += cy;
-
- dest_x = FX + x * TILEX + dx;
- dest_y = FY + y * TILEY + dy;
-
-#if DEBUG
- if (!IN_SCR_FIELD(x,y))
- {
- printf("DrawGraphicShifted(): x = %d, y = %d, graphic = %d\n",x,y,graphic);
- printf("DrawGraphicShifted(): This should never happen!\n");
- return;
- }
-#endif
-
- if (mask_mode == USE_MASKING)
- {
- if (tile_clipmask[tile] != None)
- {
- SetClipMask(src_bitmap, tile_clip_gc, tile_clipmask[tile]);
- SetClipOrigin(src_bitmap, tile_clip_gc, dest_x, dest_y);
- BlitBitmapMasked(src_bitmap, drawto_field,
- src_x, src_y, TILEX, TILEY, dest_x, dest_y);
- }
- else
- {
-#if DEBUG
-#ifndef TARGET_SDL
- printf("DrawGraphicShifted(): tile '%d' needs clipping!\n", tile);
-#endif
-#endif
-
- SetClipOrigin(src_bitmap, drawing_gc, dest_x - src_x, dest_y - src_y);
- BlitBitmapMasked(src_bitmap, drawto_field,
- src_x, src_y, width, height, dest_x, dest_y);
- }
- }
- else
- BlitBitmap(src_bitmap, drawto_field,
- src_x, src_y, width, height, dest_x, dest_y);
-
- MarkTileDirty(x,y);
-}
-
-void DrawNewGraphicShifted(int x,int y, int dx,int dy, int graphic, int frame,