home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume12
/
acm
/
part06
< prev
next >
Wrap
Internet Message Format
|
1991-03-01
|
57KB
From: riley@mipsdal.mips.com (Riley Rainey)
Newsgroups: comp.sources.x
Subject: v12i011: acm - X aerial combat simulation, Part06/09
Message-ID: <8988@exodus.Eng.Sun.COM>
Date: 2 Mar 91 08:32:43 GMT
Approved: argv@sun.com
Submitted-by: riley@mipsdal.mips.com (Riley Rainey)
Posting-number: Volume 12, Issue 11
Archive-name: acm/part06
#! /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 6 (of 9)."
# Contents: acm/fsim/Makefile acm/fsim/doViews.c acm/fsim/newPlayer.c
# acm/fsim/pm.h
# Wrapped by riley@mipsdal on Thu Feb 14 10:09:19 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'acm/fsim/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'acm/fsim/Makefile'\"
else
echo shar: Extracting \"'acm/fsim/Makefile'\" \(12313 characters\)
sed "s/^X//" >'acm/fsim/Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
X
X###########################################################################
X# Makefile generated from "Imake.tmpl" and <Imakefile>
X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
X#
X# Platform-specific parameters may be set in the appropriate .cf
X# configuration files. Site-wide parameters may be set in the file
X# site.def. Full rebuilds are recommended if any parameters are changed.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit Mips.cf to change
X
X# platform: $XConsortium: Mips.cf,v 1.2 89/01/11 14:58:19 jim Exp $
X# operating system: RISCOS
X
X SYSVTYPE = -systype sysv
X BSDTYPE = -systype bsd43
X SYSVDEFS = -DMips -DSYSV
X BSDDEFS = -DMips -DBSD43
X SYSVINCS = -I$(DESTDIR)/usr/include/bsd
X BSDINCS =
X SYSVLIBS = -lbsd -lmld
X BSDLIBS = -lmld
X
X SYSTYPE = $(BSDTYPE)
X SYSDEFS = $(BSDDEFS)
X SYSINCS = $(BSDINCS)
X SYSLIBS = $(BSDLIBS)
X
X OPTIM = -O -Olimit 2000 -Wf,-XNd8400,-XNp12000
X CCOPT = -signed
X DEFINES = -D_NO_PROTO
XSYSVCFLAGS = $(OPTIM) $(CCOPT) $(SYSVTYPE) $(INCLUDES) $(SYSVDEFS) $(SYSVINCS) $(DEFINES)
X BSDCFLAGS = $(OPTIM) $(CCOPT) $(BSDTYPE) $(INCLUDES) $(BSDDEFS) $(BSDINCS) $(DEFINES)
X
X ETCDIR = /etc
X ULIBDIR = /usr/lib
X
X XINSTALLDIR = RISCwindows4.0
X INSTALLFLAGS = -m 0555
X RS1210DIR = $(DESTDIR)/usr/$(XINSTALLDIR)/RS1210
X CONTRIBBINDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/contrib/bin
XCONTRIBAPPSDEFDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/contrib/lib/app-defaults
X CONTRIBMANDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/contrib/man
X CONTRIBSRCDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/contrib/src
X RS1210LIBDIR = $(LIBDIR)/ncd
X
X BINPATH = /usr/bin/X11
X LIBPATH = /usr/lib/X11
X ETCPATH = /usr/etc/X11
X ADMPATH = /usr/adm
X NCDPATH = /usr/X11/ncd
X NCDLIBPATH = $(LIBPATH)/ncd
X XINITPATH = $(LIBPATH)/xinit
X XDMPATH = $(ETCPATH)/xdm
X UWMPATH = $(LIBPATH)/uwm
X AWMPATH = $(LIBPATH)/awm
X MWMPATH = $(LIBPATH)/mwm
X TWMPATH = $(LIBPATH)/twm
X XAPPLOADPATH = $(LIBPATH)/app-defaults
X RS1210SRC = $(TOP)/rs1210
X
X MOTIFSRC = $(TOP)/motif
X MLIBSRC = $(MOTIFSRC)/lib
X MCLIENTSRC = $(MOTIFSRC)/clients
X MDEMOSRC = $(MOTIFSRC)/demos
X MTOOLKITSRC = $(MOTIFSRC)/X11R4/lib/Xt
X MWIDGETSRC = $(MLIBSRC)/Xm
X INCLUDEXMSRC = $(MLIBSRC)/Xm
X MRESOURCESRC = $(MLIBSRC)/Mrm
X MWMDIR = $(LIBDIR)/Mwm
X DEMOBINDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/demos/bin
X DEMOSRCDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/demos/src
X MINCLUDE = $(TOP)/include
X UILSRC = $(MCLIENTSRC)/uil
X UIL = $(UILSRC)/uil
X
X XMTOOLLIB = $(MTOOLKITSRC)/libXt.a
X XMLIB = $(MWIDGETSRC)/libXm.a
X MRESOURCELIB = $(MRESOURCESRC)/libMrm.a
X UILLIB = $(UILSRC)/libUil.a
X
X BUILDTOOLSDIR = $(TOP)/buildtools
XCROSSENVOVERRIDE= DESTROOT=/ COMP_TARGET_ROOT=/ ETCDIR=/etc ULIBDIR=/usr/lib
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site: $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X SHELL = /bin/sh
X
X TOP = ../.
X CURRENT_DIR = ./fsim
X
X AR = ar clr
X BOOTSTRAPCFLAGS = $(SYSDEFS)
X CC = cc
X
X COMPRESS = compress
X CPP = /lib/cpp $(STD_CPP_DEFINES)
X PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
X INSTALL = $(ETCDIR)/mipsinstall
X LD = ld
X LINT = lint
X LINTLIBFLAG = -C
X LINTOPTS = -axz
X LN = ln -s
X MAKE = make ETCDIR='$(ETCDIR)' ULIBDIR='$(ULIBDIR)'
X MV = mv
X CP = cp
X RANLIB = /bin/true
X RANLIBINSTFLAGS =
X RM = rm -f
X STD_INCLUDES =
X STD_CPP_DEFINES = $(SYSDEFS)
X STD_DEFINES = $(SYSDEFS) $(SYSINCS)
X EXTRA_LOAD_FLAGS =
X EXTRA_LIBRARIES = $(SYSLIBS)
X TAGS = ctags
X
X SIGNAL_DEFINES = -DSIGNALRETURNSINT
X
X PROTO_DEFINES =
X
X INSTPGMFLAGS =
X
X INSTBINFLAGS = -m 0755
X INSTUIDFLAGS = -m 4755
X INSTLIBFLAGS = -m 0664
X INSTINCFLAGS = -m 0444
X INSTMANFLAGS = -m 0444
X INSTDATFLAGS = -m 0444
X INSTKMEMFLAGS = -g sys -m 2755
X
X DESTDIR = $(DESTROOT)
X
X TOP_INCLUDES = -I$(INCROOT)
X
X CDEBUGFLAGS = $(OPTIM) $(CCOPT) $(SYSTYPE)
X CCOPTIONS =
X COMPATFLAGS =
X
X ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) $(EXT_DEFINES)
X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X LDCOMBINEFLAGS = -X -r
X
X MACROFILE = Mips.cf
X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut *.u *.b
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###########################################################################
X# X Window System Build Parameters
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X###########################################################################
X# X Window System make variables; this need to be coordinated with rules
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X PATHSEP = /
X USRLIBDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/lib
X BINDIR = $(DESTDIR)/usr/$(XINSTALLDIR)/bin
X INCROOT = $(DESTDIR)/usr/$(XINSTALLDIR)/include
X BUILDINCROOT = $(TOP)
X BUILDINCDIR = $(BUILDINCROOT)/X11
X BUILDINCTOP = ..
X INCDIR = $(INCROOT)/X11
X ADMDIR = $(DESTDIR)/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 = $(DESTDIR)/usr/X11/etc/xdm
X AWMDIR = $(LIBDIR)/awm
X TWMDIR = $(LIBDIR)/twm
X GWMDIR = $(LIBDIR)/gwm
X MANPATH = $(DESTDIR)/usr/$(XINSTALLDIR)/man/cat
X MANSOURCEPATH = $(MANPATH)/man
X MANDIR = $(MANSOURCEPATH)1
X LIBMANDIR = $(MANSOURCEPATH)3
X XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X FONTCFLAGS = -t
X
X INSTAPPFLAGS = $(INSTDATFLAGS)
X
X IMAKE = imake
X DEPEND = makedepend
X RGB = rgb
X FONTC = bdftosnf
X MKFONTDIR = mkfontdir
X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
X
X CONFIGSRC = $(TOP)/config
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 MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X EXTENSIONSRC = $(TOP)/extensions
X
X DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
X EXTENSIONLIB = -lXext
X
X DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
X XLIB = $(EXTENSIONLIB) -lX11
X
X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X XAUTHLIB = -lXau
X
X DEPXMULIB = $(USRLIBDIR)/libXmu.a
X XMULIB = -lXmu
X
X DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
X OLDXLIB = -loldX
X
X DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
X XTOOLLIB = -lXt
X
X DEPXAWLIB = $(USRLIBDIR)/libXaw.a
X XAWLIB = -lXaw
X
X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
X LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
X LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
X LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
X LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
X
X DEPLIBS = $(LOCAL_LIBRARIES)
X
X DEPLIBS1 = $(DEPLIBS)
X DEPLIBS2 = $(DEPLIBS)
X DEPLIBS3 = $(DEPLIBS)
X
X###########################################################################
X# Imake rules for building libraries, programs, scripts, and data files
X# rules: $XConsortium: Imake.rules,v 1.70 90/05/04 16:57:30 keith Exp $
X
X###########################################################################
X# start of Imakefile
X
XCDEBUGFLAGS = -systype bsd43 -O
X
XCDEBUGFLAGS = -systype bsd43 $(STD_INCLUDES) -O
XXLIB = -lX11
X
XSRCS1= server.c pm.c flaps.c droneCalc.c init.c aim9m.c\
X m61a1.c weapon.c newPlayer.c newPlane.c missile.c\
X missileCalc.c update.c doEvents.c getStick.c\
X damage.c panel.c doViews.c\
X doRadar.c placeCraft.c transpose.c doScale.c
XOBJS1= server.o pm.o flaps.o droneCalc.o init.o aim9m.o\
X m61a1.o weapon.o newPlayer.o newPlane.o missile.o\
X missileCalc.o update.o doEvents.o getStick.o\
X damage.o panel.o doViews.o\
X doRadar.o placeCraft.o transpose.o doScale.o
XDEPLIBS1= ../V/lib/libV.a
X
XSRCS2= acm.c
XOBJS2= acm.o
XDEPLIBS2=
X
XSRCS3= V2tgif.c
XOBJS3= V2tgif.o
XDEPLIBS3= ../V/lib/libV.a
X
XPROGRAMS= acm acms v2tgif
XSTD_INCLUDES= -I../V/lib
X
XLOCAL_LIBRARIES= ../V/lib/libV.a
XSYS_LIBRARIES= -lm $(XLIB)
X
XOBJS= $(OBJS1) $(OBJS2) $(OBJS3)
XSRCS= $(SRCS1) $(SRCS2) $(SRCS3)
X
Xall:: $(PROGRAMS)
X
Xacms: $(OBJS1) $(DEPLIBS1)
X $(RM) $@
X $(CC) -o $@ $(OBJS1) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
Xclean::
X $(RM) acms
X
Xinstall:: acms
X $(INSTALL) -c -s $(INSTPGMFLAGS) acms $(BINDIR)
X
Xacm: $(OBJS2) $(DEPLIBS2)
X $(RM) $@
X $(CC) -o $@ $(OBJS2) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
Xclean::
X $(RM) acm
X
Xinstall:: acm
X $(INSTALL) -c -s $(INSTPGMFLAGS) acm $(BINDIR)
X
Xacm.1:: acm.man
X nroff -man $? > $@
X
Xall:: acm.1
X
Xclean::
X rm -f acm.1
X
Xinstall.man:: acm.1
X $(INSTALL) -c $(INSTMANFLAGS) -f acm.1 $(MANDIR)/acm.1
X
Xv2tgif: $(OBJS3) $(DEPLIBS3)
X $(RM) $@
X $(CC) -o $@ $(OBJS3) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
Xclean::
X $(RM) v2tgif
X
Xdepend::
X $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
Xlint:
X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
Xlint1:
X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
Xinstall:: install.man
X
Xtar:
X tar cv acm acms f16 mig23 aim-9 rwy rwy2 tower mtn bullet
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X $(RM_CMD) \#*
X
XMakefile::
X -@if [ -f Makefile ]; then \
X echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X else exit 0; fi
X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
Xtags::
X $(TAGS) -w *.[ch]
X $(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X @echo "install in $(CURRENT_DIR) done"
X
Xinstall.man::
X @echo "install.man in $(CURRENT_DIR) done"
X
XMakefiles::
X
Xincludes::
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 12313 -ne `wc -c <'acm/fsim/Makefile'`; then
echo shar: \"'acm/fsim/Makefile'\" unpacked with wrong size!
fi
# end of 'acm/fsim/Makefile'
fi
if test -f 'acm/fsim/doViews.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'acm/fsim/doViews.c'\"
else
echo shar: Extracting \"'acm/fsim/doViews.c'\" \(12851 characters\)
sed "s/^X//" >'acm/fsim/doViews.c' <<'END_OF_FILE'
X/*
X * xflight : an aerial combat simulator for X
X *
X * Written by Riley Rainey, riley@mips.com
X *
X * Permission to use, copy, modify and distribute (without charge) this
X * software, documentation, images, etc. is granted, provided that this
X * comment and the author's name is retained.
X *
X */
X
X#include "pm.h"
X#include <math.h>
X#include <stdio.h>
X
Xextern char *ItoA();
Xextern void doDroneRadar(), doTEWS();
Xextern void placeCraft();
Xextern void doScale(), doCompassScale();
X
X#define lim ((double) -1052500.0)
X
X#define MAXPOLYGONS 8192
X
Xstatic VPolygon *poly[MAXPOLYGONS];
X
Xstatic craft *sortList;
X
Xvoid insertCraft();
X
Xvoid doViews() {
X
X int polyCount;
X register unsigned long curPixel;
X register craft *c, *p;
X register int i, j, k;
X register viewer *q;
X VPoint vp, fwd, up;
X VPoint horiz[4];
X int mono;
X
X/*
X * Build a vector of polygons for all objects in the scene.
X *
X * This vector should be ordered from "most distant" to "closest" so that
X * the final display will end up correct. Rather than generalizing this
X * to death, we'll use a few heuristics to get very close to what we need:
X *
X * (0) Build a single polygon to represent the ground.
X * (1) Objects on the surface (stbl) are collected first.
X * (2) Planes and projectiles (ptbl and mtbl) are first sorted in descending
X * order by their distance from the observer and then polygons are
X * collected.
X */
X
X
X for ((i=0, c=ptbl); i<MAXPLAYERS; (++i, ++c)) {
X
X if (c->type == CT_DRONE)
X doDroneRadar (c);
X
X if (c->type != CT_PLANE)
X continue;
X
X/*
X * Set up the eyespace transformation for this viewpoint
X */
X
X VTransform (&c->cinfo->viewPoint, &(c->trihedral), &vp);
X vp.x += c->Sg.x;
X vp.y += c->Sg.y;
X vp.z += c->Sg.z;
X
X VTransform (&c->viewDirection, &(c->trihedral), &fwd);
X fwd.x += vp.x;
X fwd.y += vp.y;
X fwd.z += vp.z;
X
X VTransform (&c->viewUp, &(c->trihedral), &up);
X up.x += vp.x;
X up.y += vp.y;
X up.z += vp.z;
X
X VGetEyeSpace (c->vl->v, vp, fwd, up);
X
X polyCount = 0;
X sortList = (craft *) NULL;
X
X horiz[0].x = c->Sg.x - lim;
X horiz[0].y = c->Sg.y - lim;
X horiz[0].z = 0.0;
X horiz[1].x = c->Sg.x - lim;
X horiz[1].y = c->Sg.y + lim;
X horiz[1].z = 0.0;
X horiz[2].x = c->Sg.x + lim;
X horiz[2].y = c->Sg.y + lim;
X horiz[2].z = 0.0;
X horiz[3].x = c->Sg.x + lim;
X horiz[3].y = c->Sg.y - lim;
X horiz[3].z = 0.0;
X
X poly[0] = VCreatePolygon (4, &horiz[0], groundColor);
X polyCount = 1;
X
X for ((j=0, p=stbl); j<MAXSURFACE; (++j, ++p)) {
X if (p->type != CT_FREE)
X insertCraft (c, p);
X }
X
X for ((j=0, p=ptbl); j<MAXPLAYERS; (++j, ++p)) {
X if (p->type != CT_FREE && p != c) {
X insertCraft (c, p);
X }
X }
X
X for ((j=0, p=mtbl); j<MAXPROJECTILES; (++j, ++p)) {
X if (p->type != CT_FREE)
X insertCraft (c, p);
X }
X
X for (p=sortList; p != (craft *) NULL; p=(craft *)p->next)
X placeCraft (p, poly, &polyCount);
X
X/*
X * Clip all polygons
X */
X
X for (j=0; j<polyCount; ++j) {
X VTransformPolygon (poly[j], &(c->vl->v->eyeSpace));
X poly[j] = VClipPolygon(poly[j], c->vl->v->clipPoly);
X }
X
X/*
X * Display this image for each viewer associated with this craft
X */
X
X for (q=c->vl; q != NULL; q = q->next) {
X
X mono = q->v->flags & VPMono;
X curPixel = -1;
X for (j=0; j<polyCount; ++j) {
X if (poly[j]) {
X if (mono == 0 &&
X curPixel != (k=q->v->pixel[poly[j]->color->index]))
X {
X XSetForeground (q->dpy, q->gc, k);
X curPixel = k;
X }
X if (mono)
X VDrawPolygon (q->v, q->win, q->gc, poly[j]);
X else
X VFillPolygon (q->v, q->win, q->gc, poly[j]);
X }
X
X }
X
X/* Draw Head-Up Display and instrument panel */
X
X doHUD(c, q);
X doRadar (c, q);
X doTEWS (c, q); /* doRadar must be called first */
X doRPM(c, q);
X doPanel (c,q);
X
X/* Expose the completed drawing */
X
X VExposeBuffer (q->v, q->gc);
X
X/*
X * Erase the un-displayed planes.
X */
X
X if (mono == 0) {
X curPixel = *(q->v->pixel);
X XSetForeground (q->dpy, q->gc, curPixel);
X#ifdef USE_PIXMAP_ANIMATION
X if (q->v->flags & VPPixmap)
X XFillRectangle (q->dpy, q->v->monoPixmap, q->gc,
X 0, 0, q->v->width, q->v->height);
X else
X#endif
X XFillRectangle (q->dpy, q->win, q->gc,
X 0, 0, q->width, q->height);
X }
X
X }
X
X/*
X * Release polygons
X */
X
X for (j=0; j<polyCount; ++j)
X if (poly[j])
X VDestroyPolygon (poly[j]);
X
X }
X}
X
X/*
X * insertCraft : Insert a craft into sortList in descending order.
X */
X
Xvoid insertCraft (c, p)
Xcraft *c, *p; {
X
X double dist, offset;
X VPoint ds;
X craft *q, *prev;
X
X/*
X * Here's a kludge for you: to avoid polygon clipping, I'm going to
X * cheat and hack a way to get ground objects to display properly.
X * if the Z coordinate of an object is zero (i.e. on ground objects),
X * I'll add a huge offset to their distance values to force them to be
X * plotted first -- and in roughly their correct drawing order.
X *
X */
X
X offset = (p->Sg.z == 0.0) ? 1000.0 * NM : 0.0;
X
X ds.x = p->Sg.x - c->Sg.x;
X ds.y = p->Sg.y - c->Sg.y;
X ds.z = p->Sg.z - c->Sg.z;
X p->order = dist = mag (ds) + offset;
X
X if (sortList != (craft *) NULL) {
X for ((q=sortList, prev=(craft *) NULL); q != (craft *) NULL;) {
X if (q->order < dist) {
X p->next = (struct _craft *) q;
X if (prev == (craft *) NULL)
X sortList = p;
X else
X prev->next = (struct _craft *) p;
X break;
X }
X prev = q;
X q = (craft *) q->next;
X }
X if (q == (craft *) NULL) {
X prev->next = (struct _craft *) p;
X p->next = (struct _craft *) NULL;
X }
X }
X else {
X sortList = p;
X p->next = (struct _craft *) NULL;
X }
X}
X
Xint doHUD (c, u)
Xcraft *c;
Xviewer *u; {
X
X char buffer[80];
X int i, x, x1, y;
X Drawable d;
X
X d = (u->v->flags & VPMono) ? (Drawable) u->v->monoPixmap :
X (Drawable) u->win;
X
X if (c->viewDirection.x < 0.90)
X return 0;
X XSetFont (u->dpy, u->gc, u->font->fid);
X if (u->v->flags & VPMono)
X XSetForeground (u->dpy, u->gc,
X BlackPixel(u->v->dpy, u->v->screen));
X else
X XSetForeground (u->dpy, u->gc, u->v->pixel[HUDPixel]);
X sprintf (buffer, "a=%.1f", RADtoDEG(c->alpha));
X x = 730 * u->width / VIEW_WINDOW_WIDTH;
X y = 130 * u->height / VIEW_WINDOW_HEIGHT;
X XDrawString (u->dpy, d, u->gc, x, y, buffer, strlen(buffer));
X
X x1 = 410 * u->width / VIEW_WINDOW_WIDTH;
X sprintf (buffer, "%4.1f", c->G.z);
X XDrawString (u->dpy, d, u->gc, x1, y, buffer, strlen(buffer));
X
X y = 390 * u->height / VIEW_WINDOW_HEIGHT;
X sprintf (buffer, "%7d", (int)(-c->Cg.z * 60.0));
X XDrawString (u->dpy, d, u->gc, x, y, buffer, strlen(buffer));
X
X x = 410 * u->width / VIEW_WINDOW_WIDTH;
X doCompassScale (u->dpy, d, u->gc, &(u->hdgScale), RADtoDEG(c->curHeading)*100.0,
X u->fth, u->ftw);
X doScale (u->dpy, d, u->gc, &(u->altScale), -c->Sg.z, u->fth, u->ftw);
X doScale (u->dpy, d, u->gc, &(u->velScale), FPStoKTS(mag(c->Cg)),
X u->fth, u->ftw);
X
X sprintf (buffer, "%3d%% %s", (int)((double)c->throttle/327.68),
X (c->flags & FL_AFTERBURNER) ? "AB" : "");
X XDrawString (u->dpy, d, u->gc, x, y, buffer, strlen(buffer));
X
X x = 380 * u->width / VIEW_WINDOW_WIDTH;
X y = 420 * u->height / VIEW_WINDOW_HEIGHT;
X
X doLadder (c, u);
X
X for (i=0; i<3; ++i) {
X XDrawString (u->dpy, d, u->gc, x, y, c->leftHUD[i],
X strlen (c->leftHUD[i]));
X y += u->fth;
X }
X
X return 0;
X
X}
X
X
Xint doLadder (c, u)
Xcraft *c;
Xviewer *u;{
X
X double x = c->curPitch, cx, s;
X double sinP, cosP, pixelsPerDegree;
X XSegment seg[24];
X XRectangle rect[1];
X int i, rung, windX, windY, w, tx, ty;
X char buf[16];
X VPoint tmp;
X Drawable d;
X
X double L_half_width = 90.0 * u->scaleFactor;
X double L_end = 25.0 * u->scaleFactor;
X double L_major_tick_interval = 10.0;
X double L_major_tick_height = 90.0 * u->scaleFactor;
X
X d = (u->v->flags & VPMono) ? (Drawable) u->v->monoPixmap :
X (Drawable) u->win;
X
X rect[0].x = u->xCenter - (int) (125.0 * u->scaleFactor + 0.5);
X rect[0].y = u->yCenter - (int) (110.0 * u->scaleFactor + 0.5);
X rect[0].width = 250.0 * u->scaleFactor + 0.5;
X rect[0].height = 220.0 * u->scaleFactor + 0.5;
X
X s = ((int)(RADtoDEG(x)) / 10 * 10) - 20;
X rung = s;
X
X pixelsPerDegree = L_major_tick_height / L_major_tick_interval;
X cx = (RADtoDEG(x) - s) * pixelsPerDegree;
X sinP = cos(c->curRoll);
X cosP = sin(c->curRoll);
X for (i=0; i<5; ++i, cx -= L_major_tick_height, rung +=10) {
X seg[i*2].x1 = L_half_width * sinP + cx * cosP + u->xCenter;
X seg[i*2].y1 = -L_half_width * cosP + cx * sinP + u->yCenter;
X seg[i*2].x2 = L_end * sinP + cx * cosP + u->xCenter;
X seg[i*2].y2 = -L_end * cosP + cx * sinP + u->yCenter;
X seg[i*2+1].x1 = -L_end * sinP + cx * cosP + u->xCenter;
X seg[i*2+1].y1 = L_end * cosP + cx * sinP + u->yCenter;
X seg[i*2+1].x2 = -L_half_width * sinP + cx * cosP + u->xCenter;
X seg[i*2+1].y2 = L_half_width * cosP + cx * sinP + u->yCenter;
X sprintf (buf, "%d", rung);
X if (seg[i*2].x1 >= rect[0].x && seg[i*2].x1 <
X rect[0].x+rect[0].width &&
X seg[i*2].y1 >= rect[0].y && seg[i*2].y1 <
X rect[0].y+rect[0].height)
X XDrawString (u->dpy, d, u->gc,
X seg[i*2].x1 + 2, seg[i*2].y1 + 5,
X buf, strlen(buf));
X }
X
X i = i * 2;
X
X XSetClipRectangles (u->dpy, u->gc, 0, 0, rect, 1, YXBanded);
X
X/*
X * Determine the location of the flight path marker
X */
X
X VTransform (&c->Cg, &c->Itrihedral, &tmp);
X if (mag(c->Cg) == 0.0 || tmp.x == 0.0) {
X windX = u->xCenter;
X windY = u->yCenter;
X }
X else {
X windX = u->xCenter + tmp.y * u->v->Scale.x / tmp.x + 0.5;
X windY = u->yCenter + tmp.z * u->v->Scale.y / tmp.x + 0.5;
X }
X
X seg[i].x1 = windX - 18;
X seg[i].y1 = windY;
X seg[i].x2 = windX - 9;
X seg[i++].y2 = windY;
X
X seg[i].x1 = windX + 18;
X seg[i].y1 = windY;
X seg[i].x2 = windX + 9;
X seg[i++].y2 = windY;
X
X seg[i].x1 = windX;
X seg[i].y1 = windY - 9;
X seg[i].x2 = windX;
X seg[i++].y2 = windY - 15;
X
X/*
X * Gether weapon display info (and maybe draw a reticle).
X */
X
X doWeaponDisplay (c, u);
X
X/*
X * Draw a target designator around the current primary radar target.
X */
X
X if (c->curRadarTarget >= 0) {
X
X w = DESIGNATOR_SIZE * u->height / VIEW_WINDOW_HEIGHT * 0.5;
X
X VTransform (&(ptbl[c->curRadarTarget].Sg),
X &u->v->eyeSpace, &tmp);
X
X/* radar target is assumed to be ahead of us (tmp.z > 0.0) */
X
X tx = u->v->Middl.x + tmp.x * u->v->Scale.x / tmp.z;
X ty = u->v->Middl.y - tmp.y * u->v->Scale.y / tmp.z;
X
X seg[i].x1 = tx - w;
X seg[i].y1 = ty - w;
X seg[i].x2 = tx + w;
X seg[i++].y2 = ty - w;
X
X seg[i].x1 = tx + w;
X seg[i].y1 = ty - w;
X seg[i].x2 = tx + w;
X seg[i++].y2 = ty + w;
X
X seg[i].x1 = tx + w;
X seg[i].y1 = ty + w;
X seg[i].x2 = tx - w;
X seg[i++].y2 = ty + w;
X
X seg[i].x1 = tx - w;
X seg[i].y1 = ty + w;
X seg[i].x2 = tx - w;
X seg[i++].y2 = ty - w;
X }
X
X XDrawSegments (u->dpy, d, u->gc, seg, i);
X XDrawArc (u->dpy, d, u->gc, u->xCenter-2, u->yCenter-2, 4, 4, 0, 360*64);
X XDrawArc (u->dpy, d, u->gc, windX-8, windY-8, 16, 16, 0, 360*64);
X
X XSetClipMask (u->dpy, u->gc, None);
X
X return 0;
X}
X
Xint doRPM (c, u)
Xcraft *c;
Xviewer *u;{
X
X int x, y, x1, y1, len, i;
X double percent, p;
X char s[32], s1[32];
X
X x = ENG_X * u->width / FS_WINDOW_WIDTH;
X y = ENG_Y * u->width / FS_WINDOW_WIDTH;
X len = (eng_x_hot - 6)* u->width / FS_WINDOW_WIDTH;
X
X XSetForeground (u->dpy, u->gc, u->v->flags & VPMono ?
X WhitePixel(u->v->dpy, u->v->screen) :
X u->v->pixel[whitePixel]);
X XSetBackground (u->dpy, u->gc, u->v->flags & VPMono ?
X BlackPixel(u->v->dpy, u->v->screen) :
X u->v->pixel[blackPixel]);
X XCopyPlane (u->dpy, u->eng, u->win, u->gc, 0, 0, eng_width,eng_height,
X x - eng_x_hot, y - eng_y_hot, 1);
X
X if (isFunctioning (c, SYS_ENGINE1))
X percent = (double) c->throttle / 32768.0 * 100.0;
X else
X percent = 0.0;
X if (percent < 60.0) {
X p = (60.0 - percent) / 120.0 * pi;
X x1 = x + len * cos(p);
X y1 = y - len * sin(p);
X }
X else {
X p = (percent - 60.0) / 40.0 * pi;
X x1 = x + len * cos(p);
X y1 = y + len * sin(p);
X }
X
X XDrawLine (u->dpy, u->win, u->gc, x, y, x1, y1);
X
X/*
X * Print Fuel and Fuel consumption rate
X */
X
X XSetBackground (u->dpy, u->gc, BlackPixel(u->v->dpy, u->v->screen));
X
X sprintf (s, "%7s lbs Total", ItoA ((int) c->fuel, s1));
X XDrawImageString (u->dpy, u->win, u->gc, x-30, y+68, s, strlen(s));
X sprintf (s, "%7s lbs/hour", ItoA ((int) (fuelUsed(c)*3600.0/deltaT), s1));
X XDrawImageString (u->dpy, u->win, u->gc, x-30, y+68+u->fth, s, strlen(s));
X
X/*
X * Display Flap Setting
X */
X
X if (c->flapSetting > DEGtoRAD(29.0))
X i=3;
X else if (c->flapSetting > DEGtoRAD(19.0))
X i=2;
X else if (c->flapSetting > DEGtoRAD(9.0))
X i=1;
X else
X i=0;
X
X x = FLAP_X * u->width / FS_WINDOW_WIDTH;
X y = FLAP_Y * u->width / FS_WINDOW_WIDTH;
X
X XCopyPlane (u->dpy, u->flap[i], u->win, u->gc, 0, 0, flaps0_width,
X flaps0_height, x, y, 1);
X sprintf (s, "Flaps: %d", (int) RADtoDEG(c->curFlap));
X XDrawImageString (u->dpy, u->win, u->gc, x+flaps0_x_hot, y+flaps0_y_hot,
X s, strlen(s));
X
X return 0;
X}
END_OF_FILE
if test 12851 -ne `wc -c <'acm/fsim/doViews.c'`; then
echo shar: \"'acm/fsim/doViews.c'\" unpacked with wrong size!
fi
# end of 'acm/fsim/doViews.c'
fi
if test -f 'acm/fsim/newPlayer.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'acm/fsim/newPlayer.c'\"
else
echo shar: Extracting \"'acm/fsim/newPlayer.c'\" \(13579 characters\)
sed "s/^X//" >'acm/fsim/newPlayer.c' <<'END_OF_FILE'
X/*
X * xflight : an aerial combat simulator for X
X *
X * Written by Riley Rainey, riley@mips.com
X *
X * Permission to use, copy, modify and distribute (without charge) this
X * software, documentation, images, etc. is granted, provided that this
X * comment and the author's name is retained.
X *
X */
X
X#include "pm.h"
X#include <stdio.h>
X#include <X11/Xutil.h>
X#ifndef hpux
X#include <X11/Xos.h>
X#endif
X#include <X11/cursorfont.h>
X
X#define BORDER 1
X
X#ifdef dec
X#define FONT "courier_18"
X#else
X#if SunOSPlatform
X#define FONT "9x15"
X#else
X#define FONT "*courier-bold-r-normal--17*"
X#endif
X#endif
X
X#define ARG_FONT "font"
X#define ARG_RADAR_FONT "radarFont"
X#define ARG_BORDER_COLOR "borderColor"
X#define ARG_BORDER "borderWidth"
X#define ARG_GEOMETRY "geometry"
X#define DEFAULT_BACKGROUND "#93bde4" /* my version of sky blue */
X#define DEFAULT_BORDER "black"
X#define DEFAULT_RADAR_FONT "fixed"
X
X#define SW_BORDER 1
X#define SW_BACKGROUND 2
X#define SW_HUDFONT 3
X#define SW_GEOM 4
X#define SW_RADARFONT 5
X#define SW_TEAM 6
X#define SW_OBSERVE 7
X
Xstruct {
X char *sw;
X int value;
X } swt[] = {
X "-bw", SW_BORDER,
X "-skycolor", SW_BACKGROUND,
X "-hudfont", SW_HUDFONT,
X "-radarfont",SW_RADARFONT,
X "-geometry", SW_GEOM,
X "-team", SW_TEAM,
X "-chase", SW_OBSERVE,
X NULL, 0}, *swp;
X
Xvoid recoverAcmArgv (args, argc, argv)
Xchar *args;
Xint *argc;
Xchar *argv[]; {
X
X char *s;
X
X argv[0] = ACM;
X argv[1] = args;
X
X if (*args == '\0') {
X *argc = 1;
X argv[1] = (char *) NULL;
X return;
X }
X else
X *argc = 2;
X
X for (s=args; *s;) {
X if (*s == '|') {
X *s = '\0';
X argv[(*argc)++] = ++s;
X }
X else
X ++s;
X }
X
X argv[*argc] = (char *) NULL;
X}
X
Xint newPlayer(s, display, logname, switches)
Xint s;
Xchar *display;
Xchar *logname;
Xchar *switches; {
X
X char *fontName; /* Name of font for string */
X XSizeHints xsh; /* Size hints for window manager */
X Colormap cmap;
X GC curGC;
X XGCValues gcv;
X unsigned long pad; /* Font size parameters */
X unsigned long bd; /* Pixel values */
X unsigned long bw; /* Border width */
X char *tempstr; /* Temporary string */
X XColor color; /* Temporary color */
X char *geomSpec; /* Window geometry string */
X XSetWindowAttributes xswa; /* Temporary Set Window Attribute struct */
X XWMHints xwmh; /* Window manager hints */
X Cursor cursor;
X char **c;
X char err[64];
X static char *background = NULL;
X int borderWidth = -1;
X int player;
X viewer *u;
X craft *cf;
X double scale;
X int argc;
X char *argv[32];
X int screen, mono;
X char *hudfont = NULL, *radarfont = NULL;
X int team = 1;
X char *plane; /* name of plane type */
X int observer = -1;
X
X recoverAcmArgv (switches, &argc, argv);
X
X geomSpec = NULL;
X u = (viewer *) malloc (sizeof(viewer));
X
X/*
X * Parse command line
X */
X
X for (c = &argv[1]; *c != (char *) NULL; ++c)
X if (**c == '-') {
X for (swp = &swt[0]; swp->value != 0; ++swp)
X if (strcmp (swp->sw, *c) == 0) {
X
X switch (swp->value) {
X
X case SW_GEOM:
X geomSpec = *(++c);
X break;
X
X case SW_BORDER:
X borderWidth = atoi (*(++c));
X break;
X
X case SW_BACKGROUND:
X background = *(++c);
X break;
X
X case SW_HUDFONT:
X hudfont = *(++c);
X break;
X
X case SW_RADARFONT:
X radarfont = *(++c);
X break;
X
X case SW_TEAM:
X team = atoi (*(++c));
X break;
X
X case SW_OBSERVE:
X observer = atoi (*(++c));
X break;
X }
X break;
X }
X if (swp->value == 0) {
X free ((char *) u);
X sprintf (err, "%s: invalid switch %s", ACM, *c);
X write (s, err, strlen(err));
X exit (1);
X }
X }
X
X if (team == 1)
X plane = "f-16c";
X else
X plane = "mig-23";
X
X if ((player = newPlane (plane)) < 0) {
X sprintf (err, "Sorry, acm is popular -- no room for \
Xany more players at this moment.\n");
X write (s, err, strlen(err));
X return -1;
X }
X
X/*
X * assign a (kludged) team location.
X */
X
X if (team == 2) {
X ptbl[player].Sg.x = -0.6 * NM + 110.0;
X ptbl[player].Sg.y = 49.0 * NM;
X }
X
X if ((u->dpy = XOpenDisplay(display)) == (Display *) NULL) {
X free ((char *) u);
X ptbl[player].type = CT_FREE;
X sprintf(err, "%s: can't open %s\n", ACM, display);
X write (s, err, strlen(err));
X return -1;
X }
X screen = DefaultScreen (u->dpy);
X mono = (DisplayPlanes (u->dpy, screen) == 1) ? 1 : 0;
X
X if (hudfont)
X fontName = hudfont;
X else if ((fontName = XGetDefault(u->dpy, ACM, ARG_FONT)) == NULL) {
X fontName = FONT;
X }
X if ((u->font = XLoadQueryFont(u->dpy, fontName)) == NULL) {
X XCloseDisplay (u->dpy);
X free ((char *) u);
X ptbl[player].type = CT_FREE;
X sprintf(err, "%s: display %s doesn't know font %s\n",
X ACM, display, fontName);
X write (s, err, strlen(err));
X return -1;
X }
X u->fth = u->font->max_bounds.ascent + u->font->max_bounds.descent;
X u->ftw = u->font->max_bounds.width;
X
X if (radarfont)
X fontName = radarfont;
X else if ((fontName = XGetDefault(u->dpy, ACM, ARG_RADAR_FONT)) == NULL) {
X fontName = DEFAULT_RADAR_FONT;
X }
X if ((u->rfont = XLoadQueryFont(u->dpy, fontName)) == NULL) {
X XCloseDisplay (u->dpy);
X free ((char *) u);
X ptbl[player].type = CT_FREE;
X sprintf(err, "%s: display %s doesn't know font %s\n",
X ACM, display, fontName);
X write (s, err, strlen(err));
X return -1;
X }
X u->rfth = u->rfont->max_bounds.ascent + u->rfont->max_bounds.descent;
X u->rftw = u->rfont->max_bounds.width;
X
X/*
X * Select colors for the border, the window background, and the
X * foreground. We use the default colormap to allocate the colors in.
X */
X
X cmap = DefaultColormap(u->dpy, screen);
X
X if (background == NULL)
X background = DEFAULT_BACKGROUND;
X
X if ((tempstr = XGetDefault(u->dpy, ACM, ARG_BORDER_COLOR)) == NULL)
X tempstr = DEFAULT_BORDER;
X if (XParseColor(u->dpy, cmap, tempstr, &color) == 0) {
X XCloseDisplay (u->dpy);
X free ((char *) u);
X ptbl[player].type = CT_FREE;
X sprintf (err, "Can't get border color %s\n", tempstr);
X write (s, err, strlen(err));
X return -1;
X }
X
X if (mono)
X bd = BlackPixel (u->dpy, screen);
X else {
X if (XAllocColor(u->dpy, cmap, &color) == 0) {
X XCloseDisplay (u->dpy);
X free ((char *) u);
X ptbl[player].type = CT_FREE;
X sprintf (err, "Cannot allocate color cells\n");
X write (s, err, strlen(err));
X return -1;
X }
X bd = color.pixel;
X }
X
X/*
X * Set the border width of the window, and the gap between the text
X * and the edge of the window, "pad".
X */
X
X pad = BORDER;
X if (borderWidth >= 0)
X bw = borderWidth;
X else if ((tempstr = XGetDefault(u->dpy, ACM, ARG_BORDER)) == NULL)
X bw = 1;
X else
X bw = atoi(tempstr);
X
X/*
X * Deal with providing the window with an initial position & size.
X * Fill out the XSizeHints struct to inform the window manager.
X */
X
X if (geomSpec == NULL)
X geomSpec = XGetDefault(u->dpy, ACM, ARG_GEOMETRY);
X
X/*
X * If the defaults database doesn't contain a specification of the
X * initial size & position - fit the window to the text and locate
X * it in the center of the screen.
X */
X
X if (geomSpec == NULL) {
X xsh.flags = PPosition | PSize;
X xsh.height = FS_WINDOW_HEIGHT;
X xsh.width = FS_WINDOW_WIDTH;
X xsh.x = (DisplayWidth(u->dpy, screen) - xsh.width) / 2;
X xsh.y = (DisplayHeight(u->dpy, screen) - xsh.height) / 2;
X }
X else {
X int bitmask;
X
X bzero((char *) &xsh, sizeof(xsh));
X bitmask = XGeometry(u->dpy, screen, geomSpec, geomSpec,
X bw, u->ftw, u->fth, pad, pad, &(xsh.x), &(xsh.y),
X &(xsh.width), &(xsh.height));
X if (bitmask & (XValue | YValue)) {
X xsh.flags |= USPosition;
X }
X if (bitmask & (WidthValue | HeightValue)) {
X xsh.flags |= USSize;
X }
X }
X
X/*
X * Create the Window with the information in the XSizeHints, the
X * border width, and the border & background pixels.
X */
X
X u->win = XCreateSimpleWindow(u->dpy, DefaultRootWindow(u->dpy),
X xsh.x, xsh.y, xsh.width, xsh.height,
X bw, bd, bd);
X
X scale = (double) xsh.width / (double) FS_WINDOW_WIDTH;
X
X/*
X * Create a pixmap of the engine RPM gauge and flap indicators.
X */
X
X u->eng = XCreateBitmapFromData (u->dpy, u->win, eng_bits, eng_width,
X eng_height);
X u->flap[0] = XCreateBitmapFromData (u->dpy, u->win, flaps0_bits,
X flaps0_width, flaps0_height);
X u->flap[1] = XCreateBitmapFromData (u->dpy, u->win, flaps1_bits,
X flaps1_width, flaps1_height);
X u->flap[2] = XCreateBitmapFromData (u->dpy, u->win, flaps2_bits,
X flaps2_width, flaps2_height);
X u->flap[3] = XCreateBitmapFromData (u->dpy, u->win, flaps3_bits,
X flaps3_width, flaps3_height);
X
X/*
X * Set the standard properties and hints for the window managers.
X */
X
X XSetStandardProperties(u->dpy, u->win, ACM, ACM, None, argv, argc, &xsh);
X xwmh.flags = InputHint | StateHint;
X xwmh.input = True;
X xwmh.initial_state = NormalState;
X XSetWMHints(u->dpy, u->win, &xwmh);
X cursor = XCreateFontCursor (u->dpy, XC_tcross);
X XDefineCursor (u->dpy, u->win, cursor);
X
X xsh.width = RADAR_WINDOW_WIDTH * scale;
X xsh.height = RADAR_WINDOW_HEIGHT * scale;
X xsh.x = RADAR_X * scale;
X xsh.y = RADAR_Y * scale;
X u->rwin = XCreateWindow (u->dpy, u->win, xsh.x, xsh.y, xsh.width,
X xsh.height, 0, CopyFromParent, CopyFromParent, CopyFromParent,
X 0, NULL);
X
X/*
X * Ensure that the window's colormap field points to the default
X * colormap, so that the window manager knows the correct colormap to
X * use for the window. Also, set the window's Bit
X * Gravity to reduce Expose events.
X */
X
X xswa.colormap = DefaultColormap(u->dpy, screen);
X xswa.bit_gravity = NorthWestGravity;
X XChangeWindowAttributes(u->dpy, u->win, (CWColormap | CWBitGravity), &xswa);
X
X/*
X * Create the GC for drawing the picture.
X */
X
X gcv.font = u->font->fid;
X curGC = XCreateGC(u->dpy, u->win, GCFont, &gcv);
X XSelectInput(u->dpy, u->win, KeyPressMask | ButtonPressMask |
X StructureNotifyMask | ButtonReleaseMask);
X
X/*
X * Fill-in the viewer structure
X */
X
X cf = &ptbl[player];
X cf->team = player;
X cf->vl = u;
X strncpy (cf->name, logname, sizeof (cf->name));
X strncpy (cf->display, display, sizeof (cf->display));
X u->next = (viewer *) NULL;
X u->width = VIEW_WINDOW_WIDTH * scale;
X u->height = VIEW_WINDOW_HEIGHT * scale;
X u->xCenter = u->width / 2;
X u->yCenter = u->height / 2;
X
X u->radarWidth = RADAR_WINDOW_WIDTH * scale;
X u->radarHeight = RADAR_WINDOW_HEIGHT * scale;
X u->gc = curGC;
X
X u->TEWSx = TEWS_X * scale;
X u->TEWSy = TEWS_Y * scale;
X u->TEWSSize = TEWS_SIZE * scale;
X u->scaleFactor = scale;
X
X#ifdef USE_PIXMAP_ANIMATION
X if (mono == 0)
X usePixmaps = 1;
X#endif
X
X u->v = VOpenViewport (u->dpy, screen, u->win,
X 12.0*25.4/1000.0, 0.5, scale * 0.70, u->width, u->height);
X
X if (VBindColors (u->v, background) < 0) {
X XCloseDisplay (u->dpy);
X free ((char *) u);
X ptbl[player].type = CT_FREE;
X sprintf (err, "Error in binding colors.\n");
X write (s, err, strlen(err));
X return -1;
X }
X
X/*
X * Fill in the scale structures for the airspeed/altitude HUD scales.
X */
X
X u->altScale.xorg = ALT_ORG_X * scale;
X u->altScale.yorg = ALT_ORG_Y * scale;
X u->altScale.length = ALT_LENGTH * scale;
X u->altScale.orientation = ALT_ORIENT;
X u->altScale.scale = ALT_SCALE / scale;
X u->altScale.minorInterval = ALT_MIN_INTERVAL;
X u->altScale.minorSize = ALT_MIN_SIZE * scale;
X u->altScale.majorInterval = ALT_MAJ_INTERVAL;
X u->altScale.majorSize = ALT_MAJ_SIZE * scale;
X u->altScale.indexSize = ALT_INDEX_SIZE * scale;
X u->altScale.divisor = ALT_DIVISOR;
X u->altScale.format = ALT_FORMAT;
X
X u->velScale.xorg = VEL_ORG_X * scale;
X u->velScale.yorg = VEL_ORG_Y * scale;
X u->velScale.length = VEL_LENGTH * scale;
X u->velScale.orientation = VEL_ORIENT;
X u->velScale.scale = VEL_SCALE / scale;
X u->velScale.minorInterval = VEL_MIN_INTERVAL;
X u->velScale.minorSize = VEL_MIN_SIZE * scale;
X u->velScale.majorInterval = VEL_MAJ_INTERVAL;
X u->velScale.majorSize = VEL_MAJ_SIZE * scale;
X u->velScale.indexSize = VEL_INDEX_SIZE * scale;
X u->velScale.divisor = VEL_DIVISOR;
X u->velScale.format = VEL_FORMAT;
X
X u->hdgScale.xorg = HDG_ORG_X * scale;
X u->hdgScale.yorg = HDG_ORG_Y * scale;
X u->hdgScale.length = HDG_LENGTH * scale;
X u->hdgScale.orientation = HDG_ORIENT;
X u->hdgScale.scale = HDG_SCALE / scale;
X u->hdgScale.minorInterval = HDG_MIN_INTERVAL;
X u->hdgScale.minorSize = HDG_MIN_SIZE * scale;
X u->hdgScale.majorInterval = HDG_MAJ_INTERVAL;
X u->hdgScale.majorSize = HDG_MAJ_SIZE * scale;
X u->hdgScale.indexSize = HDG_INDEX_SIZE * scale;
X u->hdgScale.divisor = HDG_DIVISOR;
X u->hdgScale.format = HDG_FORMAT;
X
X/*
X * Map the window to make it visible.
X */
X
X XMapWindow(u->dpy, u->win);
X XMapWindow(u->dpy, u->rwin);
X if (mono == 0) {
X register int curPixel;
X
X VExposeBuffer (u->v, u->gc);
X curPixel = *(u->v->pixel);
X XSetForeground (u->dpy, u->gc, curPixel);
X XFillRectangle (u->dpy, u->win, u->gc, 0, 0, u->width, u->height);
X }
X
X whitePixel = whiteColor->index;
X blackPixel = blackColor->index;
X HUDPixel = HUDColor->index;
X
X return 0;
X
X}
X
Xint killPlayer (c)
Xcraft *c; {
X
X viewer *v, *vn;
X int i;
X
X/*
X * Erase our radar emissions
X */
X
X for (i=0; i<MAXPLAYERS; ++i)
X ptbl[i].rval[c->index] = 0.0;
X
X/*
X * Free HUD string storage
X */
X
X if (c->leftHUD[0] != (char *) NULL)
X for (i=0; i<3; ++i) {
X free (c->leftHUD[i]);
X free (c->rightHUD[i]);
X }
X
X/*
X * Close viewers' display
X */
X
X for (v=c->vl; v != (viewer *) NULL;) {
X XCloseDisplay (v->dpy);
X vn = (viewer *) v->next;
X free ((char *) v);
X v = vn;
X }
X
X if (c->flags && FL_RECORD)
X -- recordCount;
X
X c->type = CT_FREE;
X return 0;
X}
END_OF_FILE
if test 13579 -ne `wc -c <'acm/fsim/newPlayer.c'`; then
echo shar: \"'acm/fsim/newPlayer.c'\" unpacked with wrong size!
fi
# end of 'acm/fsim/newPlayer.c'
fi
if test -f 'acm/fsim/pm.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'acm/fsim/pm.h'\"
else
echo shar: Extracting \"'acm/fsim/pm.h'\" \(13242 characters\)
sed "s/^X//" >'acm/fsim/pm.h' <<'END_OF_FILE'
X#include "manifest.h"
X#include "eng.xbm"
X#include "flaps0.xbm"
X#include "flaps1.xbm"
X#include "flaps2.xbm"
X#include "flaps3.xbm"
X#include "scale.h"
X#include "damage.h"
X#include <Vlib.h>
X
X#define MAXSURFACE 8
X#define MAXPLAYERS 16
X#define MAXPROJECTILES MAXPLAYERS*8
X#define MAXCRAFTTYPES 16
X#define STATIONS 9
X#define WEAPONTYPES 4
X
Xtypedef struct _viewer {
X struct _viewer *next;
X Display *dpy; /* display for this user */
X Window win; /* window for this user */
X Window twin, rwin; /* threat window and radar window */
X GC gc; /* GC for drawing */
X XFontStruct *font; /* HUD font */
X XFontStruct *rfont; /* radar font */
X Viewport *v; /* Viewport for out-of-cockpit views */
X Pixmap eng; /* Engine "RPM" gauge */
X Pixmap flap[5]; /* flap setting indicators */
X int cn; /* X connection fd */
X int width, height; /* width & height of viewing window */
X int xCenter, yCenter; /* center of viewing window */
X int ftw, fth; /* HUD font width & height */
X int rftw, rfth;
X int radarWidth;
X int radarHeight;
X scaleControl altScale; /* altitude scale control */
X scaleControl velScale; /* airspeed scale control */
X scaleControl hdgScale; /* heading scale control */
X int TEWSx, TEWSy; /* location of center of TEWS display */
X int TEWSSize; /* size of TEWS display, in pixels */
X double scaleFactor; /* overall scaling factor for display */
X } viewer;
X
X/*
X * This structure describes a class of aircraft.
X */
X
Xtypedef struct {
X char *name; /* name of aircraft class */
X
X double aspectRatio; /* wing aspect ratio */
X
X double CLOrigin, CLSlope; /* Defines the CL characteristic eqn */
X double CLNegStall, CLPosStall;
X double betaStall; /* Stall angle for rudder */
X double CDOrigin, CDFactor; /* Defines the CD Characteristic eqn */
X double (*CDi)(); /* compute zero lift induced drag coefficient */
X double CDPhase;
X double CDBOrigin, CDBFactor; /* Defines the CD Characteristic eqn */
X double CDBPhase;
X double CLbeta; /* coefficient rolling moment due to sideslip */
X double CMOrigin, CMFactor; /* Defines the CM Characteristic eqn */
X double CNOrigin, CNFactor; /* Defines the CM Characteristic eqn */
X double CYbeta; /* Side-force from side-slip (dCY/dBeta) */
X
X double effAileron; /* Aileron effectiveness */
X double effElevator; /* Elevator effectiveness */
X double effRudder; /* Rudder effectiveness */
X
X VMatrix I; /* Moments of Intertia about CG in [xyz] */
X double LDamp; /* roll damping factor */
X double MDamp; /* pitch damping factor */
X double NDamp; /* yaw damping factor */
X double cmSlope;
X double cmFactor;
X double cnSlope;
X double cnFactor;
X
X double maxFlap; /* maximum flap setting (radians) */
X double cFlap; /* lift coefficient of flaps */
X double cFlapDrag; /* drag coefficient of lowered flaps */
X double flapRate; /* flap movement rate (radians/sec) */
X
X double maxSpeedBrake; /* maximum speed brake setting (radians) */
X double cSpeedBrake; /* drag coefficient of 90 degree speed brake */
X double speedBrakeRate; /* rate of speed brake movement (radians/sec) */
X double speedBrakeIncr; /* number of radians than one keystroke moves brake */
X
X double wingS; /* wing area (ft^2) */
X double emptyWeight; /* empty weight (lbs.) */
X double maxFuel; /* maximum internal fuel (lbs.) */
X
X double maxThrust; /* maximum thrust, military power (lb) */
X double maxABThrust; /* maximum thrust, afterburner on (lb) */
X double spFuelConsump; /* specific fuel consump(lb fuel/lb T x hr)*/
X double spABFuelConsump;
X VPoint groundingPoint; /* hypothetical single pt of contact w/ground */
X VPoint viewPoint; /* pilot's viewing location wrt CG */
X double crashC; /* maximum tolerable touchdown z component */
X
X double muStatic; /* static coefficient of friction no-brakes */
X double muKinetic; /* moving coefficient of friction no-brakes */
X double muBStatic; /* static brakes-on */
X double muBKinetic; /* kinetic brakes-on */
X
X double maxNWDef; /* maximum nosewheel deflection (radians) */
X double NWIncr; /* deflection for each unit */
X double maxNWS; /* maximum NWS velocity */
X double gearD1; /* x station wrt nose gear of main gear */
X double gearD2; /* x station wrt CG of main gear */
X double armDelay; /* arming delay for missiles */
X
X long damageBits; /* initial bit mask of damaged systems */
X long structurePts; /* maximum structural damage */
X
X double radarOutput; /* radar output (watts) */
X double radarTRange; /* tracking radar range */
X double radarDRange; /* detection radar range */
X double TEWSThreshold;
X
X int sCount; /* number of weapon stations */
X VPoint wStation[STATIONS]; /* weapon's stations (launch points) */
X
X int (*placeProc)(); /* object placement procedure (for special craft) */
X VObject *object; /* what it looks like */
X } craftType;
X
Xtypedef struct _wdsc {
X int mask; /* key mask */
X int (*select)(); /* weapon select procedure */
X int (*update)(); /* per tick update procedure */
X int (*display)(); /* display update procedure */
X int (*firePress)(); /* fire button pressed procedure */
X int (*fireRelease)(); /* fire button released */
X craftType *w; /* description of this weapon */
X } weaponDesc;
X
Xtypedef struct _wctl {
X int type; /* type of weapon at this station */
X int info; /* extra info (weapon specific) */
X int info2; /* " " */
X int info3; /* " " */
X } weaponStation;
X
X#define WK_M61A1 0x01 /* M-61A1 Vulcan 20mm cannon */
X#define WK_AIM9M 0x02 /* Sidewinder missile */
X
X/*
X * This structure describes a particular instance of aircraft.
X */
X
Xtypedef struct _craft {
X int index; /* index number of this element in the vector */
X int type; /* craft type */
X int team; /* team number */
X double createTime; /* creation time of this craft */
X viewer *vl; /* list of viewers */
X VMatrix trihedral; /* transforms [x, y, z] to Geoparallel */
X /* x = forward, y=right wing, z=down */
X /* does not include origin translation */
X VMatrix Itrihedral; /* transforms geoparallel to [x, y, z] */
X VPoint C; /* Velocity vector in [x, y, z] */
X VPoint Cg; /* Velocity vector in Geoparallel system */
X VPoint Sg; /* Position in Geoparallel system */
X double rho; /* current rho value */
X double mach1; /* current value of mach 1.0 (fps) */
X double mach; /* current mach number */
X VPoint G; /* g-force vector in acft system */
X VPoint prevSg; /* last interval's Sg value */
X double p, q, r; /* roll, pitch, and yaw rates */
X double Se, Sa, Sr; /* control settings */
X double curHeading, curPitch, curRoll; /* Euler angles for acft */
X double curThrust; /* Current thrust value */
X double curFlap; /* current flap setting (radians) */
X double flapSetting; /* current target flap setting (radians) */
X double curSpeedBrake; /* current speed brake position (radians) */
X double speedBrakeSetting; /* current target speed brake setting (radians) */
X int throttle; /* thrust setting 0 - 32768 */
X double alpha, beta; /* angles of attack and sideslip */
X double fuel; /* current fuel on board */
X int groundContact; /* 1, when on ground */
X int flags; /* flag word */
X
X long damageBits; /* bit flags of damaged subsystems */
X long structurePts; /* damage pts that can be absorbed */
X double leakRate; /* fuel leakage rate (lbs/second) */
X double damageCL; /* damage induced roll */
X double damageCM; /* damage induced pitch */
X
X int radarMode; /* radar mode */
X double curNWDef; /* Current nosewheel deflection (radians) */
X int armFuse; /* missile arming countdown */
X craftType *cinfo; /* General craft information */
X double order; /* temporary value used to sort craft */
X struct _craft *next; /* next craft in sorted list */
X VPoint viewDirection; /* where the pilot is currently looking */
X VPoint viewUp; /* the "up" direction of the pilot's view */
X
X char name[32]; /* logname of player */
X char display[32]; /* display name of player */
X
X short curRadarTarget; /* our primary "threat" */
X double targetDistance; /* distance to primary target */
X double targetClosure; /* closure rate on primary target */
X short relValid[MAXPLAYERS];
X VPoint relPos[MAXPLAYERS];
X double rval[MAXPLAYERS];/* radar strength seen by us from other craft */
X /* relative positions of possible targets */
X char *leftHUD[3]; /* strings in lower left corner of HUD */
X /* (reserved for weapons' status */
X char *rightHUD[3]; /* strings in lower right corner of HUD */
X /* (reserved for future use) */
X int curWeapon; /* index of currently selected weapon */
X weaponStation station[STATIONS]; /* what's at each weapon station */
X } craft;
X
X/*
X * We'll use some defines to reduce the storage required for the craft
X * (unions would be cleaner, perhaps).
X */
X
X#define rounds curRadarTarget
X#define tracerMod groundContact
X#define tracerVal radarMode
X#define owner curWeapon
X
X/*
X * Craft type definitions
X */
X
X#define CT_FREE 0 /* an unused craft entry */
X#define CT_PLANE 1 /* a player */
X#define CT_MISSILE 2 /* an air to air missile */
X#define CT_CANNON 3 /* a stream of cannon fire */
X#define CT_SURFACE 4 /* surface object (e.g. a runway) */
X#define CT_OBSERVER 5 /* a non-player "watcher" */
X#define CT_DRONE 6 /* a target drone */
X
X#define FL_RECORD 0x01 /* activate recording function */
X#define FL_AFTERBURNER 0x02 /* afterburner state */
X#define FL_BRAKES 0x04 /* wheel brake state */
X#define FL_NWS 0x08 /* nose-wheel steering mode */
X#define FL_HAS_GYRO 0x10 /* missile is gyroscope equiped */
X
X#define RM_OFF 0 /* radar is off */
X#define RM_STANDBY 1 /* standby */
X#define RM_GUN_DIRECTOR 2 /* gun director mode */
X#define RM_HUD 3 /* 20 degree scan */
X#define RM_NORMAL 4 /* 65 degree scan */
X
Xint recordCount; /* number of players recording info */
Xdouble curTime; /* current time */
X
Xcraft stbl[MAXSURFACE]; /* table of surface objects */
Xcraft ptbl[MAXPLAYERS]; /* table of player aircraft */
Xcraft mtbl[MAXPROJECTILES]; /* table of missiles and cannon streams */
XweaponDesc wtbl[WEAPONTYPES]; /* descriptions of different weapons */
X
Xdouble deltaT; /* Update interval in seconds */
Xdouble halfDeltaTSquared; /* 0.5 * deltaT * deltaT */
Xint HUDPixel; /* index of HUD color in viewport(s) */
XVColor *HUDColor;
Xint whitePixel; /* index of white in viewport(s) */
XVColor *whiteColor; /* white in viewport(s) */
Xint blackPixel; /* index of black in viewport(s) */
XVColor *blackColor; /* black in viewport(s) */
XVColor *groundColor; /* ground color in viewport(s) */
X
X#define a 32.15 /* acceleration due to gravity (fps^2) */
X#define pi 3.1415927
X#define mag(v) (sqrt (v.x * v.x + v.y * v.y + v.z * v.z))
X#define calcAplha(p) (atan2 (p.C.z, p.C.x))
X#define calcBeta(p) (atan2 (p.C.y, sqrt (pow (mag(p.C), 2.0) \
X + p.C.y * p.C.y)))
X#define unitVector(v) {double m; m = mag(v); \
X v.x /= m; v.y /= m; v.z /= m; }
X
X#define addHeading(c, dh) {c->curHeading = c->curHeading + dh; \
X if (c->curHeading > pi * 2.0 || c->curHeading <= 0.0) \
X c->curHeading = (c->curHeading <= 0.0) ? c->curHeading + \
X 2.0 * pi : c->curHeading - 2.0 * pi; }
X
X#define NM 6076.115
X#define FPStoMPH(v) (v / 5280.0 * 3600.0)
X#define FPStoKTS(v) (v / 6076.115 * 3600.0)
X#define RADtoDEG(a) (a * 180.0 / pi)
X#define DEGtoRAD(a) (a * pi / 180.0)
X#define fsign(d) (d < 0 ? -1.0 : 1.0)
X#define calcThrust(c) ((((c->flags & FL_AFTERBURNER) ? \
X c->cinfo->maxABThrust : c->cinfo->maxThrust) - \
X c->cinfo->maxThrust * (1.0 - (c->rho / 0.002377))) * \
X pow ((double) c->throttle / 32768.0, 2.0))
X#define fuelUsed(c) (((c->flags & FL_AFTERBURNER) ? \
X c->cinfo->spABFuelConsump : c->cinfo->spFuelConsump) * c->curThrust * \
X deltaT / 3600.0)
X
X#define VIEW_WINDOW_HEIGHT 500
X#define VIEW_WINDOW_WIDTH 1200
X#define RADAR_WINDOW_WIDTH 200
X#define RADAR_WINDOW_HEIGHT 200
X#define RADAR_X (1200/2-200/2)
X#define RADAR_Y (500)
X#define TEWS_X (1200/2-200/2-100)
X#define TEWS_Y (VIEW_WINDOW_HEIGHT+60)
X#define TEWS_SIZE 81
X#define FS_WINDOW_WIDTH (VIEW_WINDOW_WIDTH)
X#define FS_WINDOW_HEIGHT (VIEW_WINDOW_HEIGHT+RADAR_WINDOW_HEIGHT)
X#define FLAP_X (1200/2-200/2-95)
X#define FLAP_Y (FS_WINDOW_HEIGHT-53)
X#define DESIGNATOR_SIZE 40
X#define PANEL_X (200)
X#define PANEL_Y (RADAR_Y+50)
X
X/*
X * Location of the center of the engine RPM gauge.
X */
X
X#define ENG_X (FS_WINDOW_WIDTH-400)
X#define ENG_Y (VIEW_WINDOW_HEIGHT+60)
X
X#define ALT_ORG_X 760
X#define ALT_ORG_Y 360
X#define ALT_LENGTH 199
X#define ALT_ORIENT orientRight
X#define ALT_SCALE (1700.0 / (double) ALT_LENGTH)
X#define ALT_INDEX_SIZE 30
X#define ALT_MIN_INTERVAL 100
X#define ALT_MIN_SIZE 8
X#define ALT_MAJ_INTERVAL 500
X#define ALT_MAJ_SIZE 15
X#define ALT_DIVISOR 1000.0
X#define ALT_FORMAT "%4.3g"
X
X#define VEL_ORG_X 440
X#define VEL_ORG_Y 360
X#define VEL_LENGTH ALT_LENGTH
X#define VEL_ORIENT 0
X#define VEL_SCALE (170.0 / (double) VEL_LENGTH)
X#define VEL_INDEX_SIZE 30
X#define VEL_MIN_INTERVAL 10
X#define VEL_MIN_SIZE 8
X#define VEL_MAJ_INTERVAL 50
X#define VEL_MAJ_SIZE 15
X#define VEL_DIVISOR 10.0
X#define VEL_FORMAT "%3.3g"
X
X#define HDG_ORG_X (VIEW_WINDOW_WIDTH / 2 - (6*30+1) / 2)
X#define HDG_ORG_Y 400
X#define HDG_LENGTH (6*30+1)
X#define HDG_ORIENT 0
X#define HDG_SCALE (3000.0 / (double) VEL_LENGTH)
X#define HDG_INDEX_SIZE 10
X#define HDG_MIN_INTERVAL 500
X#define HDG_MIN_SIZE 5
X#define HDG_MAJ_INTERVAL 1000
X#define HDG_MAJ_SIZE 10
X#define HDG_DIVISOR 1000.0
X#define HDG_FORMAT "%2.2g"
END_OF_FILE
if test 13242 -ne `wc -c <'acm/fsim/pm.h'`; then
echo shar: \"'acm/fsim/pm.h'\" unpacked with wrong size!
fi
# end of 'acm/fsim/pm.h'
fi
echo shar: End of archive 6 \(of 9\).
cp /dev/null ark6isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 9 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
Riley Rainey Internet: riley@mips.com
MIPS Computer Systems Phone: +1 214 770-7979
Dallas, Texas