0707070000020023171006440001460001440000010256020352163201200000500000000004Size100 0707070000020023031007770001460001440000010255040352163207700001100000000042MAKEcpiocat Files | cpio -ocBv > MOUSE+IN 0707070000020022761007770001460001440000010254770352163064500001100000000044MAKEflopcat Files | cpio -ocBv > /dev/fp021 0707070000020022771006660001460001440000010255000352163067100001100000000275Makefileinclude $(MAKEINC)/Makepre.h all: etch bounce etch: etch.o $(LD) $(SHAREDLIB) -o etch etch.o bounce: bounce.o $(LD) $(SHAREDLIB) -o bounce bounce.o include $(MAKEINC)/Makepost.h 0707070000020023071006660001460001440000010255450352163134600000500000000106NameMOUSE - source for bounce and etch programs - 07/85 - from THE STORE! 0707070000020023111007770001460001440000010255010352163145000000700000000127RemoveNAME=MOUSE FOLDER=/u/$LOGNAME/Filecabinet/SRC rm -rf ${FOLDER}/$NAME > /dev/null 2>&1 0707070000020023021006440001460001440000010255030352163205300000600000000156Files./Size ./MAKEcpio ./MAKEflop ./Makefile ./Name ./Remove ./Files ./Install ./bounce.c ./etch.c ./etch ./bounce 0707070000020023001007770001460001440000010255460352163137400001000000001567InstallNAME=MOUSE FOLDER=/u/$LOGNAME/Filecabinet/SRC if [ -d $FOLDER ] then message -i "A new folder called $NAME will be created in your Filecabinet/SRC folder. The source code and final executable will be placed in this folder for your use.\n\nTouch to continue." else message -i "A folder called SRC is being created in your Filecabinet. A second folder called SRC/$NAME will then be created to hold the source code and executable for your use.\n\nTouch to continue." mkdir $FOLDER chown $LOGNAME $FOLDER fi mkdir ${FOLDER}/$NAME chown $LOGNAME ${FOLDER}/$NAME DEST=${FOLDER}/$NAME for i in `ls *.c Makefile bounce etch` do ln $i ${DEST}/$i chown $LOGNAME ${DEST}/$i done message -i "OK - everything is in Filecabinet/SRC/${NAME}.\n\nThere is a makefile along with two executables.\n\nThe executables are called "bounce" and "etch".\n\nTouch to continue." 0707070000020023051006440001460001440000010255230352163067500001100000016736bounce.c/* bounce * coffin 4/6/85 * * This is the "pong" game.... */ #include #include #include #include #include #include #define WINX 50 #define WINY 18 #define SPEED 10 #define MX (WINX*9)-32 #define MY (WINY*12)-18 /* this structure holds the current mouse state.... */ struct curmouse { int xp, yp, but, reason; } xx; struct umdata mouse; short wn, ws; struct icon myicon; int fin(); double drand48(); char *name, *getenv(); void setup(); unsigned short ball[32]; short myscore, youscore; int beepflag, xinc, yinc, xball, yball, diff=3; main () { struct termio ttt; setup(); start(); /* this is the main loop.... */ for(;;) { domouse(); wrastop( wn, ball, 4, 0, 0, 0, 0, (unsigned short)xball, (unsigned short)yball, 32, 16, SRCSRC, DSTCAM, 0 ); xball += xinc; yball += yinc; /* if ball is at top, make increment positive */ if( yball <= 4 ) { if( beepflag ) beep(); yinc = abs(yinc); } /* if ball is at bottom, make increment negative */ else if( yball >= MY ) { if( beepflag ) beep(); yinc = -abs(yinc); } /* if ball is at left side, player may have a point */ if( xball <= 5 ) { if( beepflag ) beep(); if( yball > WINY*6-(diff*12)-12 && yball < WINY*6+(diff*12)-6) { ++youscore; score(); } else xinc = abs(xinc); } /* if ball is at right side, you lose.... */ else if ( xball > MX ) { if( beepflag ) beep(); ++myscore; score(); } /* if ball is near the paddle.... */ else if( xball >= (xx.xp-abs(xinc)-10) && xball <= (xx.xp-10) && yball>=(xx.yp-18) && yball<=(xx.yp+8)) { if( beepflag ) beep(); yinc = (yball-(xx.yp)+8)/2; xinc = -xinc; } wrastop( wn, ball, 4, 0, 0, 0, 0, (unsigned short)xball, (unsigned short)yball, 32, 16, SRCSRC, DSTOR, 0 ); } } fin() { flushinp(); clear(); wprintf( wn, "\033[=0C" ); wprintf( ws, "\033[=0C" ); wdelete( wn ); wdelete( ws ); wexit( 0 ); } /* this one will parse the mouse report */ int domouse() { int key, i; wsetmouse( wn, &mouse ); key=wgetc( wn ); switch( key ) { case '\177': case Exit: case Cancl: case s_Cancl: fin(); break; case Mouse: wreadmouse( wn, &xx.xp, &xx.yp, &xx.but, &xx.reason ); break; default: return( (-1 ) ); break; } if( xx.but&4 && xx.reason&MSDOWN ) beepflag=(beepflag==0)?1:0; if( xx.but&1 && xx.reason&MSDOWN ) { if( diff <= 1 ) diff = 3; else --diff; for(i=WINY/2-3; i= 15 ) { newgame( 0 ); return( 0 ); } else if( youscore >= 15 ) { newgame( 1 ); return( 0 ); } else if( youscore > 7 && youscore < 12 ) xinc = SPEED + SPEED/2; else if( youscore > 11 ) xinc = SPEED * 2; else xinc = SPEED; xball = 24; yball = (int)(drand48()*(double)(WINY-3)*12.0)+18; for(i=WINY/2-diff; i #include #include #define NULL (char *)0 #define TRUE 1 #define FALSE 0 #define BTPSH 16 /* bits ber short */ #define WINSWIDTH (WINWIDTH/BTPSH) /* screen width in shorts */ #define WINBWIDTH (2*WINSWIDTH) /* screen width in bytes */ #define MASK 15 /* mask bit address in short */ #define MSKBT 4 /* bits in bit address in short */ #define MIN(a, b) (a < b ? a : b) #define MAX(a, b) (a > b ? a : b) #define EXCHS(a, b) {register short c;\ c = a; a = b; b = c;} /* exchange shorts */ #define PLOT(xx, yy) {register unsigned short *sp;\ sp = &bitmap[yy][xx >> MSKBT]; *sp ^= mask[xx & MASK];} unsigned short bitmap[WINHEIGHT][WINSWIDTH]; unsigned short bmsave[WINHEIGHT][WINSWIDTH]; unsigned short bmdumb[WINHEIGHT][WINSWIDTH]; /*Without this rubber() fails */ unsigned short mask[] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000 }; extern unsigned short patblack[], patwhite[], patgray[], patltgray[]; main() { struct uwdata wns; short wn; winit(); if ( ! iswind()) { message(MT_POPUP, NULL, NULL, "can run only on bitmap"); wexit(); } if (fork()) { wait((int *)0); wpostwait(); wexit(); } wprexec(); winit(); wn = wcreate(1, 0, 24, 80, BORDCANCEL); clear(); wlabel(wn, "willieETCH 1.0"); wuser(wn, "willieETCH"); wprompt(wn, "Mouse buttons: left to etch, right to rule"); wcmd(wn, "Keyboard: Rfrsh to clear, Exit to quit\ W.A. Colon 10/84"); wputs(wn, "\033[=1C"); /* erase char. cursor */ keypad(0, 1); ioctl(wn, WIOCGETD, &wns); wrastop(wn, 0, 0, 0, 0, 0, 0, /* page in window, minimize swapping */ 0, 0, wns.uw_width, wns.uw_height, SRCPAT, DSTXOR, patblack); paint(wn); } paint(wn) short wn; { struct umdata mouse; short x0, y0; char btn; for (;;) { ioctl(wn, WIOCGETMOUSE, &mouse); mouse.um_flags = MSDOWN; ioctl(wn, WIOCSETMOUSE, &mouse); waitmouse(wn, &x0, &y0, &btn); if (btn & MBUTL) etch(wn, x0, y0); else if (btn & MBUTR) rubber(wn, x0, y0); else if (btn & MBUTM) message(MT_POPUP, NULL, NULL, "pens not yet implemented"); } } waitmouse(wn, xp, yp, bp) short wn; short *xp, *yp; char *bp; { int c; int x, y; int btni, dummy; for (;;) { c = wgetc(wn); if (c == Exit || c == Cancl || c == s_Cancl) wexit(1); if (c == Rfrsh) clear(); if (c == Mouse) { wreadmouse(wn, &x, &y, &btni, &dummy); *xp = x; *yp = y; *bp = btni; return; } } } rectmouse(wn, x, y) short wn, x, y; { struct umdata mouse; ioctl(wn, WIOCGETMOUSE, &mouse); mouse.um_flags = MSUP | MSOUT; mouse.um_x = x; mouse.um_y = y; mouse.um_w = mouse.um_h = 1; ioctl(wn, WIOCSETMOUSE, &mouse); } etch(wn, x0, y0) short wn; short x0, y0; { short x1, y1; char btn; short xb, yb; /* upper left of affected rect. */ short dx, dy; /* dimensions of affected rect. */ for (;;) { rectmouse(wn, x0, y0); waitmouse(wn, &x1, &y1, &btn); if (btn == 0) break; if (x1 == x0 && y1 == y0) continue; vector(x0, y0, x1, y1); xb = MIN(x1, x0); yb = MIN(y1, y0); dx = abs(x1 - x0) +1; dy = abs(y1 - y0) +1; wrastop(wn, bitmap, WINBWIDTH, 0, 0, xb, yb, xb, yb, dx, dy, SRCSRC, DSTOR, 0); wrastop(wn, 0, 0, bitmap, WINBWIDTH, 0, 0, xb, yb, dx, dy, SRCPAT, DSTSRC, patblack); x0 = x1; y0 = y1; } } vector(x0, y0, x1, y1) short x0, y0, x1, y1; { register short e, x, y; /* Bresenham alg. variables */ register short far, step; register short dy2, dx2; short first; char rotate; short dy, dx; /* deltas */ dy = y1 - y0; dx = x1 - x0; if (abs(dy) <= abs(dx)) rotate = FALSE; else { rotate = TRUE; EXCHS(x0, y0); EXCHS(x1, y1); EXCHS(dx, dy); } if (dx < 0) { EXCHS(x0, x1); EXCHS(y0, y1); dx = -dx; dy = -dy; } if (dy < 0) { first = x1; far = x0 - 1; y = y1; step = -1; dy = -dy; } else { first = x0; far = x1 + 1; y = y0; step = 1; } dy2 = 2 * dy; dx2 = 2 * dx; e = dy2 - dx; for (x = first; x != far; x += step) { if (rotate) PLOT(y, x) else PLOT(x, y) if (e > 0) { y += 1; e += dy2 - dx2; } else e += dy2; } } rubber(wn, x0, y0) short wn, x0, y0; { extern unsigned short patblack[]; /* to clear bitmap */ short x1, y1, x2, y2; short minx, miny, maxx, maxy; short dx, dy; char btn; maxx = minx = x1 = x0; maxy = miny = y1 = y0; for (;;) { rectmouse(wn, x1, y1); waitmouse(wn, &x2, &y2, &btn); if (btn == 0) break; if (x2 == x1 && y2 == y1) continue; minx = MIN(x0, x1); minx = MIN(minx, x2); miny = MIN(y0, y1); miny = MIN(miny, y2); maxx = MAX(x0, x1); maxx = MAX(maxx, x2); maxy = MAX(y0, y1); maxy = MAX(maxy, y2); dx = maxx - minx +1; dy = maxy - miny +1; wrastop(0, bitmap, WINBWIDTH, bmsave, WINBWIDTH, minx, miny, minx, miny, dx, dy, SRCSRC, DSTSRC, 0); vector(x0, y0, x2, y2); wrastop(wn, bitmap, WINBWIDTH, 0, 0, minx, miny, minx, miny, dx, dy, SRCSRC, DSTXOR, 0); wrastop(0, bmsave, WINBWIDTH, bitmap, WINBWIDTH, minx, miny, minx, miny, dx, dy, SRCSRC, DSTXOR, 0); x1 = x2; y1 = y2; } wrastop(wn, bitmap, WINBWIDTH, 0, 0, minx, miny, minx, miny, dx, dy, SRCSRC, DSTOR, 0); wrastop(0, bitmap, WINBWIDTH, bitmap, WINBWIDTH, minx, miny, minx, miny, dx, dy, SRCSRC, DSTXOR, 0); } 0707070000020023061007550001460001440000010255660352163167000000500000027240etchRG3 v0.HЀ=@0n46.`vJ.g$0Z-@0HЀ"| E0`"0Z-@0HЀ"| E0HrЀ"| 01RJBo RD0n@`GFEfLN^NuNV0.=@=@=@0.=@=@=@`0.nm0.H=@nl0.`0.H=@0.nm0.H=@nl0.`0.H=@0.nn0.H=@no0.`0.H=@0.nn0.H=@no0.`0.H=@0.nR@=@0.nR@=@p./p/0.H/0.H/0.H/0.H/0.H/0.H/pZ//< jl//< p/N140.H.0.H/0.H/0.H/N p.p/p/0.H/0.H/0.H/0.H/0.H/0.H/p//pZ//< 0. H/N14p.p/p/0.H/0.H/0.H/0.H/0.H/0.H/pZ//< //< jlp/N14=n=n0.H.0.H/0. H/NPHnHnHn0. H/N(J.g0.nf0.nf`p.p/p/0.H/0.H/0.H/0.H/0.H/0.H/p//pZ//< 0. H/N14p.p/p/0.H/0.H/0.H/0.H/0.H/0.H/pZ//< //< p/N14N^Nu1getgrent1getgrgid1getgrnam1setgrent1endgrent1getlogin1getopt1getpass1getpw1getpwent1getpwuid1getpwnam1setpwent1endpwent1gets1getchar1 fgets1getutent1getutid1getutlin1$pututlin1*setutent10endutent16utmpname1<malloc1Bfree1Hrealloc1Ncalloc1Tcfree1Zmemccpy1`memchr1fmemcmp1lmemcpy1rmemset1xmktemp1~monitor1perror1popen1pclose1printf1fprintf1sprintf1fputc1putw1putpwent1puts1putchar1fputs1scanf1fscanf1sscanf1setbuf1sleep1ssignal1gsignal1strcat1strncat1strcmp1strncmp1strcpy1strncpy1strlen1 strchr1&strrchr1,strpbrk12strspn18strcspn1>strtok1Dstrtol1Jatol1Patoi1Vswab1\system1btmpfile1htmpnam1ntempnam1tttyname1zisatty1ttyslot1ungetc1_filbuf1_flsbuf1lmul__1lmul1ldiv__1ldiv1lrem__1lrem1aldiv1almul1alrem1ulmul1uldiv__1uldiv1ulrem__1ulrem1qsort1l3tol1ltol31tgetflag1tgetent1 tgetstr1tgetnum1tgoto1tputs1"form1(menu1.message14setattr1:pb_open1@adf_gtxc1Fadf_gtwr1Lpb_gets1Rpb_check1Xpb_weof1^pb_seek1dpb_puts1jpb_name1ppb_empty1vpb_gbuf1|adf_gtto1wrefresh1track1wcreate1initscr1cbreak1attroff1nl1attron1flushinp1noecho1inch1getch1savetty1resetty1echo1nocbreak1nonl1wdelete1wprexec1wpostwai1wgetc1kcodemap1keypad1 wsigintr1wind1wsigcatc1winit1$wsetbuf1*iswind10wexit16endwin1<wgetpos1Bwgoto1Hwinstr1Nwreadmou1Twsetmous1Zwgetmous1`wnl1fwndelay1lwprompt1rwguser1xwcmd1~wslk1wlabel1wuser1wprintf1printw1wputc1wputs1wrastop1wselect1wgetsel1wsetstat1wgetstat1setty1fixterm1physclr1resetter1setterm1getterm1baudrate1parselin1slkcol1setjmp1longjmp1afmulf1afdivf1afaddf1_cvfd1 _cvif1&fltused1,syment12fmul18fdiv1>fadd1Dfsub1J_cvdf1P_cvdi1V_cvid1\_cvfi1bafadd1hafsub1nafsubf1tafmul1zexhelp1tolower1wicon1wicoff1toupper1l64a1a64l1_bufsync1setuname1auldiv1eprintf1dbsub__1dbadd__1dbdiv__1dbmul__1ltodb__1dbtol__1dbtofl__1fltodb__1ltofl__1fltol__1ultodb__1ultofl__1aulmul1 afdiv1dbtst__1fltst__1plock1"dial1(callout1.undial14drand481:erand481@lrand481Fmrand481Lsrand481Rjrand481Xseed481^lcong481drand1jsrand1p_startmain<_end xx mouse  wn ws myicon name ball myscore youscore beepflag xinc yinc xball yball diff finsetupfstartRdomousetscorenewgame_etext etext _edata edata end 0707070000020023141007550001460001440000010255150352163174600001300000000000TRAILER!!!t1strcmp1strncmp1strcpy1strncpy1strlen1 strchr1&strrchr1,strpbrk12strspn18strcspn1>strtok1Dstrtol1Jatol1Patoi1Vswab1\system1btmpfile1htmpnam1ntempnam1tttyname1zisatty1ttyslot1ungetc1_filbuf1_flsbuf1lmul__1lmul1ldiv__1ldiv1lrem__1lrem1aldiv1almul1alrem1ulmul1uldiv__1uldiv1ulrem__1ulrem1qsort1l3tol1ltol31tgetflag1tgetent1 tgetstr1tgetnum1tgoto1tputs1"form1(menu1.message14setattr1:pb_open1@adf_gtxc1Fadf_gtwr1Lpb_gets1Rpb_check1Xpb_weof1^pb_seek1dpb_puts1jpb_na