home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 50.7 KB | 1,483 lines |
- Newsgroups: comp.sources.x
- Path: uunet!paladin.american.edu!darwin.sura.net!mips!msi!dcmartin
- From: Nathan Sidwell <nathan@inmos.co.uk>
- Subject: v18i022: Xmris - an X video game, Part01/09
- Message-ID: <csx-18i022-xmris@uunet.UU.NET>
- Originator: dcmartin@fascet
- Sender: dcmartin@msi.com (David C. Martin - Moderator)
- Organization: Molecular Simulations, Inc.
- Date: Thu, 16 Jul 1992 17:08:22 GMT
- Approved: dcmartin@msi.com
- Lines: 1470
-
- Submitted-by: Nathan Sidwell <nathan@inmos.co.uk>
- Posting-number: Volume 18, Issue 22
- Archive-name: xmris/part01
-
- From the README:
-
- Xmris is a version of the arcade game Mr Do, which will run under the X
- windowing system.
-
- You control a gnome, who can walk around a garden, along paths already
- marked, or create new paths wherever you wish. You also have a ball,
- which can be thrown in the direction you're facing, towards the gnome's
- feet. Points are scored for collecting cherries (if you collect 8
- cherries without stopping, you get a bonus), killing monsters (by
- squashing them, or throwing the ball at them), and collecting the prize
- left when all the monsters have come out of their den.
-
- #!/bin/sh
- # This is a shell archive (produced by shar 3.50)
- # To extract the files from this archive, save it to a file, remove
- # everything above the "!/bin/sh" line above, and type "sh file_name".
- #
- # made 07/16/1992 16:47 UTC by dcmartin@fascet
- # Source directory /home/fascet/dcmartin/csx/src/xmris
- #
- # existing files will NOT be overwritten unless -c is specified
- #
- # This is part 1 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 516 -rw-r--r-- COPYRIGHT
- # 5450 -rw-r--r-- README
- # 2140 -rw-r--r-- COMPILATION
- # 1067 -rw-r--r-- Imakefile
- # 11181 -rw-r--r-- Makefile.std
- # 5444 -rw-r--r-- xmris.man
- # 29 -rw-r--r-- patchlevel.h
- # 22124 -rw-r--r-- xmris.h
- # 19361 -rw-r--r-- apple.c
- # 37076 -rw-r--r-- create.c
- # 13731 -rw-r--r-- demo.c
- # 23961 -rw-r--r-- draw.c
- # 13476 -rw-r--r-- monster.c
- # 38428 -rw-r--r-- move.c
- # 26545 -rw-r--r-- player.c
- # 3360 -rw-r--r-- timer.c
- # 18828 -rw-r--r-- xmris.c
- # 878 -rw-r--r-- bitmaps/apple/apple.h
- # 881 -rw-r--r-- bitmaps/apple/applem.h
- # 977 -rw-r--r-- bitmaps/apple/decay.h
- # 980 -rw-r--r-- bitmaps/apple/decaym.h
- # 875 -rw-r--r-- bitmaps/apple/rock.h
- # 878 -rw-r--r-- bitmaps/apple/rockm.h
- # 671 -rw-r--r-- bitmaps/apple/rot.h
- # 674 -rw-r--r-- bitmaps/apple/rotm.h
- # 878 -rw-r--r-- bitmaps/apple/split.h
- # 881 -rw-r--r-- bitmaps/apple/splitm.h
- # 881 -rw-r--r-- bitmaps/board/cherry.h
- # 884 -rw-r--r-- bitmaps/board/cherrym.h
- # 1181 -rw-r--r-- bitmaps/board/digits.h
- # 1184 -rw-r--r-- bitmaps/board/digitsm.h
- # 707 -rw-r--r-- bitmaps/board/edgelr.h
- # 830 -rw-r--r-- bitmaps/board/edgetb.h
- # 479 -rw-r--r-- bitmaps/board/fill0.h
- # 479 -rw-r--r-- bitmaps/board/fill1.h
- # 479 -rw-r--r-- bitmaps/board/fill2.h
- # 479 -rw-r--r-- bitmaps/board/fill3.h
- # 485 -rw-r--r-- bitmaps/board/munchlr.h
- # 485 -rw-r--r-- bitmaps/board/munchtb.h
- # 881 -rw-r--r-- bitmaps/board/oblong.h
- # 875 -rw-r--r-- bitmaps/board/rect.h
- # 884 -rw-r--r-- bitmaps/chomp/chmpcls.h
- # 887 -rw-r--r-- bitmaps/chomp/chmpclsm.h
- # 884 -rw-r--r-- bitmaps/chomp/chmpopn.h
- # 887 -rw-r--r-- bitmaps/chomp/chmpopnm.h
- # 884 -rw-r--r-- bitmaps/drone/dronrt1.h
- # 887 -rw-r--r-- bitmaps/drone/dronrt1m.h
- # 884 -rw-r--r-- bitmaps/drone/dronrt2.h
- # 887 -rw-r--r-- bitmaps/drone/dronrt2m.h
- # 280 -rw-r--r-- bitmaps/drone/dronsq.h
- # 283 -rw-r--r-- bitmaps/drone/dronsqm.h
- # 884 -rw-r--r-- bitmaps/drone/dronup1.h
- # 887 -rw-r--r-- bitmaps/drone/dronup1m.h
- # 884 -rw-r--r-- bitmaps/drone/dronup2.h
- # 887 -rw-r--r-- bitmaps/drone/dronup2m.h
- # 875 -rw-r--r-- bitmaps/icon/bigi.h
- # 875 -rw-r--r-- bitmaps/icon/bigm.h
- # 875 -rw-r--r-- bitmaps/icon/bigr.h
- # 875 -rw-r--r-- bitmaps/icon/bigs.h
- # 875 -rw-r--r-- bitmaps/icon/bigt.h
- # 327 -rw-r--r-- bitmaps/icon/cursor.h
- # 284 -rw-r--r-- bitmaps/icon/cursorm.h
- # 1037 -rw-r--r-- bitmaps/icon/mris.h
- # 1037 -rw-r--r-- bitmaps/icon/msit.h
- # 881 -rw-r--r-- bitmaps/icon/shelli.h
- # 881 -rw-r--r-- bitmaps/icon/shellm.h
- # 881 -rw-r--r-- bitmaps/icon/shellr.h
- # 881 -rw-r--r-- bitmaps/icon/shells.h
- # 881 -rw-r--r-- bitmaps/icon/shellt.h
- # 881 -rw-r--r-- bitmaps/icon/solidi.h
- # 881 -rw-r--r-- bitmaps/icon/solidm.h
- # 881 -rw-r--r-- bitmaps/icon/solidr.h
- # 881 -rw-r--r-- bitmaps/icon/solids.h
- # 881 -rw-r--r-- bitmaps/icon/solidt.h
- # 884 -rw-r--r-- bitmaps/munch/mnchrt1.h
- # 887 -rw-r--r-- bitmaps/munch/mnchrt1m.h
- # 884 -rw-r--r-- bitmaps/munch/mnchrt2.h
- # 887 -rw-r--r-- bitmaps/munch/mnchrt2m.h
- # 280 -rw-r--r-- bitmaps/munch/mnchsq.h
- # 283 -rw-r--r-- bitmaps/munch/mnchsqm.h
- # 884 -rw-r--r-- bitmaps/munch/mnchup1.h
- # 887 -rw-r--r-- bitmaps/munch/mnchup1m.h
- # 884 -rw-r--r-- bitmaps/munch/mnchup2.h
- # 887 -rw-r--r-- bitmaps/munch/mnchup2m.h
- # 872 -rw-r--r-- bitmaps/normal/den.h
- # 875 -rw-r--r-- bitmaps/normal/denm.h
- # 884 -rw-r--r-- bitmaps/normal/normrt1.h
- # 887 -rw-r--r-- bitmaps/normal/normrt1m.h
- # 884 -rw-r--r-- bitmaps/normal/normrt2.h
- # 887 -rw-r--r-- bitmaps/normal/normrt2m.h
- # 280 -rw-r--r-- bitmaps/normal/normsq.h
- # 283 -rw-r--r-- bitmaps/normal/normsqm.h
- # 884 -rw-r--r-- bitmaps/normal/normup1.h
- # 887 -rw-r--r-- bitmaps/normal/normup1m.h
- # 884 -rw-r--r-- bitmaps/normal/normup2.h
- # 887 -rw-r--r-- bitmaps/normal/normup2m.h
- # 111 -rw-r--r-- bitmaps/player/ball.h
- # 933 -rw-r--r-- bitmaps/player/plyrps1.h
- # 887 -rw-r--r-- bitmaps/player/plyrps1m.h
- # 934 -rw-r--r-- bitmaps/player/plyrps2.h
- # 887 -rw-r--r-- bitmaps/player/plyrps2m.h
- # 934 -rw-r--r-- bitmaps/player/plyrrt1.h
- # 887 -rw-r--r-- bitmaps/player/plyrrt1m.h
- # 934 -rw-r--r-- bitmaps/player/plyrrt2.h
- # 887 -rw-r--r-- bitmaps/player/plyrrt2m.h
- # 280 -rw-r--r-- bitmaps/player/plyrsq.h
- # 283 -rw-r--r-- bitmaps/player/plyrsqm.h
- # 933 -rw-r--r-- bitmaps/player/plyrup1.h
- # 887 -rw-r--r-- bitmaps/player/plyrup1m.h
- # 934 -rw-r--r-- bitmaps/player/plyrup2.h
- # 887 -rw-r--r-- bitmaps/player/plyrup2m.h
- # 881 -rw-r--r-- bitmaps/prize/brolly.h
- # 884 -rw-r--r-- bitmaps/prize/brollym.h
- # 875 -rw-r--r-- bitmaps/prize/cake.h
- # 878 -rw-r--r-- bitmaps/prize/cakem.h
- # 878 -rw-r--r-- bitmaps/prize/clock.h
- # 881 -rw-r--r-- bitmaps/prize/clockm.h
- # 881 -rw-r--r-- bitmaps/prize/mushrm.h
- # 884 -rw-r--r-- bitmaps/prize/mushrmm.h
- # 884 -rw-r--r-- bitmaps/prize/spanner.h
- # 887 -rw-r--r-- bitmaps/prize/spannerm.h
- # 923 -rw-r--r-- bitmaps/xtra/xtra1.h
- # 881 -rw-r--r-- bitmaps/xtra/xtra1m.h
- # 923 -rw-r--r-- bitmaps/xtra/xtra2.h
- # 881 -rw-r--r-- bitmaps/xtra/xtra2m.h
- # 280 -rw-r--r-- bitmaps/xtra/xtrasq.h
- # 283 -rw-r--r-- bitmaps/xtra/xtrasqm.h
- # 1085 -rw-r--r-- bitmaps/xtra/xtrbold.h
- # 1088 -rw-r--r-- bitmaps/xtra/xtrfaint.h
- #
- if test -r _shar_seq_.tmp; then
- echo 'Must unpack archives in sequence!'
- echo Please unpack part `cat _shar_seq_.tmp` next
- exit 1
- fi
- # ============= COPYRIGHT ==============
- if test -f 'COPYRIGHT' -a X"$1" != X"-c"; then
- echo 'x - skipping COPYRIGHT (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting COPYRIGHT (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'COPYRIGHT' &&
- X X M R I S V1.01
- X ---------------
- X (C) 1992 Nathan Sidwell
- X
- This program is copyright (C) 1992 Nathan Sidwell. This software and
- documentation is in the public domain. Permission is granted to
- distribute and compile verbatim copies of this software for
- non-commercial, non-profit use, without fee. The software may be
- modified, provided that both the above copyright notice and this
- permission notice appear.
- X
- No guarantee is given as to the robustness or suitability of this
- software for your computer.
- SHAR_EOF
- chmod 0644 COPYRIGHT ||
- echo 'restore of COPYRIGHT failed'
- Wc_c="`wc -c < 'COPYRIGHT'`"
- test 516 -eq "$Wc_c" ||
- echo 'COPYRIGHT: original size 516, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= README ==============
- if test -f 'README' -a X"$1" != X"-c"; then
- echo 'x - skipping README (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting README (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'README' &&
- X X M R I S V1.01
- X
- X (C) 1992 Nathan Sidwell
- X
- This program is copyright (C) 1992 Nathan Sidwell. This software and
- documentation is in the public domain. Permission is granted to
- distribute and compile verbatim copies of this software for
- non-commercial, non-profit use, without fee. The software may be
- modified, provided that both the above copyright notice and this
- permission notice appear.
- X
- No guarantee is given as to the robustness or suitability of this
- software for your computer.
- X
- SCENARIO
- X
- XXmris is a version of the arcade game Mr Do, which will run under the X
- windowing system.
- X
- You control a gnome, who can walk around a garden, along paths already
- marked, or create new paths wherever you wish. You also have a ball,
- which can be thrown in the direction you're facing, towards the gnome's
- feet. Points are scored for collecting cherries (if you collect 8
- cherries without stopping, you get a bonus), killing monsters (by
- squashing them, or throwing the ball at them), and collecting the prize
- left when all the monsters have come out of their den.
- X
- Extra lives are obtained by filling in the 'EXTRA' monsters at the top
- of the screen. One of these comes out every 5000 points, and also when
- you get the prize, along with 3 drones. Killing the EXTRA will kill the
- drones too. When you collect the prize, the normal monsters freeze,
- until the three drones are dead. Beware things go faster after that!
- When all the normal monsters are killed or all the cherries collected,
- or you have got the final EXTRA monster, you advance to the next screen.
- X
- You can kill the monsters by throwing the ball at them, or dropping the
- apples on them. You get more points for squashing them. The EXTRA
- monsters and its drones, can eat the apples if they're walking towards
- it when they meet. You die by colliding with a monster (unless its
- eating an apple, in which case no harm done), or by being squashed be a
- falling apple.
- X
- GAME CONTROLS
- X
- The gnome can be controlled by the mouse or keyboard, this is selected
- when you start a new game. The gnome walks towards the mouse, and
- throws the ball when you press a button. You can move the mouse at
- right angles to the gnome's direction while its walking, the gnome
- continues towards the previous destination, before turning towards the
- new one. Mouse control is not that accurate for fine control of the
- gnome (I don't use it). Keyboard control is by 'z' and 'x' for left and
- right, and '\'' and '/' for up and down. The ball is thrown with the
- space bar. Pressing more than one key, will turn the gnome
- appropriately at the next intersection, so you can go round corners by
- pressing the new direction key before releasing the old one. If you try
- to go in a direction not possible, the gnome will move towards the
- nearest intersection or in the direction it was going, depending on how
- near to an intersection it was.
- X
- The game can be paused by iconifying it (when your boss walks in), or by
- pressing 'p'. When de-iconified, the game remains paused. To continue
- press space. When paused, you can abort the game by pressing 'q'. If
- the game is displaying the demo screens, 'q' will quit the game
- entirely.
- X
- OPTIONS
- X
- -help
- X Lists command arguments and version number
- X
- -display <display>
- X Display to run on
- X
- -font <font>
- X Text font name
- X
- -rv
- X Reverse video
- X
- -bw
- X Force black and white
- X
- -iconic
- X Starts iconified
- X
- -mris
- -msit
- X So not to be accused of gender bias, xmris can also be run as
- xmsit. The gender of the game is taken from the program name (mris or
- msit) and may be over ridden by two of the following switches. The game
- is known as Mr Is because the arcade game was masculine. (Happy now
- Geoff?)
- X
- The argument list is also fed to XSetStandardProperties, I don't know
- what this does.
- X
- PLAYING THE GAME
- X
- The game works best with all other processes asleep. If another process
- gets too much processor the animation will be jerky, and the load line
- along the bottom will start to grow. Because an interrupt is used to
- control the frame rate, the animation is smoother than with xchomp.
- X
- You probably want to position the pointer at the bottom of the window,
- so that it doesn't interfere with the board. You'll notice it flicker
- if one of the sprites moves under it.
- X
- BUGS
- X
- The game is always in black and white, I haven't got round to doing
- colour sprites yet, so the -bw argument is superfluous.
- X
- The -iconic argument has no effect. (I don't know how to get it to
- work.)
- X
- Fatal XIO errors are not handled gracefully. Quiting the game by using
- your window manager results in big error message. I don't know how to
- trap this.
- X
- The program was written with a folding editor, it might be hard to find
- your way around without one.
- X
- In order to get it to compile correctly with both K&R C and ANSI C, I've
- used several macros to deal with the differences in function prototyping
- and argument lists. These produce either proper K&R declarations or
- proper ANSI ones. I did have mixed declarations, with the correct
- promotions taken care of, but that doesn't work well for the one varargs
- function. It might make it hard for things like ctags to work. Maybe
- I'll revert to the mixed declarations.
- X
- Please report modifications and other bugs, so that they can be
- considered for inclusion in later releases (especially true of syste
- X specific stuff).
- X
- email to nathan@inmos.co.uk
- X
- Have fun.
- X
- Nathan Sidwell INMOS UK | | nathan@inmos.co.uk DoD#0390
- SHAR_EOF
- chmod 0644 README ||
- echo 'restore of README failed'
- Wc_c="`wc -c < 'README'`"
- test 5450 -eq "$Wc_c" ||
- echo 'README: original size 5450, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= COMPILATION ==============
- if test -f 'COMPILATION' -a X"$1" != X"-c"; then
- echo 'x - skipping COMPILATION (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting COMPILATION (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'COMPILATION' &&
- X X M R I S V1.01
- X
- X (C) 1992 Nathan Sidwell
- X
- Modify the Imakefile as appropriate for your system. You will have to
- do this to set the compiler, as, by default, Imakefile selects gcc with
- the standard includes not in /usr/include. Makefile.std doesn't do
- this, but uses the defaults. The source will compile with both ANSI and
- K&R compilers, provided that they both correctly define and undefine
- __STDC__. (But you all use ANSI now don't you.) Compilation should be
- straight forward. The only thing that might cause problems is the timer
- stuff in timer.c which set up a real-time interrupt to get the frame
- rate constant. If the frame rate is too high (ie the interrupt occurs
- before the game loop has completed) a load line along the bottom of the
- window will start to grow towards the left of the window. If this
- always grows, with all other processes dormant, you must slow the game
- down by increasing the frame rate. This can be done by fiddling with
- the FRAME variable in the Imakefile
- X
- To make on your system type
- X
- X xmkmf
- X make depend
- X make all
- X
- To install into your X bin use make install, but note that this only
- installs xmris, not xmsit.
- X
- Please report modifications, so that they can be considered for
- inclusion in later releases (especially true of system specific stuff).
- X
- email to nathan@inmos.co.uk
- X
- XXMRIS has been tested on the following systems
- X
- X Platform OS X release Colour
- X Sparcstation 1 Sunos 4.1 X11R4 B/W
- X
- NOTES TO PROGRAMMERS
- X
- XXMRIS uses pure Xlib, without toolkits, widgets, etc. This is mainly
- because I don't know anything about toolkits, widgets, etc. In fact,
- this program started out as an experiment in X Window System
- programming, hacking from Xchomp (by Jerry Shekhel), and using the
- header files (I don't even have an X manual!). There's not much of
- XXchomp code left, infact the only thing is the DEC_icon_atom stuff and
- some bits of create_resources. I improved the response by using a real
- time interrupt rather than delay for the timing and only updating the
- necessary parts of the display.
- X
- Have fun.
- X
- Nathan Sidwell INMOS UK | | nathan@inmos.co.uk DoD#0390
- SHAR_EOF
- chmod 0644 COMPILATION ||
- echo 'restore of COMPILATION failed'
- Wc_c="`wc -c < 'COMPILATION'`"
- test 2140 -eq "$Wc_c" ||
- echo 'COMPILATION: original size 2140, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Imakefile ==============
- if test -f 'Imakefile' -a X"$1" != X"-c"; then
- echo 'x - skipping Imakefile (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Imakefile (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' &&
- /**/# I need special include directories for gcc
- STD_INCLUDES =
- /**/# select your compiler
- CC = gcc -traditional
- /**/#CC = gcc -ansi -pedantic -nostdinc -Wall -Wpointer-arith -Wwrite-strings
- /**/#CC = gcc -traditional -nostdinc -Wall -Wpointer-arith -Wwrite-strings
- /**/# uncomment and fiddle with the following lines if you want
- /**/# default game gender 0 = male, 1 = female
- /**/#GENDER = -DGAME_GENDER=1
- /**/# frame rate in microseconds
- /**/#FRAME = -DFRAME_RATE=37000
- /**/# font name
- /**/#FONT = -DFONT_NAME="-*-courier-*-r-*-*-18-*-*-*-*-*-*-*"
- /**/# do you trust the code?
- /**/# NDEBUG = -DNDEBUG
- /**/# K&R doesn't have __DATE__ so we supply it here
- DATE = -DDATE="\"`date '+%h %d 19%y'`\""
- /**/# Allow debugging?
- /**/#CDEBUGFLAGS = -g
- X
- DEFINES = $(DATE) $(GENDER) $(FRAME) $(FONT) $(NDEBUG)
- SRCS = apple.c create.c demo.c draw.c monster.c move.c player.c timer.c xmris.c
- OBJS = apple.o create.o demo.o draw.o monster.o move.o player.o timer.o xmris.o
- LOCAL_LIBRARIES = $(XLIB)
- X
- ComplexProgramTarget(xmris)
- X
- all :: xmris xmsit
- X
- xmsit: xmris
- X ln -s xmris xmsit
- SHAR_EOF
- chmod 0644 Imakefile ||
- echo 'restore of Imakefile failed'
- Wc_c="`wc -c < 'Imakefile'`"
- test 1067 -eq "$Wc_c" ||
- echo 'Imakefile: original size 1067, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Makefile.std ==============
- if test -f 'Makefile.std' -a X"$1" != X"-c"; then
- echo 'x - skipping Makefile.std (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Makefile.std (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Makefile.std' &&
- # Makefile generated by imake - do not edit!
- # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
- #
- # The cpp used on this machine replaces all newlines and multiple tabs and
- # spaces in a macro expansion with a single space. Imake tries to compensate
- # for this, but is not always successful.
- #
- X
- # -------------------------------------------------------------------------
- # Makefile generated from "Imake.tmpl" and <Imakefile>
- # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
- #
- # Platform-specific parameters may be set in the appropriate <vendor>.cf
- # configuration files. Site-specific parameters should be set in the file
- # site.def. Full rebuilds are recommended if any parameters are changed.
- #
- # If your C preprocessor does not define any unique symbols, you will need
- # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
- # "make World" the first time).
- #
- X
- # -------------------------------------------------------------------------
- # site-specific configuration parameters that need to come before
- # the platform-specific parameters - edit site.def to change
- X
- # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- # -------------------------------------------------------------------------
- # platform-specific configuration parameters - edit sun.cf to change
- X
- # platform: $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
- X
- # operating system: SunOS 4.1.1
- X
- # $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
- X
- # -------------------------------------------------------------------------
- # site-specific configuration parameters that go after
- # the platform-specific parameters - edit site.def to change
- X
- # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- X SHELL = /bin/sh
- X
- X TOP = .
- X CURRENT_DIR = .
- X
- X AR = ar clq
- X BOOTSTRAPCFLAGS =
- X CC = cc
- X AS = as
- X
- X COMPRESS = compress
- X CPP = /lib/cpp $(STD_CPP_DEFINES)
- X PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
- X INSTALL = install
- X LD = ld
- X LINT = lint
- X LINTLIBFLAG = -C
- X LINTOPTS = -axz
- X LN = ln -s
- X MAKE = make
- X MV = mv
- X CP = cp
- X
- X RANLIB = ranlib
- X RANLIBINSTFLAGS =
- X
- X RM = rm -f
- X TROFF = psroff
- X MSMACROS = -ms
- X TBL = tbl
- X EQN = eqn
- X STD_INCLUDES =
- X STD_CPP_DEFINES =
- X STD_DEFINES =
- X EXTRA_LOAD_FLAGS =
- X EXTRA_LIBRARIES =
- X TAGS = ctags
- X
- X SHAREDCODEDEF = -DSHAREDCODE
- X SHLIBDEF = -DSUNSHLIB
- X
- X PROTO_DEFINES =
- X
- X INSTPGMFLAGS =
- X
- X INSTBINFLAGS = -m 0755
- X INSTUIDFLAGS = -m 4755
- X INSTLIBFLAGS = -m 0644
- X INSTINCFLAGS = -m 0444
- X INSTMANFLAGS = -m 0444
- X INSTDATFLAGS = -m 0444
- X INSTKMEMFLAGS = -m 4755
- X
- X PROJECTROOT = /usr/X11/R5
- X
- X TOP_INCLUDES = -I$(INCROOT)
- X
- X CDEBUGFLAGS = -O
- X CCOPTIONS = -pipe
- X
- X ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
- X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
- X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
- X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
- X
- X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
- X
- X LDCOMBINEFLAGS = -X -r
- X DEPENDFLAGS =
- X
- X MACROFILE = sun.cf
- X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
- X
- X IMAKE_DEFINES =
- X
- X IRULESRC = $(CONFIGDIR)
- X IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
- X
- X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
- X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
- X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
- X
- # -------------------------------------------------------------------------
- # X Window System Build Parameters
- # $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
- X
- # -------------------------------------------------------------------------
- # X Window System make variables; this need to be coordinated with rules
- X
- X PATHSEP = /
- X USRLIBDIR = /usr/X11/R5/lib
- X BINDIR = /usr/X11/R5/bin
- X INCROOT = /usr/X11/R5/include
- X BUILDINCROOT = $(TOP)
- X BUILDINCDIR = $(BUILDINCROOT)/X11
- X BUILDINCTOP = ..
- X INCDIR = $(INCROOT)/X11
- X ADMDIR = /usr/adm
- X LIBDIR = $(USRLIBDIR)/X11
- X CONFIGDIR = $(LIBDIR)/config
- X LINTLIBDIR = $(USRLIBDIR)/lint
- X
- X FONTDIR = $(LIBDIR)/fonts
- X XINITDIR = $(LIBDIR)/xinit
- X XDMDIR = $(LIBDIR)/xdm
- X TWMDIR = $(LIBDIR)/twm
- X MANPATH = /usr/X11/R5/man
- X MANSOURCEPATH = $(MANPATH)/man
- X MANSUFFIX = n
- X LIBMANSUFFIX = 3
- X MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
- X LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
- X NLSDIR = $(LIBDIR)/nls
- X PEXAPIDIR = $(LIBDIR)/PEX
- X XAPPLOADDIR = $(LIBDIR)/app-defaults
- X FONTCFLAGS = -t
- X
- X INSTAPPFLAGS = $(INSTDATFLAGS)
- X
- X IMAKE = imake
- X DEPEND = makedepend
- X RGB = rgb
- X
- X FONTC = bdftopcf
- X
- X MKFONTDIR = mkfontdir
- X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
- X
- X CONFIGSRC = $(TOP)/config
- X DOCUTILSRC = $(TOP)/doc/util
- X CLIENTSRC = $(TOP)/clients
- X DEMOSRC = $(TOP)/demos
- X LIBSRC = $(TOP)/lib
- X FONTSRC = $(TOP)/fonts
- X INCLUDESRC = $(TOP)/X11
- X SERVERSRC = $(TOP)/server
- X UTILSRC = $(TOP)/util
- X SCRIPTSRC = $(UTILSRC)/scripts
- X EXAMPLESRC = $(TOP)/examples
- X CONTRIBSRC = $(TOP)/../contrib
- X DOCSRC = $(TOP)/doc
- X RGBSRC = $(TOP)/rgb
- X DEPENDSRC = $(UTILSRC)/makedepend
- X IMAKESRC = $(CONFIGSRC)
- X XAUTHSRC = $(LIBSRC)/Xau
- X XLIBSRC = $(LIBSRC)/X
- X XMUSRC = $(LIBSRC)/Xmu
- X TOOLKITSRC = $(LIBSRC)/Xt
- X AWIDGETSRC = $(LIBSRC)/Xaw
- X OLDXLIBSRC = $(LIBSRC)/oldX
- X XDMCPLIBSRC = $(LIBSRC)/Xdmcp
- X BDFTOSNFSRC = $(FONTSRC)/bdftosnf
- X BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
- X BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
- X MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
- X FSLIBSRC = $(FONTSRC)/lib/fs
- X FONTSERVERSRC = $(FONTSRC)/server
- X EXTENSIONSRC = $(TOP)/extensions
- X XILIBSRC = $(EXTENSIONSRC)/lib/xinput
- X PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
- X
- # $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
- X
- SHLIBLDFLAGS = -assert pure-text
- PICFLAGS = -pic
- X
- X DEPEXTENSIONLIB =
- X EXTENSIONLIB = -lXext
- X
- X DEPXLIB = $(DEPEXTENSIONLIB)
- X XLIB = $(EXTENSIONLIB) -lX11
- X
- X DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
- X XMULIB = -lXmu
- X
- X DEPOLDXLIB =
- X OLDXLIB = -loldX
- X
- X DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
- X XTOOLLIB = -lXt
- X
- X DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
- X XAWLIB = -lXaw
- X
- X DEPXILIB =
- X XILIB = -lXi
- X
- X SOXLIBREV = 4.10
- X SOXTREV = 4.10
- X SOXAWREV = 5.0
- X SOOLDXREV = 4.10
- X SOXMUREV = 4.10
- X SOXEXTREV = 4.10
- X SOXINPUTREV = 4.10
- X
- X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
- X XAUTHLIB = -lXau
- X DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
- X XDMCPLIB = -lXdmcp
- X
- X DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
- X PHIGSLIB = -lphigs
- X
- X DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
- X XBSDLIB = -lXbsd
- X
- X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
- X LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
- X LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
- X LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
- X LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
- X LINTXI = $(LINTLIBDIR)/llib-lXi.ln
- X LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
- X
- X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
- X
- X DEPLIBS1 = $(DEPLIBS)
- X DEPLIBS2 = $(DEPLIBS)
- X DEPLIBS3 = $(DEPLIBS)
- X
- # -------------------------------------------------------------------------
- # Imake rules for building libraries, programs, scripts, and data files
- # rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
- X
- # -------------------------------------------------------------------------
- # start of Imakefile
- X
- # I need special include directories for gcc
- STD_INCLUDES =
- # select your compiler
- CC = gcc -traditional
- #CC = gcc -ansi -pedantic -nostdinc -Wall -Wpointer-arith -Wwrite-strings
- #CC = gcc -traditional -nostdinc -Wall -Wpointer-arith -Wwrite-strings
- # uncomment and fiddle with the following lines if you want
- # default game gender 0 = male, 1 = female
- #GENDER = -DGAME_GENDER=1
- # frame rate in microseconds
- #FRAME = -DFRAME_RATE=37000
- # font name
- #FONT = -DFONT_NAME="-*-courier-*-r-*-*-18-*-*-*-*-*-*-*"
- # do you trust the code?
- # NDEBUG = -DNDEBUG
- # K&R doesn't have __DATE__ so we supply it here
- DATE = -DDATE="\"`date '+%h %d 19%y'`\""
- # Allow debugging?
- #CDEBUGFLAGS = -g
- X
- DEFINES = $(DATE) $(GENDER) $(FRAME) $(FONT) $(NDEBUG)
- SRCS = apple.c create.c demo.c draw.c monster.c move.c player.c timer.c xmris.c
- OBJS = apple.o create.o demo.o draw.o monster.o move.o player.o timer.o xmris.o
- LOCAL_LIBRARIES = $(XLIB)
- X
- X PROGRAM = xmris
- X
- all:: xmris
- X
- xmris: $(OBJS) $(DEPLIBS)
- X $(RM) $@
- X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
- X
- saber_xmris:: $(SRCS)
- X # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- osaber_xmris:: $(OBJS)
- X # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- install:: xmris
- X @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
- X $(INSTALL) -c $(INSTPGMFLAGS) xmris $(DESTDIR)$(BINDIR)
- X
- install.man:: xmris.man
- X @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
- X $(INSTALL) -c $(INSTMANFLAGS) xmris.man $(DESTDIR)$(MANDIR)/xmris.$(MANSUFFIX)
- X
- depend::
- X $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
- X
- lint:
- X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
- lint1:
- X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
- X
- clean::
- X $(RM) $(PROGRAM)
- X
- all :: xmris xmsit
- X
- xmsit: xmris
- X ln -s xmris xmsit
- X
- # -------------------------------------------------------------------------
- # common rules for all Makefiles - do not edit
- X
- emptyrule::
- X
- clean::
- X $(RM_CMD) "#"*
- X
- Makefile::
- X -@if [ -f Makefile ]; then set -x; \
- X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
- X else exit 0; fi
- X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
- X
- tags::
- X $(TAGS) -w *.[ch]
- X $(TAGS) -xw *.[ch] > TAGS
- X
- saber:
- X # load $(ALLDEFINES) $(SRCS)
- X
- osaber:
- X # load $(ALLDEFINES) $(OBJS)
- X
- # -------------------------------------------------------------------------
- # empty rules for directories that do not have SUBDIRS - do not edit
- X
- install::
- X @echo "install in $(CURRENT_DIR) done"
- X
- install.man::
- X @echo "install.man in $(CURRENT_DIR) done"
- X
- Makefiles::
- X
- includes::
- X
- # -------------------------------------------------------------------------
- # dependencies generated by makedepend
- X
- SHAR_EOF
- chmod 0644 Makefile.std ||
- echo 'restore of Makefile.std failed'
- Wc_c="`wc -c < 'Makefile.std'`"
- test 11181 -eq "$Wc_c" ||
- echo 'Makefile.std: original size 11181, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= xmris.man ==============
- if test -f 'xmris.man' -a X"$1" != X"-c"; then
- echo 'x - skipping xmris.man (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting xmris.man (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'xmris.man' &&
- .TH XMRIS 6 "15 July 1992" "X Version 11"
- .IX xmris#(n) "" "\fLxmris\fP(n)"
- .SH NAME
- xmris - video arcade game for
- .I X
- .SH SYNOPSIS
- .B xmris
- [-option ...]
- .LP
- .B xmsit
- [-option ...]
- .IX xmris#(n) "" "\fLxmris\fP(n) \(em video game"
- .SH "DESCRIPTION"
- .PP
- .I xmris
- is a version of the Mr Do video arcade game for the X Window System.
- .PP
- You control a gnome, who can walk around a garden, along paths already
- marked, or create new paths wherever you wish. You also have a ball,
- which can be thrown in the direction you're facing, towards the gnome's
- feet. Points are scored for collecting cherries (if you collect 8
- cherries without stopping, you get a bonus), killing monsters (by
- squashing them, or throwing the ball at them), and collecting the prize
- left when all the monsters have come out of their den.
- .PP
- Extra lives are obtained by filling in the 'EXTRA' monsters at the top
- of the screen. One of these comes out every 5000 points, and also when
- you get the prize, along with 3 drones. Killing the EXTRA will kill the
- drones too. When you collect the prize, the normal monsters freeze,
- until the three drones are dead. Beware things go faster after that!
- When all the normal monsters are killed or all the cherries collected,
- or you have got the final EXTRA monster, you advance to the next
- screen.
- .PP
- You can kill the monsters by throwing the ball at them, or dropping the
- apples on them. You get more points for squashing them. The EXTRA
- monsters and its drones, can eat the apples if they're walking towards
- it when they meet. You die by colliding with a monster (unless its
- eating an apple, in which case no harm done), or by being squashed be a
- falling apple.
- .PP
- The game works best with all other processes asleep. If another process
- gets too much processor the animation will be jerky, and the load line
- along the bottom will start to grow. Because an interrupt is used to
- control the frame rate, the animation is smoother than with xchomp.
- .PP
- You probably want to position the pointer at the bottom of the window, so
- that it doesn't interfere with the board. You'll notice it flicker if one
- of the sprites moves under it.
- .SH GAME CONTROLS
- .PP
- The gnome can be controlled by the mouse or keyboard, this is selected
- when you start a new game. The gnome walks towards the mouse, and
- throws the ball when you press a button. You can move the mouse at
- right angles to the gnome's direction while its walking, the gnome
- continues towards the previous destination, before turning towards the
- new one. Mouse control is not that accurate for fine control of the
- gnome (I don't use it). Keyboard control is by 'z' and 'x' for left and
- right, and '\'' and '/' for up and down. The ball is thrown with the
- space bar. Pressing more than one key, will turn the gnome
- appropriately at the next intersection, so you can go round corners by
- pressing the new direction key before releasing the old one. If you try
- to go in a direction not possible, the gnome will move towards the
- nearest intersection or in the direction it was going, depending on how
- near to an intersection it was.
- .PP
- The game can be paused by iconifying it (when your boss walks in), or
- by pressing 'p'. When de-iconified, the game remains paused. To
- continue press space. When paused, you can abort the game by pressing
- 'q'. If the game is displaying the demo screens, 'q' will quit the game
- entirely.
- .SH OPTIONS
- .TP 4
- .B \-help
- Lists the command options and some other info, and does not start the game.
- .TP 4
- .B \-display \fIdisplay\fP
- Specifies which X server to connect to.
- .TP 4
- .B \-font \fIfont\fP
- Specifies which font to use.
- .TP 4
- .B \-rv
- Swap black and white colours.
- .TP 4
- .B \-bw
- Use black and white, even on colour displays.
- .TP 4
- .B \-iconic
- Start up iconized.
- .TP 4
- .B \-mris
- .TP 4
- .B \-msit
- So not to be accused of gender bias, xmris can also be run as xmsit.
- The gender of the game is taken from the program name (mris or msit)
- but may be over ridden by these two switches. The game is known as Mr
- Is because the arcade game was masculine.
- .PP
- The argument list is also fed to XSetStandardProperties, I don't know what
- this does.
- .SH SEE ALSO
- xchomp(6)
- .SH BUGS
- .PP
- The game is always in black and white, I haven't got round to doing
- colour sprites yet, so the -bw argument is superfluous.
- .PP
- The -iconic argument has no effect. (I don't know how to get it to work.)
- .PP
- Fatal XIO errors are not handled gracefully. Quiting the game by using
- your window manager results in big error message. I don't know how to
- trap this.
- .PP
- The program was written with a folding editor, it might be hard to find
- your way around without one.
- .PP
- In order to get it to compile correctly with both K&R C and ANSI C,
- I've used several macros to deal with the differences in function
- prototyping and argument lists. These produce either proper K&R
- declarations or proper ANSI ones. I did have mixed declarations, with
- the correct promotions taken care of, but that doesn't work well for
- the one varargs function. It might make it hard for things like ctags
- to work. Maybe I'll revert to the mixed declarations or maybe I won't
- support K&R.
- .SH COMMENTS
- .PP
- I welcome any comments, suggestions, code, bug reports and fixes, etc.
- Don't forget to include which version of
- .I xmris
- you are using (with xmris -help),
- machine, OS, X release & patch number, window manager etc.
- .SH COPYRIGHT
- Copyright (C) 1992 Nathan Sidwell.
- .SH AUTHOR
- Nathan Sidwell (nathan@inmos.co.uk)
- SHAR_EOF
- chmod 0644 xmris.man ||
- echo 'restore of xmris.man failed'
- Wc_c="`wc -c < 'xmris.man'`"
- test 5444 -eq "$Wc_c" ||
- echo 'xmris.man: original size 5444, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= patchlevel.h ==============
- if test -f 'patchlevel.h' -a X"$1" != X"-c"; then
- echo 'x - skipping patchlevel.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting patchlevel.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' &&
- #define XMRISVERSION "V1.01"
- SHAR_EOF
- chmod 0644 patchlevel.h ||
- echo 'restore of patchlevel.h failed'
- Wc_c="`wc -c < 'patchlevel.h'`"
- test 29 -eq "$Wc_c" ||
- echo 'patchlevel.h: original size 29, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= xmris.h ==============
- if test -f 'xmris.h' -a X"$1" != X"-c"; then
- echo 'x - skipping xmris.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting xmris.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'xmris.h' &&
- /*{{{ (C) 1992 Nathan Sidwell*/
- /*****************************************************************************
- X X M R I S V1.01
- X ---------------
- X (C) 1992 Nathan Sidwell
- X
- This program is copyright (C) 1992 Nathan Sidwell. This software and documentation
- is in the public domain. Permission is granted to distribute and compile
- verbatim copies of this software for non-commercial, non-profit use,
- without fee. The software may be modified, provided that both the above copyright
- notice and this permission notice appear.
- X
- No guarantee is given as to the robustness or suitability of this
- software for your computer.
- X
- Nathan Sidwell INMOS UK | | nathan@inmos.co.uk DoD#0390
- *****************************************************************************/
- /*}}}*/
- #include "patchlevel.h"
- #ifndef EXTERN
- #define EXTERN extern
- #endif
- /*{{{ ANSI or K&R?*/
- #ifdef __STDC__
- #include <stdarg.h>
- #define PROTOARGLIST(list) list
- #define VARARG
- #define FUNCVARARG ... )
- #define FUNCARGLIST(list) (
- #define FUNCARGSEP ,
- #define FUNCARGTERM )
- #define FUNCARGVOID ()
- #define VARARGSET(args, last) va_start(args, last)
- #else /* !__STDC__ */
- #include <varargs.h>
- #define PROTOARGLIST(list) ()
- #define const
- #define volatile
- #define VARARG , va_alist
- #define FUNCVARARG va_dcl
- #define FUNCARGLIST(list) list
- #define FUNCARGSEP ;
- #define FUNCARGTERM ;
- #define FUNCARGVOID ()
- #define VARARGSET(args, last) va_start(args)
- #ifndef DATE
- #define DATE "July 1992"
- #endif /* DATE */
- #define memmove memcpy /* K&R doesn't have memmove, but memcpy is a superset */
- #endif /* __STDC__ */
- /*}}}*/
- /*{{{ include*/
- #include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <assert.h>
- #include <string.h>
- #include <ctype.h>
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- /*}}}*/
- /*{{{ defines*/
- /*{{{ board sizes*/
- #define CELLS_ACROSS 12 /* size of the board */
- #define CELLS_DOWN 13
- #define CELL_WIDTH 32 /* size of the internal cell */
- #define CELL_HEIGHT 32 /* monster sprites must be this size */
- #define GAP_WIDTH 4 /* spacing of the cells */
- #define GAP_HEIGHT 4
- #define PLAYER_START_X ((CELLS_ACROSS - 1) >> 1)
- #define PLAYER_START_Y (CELLS_DOWN - 1)
- #define DEN_X ((CELLS_ACROSS - 1) >> 1)
- #define DEN_Y (CELLS_DOWN >> 1)
- #define CELL_STRIDE 16 /* board array is bigger than the board */
- #define CELL_TOP 2 /* and the board is offset by this much */
- #define CELL_LEFT 2
- #define KNOCK_THROUGH /* how far we go to knock through a new cell */\
- X ((CELL_WIDTH + CELL_HEIGHT + GAP_WIDTH + GAP_HEIGHT) / 3)
- #define BORDER_TOP (CELL_HEIGHT + 2) /* placing of the board */
- #define BORDER_BOTTOM (CELL_HEIGHT + 2) /* on the window */
- #define BORDER_LEFT 2
- #define BORDER_RIGHT 2
- #define FLOOD_FILL 32 /* how many branches in the distance flood fill */
- #define BOARD_WIDTH ((CELL_WIDTH + GAP_WIDTH) * CELLS_ACROSS + GAP_WIDTH)
- #define BOARD_HEIGHT ((CELL_HEIGHT + GAP_HEIGHT) * CELLS_DOWN + GAP_WIDTH)
- #define WINDOW_WIDTH (BOARD_WIDTH + BORDER_LEFT + BORDER_RIGHT)
- #define WINDOW_HEIGHT (BOARD_HEIGHT + BORDER_TOP + BORDER_BOTTOM)
- #define XTRA_SPACING ((CELL_WIDTH * 4 + GAP_WIDTH * 3) / 5)
- #define XTRA_X (BORDER_LEFT + CELL_WIDTH * 4 + GAP_WIDTH * 5)
- #define XTRA_Y (BORDER_TOP - CELL_HEIGHT)
- /*}}}*/
- /*{{{ frame rate*/
- /* these are in uS, if it is too fast, the load line
- X * at the bottom will start to grow */
- #ifndef FRAME_RATE
- #define FRAME_RATE 37000
- #endif
- #define ZOOM_RATE (FRAME_RATE / 4)
- /*}}}*/
- /*{{{ font name*/
- #ifndef FONT_NAME
- #define FONT_NAME "-*-courier-*-r-*-*-18-*-*-*-*-*-*-*"
- #endif
- /*}}}*/
- /*{{{ game gender*/
- #ifndef GAME_GENDER
- #define GAME_GENDER (random() & 1)
- #endif
- /*}}}*/
- #define START_LIVES 3
- /*{{{ velocities*/
- #define VEL_X GAP_WIDTH /* how far we move per step */
- #define VEL_Y GAP_HEIGHT
- #define VEL_X_FAST (VEL_X * 5 / 4) /* how far a fast stride is */
- #define VEL_Y_FAST (VEL_Y * 5 / 4)
- #define FAST_STEPS (CELL_WIDTH / VEL_X / 4) /* how many fast strides */
- #define APPLE_VEL_Y (VEL_Y * 3 / 2) /* how fast the apple falls */
- #define APPLE_VEL_X (VEL_X / 2) /* how fast it goes sideways */
- #define APPLE_ACC (VEL_Y / 2)
- #define BALL_STEPS 2 /* relative ball speed */
- #define BALL_EX (CELL_WIDTH / 2) /* how fast we explode */
- #define BALL_EY (CELL_HEIGHT / 2)
- #define ZOOM_X VEL_X /* how fast the zoom is */
- #define ZOOM_Y VEL_Y
- /*}}}*/
- /*{{{ ball stuff*/
- #define BALL_EXPLODE (BOARD_WIDTH / BALL_EX) /* how much we explode */
- #define BALL_IMPLODE_PROB 4 /* that the ball returns */
- /*}}}*/
- #define DIE_DELAY 10 /* ticks for death spiral */
- #define SCORE_SHOW 45 /* how long on board scores show */
- #define DISPLAY_HOLD (SCORE_SHOW * 2)
- #define HISTORY_SHOW 3 /* how often we show the history */
- /*{{{ apple stuff*/
- #define APPLE_ROCK_DELAY 8 /* ticks for it to rock */
- #define APPLE_SPLIT_DELAY 8 /* ticks for split */
- #define APPLE_DECAY_DELAY 8 /* ticks for decay */
- #define APPLE_ROT_DELAY 8 /* ticks for rot */
- #define APPLE_FALL_SPLIT (CELL_HEIGHT + GAP_HEIGHT + APPLE_VEL_Y) /* safe fall distance */
- /*}}}*/
- /*{{{ den escape*/
- #define DEN_ESCAPE_PROB 8 /* normal monster gets out of the den */
- #define DEN_ESCAPE_DELAY 6 /* how many den flashes before escape */
- #define DEN_ESCAPE_FLASH 0x8 /* time per den flash */
- /*}}}*/
- /*{{{ normal & muncher*/
- #define GO_MUNCH_PROB 1 /* difficulty scale that normal goes munchy */
- #define DIFFICULTY_PEDESTAL 2 /* offset for difficulty */
- #define CONT_TOGGLE_PROB 2 /* continue flag toggle */
- #define PUSH_TURN_PROB 64 /* muncher turns around when pushing */
- #define GO_MUNCH_DELAY 16 /* pause when we start munching */
- #define STOP_MUNCH_DELAY 16 /* pause when we stop munching */
- /*}}}*/
- /*{{{ xtra & drone*/
- #define XTRA_INC_PROB 2 /* next xtra monster is selected */
- #define XTRA_BIRTH_DELAY ((CELL_WIDTH + GAP_WIDTH) / VEL_X + 4) /* pause while giving birth to drones */
- #define XTRA_CONT_OFF_PROB 16 /* that xtra stops continuing */
- #define NEXT_XTRA_PROB 1 /* probability that the extra changes */
- #define CHOMP_DELAY (CELL_WIDTH / VEL_X * 6) /* how long to eat an apple */
- /*}}}*/
- #define MONSTER_CYCLES 6 /* cycle counter */
- #define MONSTER_IMAGES 2 /* how many different images */
- /*{{{ limits*/
- #define INITIAL_APPLES 6
- #define APPLES (INITIAL_APPLES + 4) /* max number of apples */
- #define MONSTERS ((CELLS_DOWN - 2) * 2) /* maximum number of monsters */
- #define BOARD_SCORES 4 /* number of on board displayed scores */
- #define BACK_UPDATES 32 /* background updates we can cope with */
- /*}}}*/
- /*{{{ colour flags*/
- #define COLOUR_ZERO 0 /* colour is all zeros */
- #define COLOUR_ONE 1 /* colour is all ones */
- #define COLOUR_WEIRD 2 /* colour is neither zeros or ones */
- /*}}}*/
- /*}}}*/
- /*{{{ macros*/
- #define PIXELX(CX, OX) \
- X ((CX) * (CELL_WIDTH + GAP_WIDTH) + (OX) + GAP_WIDTH + BORDER_LEFT)
- #define PIXELY(CY, OY) \
- X ((CY) * (CELL_HEIGHT + GAP_HEIGHT) + (OY) + GAP_HEIGHT + BORDER_TOP)
- #define BOARDCELL(CX, CY) \
- X (&board[(CY) * CELL_STRIDE + (CX) + CELL_LEFT + CELL_TOP * CELL_STRIDE])
- /*}}}*/
- /*{{{ structs*/
- /*{{{ typedef struct Cell*/
- typedef struct Cell
- /* information about 1 cell on the board */
- {
- X int depths[4]; /* depths moved to from cell */
- X unsigned distance; /* distance from player */
- X unsigned visit : 1; /* has been visited */
- X unsigned sprite; /* has a sprite in it (cherry, or center stuff) */
- } CELL;
- /*}}}*/
- /*{{{ typedef struct Coord*/
- typedef struct Coord
- /* general coordinate store */
- {
- X int x;
- X int y;
- } COORD;
- /*}}}*/
- /*{{{ typedef struct Sprite*/
- typedef struct Sprite
- /* sprite definition */
- {
- X char *image_bits; /* image bitmap */
- X char *mask_bits; /* mask bitmap */
- X unsigned width; /* width of sprite */
- X unsigned height; /* height of sprite */
- X COORD expected; /* expected size */
- X unsigned copy; /* generated from this sprite */
- X unsigned reflect; /* reflection 1 = v axis, 2 = h axis */
- X Pixmap image; /* image pixmap */
- X Pixmap mask; /* mask pixmap */
- } SPRITE;
- /*}}}*/
- /*{{{ typedef struct Arg*/
- typedef struct Arg
- /* command line argument specifier */
- {
- X char const *arg; /* arg text */
- X int flag; /* switch or value */
- X void *ptr; /* value pointer */
- X char const *help; /* help message */
- } ARG;
- /*}}}*/
- /*{{{ typedef struct Board*/
- typedef struct Board
- /* initial board information */
- {
- X unsigned fill; /* fill pattern */
- X char map[CELLS_DOWN][CELLS_ACROSS];
- } BOARD;
- /*}}}*/
- /*{{{ typedef struct Background*/
- typedef struct Background
- /* area to update from back to copy to window */
- {
- X COORD place; /* top left area */
- X COORD size; /* size of area */
- } BACKGROUND;
- /*}}}*/
- /*{{{ typedef struct Score*/
- typedef struct Score
- /* on board score display */
- {
- X Pixmap mask; /* the mask to use */
- X Pixmap image; /* the image to display */
- X COORD place; /* where to bung it */
- X unsigned count; /* removal countdown */
- } SCORE;
- /*}}}*/
- /*{{{ typedef struct Ball*/
- typedef struct Ball
- /* the ball state */
- {
- X COORD cell;
- X COORD offset;
- X COORD pixel;
- X unsigned state; /* state of the ball
- X * 0 held by player
- X * 1 bouncing
- X * 2 exploding
- X * 3 exploded
- X * 4 imploding
- X */
- X unsigned count; /* count or direction or player type */
- X unsigned image; /* player image */
- } BALL;
- /*}}}*/
- /*{{{ typedef struct Apple*/
- typedef struct Apple
- /* non-background apple information */
- {
- X COORD cell; /* apple's cell */
- X COORD offset; /* offset from center */
- X COORD pixel; /* pixel for sprite */
- X int push; /* horizontal push */
- X unsigned count; /* general counter */
- X unsigned state; /* state
- X * 0 stationary
- X * 1 rock
- X * 2 falling
- X * 3 split
- X * 4 decay
- X * 5 rot
- X * 6 delete
- X */
- X unsigned distance; /* distance we've fallen */
- X unsigned monsters; /* monsters we've squashed */
- X unsigned chewed; /* chewed */
- X int maypush; /* temp push vector */
- X unsigned waspushed; /* was pushed the previous go */
- X struct Monster *list; /* list of monsters for initial fall */
- X COORD old_pixel; /* where i was */
- X unsigned old_state; /* what I looked like */
- } APPLE;
- /*}}}*/
- /*{{{ typedef struct Apple_Size*/
- typedef struct Apple_Size
- {
- X COORD size;
- X COORD offset;
- } APPLE_SIZE;
- /*}}}*/
- /*{{{ typedef struct Text*/
- typedef struct Text
- /* how we say text sizes */
- {
- X int ascent;
- X int descent;
- X int width;
- } TEXT;
- /*}}}*/
- /*{{{ typedef struct Monster*/
- typedef struct Monster
- /* monster information */
- {
- X COORD cell; /* board cell we're related to */
- X COORD offset; /* offset from this cell */
- X COORD pixel; /* pixel coordinate */
- X unsigned dir; /* direction we're moving in */
- X unsigned pause; /* we're paused for one */
- X unsigned stop; /* we're stopped (player only) */
- X unsigned type; /* type
- X * 0 - normal
- X * 1 - munch
- X * 2 - xtra
- X * 3 - drone
- X * 4 - player
- X * 5 - delete
- X *>5 - demo sprite
- X */
- X unsigned face; /* direction we're facing
- X * 0 up left,
- X * 1 down right
- X * 2 left
- X * 3 right
- X * 4 up right
- X * 5 down left
- X * 6 push left
- X * 7 push right
- X * 8 squish left
- X * 9 squish right
- X */
- X int push; /* being pushed in this direction */
- X unsigned gomunch; /* change munch state */
- X unsigned cont; /* continue */
- X unsigned chew; /* chewing */
- X unsigned count; /* counter */
- X unsigned shot; /* has been shot */
- X unsigned cycle; /* image cycler */
- X unsigned image; /* which image to display */
- X unsigned fast; /* fast speed */
- X unsigned pushing; /* pushing apple */
- X struct Monster *list; /* list of monsters for initial apple fall */
- X APPLE *apple; /* which apple we're stuck to */
- X COORD old_pixel; /* where we were */
- X int old_sprite; /* what we looked like */
- } MONSTER;
- /*}}}*/
- /*}}}*/
- /*{{{ display*/
- EXTERN struct
- {
- X char const *name; /* display name */
- X Display *display; /* server name stuff */
- X int screen; /* it's default screen */
- X Colormap colormap; /* color map for display */
- X Window root; /* its root window */
- X Window window; /* game window */
- X int depth; /* bitplanes */
- X unsigned long black; /* black pixel index */
- X unsigned long white; /* white pixel index */
- X unsigned long xor; /* black xor white */
- X Atom DEC_icon_atom; /* DEC iconizing hack */
- X unsigned long event_mask; /* default event mask */
- X Pixmap back; /* background store */
- X Pixmap copy; /* backing store */
- X Cursor cursor; /* cursor to use */
- X Pixmap icon; /* icon to use */
- X unsigned background; /* type of background colour */
- X unsigned foreground; /* type of foreground colour */
- } display;
- /*}}}*/
- /*{{{ font*/
- EXTERN struct
- {
- X char const *name; /* name of font */
- X Font font; /* font handle */
- } font;
- /*}}}*/
- EXTERN CELL board[(CELLS_DOWN + CELL_TOP * 2) * CELL_STRIDE];
- EXTERN Pixmap ball_xor;
- /*{{{ gc*/
- #define GCN(n) gcs[n]
- #define GC_COPY 0 /* src */
- #define GC_CLEAR 1 /* background */
- #define GC_SET 2 /* foreground */
- #define GC_MASK 3 /* NOT src AND dst */
- #define GC_OR 4 /* src OR dst */
- #define GC_BACK 5 /* background cutter */
- #define GC_BALL 6 /* XOR for the ball */
- #define GC_TEXT 7 /* text drawer */
- #define GC_AND 8 /* and */
- #define GC_BOARD 9 /* board background */
- #define GCS 10
- EXTERN GC gcs[GCS];
- /*}}}*/
- /*{{{ flags*/
- EXTERN struct
- {
- X unsigned reverse; /* reverse black & white */
- X unsigned bw; /* force black & white */
- X unsigned iconic; /* start iconic */
- X unsigned help; /* gimme some help */
- X unsigned gender; /* he or she? */
- } flags;
- /*}}}*/
- /*{{{ player*/
- SHAR_EOF
- true || echo 'restore of xmris.h failed'
- fi
- echo 'End of part 1'
- echo 'File xmris.h is continued in part 2'
- echo 2 > _shar_seq_.tmp
- exit 0
- --
- ---
- Senior Systems Scientist mail: dcmartin@msi.com
- Molecular Simulations, Inc. uucp: uunet!dcmartin
- 796 North Pastoria Avenue at&t: 408/522-9236
-