X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fcartoons.c;h=19f6cac2f42c8cb0415c16c6fb3baa09707db8af;hb=681721dddc91bcdaef50002d1e861cc8d484e938;hp=2edb0e4e942932d859ffc02e106e8146f4ad37ca;hpb=e2d2518810a4ab32f6dfd32faa83869307b3aa3d;p=rocksndiamonds.git diff --git a/src/cartoons.c b/src/cartoons.c index 2edb0e4e..19f6cac2 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -1,25 +1,24 @@ /*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * +* Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* ©1995 Artsoft Development * -* Holger Schemel * -* 33659 Bielefeld-Senne * -* Telefon: (0521) 493245 * -* eMail: aeglos@valinor.owl.de * -* aeglos@uni-paderborn.de * -* q99492@pbhrzx.uni-paderborn.de * +* (c) 1995-2001 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * *----------------------------------------------------------* -* cartoons.c * +* cartoons.c * ***********************************************************/ #include "cartoons.h" #include "main.h" -#include "misc.h" #include "tools.h" + static void HandleAnimation(int); -static BOOL AnimateToon(int, BOOL); -static void DrawAnim(Pixmap, GC, int, int, int, int, int, int, int, int); +static boolean AnimateToon(int, boolean); +static void DrawAnim(Bitmap *, GC, int, int, int, int, int, int, int, int); struct AnimInfo { @@ -28,7 +27,7 @@ struct AnimInfo int frames; int frames_per_second; int stepsize; - BOOL pingpong; + boolean pingpong; int direction; int position; }; @@ -108,14 +107,14 @@ void DoAnimation() void HandleAnimation(int mode) { - static long animstart_delay = -1; - static long animstart_delay_value = 0; - static BOOL anim_restart = TRUE; - static BOOL reset_delay = TRUE; + static unsigned long animstart_delay = -1; + static unsigned long animstart_delay_value = 0; + static boolean anim_restart = TRUE; + static boolean reset_delay = TRUE; static int toon_nr = 0; int draw_mode; - if (!toons_on) + if (!setup.toons) return; switch(mode) @@ -125,30 +124,28 @@ void HandleAnimation(int mode) reset_delay = TRUE; /* Fill empty backbuffer for animation functions */ - if (direct_draw_on && game_status==PLAYING) + if (setup.direct_draw && game_status == PLAYING) { int xx,yy; SetDrawtoField(DRAW_BACKBUFFER); - for(xx=0;xxstored_clip_gc; if (restart) { horiz_move = (anim->direction & (ANIMDIR_LEFT | ANIMDIR_RIGHT)); vert_move = (anim->direction & (ANIMDIR_UP | ANIMDIR_DOWN)); - anim_delay_value = 100/anim->frames_per_second; + anim_delay_value = 1000/anim->frames_per_second; frame = 0; if (horiz_move) @@ -461,12 +459,14 @@ BOOL AnimateToon(int toon_nr, BOOL restart) pos_y >= FULL_SYSIZE + anim->stepsize) return(TRUE); - if (!DelayReached(&anim_delay,anim_delay_value)) + if (!DelayReached(&anim_delay, anim_delay_value)) { - if (game_status==HELPSCREEN && !restart) - DrawAnim(anim_pixmap,anim_clip_gc, - src_x+cut_x,src_y+cut_y, width,height, - REAL_SX+dest_x,REAL_SY+dest_y, pad_x,pad_y); + if ((game_status == HELPSCREEN || + (game_status == MAINMENU && redraw_mask & REDRAW_MICROLEVEL)) + && !restart) + DrawAnim(anim_bitmap, anim_clip_gc, + src_x + cut_x, src_y + cut_y, width, height, + REAL_SX + dest_x, REAL_SY + dest_y, pad_x, pad_y); return(FALSE); } @@ -508,7 +508,7 @@ BOOL AnimateToon(int toon_nr, BOOL restart) else if (pos_y>FULL_SYSIZE-anim->height) height -= (pos_y - (FULL_SYSIZE-anim->height)); - DrawAnim(anim_pixmap,anim_clip_gc, + DrawAnim(anim_bitmap,anim_clip_gc, src_x+cut_x,src_y+cut_y, width,height, REAL_SX+dest_x,REAL_SY+dest_y, pad_x,pad_y); @@ -530,7 +530,7 @@ BOOL AnimateToon(int toon_nr, BOOL restart) return(FALSE); } -void DrawAnim(Pixmap toon_pixmap, GC toon_clip_gc, +void DrawAnim(Bitmap *toon_bitmap, GC toon_clip_gc, int src_x, int src_y, int width, int height, int dest_x, int dest_y, int pad_x, int pad_y) { @@ -538,27 +538,26 @@ void DrawAnim(Pixmap toon_pixmap, GC toon_clip_gc, #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,toon_clip_gc,dest_x-src_x,dest_y-src_y); - XCopyArea(display,toon_pixmap,backbuffer,toon_clip_gc, - 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); + BlitBitmap(backbuffer, pix[PIX_DB_DOOR], dest_x-pad_x, dest_y-pad_y, + width+2*pad_x, height+2*pad_y, buf_x, buf_y); + SetClipOrigin(toon_bitmap, toon_clip_gc, dest_x-src_x, dest_y-src_y); + BlitBitmapMasked(toon_bitmap, backbuffer, + src_x, src_y, width, height, dest_x, dest_y); + BlitBitmap(backbuffer, window, 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); + BlitBitmap(pix[PIX_DB_DOOR], backbuffer, 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,toon_clip_gc, - buf_x-src_x+pad_x,buf_y-src_y+pad_y); - XCopyArea(display,toon_pixmap,pix[PIX_DB_DOOR],toon_clip_gc, - 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); + BlitBitmap(backbuffer, pix[PIX_DB_DOOR], dest_x-pad_x, dest_y-pad_y, + width+2*pad_x, height+2*pad_y, buf_x, buf_y); + SetClipOrigin(toon_bitmap,toon_clip_gc, buf_x-src_x+pad_x,buf_y-src_y+pad_y); + BlitBitmapMasked(toon_bitmap, pix[PIX_DB_DOOR], + src_x, src_y, width, height, buf_x+pad_x, buf_y+pad_y); + BlitBitmap(pix[PIX_DB_DOOR], window, buf_x, buf_y, + width+2*pad_x, height+2*pad_y, dest_x-pad_x, dest_y-pad_y); #endif - XFlush(display); + FlushDisplay(); }