X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=f987d323a2f550c0b778f3eda9e4fd1ec268daa9;hb=2fe0fbc2a34fd4b50081f1829931dea3ca2c4c1c;hp=2aad13a9ade064e7ad2d2c73b9719f262b78f059;hpb=823bddb0d9cc63ddda17a2cd20266aa3b82bde38;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 2aad13a9..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) @@ -382,14 +385,14 @@ void DrawPlayer(struct PlayerInfo *player) if (Store[last_jx][last_jy]) { DrawLevelElement(last_jx,last_jy, Store[last_jx][last_jy]); - DrawLevelElementThruMask(last_jx,last_jy, Feld[last_jx][last_jy]); + DrawLevelFieldThruMask(last_jx,last_jy); } else if (Feld[last_jx][last_jy] == EL_DYNAMIT) DrawDynamite(last_jx,last_jy); 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) @@ -483,6 +492,16 @@ void DrawPlayer(struct PlayerInfo *player) DrawGraphicThruMask(sx,sy, graphic + phase); } + if ((last_jx != jx || last_jy != jy) && Feld[last_jx][last_jy]==EL_EXPLODING) + { + int phase = Frame[last_jx][last_jy]; + int delay = 2; + + if (phase > 2) + DrawGraphicThruMask(SCREENX(last_jx),SCREENY(last_jy), + GFX_EXPLOSION + ((phase-1)/delay-1)); + } + if (direct_draw_on) { int dest_x = SX + SCREENX(MIN(jx,last_jx))*TILEX; @@ -545,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)) { @@ -592,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)) { @@ -606,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]; @@ -624,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]); @@ -648,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) @@ -946,6 +965,11 @@ void DrawLevelElementThruMask(int x, int y, int element) DrawLevelElementExt(x,y, 0,0, element, NO_CUTTING, USE_MASKING); } +void DrawLevelFieldThruMask(int x, int y) +{ + DrawLevelElementExt(x,y, 0,0, Feld[x][y], NO_CUTTING, USE_MASKING); +} + void ErdreichAnbroeckeln(int x, int y) { int i, width, height, cx,cy; @@ -1087,13 +1111,8 @@ void DrawScreenField(int x, int y) Store[ux][uy]==EL_AMOEBE_NASS) cut_mode = CUT_ABOVE; else if (Store[ux][uy]==EL_MORAST_VOLL || - -#if 0 - Store[ux][uy]==EL_SALZSAEURE || -#endif - - Store[ux][uy]==EL_SIEB_VOLL || - Store[ux][uy]==EL_SIEB2_VOLL) + Store[ux][uy]==EL_SIEB_VOLL || + Store[ux][uy]==EL_SIEB2_VOLL) cut_mode = CUT_BELOW; if (cut_mode==CUT_ABOVE) @@ -1106,11 +1125,8 @@ void DrawScreenField(int x, int y) else DrawScreenElementShifted(x,y, 0,MovPos[ux][uy], element, cut_mode); -#if 1 if (Store[ux][uy] == EL_SALZSAEURE) DrawLevelElementThruMask(ux,uy+1, EL_SALZSAEURE); -#endif - } else if (IS_BLOCKED(ux,uy)) { @@ -1274,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