-
- if (pos_x <= -anim->width - anim->stepsize ||
- pos_x >= FULL_SXSIZE + anim->stepsize ||
- pos_y <= -anim->height - anim->stepsize ||
- pos_y >= FULL_SYSIZE + anim->stepsize)
- return(TRUE);
-
- if (!DelayReached(&anim_delay,anim_delay_value))
- {
- if (game_status==HELPSCREEN && !restart)
- DrawAnim(src_x+cut_x,src_y+cut_y, width,height,
- REAL_SX+dest_x,REAL_SY+dest_y, pad_x,pad_y);
-
- return(FALSE);
- }
-
- if (pos_x<-anim->width)
- pos_x = -anim->width;
- else if (pos_x>FULL_SXSIZE)
- pos_x = FULL_SXSIZE;
- if (pos_y<-anim->height)
- pos_y = -anim->height;
- else if (pos_y>FULL_SYSIZE)
- pos_y = FULL_SYSIZE;
-
- pad_x = (horiz_move ? anim->stepsize : 0);
- pad_y = (vert_move ? anim->stepsize : 0);
- src_x = anim->src_x + frame * anim->width;
- src_y = anim->src_y;
- dest_x = pos_x;
- dest_y = pos_y;
- cut_x = cut_y = 0;
- width = anim->width;
- height = anim->height;
-
- if (pos_x<0)
- {
- dest_x = 0;
- width += pos_x;
- cut_x = -pos_x;
- }
- else if (pos_x>FULL_SXSIZE-anim->width)
- width -= (pos_x - (FULL_SXSIZE-anim->width));
-
- if (pos_y<0)
- {
- dest_y = 0;
- height += pos_y;
- cut_y = -pos_y;
- }
- else if (pos_y>FULL_SYSIZE-anim->height)
- height -= (pos_y - (FULL_SYSIZE-anim->height));
-
- DrawAnim(src_x+cut_x,src_y+cut_y, width,height,
- REAL_SX+dest_x,REAL_SY+dest_y, pad_x,pad_y);
-
- pos_x += delta_x;
- pos_y += delta_y;
- frame += frame_step;
-
- if (frame<0 || frame>=anim->frames)
- {
- if (anim->pingpong)
- {
- frame_step *= -1;
- frame = (frame<0 ? 1 : anim->frames-2);
- }
- else
- frame = (frame<0 ? anim->frames-1 : 0);
- }
-
- return(FALSE);
-}
-
-void DrawAnim(int src_x, int src_y, int width, int height,
- int dest_x, int dest_y, int pad_x, int pad_y)
-{
- int buf_x = DOOR_GFX_PAGEX3, buf_y = DOOR_GFX_PAGEY1;
-
-#if 1
- /* special method to avoid flickering interference with BackToFront() */
- XCopyArea(display,backbuffer,pix[PIX_DB_DOOR],gc,dest_x-pad_x,dest_y-pad_y,
- width+2*pad_x,height+2*pad_y, buf_x,buf_y);
- XSetClipOrigin(display,clip_gc[PIX_TOONS],dest_x-src_x,dest_y-src_y);
- XCopyArea(display,pix[PIX_TOONS],backbuffer,clip_gc[PIX_TOONS],
- src_x,src_y, width,height, dest_x,dest_y);
- XCopyArea(display,backbuffer,window,gc, dest_x-pad_x,dest_y-pad_y,
- width+2*pad_x,height+2*pad_y, dest_x-pad_x,dest_y-pad_y);
- BackToFront();
- XCopyArea(display,pix[PIX_DB_DOOR],backbuffer,gc, buf_x,buf_y,
- width+2*pad_x,height+2*pad_y, dest_x-pad_x,dest_y-pad_y);
-#else
- /* normal method, causing flickering interference with BackToFront() */
- XCopyArea(display,backbuffer,pix[PIX_DB_DOOR],gc,dest_x-pad_x,dest_y-pad_y,
- width+2*pad_x,height+2*pad_y, buf_x,buf_y);
- XSetClipOrigin(display,clip_gc[PIX_TOONS],
- buf_x-src_x+pad_x,buf_y-src_y+pad_y);
- XCopyArea(display,pix[PIX_TOONS],pix[PIX_DB_DOOR],clip_gc[PIX_TOONS],
- src_x,src_y, width,height, buf_x+pad_x,buf_y+pad_y);
- XCopyArea(display,pix[PIX_DB_DOOR],window,gc, buf_x,buf_y,
- width+2*pad_x,height+2*pad_y, dest_x-pad_x,dest_y-pad_y);
-#endif
-
- XFlush(display);