2 * $Id: rain.c,v 1.8 1997/05/03 18:38:27 tom Exp $
6 #include <term.h> /* for tparm() */
10 /* rain 11/3/1980 EPS/CITHEP */
12 #define cursor(col,row) move(row,col)
14 static float ranf(void);
15 static void onsig(int sig);
20 char *argv[] GCC_UNUSED)
23 static int xpos[5], ypos[5];
27 for (j=SIGHUP;j<=SIGTERM;j++)
28 if (signal(j,SIG_IGN)!=SIG_IGN) signal(j,onsig);
35 r = (float)(LINES - 4);
36 c = (float)(COLS - 4);
38 xpos[j]=(int)(c* ranf())+2;
39 ypos[j]=(int)(r* ranf())+2;
45 cursor(x,y); addch('.');
47 cursor(xpos[j],ypos[j]); addch('o');
49 if (j==0) j=4; else --j;
50 cursor(xpos[j],ypos[j]); addch('O');
52 if (j==0) j=4; else --j;
53 cursor(xpos[j],ypos[j]-1);
55 cursor(xpos[j]-1,ypos[j]);
57 cursor(xpos[j],ypos[j]+1);
60 if (j==0) j=4; else --j;
61 cursor(xpos[j],ypos[j]-2);
63 cursor(xpos[j]-1,ypos[j]-1);
65 cursor(xpos[j]-2,ypos[j]);
67 cursor(xpos[j]-1,ypos[j]+1);
69 cursor(xpos[j],ypos[j]+2);
72 if (j==0) j=4; else --j;
73 cursor(xpos[j],ypos[j]-2);
75 cursor(xpos[j]-1,ypos[j]-1);
77 cursor(xpos[j]-2,ypos[j]);
79 cursor(xpos[j]-1,ypos[j]+1);
81 cursor(xpos[j],ypos[j]+2);
90 onsig(int n GCC_UNUSED)
104 rv =((float)r/32767.);