X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=7efa122be50395c7bc392b5b28c426b8bd406400;hb=59c2e609872b70cb4c458004cd9e2fe22c86a54b;hp=a705df5603bf498f82f15aa2c42246bd067a1eef;hpb=e557b2b5d9951a4e692fd4e32a5cf45c84252c64;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index a705df56..7efa122b 100644 --- a/src/tools.c +++ b/src/tools.c @@ -23,6 +23,7 @@ #include "buttons.h" #include "joystick.h" #include "cartoons.h" +#include "network.h" #include @@ -356,11 +357,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 +379,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 +393,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 +407,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 +431,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 +565,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,20 +611,26 @@ 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)) { - printf("DrawGraphicThruMask(): x = %d, y = %d\n",x,y); + printf("DrawGraphicThruMask(): x = %d,y = %d, graphic = %d\n",x,y,graphic); printf("DrawGraphicThruMask(): This should never happen!\n"); return; } #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 +649,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 +670,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 +1291,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