v04i062: xfish -- see fish swim, Part01/01
Dan Heller
argv at island.uu.net
Thu Jul 20 09:12:52 AEST 1989
Submitted-by: Lars Huttar <huttar at svax.cs.cornell.edu>
Posting-number: Volume 4, Issue 62
Archive-name: xfish/part01
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix at uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
# "End of shell archive."
# Contents: Makefile blimp.li blimp.lm blimp.ri blimp.rm eye.li eye.lm
# eye.ri eye.rm face.li face.lm face.ri face.rm fork.li fork.lm
# fork.ri fork.rm new.li new.lm new.ri new.rm orig.li orig.lm
# orig.ri orig.rm xfish.c xfish.man
# Wrapped by argv at island on Wed Jul 19 16:09:15 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(256 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# makefile for xfish.c. Pretty self-explanatory; just "make xfish".
X
XINCLUDES =
X
XCC=cc
X
XXLIB = -lX11
XCFLAGS = $(INCLUDES) -O
XCLIBS =
X
X.SUFFIXES: .o .h .c .a
X
XOBJS = xfish.o
X
Xall: xfish
X
Xxfish: $(OBJS)
X $(CC) $(CFLAGS) -o xfish $(OBJS) $(XLIB) $(CLIBS)
X
END_OF_FILE
if test 256 -ne `wc -c <'Makefile'`; then
echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'blimp.li' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'blimp.li'\"
else
echo shar: Extracting \"'blimp.li'\" \(479 characters\)
sed "s/^X//" >'blimp.li' <<'END_OF_FILE'
X#define blimp_width 32
X#define blimp_height 16
Xstatic char blimp_bits[] = {
X 0x00, 0xfc, 0x0f, 0x00, 0x80, 0x03, 0x70, 0x00, 0x60, 0x00, 0x80, 0x41,
X 0x18, 0x00, 0x00, 0x62, 0x04, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x48,
X 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x4c,
X 0x04, 0x00, 0x80, 0x54, 0xb8, 0x42, 0x10, 0x63, 0x60, 0x14, 0xa5, 0x41,
X 0x80, 0xab, 0x7a, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00,
X 0x00, 0xf8, 0x07, 0x00};
END_OF_FILE
if test 479 -ne `wc -c <'blimp.li'`; then
echo shar: \"'blimp.li'\" unpacked with wrong size!
fi
# end of 'blimp.li'
fi
if test -f 'blimp.lm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'blimp.lm'\"
else
echo shar: Extracting \"'blimp.lm'\" \(525 characters\)
sed "s/^X//" >'blimp.lm' <<'END_OF_FILE'
X#define blimp_width 32
X#define blimp_height 16
X#define blimp_x_hot -1
X#define blimp_y_hot -1
Xstatic char blimp_bits[] = {
X 0x00, 0xfc, 0x0f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xe0, 0xff, 0xff, 0x41,
X 0xf8, 0xff, 0xff, 0x63, 0xfc, 0xff, 0xff, 0x77, 0xfe, 0xff, 0xff, 0x7f,
X 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x7f,
X 0xfc, 0xff, 0xff, 0x77, 0xf8, 0xff, 0xff, 0x63, 0xe0, 0xff, 0xff, 0x41,
X 0x80, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00,
X 0x00, 0xf8, 0x07, 0x00};
END_OF_FILE
if test 525 -ne `wc -c <'blimp.lm'`; then
echo shar: \"'blimp.lm'\" unpacked with wrong size!
fi
# end of 'blimp.lm'
fi
if test -f 'blimp.ri' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'blimp.ri'\"
else
echo shar: Extracting \"'blimp.ri'\" \(479 characters\)
sed "s/^X//" >'blimp.ri' <<'END_OF_FILE'
X#define blimp_width 32
X#define blimp_height 16
Xstatic char blimp_bits[] = {
X 0x00, 0xfc, 0x0f, 0x00, 0x80, 0x03, 0x70, 0x00, 0x60, 0x00, 0x80, 0x41,
X 0x18, 0x00, 0x00, 0x62, 0x04, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x48,
X 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x4c,
X 0x04, 0x00, 0x80, 0x54, 0xb8, 0x42, 0x10, 0x63, 0x60, 0x14, 0xa5, 0x41,
X 0x80, 0xab, 0x7a, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00,
X 0x00, 0xf8, 0x07, 0x00};
END_OF_FILE
if test 479 -ne `wc -c <'blimp.ri'`; then
echo shar: \"'blimp.ri'\" unpacked with wrong size!
fi
# end of 'blimp.ri'
fi
if test -f 'blimp.rm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'blimp.rm'\"
else
echo shar: Extracting \"'blimp.rm'\" \(525 characters\)
sed "s/^X//" >'blimp.rm' <<'END_OF_FILE'
X#define blimp_width 32
X#define blimp_height 16
X#define blimp_x_hot -1
X#define blimp_y_hot -1
Xstatic char blimp_bits[] = {
X 0x00, 0xfc, 0x0f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xe0, 0xff, 0xff, 0x41,
X 0xf8, 0xff, 0xff, 0x63, 0xfc, 0xff, 0xff, 0x77, 0xfe, 0xff, 0xff, 0x7f,
X 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x7f,
X 0xfc, 0xff, 0xff, 0x77, 0xf8, 0xff, 0xff, 0x63, 0xe0, 0xff, 0xff, 0x41,
X 0x80, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00,
X 0x00, 0xf8, 0x07, 0x00};
END_OF_FILE
if test 525 -ne `wc -c <'blimp.rm'`; then
echo shar: \"'blimp.rm'\" unpacked with wrong size!
fi
# end of 'blimp.rm'
fi
if test -f 'eye.li' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'eye.li'\"
else
echo shar: Extracting \"'eye.li'\" \(272 characters\)
sed "s/^X//" >'eye.li' <<'END_OF_FILE'
X#define eye_width 16
X#define eye_height 16
Xstatic char eye_bits[] = {
X 0xc0, 0x07, 0x30, 0x18, 0x88, 0x20, 0x84, 0x40, 0x6e, 0x43, 0x1e, 0x84,
X 0x0b, 0x80, 0x0b, 0x80, 0x0b, 0x80, 0x0e, 0x80, 0x16, 0x40, 0x24, 0x40,
X 0x08, 0x20, 0x30, 0x18, 0xc0, 0x07, 0x00, 0x00};
END_OF_FILE
if test 272 -ne `wc -c <'eye.li'`; then
echo shar: \"'eye.li'\" unpacked with wrong size!
fi
# end of 'eye.li'
fi
if test -f 'eye.lm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'eye.lm'\"
else
echo shar: Extracting \"'eye.lm'\" \(314 characters\)
sed "s/^X//" >'eye.lm' <<'END_OF_FILE'
X#define eye_width 16
X#define eye_height 16
X#define eye_x_hot -1
X#define eye_y_hot -1
Xstatic char eye_bits[] = {
X 0xc0, 0x07, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0xff,
X 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfc, 0x7f,
X 0xf8, 0x3f, 0xf0, 0x1f, 0xc0, 0x07, 0x00, 0x00};
END_OF_FILE
if test 314 -ne `wc -c <'eye.lm'`; then
echo shar: \"'eye.lm'\" unpacked with wrong size!
fi
# end of 'eye.lm'
fi
if test -f 'eye.ri' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'eye.ri'\"
else
echo shar: Extracting \"'eye.ri'\" \(272 characters\)
sed "s/^X//" >'eye.ri' <<'END_OF_FILE'
X#define eye_width 16
X#define eye_height 16
Xstatic char eye_bits[] = {
X 0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0x02, 0x24, 0x42, 0x24, 0x01, 0x41,
X 0x01, 0x44, 0x01, 0x44, 0x01, 0x68, 0x01, 0x58, 0x82, 0x34, 0x42, 0x3b,
X 0x04, 0x3e, 0x18, 0x1d, 0xe0, 0x03, 0x00, 0x00};
END_OF_FILE
if test 272 -ne `wc -c <'eye.ri'`; then
echo shar: \"'eye.ri'\" unpacked with wrong size!
fi
# end of 'eye.ri'
fi
if test -f 'eye.rm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'eye.rm'\"
else
echo shar: Extracting \"'eye.rm'\" \(314 characters\)
sed "s/^X//" >'eye.rm' <<'END_OF_FILE'
X#define eye_width 16
X#define eye_height 16
X#define eye_x_hot -1
X#define eye_y_hot -1
Xstatic char eye_bits[] = {
X 0xe0, 0x03, 0xf8, 0x0f, 0xfc, 0x1f, 0xfe, 0x3f, 0xfe, 0x3f, 0xff, 0x7f,
X 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x3f, 0xfe, 0x3f,
X 0xfc, 0x3f, 0xf8, 0x1f, 0xe0, 0x03, 0x00, 0x00};
END_OF_FILE
if test 314 -ne `wc -c <'eye.rm'`; then
echo shar: \"'eye.rm'\" unpacked with wrong size!
fi
# end of 'eye.rm'
fi
if test -f 'face.li' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'face.li'\"
else
echo shar: Extracting \"'face.li'\" \(875 characters\)
sed "s/^X//" >'face.li' <<'END_OF_FILE'
X#define face_width 32
X#define face_height 32
Xstatic char face_bits[] = {
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x1c, 0x70, 0x00, 0x00, 0x03, 0x80, 0x01,
X 0x80, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x08,
X 0x10, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x70, 0x20,
X 0x04, 0x00, 0x88, 0x40, 0x04, 0x18, 0x88, 0x40, 0x04, 0x18, 0x88, 0x40,
X 0x02, 0x00, 0x70, 0x80, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80,
X 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x82,
X 0x82, 0x00, 0x00, 0x82, 0x84, 0x00, 0x00, 0x5c, 0x54, 0x00, 0x00, 0x44,
X 0xa4, 0x01, 0x00, 0x42, 0x08, 0x07, 0x00, 0x23, 0x08, 0x9f, 0xef, 0x21,
X 0x10, 0xfe, 0xbf, 0x10, 0x20, 0xf0, 0x80, 0x08, 0x40, 0xf0, 0x7f, 0x04,
X 0x80, 0x00, 0x2f, 0x02, 0x00, 0x03, 0x80, 0x01, 0x00, 0x1c, 0x70, 0x00,
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 875 -ne `wc -c <'face.li'`; then
echo shar: \"'face.li'\" unpacked with wrong size!
fi
# end of 'face.li'
fi
if test -f 'face.lm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'face.lm'\"
else
echo shar: Extracting \"'face.lm'\" \(919 characters\)
sed "s/^X//" >'face.lm' <<'END_OF_FILE'
X#define face_width 32
X#define face_height 32
X#define face_x_hot -1
X#define face_y_hot -1
Xstatic char face_bits[] = {
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x01,
X 0x80, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x0f,
X 0xf0, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0x3f,
X 0xfc, 0xff, 0x8f, 0x7f, 0xfc, 0xff, 0x8f, 0x7f, 0xfc, 0xff, 0x8f, 0x7f,
X 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff,
X 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff,
X 0xfe, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0x7f,
X 0xfc, 0xff, 0xff, 0x7f, 0xf8, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0x3f,
X 0xf0, 0xff, 0xff, 0x1f, 0xe0, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0x07,
X 0x80, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x01, 0x00, 0xfc, 0x7f, 0x00,
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 919 -ne `wc -c <'face.lm'`; then
echo shar: \"'face.lm'\" unpacked with wrong size!
fi
# end of 'face.lm'
fi
if test -f 'face.ri' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'face.ri'\"
else
echo shar: Extracting \"'face.ri'\" \(919 characters\)
sed "s/^X//" >'face.ri' <<'END_OF_FILE'
X#define face_width 32
X#define face_height 32
X#define face_x_hot -1
X#define face_y_hot -1
Xstatic char face_bits[] = {
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x1c, 0x70, 0x00, 0x00, 0x03, 0x80, 0x01,
X 0x80, 0x40, 0x04, 0x02, 0x40, 0x06, 0xc0, 0x04, 0xa0, 0x01, 0x00, 0x0b,
X 0x10, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20,
X 0x04, 0x00, 0x00, 0x40, 0x04, 0xe0, 0x0f, 0x40, 0x04, 0x18, 0x30, 0x40,
X 0x02, 0x04, 0x40, 0x80, 0x02, 0x02, 0x80, 0x80, 0x02, 0x01, 0x00, 0x81,
X 0x02, 0x01, 0x00, 0x81, 0x82, 0x00, 0x00, 0x82, 0x82, 0x00, 0x00, 0x82,
X 0x82, 0x00, 0x00, 0x82, 0x84, 0x00, 0x00, 0x42, 0x84, 0x00, 0x00, 0x42,
X 0x84, 0x00, 0x00, 0x42, 0x88, 0x00, 0x00, 0x22, 0x88, 0x00, 0x00, 0x22,
X 0x10, 0x01, 0x00, 0x11, 0x20, 0x01, 0x00, 0x09, 0x40, 0x02, 0x80, 0x04,
X 0x80, 0x1c, 0x70, 0x02, 0x00, 0xe3, 0x8f, 0x01, 0x00, 0x1c, 0x70, 0x00,
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 919 -ne `wc -c <'face.ri'`; then
echo shar: \"'face.ri'\" unpacked with wrong size!
fi
# end of 'face.ri'
fi
if test -f 'face.rm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'face.rm'\"
else
echo shar: Extracting \"'face.rm'\" \(919 characters\)
sed "s/^X//" >'face.rm' <<'END_OF_FILE'
X#define face_width 32
X#define face_height 32
X#define face_x_hot -1
X#define face_y_hot -1
Xstatic char face_bits[] = {
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x01,
X 0x80, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x0f,
X 0xf0, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0x3f,
X 0xfc, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0x7f, 0xfc, 0x1f, 0xf0, 0x7f,
X 0xfe, 0x07, 0xc0, 0xff, 0xfe, 0x03, 0x80, 0xff, 0xfe, 0x01, 0x00, 0xff,
X 0xfe, 0x01, 0x00, 0xff, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe,
X 0xfe, 0x00, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x7e, 0xfc, 0x00, 0x00, 0x7e,
X 0xfc, 0x00, 0x00, 0x7e, 0xf8, 0x00, 0x00, 0x3e, 0xf8, 0x00, 0x00, 0x3e,
X 0xf0, 0x01, 0x00, 0x1f, 0xe0, 0x01, 0x00, 0x0f, 0xc0, 0x03, 0x80, 0x07,
X 0x80, 0x1f, 0xf0, 0x03, 0x00, 0xff, 0xff, 0x01, 0x00, 0xfc, 0x7f, 0x00,
X 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 919 -ne `wc -c <'face.rm'`; then
echo shar: \"'face.rm'\" unpacked with wrong size!
fi
# end of 'face.rm'
fi
if test -f 'fork.li' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fork.li'\"
else
echo shar: Extracting \"'fork.li'\" \(476 characters\)
sed "s/^X//" >'fork.li' <<'END_OF_FILE'
X#define fork_width 16
X#define fork_height 32
Xstatic char fork_bits[] = {
X 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
X 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x01,
X 0xe0, 0x01, 0xe0, 0x01, 0xf0, 0x01, 0xf0, 0x00, 0xf8, 0x00, 0xfc, 0x00,
X 0xfc, 0x00, 0xfc, 0x00, 0xf4, 0x01, 0xd4, 0x01, 0x54, 0x01, 0x54, 0x01,
X 0x54, 0x01, 0x52, 0x01, 0x4a, 0x01, 0x29, 0x01, 0xa4, 0x00, 0x90, 0x00,
X 0x40, 0x00, 0x00, 0x00};
END_OF_FILE
if test 476 -ne `wc -c <'fork.li'`; then
echo shar: \"'fork.li'\" unpacked with wrong size!
fi
# end of 'fork.li'
fi
if test -f 'fork.lm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fork.lm'\"
else
echo shar: Extracting \"'fork.lm'\" \(476 characters\)
sed "s/^X//" >'fork.lm' <<'END_OF_FILE'
X#define fork_width 16
X#define fork_height 32
Xstatic char fork_bits[] = {
X 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
X 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x01,
X 0xe0, 0x01, 0xe0, 0x01, 0xf0, 0x01, 0xf0, 0x00, 0xf8, 0x00, 0xfc, 0x00,
X 0xfc, 0x00, 0xfc, 0x00, 0xf4, 0x01, 0xd4, 0x01, 0x54, 0x01, 0x54, 0x01,
X 0x54, 0x01, 0x52, 0x01, 0x4a, 0x01, 0x29, 0x01, 0xa4, 0x00, 0x90, 0x00,
X 0x40, 0x00, 0x00, 0x00};
END_OF_FILE
if test 476 -ne `wc -c <'fork.lm'`; then
echo shar: \"'fork.lm'\" unpacked with wrong size!
fi
# end of 'fork.lm'
fi
if test -f 'fork.ri' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fork.ri'\"
else
echo shar: Extracting \"'fork.ri'\" \(520 characters\)
sed "s/^X//" >'fork.ri' <<'END_OF_FILE'
X#define fork_width 16
X#define fork_height 32
X#define fork_x_hot -1
X#define fork_y_hot -1
Xstatic char fork_bits[] = {
X 0x80, 0x04, 0x80, 0x04, 0x80, 0x04, 0x80, 0x04, 0x80, 0x04, 0x80, 0x04,
X 0x80, 0x04, 0x80, 0x04, 0x80, 0x04, 0x80, 0x04, 0x80, 0x04, 0x40, 0x04,
X 0x20, 0x04, 0x20, 0x04, 0x10, 0x04, 0x10, 0x02, 0x08, 0x02, 0x04, 0x02,
X 0x04, 0x02, 0x04, 0x02, 0x14, 0x04, 0x54, 0x04, 0x54, 0x05, 0x54, 0x05,
X 0x54, 0x05, 0x5a, 0x05, 0x6a, 0x05, 0xad, 0x05, 0xb6, 0x02, 0xdc, 0x02,
X 0x70, 0x01, 0xc0, 0x00};
END_OF_FILE
if test 520 -ne `wc -c <'fork.ri'`; then
echo shar: \"'fork.ri'\" unpacked with wrong size!
fi
# end of 'fork.ri'
fi
if test -f 'fork.rm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fork.rm'\"
else
echo shar: Extracting \"'fork.rm'\" \(520 characters\)
sed "s/^X//" >'fork.rm' <<'END_OF_FILE'
X#define fork_width 16
X#define fork_height 32
X#define fork_x_hot -1
X#define fork_y_hot -1
Xstatic char fork_bits[] = {
X 0x80, 0x07, 0x80, 0x07, 0x80, 0x07, 0x80, 0x07, 0x80, 0x07, 0x80, 0x07,
X 0x80, 0x07, 0x80, 0x07, 0x80, 0x07, 0x80, 0x07, 0x80, 0x07, 0xc0, 0x07,
X 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x07, 0xf0, 0x03, 0xf8, 0x03, 0xfc, 0x03,
X 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07,
X 0xfc, 0x07, 0xfe, 0x07, 0xfe, 0x07, 0xff, 0x07, 0xfe, 0x03, 0xfc, 0x03,
X 0xf0, 0x01, 0xc0, 0x00};
END_OF_FILE
if test 520 -ne `wc -c <'fork.rm'`; then
echo shar: \"'fork.rm'\" unpacked with wrong size!
fi
# end of 'fork.rm'
fi
if test -f 'new.li' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'new.li'\"
else
echo shar: Extracting \"'new.li'\" \(272 characters\)
sed "s/^X//" >'new.li' <<'END_OF_FILE'
X#define new_width 16
X#define new_height 16
Xstatic char new_bits[] = {
X 0xfc, 0x01, 0x03, 0x06, 0xc6, 0x88, 0x1a, 0x91, 0x68, 0xd0, 0xa0, 0xa0,
X 0x00, 0x81, 0x00, 0x81, 0xa0, 0xb0, 0x68, 0xd0, 0x1a, 0xc8, 0x06, 0x88,
X 0x1f, 0x84, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 272 -ne `wc -c <'new.li'`; then
echo shar: \"'new.li'\" unpacked with wrong size!
fi
# end of 'new.li'
fi
if test -f 'new.lm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'new.lm'\"
else
echo shar: Extracting \"'new.lm'\" \(314 characters\)
sed "s/^X//" >'new.lm' <<'END_OF_FILE'
X#define new_width 16
X#define new_height 16
X#define new_x_hot -1
X#define new_y_hot -1
Xstatic char new_bits[] = {
X 0xfc, 0x01, 0xff, 0x07, 0xfe, 0x8f, 0xfa, 0x9f, 0xe8, 0xdf, 0xa0, 0xff,
X 0x00, 0xff, 0x00, 0xff, 0xa0, 0xff, 0xe8, 0xdf, 0xfa, 0xcf, 0xfe, 0x8f,
X 0xff, 0x87, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 314 -ne `wc -c <'new.lm'`; then
echo shar: \"'new.lm'\" unpacked with wrong size!
fi
# end of 'new.lm'
fi
if test -f 'new.ri' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'new.ri'\"
else
echo shar: Extracting \"'new.ri'\" \(272 characters\)
sed "s/^X//" >'new.ri' <<'END_OF_FILE'
X#define new_width 16
X#define new_height 16
Xstatic char new_bits[] = {
X 0x80, 0x3f, 0x60, 0xc0, 0x11, 0x63, 0x89, 0x58, 0x0b, 0x16, 0x05, 0x05,
X 0x81, 0x00, 0x81, 0x00, 0x0d, 0x05, 0x0b, 0x16, 0x13, 0x58, 0x11, 0x60,
X 0x21, 0xf8, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 272 -ne `wc -c <'new.ri'`; then
echo shar: \"'new.ri'\" unpacked with wrong size!
fi
# end of 'new.ri'
fi
if test -f 'new.rm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'new.rm'\"
else
echo shar: Extracting \"'new.rm'\" \(314 characters\)
sed "s/^X//" >'new.rm' <<'END_OF_FILE'
X#define new_width 16
X#define new_height 16
X#define new_x_hot -1
X#define new_y_hot -1
Xstatic char new_bits[] = {
X 0x80, 0x3f, 0xe0, 0xff, 0xf1, 0x7f, 0xf9, 0x5f, 0xfb, 0x17, 0xff, 0x05,
X 0xff, 0x00, 0xff, 0x00, 0xff, 0x05, 0xfb, 0x17, 0xf3, 0x5f, 0xf1, 0x7f,
X 0xe1, 0xff, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 314 -ne `wc -c <'new.rm'`; then
echo shar: \"'new.rm'\" unpacked with wrong size!
fi
# end of 'new.rm'
fi
if test -f 'orig.li' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'orig.li'\"
else
echo shar: Extracting \"'orig.li'\" \(520 characters\)
sed "s/^X//" >'orig.li' <<'END_OF_FILE'
X#define orig_width 32
X#define orig_height 16
X#define orig_x_hot -1
X#define orig_y_hot -1
Xstatic char orig_bits[] = {
X 0x00, 0xc0, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x80, 0x7f, 0x03, 0xe0,
X 0xe0, 0x83, 0x03, 0xb0, 0xf8, 0x01, 0x0c, 0x68, 0xfc, 0x03, 0xf0, 0x37,
X 0xfe, 0x01, 0x00, 0x28, 0xff, 0x8b, 0x88, 0x34, 0xfe, 0x01, 0x00, 0x28,
X 0xf8, 0x03, 0xc0, 0x5f, 0xf0, 0x28, 0x30, 0xb0, 0xc0, 0x39, 0x0e, 0xe0,
X 0x00, 0xee, 0x01, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00,
X 0x00, 0xc0, 0x00, 0x00};
END_OF_FILE
if test 520 -ne `wc -c <'orig.li'`; then
echo shar: \"'orig.li'\" unpacked with wrong size!
fi
# end of 'orig.li'
fi
if test -f 'orig.lm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'orig.lm'\"
else
echo shar: Extracting \"'orig.lm'\" \(491 characters\)
sed "s/^X//" >'orig.lm' <<'END_OF_FILE'
X#define lfishmask_width 32
X#define lfishmask_height 16
Xstatic char lfishmask_bits[] = {
X 0x00, 0xc0, 0x07, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x80, 0xff, 0x03, 0xe0,
X 0xe0, 0xff, 0x03, 0xf0, 0xf8, 0xff, 0x0f, 0x78, 0xfc, 0xff, 0xff, 0x3f,
X 0xfe, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f,
X 0xf8, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0x3f, 0xf0, 0xc0, 0xff, 0x0f, 0xe0,
X 0x00, 0xfe, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
X 0x00, 0xc0, 0x00, 0x00};
END_OF_FILE
if test 491 -ne `wc -c <'orig.lm'`; then
echo shar: \"'orig.lm'\" unpacked with wrong size!
fi
# end of 'orig.lm'
fi
if test -f 'orig.ri' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'orig.ri'\"
else
echo shar: Extracting \"'orig.ri'\" \(520 characters\)
sed "s/^X//" >'orig.ri' <<'END_OF_FILE'
X#define orig_width 32
X#define orig_height 16
X#define orig_x_hot -1
X#define orig_y_hot -1
Xstatic char orig_bits[] = {
X 0x00, 0xe0, 0x03, 0x00, 0x00, 0x60, 0x0d, 0x00, 0x07, 0xc0, 0xfe, 0x01,
X 0x0d, 0xc0, 0xc1, 0x07, 0x12, 0x30, 0x80, 0x1f, 0xec, 0x0f, 0xc0, 0x3f,
X 0x14, 0x00, 0x80, 0x7f, 0xac, 0x88, 0xc8, 0xff, 0x14, 0x00, 0x80, 0x7f,
X 0xfa, 0x03, 0xc0, 0x1f, 0x0d, 0x0c, 0x14, 0x0f, 0x07, 0x70, 0x9c, 0x03,
X 0x00, 0x80, 0x77, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x05, 0x00,
X 0x00, 0x00, 0x03, 0x00};
END_OF_FILE
if test 520 -ne `wc -c <'orig.ri'`; then
echo shar: \"'orig.ri'\" unpacked with wrong size!
fi
# end of 'orig.ri'
fi
if test -f 'orig.rm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'orig.rm'\"
else
echo shar: Extracting \"'orig.rm'\" \(491 characters\)
sed "s/^X//" >'orig.rm' <<'END_OF_FILE'
X#define rfishmask_width 32
X#define rfishmask_height 16
Xstatic char rfishmask_bits[] = {
X 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x07, 0xc0, 0xff, 0x01,
X 0x0f, 0xc0, 0xff, 0x07, 0x1e, 0xf0, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0x3f,
X 0xfc, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x7f,
X 0xfe, 0xff, 0xff, 0x1f, 0x0f, 0xfc, 0xff, 0x0f, 0x07, 0xf0, 0xff, 0x03,
X 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00,
X 0x00, 0x00, 0x03, 0x00};
END_OF_FILE
if test 491 -ne `wc -c <'orig.rm'`; then
echo shar: \"'orig.rm'\" unpacked with wrong size!
fi
# end of 'orig.rm'
fi
if test -f 'xfish.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xfish.c'\"
else
echo shar: Extracting \"'xfish.c'\" \(13466 characters\)
sed "s/^X//" >'xfish.c' <<'END_OF_FILE'
X/*
X * xfish.c - serves no useful purpose whatsoever
X *
X * Author: John H. Bradley, University of Pennsylvania
X * (bradley at cis.upenn.edu)
X * October, 1987
X *
X * For 4.3ish Unix systems running X V11
X *
X * Modified by Jon Greenblatt (jonnyg at rover.umd.edu):
X *
X * 1: Improved event handeling.
X * 2: Added the -root option (xerror occurs with window managers running).
X * 3: Added the -rv reverse video option.
X *
X * Modified by Lars Huttar (huttar at svax.cs.cornell.edu) 7/89:
X *
X * 1: Added the -nobell option.
X * 2: Allowed for two fish to be hit by one shot.
X * 3: Added the -bitmap option for using your own bitmaps.
X *
X */
X
X
X#include <stdio.h>
X#include <math.h>
X#include <strings.h>
X#include <signal.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X#include <X11/cursorfont.h>
X#include <sys/time.h>
X#include <sys/types.h>
X#include <sys/timeb.h>
X
X#define DEFAULTDIR "/usr/public/sun3/games/lib/xfish_bitmaps/"
X
X/* handy-dandy functions */
X#define max(a, b) ((a) > (b) ? (a) : (b))
X#define min(a, b) ((a) < (b) ? (a) : (b))
X#define abs(a) ((a) < 0 ? -(a) : (a))
X
X
X/* objects */
XDisplay *disp;
XWindow theWindow;
XPixmap stipP, lfishP, rfishP, lfishmaskP, rfishmaskP;
XGC gc,lgc,rgc;
XXGCValues xgcv;
XXSetWindowAttributes xswa;
X#define root_weave_width 16
X#define root_weave_height 16
Xstatic char root_weave_bits[] = {
X 0x77, 0x77, 0xdd, 0xdd, 0xbb, 0xbb, 0xee, 0xee, 0x77, 0x77, 0xdd, 0xdd,
X 0xbb, 0xbb, 0xee, 0xee, 0x77, 0x77, 0xdd, 0xdd, 0xbb, 0xbb, 0xee, 0xee,
X 0x77, 0x77, 0xdd, 0xdd, 0xbb, 0xbb, 0xee, 0xee};
X
Xstatic char iroot_weave_bits[] = {
X 0x88, 0x88, 0x22, 0x22, 0x44, 0x44, 0x11, 0x11, 0x88, 0x88, 0x22, 0x22,
X 0x44, 0x44, 0x11, 0x11, 0x88, 0x88, 0x22, 0x22, 0x44, 0x44, 0x11, 0x11,
X 0x88, 0x88, 0x22, 0x22, 0x44, 0x44, 0x11, 0x11};
X
Xint fish_width=32, fish_height=16;
X
Xstatic char lfish_bits[] = {
X 0x00, 0xc0, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x80, 0x7f, 0x03, 0xe0,
X 0x60, 0x82, 0x03, 0xb0, 0x18, 0x00, 0x0c, 0x68, 0x64, 0x02, 0xf0, 0x37,
X 0x62, 0x00, 0x00, 0x28, 0x01, 0xaa, 0xaa, 0x36, 0x46, 0x00, 0x00, 0x28,
X 0x38, 0x03, 0xc0, 0x5f, 0xb0, 0x28, 0x30, 0xb0, 0xc0, 0x39, 0x0e, 0xe0,
X 0x00, 0xee, 0x01, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00,
X 0x00, 0xc0, 0x00, 0x00};
X
Xstatic char lfishmask_bits[] = {
X 0x00, 0xc0, 0x07, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x80, 0xff, 0x03, 0xe0,
X 0xe0, 0xff, 0x03, 0xf0, 0xf8, 0xff, 0x0f, 0x78, 0xfc, 0xff, 0xff, 0x3f,
X 0xfe, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f,
X 0xf8, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0x3f, 0xf0, 0xc0, 0xff, 0x0f, 0xe0,
X 0x00, 0xfe, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
X 0x00, 0xc0, 0x00, 0x00};
X
Xstatic char rfish_bits[] = {
X 0x00, 0xe0, 0x03, 0x00, 0x00, 0x60, 0x0d, 0x00, 0x07, 0xc0, 0xfe, 0x01,
X 0x0d, 0xc0, 0x41, 0x06, 0x12, 0x30, 0x00, 0x18, 0xec, 0x0f, 0x40, 0x26,
X 0x14, 0x00, 0x00, 0x46, 0xac, 0xaa, 0x4a, 0x80, 0x14, 0x00, 0x00, 0x62,
X 0xfa, 0x03, 0xc0, 0x1c, 0x0d, 0x0c, 0x14, 0x0d, 0x07, 0x70, 0x9c, 0x03,
X 0x00, 0x80, 0x77, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x05, 0x00,
X 0x00, 0x00, 0x03, 0x00};
X
Xstatic char rfishmask_bits[] = {
X 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x07, 0xc0, 0xff, 0x01,
X 0x0f, 0xc0, 0xff, 0x07, 0x1e, 0xf0, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0x3f,
X 0xfc, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x7f,
X 0xfe, 0xff, 0xff, 0x1f, 0x0f, 0xfc, 0xff, 0x0f, 0x07, 0xf0, 0xff, 0x03,
X 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00,
X 0x00, 0x00, 0x03, 0x00};
X
X
X#define MAXFISH 100
Xstruct fishstr { short x,y,dx,dy; } fish[MAXFISH];
X
Xint NUMFISH=20, startnfish=20, shots=0, no_bell=0, use_root=0,
X reverse_video=0, load_bitmap=0, screen;
X#define MAXFNLEN 51
Xchar filename[MAXFNLEN];
X
X
Xlong starttime;
X
X/**************/
Xmain(argc, argv)
X int argc;
X char *argv[];
X/**************/
X{
X int i,dpcs,n,fcnt;
X char *strind;
X
X char *fc, *bc;
X char *display = NULL;
X
X char *def;
X short bot,right;
X XSizeHints xsh;
X
X
X /*********************Options*********************/
X
X for (i = 1; i < argc; i++) {
X
X strind = index(argv[i], ':'); /* is it display address? */
X if(strind != NULL) {
X display = argv[i];
X continue;
X }
X
X if (n=atoi(argv[i])) {
X if (n<1) n=1;
X if (n>100) n=100;
X NUMFISH=startnfish=n;
X continue;
X }
X
X if (*argv[i] == '-') {
X if (strcmp(argv[i],"-root") == 0) {
X use_root = 1;
X continue;
X }
X if (strcmp(argv[i],"-rv") == 0) {
X reverse_video = 1;
X continue;
X }
X if (strncmp(argv[i],"-n",2) == 0) { /* -nobell */
X no_bell = 1;
X continue;
X }
X if (strncmp(argv[i],"-b",2) == 0 && argc>i+1 /* -bitmap */
X && sscanf(argv[++i], "%50s", filename)==1) {
X load_bitmap = 1;
X continue;
X }
X }
X
X Syntax(argv[0]);
X }
X
X
X /*****************************************************/
X
X /* Open up the display. */
X
X if ((disp=XOpenDisplay(display)) == NULL) {
X fprintf(stderr, "%s: Can't open display ''\n",argv[0],display);
X exit(1);
X }
X
X
X bot =DisplayHeight(disp,DefaultScreen(disp));
X right=DisplayWidth (disp,DefaultScreen(disp));
X
X xsh.flags = USSize | USPosition;
X xsh.x = xsh.y = 0;
X xsh.width = right;
X xsh.height= bot;
X
X xswa.event_mask = ButtonPressMask;
X if (use_root)
X theWindow = RootWindow(disp,DefaultScreen(disp));
X else
X theWindow = XCreateWindow(disp, DefaultRootWindow(disp), 0,0,
X right,bot,0,1,InputOutput,
X DefaultVisual(disp,DefaultScreen(disp)),
X CWEventMask,&xswa);
X
X
X stipP=XCreateBitmapFromData(disp,theWindow,
X iroot_weave_bits, root_weave_width, root_weave_height);
X
X if (load_bitmap) load_bitmaps();
X else {
X lfishP=XCreateBitmapFromData(disp,theWindow,
X lfish_bits,fish_width,fish_height);
X rfishP=XCreateBitmapFromData(disp,theWindow,
X rfish_bits,fish_width,fish_height);
X lfishmaskP=XCreateBitmapFromData(disp,theWindow,
X lfishmask_bits,fish_width,fish_height);
X rfishmaskP=XCreateBitmapFromData(disp,theWindow,
X rfishmask_bits,fish_width,fish_height);
X }
X
X if (!use_root) {
X XSetWindowBackgroundPixmap(disp,theWindow,stipP);
X XSetNormalHints(disp,theWindow,&xsh);
X XSetStandardProperties(disp,theWindow,"fish","fish",None,0,0,&xsh);
X XMapWindow(disp,theWindow);
X XLowerWindow(disp, theWindow);
X }
X
X /* init fish */
X for (i=0; i<NUMFISH; i++) {
X fish[i].x=rand()%(right-100)+50;
X fish[i].y=rand()%(bot-100)+50;
X fish[i].dx = (abs(rand()%10)+4);
X
X /* switch direction based on a higher-order bit. the low-order bit
X tended to be useless */
X if (rand()&0x10) fish[i].dx = -fish[i].dx;
X
X fish[i].dy=rand()%7-3; if (fish[i].dy==0) fish[i].dy=1;
X }
X
X
X xgcv.tile=stipP;
X xgcv.graphics_exposures = False;
X
X gc = XCreateGC(disp,theWindow,GCTile|GCGraphicsExposures,&xgcv);
X lgc= XCreateGC(disp,theWindow,GCTile|GCGraphicsExposures,&xgcv);
X rgc= XCreateGC(disp,theWindow,GCTile|GCGraphicsExposures,&xgcv);
X
X xgcv.fill_style= FillTiled;
X
X xgcv.clip_mask = None;
X
X screen = DefaultScreen(disp);
X if (reverse_video) {
X xgcv.foreground = WhitePixel(disp,screen);
X xgcv.background = BlackPixel(disp,screen);
X }
X else {
X xgcv.foreground = BlackPixel(disp,screen);
X xgcv.background = WhitePixel(disp,screen);
X }
X xgcv.clip_mask = lfishmaskP;
X XChangeGC(disp,lgc,GCClipMask|GCFillStyle|GCForeground|GCBackground,&xgcv);
X
X xgcv.clip_mask = rfishmaskP;
X XChangeGC(disp,rgc,GCClipMask|GCFillStyle|GCForeground|GCBackground,&xgcv);
X
X starttime=time(0);
X
X
X /**************** Main loop *****************/
X
X fcnt = 0;
X if (use_root)
X XSelectInput(disp,theWindow,ButtonPressMask);
X while (1) {
X XEvent event;
X short x,y,bnum;
X
X if (XCheckMaskEvent(disp,ButtonPressMask,&event)) {
X if (event.type == ButtonPress) {
X XButtonEvent *butevent = (XButtonEvent *) &event;
X
X bnum = butevent->button;
X if ((bnum == Button1) || (bnum == Button3)) {
X
X if (bnum == Button3) shots++;
X
X x = butevent->x; y = butevent->y;
X for (i=0; i<NUMFISH; i++) {
X if ( (x >= fish[i].x) &&
X (x <= fish[i].x+fish_width) &&
X (y >= fish[i].y) &&
X (y <= fish[i].y+fish_height) )
X
X if (i!=NUMFISH) {
X if (!no_bell) XBell(disp,25);
X EraseFish(i);
X if (bnum == Button1) {
X fish[i].dx = -fish[i].dx;
X fish[i].dy = -fish[i].dy;
X DrawFish(i);
X }
X else {
X if (NUMFISH==1) Stats();
X bcopy(&fish[NUMFISH-1],&fish[i],
X sizeof(struct fishstr));
X NUMFISH--;
X }
X }
X }
X }
X }
X }
X
X if (fcnt>=NUMFISH) fcnt=0; /* since it's possible NUMFISH decreased */
X
X EraseFish(fcnt);
X
X fish[fcnt].x += fish[fcnt].dx;
X fish[fcnt].y += fish[fcnt].dy;
X if (fish[fcnt].x < -50 || fish[fcnt].x > (right+50))
X fish[fcnt].dx = -fish[fcnt].dx;
X if (fish[fcnt].y < 0 || fish[fcnt].y > (bot-16))
X fish[fcnt].dy = -fish[fcnt].dy;
X
X DrawFish(fcnt);
X
X fcnt++;
X if (fcnt>=NUMFISH) { fcnt=0; Timer(250000L); }
X
X } /* end main loop */
X}
X
X/*****************/
XEraseFish(i)
X int i;
X{
X XClearArea(disp,theWindow,fish[i].x,fish[i].y,fish_width,fish_height,0);
X}
X
X/*****************/
XDrawFish(i)
X int i;
X{
X xgcv.clip_x_origin = fish[i].x;
X xgcv.clip_y_origin = fish[i].y;
X
X if (fish[i].dx<0) {
X XChangeGC(disp,lgc,GCClipXOrigin|GCClipYOrigin,&xgcv);
X XCopyPlane(disp,lfishP,theWindow,lgc,0,0,fish_width,fish_height,
X fish[i].x,fish[i].y,1);
X }
X else {
X XChangeGC(disp,rgc,GCClipXOrigin|GCClipYOrigin,&xgcv);
X XCopyPlane(disp,rfishP,theWindow,rgc,0,0,fish_width,fish_height,
X fish[i].x,fish[i].y,1);
X }
X}
X
X
X/***********************************/
XSyntax(call)
X char *call;
X{
X printf ("Usage: %s [-root -rv -nobell -bitmap bitmapfile]\n",call);
X puts("\t\t[host:display] [number of fish]\n");
X exit(1);
X}
X
X
X/***********************************/
XXFishError (identifier)
X char *identifier;
X{
X fprintf(stderr, "xfish: %s\n", identifier);
X exit(1);
X}
X
X
X
X/*******/
XStats()
X{
X long curtime;
X float acc;
X
X curtime=time(0);
X acc = (float) shots / (float) startnfish;
X if (!no_bell) puts("\007\007\007");
X printf("You used %d shots to hit %d fish. (in %d seconds)\n",
X shots,startnfish,curtime-starttime);
X printf(" For an accuracy ratio of: %f\n", acc);
X
X if (acc < 1.0) printf("Tex, you're a whiz!\n");
X else if (acc < 1.5) printf("Nice shootin', Tex!\n");
X XPending(disp);
X exit(0);
X}
X
X
X
Xstatic int timerdone;
X
X/*******/
Xonalarm()
X/*******/
X{
X timerdone=1;
X}
X
X/*******/
XTimer(val,n)
X long val;
X/*******/
X{
X /* waits 'val' microseconds */
X
X struct itimerval it;
X
X bzero(&it, sizeof(it));
X it.it_value.tv_usec = val;
X timerdone=0;
X signal(SIGALRM,onalarm);
X setitimer(ITIMER_REAL, &it, (struct itimerval *)0);
X while (1) {
X sigblock(sigmask(SIGALRM)); /* note: have to block, so that ALRM */
X if (timerdone) break; /* doesn't occur between 'if (timerdone)'*/
X else sigpause(0); /* and calling sigpause(0) */
X }
X sigblock(0); /* turn ALRM blocking off */
X signal(SIGALRM,SIG_DFL);
X}
X
Xload_bitmaps()
X{ int dummy;
X register int i, status;
X char nufilename[MAXFNLEN+3], temp[MAXFNLEN+3];
X static char extensions[4][4]={".li", ".lm", ".ri", ".rm"};
X static Pixmap *pixmaps[4] = {&lfishP, &lfishmaskP, &rfishP, &rfishmaskP};
X
X for (i=0; i<4; i++) {
X strcpy(nufilename, filename);
X strcat(nufilename, extensions[i]); /* Add extension... */
X
X /* Load in the bitmap. If unsuccessful... */
X if ((status=XReadBitmapFile(disp, RootWindow(disp, DefaultScreen(disp)),
X nufilename, &fish_width, &fish_height, pixmaps[i],
X &dummy, &dummy)) != BitmapSuccess) {
X
X /* If the file couldn't be opened, try the default directory. */
X if (status==BitmapOpenFailed && filename[0]!='/') {
X strcpy(nufilename, DEFAULTDIR);
X strcat(nufilename, filename); /* Add default path to front */
X strcpy(filename, nufilename); /* of filename. */
X strcat(nufilename, extensions[i]);
X if ((status=XReadBitmapFile(disp,
X RootWindow(disp, DefaultScreen(disp)),
X nufilename, &fish_width, &fish_height, pixmaps[i],
X &dummy, &dummy)) == BitmapSuccess) continue;
X /* If the default dir worked, go load next bitmap. */
X }
X
X /* Explain failure and quit. */
X fputs("Invalid bitmap files. There should be four,\n", stderr);
X fputs("with extensions .li, .lm, .ri, and .rm.\n", stderr);
X fputs("They are used for left and right images ", stderr);
X fputs("and masks.\n", stderr);
X exit(1);
X }
X }
X}
END_OF_FILE
if test 13466 -ne `wc -c <'xfish.c'`; then
echo shar: \"'xfish.c'\" unpacked with wrong size!
fi
# end of 'xfish.c'
fi
if test -f 'xfish.man' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xfish.man'\"
else
echo shar: Extracting \"'xfish.man'\" \(1336 characters\)
sed "s/^X//" >'xfish.man' <<'END_OF_FILE'
X.\" @(#)xfish.6 John H. Bradley
X.\" <bradley at cis.upenn.edu>
X.\" Man page by Lars Huttar 7/17/89
X.TH XFISH 6 "October 1987"
X.SH NAME
Xxfish \- make workstation into aquarium
X.SH SYNOPSIS
X.B xfish
X[ -\fIn\fPobell -root -rv ] [ -\fIb\fPitmap bitmapfile ]
X.SH DESCRIPTION
X.LP
X.I xfish
Xis a little thing that runs under the X window system, release 11.
XIf run without arguments, it starts up a window with fish drifting
Xback and forth. Using the right mouse button you can shoot them;
Xwith the left mouse button you can reverse their directions.
X
X.SH OPTIONS
X.TP
X.B \-n(obell)
Xdisable beep that signals a direct hit.
X.TP
X.B \-root
Xuse the root window (xerror occurs with window manager running).
X.TP
X.B \-rv
Xreverse video
X.TP
X.B \-b(itmap) \fIfile\fP
Xuse the bitmap found in \fIfile\fP. \fIxfish\fP looks first
Xin the current directory, then in
Xthe default directory (/usr/public/sun3/games/lib/xfish_bitmaps).
XBitmap files come in sets of four: one with a .li suffix containing
Xthe image of the left-facing fish; one with a .lm suffix containing
Xa mask for the left-facing fish; and analogous .ri and .rm files
Xfor the right-facing fish. (Of course they do not actually have
Xto be fish.) Example: 'xfish -b eye' uses the files eye.li, eye.lm,
Xeye.ri, and eye.rm, which may be in the current directory or the
Xdefault xfish directory.
X
END_OF_FILE
if test 1336 -ne `wc -c <'xfish.man'`; then
echo shar: \"'xfish.man'\" unpacked with wrong size!
fi
# end of 'xfish.man'
fi
echo shar: End of shell archive.
exit 0
More information about the Comp.sources.x
mailing list