v01i042: qix: An arcade games for X, Part01/01

Mike Wexler mikew at wyse.wyse.com
Thu Sep 15 04:02:41 AEST 1988


Submitted-by: Dan Heller <island!maui!argv at Sun.COM>
Posting-number: Volume 1, Issue 42
Archive-name: qix/part01

: This is a shell archive file. Remove everything above this line
: to unbundle. chmod +x "thisfile", then run it: e.g. % thisfile
: SHAR archive format.  Archive created Sat Sep 3 21:53:28 PDT 1988
: file contains: 
:	Makefile
:	README
:	qix.man
:	qix.h
:	patchlevel.h
:	main.c
:	joystick.c
:	sparks.c
:	regions.c
:	qmove.c
:	polyfill.c
:	polygon_area.c
:	polyfill_rec.c
:	score.c
:	joystick.lf
:	joystick.rt
:	joystick.up
:	joystick.dn
:	joystick.stop
:	spark1.pr
:	spark2.pr
:	spark3.pr
:	spark4.pr
:	marker.cursor
:	qix.icon
:	mouse.rt.icon
:	jstick.dn.xbm
:	jstick.lf.xbm
:	jstick.rt.xbm
:	jstick.stop.xbm
:	jstick.up.xbm
:	pen.xbm
:	mse.lf.gr.xbm
:	mse.lf.xbm
:	mse.mid.gr.xbm
:	mse.mid.xbm
:	mse.rt.icon.xbm
:	spark1.pr.xbm
:	spark2.pr.xbm
:	spark3.pr.xbm
:	spark4.pr.xbm
echo x - Makefile
sed 's/^X//' > Makefile <<'+END+OF+Makefile'
X#
X# Makefile for qix.
X# 1988 (c) Dan Heller <island!argv at sun.com>
X# To compile for X11, have CFLAGS have "-DX11" in it and "make xqix"
X# To compile for Sunview, don't have -DX11 and type "make qix"
X#
XCFILES= main.c joystick.c sparks.c regions.c qmove.c polyfill.c \
X	polygon_area.c polyfill_rec.c score.c
XOBJS= main.o joystick.o sparks.o regions.o qmove.o polyfill.o score.o
XREC_OBJS= main.o joystick.o sparks.o regions.o qmove.o \
X	polygon_area.o polyfill_rec.o
XICONS= joystick.lf joystick.rt joystick.up joystick.dn joystick.stop \
X	spark1.pr spark2.pr spark3.pr spark4.pr marker.cursor qix.icon \
X	mouse.rt.icon
XXICONS= jstick.dn.xbm jstick.lf.xbm jstick.rt.xbm jstick.stop.xbm \
X	jstick.up.xbm pen.xbm mse.lf.gr.xbm mse.lf.xbm \
X	mse.mid.gr.xbm mse.mid.xbm mse.rt.icon.xbm spark1.pr.xbm \
X	spark2.pr.xbm spark3.pr.xbm spark4.pr.xbm
XMISC= README qix.man qix.h patchlevel.h
X
X#	Change these to suit your installation
XSCOREFILE=/usr/games/lib/qix.scores
XBINDIR=/usr/games
X
XCFLAGS= -O -DX11 -DDEBUG
XLDFLAGS= -g
XLIBS= -lsuntool -lsunwindow -lpixrect
XXLIBS= -lX11
X
Xxqix: $(OBJS)
X	@echo loading...
X	@cc ${LDFLAGS} ${OBJS} ${XLIBS} -o xqix
X
Xqix:	${OBJS}
X	@echo loading...
X	@cc ${LDFLAGS} ${OBJS} ${LIBS} -o qix
X
Xinstall: qix
X	install -s -c -m 2711 -o games -g games qix ${BINDIR}
X	touch ${SCOREFILE}
X	chmod 660 ${SCOREFILE}
X	-chgrp games ${SCOREFILE}
X	-chown games ${SCOREFILE}
X
Xscore.o:
X	cc $(CFLAGS) -DSCOREFILE=\"${SCOREFILE}\" -c score.c
X
X# qix with a recursive polygon file rather than iterative.
X# If you use it you have to unlimit the stacksize in csh
X# and check the code to make sure it's called right (it's old).
X# (not for X11)
Xqrec: ${REC_OBJS}
X	@echo loading...
X	@cc ${LDFLAGS} ${REC_OBJS} ${LIBS} -o qrec
X
Xtarmail : ;  tar fcv - Makefile ${MISC} ${CFILES} ${ICONS} ${XICONS} | \
X	compress | btoa > qix.tarmail
X
Xshar: ; shar Makefile ${MISC} ${CFILES} ${ICONS} ${XICONS} > qix.shar
X
Xclean:
X	rm -f qix $(OBJS) core errs
X
Xlint:
X	lint -hbx $(CPPFLAGS) $(CFILES) $(LIBS)
+END+OF+Makefile
echo '-rw-rw-rw-  1 argv         1975 Sep  3 21:50 Makefile    (as sent)'
chmod u=rw,g=rw,o=rw Makefile
ls -l Makefile
echo x - README
sed 's/^X//' > README <<'+END+OF+README'
X
XQix -- the video game by Taito (I think).  This is a direct ripoff of
Xthat game for demonstration purposes only (please, no wagering).  It runs
Xunder Sunview for Sun Workstations and under X11R2 for anything that'll
Xrun X11R2.
X
XThis program was written by Dan Heller <island!argv at sun.com> except
Xwhere noted (see below).
X
XTo move around on the screen, move the mouse in the direction you want
Xto go and the pen will [eventually] go that way.  Under Sunview, it's
Xpretty quick.  Under X11...well...  For either interface, however, the
Xpreferred mode of movement is using the keys h,j,k,l (remember rogue?).
XUse a shift key to draw a line while moving.  To draw a line slowly,
Xyou need to use the middle mouse button and move.  since better players
Xuse the "slow" draw seldomly, you will rarely have to use it often.
X
XTo stop the game, select the *right* mouse button twice; once to stop
Xthe pen, and the second to stop the game.  Move to the window which started
Xthe game and ^C.  Sorry, I wasn't into building a user interface for this.
X
X-----------
XQix under X11R2:
X
X    Just define "X11" in the Makefile and make sure you have the
XX11 *.xbm bitmaps.  There is no timouts because X is too slow to
Xbother dealing with it.  Basically, the main loop will test to see
Xif there is an event (you move the mouse or push a button) and if
Xso, service it.  Then it moves the items on the board (qix, sparx,
Xyour pen, etc).  If there are no events pending, it will just move
Xthe items on the board.
X
XThe performance under X11 is *bad* at best.  In fact, it's hardly
Xworth playing at all -- but it does demonstrate how to use some of
Xthe lower level routines.
X
XIF YOU WANT TO IMPROVE PERFORMANCE OF THIS PROGRAM, make a widget out
Xof the the main drawing board and use the internal timer that is
Xintrinsic to the toolkit:  XtAddTimeOut()...  Use the xclock widget
Xas an example, if you don't know how to do this.
X
X-----------
XSunView qix:
X
Xcolor support:
X    Ian Donaldson <uunet.uu.net!munnari!koel.rmit.oz.au!rcodi>
X
XIn addition to Ian's changes:
X
XNew command line option "-s timeout" where timeout is in milliseconds.
XMachines with a graphics processor run significantly faster and the player
Xhasn't a chance.  I've noticed that running with a gp, -s 50000 should
Xbe sufficient.
X
XThe program has been speeded up slightly -- it was too easy.  The qix is
Xmore aggressive and faster beginning at the second screen.
X
XThe program figures out whether you're running in color and if so, it
Xwill speed up a little for those without gp's so that it runs about
Xthe same speed as a sun3/50.
X
XThe scorefile is created if it doesn't already exist.
+END+OF+README
echo '-rw-rw-rw-  1 argv         2628 Aug 27 21:45 README    (as sent)'
chmod u=rw,g=rw,o=rw README
ls -l README
echo x - qix.man
sed 's/^X//' > qix.man <<'+END+OF+qix.man'
X.\" @(#)qix.6 2.0 8/30/88 (c) Dan Heller
X.\" <island!argv at sun.com>
X.TH QIX 6 "30 August 1988"
X.SH NAME
Xqix \- play a game of qix
X.SH SYNOPSIS
X.B qix
X[ -r ]
X.SH DESCRIPTION
X.LP
X.I Qix
Xwas originally a video game written owned by Taito Corporation.
XI spent enough money learning to get good at this game that it's
Xbeen embedded in my head for years.  Now that this game is written,
XI've got \fIcentipedes\fP to deal with.
XWhen \fIQix\fP starts up, it is running in demo mode to show the
Xuser how to play it.  You will probably figure it out much more easily
Xthan reading this silly man page.  After all, you don't get man pages
Xfor the games you play in an arcade, do you?
X
XThe -r command line option specifies reverse video for X11 only.
X
X.SH RULES
XSince you're still with me, I'll tell you the rules of the game.
XThe object is to use the \fIpen\fP to draw lines which will enclose
Xa region which will give you points.  If you enclose more than 75%
Xof the board, then the board is cleared and the level of difficulty
Xincreases.  When drawing lines, you can't cross over lines that are
Xnot already part of a region; that is to say, you can't self-intersect
Xa line.  You may move around the board freely without drawing lines
Xas long as you remain on lines that have already been drawn.  Once you
Xstart drawing, you \fIcannot stop\fP drawing until you have completed
Xa region.  See, you're already getting confused, I can tell.
X
X.IR "Things to watch out for (enemies)."
XWhen moving about the board, the \fIQix\fP will try to kill you.
XThis is an object with 7 lines that moves (seemingly) randomly bouncing
Xoff things everywhere.  You are safe from the qix while you are not drawing
Xany lines.  If you are drawing lines, the qix may hit you or any part
Xof your unconnected line.
X
XWhile you're trying to avoid the qix, you might get zapped by \fIsparx\fP.
XThese are electical pulses of something-or-other which has yet to be defined,
Xso it's best to stay away from them.  Sparx are always released in pairs
Xat the top of the playing board during play.  Sparks can zap you even
Xthough you're not drawing lines.  In fact, normal sparx can't zap you
Xif you're drawing lines (hint: this is a way to escape sparx, but then
Xthere's that damn qix you gotta avoid).  If you start taking too much time,
Xsparx will become \fIaggressive\fP and will follow you along your new
Xlines if you're drawing.  You will be informed when sparx become aggressive.
X
XIf that's not enough to avoid, there is the the \fIfuse\fP.  A fuse is
Xa special case type of spark.  If you are
Xdrawing a line and you stop drawing before establishing an enclosed region,
Xa fuse will start at the beginning of your line and follow it till it
Xzaps you.  You can stop the fuse by resuming drawing.  If you stop again,
Xthe fuse will start where it left off before.
X
XAs you progress to each level, the game gets more difficult.  The qix will
Xfollow you more closely, it will go faster, it will drive you \fInuts\fP.
XSparx won't change; they remain as annoying as they do in the beginning.
XIf you progress to level 3, then there will be two qix to deal with.
XIf you split the two qix by drawing a line which separates them, then
Xyou proceed to the next screen and all new points are doubled.  Each screen
Xafter this repeats this.  You go from 2-times values to 3-times, and so on.
X
X.SH "PLAYING THE GAME"
XActually moving the joystick is indeed the most difficult, frustrating
Xand bothersome part about learning this game.  But that's the price \fIyou\fP
Xpay for the number of blisters \fII\fP got on my first $50 with the coin-op
Xversion of \fIQix\fP.  Since this games runs under two different windowing
Xsystems, how easy it is to use is very dependent on which windowing system
Xyour particular computer is using.  If it's \fISunview\fP, you'll do ok.
XIf it's \fIX11\fP, then plan on spending some time with it.
X
XThere are two different ways to move the pen.  The mouse and the keyboard.
XThe keyboard is much easier than the mouse, so I suggest you put the mouse
Xaway.  At the bottom of the board there is an icon of the joystick which
Xshows which direction the mouse is moving (or wants to move).  To start
Xthe game, send me a quarter in the mail and click the right mouse button
Xor press the spacebar.  To move the pen around, move the mouse in the
Xdirection you want to go.  To draw a line, do as above, but press the
Xleft mouse button to draw a fast line, or the middle button to draw a
Xslow line.  Slow lines go twice the speed as fast lines, but you get
Xtwice the points for the area you cover.  You can change speeds from
Xslow to fast, but not from fast to slow.  To stop the pen, press the
Xspacebar once or the right mouse button once.  To suspend the game
X(that is, stop all movement and free the mouse to move about the console),
Xpress the spacebar or right mouse button a second time (from a \fIstop\fP
Xstate).  To terminate the game, acheive this state, move the mouse to
Xthe window which started this thing and hit ^C.  Or, you could just unplug
Xthe computer; both are effective.
X
XTo use the keyboard to move the pen around, the letters h, j, k, and l,
Xare used to move left, down, up and right respectively.  To draw a line,
Xuse a capital letter of each direction.  You'll find that the game will
Xrespond more quickly to keyboard input than mouse input.  The game \fBwill\fP
Xrespond to mouse movement, there is a delay and it's hard to get used to.
XThere used to be a method of drawing slow lines using the keyboard only,
Xbut it doesn't seem to work anymore, so I won't tell you about it.  If you
Xneed to draw a slow line, use the mouse.
X
XYou are given 5 (lives) chances and then you have to send me another
Xquarter to play again.
X
X.SH "SOURCE CODE AND AUTHOR INFORMATION"
XThis program was written for the Sun Workstation by Dan Heller with
Xsome added help by Sky Schultz for his interesting method of polygon
Xfills.  A completely non-intuitive, but effective, method of polygon
Xfill is found in auxiliary files distributed with the source.  This
Xstuff was written by Don Hatch who happens to be working at Ardent
XComputer right now, but they had nothing to do with it.
X
XA port to X11 was done in July, 1988 by Dan Heller in an attempt to
Xmake an X11 program out of a Sunview program.  If you don't know X
Xalready, I highly discourage using the source to this program as an
Xexample.  If you know Sunview, then you might find it quite helpful
Xsince virtually all of it is in Sunview; the X port is mostly defines
Xand stuff to get it to work.  The X version does not use the toolkit
Xat all.  It is implemented using the raw Xlib libraries only.
X
XPlease send comments, bug reports and quarters to:
X.in +2
X.nf
XDan Heller
X<island!argv at sun.com>
+END+OF+qix.man
echo '-rw-rw-rw-  1 argv         6704 Aug 30 22:07 qix.man    (as sent)'
chmod u=rw,g=rw,o=rw qix.man
ls -l qix.man
echo x - qix.h
sed 's/^X//' > qix.h <<'+END+OF+qix.h'
X/*
X * prototype joystick -- simple window with a joystick.
X * click right mouse button to activate joystick.
X * move mouse in direction to move drawing marker.
X * click left mouse button to draw fast.
X * click middle mouse button to draw slow.
X * click right to stop moving.
X * click right mouse twice (after stop moment) to return to normal state.
X *
X * For sunview compiles, use -lsuntool -lsunwindow -lpixrect libraries.
X * For X11R2 compiles, use -lX11 library.
X */
X#include <stdio.h>
X#include <ctype.h>
X
X#ifdef X11
X#include <X11/Xos.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X#include <X11/keysym.h>
X#include <X11/Xatom.h>
X#include <signal.h>
X#define TRUE  1
X#define FALSE 0
X#define max(a,b)	((a)>(b)?(a):(b))
X#define min(a,b)	((a)<(b)?(a):(b))
X
X#else /* USE SUNVIEW */
X
X#include <suntool/sunview.h>
X#include <suntool/canvas.h>
X#include <sunwindow/cms_rainbow.h>
X#include <sys/time.h>
X#endif /* X11 */
X
X/* qix uses 0..7 */
X#define QIX_COLOR_BASE  0
X#define TEXT_COLOR	8
X#define SLOW_DRAW_COLOR 16
X#define FAST_DRAW_COLOR 32
X#define SPARKS_COLOR 	RED
X#define AGGR_SPARK_COLOR 	BLUE
X#define BORDER_COLOR 	128
X
X#define QIX_CMS_SIZE	256
X#define QIX_CMS_NAME	"QIX"
X
Xextern int text_mask;
Xextern int qix_mask;
Xextern int fast_draw_mask;
Xextern int slow_draw_mask;
Xextern int border_mask;
Xextern int all_mask;
X
X#define when 		break;case
X#define otherwise	break;default
X#define rrand		random
X
X#ifdef X11
XDisplay		*dpy;
XWindow		draw_win, joystick_win;
XGC		src_gc, xor_gc, clr_gc;
X#define		frame
XXFontStruct	*big_font, *small_font;
X
X#define l_width(font)	(font)->max_bounds.width
X#define l_height(font)	((font)->ascent + (font)->descent)
X
Xtypedef XEvent Event;
Xtypedef Window Canvas;
X#define LOC_MOVE	1000 /* arbitrarily assigned numbers */
X#define MS_LEFT		1001
X#define MS_MIDDLE	1002
X#define MS_RIGHT	1003
X#else
X/* Sunview */
X#define l_width(font)	(font)->pf_defaultsize.x
X#define l_height(font)	(font)->pf_defaultsize.y
X
XFrame		frame;
XCanvas		Draw, Joystick;
XPixwin		*draw_win, *joystick_win;
XPixfont		*big_font, *small_font;
X#endif /* X11 */
X
Xint
X    /* routines to call on sigalrm or sigwinch */
X    move_joystick(), move_pen(), redraw_board(),
X    score, 		/* players score */
X    lives,		/* chances left before end of game */
X    nitems;		/* number of x/y coords in current line drawn */
X
X#define MAX_LIVES	5  /* each game gives 5 lives */
X#define LIVE		1
X#define DIE	       -1
X
X#define SPARK_TIME    500
X
Xstruct itimerval timeout;
X
Xlong interval; /* 50000 for monochrome or 35000 for color displays */
X#ifdef X11
X#define start_timer() /* no-op */
X#define stop_timer() /* no-op */
X#else
X#define start_timer()  \
X    timeout.it_value.tv_usec = interval, setitimer(ITIMER_REAL, &timeout, NULL)
X#define stop_timer()  \
X    timerclear(&timeout.it_value), setitimer(ITIMER_REAL, &timeout, NULL)
X#endif /* X11 */
X
X#define LINE_SPACE			5 /* dist pen draws from other lines */
X#define MARKER_WIDTH			8
X#define TOP_BORDER			25
X#define BORDER				10 /* should be larger than MARKER_W */
X
X#define FRAME_X				250
X#define FRAME_Y				45
X#define BOARD_WIDTH_IN_PIXELS		700
X#define BOARD_HEIGHT_IN_PIXELS		750
X#define BOARD_WIDTH	((BOARD_WIDTH_IN_PIXELS - 2 * BORDER)/LINE_SPACE)
X#define BOARD_HEIGHT	((BOARD_HEIGHT_IN_PIXELS-BORDER-TOP_BORDER)/LINE_SPACE)
X#define TOTAL_AREA	((BOARD_WIDTH-1) * (BOARD_HEIGHT-1))
X#define TOTAL_QUADRANTS	(TOTAL_AREA * 4)
X
X#define MID_X			BOARD_WIDTH_IN_PIXELS / 2
X#define MID_Y			BOARD_HEIGHT_IN_PIXELS / 2
X
X/* the board is a two dimentional array of ints. Values of ints are masked */
Xint board[BOARD_WIDTH][BOARD_HEIGHT];
X
X/*
X * each "cell" ("_CL_") in the playing board may have values masked in.
X * If a line is drawn thru a cell, it is entered from one direction and
X * is exited to another direction.  It may be reentered thus setting the
X * bits again.  When a region is "closed", it will be painted with a value
X * "_PNT_" -- initially, the left border of the board will contain cells whose
X * values will have left parts of the cells painted and right parts unpainted.
X */
X#define CL_LN_RT   		0x0001
X#define CL_LN_LF		0x0002
X#define CL_LN_UP  		0x0004
X#define CL_LN_DN 		0x0008
X#define CL_PNT_UL		0x0010
X#define CL_PNT_UR		0x0020
X#define CL_PNT_LR		0x0040
X#define CL_PNT_LL		0x0080
X
X#define OLD_LINE		0x1000 /* line may be new, old, or neither */
X#define NEW_LINE		0x2000
X
X#define CL_PNT_TOP		(CL_PNT_UL | CL_PNT_UR)
X#define CL_PNT_BOT		(CL_PNT_LL | CL_PNT_LR)
X#define CL_PNT_LEFT		(CL_PNT_UL | CL_PNT_LL)
X#define CL_PNT_RIGHT		(CL_PNT_UR | CL_PNT_LR)
X#define PAINTED			(CL_PNT_UL|CL_PNT_UR|CL_PNT_LL|CL_PNT_LR)
X
X#define check_painted(x, y, paint) ((board[x][y] & paint) == paint)
X
X#define SENS_FACTOR 1    /* mouse must move this many pixels to move joystick */
X
X#define convert_x(coord) ((coord) * LINE_SPACE + BORDER)
X#define convert_y(coord) ((coord) * LINE_SPACE + TOP_BORDER)
X#define pen_coord_x(coord) (convert_x(coord) - MARKER_WIDTH)
X#define pen_coord_y(coord) (convert_y(coord) - MARKER_WIDTH)
X
X#ifdef X11
Xtypedef XPoint Point;
Xextern Pixmap pen_image;
X#define place_pen()		\
X	XCopyArea(dpy, pen_image, draw_win, xor_gc, 0, 0, \
X		  16, 16, pen_coord_x(pen_x), pen_coord_y(pen_y))
X#define pw_putattributes(a,b)	/* no-op */
X#define PIX_COLOR(x)		0  /* For X, this is a no-op */
X#define PIX_SRC			GXcopy
X#define PIX_CLR			GXcopyInverted
X#define SRC_OR_DST		GXor /* used to render text only */
X#define XOR			GXxor
X#define pw_rop(win, x, y, width, height, op, image, offs_x, offs_y) \
X	XCopyArea(dpy, image, win, (op) == GXcopy? src_gc : clr_gc, \
X	    offs_x, offs_y, (unsigned)width, (unsigned)height, x, y)
X#define draw(x1,y1,x2,y2,OP)	\
X	XDrawLine(dpy, draw_win, \
X	 (OP) == GXcopy? src_gc : (OP) == GXxor? xor_gc : clr_gc, x1,y1, x2,y2)
X#define box(x1, y1, x2, y2, OP) \
X	XDrawRectangle(dpy, draw_win, \
X	    (OP) == GXcopy? src_gc : xor_gc, x1,y1,(x2)-(x1),(y2)-(y1))
X
X#else
X/* Sunview stuff */
Xtypedef struct pr_pos Point;
Xtypedef struct pixrect *Pixmap;
X
X/* place_pen() macro XOR's the pen at its current coordinates */
X#define place_pen() \
X	    pw_putattributes(draw_win, &qix_mask), \
X	    pw_rop(draw_win, \
X		pen_coord_x(pen_x), pen_coord_y(pen_y), \
X		16, 16, XOR|PIX_COLOR(VIOLET), pen_image, 0, 0)
X
X#define XOR (PIX_SRC^PIX_DST)
X#define SRC_OR_DST (PIX_SRC|PIX_DST)
X#define draw(x1,y1,x2,y2,OP) 	pw_vector(draw_win, x1,y1,x2,y2,(OP),1)
X
X#define box(x1,y1,x2,y2,OP) 	\
X    draw(x1,y1,x1,y2,OP), draw(x1,y2,x2,y2,OP), \
X    draw(x2,y2,x2,y1,OP), draw(x2,y1,x1,y1,OP)
X#endif /* X11 */
X
X#ifdef DEBUG
X/* "Bert" is the little man who follows points in debug mode */
X#define show_bert(x, y) \
X	if (debug > 2) \
X	    box(convert_x(x)-3, convert_y(y)-3, \
X		convert_x(x)+3, convert_y(y)+3, XOR), \
X	    usleep(30000), \
X	    box(convert_x(x)-3, convert_y(y)-3, \
X		convert_x(x)+3, convert_y(y)+3, XOR)
X#endif /* DEBUG */
X
Xextern Pixmap pen_image;
X
Xint
X    moving,		/* if moving (e.g. !NO_MOVE), which direction */
X#define NO_MOVE 0
X#define STOP	1
X#define LEFT	2
X#define RIGHT	3
X#define UP	4
X#define DOWN	5
X#define LEFT_OF(d)	(d==UP? LEFT : d==LEFT ? DOWN : d==DOWN ? RIGHT : UP)
X#define RIGHT_OF(d)	(d==UP? RIGHT : d==RIGHT ? DOWN : d==DOWN ? LEFT : UP)
X#define OPP_OF(d)	(d==UP? DOWN : d==RIGHT ? LEFT : d==DOWN ? UP : RIGHT)
X
X    pen_x, pen_y,	/* the coordinates of the drawing pen */
X    fast,		/* when we're drawing, are we drawing "fast"? */
X    is_alive,		/* if the current play is active or not */
X    drawing,		/* boolean: the pen is/not down (drawing) */
X    level,		/* completing 75% of the board raises you one level */
X    Speed;		/* aggressiveness/speed of qix */
X#define MAX_SPEED	15  /* I don't think speed'll ever reach this */
X
Xstruct region {
X    int x, y;
X    struct region *next, *prev;
X} *region, *cur_coord, *fuse;
X
Xint saved_edge;   /* Starting edge's original value of newly drawn lines */
Xint area_closed;
X#ifdef DEBUG
Xint debug, no_qix_kill;	  /* debugging stuff */
X#endif /* DEBUG */
X
Xint play_mode;
X#define REAL_PLAY	-1		/* must be last in list */
X#define SHOW_SCORES	0
X#define SHOW_POINTS	1
X#define SHOW_QIX	2
X#define SHOW_SPARKS	3
X#define SHOW_FUSE	4
X#define SHOW_SPIRAL	5
X#define DEMO		6
X
Xint time_left;
+END+OF+qix.h
echo '-rw-rw-rw-  1 argv         8081 Sep  3 21:17 qix.h    (as sent)'
chmod u=rw,g=rw,o=rw qix.h
ls -l qix.h
echo x - patchlevel.h
sed 's/^X//' > patchlevel.h <<'+END+OF+patchlevel.h'
X#define PATCHLEVEL 0
+END+OF+patchlevel.h
echo '-rw-rw-r--  1 argv           21 Sep  3 21:50 patchlevel.h    (as sent)'
chmod u=rw,g=rw,o=r patchlevel.h
ls -l patchlevel.h
echo x - main.c
sed 's/^X//' > main.c <<'+END+OF+main.c'
X/*
X * The game of Qix for the Sun3 workstation running Sunview (probably 3.0)--
X * X11 version updated by Dan Heller June 1988.
X * Appearance ONLY shamelessly stolen from the real video game wonderfully
X * and admirably written by individual(s) unknown at Taito Corp (I think).
X *
X * Copyright 1987 by Dan Heller
X *	island!argv at sun.com
X *	dheller at dheller@ucbcory.berkeley.edu
X *
X * Various polygon filling routines written by
X *   -- Dan "Sky" Shultz
X *   -- Don Hatch (ardent!hatch at ucbcad.berkeley.edu)
X *      additional help (general debugging, recursive polyfill)
X *
X * Move mouse to go in direction.  Left button does fast draw. Middle does
X * slow draw.  Rogue/vi keys moves -- upper case draws.  There is no slow
X * draw for keyboard input.
X */
X
X#include "qix.h"
X
X#ifndef X11
X/* the main icon for when the tool is closed */
Xshort qix_icon_dat[] = {
X#include "qix.icon"
X};
XDEFINE_ICON_FROM_IMAGE(qix_icon, qix_icon_dat);
X#endif /* X11 */
X
Xint (*old_repaint_func)();
X
Xint qix_mask 		= 0x7;
Xint text_mask 		= TEXT_COLOR;
Xint fast_draw_mask 	= FAST_DRAW_COLOR;
Xint slow_draw_mask 	= SLOW_DRAW_COLOR;
Xint border_mask    	= BORDER_COLOR;
Xint all_mask		= 0xff;
X
X#ifndef X11
Xredraw(args)
X{
X    stop_timer();
X    (*old_repaint_func)(&args);
X    start_timer();
X}
X#endif /* X11 */
X
Xmain(argc, argv)
Xchar *argv[];
X{
X    int catch();
X    char **newargv = argv;
X
X    (void) signal(SIGBUS, catch);
X    (void) signal(SIGSEGV, catch);
X    (void) signal(SIGXCPU, catch);
X
X    /*
X     * specify debug levels "-d level"
X     * a level of 2 prints polygon fill info. 4 disables spark-generation
X     * but doesn't kill current sparks.  debug level 1 does prints things...
X     */
X    while (*++newargv)
X	if (!strcmp(*newargv, "-s"))
X	    if (!*++newargv)
X		puts("usage: qix [-s timeout] (in milliseconds)"), exit(1);
X	    else {
X		if ((interval = atoi(*newargv)) < 15000 || interval > 60000)
X		    puts("delay must be between 15000 and 60000"), exit(1);
X	    }
X#ifdef DEBUG
X	else if (!strcmp(*newargv, "-q"))
X	    no_qix_kill = 1;
X	else if (!strcmp(*newargv, "-d"))
X	    debug = (*++newargv) ? atoi(*newargv) : 1;
X#endif DEBUG
X
X    init_win(argc, argv);
X
X    level = -2; /* two screens before player may split two qix */
X    moving = NO_MOVE;
X    fast = 1,
X
X    srandom(time(0));
X    srand(time(0));
X
X    init_qix();
X    draw_joystick();
X    play_mode = SHOW_SCORES;
X    (void) score_board(TRUE, FALSE);
X    time_left = 300; /* timeout before next demo mode switch */
X    (void) signal(SIGALRM, move_pen);
X    start_timer();
X
X    window_main_loop(frame);		/* main loop to read input */
X    exit(0);
X}
X
Xclear_board()
X{
X    register int x, y;
X
X    clear_sparks();
X    area_closed = 0;
X
X    pen_x = (BOARD_WIDTH-1)/2, pen_y = BOARD_HEIGHT-1;
X    remove_msgs(1);
X
X    pw_putattributes(draw_win, &all_mask);
X
X    /* give left->right sweeping effect like the real game */
X    for (x = 0; x < BOARD_WIDTH_IN_PIXELS; x++)
X	draw(x, 0, x, BOARD_HEIGHT_IN_PIXELS-1, PIX_CLR);
X
X    pw_putattributes(draw_win, &border_mask);
X    box(convert_x(0), convert_y(0),
X	convert_x(BOARD_WIDTH-1), convert_y(BOARD_HEIGHT-1), 
X	PIX_SRC|PIX_COLOR(BORDER_COLOR));
X    update_score();
X
X    /* clear the interior of the board */
X    for (x = 1; x < BOARD_WIDTH-1; x++)
X	for (y = 1; y < BOARD_HEIGHT-1; y++)
X	    board[x][y] = 0;
X
X    for (x = 1; x < BOARD_WIDTH-1; x++) {
X	board[x][0] = CL_LN_LF | CL_LN_RT | OLD_LINE | CL_PNT_TOP;
X	board[x][BOARD_HEIGHT-1] = CL_LN_LF | CL_LN_RT | OLD_LINE | CL_PNT_BOT;
X    }
X
X    for (y = 1; y < BOARD_HEIGHT-1; y++) {
X	board[0][y] = CL_LN_UP | CL_LN_DN | OLD_LINE | CL_PNT_LEFT;
X	board[BOARD_WIDTH-1][y] = CL_LN_UP | CL_LN_DN | OLD_LINE | CL_PNT_RIGHT;
X    }
X    /* set the corners explicitly */
X    board[0][0] = (CL_LN_DN | CL_LN_RT | CL_PNT_TOP | CL_PNT_LEFT | OLD_LINE);
X    board[0][BOARD_HEIGHT-1] =
X	(CL_LN_UP | CL_LN_RT | CL_PNT_BOT | CL_PNT_LEFT | OLD_LINE);
X    board[BOARD_WIDTH-1][0] =
X        (CL_LN_DN | CL_LN_LF | CL_PNT_TOP | CL_PNT_RIGHT | OLD_LINE);
X    board[BOARD_WIDTH-1][BOARD_HEIGHT-1] =
X	(CL_LN_UP | CL_LN_LF | CL_PNT_BOT | CL_PNT_RIGHT | OLD_LINE);
X}
X
X/*
X * change the status of the player.  If he's living, we add special
X * effects and do the cleanup from the last game. setup the right icons
X * and grab all the io on the screen. If he's dead, release the IO
X * from the screen and reset critical values.
X */
Xchange_life(live_or_die)
X{
X    register int x, n, m = (live_or_die == -1)? 40 : 300;
X
X    stop_timer();
X    if (live_or_die == LIVE) {
X	move_fuse(fuse = (struct region *)NULL); /* erase the last fuse */
X	if (region) {
X	    pen_x = region->x, pen_y = region->y;
X	    rm_cur_line(PIX_CLR); /* remove the current line drawn */
X	}
X	if (lives <= 0) {
X	    if (play_mode == DEMO)
X		lives =  1;
X	    else
X		lives = MAX_LIVES;
X	    clear_board(); /* resets pen_x, pen_y (changes plane mask) */
X	    level = -2, score = 0;
X	} else {
X	    extern int qix1_x0[], qix1_x1[], qix1_y0[], qix1_y1[];
X	    extern int qix2_x0[], qix2_x1[], qix2_y0[], qix2_y1[];
X
X	    draw(convert_x(qix1_x0[0]), convert_y(qix1_y0[0]),
X		 convert_x(qix1_x1[0]), convert_y(qix1_y1[0]), PIX_CLR);
X	    if (level >= 0)
X		draw(convert_x(qix2_x0[0]), convert_y(qix2_y0[0]),
X		     convert_x(qix2_x1[0]), convert_y(qix2_y1[0]), PIX_CLR);
X	}
X	Speed = 3 + min(level/3, 3);
X#ifdef DEBUG
X	if (debug)
X	    printf("Speed = %d\n", Speed);
X#endif DEBUG
X	clear_sparks();
X	update_score();
X	moving = STOP;
X	drawing = FALSE;
X	if (level > 0) {
X	    msg("All scores now\n%d times\ntheir original value.", level+1);
X	    Sleep(3);
X	    remove_msgs(0);
X	}
X	place_pen(); /* make pen appear */
X    }
X
X    pw_putattributes(draw_win, &border_mask);
X    for (x = 0; x < 2; x++)
X	for (n = m; n >= 40 && n <= 300; n -= 5 * live_or_die)
X	    box(pen_coord_x(pen_x)-n/2, pen_coord_y(pen_y)-n/2,
X		pen_coord_x(pen_x)+n/2, pen_coord_y(pen_y)+n/2, 
X		XOR | PIX_COLOR(BORDER_COLOR));
X
X    if (live_or_die == DIE) {
X	is_alive = FALSE;
X	if (--lives <= 0) {
X	    int do_scores = TRUE;
X	    reset_joystick_win(TRUE);
X	    msg("Game Over.");
X	    Sleep(2);
X	    /* if he got on the scoreboard, let him put his initials up */
X	    if (play_mode == REAL_PLAY)
X		do_scores = (score_board(FALSE, FALSE) == 0);
X	    if (play_mode == SHOW_SPIRAL)
X		time_left = 50; /* demo mode comes after spiral death trap */
X	    else {
X		play_mode = SHOW_SCORES;
X		if (do_scores)
X		    (void) score_board(TRUE, FALSE), time_left = 300;
X		else
X		    time_left = 100;
X	    }
X	    moving = NO_MOVE;
X	} else {
X	    moving = STOP;
X	    drawing = 0;
X	}
X	place_pen(); /* erase pen */
X    } else {
X	is_alive = TRUE;
X	reset_joystick_win(FALSE);
X    }
X    start_timer();
X}
X
Xupdate_score()
X{
X    char buf[128];
X    int x;
X
X    (void) sprintf(buf, "Score: %6d", score);
X    pw_putattributes(joystick_win, &text_mask);
X    pw_text(joystick_win, 500, 22, PIX_SRC|PIX_COLOR(TEXT_COLOR), 
X	big_font, buf);
X
X    if (play_mode != REAL_PLAY)
X	pw_text(draw_win, 105, 12, PIX_SRC|PIX_COLOR(TEXT_COLOR), small_font,
X	    "Click RIGHT mouse button or use <spacebar> to start new game.");
X    else {
X	pw_text(joystick_win, 500, 45, PIX_SRC|PIX_COLOR(TEXT_COLOR), 
X		big_font, "Lives: ");
X	pw_putattributes(joystick_win, &border_mask);
X	for (x = 0; x < MAX_LIVES; x++)
X	    pw_rop(joystick_win, 575+(x*20), 32, 16,16, ((x < lives-1)?
X		PIX_SRC:PIX_CLR)|PIX_COLOR(BORDER_COLOR), pen_image, 0, 0);
X
X	sprintf(buf, "Filled: %d%%",(int)((double)area_closed/TOTAL_AREA*100));
X	pw_putattributes(draw_win, &text_mask);
X	pw_text(draw_win, 280, 12, PIX_SRC|PIX_COLOR(TEXT_COLOR),
X		small_font, buf);
X	pw_text(draw_win, 281, 12, SRC_OR_DST|PIX_COLOR(TEXT_COLOR),
X		small_font, buf);
X    }
X}
X
X#ifdef X11
XXImage *save[15];  /* area under text to be redisplayed upon removal of text */
X#else
XPixrect *save[15];  /* area under text to be redisplayed upon removal of text */
X#endif /* X11 */
Xint x_save[15], y_save, x_pos[15], y_pos[15];
Xstatic int msgs;   /* the number of text lines displayed on the board */
X
X/*VARARGS1*/
Xmsg(fmt, args)
Xchar *fmt;
X{
X    char buf[BUFSIZ], *index();
X    register char *p2, *p = buf;
X
X    if (y_save == 0)
X	y_save = l_height(big_font) + 1;
X
X    (void) vsprintf(buf, fmt, &args);
X#ifdef DEBUG
X    if (debug)
X	puts(buf);
X#endif DEBUG
X    pw_putattributes(draw_win, &text_mask);
X    do  {
X	if (p2 = index(p, '\n'))
X	    *p2 = 0;
X	x_save[msgs] = strlen(p) * l_width(big_font) + 1;
X	x_pos[msgs] = BOARD_WIDTH_IN_PIXELS/2 - x_save[msgs]/2;
X	y_pos[msgs] = TOP_BORDER + (1+msgs) * 2 * y_save;
X
X#ifdef X11
X	/* save_under */
X	save[msgs] = XGetImage(dpy, draw_win,
X			       x_pos[msgs], y_pos[msgs]-4,
X			       x_save[msgs], y_save+4, /* width/height */
X			       AllPlanes, XYPixmap);
X#else
X	save[msgs] = mem_create(x_save[msgs], y_save, 1);
X#endif /* X11 */
X	if (!(save[msgs])) {
X	    puts("whoops! Out of memory... no sense going on with this.");
X	    exit(1);
X	}
X#ifndef X11
X	/* sunview save_under */
X	pr_rop(save[msgs], 0, 0, x_save[msgs], y_save, PIX_SRC,
X	       draw_win->pw_prretained, x_pos[msgs], y_pos[msgs]);
X#endif /* X11 */
X	pw_text(draw_win, x_pos[msgs], y_pos[msgs]+l_height(big_font)-5,
X	    PIX_SRC | PIX_COLOR(TEXT_COLOR), big_font, p);
X	pw_text(draw_win, x_pos[msgs]+1, y_pos[msgs]+l_height(big_font)-5,
X	    SRC_OR_DST | PIX_COLOR(TEXT_COLOR), big_font, p);
X    } while (++msgs < 15 && p2 && *(p = p2+1));
X#ifdef X11
X    XFlush(dpy);
X#endif /* X11 */
X}
X
X/* remove all messages from the board and put back the images underneith */
Xremove_msgs(clearing)
X{
X    pw_putattributes(draw_win, &text_mask);
X    while (msgs--) {
X#ifdef X11
X	if (!clearing) {
X	    XPutImage(dpy, draw_win, src_gc, save[msgs], 0, 0,
X		      x_pos[msgs], y_pos[msgs]-4, x_save[msgs], y_save+4); 
X	}
X	XDestroyImage(save[msgs]);
X#else
X	if (!clearing)
X	    pw_rop(draw_win, x_pos[msgs], y_pos[msgs], x_save[msgs],  y_save,
X		PIX_SRC | PIX_COLOR(TEXT_COLOR), save[msgs], 0, 0);
X	pr_destroy(save[msgs]);
X#endif /* X11 */
X    }
X    msgs = 0;
X#ifdef X11
X    XFlush(dpy);
X#endif /* X11 */
X}
X
Xcatch(sig)
X{
X    stop_timer();
X    if (sig == SIGXCPU) {
X	msg("CPU timelimit exceeded.  Go home and eat dinner.");
X	Sleep(2);
X	remove_msgs(0);
X	return;
X    }
X    change_life(DIE);
X    if (sig == SIGSEGV)
X	fprintf(stderr, "Segmentation fault.\n");
X    else
X	fprintf(stderr, "Bus Error\n");
X    abort();
X}
X
Xvoid
Xflush_events()
X{
X#ifdef X11
X    XEvent event;
X    XSync(dpy, 0); /* throw away all queued events */
X    while (XPending(dpy))
X	XNextEvent(dpy, &event);
X#else
X    struct timeval dummy;
X    Event event;
X    int readfd = 1 << (int)window_get(Draw, WIN_FD);
X
X    timerclear(&dummy);
X    while (select(readfd+1, &readfd, 0, 0, &dummy) > 0)
X	window_read_event(Draw, &event);
X#endif /* X11 */
X}
X
XSleep(n)
X{
X    flush_events();
X    sleep(n);
X    flush_events();
X}
X
X#ifdef X11
X
Xinit_win(argc, argv)
Xchar *argv[];
X{
X    XSetWindowAttributes attr;
X    XSizeHints size;
X    XGCValues gcvalues;
X    unsigned long mask =
X	GCFunction | GCGraphicsExposures | GCForeground | GCBackground;
X    unsigned long foreground, background;
X    int reverse = 0;
X
X#define screen	DefaultScreen(dpy)
X
X    interval = 50000;
X    while (*++argv) /* X11 mode options only */
X	if (!strcmp(*argv, "-r"))
X	    reverse = 1;
X
X    if (!(dpy = XOpenDisplay(getenv("DISPLAY"))))
X	perror("can't open display"), exit(1);
X    if (!(small_font = XLoadQueryFont(dpy, "r14")) ||
X	!(big_font = XLoadQueryFont(dpy, "9x15")))
X	perror("can't open default font"), exit(1);
X    attr.override_redirect = TRUE;
X    attr.event_mask = KeyPressMask | ButtonPressMask | ButtonReleaseMask |
X		      PointerMotionMask;
X
X    foreground = BlackPixel(dpy, screen);
X    background = WhitePixel(dpy, screen);
X#ifdef NOT_NOW
X    if (reverse == TRUE)
X        attr.background_pixel = foreground;
X    else
X#endif /* NOT_NOW */
X        attr.background_pixel = background;
X
X    /* Set position and size of main window */
X    size.flags = PMinSize | PMaxSize | USPosition;
X    size.x = (DisplayWidth(dpy, screen) - BOARD_WIDTH_IN_PIXELS) / 2;
X    size.y = 30;
X    size.min_width = size.width = BOARD_WIDTH_IN_PIXELS;
X    size.min_height = size.height = BOARD_HEIGHT_IN_PIXELS + 70;
X
X    draw_win = XCreateWindow(dpy, RootWindow(dpy, screen),
X	size.x, size.y, size.width, size.height,
X        1, DefaultDepth(dpy, screen), InputOutput, DefaultVisual(dpy, screen),
X	CWOverrideRedirect | CWEventMask | CWBackPixel, &attr);
X
X    XSetNormalHints(dpy, draw_win, &size);
X    XChangeProperty(dpy, draw_win, XA_WM_NAME, XA_STRING, 8,
X	PropModeReplace, "Qix", 3);
X
X    /* Set position and size of main window */
X    joystick_win = XCreateWindow(dpy, draw_win,
X	1, size.height - 68, size.width-4, 65,
X        1, DefaultDepth(dpy, screen), InputOutput, DefaultVisual(dpy, screen),
X        CWBackPixel, &attr);
X
X    gcvalues.foreground = reverse? background : foreground;
X    gcvalues.background = reverse? foreground : background;
X    gcvalues.graphics_exposures = False;
X    gcvalues.function = GXcopy;
X    src_gc = XCreateGC(dpy, draw_win, mask, &gcvalues);
X
X    gcvalues.function = GXclear;
X    clr_gc = XCreateGC(dpy, draw_win, mask, &gcvalues);
X
X    gcvalues.function = GXxor;
X    gcvalues.foreground = foreground;
X    gcvalues.background = background;
X    gcvalues.plane_mask = background ^ foreground;
X    xor_gc = XCreateGC(dpy, draw_win, mask | GCPlaneMask, &gcvalues);
X
X    init_images();
X    XMapWindow(dpy, draw_win);
X    XMapWindow(dpy, joystick_win);
X    XSync(dpy, 0);
X}
X
Xwindow_main_loop()
X{
X    XEvent event;
X
X    for (;;) {
X	if (XPending(dpy)) {
X	    XNextEvent(dpy, &event);
X	    move_joystick(event.xany.window, &event);
X	} else
X	    move_pen();
X    }
X}
X
Xpw_text(win, x, y, op, font, string)
XWindow win;
XXFontStruct *font;
Xchar *string;
X{
X    XSetFont(dpy, src_gc, font->fid);
X    if (op != GXcopy) {
X	XSetFunction(dpy, src_gc, op);
X	XDrawString(dpy, win, src_gc, x, y, string, strlen(string));
X	XSetFunction(dpy, src_gc, GXcopy);
X    } else
X	XDrawImageString(dpy, win, src_gc, x, y, string, strlen(string));
X}
X
X#else /* USE SUNVIEW */
X
Xinit_win(argc, argv)
Xchar *argv[];
X{
X    frame = window_create(NULL, FRAME,
X	FRAME_LABEL, argv[0],
X	WIN_X, FRAME_X, WIN_Y, FRAME_Y,
X	FRAME_ICON, &qix_icon,
X	FRAME_ARGS, argc, argv,
X	FRAME_NO_CONFIRM, TRUE,
X	0);
X
X    Draw = window_create(frame, CANVAS,
X	WIN_HEIGHT, BOARD_HEIGHT_IN_PIXELS,
X	WIN_WIDTH,  BOARD_WIDTH_IN_PIXELS,
X	WIN_EVENT_PROC, move_joystick,
X	0);
X
X    draw_win = canvas_pixwin(Draw);
X    if (interval == 0)
X	interval = (draw_win->pw_pixrect->pr_depth == 8)? 35000 : 50000;
X    window_set(Draw,
X	CANVAS_FAST_MONO, TRUE,
X	WIN_CONSUME_PICK_EVENTS,
X	    WIN_MOUSE_BUTTONS,
X	    0,
X	WIN_CONSUME_KBD_EVENTS,
X	    WIN_ASCII_EVENTS,
X	    SHIFT_CTRL, SHIFT_META,
X	    0,
X	WIN_INPUT_DESIGNEE, window_get(Draw, WIN_DEVICE_NUMBER),
X	0);
X
X    Joystick = window_create(frame, CANVAS,
X	WIN_X, 0,
X	WIN_BELOW, Draw,
X	WIN_HEIGHT, 68,
X	WIN_WIDTH, WIN_EXTEND_TO_EDGE,
X	0);
X    joystick_win = canvas_pixwin(Joystick);
X
X    /*
X     *	 set color map segment name and load color map
X     */
X    {
X	static char cmsname[CMS_NAMESIZE];
X	static char r[QIX_CMS_SIZE],g[QIX_CMS_SIZE],b[QIX_CMS_SIZE];
X
X	(void) strcpy(cmsname, QIX_CMS_NAME);
X	pw_setcmsname(draw_win, cmsname);
X	pw_setcmsname(joystick_win, cmsname);
X
X	/* blueish */
X	r[FAST_DRAW_COLOR] = 40;
X	g[FAST_DRAW_COLOR] = 170;
X	b[FAST_DRAW_COLOR] = 213;
X
X	/* brownish */
X	r[SLOW_DRAW_COLOR] = 213;
X	g[SLOW_DRAW_COLOR] = 170;
X	b[SLOW_DRAW_COLOR] = 0;
X
X	/* dark something */
X	r[TEXT_COLOR] = 0;
X	g[TEXT_COLOR] = 80;
X	b[TEXT_COLOR] = 190;
X
X	/* red sparks when not aggressive */
X	r[SPARKS_COLOR] = 255;
X	g[SPARKS_COLOR] = 0;
X	b[SPARKS_COLOR] = 0;
X
X	/* blue sparks when aggressive */
X	r[AGGR_SPARK_COLOR] = 0;
X	g[AGGR_SPARK_COLOR] = 0;
X	b[AGGR_SPARK_COLOR] = 255;
X
X	cms_rainbowsetup(&r[QIX_COLOR_BASE],
X			 &g[QIX_COLOR_BASE],
X			 &b[QIX_COLOR_BASE]);
X
X	pw_putcolormap(draw_win, 0, QIX_CMS_SIZE, r, g, b);
X	pw_putcolormap(joystick_win, 0, QIX_CMS_SIZE, r, g, b);
X    }
X
X    window_fit(frame);
X
X    if (!(small_font = pf_open("/usr/people/argv/computer.14")) &&
X	!(small_font = pf_default()) ||
X	!(big_font = pf_open("/usr/lib/fonts/fixedwidthfonts/serif.r.16")) &&
X	!(big_font = pf_default()))
X	perror("can't open default font"), exit(1);
X
X    pw_text(joystick_win, 92, 24, PIX_SRC, small_font, "Fast  Slow");
X    old_repaint_func = (int(*)())window_get(frame, CANVAS_REPAINT_PROC);
X    window_set(frame, CANVAS_REPAINT_PROC, redraw, 0);
X}
X#endif /* X11 */
+END+OF+main.c
echo '-rw-rw-rw-  1 argv        16273 Sep  3 21:15 main.c    (as sent)'
chmod u=rw,g=rw,o=rw main.c
ls -l main.c
echo x - joystick.c
sed 's/^X//' > joystick.c <<'+END+OF+joystick.c'
X#include "qix.h"
X#include "math.h"
X
X#ifdef X11
X#include	"pen.xbm",
X#include	"mse.lf.gr.xbm",
X#include	"mse.lf.xbm",
X#include	"mse.mid.gr.xbm",
X#include	"mse.mid.xbm",
X#include	"mse.rt.icon.xbm",
X#include	"jstick.lf.xbm",
X#include	"jstick.rt.xbm",
X#include	"jstick.up.xbm",
X#include	"jstick.dn.xbm",
X#include	"jstick.stop.xbm"
X
XPixmap
X    joystick_left, joystick_right, joystick_up, joystick_down,
X    joystick_stop, ready_icon, ms_fast_on, ms_fast_off, ms_slow_on,
X    ms_slow_off, pen_image;
X
Xstruct image_stuff {
X    Pixmap *image;
X    int w, h;
X    char *bits;
X};
X
Xstruct image_stuff images[] = {
X    { &pen_image,
X	pen_width, pen_height, pen_bits },
X    { &ms_fast_on,
X	mse_lf_gr_width, mse_lf_gr_height, mse_lf_gr_bits },
X    { &ms_fast_off,
X	mse_lf_width, mse_lf_height, mse_lf_bits },
X    { &ms_slow_on,
X	mse_mid_gr_width, mse_mid_gr_height, mse_mid_gr_bits },
X    { &ms_slow_off,
X	mse_mid_width, mse_mid_height, mse_mid_bits },
X    { &ready_icon,
X	mse_rt_icon_width, mse_rt_icon_height, mse_rt_icon_bits },
X    { &joystick_left,
X	jstick_lf_width, jstick_lf_height, jstick_lf_bits },
X    { &joystick_right,
X	jstick_rt_width, jstick_rt_height, jstick_rt_bits },
X    { &joystick_up,
X	jstick_up_width, jstick_up_height, jstick_up_bits },
X    { &joystick_down,
X	jstick_dn_width, jstick_dn_height, jstick_dn_bits },
X    { &joystick_stop,
X	jstick_stop_width, jstick_stop_height, jstick_stop_bits },
X};
X
Xinit_images()
X{
X    int i;
X    Pixmap pix;
X    int scr = DefaultScreen(dpy);
X
X    for (i = 0; i < sizeof(images) / sizeof (struct image_stuff); i++)
X	if (!(*images[i].image = XCreatePixmapFromBitmapData(dpy, draw_win,
X	    images[i].bits, images[i].w, images[i].h,
X	    BlackPixel(dpy, scr), WhitePixel(dpy, scr),
X	    DefaultDepth(dpy, scr))))
X	    perror("init_images"), exit(1);
X
X    init_sparx();
X    init_gray();
X}
X
X#else
X/* the pen marker */
Xshort marker_curs_dat[] = {
X#include "marker.cursor"
X};
Xmpr_static(_pen_image,          16, 16, 1, marker_curs_dat);
XPixrect *pen_image = &_pen_image;
X
Xshort fast_draw_off_dat[] = {
X#include <images/mouse_left_hand.pr>
X};
Xmpr_static(_ms_fast_off,      16, 23, 1, fast_draw_off_dat);
XPixrect *ms_fast_off = &_ms_fast_off;
X
Xshort fast_draw_on_dat[] = {
X#include <images/mouse_left_hand_grey.pr>
X};
Xmpr_static(_ms_fast_on,     16, 23, 1, fast_draw_on_dat);
XPixrect *ms_fast_on = &_ms_fast_on;
X
Xshort slow_draw_off_dat[] = {
X#include <images/mouse_mid_hand.pr>
X};
Xmpr_static(_ms_slow_off,      16, 23, 1, slow_draw_off_dat);
XPixrect *ms_slow_off = &_ms_slow_off;
X
Xshort slow_draw_on_dat[] = {
X#include <images/mouse_mid_hand_grey.pr>
X};
Xmpr_static(_ms_slow_on,     16, 23, 1, slow_draw_on_dat);
XPixrect *ms_slow_on = &_ms_slow_on;
X
X/* joystick (really, arrow) symbols */
Xshort left_arrow_dat[] = {
X#include "joystick.lf"
X};
Xmpr_static(_joystick_left,   64, 64, 1, left_arrow_dat);
XPixrect *joystick_left = &_joystick_left;
X
Xshort right_arrow_dat[] = {
X#include "joystick.rt"
X};
Xmpr_static(_joystick_right,  64, 64, 1, right_arrow_dat);
XPixrect *joystick_right = &_joystick_right;
X
Xshort up_arrow_dat[] = {
X#include "joystick.up"
X};
Xmpr_static(_joystick_up,     64, 64, 1, up_arrow_dat);
XPixrect *joystick_up = &_joystick_up;
X
Xshort dn_arrow_dat[] = {
X#include "joystick.dn"
X};
Xmpr_static(_joystick_down,   64, 64, 1, dn_arrow_dat);
XPixrect *joystick_down = &_joystick_down;
X
X/* a circle with line thru it */
Xshort stop_dat[] = {
X#include "joystick.stop"
X};
Xmpr_static(_joystick_stop,   64, 64, 1, stop_dat);
XPixrect *joystick_stop = &_joystick_stop;
X
X/* a big right mouse button */
Xshort ready_icon_dat[] = {
X#include "mouse.rt.icon"
X};
Xmpr_static(_ready_icon,      64, 64, 1, ready_icon_dat);
XPixrect *ready_icon = &_ready_icon;
X#endif /* X11 */
X
X/*
X * the main window selection catches input interrupts and calls this
X * routine to process what just happened.  Nothing is actually done
X * besides that -- that is, the pen is not moved, the qix isn't moved,
X * and sparks don't move.  however, we will reset the "moving" variable,
X * start the or finish the "drawing" state, and reset the icon that displays
X * the joystick icon that indicates which way the user is moving.
X */
Xmove_joystick(canvas, event)
Xregister Canvas canvas;
Xregister Event *event;
X{
X    register int ID;
X    static start_fast;
X    int x, y; /* event location */
X
X#ifdef X11
X    int release = FALSE;
X#define event_is_up(e)	(release == TRUE)
X
X    switch(event->xany.type) {
X	case KeyRelease : release = TRUE;
X	case KeyPress : {
X	    char b;
X	    KeySym k; /* ignored */
X	    (void) XLookupString(event, &b, 1, &k, NULL);
X	    ID = (int)(b);
X#ifdef DEBUG
X	    if (debug)
X		putchar(ID), fflush(stdout);
X#endif /* DEBUG */
X	    x = MID_X, y = MID_Y; /* no movement by user */
X	    break;
X	}
X	case MotionNotify :
X	    ID = LOC_MOVE;
X	    x = event->xmotion.x, y = event->xmotion.y;
X#ifdef DEBUG
X	    if (debug)
X		putchar('.'), fflush(stdout);
X#endif /* DEBUG */
X	    /*
X	    while (XPending(dpy) && XPeekEvent(dpy, event))
X		if (event->xany.type != MotionNotify) {
X		    printf("pending: %d\n", event->xany.type);
X		    break;
X		} else {
X		    XNextEvent(dpy, event);
X		    putchar('.'), fflush(stdout);
X		}
X	    */
X	    break;
X	case ButtonRelease : release = TRUE;
X	case ButtonPress :
X	    ID = MS_LEFT + event->xbutton.button - 1;
X	    x = event->xbutton.x, y = event->xbutton.y; 
X#ifdef DEBUG
X	    if (debug)
X		printf("Button %d %sed\n", event->xbutton.button,
X		    release? "release" : "press");
X#endif /* DEBUG */
X	    break;
X	default :
X	    printf("unknown event: %d\n", event->xany.type);
X	    return;
X    }
X#else
X    ID = event->ie_code;
X    x = event_x(event);
X    y = event_y(event);
X#endif /* X11 */
X    if (play_mode != REAL_PLAY && ID != ' ' && ID != MS_RIGHT)
X	return;
X
X    if (ID == LOC_MOVE && moving != NO_MOVE) {
X	register int delta_x, delta_y;
X	if (x <= 0)
X	    x = 1;
X	if (y <= 0)
X	    y = 1;
X	delta_x = x - MID_X;
X	delta_y = y - MID_Y;
X
X	/* didn't move enough */
X	if (abs(delta_x) <= SENS_FACTOR && abs(delta_y) <= SENS_FACTOR)
X	    return;
X
X	if (abs(delta_x) > abs(delta_y))
X	    if (delta_x > 0)
X		moving = RIGHT;
X	    else
X		moving = LEFT;
X	else
X	    if (delta_y > 0)
X		moving = DOWN;
X	    else
X		moving = UP;
X    }
X
X    if (isascii(ID) && ID != ' ') {
X#ifdef DEBUG
X	if (isdigit(ID)) {
X	    debug = ID - '0';
X	    msg("Debugging level set to %d", debug);
X	    Sleep(2);
X	    remove_msgs();
X	    return;
X	} else
X#endif DEBUG
X	if (event_is_up(event)) {
X	    /* up events -- user released a key, so stop moving */
X	    /* unimplemented -- holding key down results in fast up/down's */
X	    moving = STOP;
X	    drawing = 0;
X	    return;
X	}
X#ifdef X11
X	else if (isupper(ID))
X#else
X	else if (event_shift_is_down(event))
X#endif /* X11 */
X	    fast = drawing = 1;
X	else
X	    drawing = 0;
X    }
X
X    switch(ID) {
X	when MS_LEFT :
X	    fast = (drawing = (!event_is_up(event)));
X	    start_fast = TRUE;
X	    return;
X	when MS_MIDDLE :
X	    fast = 0;
X	    if (start_fast == TRUE && region)
X		drawing = 0;
X	    else
X		drawing = !event_is_up(event);
X	    return;
X	when MS_RIGHT : case ' ' :
X	    if (event_is_up(event))
X		break;
X	    /* if moving == NO_MOVE, RIGHT, LEFT, UP or DOWN */
X	    if (!is_alive || play_mode != REAL_PLAY) {
X		lives = 0;
X		play_mode = REAL_PLAY;  /* set Nowhere else but here! */
X		change_life(LIVE); /* "next" life in current game */
X	    } else if (moving != STOP) {
X		/* NO_MOVE state goes right to STOP state */
X		if (moving == NO_MOVE)
X		    reset_joystick_win(FALSE);
X		/* all other directions go right to STOP state */
X		moving = STOP;
X	    } else
X		/* STOP state goes right to NO_MOVE state */
X		moving = NO_MOVE, reset_joystick_win(TRUE);
X	when 'h' : case 'H' :
X	    moving = LEFT;
X	when 'l' : case 'L' :
X	    moving = RIGHT;
X	when 'j' : case 'J' :
X	    moving = DOWN;
X	when 'k' : case 'K' :
X	    moving = UP;
X	when LOC_MOVE : ; /* let those thru! (break-- do nothing) */
X	when 3 : /* CTRL(C) */
X	    drawing = 0;		
X	    if (play_mode == REAL_PLAY) {
X		lives = 0;
X		change_life(DIE);
X	    }
X#ifdef DEBUG
X	when '@' : no_qix_kill = !no_qix_kill; drawing = 0;
X	when '#' : clear_sparks();
X	when '+' : lives = min(lives+1, MAX_LIVES); update_score(); drawing = 0;
X	when '-' : lives = max(lives-1, 1); update_score(); drawing = 0;
X	when '!' : drawing = 0;
X	    if (play_mode == REAL_PLAY) {
X		lives = 0;
X		change_life(LIVE);
X	    } /* fall thru */
X#endif DEBUG
X	default :
X	    return; /* do nothing */
X    }
X    if (moving != NO_MOVE && (x != MID_X || y != MID_Y))
X#ifdef X11
X	XWarpPointer(dpy, canvas, canvas, x, y,
X	    BOARD_WIDTH_IN_PIXELS, BOARD_HEIGHT_IN_PIXELS+70, MID_X, MID_Y);
X#else
X	window_set(canvas, WIN_MOUSE_XY, MID_X, MID_Y, 0);
X#endif /* X11 */
X}
X
X/*
X * The main routine waits for input from the user until an alarm goes off
X * which says, "ok, go to the next state of the machine" which may very
X * well be "do nothing".  The timer is restarted when we're done processing
X * whatever we have to process.  This is where the pen actually moves to the
X * next position, drawing lines, or running scared from a vicious spark.
X */
Xmove_pen()
X{
X    register int x = pen_x, y = pen_y, new_value, old_value;
X    static slow_draw;
X
X    stop_timer();
X    if (!is_alive && lives > 0) {
X	/* user has died and is waiting to start again */
X	Sleep(2);
X	change_life(LIVE);
X	stop_timer(); /* change_life restarts it */
X	msg("Ready?");
X	Sleep(2);
X	remove_msgs(0);
X	start_timer();
X	return;
X    }
X    /* don't play if the joystick isn't active */
X    if (moving == NO_MOVE || play_mode != REAL_PLAY) {
X	if (play_mode != REAL_PLAY) {
X	    time_left--;
X	    if (play_mode == DEMO && lives > 0) {
X		if (time_left == 0) {
X		    int lastmove = moving;
X		    register int left, right, up, down;
X		    drawing = 1;
X		    if (!(board[x][y] & NEW_LINE))
X			fast = (rrand() & 3);
X		    left = (!check_painted(x, y, CL_PNT_LEFT) &&
X			    !(board[x-1][y] & NEW_LINE));
X
X		    right = (!check_painted(x, y, CL_PNT_RIGHT) &&
X			     !(board[x+1][y] & NEW_LINE));
X
X		    up = (!check_painted(x, y, CL_PNT_TOP) &&
X			  !(board[x][y-1] & NEW_LINE));
X
X		    down = (!check_painted(x, y, CL_PNT_BOT) &&
X			    !(board[x][y+1] & NEW_LINE));
X
X		    if (!left && !right && !up && !down)
X			moving = STOP, time_left = -1; /* let fuse catch up */
X		    else {
X			int dx = region ? region->x - x : 0;
X			int dy = region ? region->y - y : 0;
X			time_left = 15 + (rrand() & 31);
X			/* first attempt to limit box to less than 25 X 25 */
X			if (region && (_ABS(dx) > 25 || _ABS(dy) > 25)) {
X			    if (_ABS(dx) > 25 ||
X				_ABS(dy) > 25 && (moving == LEFT ||
X						  moving == RIGHT))
X				if (moving != LEFT && moving != RIGHT)
X				    moving = (dx > 25) ? RIGHT : LEFT;
X				else
X				    moving = (dy > 0) ? DOWN : UP;
X			    else if (_ABS(dy) > 25)
X				if (moving != UP && moving != DOWN)
X				    moving = (dy > 25) ? DOWN : UP;
X				else
X				    moving = (dx > 0) ? RIGHT : LEFT;
X			}
X			/* Make sure we can move in that direction */
X			while (moving == lastmove ||
X			    !left && moving == LEFT || !up && moving == UP ||
X			    !down && moving == DOWN || !right && moving== RIGHT)
X			    moving = LEFT + (rrand() & 3);
X		    }
X		}
X	    } else if (time_left <= 0) {
X		drawing = 0;
X		level = -2;
X		moving = NO_MOVE;
X		init_qix();
X		switch (play_mode = (play_mode + 1) % (DEMO+1)) {
X		    when SHOW_SCORES :
X			clear_board();
X			score_board(TRUE, FALSE);
X			time_left = 50;
X		    when SHOW_POINTS :
X			score = 0;
X			move_fuse(fuse = NULL); /* just in case */
X			rm_cur_line(PIX_CLR);
X			clear_board();
X			place_pen();
X			msg("Direct the mouse to control joystick.");
X			time_left = 315;
X			moving = LEFT;
X		    when SHOW_QIX :
X			remove_msgs(0);
X			msg("Your Enemies:");
X			Sleep(2);
X			time_left = 40;
X		    when SHOW_SPARKS :
X			time_left = 90;
X		    when SHOW_FUSE :
X			drawing = fast = 1;
X			moving = UP;
X			time_left = 280;
X		    when SHOW_SPIRAL :
X			moving = STOP;
X			drawing = 0;
X			time_left = 100;
X		    when DEMO :
X			time_left = 1;
X			change_life(LIVE);
X			stop_timer();
X	    msg("Enclose more than\n75%%\nof the play area for extra bonus.");
X			Sleep(2);
X			remove_msgs(0);
X			level = -2;
X			drawing = fast = 1;
X			goto done;
X		}
X	    } else switch (play_mode) {
X		when SHOW_QIX :
X		    move_qix();
X		    if (time_left == 1) {
X			pw_putattributes(draw_win, &text_mask);
X			pw_text(draw_win, 200,200,PIX_SRC|PIX_COLOR(TEXT_COLOR),
X				big_font, "The qix.");
X			Sleep(2);
X		    }
X		when SHOW_SPARKS :
X		    move_sparks();
X		    if (time_left == 1) {
X			pw_putattributes(draw_win, &text_mask);
X			pw_text(draw_win, 15, 110, 
X				PIX_SRC|PIX_COLOR(TEXT_COLOR), 
X				big_font, "Sparx.");
X			pw_text(draw_win,625, 110, 
X				PIX_SRC|PIX_COLOR(TEXT_COLOR), 
X				big_font, "Sparx.");
X			Sleep(2);
X		    }
X		when SHOW_FUSE :
X		    /* after the pw_text, this moves into spiral death trap */
X		    switch (time_left) {
X			when 230 :
X			    drawing = 0;
X			    pw_putattributes(draw_win, &text_mask);
X			    pw_text(draw_win,
X				convert_x(pen_x - 7), convert_y(pen_y + 7),
X				PIX_SRC|PIX_COLOR(TEXT_COLOR), 
X				big_font, "The fuse.");
X			when 80 :
X			    pw_putattributes(draw_win, &text_mask);
X			    pw_text(draw_win, 265, 445,
X				PIX_SRC|PIX_COLOR(TEXT_COLOR), 
X				big_font, "The Spiral Death Trap.");
X			case 200 : case 240 : case 40 : case 20 :
X			    moving = LEFT, drawing = 1;
X			when 110 : case  55 : case 30 : moving = RIGHT;
X			when 126 : case  65 : case 35 : moving = UP;
X			when  95 : case  45 : case 25 : moving = DOWN;
X		    }
X		    goto movit;
X		when SHOW_SPIRAL :
X		    if (fuse) { /* when we die, fuse will be NULL */
X			time_left = 2;
X			goto movit;
X		    } else if (region) {
X			move_fuse(fuse = NULL);
X			rm_cur_line(PIX_SRC|PIX_COLOR(BORDER_COLOR));
X		    }
X		when SHOW_POINTS : {
X		    char buf[5];
X		    switch (time_left) {
X			when 270 :
X			    msg("Use LEFT mouse button for Fast Draw.");
X			    drawing = fast = 1, moving = UP;
X			    score = 0;
X			when 170 :
X			    msg("Use MIDDLE mouse button for Slow Draw.");
X			    drawing = 1, fast = 0, moving = UP;
X			    score = 0;
X			when 250 : case 130 : moving = RIGHT;
X			when 230 : case  90 : moving = DOWN;
X			when 210 : drawing = 0, moving = RIGHT;
X			    pw_putattributes(draw_win, &text_mask);
X			    (void) sprintf(buf, "%d", score);
X			    pw_text(draw_win,
X				convert_x(pen_x - 12), convert_y(pen_y - 25),
X				PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font, buf);
X			when 49 : /* make sure region is closed */
X			    msg("Use RIGHT mouse button to STOP movement.");
X			    pw_putattributes(draw_win, &text_mask);
X			    (void) sprintf(buf, "%d", score);
X			    pw_text(draw_win,
X				convert_x(pen_x - 12), convert_y(pen_y - 25),
X				PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font, buf);
X			when 15 : drawing = 0, moving = RIGHT;
X		    }
X		    goto movit; /* avoid moving qix and sparks */
X		}
X	    }
X	}
X	if (play_mode != DEMO)
X	    goto done;
X    }
X
X    if (move_qix() == -1) {
X	change_life(DIE);
X	return;
X    }
X
X    if (move_sparks() == -1) /* player got hosed */
X	return; /* don't restart timer */
X
Xmovit:
X    draw_joystick();
X    if (moving == STOP) {
X	if (!cur_coord || move_fuse(&fuse) != -1)  /* -1: fuse caught up */
X	    start_timer();
X	return;
X    }
X    /* this forces the last fuse to go away */
X    (void) move_fuse((struct region *)NULL); /* this can't return -1 */
X    if (drawing && !fast && board[pen_x][pen_y] & NEW_LINE
X	&& (slow_draw = !slow_draw))
X	goto done;
X
X    /*
X     * x,y will be the new (proposed) position if the following is true...
X     * if not drawing, then check to see if the current cell we're at connects
X     * with the proposed new position.  Logic says that it will connect if
X     * it "points" that way.. f'rinstance, you can't move left if the current
X     * cell doesn't have the "cell-line-left" (CL_LN_LF) attribute. Also,
X     * check to see if the current cell has the NEW_LINE attribute. If so,
X     * user should be drawing. If he isn't, the fuse starts.
X     */
X    switch (moving) {
X	when LEFT :
X	    if (check_painted(x, y, CL_PNT_LEFT) ||
X		    !drawing && !(board[x][y] & (CL_LN_LF|NEW_LINE))) {
X		if (play_mode == DEMO)
X		    time_left = 1;
X		goto done;
X	    }
X	    x--;
X	when RIGHT :
X	    if (check_painted(x, y, CL_PNT_RIGHT) ||
X		    !drawing && !(board[x][y] & (CL_LN_RT|NEW_LINE))) {
X		if (play_mode == DEMO)
X		    time_left = 1;
X		goto done;
X	    }
X	    x++;
X	when UP :
X	    if (check_painted(x, y, CL_PNT_TOP) ||
X		    !drawing && !(board[x][y] & (CL_LN_UP|NEW_LINE))) {
X		if (play_mode == DEMO)
X		    time_left = 1;
X		goto done;
X	    }
X	    --y;
X	when DOWN :
X	    if (check_painted(x, y, CL_PNT_BOT) ||
X		    !drawing && !(board[x][y] & (CL_LN_DN|NEW_LINE))) {
X		if (play_mode == DEMO)
X		    time_left = 1;
X		goto done;
X	    }
X	    ++y;
X    }
X    old_value = board[pen_x][pen_y];
X    new_value = board[x][y];
X    /*
X     * If drawing, you can't move onto yourself (a "new" line). [start fuse]
X     * You can alwasy move onto an old line (completing a region if drawing).
X     * If not drawing, you must be on an old line and moving
X     * onto another old line. If we're not drawing and *should* be drawing
X     * (determined by old_value's NEW_LINE bit set), start a fuse.
X     * Also, player can't cheat by fast drawing and suddenly changing to
X     * a slow draw just to close a region. Test to see if start_fast is
X     * set correctly by testing "region" first.
X     */
X    if (drawing && (new_value & NEW_LINE) && !(new_value & OLD_LINE) ||
X	!drawing && (old_value & NEW_LINE)) {
X	if (!fuse) /* if a fuse isn't going, ignite one */
X	    fuse = region;
X	if (play_mode == DEMO)
X	    time_left = 1;
X	else
X	    moving = STOP;
X	goto done;
X    }
X
X    /* erase the pen_image, move, reset pen_image, draw line */
X    place_pen();
X
X    /* next, determine that if we are drawing, ignore that fact if we
X     * are attempting to draw on top of an already drawn line.  If we
X     * are creating a new line, then go ahead and create it.
X     */
X    if (drawing) {
X	switch (moving) {
X	    when LEFT :
X		if (board[pen_x][pen_y] & CL_LN_LF)
X		    goto redraw_pen;
X		board[pen_x][pen_y] |= CL_LN_LF;
X		board[x][y] |= CL_LN_RT;
X	    when RIGHT :
X		if (board[pen_x][pen_y] & CL_LN_RT)
X		    goto redraw_pen;
X		board[pen_x][pen_y] |= CL_LN_RT;
X		board[x][y] |= CL_LN_LF;
X	    when UP :
X		if (board[pen_x][pen_y] & CL_LN_UP)
X		    goto redraw_pen;
X		board[pen_x][pen_y] |= CL_LN_UP;
X		board[x][y] |= CL_LN_DN;
X	    when DOWN :
X		if (board[pen_x][pen_y] & CL_LN_DN)
X		    goto redraw_pen;
X		board[pen_x][pen_y] |= CL_LN_DN;
X		board[x][y] |= CL_LN_UP;
X	}
X	pw_putattributes(draw_win, &border_mask);
X	draw(convert_x(x), convert_y(y),
X	     convert_x(pen_x), convert_y(pen_y), 
X	     PIX_SRC|PIX_COLOR(BORDER_COLOR));
X	if (!region) {
X	    saved_edge = old_value;
X	    add_to_line(pen_x, pen_y);
X	    old_value = (board[pen_x][pen_y] |= NEW_LINE);
X	}
X	/* if drawing from a newline onto an old line, a region is completed */
X	if ((old_value & NEW_LINE) && (new_value & OLD_LINE)) {
X	    int new_level = close_region(x, y);
X	    if (!new_level)
X		update_score();
X	    if (new_level || (int)(((double)area_closed/TOTAL_AREA)*100) >= 75){
X		if (!new_level) {
X		    int percent_closed =
X			(int)(((double)area_closed/TOTAL_AREA) * 100);
X		    msg("Closed %d%% of the board.", percent_closed);
X		    if (percent_closed > 75) {
X			score += (percent_closed - 75) * 1000;
X			update_score();
X			msg("1000 bonus points for each percent over 75%%");
X			msg("BONUS: %d", (percent_closed - 75) * 1000);
X		    }
X		} else
X		    level++;
X		Sleep(3);
X		clear_board(); /* removes msgs also */
X		change_life(LIVE);
X		stop_timer();
X		if (level < 0)
X		    level++;
X		if (level == 0) {
X		    msg("Split the 2 qix to advance score multiplier.");
X		    Sleep(2);
X		    remove_msgs(0);
X		}
X		start_timer();
X		return;
X	    }
X	} else if (new_value == 0) {
X	    board[x][y] |= NEW_LINE;
X	    add_to_line(x, y);
X	}
X    }
Xredraw_pen:
X    pen_x = x, pen_y = y;
X    place_pen(); /* set the new pen image */
Xdone:
X    start_timer();
X}
X
Xdraw_joystick()
X{
X    Pixmap image = moving == LEFT? joystick_left :
X		   moving == RIGHT? joystick_right :
X		   moving == UP? joystick_up :
X		   moving == DOWN? joystick_down :
X		   moving == STOP? joystick_stop : ready_icon;
X    pw_putattributes(joystick_win, &border_mask);
X    pw_rop(joystick_win,
X	BOARD_WIDTH_IN_PIXELS/2-32, 2, 64, 64, PIX_SRC|PIX_COLOR(BORDER_COLOR),
X	image, 0,0);
X    pw_rop(joystick_win, 100,32, 16,23, PIX_SRC|PIX_COLOR(BORDER_COLOR),
X	(drawing && fast)? ms_fast_on : ms_fast_off, 0, 0);
X    pw_rop(joystick_win, 150,32, 16,23, PIX_SRC|PIX_COLOR(BORDER_COLOR),
X	(drawing && !fast)? ms_slow_on : ms_slow_off, 0, 0);
X}
X
X/*
X * if "see_it" -- then show the mouse cursor and stop moving mouse to middle
X * of window allowing allow player to grab beer. If "see_it" is
X * false, then the user is ready to move around, so make cursor go away,
X * and force all mouse moves to return to the middle of window.
X */
Xreset_joystick_win(see_it)
X{
X#ifndef X11
X    Cursor cursor = (Cursor)window_get(Draw, WIN_CURSOR);
X#endif /* X11 */
X
X    if (!see_it) {   /* we don't want to see the cursor, so get rid of it */
X	/* get the current cursor and make it invisible */
X#ifdef X11
X	XDefineCursor(dpy, draw_win, None);
X#else
X	cursor_set(cursor, CURSOR_OP, PIX_DST, 0);
X#endif /* X11 */
X	moving = STOP;
X	draw_joystick();
X    } else {
X#ifdef X11
X	XUndefineCursor(dpy, draw_win);
X#endif /* X11 */
X	moving = NO_MOVE;
X	draw_joystick();
X    }
X#ifndef X11
X    window_set(Joystick, WIN_CURSOR, cursor, 0);
X    window_set(Draw, WIN_CURSOR, cursor, 0);
X#endif /* X11 */
X}
+END+OF+joystick.c
echo '-rw-rw-rw-  1 argv        21409 Sep  2 16:04 joystick.c    (as sent)'
chmod u=rw,g=rw,o=rw joystick.c
ls -l joystick.c
echo x - sparks.c
sed 's/^X//' > sparks.c <<'+END+OF+sparks.c'
X#include "qix.h"
X
X/*
X * This file deals with the sparks excplicitely.  A fuse is a spark, but
X * travels along the the line the user is drawing.
X */
X
X#ifdef X11
X#include	"spark1.pr.xbm"
X#include	"spark2.pr.xbm"
X#include	"spark3.pr.xbm"
X#include	"spark4.pr.xbm"
X
Xstruct image_stuff {
X    Pixmap *image;
X    int w, h;
X    char *bits;
X};
Xstatic Pixmap spark_icons[4];
X
Xstatic struct image_stuff sparx[] = {
X    { &spark_icons[0], spark1_pr_width, spark1_pr_height, spark1_pr_bits },
X    { &spark_icons[1], spark2_pr_width, spark2_pr_height, spark2_pr_bits },
X    { &spark_icons[2], spark3_pr_width, spark3_pr_height, spark3_pr_bits },
X    { &spark_icons[3], spark4_pr_width, spark4_pr_height, spark4_pr_bits },
X};
X
Xinit_sparx()
X{
X    int i, w, h;
X    Pixmap pix;
X    int scr = DefaultScreen(dpy);
X
X    for (i = 0; i < sizeof(sparx) / sizeof (struct image_stuff); i++)
X	if (!(*sparx[i].image = XCreatePixmapFromBitmapData(dpy, draw_win,
X	    sparx[i].bits, sparx[i].w, sparx[i].h,
X	    BlackPixel(dpy, scr), WhitePixel(dpy, scr),
X	    DefaultDepth(dpy, scr))))
X	    perror("init_sparx"), exit(1);
X}
X
X#else
X
Xshort spark1_dat[] = {
X#include "spark1.pr"
X};
Xmpr_static(spark1,     16, 16, 1, spark1_dat);
X
Xshort spark2_dat[] = {
X#include "spark2.pr"
X};
Xmpr_static(spark2,     16, 16, 1, spark2_dat);
X
Xshort spark3_dat[] = {
X#include "spark3.pr"
X};
Xmpr_static(spark3,     16, 16, 1, spark3_dat);
X
Xshort spark4_dat[] = {
X#include "spark4.pr"
X};
Xmpr_static(spark4,     16, 16, 1, spark4_dat);
X
Xstatic Pixrect *spark_icons[4] = { &spark1, &spark2, &spark3, &spark4 };
X#endif /* X11 */
X
Xstatic int spark_time, aggressive;
X
X/*
X * Macor to draw a spark at x,y -- intended to call this macro twice with
X * the same x,y coords to remove the first spark icon. There are four spark
X * icons to give a "sparkling" effect when it moves. Since sparks can only
X * move left-right or up-down the formula given finds which icon to use to
X * to guarantee that it's not the last one used.
X */
X#ifdef X11
X#define draw_spark(x, y, color) 	\
X    XCopyArea(dpy, spark_icons[(x+y)&3], draw_win, xor_gc, 0, 0, \
X	      16, 16, pen_coord_x(x), pen_coord_y(y))
X#else
X#define draw_spark(x, y, color) 	\
X    pw_rop(draw_win, pen_coord_x(x), pen_coord_y(y), 16,16, \
X	XOR| PIX_COLOR(color), spark_icons[(x + y) & 3], 0,0)
X#endif /* X11 */
X
Xstruct spark {
X    int x, y, oldx, oldy;
X} sparks[] = {
X    { -1, -1, -1, -1 }, { -1, -1, -1, -1 }, { -1, -1, -1, -1 },
X    { -1, -1, -1, -1 }, { -1, -1, -1, -1 }, { -1, -1, -1, -1 },
X    { -1, -1, -1, -1 }, { -1, -1, -1, -1 }
X};
Xint MAX_SPARKS = sizeof (sparks) / sizeof (struct spark);
X
X#define CLOCKWISE(spark_number) (spark_number & 1)
X
X/* start a new spark at this x,y coord.  Since sparks are released in
X * pairs, odd spark goes left, even spark goes right, and those directions
X * are [supposed] to remain with the spark thruout its life.
X */
Xstart_spark(x, y)
X{
X    register int sp;
X
X#ifdef DEBUG
X    if (debug > 1)
X	return;
X#endif DEBUG
X
X    for (sp = 0; sp < MAX_SPARKS; sp++)
X	if (sparks[sp].x < 0) {
X	    if (CLOCKWISE(sp)) /* odd number spark */
X		sparks[sp].oldx = x-1, sparks[sp].oldy = y;
X	    else
X		sparks[sp].oldx = x+1, sparks[sp].oldy = y;
X	    sparks[sp].x = x, sparks[sp].y = y;
X	    return;
X	}
X}
X
X/*
X * Spark movement checks... can't move back onto himself... must only move
X * onto a square which has a connecting line.  If it's on a square which
X * is completely painted, it may move anywhere.  Otherwise, the square has
X * to have at least one quad which is not painted.  Sparks may only move
X * on "old" (not currently being drawn) lines unless they are aggressive.
X */
X#define check_up(curx, cury, newx, newy, oldy) \
X    (newy != oldy && (board[curx][cury] & CL_LN_UP) && \
X    (aggressive || (board[newx][newy] & OLD_LINE) && \
X    (!check_painted(newx, newy, PAINTED) || check_painted(curx, cury,PAINTED))))
X
X#define check_down(curx, cury, newx, newy, oldy) \
X    (newy != oldy && (board[curx][cury] & CL_LN_DN) && \
X    (aggressive || (board[newx][newy] & OLD_LINE) && \
X    (!check_painted(newx, newy, PAINTED) || check_painted(curx, cury,PAINTED))))
X
X#define check_left(curx, cury, newx, newy, oldx) \
X    (newx != oldx && (board[curx][cury] & CL_LN_LF) && \
X    (aggressive || (board[newx][newy] & OLD_LINE) && \
X    (!check_painted(newx, newy, PAINTED) || check_painted(curx, cury,PAINTED))))
X
X#define check_right(curx, cury, newx, newy, oldx) \
X    (newx != oldx && (board[curx][cury] & CL_LN_RT) && \
X    (aggressive || (board[newx][newy] & OLD_LINE) && \
X    (!check_painted(newx, newy, PAINTED) || check_painted(curx, cury,PAINTED))))
X
X/* return -1 if player dies.  0 otherwise. */
Xmove_sparks()
X{
X    register int x, y, sp, move_clockwise, came_from, dir;
X    /* new spark x and y coord */
X
X    pw_putattributes(draw_win, &qix_mask);
X    for (sp = 0; sp < MAX_SPARKS; sp++) {
X	if (sparks[sp].x < 0)
X	    break;
X	/* if the spark was just introduced, this will not erase the spark,
X	 * but actually create two images.  however, since sparks are intro-
X	 * duced in pairs, the second spark will have the same coords and
X	 * erase this mark. (clever, huh?)
X	 */
X	draw_spark(sparks[sp].x, sparks[sp].y,
X		   aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
X	x = sparks[sp].x, y = sparks[sp].y;
X	/* user bit the big one */
X	if (x == pen_x && y == pen_y) {
X	    draw_spark(sparks[sp].x, sparks[sp].y,
X		   aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
X	    change_life(DIE);
X	    return -1;
X	}
X
X	came_from = (x > sparks[sp].oldx)? LEFT :
X		    (x < sparks[sp].oldx)? RIGHT :
X		    (y > sparks[sp].oldy)? UP : DOWN;
X	if (check_painted(x, y, PAINTED))
X	    move_clockwise = (random() & 1);
X	else {
X	    move_clockwise = (CLOCKWISE(sp));
X	    if (check_painted(sparks[sp].oldx, sparks[sp].oldy, PAINTED))
X	    /* we just exited a painted region onto open territory.
X	     * pretend we came from along a border, as usual.
X	     */
X		while (came_from == UP && check_painted(x,y, CL_PNT_TOP) ||
X		       came_from == DOWN && check_painted(x,y, CL_PNT_BOT) ||
X		       came_from == LEFT && check_painted(x,y, CL_PNT_LEFT) ||
X		       came_from == RIGHT && check_painted(x,y, CL_PNT_RIGHT))
X		    if (CLOCKWISE(sp))
X			came_from = LEFT_OF(came_from);
X		    else
X			came_from = RIGHT_OF(came_from);
X	}
X	dir = came_from;
X
X	/* if we are not on a border (surrounded by painted quads) */
X	do  {
X	    if (move_clockwise)
X		dir = LEFT_OF(dir); /* this is right, don't argue */
X	    else
X		dir = RIGHT_OF(dir);
X#ifdef DEBUG
X	    if (dir == came_from) {
X		box(convert_x(x)-10, convert_y(y)-10,
X		    convert_x(x)+10, convert_y(y)+10, XOR);
X		msg("HALT! infinite-loop police! [y] (%d, %d)", x, y);
X		Sleep(2);
X		remove_msgs(0);
X		box(convert_x(x)-10, convert_y(y)-10,
X		    convert_x(x)+10, convert_y(y)+10, XOR);
X		break;
X	    }
X#endif DEBUG
X	    switch (dir) {
X		when LEFT:
X		    if (check_left(x, y, x - 1, y, sparks[sp].oldx))
X			x--;
X		when RIGHT:
X		    if (check_right(x,y,x+1,y,sparks[sp].oldx))
X			x++;
X		when UP:
X		    if (check_up(x,y,x,y-1,sparks[sp].oldy))
X			y--;
X		when DOWN:
X		    if (check_down(x, y, x, y+1, sparks[sp].oldy))
X			y++;
X	    }
X	} while (x == sparks[sp].x && y == sparks[sp].y);
X
X	sparks[sp].oldx = sparks[sp].x, sparks[sp].oldy = sparks[sp].y;
X	/* draw the new spark */
X	draw_spark(x, y, aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
X	sparks[sp].x = x, sparks[sp].y = y;
X
X	if (x == pen_x && y == pen_y) {
X	    change_life(DIE);
X	    return -1;
X	}
X    }
X    /* if the timeout has occured, release two sparks */
X    if (spark_time-- <= 0) {
X	spark_time = SPARK_TIME;
X	if (sp >= MAX_SPARKS/2) {
X	    if (!aggressive) {
X		/* give the only warning we can without a sound chip :-) */
X		fputc(7, stderr), fflush(stderr);
X		msg("Sparx are now aggressive.");
X		Sleep(2);
X		remove_msgs(0);
X		/* erase red sparks now or blue sparks will leave green */
X		toggle_sparks();
X		aggressive = 1;
X		/* now draw blue sparks */
X		toggle_sparks();
X	    }
X	    if (sp == MAX_SPARKS) {
X		return 0; /* no sparks left to start, so don't do a countdown */
X	    }
X	}
X	start_spark(BOARD_WIDTH/2, 0);
X	start_spark(BOARD_WIDTH/2, 0);
X	draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, 
X		PIX_SRC|PIX_COLOR(SPARKS_COLOR));
X	draw(BORDER, 21, BOARD_WIDTH_IN_PIXELS-BORDER, 21, 
X		PIX_SRC|PIX_COLOR(SPARKS_COLOR));
X    }
X    if (sp < MAX_SPARKS) {
X	/* calculate the percentage of the width of the board in pixels */
X	register int len = (((spark_time*100)/SPARK_TIME)) *
X	       (BOARD_WIDTH_IN_PIXELS-2*BORDER)/200;
X
X	draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS/2 - len, 20, PIX_CLR);
X	draw(BORDER, 21, BOARD_WIDTH_IN_PIXELS/2 - len, 21, PIX_CLR);
X	draw(BOARD_WIDTH_IN_PIXELS/2 + len, 20,
X	     BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_CLR);
X	draw(BOARD_WIDTH_IN_PIXELS/2 + len, 21,
X	     BOARD_WIDTH_IN_PIXELS-BORDER, 21, PIX_CLR);
X    }
X    return 0;
X}
X
X/*
X * move fuse -- first, remove the last location (if applicable). If
X * the fuse has burned out, then programmer just wants to erase last one.
X * next, since the fuse only travels along new lines, move down the list.
X */
Xmove_fuse(pos)
Xregister struct region **pos;
X{
X    static x = -1, y;
X    int n;
X
X    /* fuse is always red */
X    pw_putattributes(draw_win, &qix_mask);
X    if (x > -1)
X	draw_spark(x, y, SPARKS_COLOR);
X    if (!pos || !*pos) {
X	x = -1;
X	return 0;
X    }
X    draw_spark((*pos)->x, (*pos)->y, SPARKS_COLOR);
X    x = (*pos)->x, y = (*pos)->y;
X
X    if ((*pos)->x == pen_x && (*pos)->y == pen_y) {
X	change_life(DIE);
X	pen_x = region->x, pen_y = region->y;
X	return -1;
X    }
X    if (!(*pos = (*pos)->next))
X	*pos = NULL, x = -1;
X    return 0;
X}
X
X/*
X * removes all sparks from the screen and their x/y coords.
X * reset the sparktime value and draw the timeout line.
X */
Xclear_sparks()
X{
X    int n;
X
X    pw_putattributes(draw_win, &qix_mask);
X    /* for each spark, if active, make it go away and reset to -1 */
X    for (n = 0; n < MAX_SPARKS; n++)
X	if (sparks[n].x > -1) {
X	    draw_spark(sparks[n].x, sparks[n].y,
X			aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
X	    sparks[n].oldx = sparks[n].x = -1;
X	}
X    draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_CLR);
X    draw(BORDER, 21, BOARD_WIDTH_IN_PIXELS-BORDER, 21, PIX_CLR);
X    aggressive = spark_time = 0;
X}
X
X/* routine to turn on/off all sparks.  When user closes a region, call
X * this routine to turn off sparks so when the region is filled, the
X * spark doesn't leave it's mark once it starts moving again.
X */
Xtoggle_sparks()
X{
X    register int sp;
X
X    pw_putattributes(draw_win, &qix_mask);
X    for (sp = 0; sp < MAX_SPARKS; sp++) {
X	if (sparks[sp].x < 0)
X	    break;
X	draw_spark(sparks[sp].x, sparks[sp].y,
X	    aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
X    }
X}
+END+OF+sparks.c
echo '-rw-rw-rw-  1 argv        10615 Sep  2 12:46 sparks.c    (as sent)'
chmod u=rw,g=rw,o=rw sparks.c
ls -l sparks.c
echo x - regions.c
sed 's/^X//' > regions.c <<'+END+OF+regions.c'
X#include "qix.h"
X
X#ifdef X11
X#include <X11/bitmaps/gray1> 
X#include <X11/bitmaps/gray3> 
X
Xstatic Pixmap fast_gray, slow_gray;
X
Xinit_gray()
X{
X    if (!(fast_gray = XCreateBitmapFromData(dpy, draw_win,
X	gray1_bits, gray1_width, gray1_height)))
X	perror("gray1");
X    if (!(slow_gray = XCreateBitmapFromData(dpy, draw_win,
X	gray3_bits, gray3_width, gray3_height)))
X	perror("gray3");
X}
X
X#else
X
Xshort slow_gray_dat[] = {
X#include <images/square_25.pr>
X};
Xmpr_static(slow_gray,       16, 16, 1, slow_gray_dat);
X
Xshort fast_gray_dat[] = {
X#include <images/square_50.pr>
X};
Xmpr_static(fast_gray,       16, 16, 1, fast_gray_dat);
X#endif /* X11 */
X
X/*
X * Ther user is drawing a line ... store each move as a doubly linked
X * list of x/y coords.  When the region is completed, the list is completed
X * resulting in a closed polygon.
X */
Xadd_to_line(x, y)
Xregister int x,y;
X{
X    struct region *new;
X
X    if(!(new = (struct region *)malloc(sizeof(struct region)))) {
X	change_life(DIE);
X	fprintf(stderr, "%s, line %d: malloc failed\n", __FILE__, __LINE__);
X	abort();
X    }
X    new->x = x;
X    new->y = y;
X    new->next = (struct region *) NULL;
X    new->prev = cur_coord;
X    if (nitems++)
X	cur_coord->next = new, cur_coord = new;
X    else
X	region = new, cur_coord = region;
X}
X
X/*
X * close region means that the user has successfully drawn from
X * one point to another closing a "region" of territory.  We *should*
X *    Kill the current fuse.
X *    Determine where the qix is and determine the
X *    	region that does NOT enclose the qix (get_edge()).
X *    Call polyfill to fill region and tally up points.
X *    Fill the the region with the appropriate "shade".
X * If there are two qix, check to see that get_edge returns the same edge.
X * If they are different, then the user split the two qix.  If they're the
X * same, close the region as usual.
X *
X * return 0 if normal region closed.  return 1 on error or splitting 2 qix.
X */
Xclose_region(x,y)
X{
X    int npts[1], n, edge, region_score;
X    Point *calloc(), *new_area, save_pt;
X
X    fuse = NULL;
X
X    if (level > -1 && (n = get_edge(moving, x, y, 1)) == -1)
X	return -1;
X    if ((edge = get_edge(moving, x, y, 0)) == -1)
X	return -1;
X    if (level > -1 && edge != n) {
X	msg("You split the two qix!");
X	Sleep(2);
X	/* don't erase it, but free it up */
X	rm_cur_line(PIX_SRC|PIX_COLOR(BORDER_COLOR)); 
X	moving = STOP;
X	return 1;
X    }
X
X#ifdef DEBUG
X    if (debug && edge)
X	printf("moving = %s, edge = %s\n",
X	    (moving == UP)? "UP" : (moving == DOWN)? "DOWN" :
X	    (moving == LEFT)? "LEFT" : "RIGHT",
X	    (edge == UP)? "UP" : (edge == DOWN)? "DOWN" :
X	    (edge == LEFT)? "LEFT" : "RIGHT");
X#endif DEBUG
X
X    if (moving == UP && edge == LEFT || moving == LEFT && edge == UP)
X	region_score = polyfill(x*2 + 1, y*2 + 1);
X    else if (moving == RIGHT && edge == DOWN
X	  || moving == DOWN && edge == RIGHT)
X	region_score = polyfill(x*2 - 1, y*2 - 1);
X    else if (moving == UP && edge == RIGHT
X	  || moving == RIGHT && edge == UP)
X	region_score = polyfill(x*2 - 1, y*2 + 1);
X    else if (moving == LEFT && edge == DOWN
X	  || moving == DOWN && edge == LEFT)
X	region_score = polyfill(x*2 + 1, y*2 - 1);
X    else
X	region_score = 0;
X
X    /* region_score is number of board locations closed * 4 since there
X     * are 4 quads per square. divide region_score by 4.
X     */
X    region_score /= 4;
X
X    /* level shows bonus multipliers -- !fast is a slow draw (double score)
X     * 1/2 point per board location, so divide region_score by 2.
X     */
X    score += (region_score * ((level>-1)? (level+1) : 1) * (!fast + 1))/2;
X    area_closed += region_score;
X
X    save_pt.x = x, save_pt.y = y;
X    while (x != region->x || y != region->y) {
X	if (nitems > 10000) {
X	    msg("can't fill region; over 10000 positions");
X	    pen_x = region->x, pen_y = region->y;
X	    msg("removing bad line ...(takes a while)");
X	    /* causes dotted line effect */
X	    rm_cur_line(XOR|PIX_COLOR(BORDER_COLOR)); 
X	    remove_msgs(0);
X	    return -1;
X	}
X	/* if we came from up, we check left-right */
X	add_to_line(x, y);
X#ifdef DEBUG
X	if (debug > 2)
X	    show_bert(x, y);
X#endif DEBUG
X
X	switch (moving) {
X	    when UP :
X		switch (edge) {
X		    /* Edge is on our left, sweep counter-clockwise */
X		    when LEFT :
X			if (board[x][y] & CL_LN_RT)
X			    x++, moving = RIGHT, edge = UP;
X			else if (board[x][y] & CL_LN_UP)
X			    y--;
X			else if (board[x][y] & CL_LN_LF)
X			    x--, moving = LEFT, edge = DOWN;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		    /* Edge is on our right, sweep clockwise */
X		    when RIGHT :
X			if (board[x][y] & CL_LN_LF)
X			    x--, moving = LEFT, edge = UP;
X			else if (board[x][y] & CL_LN_UP)
X			    y--;
X			else if (board[x][y] & CL_LN_RT)
X			    x++, moving = RIGHT, edge = DOWN;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		}
X
X	    when LEFT :
X		switch (edge) {
X		    /* Edge is above, sweep counter-clockwise */
X		    when UP :
X			if (board[x][y] & CL_LN_DN)
X			    y++, moving = DOWN, edge = LEFT;
X			else if (board[x][y] & CL_LN_LF)
X			    x--;
X			else if (board[x][y] & CL_LN_UP)
X			    y--, moving = UP, edge = RIGHT;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		    /* Edge is below, sweep clockwise */
X		    when DOWN :
X			if (board[x][y] & CL_LN_UP)
X			    y--, moving = UP, edge = LEFT;
X			else if (board[x][y] & CL_LN_LF)
X			    x--;
X			else if (board[x][y] & CL_LN_DN)
X			    y++, moving = DOWN, edge = RIGHT;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		}
X
X	    when DOWN :
X		switch (edge) {
X		    /* Edge is on our left, sweep clockwise */
X		    when LEFT :
X			if (board[x][y] & CL_LN_RT)
X			    x++, moving = RIGHT, edge = DOWN;
X			else if (board[x][y] & CL_LN_DN)
X			    y++;
X			else if (board[x][y] & CL_LN_LF)
X			    x--, moving = LEFT, edge = UP;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		    /* Edge is on our right, sweep counter-clockwise */
X		    when RIGHT :
X			if (board[x][y] & CL_LN_LF)
X			    x--, moving = LEFT, edge = DOWN;
X			else if (board[x][y] & CL_LN_DN)
X			    y++;
X			else if (board[x][y] & CL_LN_RT)
X			    x++, moving = RIGHT, edge = UP;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		}
X
X	    when RIGHT :
X		switch (edge) {
X		    /* Edge is above, sweep clockwise */
X		    when UP :
X			if (board[x][y] & CL_LN_DN)
X			    y++, moving = DOWN, edge = RIGHT;
X			else if (board[x][y] & CL_LN_RT)
X			    x++;
X			else if (board[x][y] & CL_LN_UP)
X			    y--, moving = UP, edge = LEFT;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		    /* Edge is below, sweep counter-clockwise */
X		    when DOWN :
X			if (board[x][y] & CL_LN_UP)
X			    y--, moving = UP, edge = RIGHT;
X			else if (board[x][y] & CL_LN_RT)
X			    x++;
X			else if (board[x][y] & CL_LN_DN)
X			    y++, moving = DOWN, edge = LEFT;
X#ifdef DEBUG
X			else
X			    bad_fill_cell(x,y, edge, moving);
X#endif DEBUG
X		}
X	}
X    }
X
X    if (!(new_area = calloc(nitems, sizeof(Point)))) {
X	change_life(DIE);
X	fprintf(stderr, "%s, line %d: malloc failed\n", __FILE__, __LINE__);
X	abort();
X    }
X
X    /* we CAN move onto endpoints, but nothing inside */
X    npts[0] = nitems;
X    for (n = 0; region; n++) {
X	new_area[n].x = convert_x(region->x);
X	new_area[n].y = convert_y(region->y);
X	board[region->x][region->y] &= ~NEW_LINE;
X	board[region->x][region->y] |= OLD_LINE;
X	cur_coord = region->next;
X	free(region);
X	region = cur_coord;
X    }
X#if 0
X    if (debug > 1)
X	printf("polyfill(): %d; polygon_area(): %d\n", region_score,
X		polygon_area(new_area, nitems) / LINE_SPACE / LINE_SPACE);
X#endif
X
X    toggle_sparks();
X    pw_putattributes(draw_win, fast ? &fast_draw_mask: &slow_draw_mask);
X#ifdef X11
X    /* When filling with a pattern, use stipple -- I don't know how to color */
X    XFlush(dpy); /* appear to close the region */
X    XSetFillStyle(dpy, src_gc, FillStippled);
X    XSetStipple(dpy, src_gc, fast? fast_gray : slow_gray);
X    XFillPolygon(dpy, draw_win, src_gc, new_area, nitems,
X		 Nonconvex,CoordModeOrigin);
X    XFlush(dpy);
X    XSetFillStyle(dpy, src_gc, FillSolid);
X#else
X    pw_polygon_2(draw_win, 0,0,1, npts, new_area, 
X	PIX_SRC | PIX_DST | PIX_COLOR(fast ? FAST_DRAW_COLOR: SLOW_DRAW_COLOR),
X	draw_win->pw_pixrect->pr_depth == 8? NULL :
X	fast? &fast_gray : &slow_gray, 0, 0);
X#endif /* X11 */
X    toggle_sparks();
X
X    free(new_area);
X    nitems = 0, moving = STOP;
X    if (play_mode == DEMO)
X	time_left = 1;
X    return 0;
X}
X
X#ifdef DEBUG
Xbad_fill_cell(x, y, edge, moving)
Xregister int x, y, edge, moving;
X{
X    msg("fail at %d, %d (%x) moving = %s, edge on %s", x,y,board[x][y],
X	(moving == UP)? "up" : (moving == DOWN)? "down" :
X	(moving == RIGHT)? "right" : "left",
X	(edge == UP)? "up" : (edge == DOWN)? "down" :
X	(edge == RIGHT)? "right" : "left");
X    Sleep(2);
X    remove_msgs(0);
X}
X#endif DEBUG
X
Xrm_cur_line(op)
X{
X    pw_putattributes(draw_win, &border_mask);
X    if (region)
X	board[region->x][region->y] = saved_edge;
X    while (cur_coord)
X	if (cur_coord = cur_coord->prev) {
X	    board[cur_coord->next->x][cur_coord->next->y] = 0;
X	    draw(convert_x(cur_coord->next->x),
X		 convert_y(cur_coord->next->y),
X		 convert_x(cur_coord->x), convert_y(cur_coord->y), op);
X	    free(cur_coord->next);
X	}
X    region = (struct region *)NULL;
X    cur_coord = (struct region *)NULL;
X    nitems = 0;
X}
X
X/* cmp: returns 0, 1, or 2 depending on whether
X	a is    <, =, or > b */
X#define cmp(a,b) ((a > b) + (a >= b))
X/* which way bert should start, depending on where person is w.r.t qix */
Xchar dirtable[3][3] ={	{ LEFT, UP, UP },
X			{ LEFT, 0, RIGHT},
X			{ DOWN, DOWN, RIGHT} };
Xget_edge(person_moving, person_x, person_y, which_qix)
X{
X    int dx, dy;
X    int x, y, moving;
X
X    if (get_qix_pos(which_qix, &x, &y) == -1)
X	return -1;
X
X    /* move from the qix until we find a line or the edge of the board */
X    moving = dirtable[cmp(person_y, y)][cmp(person_x, x)];
X    if (moving == 0) {
X	change_life(DIE);
X	msg("You fucked up so incredibly badly that you must die\n");
X	exit(1);
X    }
X    dx = dy = 0;
X    switch (moving) {
X	when UP: dy = -1;
X	when DOWN: dy = 1;
X	when LEFT: dx = -1;
X	when RIGHT: dx = 1;
X    }
X    while (!board[x][y]) {
X#ifdef DEBUG
X	show_bert(x, y);
X#endif DEBUG
X	x += dx;
X	y += dy;
X    }
X
X    /* now traverse the interior clockwise until bert hits the person */
X    for (;;) {
X	int on_person = person_x == x && person_y == y;
X#ifdef DEBUG
X	show_bert(x, y);
X#endif DEBUG
X	/* always sweep clockwise around the edges till we find the player */
X	if (on_person && moving == person_moving)
X	    /* the bert just rear-ended player */
X       /* qix on on the "right" of the player (with respect to player facing) */
X	    return RIGHT_OF(person_moving);
X
X	switch (moving) {
X	    when UP :
X		if (board[x][y] & CL_LN_RT)
X		    x++, moving = RIGHT;
X		else if (board[x][y] & CL_LN_UP)
X		    y--;
X		else if (board[x][y] & CL_LN_LF)
X		    x--, moving = LEFT;
X
X	    when LEFT :
X		if (board[x][y] & CL_LN_UP)
X		    y--, moving = UP;
X		else if (board[x][y] & CL_LN_LF)
X		    x--;
X		else if (board[x][y] & CL_LN_DN)
X		    y++, moving = DOWN;
X
X	    when DOWN :
X		if (board[x][y] & CL_LN_LF)
X		    x--, moving = LEFT;
X		else if (board[x][y] & CL_LN_DN)
X		    y++;
X		else if (board[x][y] & CL_LN_RT)
X		    x++, moving = RIGHT;
X
X	    when RIGHT :
X		if (board[x][y] & CL_LN_DN)
X		    y++, moving = DOWN;
X		else if (board[x][y] & CL_LN_RT)
X		    x++;
X		else if (board[x][y] & CL_LN_UP)
X		    y--, moving = UP;
X	}
X	if (on_person && moving == OPP_OF(person_moving)) {
X	    /* then bert just ran over player */
X       /* qix on on the "left" of the player (with respect to player facing) */
X	    return LEFT_OF(person_moving);
X        }
X    }
X}
+END+OF+regions.c
echo '-rw-rw-rw-  1 argv        11697 Sep  2 11:14 regions.c    (as sent)'
chmod u=rw,g=rw,o=rw regions.c
ls -l regions.c
echo x - qmove.c
sed 's/^X//' > qmove.c <<'+END+OF+qmove.c'
X#include "qix.h"
X/*
X * Code to draw and move the qix.
X */
X
X#define QSIZE	 45	/* Max size for lines in the Qix */
X#define DTHRESH	 ((4+level)/3)	/* larger ==> more active */
X#define FUDGE	 (Speed)
X#define NLINES	 8	/* Max. # lines in the Qix itself */
X
X/* Qix position: */
Xint
X    qix1_x0[NLINES], qix1_x1[NLINES], qix1_y0[NLINES], qix1_y1[NLINES],
X    qix1_dx0, qix1_dx1, qix1_dy0, qix1_dy1,	/* velocity */
X    qix2_x0[NLINES], qix2_x1[NLINES], qix2_y0[NLINES], qix2_y1[NLINES],
X    qix2_dx0, qix2_dx1, qix2_dy0, qix2_dy1;	/* velocity */
X
Xinit_qix()
X{
X    int x;
X    Speed = 3;
X
X    for (x = 0; x < NLINES; x++) {
X	qix1_x0[x] = BOARD_WIDTH / 2 + (rrand() & 3) - 6;
X	qix1_x1[x] = qix1_x0[x] + 2;
X	qix1_y0[x] = (BOARD_HEIGHT-10) / 2 + (rrand() & 3) - 6;
X	qix1_y1[x] = qix1_y0[x] + 2;
X
X	qix2_x0[x] = BOARD_WIDTH / 2 + (rrand() & 3) - 6;
X	qix2_x1[x] = qix2_x0[x] + 2;
X	qix2_y0[x] = (BOARD_HEIGHT-10) / 2 + (rrand() & 3) - 6;
X	qix2_y1[x] = qix2_y0[x] + 2;
X    }
X}
X
Xmove_qix()
X{
X    static index = 0, count;
X    int i, j;
X
X    if (level < -1 && count++ & 1)
X	return 0;
X
X    if (qix1_x0[index] <= 0)
X	qix1_x0[index] = 1;
X    if (qix1_x0[index] >= BOARD_WIDTH-1)
X	qix1_x0[index] = BOARD_WIDTH-2;
X    if (qix1_x1[index] <= 0)
X	qix1_x1[index] = 1;
X    if (qix1_x1[index] >= BOARD_WIDTH-1)
X	qix1_x1[index] = BOARD_WIDTH-2;
X    if (qix1_y0[index] <= 0)
X	qix1_y0[index] = 1;
X    if (qix1_y0[index] >= BOARD_HEIGHT-1)
X	qix1_y0[index] = BOARD_HEIGHT-2;
X    if (qix1_y1[index] <= 0)
X	qix1_y1[index] = 1;
X    if (qix1_y1[index] >= BOARD_HEIGHT-1)
X	qix1_y1[index] = BOARD_HEIGHT-2;
X
X    if (level > -1) {
X	if (qix2_x0[index] <= 0)
X	    qix2_x0[index] = 1;
X	if (qix2_x0[index] >= BOARD_WIDTH-1)
X	    qix2_x0[index] = BOARD_WIDTH-2;
X	if (qix2_x1[index] <= 0)
X	    qix2_x1[index] = 1;
X	if (qix2_x1[index] >= BOARD_WIDTH-1)
X	    qix2_x1[index] = BOARD_WIDTH-2;
X	if (qix2_y0[index] <= 0)
X	    qix2_y0[index] = 1;
X	if (qix2_y0[index] >= BOARD_HEIGHT-1)
X	    qix2_y0[index] = BOARD_HEIGHT-2;
X	if (qix2_y1[index] <= 0)
X	    qix2_y1[index] = 1;
X	if (qix2_y1[index] >= BOARD_HEIGHT-1)
X	    qix2_y1[index] = BOARD_HEIGHT-2;
X    }
X
X    j = bounds(qix1_x0[index], qix1_y0[index],
X	       qix1_x1[index], qix1_y1[index],
X	       &qix1_dx0, &qix1_dy0, &qix1_dx1, &qix1_dy1);
X    if (j != -1 && level > -1)
X	j = bounds(qix2_x0[index],qix2_y0[index],qix2_x1[index],qix2_y1[index],
X	    &qix2_dx0, &qix2_dy0, &qix2_dx1, &qix2_dy1);
X
X    i = (index + 1) % NLINES;
X
X    /* erase old line */
X    pw_putattributes(draw_win, &qix_mask);
X    draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
X	 convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), 
X		PIX_CLR|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
X		QIX_COLOR_BASE));
X    if (level > -1)
X	draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
X	     convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), 
X		PIX_CLR|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
X		QIX_COLOR_BASE));
X
X    qix1_x0[i] = qix1_x0[index] + qix1_dx0;
X    qix1_y0[i] = qix1_y0[index] + qix1_dy0;
X    qix1_x1[i] = qix1_x1[index] + qix1_dx1;
X    qix1_y1[i] = qix1_y1[index] + qix1_dy1;
X
X    if (level > -1) {
X	qix2_x0[i] = qix2_x0[index] + qix2_dx0;
X	qix2_y0[i] = qix2_y0[index] + qix2_dy0;
X	qix2_x1[i] = qix2_x1[index] + qix2_dx1;
X	qix2_y1[i] = qix2_y1[index] + qix2_dy1;
X    }
X    index = i;
X
X    draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
X	 convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), 
X	 PIX_SRC|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
X	 QIX_COLOR_BASE));
X    if (level > -1)
X	draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
X	     convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), 
X	     PIX_SRC|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
X	     QIX_COLOR_BASE));
X    return j;
X}
X
Xbounds(x0, y0, x1, y1, dx0, dy0, dx1, dy1)
Xregister int x0, y0, x1, y1;
Xregister int *dx0, *dy0, *dx1, *dy1;
X{
X    register int i, new_x0, new_y0, new_x1, new_y1;
X    int count, loop_count = 0;
X
X    /* randomly change direction */
X    if (!(rrand() % 10)) {
X	register int r;
X	/* move at least one space, but not greater than "Speed" */
X	r = rrand();
X	*dx0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
X	r = rrand();
X	*dy0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
X	r = rrand();
X	*dx1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
X	r = rrand();
X	*dy1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
X	/* check that qix is moving towards player */
X	if (level > -2 && !(rrand() % (6 - level))) {
X	    if (pen_x - x0 > 0 && *dx0 < 0)
X		*dx0 = -*dx0;
X	    if (pen_x - x1 > 0 && *dx1 < 0)
X		*dx1 = -*dx1;
X	    if (pen_y - y0 > 0 && *dy0 < 0)
X		*dy0 = -*dy0;
X	    if (pen_y - y1 > 0 && *dy1 < 0)
X		*dy1 = -*dy1;
X	}
X    }
X
X    do  {
X	if (x0 + *dx0 <= 1 || x0 + *dx0 >= BOARD_WIDTH-2)
X	    *dx0 = -*dx0;
X	if (x1 + *dx1 <= 1 || x1 + *dx1 >= BOARD_WIDTH-2)
X	    *dx1 = -*dx1;
X	if (y0 + *dy0 <= 1 || y0 + *dy0 >= BOARD_HEIGHT-2)
X	    *dy0 = -*dy0;
X	if (y1 + *dy1 <= 1 || y1 + *dy1 >= BOARD_HEIGHT-2)
X	    *dy1 = -*dy1;
X
X	new_x0 = x0 + *dx0;
X	new_x1 = x1 + *dx1;
X	new_y0 = y0 + *dy0;
X	new_y1 = y1 + *dy1;
X
X	/* Prevent Qix from growing too large: */
X	if ((abs(new_x1 - new_x0) > QSIZE) || (abs((*dx0)-(*dx1)) < DTHRESH))
X	    if (rrand()&1)
X		*dx1 += (x1<x0 ? FUDGE : -FUDGE), new_x1 = x1 + *dx1;
X	    else
X		*dx0 += (x0<x1 ? FUDGE : -FUDGE), new_x0 = x0 + *dx0;
X	if ((abs(new_y1 - new_y0) > QSIZE) || (abs((*dy0)-(*dy1)) < DTHRESH)) 
X	    if (rrand()&1)
X		(*dy1) += (y1<y0 ? FUDGE : -FUDGE), new_y1 = y1 + *dy1;
X	    else
X		(*dy0) += (y0<y1 ? FUDGE : -FUDGE), new_y0 = y0 + *dy0;
X
X	/* if we hit a wall, try again */
X	if ((count = check_line(new_x0, new_y0, new_x1, new_y1)) == 1) {
X	    register int r;
X	    *dx0 = (1 + (r = rrand())%Speed) * ((r&1) ? -1 : 1);
X	    *dy0 = (1 + (r = rrand())%Speed) * ((r&1) ? -1 : 1);
X	    *dx1 = (1 + (r = rrand())%Speed) * ((r&1) ? -1 : 1);
X	    *dy1 = (1 + (r = rrand())%Speed) * ((r&1) ? -1 : 1);
X	}
X	if (!(++loop_count % 100)) {
X#ifdef DEBUG
X	    msg("bad news... loop count hit %d", loop_count);
X	    Sleep(2);
X	    remove_msgs(0);
X#endif DEBUG
X	    break;
X	}
X    } while(count == 1);
X    return count;
X}
X
Xcheck_line(x1, y1, x2, y2)
X{
X    register double dx_step, dy_step, x, y;
X    int dx, dy, steps;
X
X    x = x1 + 0.5, y = y1 + 0.5;
X    dx = x2 - x1;
X    dy = y2 - y1;
X
X    steps = max(abs(dx), abs(dy)) + 1;
X    dx_step = (double)((double)dx / (double)steps);
X    dy_step = (double)((double)dy / (double)steps);
X
X    while (steps--) {
X	if (board[(int)x][(int)y]) {
X	    if (
X#ifdef DEBUG
X		!no_qix_kill &&
X#endif DEBUG
X		(board[(int)x][(int)y] & NEW_LINE))
X		return -1;
X	    return 1;  /* just an intersect, return */
X	}
X	x += dx_step;
X	y += dy_step;
X    }
X    return 0;
X}
X
Xget_qix_pos(which, x, y)
Xregister int *x, *y;
X{
X    register int i;
X    int *x0, *y0, *x1, *y1;
X
X    if (which == 0)
X	x0 = qix1_x0, y0 = qix1_y0, x1 = qix1_x1, y1 = qix1_y1;
X    else
X	x0 = qix2_x0, y0 = qix2_y0, x1 = qix2_x1, y1 = qix2_y1;
X
X    for (i = 0; i < NLINES; i++)
X	if (!board[x0[i]][y0[i]]) {
X	    *x = x0[i], *y = y0[i];
X	    return 0;
X	}
X    msg("The qix is trapped in a place it shouldn't have gotten to!");
X    Sleep(2);
X    remove_msgs(0);
X    return -1;
X}
+END+OF+qmove.c
echo '-rw-rw-rw-  1 argv         6994 Sep  2 16:03 qmove.c    (as sent)'
chmod u=rw,g=rw,o=rw qmove.c
ls -l qmove.c
echo x - polyfill.c
sed 's/^X//' > polyfill.c <<'+END+OF+polyfill.c'
X/*
X    File:   polyfill.c
X    By:     Sky Schulz
X  
X    For:    Yaq (Yet Another Qix)
X
X    Routine to fill the playing field (and to count the number of cells
X    claimed, for scoring purposes).
X  
X    Friday, May 8th, 1987 - Sky
X    Making mods to support the new/old data structure implementation.
X  
X    Just a little note to remind whom-ever:
X	The coordinate values (x and y) used in polyfill() are NOT the actual
X	coordinate values of the board.  Instead, they are twice the size of
X	the board and represent the quadrants within a cell.
X*/
X
X#include    "qix.h"
X#ifdef X11
Xstruct pr_pos {
X    short x, y;
X};
X#endif /* X11 */
X
Xstatic region_score;
X
X/* Polygon fill point stack structure */
Xtypedef struct pr_pos pnt;
X
X/* Polygon fill stack */
X#define MAX_PFILL_PNTS 128
Xpnt pnts[MAX_PFILL_PNTS];
X
Xint pntr;	/* Stack pointer */
X
X/* Filled areas look-up tables */
Xint fill_table[2][2] = {	/* Filled state bits */
X    {CL_PNT_UL, CL_PNT_UR},
X    {CL_PNT_LL, CL_PNT_LR}
X};
Xint edge_table[4][2][2] = {	/* Edge state bits */
X    {			/* Look left */
X	{0, CL_LN_UP},
X	{0, CL_LN_DN}
X    },
X    {			/* Look right */
X	{CL_LN_UP, 0},
X	{CL_LN_DN, 0}
X    },
X    {			/* Look up */
X	{0, 0},
X	{CL_LN_LF, CL_LN_RT}
X    },
X    {			/* Look down */
X	{CL_LN_LF, CL_LN_RT},
X	{0, 0}
X    }
X};
X
X/* Macro for testing and changing the current (x,y) points state */
Xpttest(x,y)
Xregister int x, y;
X{
X    return (board[(x)/2][(y)/2] & fill_table[(y)&1][(x)&1]);
X}
X
Xlntest(x,y,d)
Xregister int x, y;
X{
X    return (board[(x)/2][(y)/2] & edge_table[d-LEFT][(y)&1][(x)&1]);
X}
X
Xptset(x,y)
Xregister int x,y;
X{
X    board[x/2][y/2] |= fill_table[y&1][x&1], region_score++;
X#ifdef DEBUG
X    if (debug)
X	box(convert_x(x/2)-3 + ((x&1)*4), convert_y(y/2)-3 + ((y&1)*4),
X	    convert_x(x/2)-3 + ((x&1)*4)+2, convert_y(y/2)-3 + ((y&1)*4)+2,
X	    PIX_SRC);
X#endif DEBUG
X}
X
Xpush(x,y)
Xregister int x, y;
X{
X    if (++pntr == MAX_PFILL_PNTS) {
X        /* Serious problem folks... */
X        msg ("Polygon fill stack overflow! (%d, %d)", x, y);
X	sleep(2);
X	remove_msgs(0);
X        --pntr;
X    } else
X        pnts[pntr].x = x, pnts[pntr].y = y;
X}
X
Xpop(x,y)
Xregister int *x, *y;
X{
X    if (pntr < 0)
X	return FALSE;
X
X    *x = pnts[pntr].x;
X    *y = pnts[pntr].y;
X    pntr--; 
X    return TRUE;
X}
X
X/* polyfill(x, y) - Flood the enclosed region found to surround (x,y) */
Xpolyfill(x, y)
Xregister int x, y;
X{
X    int org_x, org_y;
X    int i, j;
X
X    /* Make sure stack is reset (should be if all works well) */
X    pntr = -1;
X    region_score = 0;
X
X    /* Save start point */
X    org_x = x;
X    org_y = y;
X
X    /*
X     * Main loop - uses x,y to start each push to the left and right on entry
X     * x and y come from the call parameters on subsequent trips around the
X     * loop x and y come from pop() returning points saved with push()
X     * calls 
X     */
X    do  {
X	/* Remember start point */
X	x = org_x;
X	y = org_y;
X
X	/* Check points above and below start */
X	/* test point above empty */
X	if (!lntest(x, y, UP) && !pttest(x, y - 1))
X	    push(x, y - 1);	/* Yes, save it */
X
X	if (!lntest(x, y, DOWN) && !pttest(x, y + 1))
X	    push(x, y + 1);	/* Yeah, save it */
X
X	/* Fill in initial point */
X	ptset(x, y);
X
X	/* if we can move left, then do it */
X	if (!lntest(x, y, LEFT)) {
X	    /* Push to the left first.  Stop when we hit the edge */
X	    for (x--;;x--) {
X		/* See if we need to save points above and below */
X		if (lntest(x, y-1, RIGHT) && (!lntest(x, y, UP)))
X		    push(x, y - 1);
X		if (lntest(x, y+1, RIGHT) && (!lntest(x, y, DOWN)))
X		    push(x, y + 1);
X		/* Fill in current point */
X		ptset(x, y);
X
X		/* See if we hit the edge */
X		if (lntest(x, y, LEFT))
X		    break;
X	    }
X	}
X	/* Now try moving to the right */
X	x = org_x;
X	y = org_y;
X
X	if (lntest(x, y, RIGHT))	/* can we move right? */
X	    continue;	/* No, get another point */
X	for (x++;;x++) {	/* Go until we hit the right edge */
X	    /* Check points above and below to see if we can seep thru */
X	    if (lntest(x, y-1, LEFT) && (!lntest(x, y, UP)))
X		push(x, y - 1);
X	    if (lntest(x, y+1, LEFT) && (!lntest(x, y, DOWN)))
X		push(x, y + 1);
X	    /* Fill in current point */
X	    ptset(x, y);
X
X	    /* Remove "surrounded" edges */
X	    /* lnkill(x, y); */
X
X	    /* See if we hit the edge yet */
X	    if (lntest(x, y, RIGHT))
X		break;
X	}
X    }
X    while (pop(&org_x, &org_y));	/* Go until our stack is empty */
X
X    return region_score;
X}			/* end of polyfill */
+END+OF+polyfill.c
echo '-rw-rw-rw-  1 argv         4381 Jul 11 13:02 polyfill.c    (as sent)'
chmod u=rw,g=rw,o=rw polyfill.c
ls -l polyfill.c
echo x - polygon_area.c
sed 's/^X//' > polygon_area.c <<'+END+OF+polygon_area.c'
X/*
X * File:	polygon_area.c
X * By:		Don Hatch
X *
X * For:		Yaq (Yet Another Qix)
X *
X * This procedure efficiently calculates the area of a closed polygon
X * consisting only of alternating horizontal and vertical segments.
X *
X * Running time is O(n), where n is the number of segments (or, equivalently,
X * the number of vertices).
X *
X * Input:	p -- an array containing the vertices
X *		n -- number of vertices (must be even, of course)
X *
X * Output:	function returns the area (always non-negative).
X *		The p array is not disturbed.
X *
X * Implementation:
X *	Total is initialized to zero.
X *
X *	Three consecutive points are chosen, namely p[n-1], p[n-2]
X *	and p[n-3].  These three points are replaced by a single point,
X *	effectively "ironing out" the kink p[n-2], and making a simpler
X *	polygon.  The area of the ironed-out kink (which is a rectangle)
X *	is added or subtracted from total, as appropriate.
X *
X *	We now have a polygon with two fewer vertices; decrement n by two
X *	and repeat the above until there's only two points left.
X *	The absolute value of total is returned (since we may have calculated
X *	the area "inside-out").
X *
X *	At the top of the loop, temp always represents p[n-1] in the current
X *	(simplified) polygon; we use temp so as not to disturb the input array.
X *
X *	Note that the type of coordinates need not be integer; this algorithm
X *	would work with floating-point coordinates as well.
X */
X
X#include <pixrect/pixrect_hs.h>
X
X#define rect_area(a, b)	(((b).x - (a).x) * ((b).y - (a).y))
X
Xsimple_polygon_area0(p, n)	/* works if polygon is alternating
X				   horizontal/vertical segments */
Xregister struct pr_pos *p;
Xregister int n;
X{
X    register int total = 0;
X    register int first_line_is_horizontal = p[0].y == p[1].y;
X    register struct pr_pos temp;		/* doesn't hurt */
X    temp = p[n-1];
X
X    for (; n > 2; n -= 2) {
X	if (first_line_is_horizontal)
X	    temp.y = p[n-3].y;
X	else
X	    temp.x = p[n-3].x;
X	total += rect_area(p[n-2], temp);
X    }
X    return abs(total);
X}
Xsimple_polygon_area1(p, n)	/* works if polygon is alternating
X				   horizontal/vertical segments */
Xregister struct pr_pos *p;
Xregister int n;
X{
X    register int total = 0;
X    while (n--)
X	total = p[n].x * p[n].y - total;	/* alternately add/subtract */
X    return abs(total);
X}
X#define twice_triangle_area(a,b,c) ((b.y-a.y)*(c.x-a.x)-(c.y-a.y)*(b.x-a.x))
Xpolygon_area(p, n) /* works on arbitrary polygons */
Xregister struct pr_pos *p;
Xregister int n;
X{
X    register int total = 0;
X
X    for (; n > 2; n --)
X	total += twice_triangle_area(p[0], p[n-1], p[n-2]);
X
X    return abs(total)/2; /* note roundoff error if actual area is fractional*/
X}
X#define twice_segment_area(b,c)	((b.y * c.x) - (c.y * b.x))
Xpolygon_area2(p, n) /* works on arbitrary polygons, if coords are close to 0 */
Xregister struct pr_pos *p;
Xregister int n;
X{
X    register int total = segment_area(p[n-1], p[0]);
X
X    for (; --n > 0; ++p)
X	total += segment_area(p[0], p[1]);
X
X    return abs(total)/2; /* note roundoff error if actual area is fractional*/
X}
X
X#ifdef DRIVER
X#define MAXPTS 10000
Xmain(argc, argv)
Xchar **argv;
X{
X    struct pr_pos p[MAXPTS];
X    int n, is_tty = isatty(0);
X    is_tty && printf("Enter x,y coords of the vertices, one per line.\n");
X    while (is_tty && printf("--> "), scanf("%d %d", &p[n].x, &p[n].y) == 2)
X	if (++n == MAXPTS) {
X	    printf("That's quite enough!\n");
X	    break;
X	}
X    dump(p, n);
X    printf("simple area is        %d\n", old_simple_polygon_area(p, n));
X    printf("simple simple area is %d\n", simple_polygon_area(p, n));
X    printf("area is               %d\n", polygon_area(p, n));
X    dump(p, n);	/* make sure it's the same */
X}
Xdump(p, n)
Xstruct pr_pos *p;
X{
X    int i;
X    printf("%d pts: ", n);
X    for (i = 0; i < n; ++i)
X	printf("%d %d  ", p[i].x, p[i].y);
X    printf("\n");
X}
X#endif
+END+OF+polygon_area.c
echo '-rw-rw-rw-  1 argv         3815 Jun 30 14:50 polygon_area.c    (as sent)'
chmod u=rw,g=rw,o=rw polygon_area.c
ls -l polygon_area.c
echo x - polyfill_rec.c
sed 's/^X//' > polyfill_rec.c <<'+END+OF+polyfill_rec.c'
X/*
X    File:   polyfill.c
X    By:     Don Hatch
X  
X    For:    Yaq (Yet Another Qix)
X
X    Cute randomized recursive seed fill routine,
X    until bug in the real one gets fixed
X  
X    Just a little note to remind whom-ever:
X  
X	The coordinate values (x and y) used in polyfill() are NOT the actual
X	coordinate values of the board.  Instead, they are twice the size of
X	the board and represent the quadrants within a cell.
X*/
X
X#include    "qix.h"
X
X
X/* Filled areas look-up tables */
Xint fill_table[2][2] = {	/* Filled state bits */
X    {CL_PNT_UL, CL_PNT_LL},
X    {CL_PNT_UR, CL_PNT_LR}
X};
Xint edge_table[4][2][2] = {	/* Edge state bits */
X    {			/* Look left */
X	{0, 0},
X	{CL_LN_UP, CL_LN_DN}
X    },
X    {			/* Look right */
X	{CL_LN_UP, CL_LN_DN},
X	{0, 0}
X    },
X    {			/* Look up */
X	{0, CL_LN_LF},
X	{0, CL_LN_RT}
X    },
X    {			/* Look down */
X	{CL_LN_LF, 0},
X	{CL_LN_RT, 0}
X    }
X};
X
X/* Macro for testing and changing the current (x,y) points state */
X
X#define pttest(x,y)	(board[(x)/2][(y)/2] & fill_table[(x)&1][(y)&1])
X
X
X#define lntest(x,y,d) (board[(x)/2][(y)/2] & edge_table[d-LEFT][(x)&1][(y)&1])
X
X#define ptclr(x,y) \
X    (board[(x)/2][(y)/2] &= ~fill_table[(x)&1][(y)&1]), region_score++;
X
X#ifndef DEBUG
X#define ptset(x,y) \
X    (board[(x)/2][(y)/2] |= fill_table[(x)&1][(y)&1]), region_score++;
X
X#else
X
Xptset(x,y)
Xregister int x,y;
X{
X    extern region_score;
X    board[x/2][y/2] |= fill_table[x&1][y&1], region_score++;
X    if (debug)
X	/* pw_put(draw_win, convert_x(x/2), convert_y(y/2)-3, 1); */
X    box(convert_x(x/2)-3 + ((x&1)*4), convert_y(y/2)-3 + ((y&1)*4),
X        convert_x(x/2)-3 + ((x&1)*4)+2, convert_y(y/2)-3 + ((y&1)*4)+2,PIX_SRC);
X}
X#endif DEBUG
X
Xstatic region_score;
Xstatic depth = 0;
X
Xint seedfill1(), seedfill2(), seedfill3(), seedfill4();
Xint (*seedfills[])() = {seedfill1, seedfill2, seedfill3, seedfill4};
X#define seedfill (seedfills[(rand()>>5) % 4])
X
X/* polyfill(x, y) - Flood the enclosed region found to surround (x,y) */
Xpolyfill(x, y)
Xregister int x, y;
X{
X    region_score = 0;
X    seedfill(x,y);
X    return region_score;
X}
Xstatic
Xseedfill1(x, y)
Xregister int x, y;
X{
X    ++depth;
X    if (depth == toodeep) {
X	printf("Too deep! stack depth exceeded %d\n",toodeep);
X	depth--;
X	return;
X    }
X    if (pttest(x, y)) {
X	depth--;
X	return;
X    }
X    /* Fill in initial point */
X    ptset(x, y);
X    if (!lntest(x, y, LEFT))
X	seedfill(x - 1, y);
X    if (!lntest(x, y, DOWN))
X	seedfill(x, y + 1);
X    if (!lntest(x, y, RIGHT))
X	seedfill(x + 1, y);
X    if (!lntest(x, y, UP))
X	seedfill(x, y - 1);
X    depth--;
X}
X
Xstatic
Xseedfill2(x, y)
Xregister int x, y;
X{
X    ++depth;
X    if (depth == toodeep) {
X	printf("Too deep! stack depth exceeded %d\n",toodeep);
X	depth--;
X	return;
X    }
X    if (pttest(x, y)) {
X	depth--;
X	return;
X    }
X    /* Fill in initial point */
X    ptset(x, y);
X    if (!lntest(x, y, RIGHT))
X	seedfill(x + 1, y);
X    if (!lntest(x, y, UP))
X	seedfill(x, y - 1);
X    if (!lntest(x, y, LEFT))
X	seedfill(x - 1, y);
X    if (!lntest(x, y, DOWN))
X	seedfill(x, y + 1);
X    depth--;
X}
X
Xstatic
Xseedfill3(x, y)
Xregister int x, y;
X{
X    ++depth;
X    if (depth == toodeep) {
X	printf("Too deep! stack depth exceeded %d\n",toodeep);
X	depth--;
X	return;
X    }
X    if (pttest(x, y)) {
X	depth--;
X	return;
X    }
X    /* Fill in initial point */
X    ptset(x, y);
X    if (!lntest(x, y, UP))
X	seedfill(x, y - 1);
X    if (!lntest(x, y, LEFT))
X	seedfill(x - 1, y);
X    if (!lntest(x, y, DOWN))
X	seedfill(x, y + 1);
X    if (!lntest(x, y, RIGHT))
X	seedfill(x + 1, y);
X    depth--;
X}
X
Xstatic
Xseedfill4(x, y)
Xregister int x, y;
X{
X    ++depth;
X    if (depth == toodeep) {
X	printf("Too deep! stack depth exceeded %d\n",toodeep);
X	depth--;
X	return;
X    }
X    if (pttest(x, y)) {
X	depth--;
X	return;
X    }
X    /* Fill in initial point */
X    ptset(x, y);
X    if (!lntest(x, y, DOWN))
X	seedfill(x, y + 1);
X    if (!lntest(x, y, UP))
X	seedfill(x, y - 1);
X    if (!lntest(x, y, RIGHT))
X	seedfill(x + 1, y);
X    if (!lntest(x, y, LEFT))
X	seedfill(x - 1, y);
X    depth--;
X}
+END+OF+polyfill_rec.c
echo '-rw-rw-rw-  1 argv         3979 Jun 30 14:50 polyfill_rec.c    (as sent)'
chmod u=rw,g=rw,o=rw polyfill_rec.c
ls -l polyfill_rec.c
echo x - score.c
sed 's/^X//' > score.c <<'+END+OF+score.c'
X/*  SCORE.C  */
X
X#include "qix.h"
X#include <sys/fcntl.h>
X
X#define NAMELEN		3
X
Xstruct scores {
X    int score;
X    char initials[NAMELEN+1];
X    char login[9];
X}   top_ten[10];
X
Xextern int errno;
Xextern char *sys_errlist[];
X
X/* returns whether the score file can be accessed */
Xscore_board(Read, names)
X{
X    struct scores *scp, *temp;
X    char buf[BUFSIZ];
X    int fd;
X
X    clear_board();
X
X    for (scp = top_ten; scp < &top_ten[10]; scp++) {
X	(void) strcpy(scp->initials, "Qix");
X	scp->initials[3] = 0;
X	(void) strcpy(scp->login, "computer");
X#ifdef DEBUG
X	scp->score = 0;
X#else DEBUG
X	scp->score = 30000;
X#endif DEBUG
X    }
X
X    /* read the top ten file into the array and close the file. If it doesn't
X     * open for read/write, it probably doesn't exit -- create it rw for all.
X     */
X    if ((fd = open(SCOREFILE, O_RDWR)) == -1 &&
X	(Read || (fd = open(SCOREFILE, O_WRONLY, 0666))) ||
X	read(fd, (char *) top_ten, sizeof(top_ten)) == -1) {
X	msg("No score file:\n%s", sys_errlist[errno]);
X	Sleep(2);
X	remove_msgs(0);
X	return -1;
X    }
X
X    /* Print the list */
X    if (Read) {
X	msg("Top Players:\nScore%24cName\n", ' ');
X	for (scp = top_ten; scp < &top_ten[10] && scp->score; scp++) {
X	    (void) sprintf(buf, "%7.d%24c%c%c%c  ", scp->score, ' ',
X		scp->initials[0], scp->initials[1], scp->initials[2]);
X	    if (names)
X		(void) strcat(buf, scp->login);
X	    msg(buf);
X	}
X    }
X    /* check to see if current score made it */
X    else {
X	int pos;
X	for (pos = 1, scp = top_ten; pos <= 10; scp++, pos++)
X	    if (scp->score < score)
X		break;
X	if (pos <= 10) {
X	    char *getlogin(), *login = getlogin();
X
X	    for (temp = &top_ten[9]; temp > scp; temp--)
X		*temp = *(temp - 1);
X	    scp->score = score;
X	    (void) strcpy(scp->login, login);
X	    prompt_initials(pos, scp->initials);
X	    if (strlen(scp->initials) > 1) {
X		(void) lseek(fd, (long)0, 0);
X		(void) write(fd, (char *)top_ten, sizeof top_ten);
X	    }
X	}
X    }
X    (void) close(fd);
X    return 0;
X}
X
Xchar *
Xordinate(n)
X{
X    if (n == 1)
X	return "st";
X    if (n == 2)
X	return "nd";
X    if (n == 3)
X	return "rd";
X    return "th";
X}
X
Xprompt_initials(pos, buf)
Xregister char *buf;
X{
X    Event event;
X    int x = MID_X - 15 * l_width(big_font);
X    int y = 19 * l_height(big_font), len;
X    int ID;
X    char s[16];
X
X    msg("You attained the %d%s position", pos, ordinate(pos));
X    msg("Type initials or use:\nLEFT button to advance one character.");
X    msg("MIDDLE button to decrement one character.\n");
X    msg("Use RETURN or RIGHT button to enter each letter.");
X    msg("Use <backspace> key to go back one position.");
X    (void) sprintf(s, "%d", score);
X    pw_text(draw_win, x, y, PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font, s);
X    x += 25 * l_width(big_font);
X    (void) strcpy(buf, "AAA");
X
X    for (len = 0; len < 3;) {
X	pw_text(draw_win, x - len*l_width(big_font), y, 
X		PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font, buf);
X	pw_text(draw_win, x, y, SRC_OR_DST|PIX_COLOR(TEXT_COLOR), 
X		big_font, "_");
X
X#ifdef X11
X	do XNextEvent(dpy, &event);
X	while (event.xany.type != ButtonPress &&
X	       event.xany.type != KeyPress);
X	if (event.xany.type == ButtonPress)
X	    ID = MS_LEFT + event.xbutton.button - 1;
X	else {
X	    KeySym k;
X	    (void) XLookupString(&event, s, 1, &k, NULL);
X	    ID = (int)(s[0]);
X	}
X#else
X	do window_read_event(Draw, &event);
X	while (event.ie_code == LOC_MOVE || event.ie_code == LOC_DRAG ||
X	       event_is_up(&event));
X	ID = event.ie_code;
X#endif /* X11 */
X
X	switch (ID) {
X	    when 8 : case 127 :
X		if (len > 0)
X		    len--, x -= l_width(big_font);
X	    when '\n' : case '\r' : case MS_RIGHT :
X		len++, x += l_width(big_font);
X	    when MS_LEFT :
X		if (++(buf[len]) < 'A' || buf[len] > 'z')
X		    buf[len] = 'A';
X	    when MS_MIDDLE :
X		if (--(buf[len]) < 'A' || buf[len] > 'z')
X		    buf[len] = 'z';
X	    otherwise :
X		if (isascii(ID))
X		    buf[len] = (char)ID;
X		else
X		    printf("%d ", ID);
X	}
X    }
X}
+END+OF+score.c
echo '-rw-rw-rw-  1 argv         3898 Jul  5 10:22 score.c    (as sent)'
chmod u=rw,g=rw,o=rw score.c
ls -l score.c
echo x - joystick.lf
sed 's/^X//' > joystick.lf <<'+END+OF+joystick.lf'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x7FFF,0xFFFF,0x0000,0x0000,0x6000,0x0003,0x0000,
X	0x0000,0x5000,0x0005,0x0000,0x01FC,0x4800,0x0009,0x0000,
X	0x0603,0x4400,0x0011,0x0000,0x0800,0xC200,0x0021,0x0000,
X	0x1000,0x4100,0x0041,0x0000,0x2000,0x2080,0x0081,0x0000,
X	0x4000,0x10FF,0xFF01,0x0000,0x4000,0x1FFF,0xFF01,0x0000,
X	0x8000,0x087F,0xFF01,0x0000,0x8000,0x080F,0xFF01,0x0000,
X	0x8000,0x0803,0xFF01,0x0000,0x8000,0x0801,0xFF01,0x0000,
X	0x8000,0x0803,0xFF01,0x0000,0x8000,0x080F,0xFF01,0x0000,
X	0x8000,0x08FF,0xFF01,0x0000,0x4000,0x1FFF,0xFF01,0x0000,
X	0x4000,0x10FF,0xFF01,0x0000,0x2000,0x2100,0x0081,0x0000,
X	0x1000,0x4200,0x0041,0x0000,0x0800,0x8400,0x0021,0x0000,
X	0x0603,0x8800,0x0011,0x0000,0x01FC,0x9000,0x0009,0x0000,
X	0x0000,0xA000,0x0005,0x0000,0x0000,0xC000,0x0003,0x0000,
X	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+END+OF+joystick.lf
echo '-rw-rw-rw-  1 argv         1933 Jun 30 14:50 joystick.lf    (as sent)'
chmod u=rw,g=rw,o=rw joystick.lf
ls -l joystick.lf
echo x - joystick.rt
sed 's/^X//' > joystick.rt <<'+END+OF+joystick.rt'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0xFFFF,0xFFFE,0x0000,0x0000,0xC000,0x0006,0x0000,
X	0x0000,0xA000,0x000A,0x0000,0x0000,0x9000,0x0012,0x3F80,
X	0x0000,0x8800,0x0022,0xC060,0x0000,0x8400,0x0043,0x0010,
X	0x0000,0x8200,0x0082,0x0008,0x0000,0x8100,0x0104,0x0004,
X	0x0000,0x80FF,0xFF08,0x0002,0x0000,0x80FF,0xFFF8,0x0002,
X	0x0000,0x80FF,0xFE10,0x0001,0x0000,0x80FF,0xF010,0x0001,
X	0x0000,0x80FF,0xC010,0x0001,0x0000,0x80FF,0x8010,0x0001,
X	0x0000,0x80FF,0xC010,0x0001,0x0000,0x80FF,0xF010,0x0001,
X	0x0000,0x80FF,0xFF10,0x0001,0x0000,0x80FF,0xFFF8,0x0002,
X	0x0000,0x80FF,0xFF08,0x0002,0x0000,0x8100,0x0084,0x0004,
X	0x0000,0x8200,0x0042,0x0008,0x0000,0x8400,0x0021,0x0010,
X	0x0000,0x8800,0x0011,0xC060,0x0000,0x9000,0x0009,0x3F80,
X	0x0000,0xA000,0x0005,0x0000,0x0000,0xC000,0x0003,0x0000,
X	0x0000,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+END+OF+joystick.rt
echo '-rw-rw-rw-  1 argv         1933 Jun 30 14:50 joystick.rt    (as sent)'
chmod u=rw,g=rw,o=rw joystick.rt
ls -l joystick.rt
echo x - joystick.up
sed 's/^X//' > joystick.up <<'+END+OF+joystick.up'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0003,0xF800,0x0000,0x0000,0x000C,0x0600,0x0000,
X	0x0000,0x0010,0x0100,0x0000,0x0000,0x0060,0x00C0,0x0000,
X	0x0000,0x0040,0x0040,0x0000,0x0000,0x0080,0x0020,0x0000,
X	0x0000,0x0100,0x0010,0x0000,0x0000,0x0100,0x0010,0x0000,
X	0x0000,0x0200,0x0008,0x0000,0x0000,0x0200,0x0008,0x0000,
X	0x0000,0x0200,0x0008,0x0000,0x0000,0x0200,0x0008,0x0000,
X	0x0000,0x0200,0x0008,0x0000,0x0000,0x0200,0x0008,0x0000,
X	0x0000,0x0200,0x0008,0x0000,0x0000,0x0100,0x0010,0x0000,
X	0x0000,0x0100,0x0010,0x0000,0x0000,0x0080,0x0020,0x0000,
X	0x0000,0x7F80,0x003F,0x8000,0x0000,0x6060,0x00C1,0x8000,
X	0x0000,0x5010,0x0102,0x8000,0x0000,0x480C,0x0604,0x8000,
X	0x0000,0x440B,0xFA08,0x8000,0x0000,0x4208,0x0210,0x8000,
X	0x0000,0x4104,0x0420,0x8000,0x0000,0x4084,0x0440,0x8000,
X	0x0000,0x407E,0x0F80,0x8000,0x0000,0x407E,0x0F80,0x8000,
X	0x0000,0x407E,0x0F80,0x8000,0x0000,0x407F,0x1F80,0x8000,
X	0x0000,0x407F,0x1F80,0x8000,0x0000,0x407F,0x1F80,0x8000,
X	0x0000,0x407F,0x1F80,0x8000,0x0000,0x407F,0xFF80,0x8000,
X	0x0000,0x407F,0xFF80,0x8000,0x0000,0x407F,0xFF80,0x8000,
X	0x0000,0x407F,0xFF80,0x8000,0x0000,0x4080,0x0040,0x8000,
X	0x0000,0x4100,0x0020,0x8000,0x0000,0x4200,0x0010,0x8000,
X	0x0000,0x4400,0x0008,0x8000,0x0000,0x4800,0x0004,0x8000,
X	0x0000,0x5000,0x0002,0x8000,0x0000,0x6000,0x0001,0x8000,
X	0x0000,0x7FFF,0xFFFF,0x8000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+END+OF+joystick.up
echo '-rw-rw-rw-  1 argv         1933 Jun 30 14:50 joystick.up    (as sent)'
chmod u=rw,g=rw,o=rw joystick.up
ls -l joystick.up
echo x - joystick.dn
sed 's/^X//' > joystick.dn <<'+END+OF+joystick.dn'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x7FFF,0xFFFF,0x8000,0x0000,0x6000,0x0001,0x8000,
X	0x0000,0x5000,0x0002,0x8000,0x0000,0x4800,0x0004,0x8000,
X	0x0000,0x4400,0x0008,0x8000,0x0000,0x4200,0x0010,0x8000,
X	0x0000,0x4100,0x0020,0x8000,0x0000,0x4080,0x0040,0x8000,
X	0x0000,0x407F,0xFF80,0x8000,0x0000,0x407F,0xFF80,0x8000,
X	0x0000,0x407F,0xFF80,0x8000,0x0000,0x407F,0xFF80,0x8000,
X	0x0000,0x407F,0xFF80,0x8000,0x0000,0x407F,0xBF80,0x8000,
X	0x0000,0x407F,0xBF80,0x8000,0x0000,0x407F,0x1F80,0x8000,
X	0x0000,0x407F,0x1F80,0x8000,0x0000,0x407E,0x0F80,0x8000,
X	0x0000,0x407E,0x0F80,0x8000,0x0000,0x4082,0x0840,0x8000,
X	0x0000,0x4104,0x0420,0x8000,0x0000,0x4204,0x0410,0x8000,
X	0x0000,0x4408,0x0208,0x8000,0x0000,0x480B,0xFA04,0x8000,
X	0x0000,0x500C,0x0602,0x8000,0x0000,0x6010,0x0101,0x8000,
X	0x0000,0x7FE0,0x00FF,0x8000,0x0000,0x0040,0x0040,0x0000,
X	0x0000,0x0080,0x0020,0x0000,0x0000,0x0100,0x0010,0x0000,
X	0x0000,0x0100,0x0010,0x0000,0x0000,0x0200,0x0008,0x0000,
X	0x0000,0x0200,0x0008,0x0000,0x0000,0x0200,0x0008,0x0000,
X	0x0000,0x0200,0x0008,0x0000,0x0000,0x0200,0x0008,0x0000,
X	0x0000,0x0200,0x0008,0x0000,0x0000,0x0200,0x0008,0x0000,
X	0x0000,0x0100,0x0010,0x0000,0x0000,0x0100,0x0010,0x0000,
X	0x0000,0x0080,0x0020,0x0000,0x0000,0x0040,0x0040,0x0000,
X	0x0000,0x0060,0x00C0,0x0000,0x0000,0x0010,0x0100,0x0000,
X	0x0000,0x000C,0x0600,0x0000,0x0000,0x0003,0xF800,0x0000
+END+OF+joystick.dn
echo '-rw-rw-rw-  1 argv         1933 Jun 30 14:50 joystick.dn    (as sent)'
chmod u=rw,g=rw,o=rw joystick.dn
ls -l joystick.dn
echo x - joystick.stop
sed 's/^X//' > joystick.stop <<'+END+OF+joystick.stop'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x7FFF,0xFFFF,0x8000,0x0000,0x6000,0x0001,0x8000,
X	0x0000,0x5003,0xF802,0x8000,0x0000,0x480C,0x0604,0x8000,
X	0x0000,0x4410,0x0108,0x8000,0x0000,0x4260,0x00D0,0x8000,
X	0x0000,0x4140,0x0060,0x8000,0x0000,0x4080,0x0020,0x8000,
X	0x0000,0x4100,0x0010,0x8000,0x0000,0x4100,0x0010,0x8000,
X	0x0000,0x4200,0x0008,0x8000,0x0000,0x4200,0x0008,0x8000,
X	0x0000,0x4200,0x0008,0x8000,0x0000,0x4200,0x0008,0x8000,
X	0x0000,0x4200,0x0008,0x8000,0x0000,0x4200,0x0008,0x8000,
X	0x0000,0x4200,0x0008,0x8000,0x0000,0x4100,0x0010,0x8000,
X	0x0000,0x4100,0x0010,0x8000,0x0000,0x4080,0x0020,0x8000,
X	0x0000,0x4140,0x0060,0x8000,0x0000,0x4260,0x00D0,0x8000,
X	0x0000,0x4410,0x0108,0x8000,0x0000,0x480C,0x0604,0x8000,
X	0x0000,0x5003,0xF802,0x8000,0x0000,0x6000,0x0001,0x8000,
X	0x0000,0x7FFF,0xFFFF,0x8000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+END+OF+joystick.stop
echo '-rw-rw-rw-  1 argv         1933 Jun 30 14:50 joystick.stop    (as sent)'
chmod u=rw,g=rw,o=rw joystick.stop
ls -l joystick.stop
echo x - spark1.pr
sed 's/^X//' > spark1.pr <<'+END+OF+spark1.pr'
X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
X */
X	0x0200,0x0008,0x0080,0x0840,0x0228,0x4080,0x0A52,0x0480,
X	0x2150,0x0484,0x0010,0x1280,0x000A,0x0020,0x1100,0x0000
+END+OF+spark1.pr
echo '-rw-rw-rw-  1 argv          193 Jun 30 14:50 spark1.pr    (as sent)'
chmod u=rw,g=rw,o=rw spark1.pr
ls -l spark1.pr
echo x - spark2.pr
sed 's/^X//' > spark2.pr <<'+END+OF+spark2.pr'
X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
X */
X	0x0210,0x0100,0x9002,0x0040,0x0120,0x4A50,0x0102,0x1440,
X	0x0148,0x0801,0x2120,0x0A84,0x1000,0x0088,0x0400,0x5000
+END+OF+spark2.pr
echo '-rw-rw-rw-  1 argv          193 Jun 30 14:50 spark2.pr    (as sent)'
chmod u=rw,g=rw,o=rw spark2.pr
ls -l spark2.pr
echo x - spark3.pr
sed 's/^X//' > spark3.pr <<'+END+OF+spark3.pr'
X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
X */
X	0x4100,0x0008,0x0081,0x8800,0x0008,0x4080,0x0412,0x0000,
X	0x2080,0x0404,0x0010,0x1080,0x8002,0x0020,0x1104,0x0000
+END+OF+spark3.pr
echo '-rw-rw-rw-  1 argv          193 Jun 30 14:50 spark3.pr    (as sent)'
chmod u=rw,g=rw,o=rw spark3.pr
ls -l spark3.pr
echo x - spark4.pr
sed 's/^X//' > spark4.pr <<'+END+OF+spark4.pr'
X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0000,0x0120,0x0808,0x0040,0x0910,0x0244,0x2480,
X	0x0148,0x1020,0x0484,0x0010,0x0900,0x0040,0x0000,0x0000
+END+OF+spark4.pr
echo '-rw-rw-rw-  1 argv          193 Jun 30 14:50 spark4.pr    (as sent)'
chmod u=rw,g=rw,o=rw spark4.pr
ls -l spark4.pr
echo x - marker.cursor
sed 's/^X//' > marker.cursor <<'+END+OF+marker.cursor'
X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0180,0x03C0,0x0660,0x0C30,0x1818,0x300C,0x6006,
X	0x300C,0x1818,0x0C30,0x0660,0x03C0,0x0180,0x0000,0x0000
+END+OF+marker.cursor
echo '-rw-rw-rw-  1 argv          193 Jun 30 14:50 marker.cursor    (as sent)'
chmod u=rw,g=rw,o=rw marker.cursor
ls -l marker.cursor
echo x - qix.icon
sed 's/^X//' > qix.icon <<'+END+OF+qix.icon'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
X	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0040,0x0001,
X	0x8000,0x0000,0x1042,0x0001,0x8000,0x0000,0x0822,0x0001,
X	0x8000,0x0018,0x0422,0x0001,0x8000,0x0007,0x8211,0x0001,
X	0xFFF0,0x0000,0x7991,0xF001,0xA230,0x0000,0x07FF,0x0001,
X	0xC450,0x0000,0xFFF9,0x0001,0x9110,0x000F,0x001F,0xE001,
X	0x8890,0x0000,0x000D,0x0001,0xA230,0x0000,0x0007,0x0001,
X	0xC450,0x0000,0x0002,0x8001,0x9110,0x0000,0x0001,0x8001,
X	0x889F,0xFF00,0x0001,0x8001,0xA232,0x2300,0x0000,0xE001,
X	0xC454,0x4500,0x0000,0x9001,0x9111,0x1100,0x0000,0xC801,
X	0x8898,0x8900,0x0000,0xC401,0xFFF2,0x2300,0x0000,0x6201,
X	0xC444,0x4500,0x0000,0x6001,0x9111,0x1100,0x0000,0x5001,
X	0x8888,0x8B00,0x0000,0x5001,0xA222,0x2100,0x0000,0x4801,
X	0xC444,0x4500,0x0000,0x4801,0x9111,0x1300,0x0000,0x4401,
X	0x8888,0x8900,0x0000,0x2401,0xA222,0x2300,0x0000,0x2201,
X	0xC444,0x4500,0x0000,0x2001,0x9111,0x1100,0x0000,0x2001,
X	0x8888,0x8904,0x0000,0x2001,0xA222,0x230A,0x0000,0x2001,
X	0xC544,0x450A,0x0000,0x2001,0xFFFF,0xFF04,0x0000,0x1001,
X	0x8240,0x0004,0x0000,0x1001,0x8100,0x0004,0x0000,0x1001,
X	0x8240,0x0004,0x0000,0x1001,0x8000,0x0004,0x0000,0x0001,
X	0x8000,0x0004,0x0000,0x0001,0x8000,0x0005,0x0000,0x0001,
X	0x8000,0x0016,0x0000,0x0001,0x8000,0x000C,0x0000,0x0001,
X	0x8000,0x0015,0x0000,0x0001,0x8000,0x0004,0x0000,0x0001,
X	0x8000,0x0004,0x0000,0x0001,0x8000,0x0004,0x0000,0x0001,
X	0x8000,0x0004,0x0000,0x0005,0x8000,0x0004,0x0000,0x0003,
X	0x8000,0x0004,0x0000,0x0009,0x8000,0x0004,0x0000,0x0005,
X	0x8000,0x001F,0xFFE0,0x0001,0x8000,0x001D,0xDDE0,0x0001,
X	0x8000,0x001B,0xBBA0,0x0001,0x8000,0x001E,0xEEE8,0x0001,
X	0x8000,0x0017,0x7770,0x0001,0x8000,0x001D,0xDDF0,0x0001,
X	0x8000,0x001B,0xBBA0,0x0001,0x8000,0x001E,0xEEE8,0x0001,
X	0x8000,0x0017,0x7760,0x0001,0x8000,0x001D,0xDDE0,0x0001,
X	0x8000,0x001B,0xBBA0,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
+END+OF+qix.icon
echo '-rw-rw-rw-  1 argv         1933 Jun 30 14:50 qix.icon    (as sent)'
chmod u=rw,g=rw,o=rw qix.icon
ls -l qix.icon
echo x - mouse.rt.icon
sed 's/^X//' > mouse.rt.icon <<'+END+OF+mouse.rt.icon'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0x8000,
X	0x0006,0x0000,0x0000,0x6000,0x0008,0x0000,0x0000,0x1000,
X	0x0009,0xFF9F,0xF9FF,0x9000,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0x0090,0x09FF,0x8800,
X	0x0011,0x0090,0x09FF,0x8800,0x0011,0xFF9F,0xF9FF,0x8800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x0000,0x0800,
X	0x0010,0x0000,0x0000,0x0800,0x0010,0x0000,0x7FFF,0xC800,
X	0x0010,0x0000,0x4000,0x4800,0x0010,0x0000,0x48C0,0x4800,
X	0x0010,0x0000,0x5500,0x4800,0x0010,0x0000,0x62CA,0x4800,
X	0x0010,0x0000,0x542B,0x4800,0x0010,0x0000,0x49CB,0x4800,
X	0x0010,0x0000,0x4000,0x4800,0x0010,0x0000,0x7FFF,0xC800,
X	0x0008,0x0000,0x0000,0x1000,0x0008,0x0000,0x0000,0x1000,
X	0x0006,0x0000,0x0000,0x6000,0x0001,0xFFFF,0xFFFF,0x8000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+END+OF+mouse.rt.icon
echo '-rw-rw-rw-  1 argv         1933 Jun 30 14:50 mouse.rt.icon    (as sent)'
chmod u=rw,g=rw,o=rw mouse.rt.icon
ls -l mouse.rt.icon
echo x - jstick.dn.xbm
sed 's/^X//' > jstick.dn.xbm <<'+END+OF+jstick.dn.xbm'
X#define jstick_dn_width 64
X#define jstick_dn_height 64
Xstatic char jstick_dn_bits[] = {
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
X 0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x0a,0x00,0x00,
X 0x40,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x20,0x01,0x00,0x00,0x00,0x22,0x00,
X 0x00,0x10,0x01,0x00,0x00,0x00,0x42,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x82,
X 0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x02,0x01,0x00,0x02,0x01,0x00,0x00,0x00,
X 0x02,0xfe,0xff,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xff,0x01,0x01,0x00,0x00,
X 0x00,0x02,0xfe,0xff,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xff,0x01,0x01,0x00,
X 0x00,0x00,0x02,0xfe,0xff,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xfd,0x01,0x01,
X 0x00,0x00,0x00,0x02,0xfe,0xfd,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xf8,0x01,
X 0x01,0x00,0x00,0x00,0x02,0xfe,0xf8,0x01,0x01,0x00,0x00,0x00,0x02,0x7e,0xf0,
X 0x01,0x01,0x00,0x00,0x00,0x02,0x7e,0xf0,0x01,0x01,0x00,0x00,0x00,0x02,0x41,
X 0x10,0x02,0x01,0x00,0x00,0x00,0x82,0x20,0x20,0x04,0x01,0x00,0x00,0x00,0x42,
X 0x20,0x20,0x08,0x01,0x00,0x00,0x00,0x22,0x10,0x40,0x10,0x01,0x00,0x00,0x00,
X 0x12,0xd0,0x5f,0x20,0x01,0x00,0x00,0x00,0x0a,0x30,0x60,0x40,0x01,0x00,0x00,
X 0x00,0x06,0x08,0x80,0x80,0x01,0x00,0x00,0x00,0xfe,0x07,0x00,0xff,0x01,0x00,
X 0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,
X 0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,
X 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
X 0x10,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,0x00,
X 0x00,0x10,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,
X 0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,
X 0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,
X 0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,
X 0x00,0x00,0x00,0x06,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x08,0x80,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x1f,0x00,
X 0x00,0x00};
+END+OF+jstick.dn.xbm
echo '-rw-rw-rw-  1 argv         2719 Aug  3 10:36 jstick.dn.xbm    (as sent)'
chmod u=rw,g=rw,o=rw jstick.dn.xbm
ls -l jstick.dn.xbm
echo x - jstick.lf.xbm
sed 's/^X//' > jstick.lf.xbm <<'+END+OF+jstick.lf.xbm'
X#define jstick_lf_width 64
X#define jstick_lf_height 64
Xstatic char jstick_lf_bits[] = {
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
X 0x00,0x00,0x00,0x00,0x06,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,
X 0xa0,0x00,0x00,0x80,0x3f,0x12,0x00,0x00,0x90,0x00,0x00,0x60,0xc0,0x22,0x00,
X 0x00,0x88,0x00,0x00,0x10,0x00,0x43,0x00,0x00,0x84,0x00,0x00,0x08,0x00,0x82,
X 0x00,0x00,0x82,0x00,0x00,0x04,0x00,0x04,0x01,0x00,0x81,0x00,0x00,0x02,0x00,
X 0x08,0xff,0xff,0x80,0x00,0x00,0x02,0x00,0xf8,0xff,0xff,0x80,0x00,0x00,0x01,
X 0x00,0x10,0xfe,0xff,0x80,0x00,0x00,0x01,0x00,0x10,0xf0,0xff,0x80,0x00,0x00,
X 0x01,0x00,0x10,0xc0,0xff,0x80,0x00,0x00,0x01,0x00,0x10,0x80,0xff,0x80,0x00,
X 0x00,0x01,0x00,0x10,0xc0,0xff,0x80,0x00,0x00,0x01,0x00,0x10,0xf0,0xff,0x80,
X 0x00,0x00,0x01,0x00,0x10,0xff,0xff,0x80,0x00,0x00,0x02,0x00,0xf8,0xff,0xff,
X 0x80,0x00,0x00,0x02,0x00,0x08,0xff,0xff,0x80,0x00,0x00,0x04,0x00,0x84,0x00,
X 0x00,0x81,0x00,0x00,0x08,0x00,0x42,0x00,0x00,0x82,0x00,0x00,0x10,0x00,0x21,
X 0x00,0x00,0x84,0x00,0x00,0x60,0xc0,0x11,0x00,0x00,0x88,0x00,0x00,0x80,0x3f,
X 0x09,0x00,0x00,0x90,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0xa0,0x00,0x00,0x00,
X 0x00,0x03,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00};
+END+OF+jstick.lf.xbm
echo '-rw-rw-rw-  1 argv         2719 Aug  3 10:37 jstick.lf.xbm    (as sent)'
chmod u=rw,g=rw,o=rw jstick.lf.xbm
ls -l jstick.lf.xbm
echo x - jstick.rt.xbm
sed 's/^X//' > jstick.rt.xbm <<'+END+OF+jstick.rt.xbm'
X#define jstick_rt_width 64
X#define jstick_rt_height 64
Xstatic char jstick_rt_bits[] = {
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x7f,
X 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x05,0x00,0x00,
X 0x50,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x48,0xfc,0x01,0x00,0x00,0x11,0x00,
X 0x00,0x44,0x03,0x06,0x00,0x00,0x21,0x00,0x00,0xc2,0x00,0x08,0x00,0x00,0x41,
X 0x00,0x00,0x41,0x00,0x10,0x00,0x00,0x81,0x00,0x80,0x20,0x00,0x20,0x00,0x00,
X 0x01,0xff,0xff,0x10,0x00,0x40,0x00,0x00,0x01,0xff,0xff,0x1f,0x00,0x40,0x00,
X 0x00,0x01,0xff,0x7f,0x08,0x00,0x80,0x00,0x00,0x01,0xff,0x0f,0x08,0x00,0x80,
X 0x00,0x00,0x01,0xff,0x03,0x08,0x00,0x80,0x00,0x00,0x01,0xff,0x01,0x08,0x00,
X 0x80,0x00,0x00,0x01,0xff,0x03,0x08,0x00,0x80,0x00,0x00,0x01,0xff,0x0f,0x08,
X 0x00,0x80,0x00,0x00,0x01,0xff,0xff,0x08,0x00,0x80,0x00,0x00,0x01,0xff,0xff,
X 0x1f,0x00,0x40,0x00,0x00,0x01,0xff,0xff,0x10,0x00,0x40,0x00,0x00,0x81,0x00,
X 0x00,0x21,0x00,0x20,0x00,0x00,0x41,0x00,0x00,0x42,0x00,0x10,0x00,0x00,0x21,
X 0x00,0x00,0x84,0x00,0x08,0x00,0x00,0x11,0x00,0x00,0x88,0x03,0x06,0x00,0x00,
X 0x09,0x00,0x00,0x90,0xfc,0x01,0x00,0x00,0x05,0x00,0x00,0xa0,0x00,0x00,0x00,
X 0x00,0x03,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00};
+END+OF+jstick.rt.xbm
echo '-rw-rw-rw-  1 argv         2719 Aug  3 10:37 jstick.rt.xbm    (as sent)'
chmod u=rw,g=rw,o=rw jstick.rt.xbm
ls -l jstick.rt.xbm
echo x - jstick.stop.xbm
sed 's/^X//' > jstick.stop.xbm <<'+END+OF+jstick.stop.xbm'
X#define jstick_stop_width 64
X#define jstick_stop_height 64
Xstatic char jstick_stop_bits[] = {
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
X 0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x0a,0xc0,0x1f,
X 0x40,0x01,0x00,0x00,0x00,0x12,0x30,0x60,0x20,0x01,0x00,0x00,0x00,0x22,0x08,
X 0x80,0x10,0x01,0x00,0x00,0x00,0x42,0x06,0x00,0x0b,0x01,0x00,0x00,0x00,0x82,
X 0x02,0x00,0x06,0x01,0x00,0x00,0x00,0x02,0x01,0x00,0x04,0x01,0x00,0x00,0x00,
X 0x82,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x82,0x00,0x00,0x08,0x01,0x00,0x00,
X 0x00,0x42,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x42,0x00,0x00,0x10,0x01,0x00,
X 0x00,0x00,0x42,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x42,0x00,0x00,0x10,0x01,
X 0x00,0x00,0x00,0x42,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x42,0x00,0x00,0x10,
X 0x01,0x00,0x00,0x00,0x42,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x82,0x00,0x00,
X 0x08,0x01,0x00,0x00,0x00,0x82,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x02,0x01,
X 0x00,0x04,0x01,0x00,0x00,0x00,0x82,0x02,0x00,0x06,0x01,0x00,0x00,0x00,0x42,
X 0x06,0x00,0x0b,0x01,0x00,0x00,0x00,0x22,0x08,0x80,0x10,0x01,0x00,0x00,0x00,
X 0x12,0x30,0x60,0x20,0x01,0x00,0x00,0x00,0x0a,0xc0,0x1f,0x40,0x01,0x00,0x00,
X 0x00,0x06,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0x01,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00};
+END+OF+jstick.stop.xbm
echo '-rw-rw-rw-  1 argv         2725 Aug  3 10:37 jstick.stop.xbm    (as sent)'
chmod u=rw,g=rw,o=rw jstick.stop.xbm
ls -l jstick.stop.xbm
echo x - jstick.up.xbm
sed 's/^X//' > jstick.up.xbm <<'+END+OF+jstick.up.xbm'
X#define jstick_up_width 64
X#define jstick_up_height 64
Xstatic char jstick_up_bits[] = {
X 0x00,0x00,0x00,0xc0,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x60,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x03,
X 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
X 0x04,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x80,0x00,
X 0x00,0x08,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,
X 0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,
X 0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,
X 0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,
X 0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x08,0x00,
X 0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0xfe,0x01,0x00,0xfc,
X 0x01,0x00,0x00,0x00,0x06,0x06,0x00,0x83,0x01,0x00,0x00,0x00,0x0a,0x08,0x80,
X 0x40,0x01,0x00,0x00,0x00,0x12,0x30,0x60,0x20,0x01,0x00,0x00,0x00,0x22,0xd0,
X 0x5f,0x10,0x01,0x00,0x00,0x00,0x42,0x10,0x40,0x08,0x01,0x00,0x00,0x00,0x82,
X 0x20,0x20,0x04,0x01,0x00,0x00,0x00,0x02,0x21,0x20,0x02,0x01,0x00,0x00,0x00,
X 0x02,0x7e,0xf0,0x01,0x01,0x00,0x00,0x00,0x02,0x7e,0xf0,0x01,0x01,0x00,0x00,
X 0x00,0x02,0x7e,0xf0,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xf8,0x01,0x01,0x00,
X 0x00,0x00,0x02,0xfe,0xf8,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xf8,0x01,0x01,
X 0x00,0x00,0x00,0x02,0xfe,0xf8,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xff,0x01,
X 0x01,0x00,0x00,0x00,0x02,0xfe,0xff,0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xff,
X 0x01,0x01,0x00,0x00,0x00,0x02,0xfe,0xff,0x01,0x01,0x00,0x00,0x00,0x02,0x01,
X 0x00,0x02,0x01,0x00,0x00,0x00,0x82,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x42,
X 0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x22,0x00,0x00,0x10,0x01,0x00,0x00,0x00,
X 0x12,0x00,0x00,0x20,0x01,0x00,0x00,0x00,0x0a,0x00,0x00,0x40,0x01,0x00,0x00,
X 0x00,0x06,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0x01,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00};
+END+OF+jstick.up.xbm
echo '-rw-rw-rw-  1 argv         2719 Aug  3 10:37 jstick.up.xbm    (as sent)'
chmod u=rw,g=rw,o=rw jstick.up.xbm
ls -l jstick.up.xbm
echo x - pen.xbm
sed 's/^X//' > pen.xbm <<'+END+OF+pen.xbm'
X#define pen_width 16
X#define pen_height 16
Xstatic char pen_bits[] = {
X 0x00,0x00,0x80,0x01,0xc0,0x03,0x60,0x06,0x30,0x0c,0x18,0x18,0x0c,0x30,0x06,
X 0x60,0x0c,0x30,0x18,0x18,0x30,0x0c,0x60,0x06,0xc0,0x03,0x80,0x01,0x00,0x00,
X 0x00,0x00};
+END+OF+pen.xbm
echo '-rw-rw-rw-  1 argv          237 Aug  3 11:02 pen.xbm    (as sent)'
chmod u=rw,g=rw,o=rw pen.xbm
ls -l pen.xbm
echo x - mse.lf.gr.xbm
sed 's/^X//' > mse.lf.gr.xbm <<'+END+OF+mse.lf.gr.xbm'
X#define mse_lf_gr_width 16
X#define mse_lf_gr_height 23
Xstatic char mse_lf_gr_bits[] = {
X 0xe0,0x1f,0x10,0x20,0xd0,0x20,0xd0,0x20,0xd0,0x20,0xd0,0x20,0x50,0x21,0x50,
X 0x21,0x50,0x21,0x58,0x21,0x54,0x27,0x54,0x2d,0xb4,0x2a,0x54,0x15,0xac,0x1a,
X 0x54,0x15,0xa8,0x0a,0x50,0x0d,0xf0,0x07,0x08,0x08,0x08,0x0a,0x08,0x08,0xf0,
X 0x07};
+END+OF+mse.lf.gr.xbm
echo '-rw-rw-rw-  1 argv          327 Aug  3 10:38 mse.lf.gr.xbm    (as sent)'
chmod u=rw,g=rw,o=rw mse.lf.gr.xbm
ls -l mse.lf.gr.xbm
echo x - mse.lf.xbm
sed 's/^X//' > mse.lf.xbm <<'+END+OF+mse.lf.xbm'
X#define mse_lf_width 16
X#define mse_lf_height 23
Xstatic char mse_lf_bits[] = {
X 0xe0,0x1f,0x10,0x20,0xd0,0x20,0xd0,0x20,0xd0,0x20,0xd0,0x20,0x50,0x21,0x50,
X 0x21,0x50,0x21,0x58,0x21,0x54,0x23,0x54,0x24,0x54,0x28,0x24,0x10,0x04,0x10,
X 0x04,0x10,0x08,0x08,0x10,0x08,0xf0,0x07,0x08,0x08,0x08,0x0a,0x08,0x08,0xf0,
X 0x07};
+END+OF+mse.lf.xbm
echo '-rw-rw-rw-  1 argv          318 Aug  3 10:38 mse.lf.xbm    (as sent)'
chmod u=rw,g=rw,o=rw mse.lf.xbm
ls -l mse.lf.xbm
echo x - mse.mid.gr.xbm
sed 's/^X//' > mse.mid.gr.xbm <<'+END+OF+mse.mid.gr.xbm'
X#define mse_mid_gr_width 16
X#define mse_mid_gr_height 23
Xstatic char mse_mid_gr_bits[] = {
X 0xe0,0x1f,0x10,0x20,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x90,0x22,0x90,
X 0x22,0x90,0x22,0x98,0x22,0x94,0x26,0x94,0x2d,0xd4,0x3a,0x74,0x15,0xac,0x1a,
X 0x54,0x15,0xa8,0x0a,0x50,0x0d,0xf0,0x07,0x08,0x08,0x08,0x0a,0x08,0x08,0xf0,
X 0x07};
+END+OF+mse.mid.gr.xbm
echo '-rw-rw-rw-  1 argv          330 Aug  3 10:38 mse.mid.gr.xbm    (as sent)'
chmod u=rw,g=rw,o=rw mse.mid.gr.xbm
ls -l mse.mid.gr.xbm
echo x - mse.mid.xbm
sed 's/^X//' > mse.mid.xbm <<'+END+OF+mse.mid.xbm'
X#define mse_mid_width 16
X#define mse_mid_height 23
Xstatic char mse_mid_bits[] = {
X 0xe0,0x1f,0x10,0x20,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x90,0x22,0x90,
X 0x22,0x90,0x22,0x98,0x22,0x94,0x26,0x94,0x28,0x54,0x30,0x24,0x10,0x04,0x10,
X 0x04,0x10,0x08,0x08,0x10,0x08,0xf0,0x07,0x08,0x08,0x08,0x0a,0x08,0x08,0xf0,
X 0x07};
+END+OF+mse.mid.xbm
echo '-rw-rw-rw-  1 argv          321 Aug  3 10:39 mse.mid.xbm    (as sent)'
chmod u=rw,g=rw,o=rw mse.mid.xbm
ls -l mse.mid.xbm
echo x - mse.rt.icon.xbm
sed 's/^X//' > mse.rt.icon.xbm <<'+END+OF+mse.rt.icon.xbm'
X#define mse_rt_icon_width 64
X#define mse_rt_icon_height 64
Xstatic char mse_rt_icon_bits[] = {
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,
X 0x01,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x10,0x00,0x00,0x00,
X 0x00,0x08,0x00,0x00,0x90,0xff,0xf9,0x9f,0xff,0x09,0x00,0x00,0x88,0x00,0x09,
X 0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,
X 0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,
X 0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,
X 0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,
X 0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,
X 0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,
X 0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,
X 0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,
X 0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,
X 0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,
X 0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,
X 0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,
X 0x00,0x88,0x00,0x09,0x90,0xff,0x11,0x00,0x00,0x88,0xff,0xf9,0x9f,0xff,0x11,
X 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,
X 0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,
X 0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,
X 0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,
X 0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,
X 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,
X 0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,
X 0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,
X 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x00,
X 0x10,0x00,0x00,0x08,0x00,0x00,0xfe,0xff,0x13,0x00,0x00,0x08,0x00,0x00,0x02,
X 0x00,0x12,0x00,0x00,0x08,0x00,0x00,0x12,0x03,0x12,0x00,0x00,0x08,0x00,0x00,
X 0xaa,0x00,0x12,0x00,0x00,0x08,0x00,0x00,0x46,0x53,0x12,0x00,0x00,0x08,0x00,
X 0x00,0x2a,0xd4,0x12,0x00,0x00,0x08,0x00,0x00,0x92,0xd3,0x12,0x00,0x00,0x08,
X 0x00,0x00,0x02,0x00,0x12,0x00,0x00,0x08,0x00,0x00,0xfe,0xff,0x13,0x00,0x00,
X 0x10,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x08,0x00,
X 0x00,0x60,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x80,0xff,0xff,0xff,0xff,0x01,
X 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X 0x00,0x00};
+END+OF+mse.rt.icon.xbm
echo '-rw-rw-rw-  1 argv         2725 Aug  3 10:39 mse.rt.icon.xbm    (as sent)'
chmod u=rw,g=rw,o=rw mse.rt.icon.xbm
ls -l mse.rt.icon.xbm
echo x - spark1.pr.xbm
sed 's/^X//' > spark1.pr.xbm <<'+END+OF+spark1.pr.xbm'
X#define spark1_pr_width 16
X#define spark1_pr_height 16
Xstatic char spark1_pr_bits[] = {
X 0x40,0x00,0x00,0x10,0x00,0x01,0x10,0x02,0x40,0x14,0x02,0x01,0x50,0x4a,0x20,
X 0x01,0x84,0x0a,0x20,0x21,0x00,0x08,0x48,0x01,0x00,0x50,0x00,0x04,0x88,0x00,
X 0x00,0x00};
+END+OF+spark1.pr.xbm
echo '-rw-rw-rw-  1 argv          255 Aug  3 10:39 spark1.pr.xbm    (as sent)'
chmod u=rw,g=rw,o=rw spark1.pr.xbm
ls -l spark1.pr.xbm
echo x - spark2.pr.xbm
sed 's/^X//' > spark2.pr.xbm <<'+END+OF+spark2.pr.xbm'
X#define spark2_pr_width 16
X#define spark2_pr_height 16
Xstatic char spark2_pr_bits[] = {
X 0x40,0x08,0x80,0x00,0x09,0x40,0x00,0x02,0x80,0x04,0x52,0x0a,0x80,0x40,0x28,
X 0x02,0x80,0x12,0x10,0x80,0x84,0x04,0x50,0x21,0x08,0x00,0x00,0x11,0x20,0x00,
X 0x0a,0x00};
+END+OF+spark2.pr.xbm
echo '-rw-rw-rw-  1 argv          255 Aug  3 10:39 spark2.pr.xbm    (as sent)'
chmod u=rw,g=rw,o=rw spark2.pr.xbm
ls -l spark2.pr.xbm
echo x - spark3.pr.xbm
sed 's/^X//' > spark3.pr.xbm <<'+END+OF+spark3.pr.xbm'
X#define spark3_pr_width 16
X#define spark3_pr_height 16
Xstatic char spark3_pr_bits[] = {
X 0x82,0x00,0x00,0x10,0x00,0x81,0x11,0x00,0x00,0x10,0x02,0x01,0x20,0x48,0x00,
X 0x00,0x04,0x01,0x20,0x20,0x00,0x08,0x08,0x01,0x01,0x40,0x00,0x04,0x88,0x20,
X 0x00,0x00};
+END+OF+spark3.pr.xbm
echo '-rw-rw-rw-  1 argv          255 Aug  3 10:39 spark3.pr.xbm    (as sent)'
chmod u=rw,g=rw,o=rw spark3.pr.xbm
ls -l spark3.pr.xbm
echo x - spark4.pr.xbm
sed 's/^X//' > spark4.pr.xbm <<'+END+OF+spark4.pr.xbm'
X#define spark4_pr_width 16
X#define spark4_pr_height 16
Xstatic char spark4_pr_bits[] = {
X 0x00,0x00,0x00,0x00,0x80,0x04,0x10,0x10,0x00,0x02,0x90,0x08,0x40,0x22,0x24,
X 0x01,0x80,0x12,0x08,0x04,0x20,0x21,0x00,0x08,0x90,0x00,0x00,0x02,0x00,0x00,
X 0x00,0x00};
+END+OF+spark4.pr.xbm
echo '-rw-rw-rw-  1 argv          255 Aug  3 10:40 spark4.pr.xbm    (as sent)'
chmod u=rw,g=rw,o=rw spark4.pr.xbm
ls -l spark4.pr.xbm
exit 0
-- 
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330



More information about the Comp.sources.x mailing list