/*polygons: Amiga version by Terry W. Gintz*/ int drawpoly(),stopcheck(); extern short int x1[50][15],y1[50][15],x2[50][27],y2[50][27],x3[50][51]; extern short int y3[50][51]; poly() { int ex; SetAPen(rp,4); SetDrMd(w->RPort,JAM1); RectFill(w->RPort,0,0,320,200); SetDrMd(w->RPort,JAM2); ex=0; while (ex==0){ ex=drawpoly(); } } int drawpoly() { int ex,l,ns,pix,xon,xoff,yon,yoff,x,xstep,y,ystep,x4,y4,x5,y5; register short int i,inc,nc,ls,s; ex=0; pix=RangeRand(5); xstep=80; ystep=50; switch(pix){ case 0: xon=120; xoff=200; yon=100; yoff=100; break; case 1: xon=80; xoff=240; yon=100; yoff=100; break; case 2: xon=120; xoff=200; yon=75; yoff=125; break; case 3: xon=80; xoff=240; yon=75; yoff=125; break; case 4: xon=80; xoff=240; yon=50; yoff=150; break; } l=RangeRand(3); ns=RangeRand(3); s=4; for (ls=0;ls<50;ls+=2){ ++s; ex=stopcheck(); if (ex==1) break; for (inc=xon;inc<=xoff;inc+=xstep){ x=inc; for (nc=yon;nc<=yoff;nc+=ystep){ y=nc; switch(l){ case 0: switch(ns){ case 0: x4=x+x1[ls][0]; y4=y; for (i=1;i<5;i++){ x5=x+x1[ls][i]; y5=y+y1[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; case 1: x4=x+x2[ls][0]; y4=y; for (i=1;i<9;i++){ x5=x+x2[ls][i]; y5=y+y2[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; case 2: x4=x+x3[ls][0]; y4=y; for (i=1;i<17;i++){ x5=x+x3[ls][i]; y5=y+y3[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; } break; case 1: switch(ns){ case 0: x4=x+x1[ls][5]; y4=y; for (i=6;i<10;i++){ x5=x+x1[ls][i]; y5=y+y1[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; case 1: x4=x+x2[ls][9]; y4=y; for (i=10;i<18;i++){ x5=x+x2[ls][i]; y5=y+y2[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; case 2: x4=x+x3[ls][17]; y4=y; for (i=18;i<34;i++){ x5=x+x3[ls][i]; y5=y+y3[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; } break; case 2: switch(ns){ case 0: x4=x+x1[ls][10]; y4=y; for (i=11;i<15;i++){ x5=x+x1[ls][i]; y5=y+y1[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; case 1: x4=x+x2[ls][18]; y4=y; for (i=19;i<27;i++){ x5=x+x2[ls][i]; y5=y+y2[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } break; case 2: x4=x+x3[ls][34]; y4=y; for (i=35;i<51;i++){ x5=x+x3[ls][i]; y5=y+y3[ls][i]; SetAPen(rp,s); Move(rp,x4,y4); Draw(rp,x5,y5); y4=y5; x4=x5; } } } } } } return(ex); }