games@tekred.TEK.COM (01/29/88)
Submitted by: Dan Heller <island!argv@sun.com> Comp.sources.games: Volume 3, Issue 81 Archive-name: qix/Part02 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 2 (of 2)." # Contents: Makefile joystick.dn joystick.lf joystick.rt joystick.stop # joystick.up marker.cursor mouse.rt.icon polyfill.c polyfill_rec.c # polygon_area.c qix.h qix.icon qmove.c spark1.pr spark2.pr # spark3.pr spark4.pr # Wrapped by billr@saab on Tue Jan 26 18:06:31 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(963 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' 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 XCFLAGS= -O XLDFLAGS= XLIBES= -lsuntool -lsunwindow -lpixrect X Xqix.x: ${OBJS} X @echo loading... X @cc ${LDFLAGS} ${OBJS} ${LIBES} -o qix 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). Xqrec: ${REC_OBJS} X @echo loading... X @cc ${LDFLAGS} ${REC_OBJS} ${LIBES} -o qrec X Xtarmail : ; tar fcv - Makefile qix.h ${CFILES} ${ICONS} | compress | \ X btoa > qix.tarmail X Xshar: ; shar Makefile qix.h ${CFILES} ${ICONS} > qix.shar END_OF_Makefile if test 963 -ne `wc -c <Makefile`; then echo shar: \"Makefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f joystick.dn -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"joystick.dn\" else echo shar: Extracting \"joystick.dn\" \(1933 characters\) 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 if test 1933 -ne `wc -c <joystick.dn`; then echo shar: \"joystick.dn\" unpacked with wrong size! fi # end of overwriting check fi if test -f joystick.lf -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"joystick.lf\" else echo shar: Extracting \"joystick.lf\" \(1933 characters\) 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 if test 1933 -ne `wc -c <joystick.lf`; then echo shar: \"joystick.lf\" unpacked with wrong size! fi # end of overwriting check fi if test -f joystick.rt -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"joystick.rt\" else echo shar: Extracting \"joystick.rt\" \(1933 characters\) 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 if test 1933 -ne `wc -c <joystick.rt`; then echo shar: \"joystick.rt\" unpacked with wrong size! fi # end of overwriting check fi if test -f joystick.stop -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"joystick.stop\" else echo shar: Extracting \"joystick.stop\" \(1933 characters\) 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 if test 1933 -ne `wc -c <joystick.stop`; then echo shar: \"joystick.stop\" unpacked with wrong size! fi # end of overwriting check fi if test -f joystick.up -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"joystick.up\" else echo shar: Extracting \"joystick.up\" \(1933 characters\) 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 if test 1933 -ne `wc -c <joystick.up`; then echo shar: \"joystick.up\" unpacked with wrong size! fi # end of overwriting check fi if test -f marker.cursor -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"marker.cursor\" else echo shar: Extracting \"marker.cursor\" \(193 characters\) 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 if test 193 -ne `wc -c <marker.cursor`; then echo shar: \"marker.cursor\" unpacked with wrong size! fi # end of overwriting check fi if test -f mouse.rt.icon -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"mouse.rt.icon\" else echo shar: Extracting \"mouse.rt.icon\" \(1933 characters\) 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 if test 1933 -ne `wc -c <mouse.rt.icon`; then echo shar: \"mouse.rt.icon\" unpacked with wrong size! fi # end of overwriting check fi if test -f polyfill.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"polyfill.c\" else echo shar: Extracting \"polyfill.c\" \(4702 characters\) 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 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 = -1; /* 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 /* Move to the left */ X x--; X X /* Push to the left first. Stop when we hit the edge */ X for (;;x--) { X /* See if we need to save points above and below */ X#if 0 X if (lntest(x, y-1, RIGHT) && lntest(x+1, y, UP)) X push(x, y - 1); X if (lntest(x, y+1, RIGHT) && lntest(x+1, y, DOWN)) X push(x, y + 1); X#endif 0 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 x++; /* Move over */ X X for (;;x++) { /* Go until we hit the right edge */ X /* Check points above and below to see if we can seep thru */ X#if 0 X if (lntest(x, y-1, LEFT) && lntest(x-1, y, UP)) X push(x, y - 1); X if (lntest(x, y+1, LEFT) && lntest(x-1, y, DOWN)) X push(x, y + 1); X#endif 0 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 if test 4702 -ne `wc -c <polyfill.c`; then echo shar: \"polyfill.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f polyfill_rec.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"polyfill_rec.c\" else echo shar: Extracting \"polyfill_rec.c\" \(3979 characters\) 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 if test 3979 -ne `wc -c <polyfill_rec.c`; then echo shar: \"polyfill_rec.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f polygon_area.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"polygon_area.c\" else echo shar: Extracting \"polygon_area.c\" \(3815 characters\) 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 if test 3815 -ne `wc -c <polygon_area.c`; then echo shar: \"polygon_area.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f qix.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"qix.h\" else echo shar: Extracting \"qix.h\" \(5699 characters\) 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 * The machine will not respond sometimes. I don't know why. X * I need suggestions on fixing this interface and making it X * more usable. X * X * compile -lsuntool -lsunwindow -lpixrect X */ X#include <stdio.h> X#include <suntool/sunview.h> X#include <suntool/canvas.h> X#include <sys/time.h> X#include <ctype.h> X X#define when break;case X#define otherwise break;default X#define rrand random X#define SCOREFILE "qix.scores" X XFrame frame; XCanvas Draw, Joystick; XPixwin *draw_win, *joystick_win; XPixfont *big_font, *small_font; 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 X#define start_timer() \ X timeout.it_value.tv_usec = 50000, setitimer(ITIMER_REAL, &timeout, NULL); X#define stop_timer() \ X timerclear(&timeout.it_value), setitimer(ITIMER_REAL, &timeout, NULL); 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 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 3 /* 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 Xextern Pixrect pen_image; X X/* place_pen() macro XOR's the pen at its current coordinates */ X#define place_pen() pw_rop(draw_win, \ X pen_coord_x(pen_x), pen_coord_y(pen_y), \ X 16, 16, XOR, &pen_image, 0, 0) X X#define XOR (PIX_SRC^PIX_DST) X#define draw(x1,y1,x2,y2,OP) pw_vector(draw_win, x1,y1,x2,y2,(OP),1) 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 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 NOT_NOW X X#define l_width(font) (font)->pf_defaultsize.x X#define l_height(font) (font)->pf_defaultsize.y 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 if test 5699 -ne `wc -c <qix.h`; then echo shar: \"qix.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f qix.icon -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"qix.icon\" else echo shar: Extracting \"qix.icon\" \(1933 characters\) 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 if test 1933 -ne `wc -c <qix.icon`; then echo shar: \"qix.icon\" unpacked with wrong size! fi # end of overwriting check fi if test -f qmove.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"qmove.c\" else echo shar: Extracting \"qmove.c\" \(6694 characters\) 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 < 0 && 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 draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]), X convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), PIX_CLR); 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]), PIX_CLR); 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]), PIX_SRC); 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]), PIX_SRC); 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 *dx0 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1); X *dy0 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1); X *dx1 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1); X *dy1 = (1 + (r = rrand())%(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 if test 6694 -ne `wc -c <qmove.c`; then echo shar: \"qmove.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f spark1.pr -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"spark1.pr\" else echo shar: Extracting \"spark1.pr\" \(193 characters\) 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 if test 193 -ne `wc -c <spark1.pr`; then echo shar: \"spark1.pr\" unpacked with wrong size! fi # end of overwriting check fi if test -f spark2.pr -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"spark2.pr\" else echo shar: Extracting \"spark2.pr\" \(193 characters\) 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 if test 193 -ne `wc -c <spark2.pr`; then echo shar: \"spark2.pr\" unpacked with wrong size! fi # end of overwriting check fi if test -f spark3.pr -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"spark3.pr\" else echo shar: Extracting \"spark3.pr\" \(193 characters\) 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 if test 193 -ne `wc -c <spark3.pr`; then echo shar: \"spark3.pr\" unpacked with wrong size! fi # end of overwriting check fi if test -f spark4.pr -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"spark4.pr\" else echo shar: Extracting \"spark4.pr\" \(193 characters\) 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 if test 193 -ne `wc -c <spark4.pr`; then echo shar: \"spark4.pr\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 2 \(of 2\). cp /dev/null ark2isdone MISSING="" for I in 1 2 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked both archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0