home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Fichier line.dark.c */ /* Module appele par le programme principal */ /* pour effectuer un effet defini..appele par */ /* loadseg */ #include <exec/types.h> #include <intuition/intuition.h> #include <graphics/gfx.h> #include <graphics/gfxbase.h> #include <graphics/gfxmacros.h> #include <graphics/rastport.h> #include <libraries/gadtools.h> #include <graphics/displayinfo.h> #include <graphics/gfx.h> /* #include <clib/exec_protos.h> #include <clib/intuition_protos.h> #include <clib/gadtools_protos.h> */ #include "/includes/struct.h" #include "/includes/tom_gadget.h" /***************************************************************************/ extern struct my_data *p_info; extern struct appel_proc *p_data_proc; extern struct GfxBase *GfxBase; struct RastPort *rp,*rps; struct Screen *s; int width,height; UBYTE *TypeLabels[] = { "Line 1", "Line 2", "Squares", "Random", 0l }; #define reg register extern void __asm MultiPlot(reg __a0 struct Screen *,reg __d0 WORD, reg __d1 WORD,reg __d2 WORD); char p_ver[]=" $VER: Line v1.1 (28/02/93)"; char *p_text_info="\n Line V1.1\n Your current screen will slowly\ndisappear...\n 3 kinds of disparitions are availaible:\n - line1 and 2 are line based effect,\n - Squares will draw plenty of little\n squares...\n\nby T.Landspurg\n"; struct tom_gadget my_gadg[]={ {"Type", MX, 139,13,17,40,0, 0,0,0,(char *)TypeLabels}, {0, END_LISTE, 0, 0, 0, 0, 0,0,0,0,0} }; /***************************************************************************/ void effet1() { int i; SetAPen(rp,0); for(i=0;(i<height-1)&&(tst_end()==FALSE);i+=2){ WaitTOF(); Move(rp,0,i); Draw(rp,width-1,height-i-1); Move(rp,width-1,i); Draw(rp,0,height-i-1); } for(i=0;(i<width-1)&&(tst_end()==FALSE);i+=2){ WaitTOF(); Move(rp,i,0); Draw(rp,width-i-1,height-1); Move(rp,width-i-1,0); Draw(rp,i,height-1); } } /***************************************************************************/ void efface(dec) int dec; { int i; SetAPen(rp,0); for(i=dec;(i<height-1)&&(tst_end()==FALSE);i+=4){ Move(rp,width/2,height/2); Draw(rp,0,i); } for(i=dec;(i<width-1)&&(tst_end()==FALSE);i+=4){ Move(rp,width/2,height/2); Draw(rp,i,height-1); } for(i=dec;(i<height-1)&&(tst_end()==FALSE);i+=4){ Move(rp,width/2,height/2); Draw(rp,width-1,height-i-1); } for(i=dec;(i<width-1)&&(tst_end()==FALSE);i+=4){ Move(rp,width/2,height/2); Draw(rp,width-i-1,0); } } /**************************************************************** effet2() **/ void effet2() { int i; for(i=0;i<4;i++){ efface(i); } } /************************************************************ effet_square() **/ void effet_square() { int i; int j; int haut,bas,droite,gauche; int tx,ty; int dx,dy; /* Direction */ int px,py; /* Position de depart */ tx=16; ty=16; haut=ty-1; bas=0; droite=tx-1; gauche=0; SetAPen(rp,0); dx=1; /* On commence par aller a droite */ dy=0; px=0; py=0; do{ WaitTOF(); for(i=0;(i<=height/ty)&&(tst_end()==FALSE);i++){ for(j=0;(j<=width/tx)&&(tst_end()==FALSE);j++){ MultiPlot(s,(WORD)(px+j*tx),(WORD)(py+i*ty),0); } } px+=dx; py+=dy; if(dx!=0){ if((px==droite)&&(dx==1)){ bas++; dx=0; dy=1; /* arrive a droite, on va en bas */ } if((px==gauche)&&(dx==-1)){ haut--; dy=-1; dx=0; } }else { if((py==haut)&&(dy==1)){ droite--; dx=-1; /* arrive a droite, on va en bas */ dy=0; } if((py==bas)&&(dy==-1)){ gauche++; dy=0; dx=1; } } }while((bas!=haut+1)&&(droite+1!=gauche)&&(tst_end()==FALSE)); SetRast(rp,0); } /***************************************************************************/ void __saveds dark() { int i,color,cr,cg,cb,cr2,cg2,cb2,num; rp=p_data_proc->rp; rps=p_data_proc->rps; s=p_data_proc->s; width=s->Width; height=s->Height; if(s!=0){ FreeSprite (0); GfxBase->SpriteReserved|=1; if(my_gadg[0].value==3){ num=rand()%3; }else{ num=my_gadg[0].value; } switch(num){ case 0:effet1(); break; case 1:effet2(); break; case 2:effet_square(); break; } color=GetRGB4(s->ViewPort.ColorMap,0); cr=(color&0xf00)>>8; cg=(color&0xf0)>>4; cb=color&0xf; for(i=16;(i!=0)&&(tst_end()==FALSE);i--){ WaitTOF(); cr2=(cr*i)>>4; cg2=(cg*i)>>4; cb2=(cb*i)>>4; SetRGB4(&(s->ViewPort),0,cr2,cg2,cb2); } } wait_end(); } /***************************************************************************/ void proc_init() { p_data_proc->type_screen=SCR_GIVEN; } void proc_save() { } void proc_end() { }