v12i012: acm - X aerial combat simulation, Part07/09
Riley Rainey
riley at mipsdal.mips.com
Sat Mar 2 19:32:47 AEST 1991
Submitted-by: riley at mipsdal.mips.com (Riley Rainey)
Posting-number: Volume 12, Issue 12
Archive-name: acm/part07
#! /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 7 (of 9)."
# Contents: acm/Makefile acm/V/Makefile acm/fsim/m61a1.c
# Wrapped by riley at mipsdal on Thu Feb 14 10:09:20 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'acm/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'acm/Makefile'\"
else
echo shar: Extracting \"'acm/Makefile'\" \(14158 characters\)
sed "s/^X//" >'acm/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 = .
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
XSUBDIRS= V fsim
X
Xall::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) CDEBUFLAGS='$(CDEBUGFLAGS)' all); \
X done
X
Xdepend::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) depend); \
X done
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X $(RM_CMD) \#*
X
XMakefile::
X - at 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# rules for building in SUBDIRS - do not edit
X
Xinstall::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \
X done
X
Xinstall.man::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \
X done
X
Xclean::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \
X done
X
Xtags::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "tagging" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags); \
X done
X
XMakefiles::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \
X case "$$i" in \
X ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \
X ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \
X ./?*/?*) newtop=../../ sub=subsub;; \
X ./?*) newtop=../ sub=sub;; \
X */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \
X */?*/?*) newtop=../../../ sub=subsubsub;; \
X */?*) newtop=../../ sub=subsub;; \
X *) newtop=../ sub=sub;; \
X esac; \
X case "$(TOP)" in \
X /?*) newtop= upprefix= ;; \
X *) upprefix=../ ;; \
X esac; \
X $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \
X MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\
X done
X
XsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
XsubsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
XsubsubsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
XsubsubsubsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
Xincludes::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo including "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) includes); \
X done
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 14158 -ne `wc -c <'acm/Makefile'`; then
echo shar: \"'acm/Makefile'\" unpacked with wrong size!
fi
# end of 'acm/Makefile'
fi
if test -f 'acm/V/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'acm/V/Makefile'\"
else
echo shar: Extracting \"'acm/V/Makefile'\" \(14160 characters\)
sed "s/^X//" >'acm/V/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 = ./V
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
XSUBDIRS= lib
X
Xall::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) CDEBUFLAGS='$(CDEBUGFLAGS)' all); \
X done
X
Xdepend::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) depend); \
X done
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X $(RM_CMD) \#*
X
XMakefile::
X - at 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# rules for building in SUBDIRS - do not edit
X
Xinstall::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \
X done
X
Xinstall.man::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \
X done
X
Xclean::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \
X done
X
Xtags::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo "tagging" "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags); \
X done
X
XMakefiles::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \
X case "$$i" in \
X ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \
X ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \
X ./?*/?*) newtop=../../ sub=subsub;; \
X ./?*) newtop=../ sub=sub;; \
X */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \
X */?*/?*) newtop=../../../ sub=subsubsub;; \
X */?*) newtop=../../ sub=subsub;; \
X *) newtop=../ sub=sub;; \
X esac; \
X case "$(TOP)" in \
X /?*) newtop= upprefix= ;; \
X *) upprefix=../ ;; \
X esac; \
X $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \
X MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\
X done
X
XsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
XsubsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
XsubsubsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
XsubsubsubsubdirMakefiles:
X $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
X - at if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
X echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
X $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
X else exit 0; fi
X cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
X $(MAKE) $(MFLAGS) Makefiles
X
Xincludes::
X @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X for i in $(SUBDIRS) ;\
X do \
X (cd $$i ; echo including "in $(CURRENT_DIR)/$$i..."; \
X $(MAKE) $(MFLAGS) includes); \
X done
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 14160 -ne `wc -c <'acm/V/Makefile'`; then
echo shar: \"'acm/V/Makefile'\" unpacked with wrong size!
fi
# end of 'acm/V/Makefile'
fi
if test -f 'acm/fsim/m61a1.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'acm/fsim/m61a1.c'\"
else
echo shar: Extracting \"'acm/fsim/m61a1.c'\" \(14922 characters\)
sed "s/^X//" >'acm/fsim/m61a1.c' <<'END_OF_FILE'
X/*
X * xflight : an aerial combat simulator for X
X *
X * Written by Riley Rainey, riley at 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 <string.h>
X#include <math.h>
X
X#define BORE_CROSS_SIZE 7
X#define MUZZLE_VELOCITY (3.2808 * 1036.0)
X#define TRACER_MOD 10
X#define OFFSET_ANGLE (DEGtoRAD(3.0)) /* the gun points up at this angle */
X#define RATE_OF_FIRE (3000.0 / 60.0) /* rounds per second */
X#define FUZZ (DEGtoRAD(1.0)) /* distribution due to vibration */
X
Xint select_m61a1();
Xint display_m61a1();
Xint update_m61a1();
Xint press_m61a1();
Xint release_m61a1();
Xextern craftType * lookupCraft();
Xextern FILE * acm_fopen();
Xvoid lcos();
X
Xint cdebug = 0; /* set to 1 to debug cannon fire */
X
XweaponDesc m61a1Desc = {
X WK_M61A1,
X select_m61a1, /* select */
X update_m61a1, /* update */
X display_m61a1, /* display procedure */
X press_m61a1, /* fire */
X release_m61a1, /* fire button release */
X };
X
X/*
X * We'll take a running average of our pitch and yaw rates to keep the
X * aiming reticle from jumping all over the screen.
X */
X
X#define HIST 4
X
Xtypedef struct {
X double pitch_hist[HIST];
X double yaw_hist[HIST];
X int cur; /* current entry in the histories */
X int count; /* number of valid entries */
X double pitch_total;
X double yaw_total;
X } hist_t;
X
Xstatic hist_t history[MAXPLAYERS];
X
X/*
X * m61a1 selection function
X *
X * A selection function normally determines whether there are any weapons
X * of this type on-board. If so, and the weapon system is functional
X * (in other words, undamaged) then return 1; otherwise return 0.
X */
X
Xint select_m61a1 (c)
Xcraft *c; {
X
X hist_t *p;
X
X p = &history[c->index];
X p->count = p->cur = 0;
X p->pitch_total = p->yaw_total = 0.0;
X
X if (c->station[0].type == WK_M61A1 && c->station[0].info > 0)
X return 1;
X else
X return 0;
X
X}
X
X/*
X * m61a1 display function
X *
X * Update the HUD display strings associated with this weapon system.
X */
X
X/*ARGSUSED*/
Xint display_m61a1 (c, w, u)
Xcraft *c;
XcraftType *w;
Xviewer *u; {
X
X char s[16];
X register int tx, ty, m;
X XSegment seg[2];
X Drawable d;
X hist_t *p;
X
X p = &history[c->index];
X if ((m = p->cur = p->cur + 1) >= HIST)
X m = p->cur = 0;
X if (p->count != HIST)
X (p->count) ++;
X else {
X p->pitch_total -= p->pitch_hist[m];
X p->yaw_total -= p->yaw_hist[m];
X }
X p->pitch_hist[m] = c->q;
X p->yaw_hist[m] = c->r;
X p->pitch_total += c->q;
X p->yaw_total += c->r;
X
X d = (u->v->flags & VPMono) ? (Drawable) u->v->monoPixmap :
X (Drawable) u->win;
X
X strcpy (c->leftHUD[0], "LCOS");
X sprintf (s, "%.3d M-61A1", c->station[0].info);
X strcpy (c->leftHUD[1], s);
X if (c->station[0].info3)
X strcpy (c->leftHUD[2], "FIRING");
X else
X strcpy (c->leftHUD[2], "");
X
X/*
X * Draw the boresight cross
X */
X
X m = (double) BORE_CROSS_SIZE * (double) u->width /
X (double) VIEW_WINDOW_WIDTH + 0.5;
X
X tx = u->xCenter;
X ty = u->yCenter - 3 * 9; /* kludged, for now */
X seg[0].x1 = tx - m;
X seg[0].x2 = tx + m;
X seg[0].y1 = seg[0].y2 = ty;
X seg[1].x1 = seg[1].x2 = tx;
X seg[1].y1 = ty - m;
X seg[1].y2 = ty + m;
X XDrawSegments (u->dpy, d, u->gc, seg, 2);
X
X/*
X * Plot the reticle.
X */
X
X lcos (c, u);
X
X}
X
Xint press_m61a1 (c)
Xcraft *c; {
X c->station[0].info3 |= 1;
X return 0;
X}
X
Xint release_m61a1 (c)
Xcraft *c; {
X c->station[0].info3 &= ~1;
X return 0;
X}
X
Xextern long random ();
X
Xint update_m61a1 (c)
Xcraft *c; {
X
X craft *m;
X int i;
X VPoint tmp, mvel;
X double fuzz, fuzzAngle, phiY, phiZ, tm, mv = MUZZLE_VELOCITY;
X
X if (c->station[0].info3 == 0)
X return 0;
X
X/*
X * Got any ammunition ?
X */
X
X if (c->station[0].info <= 0)
X return -1;
X
X/*
X * Allocate a projectile record
X */
X
X for ((i=0, m= &mtbl[0]); i<MAXPROJECTILES; (++i, ++m))
X if (m->type == CT_FREE) {
X m->type = CT_CANNON;
X break;
X }
X
X if (i == MAXPROJECTILES)
X return -1;
X
X/*
X * Determine how far we're fuzzed off the ideal boresight.
X */
X
X fuzz = ((double)(random() & 32767) +
X (double)(random() & 32767)) / 32768.0 - 1.0;
X fuzz = fuzz * FUZZ;
X fuzzAngle = 2.0 * pi * (double)(random() & 511) / 512.0;
X
X/*
X * Determine the initial velocity of the projectile stream.
X */
X
X phiZ = fuzz * sin (fuzzAngle);
X phiY = fuzz * cos (fuzzAngle);
X tm = mv * cos (OFFSET_ANGLE + phiZ);
X
X tmp.x = tm * cos (phiY);
X tmp.y = tm * sin (phiY);
X tmp.z = mv * sin (-OFFSET_ANGLE + phiZ);
X VTransform (&tmp, &(c->trihedral), &mvel);
X
X m->owner = c->index;
X m->createTime = curTime;
X m->Cg = c->Cg;
X m->curRoll = c->curRoll;
X m->curPitch = c->curPitch;
X m->curHeading = c->curHeading;
X m->Cg.x += mvel.x;
X m->Cg.y += mvel.y;
X m->Cg.z += mvel.z;
X
X/*
X * Determine the initial position.
X */
X
X VTransform (&(c->cinfo->wStation[0]), &(c->trihedral), &tmp);
X m->Sg.x = c->Sg.x + tmp.x;
X m->Sg.y = c->Sg.y + tmp.y;
X m->Sg.z = c->Sg.z + tmp.z;
X m->prevSg = m->Sg;
X
X/*
X * Subtract the number of rounds fired.
X */
X
X m->rounds = RATE_OF_FIRE * deltaT;
X m->rounds = (m->rounds > c->station[0].info) ? c->station[0].info : m->rounds;
X m->tracerMod = TRACER_MOD;
X m->tracerVal = c->station[0].info2 % m->tracerMod;
X c->station[0].info -= m->rounds;
X c->station[0].info2 += m->rounds;
X
X m->cinfo = lookupCraft ("m61a1 cannon");
X
X return 0;
X
X}
X
Xextern craftType * newCraft ();
X
Xint placeCannon(c, m, poly, cnt)
Xcraft *c;
XVMatrix *m;
XVPolygon **poly;
Xint *cnt; {
X
X double t, intervalT;
X VPoint v, s;
X int i, j, k, n;
X VPoint *q, tmp;
X VPolygon **p;
X
X/*
X * Reduce the shell path to a set of parametric equations.
X */
X
X v.x = c->Sg.x - c->prevSg.x;
X v.y = c->Sg.y - c->prevSg.y;
X v.z = c->Sg.z - c->prevSg.z;
X
X/*
X * Now add each tracer shell to the view.
X */
X
X intervalT = 1.0 / c->rounds;
X for (t=intervalT*c->tracerVal; t <= 1.0; t += intervalT * TRACER_MOD) {
X s.x = -v.x * t;
X s.y = -v.y * t;
X s.z = -v.z * t;
X if (c->Sg.z + s.z > 0.0) /* underground? don't plot it */
X continue;
X n = c->cinfo->object->numPolys;
X p = c->cinfo->object->polygon;
X j = *cnt;
X for (i=0; i<n; ++i) {
X poly[j] = VCopyPolygon(p[i]);
X for ((k=0, q=poly[j]->vertex); k<poly[j]->numVtces; (++k, ++q)) {
X VTransform(q, m, &tmp);
X tmp.x += s.x;
X tmp.y += s.y;
X tmp.z += s.z;
X *q = tmp;
X }
X ++j;
X }
X *cnt = j;
X }
X
X return(0);
X}
X
Xvoid initm61a1()
X{
X
X craftType *c;
X FILE *f;
X
X wtbl[1] = m61a1Desc;
X
X c = newCraft();
X c->name = strdup("m61a1 cannon");
X
X c->placeProc = placeCannon;
X
X f = acm_fopen ("bullet", "r");
X c->object = VReadObject(f);
X fclose (f);
X
X}
X
Xint cannonCalculations (c)
Xcraft *c; {
X
X
X/*
X * Kill projectile streams after 10.0 seconds of flight or when
X * they strike the ground.
X */
X
X if (curTime - c->createTime > 10.0)
X return 1;
X
X if (c->Sg.z > 0.0)
X return 1;
X
X c->prevSg = c->Sg;
X
X c->Sg.x += c->Cg.x * deltaT;
X c->Sg.y += c->Cg.y * deltaT;
X c->Sg.z += c->Cg.z * deltaT + a * halfDeltaTSquared;
X
X c->Cg.z += a * deltaT;
X return 0;
X
X}
X
X/*
X * plotReticle : draws the aiming reticle onto the HUD.
X *
X * An aiming reticle is a circle with an inner arc that clues the
X * pilot as to the range of the target. Twelve tic marks are used
X * to demarcate the range -- each tic represents 1000 feet of
X * distance.
X */
X
Xstatic struct {
X double x, y;
X } ticTable[12] = {
X { 0.0, -1.0 },
X { 0.5, -0.866 },
X { 0.866, -0.5 },
X { 1.0, 0.0 },
X { 0.866, 0.5 },
X { 0.5, 0.866 },
X { 0.0, 1.0 },
X { -0.5, 0.866 },
X { -0.866, 0.5 },
X { -1.0, 0.0 },
X { -0.866, -0.5 },
X { -0.5, -0.866 } };
X
Xvoid plotReticle (c, u, x, y, range)
Xcraft *c;
Xviewer *u;
Xint x;
Xint y;
Xint range; {
X
X#define RETICLE_SIZE 65
X#define RANGE_SIZE 59
X#define TICK_SIZE (RETICLE_SIZE + 12)
X
X register int i, size, xt, yt, size1, xt1, yt1, nseg, arc;
X XSegment seg[16];
X register double rs, rt;
X Drawable d;
X
X d = (u->v->flags & VPMono) ? (Drawable) u->v->monoPixmap :
X (Drawable) u->win;
X
X size = RETICLE_SIZE * u->scaleFactor + 0.5;
X if ((size & 1) == 0)
X ++size; /* insure it is an odd value */
X xt = x - size / 2;
X yt = y - size / 2;
X rs = size / 2;
X rt = ((TICK_SIZE + 1) / 2) * u->scaleFactor;
X
X for (i=0; i < 12; i++) {
X seg[i].x1 = x +
X (int) (rs * ticTable[i].x + 0.5);
X seg[i].y1 = y +
X (int) (rs * ticTable[i].y + 0.5);
X seg[i].x2 = x +
X (int) (rt * ticTable[i].x + 0.5);
X seg[i].y2 = y +
X (int) (rt * ticTable[i].y + 0.5);
X }
X
X nseg = 12;
X XDrawArc (u->dpy, d, u->gc, xt, yt, size, size, 0,
X 360 * 64);
X
X if (range != -1) {
X if (range > 12000)
X range = 12000;
X arc = - range * 23040 / 12000;
X size1 = RANGE_SIZE * u->scaleFactor + 0.5;
X if ((size1 & 1) == 0)
X ++ size1;
X if (size == size1)
X -- size1;
X xt1 = x - size1 / 2;
X yt1 = y - size1 / 2;
X XDrawArc (u->dpy, d, u->gc, xt1, yt1, size1, size1,
X 90 * 64, arc);
X }
X
X XDrawSegments (u->dpy, d, u->gc, seg, nseg);
X
X}
X
Xvoid lcos (c, u)
Xcraft *c;
Xviewer *u; {
X
X
X/*
X * How does this LCOS thing work, anyway?
X *
X * First, let me say that this may or, more probably, may not look
X * anything like the technique used in a real fighter's gun sighting
X * system. Having said that, here's the basic assumptions and steps
X * used to generate the reticle on the HUD:
X *
X * 1) Using radar, we know the distance to the target. Assuming that the
X * radar is in working order and is locked onto something.
X *
X * 2) We know the muzzle velocity of the shells we're firing and can
X * use that value to closely estimate the flight time of the shells
X * to a target that's a certain distance away (the target). Call
X * this value "fTime".
X *
X * 3) Use the muzzle velocity vector to determine the
X * relative position (w.r.t. out craft) of a shell "fTime" seconds into
X * its flight. Call this vector "pos".
X *
X * 4) Gravity will accelerate the shells. Use d = 0.5 * g * t ^ 2
X * to add a distance (along the Z axis that will approximate the
X * effect of gravity. Add that to "pos".
X *
X * 5) We know our pitch and yaw rates. These rotations will have the
X * effect of visually "bending" the cannon stream, from the pilot's
X * perspective. Use the values to generate a matrix to transform
X * "pos" by an amount proportional to our "fTime" value.
X *
X * 6) Convert our "pos" vector to screen x,y coordinates and call
X * plotReticle.
X */
X
X double fTime, range, gm, pitch_rate, yaw_rate;
X VPoint pos, tmp, tmp1;
X VPoint zg, z;
X VMatrix rotation;
X register int x, y, clue;
X hist_t *hist;
X
X hist = &history[c->index];
X
X/* Step 1 */
X
X if (c->curRadarTarget >= 0)
X range = c->targetDistance;
X else
X range = 2500.0;
X
X/* Step 2 */
X
X fTime = range / MUZZLE_VELOCITY;
X
X/* Step 3 */
X
X pos.x = fTime * MUZZLE_VELOCITY * cos (OFFSET_ANGLE);
X pos.y = 0.0;
X pos.z = - fTime * MUZZLE_VELOCITY * sin (OFFSET_ANGLE);
X
X/* Step 4 */
X
X zg.x = zg.y = 0.0;
X zg.z = 1.0;
X
X VTransform (&zg, &(c->Itrihedral), &z);
X
X gm = 0.5 * a * fTime * fTime;
X pos.x += z.x * gm;
X pos.y += z.y * gm;
X pos.z += z.z * gm;
X
X/* Step 5 */
X
X VIdentMatrix (&rotation);
X
X pitch_rate = hist->pitch_total / (double) hist->count;
X yaw_rate = hist->yaw_total / (double) hist->count;
X
X if (pitch_rate != 0.0)
X VRotate (&rotation, YRotation, pitch_rate * fTime);
X if (yaw_rate != 0.0)
X VRotate (&rotation, ZRotation, yaw_rate * fTime);
X
X VTransform (&pos, &rotation, &tmp);
X
X/* Step 6 */
X
X tmp1 = tmp;
X x = u->v->Middl.x + tmp1.y * u->v->Scale.x / tmp1.x + 0.5;
X y = u->v->Middl.y + tmp1.z * u->v->Scale.y / tmp1.x + 0.5;
X
X if (c->curRadarTarget >= 0)
X clue = c->targetDistance + 0.5;
X else
X clue = -1;
X
X plotReticle (c, u, x, y, clue);
X}
X
X/*
X * lookForCannonImpacts : Track cannon shells and look for impacts with
X * aircraft. This algorithm tracks each shell's
X * flight.
X */
X
Xtypedef struct _entry {
X double time;
X double min;
X craft *c;
X struct _entry *next;
X } entry;
X
X
Xextern int cdebug;
X
Xvoid lookForCannonImpacts (m)
Xcraft *m; {
X
X craft *c;
X entry p[MAXPLAYERS], *list, *q, *r, *rprev;
X VPoint v, s0, prevSg, Vm;
X double t, d, roundT, intervalT;
X int j;
X
X intervalT = 1.0 / m->rounds;
X for (roundT=0.0; roundT < 1.0; roundT += intervalT) {
X
X Vm.x = m->Sg.x - m->prevSg.x;
X Vm.y = m->Sg.y - m->prevSg.y;
X Vm.z = m->Sg.z - m->prevSg.z;
X
X prevSg.x = m->prevSg.x - Vm.x * (1.0 - roundT);
X prevSg.y = m->prevSg.y - Vm.y * (1.0 - roundT);
X prevSg.z = m->prevSg.z - Vm.z * (1.0 - roundT);
X
X list = (entry *) NULL;
X for (c=ptbl, j=0; j<MAXPLAYERS; ++j, ++c) {
X
X if (c->type == CT_FREE || m->owner == c->index)
X continue;
X
X/*
X * Reduce the relative motion of this object to a the parametric system
X * of equations:
X * x(t) = vx * t + s0x
X * y(t) = vy * t + s0y
X * z(t) = vz * t + s0z
X *
X * We can then compute the time of perigee (closest pass) along with
X * the associated minimum distance.
X */
X
X v.x = c->Sg.x - c->prevSg.x - Vm.x;
X v.y = c->Sg.y - c->prevSg.y - Vm.y;
X v.z = c->Sg.z - c->prevSg.z - Vm.z;
X s0.x = c->prevSg.x - prevSg.x;
X s0.y = c->prevSg.y - prevSg.y;
X s0.z = c->prevSg.z - prevSg.z;
X
X/*
X * Compute time of minimum distance between the two objects (note that units
X * here are UPDATE_INTERVAL seconds).
X */
X
X t = - (v.x * s0.x + v.y * s0.y + v.z * s0.z) /
X (v.x * v.x + v.y * v.y + v.z * v.z);
X
X if (cdebug)
X printf ("perigee in %g seconds with player %d\n",
X t*deltaT, j);
X
X/*
X * If the closest pass occurs during this update interval, check for a hit.
X * We'll build a linked list of all craft that this projectile may strike
X * during this period, arranged in ascending order by time of "perigee"
X * (closest pass). We'll then test for strikes. If a projectile misses
X * the first object, then it may have struck subsequent objects in the
X * list ...
X */
X
X/*
X * One special case occurs when a target or missile's turn suddenly
X * changes the perigee time from positive to negative. If the missile
X * is within hitting range at t=0 and the time of perigee is negative,
X * then zap 'em.
X */
X
X if (t < 0.0) {
X d = sqrt (s0.x *s0.x + s0.y * s0.y +
X s0.z * s0.z);
X if (isCannonHit (d, c)) {
X printf ("detected a \"curve hit\"\n");
X t = 0.0;
X }
X }
X
X if (t >= 0.0 && t <= 1.0) {
X q = &p[j];
X if (list == (entry *) NULL) {
X q->next = list;
X list = q;
X }
X else if (list->time > t) {
X q->next = list;
X list = q;
X }
X else {
X for (rprev=list, r=list->next; r != (entry *) NULL;) {
X if (r->time > t) break;
X rprev = r;
X r = r->next;
X }
X if (rprev != list)
X rprev->next = q;
X q->next = r;
X }
X q->time = t;
X q->c = c;
X q->min = sqrt (pow(v.x * t + s0.x, 2.0) +
X pow (v.y * t + s0.y, 2.0) +
X pow (v.z * t + s0.z, 2.0) );
X if (cdebug)
X printf ("perigee %g feet; craft %d.\n",
X q->min, j);
X }
X }
X
X/*
X * Now look for cannon hits in the list of perigees.
X */
X
X for (r=list; r != (entry *) NULL; r=r->next)
X if (isCannonHit (r->min, r->c)) {
X /* killMissile (m); */
X if (absorbDamage (r->c, 3) == 0)
X killPlayer (r->c);
X break;
X }
X }
X}
X
X/*ARGSUSED*/
Xint isCannonHit (min, c)
Xdouble min;
Xcraft *c; {
X
X return (min < 50.0) ? 1 : 0;
X}
END_OF_FILE
if test 14922 -ne `wc -c <'acm/fsim/m61a1.c'`; then
echo shar: \"'acm/fsim/m61a1.c'\" unpacked with wrong size!
fi
# end of 'acm/fsim/m61a1.c'
fi
echo shar: End of archive 7 \(of 9\).
cp /dev/null ark7isdone
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 at mips.com
MIPS Computer Systems Phone: +1 214 770-7979
Dallas, Texas
More information about the Comp.sources.x
mailing list