X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Ftools.c;h=f987d323a2f550c0b778f3eda9e4fd1ec268daa9;hp=a705df5603bf498f82f15aa2c42246bd067a1eef;hb=2fe0fbc2a34fd4b50081f1829931dea3ca2c4c1c;hpb=57562a0f29074feea1dc01ddf1b1d5e4e6d59730 diff --git a/src/tools.c b/src/tools.c index a705df56..f987d323 100644 --- a/src/tools.c +++ b/src/tools.c @@ -356,11 +356,17 @@ void DrawPlayer(struct PlayerInfo *player) int element = Feld[jx][jy]; int graphic, phase; + /* if (!player->active || player->gone || !IN_SCR_FIELD(sx,sy)) return; + */ + + if (!player->active || player->gone || + !IN_SCR_FIELD(SCREENX(last_jx),SCREENY(last_jy))) + return; #if DEBUG - if (!IN_LEV_FIELD(jx,jy) || !IN_SCR_FIELD(sx,sy)) + if (!IN_LEV_FIELD(jx,jy)) { printf("DrawPlayerField(): x = %d, y = %d\n",jx,jy); printf("DrawPlayerField(): sx = %d, sy = %d\n",sx,sy); @@ -372,9 +378,6 @@ void DrawPlayer(struct PlayerInfo *player) if (element == EL_EXPLODING) return; - if (direct_draw_on) - SetDrawtoField(DRAW_BUFFERED); - /* draw things in the field the player is leaving, if needed */ if (last_jx != jx || last_jy != jy) @@ -389,7 +392,7 @@ void DrawPlayer(struct PlayerInfo *player) else DrawLevelField(last_jx,last_jy); - if (player->Pushing) + if (player->Pushing && IN_SCR_FIELD(SCREENX(next_jx),SCREENY(next_jy))) { if (player->GfxPos) { @@ -403,6 +406,12 @@ void DrawPlayer(struct PlayerInfo *player) } } + if (!IN_SCR_FIELD(sx,sy)) + return; + + if (direct_draw_on) + SetDrawtoField(DRAW_BUFFERED); + /* draw things behind the player, if needed */ if (Store[jx][jy]) @@ -421,7 +430,7 @@ void DrawPlayer(struct PlayerInfo *player) else /* MV_DOWN || MV_NO_MOVING */ graphic = GFX_SPIELER1_DOWN; - graphic += player->nr * 3*HEROES_PER_LINE; + graphic += player->index_nr * 3*HEROES_PER_LINE; graphic += player->Frame; if (player->GfxPos) @@ -555,7 +564,6 @@ void DrawGraphicAnimationThruMask(int x, int y, int graphic, void DrawGraphic(int x, int y, int graphic) { - #if DEBUG if (!IN_SCR_FIELD(x,y)) { @@ -602,11 +610,6 @@ void DrawGraphicExt(Drawable d, GC gc, int x, int y, int graphic) void DrawGraphicThruMask(int x, int y, int graphic) { - int src_x,src_y, dest_x,dest_y; - int tile = graphic; - Pixmap src_pixmap; - GC drawing_gc; - #if DEBUG if (!IN_SCR_FIELD(x,y)) { @@ -616,6 +619,17 @@ void DrawGraphicThruMask(int x, int y, int graphic) } #endif + DrawGraphicThruMaskExt(drawto_field, FX+x*TILEX, FY+y*TILEY, graphic); + MarkTileDirty(x,y); +} + +void DrawGraphicThruMaskExt(Drawable d, int dest_x, int dest_y, int graphic) +{ + int src_x, src_y; + int tile = graphic; + Pixmap src_pixmap; + GC drawing_gc; + if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN) { src_pixmap = pix[PIX_BACK]; @@ -634,13 +648,10 @@ void DrawGraphicThruMask(int x, int y, int graphic) } else { - DrawGraphic(x,y,graphic); + DrawGraphicExt(d, gc, dest_x,dest_y, graphic); return; } - dest_x = FX + x*TILEX; - dest_y = FY + y*TILEY; - if (tile_clipmask[tile] != None) { XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]); @@ -658,8 +669,6 @@ void DrawGraphicThruMask(int x, int y, int graphic) XCopyArea(display, src_pixmap, drawto_field, drawing_gc, src_x,src_y, TILEX,TILEY, dest_x,dest_y); } - - MarkTileDirty(x,y); } void DrawMiniGraphic(int x, int y, int graphic) @@ -1281,7 +1290,7 @@ void DrawMicroLevel(int xpos, int ypos) redraw_mask |= REDRAW_MICROLEV; } -int AYS_in_range(int x, int y) +int REQ_in_range(int x, int y) { if (y>DY+249 && y