[comp.sources.games] v04i026: spacewar - multiplayer asynchronous space battle game, Part06/06

games@tekred.TEK.COM (06/01/88)

Submitted by: udenva!koala!dir (Dan Rosenblatt)
Comp.sources.games: Volume 4, Issue 26
Archive-name: spacewar/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 6)."
# Contents:  aln.h bfuncs.c copyright dbm.h fixdir.c globals.c lckmsg.c
#   login.h mlbx.h obj.h plyr.h psw.sh rpt.c rsw.c sys.h tget.c torp.h
#   tstsz.c ucmd.h uio.h uio2.h universe.h vmsdelmbx.c who.c
# Wrapped by billr@saab on Tue May 31 09:54:56 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f aln.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"aln.h\"
else
echo shar: Extracting \"aln.h\" \(680 characters\)
sed "s/^X//" >aln.h <<'END_OF_aln.h'
X/*
X * Spacewar - include file that defines an alien
X *	      (requires prior inclusion of sys.h and universe.h)
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
Xstruct aln {
X	double	al_pstn[3];	/* alien position */
X	double	al_vel[3];	/* alien velocity */
X	double	al_thr[3];	/* alien thrust */
X	short	al_dly;		/* alien delay counter */
X	char	al_htyp;	/* alien hull type */
X	idxptr	al_lhit;	/* alien last hit by */
X	idxptr	al_atck;	/* alien currently attacking */
X	short	al_aeval;	/* alien attack evaluation */
X	idxptr	al_univ;	/* alien universe location */
X	struct sys al_sys[MSYS];/* alien systems */
X};
X
X#define MAXALN	30
X
Xextern struct aln alnlst[];
END_OF_aln.h
if test 680 -ne `wc -c <aln.h`; then
    echo shar: \"aln.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f bfuncs.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"bfuncs.c\"
else
echo shar: Extracting \"bfuncs.c\" \(739 characters\)
sed "s/^X//" >bfuncs.c <<'END_OF_bfuncs.c'
X/*
X * Spacewar - byte functions
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X
XVOID bcopy(dst,src,len)
Xregister char *dst,*src;
Xregister int len;
X{
X	while (len-- > 0)
X		*dst++ = *src++;
X}
X
XVOID binit(dst,len)
Xregister char *dst;
Xregister int len;
X{
X	while (len-- > 0)
X		*dst++ = 0;
X}
X
XVOID vcopy(dst,src)
Xregister double *dst,*src;
X{
X	register int i;
X
X	for (i=0;i++<3;)
X		*dst++ = *src++;
X}
X
XVOID mcopy(dst,src)
Xregister double *dst,*src;
X{
X	register int i;
X
X	for (i=0;i++<9;)
X		*dst++ = *src++;
X}
X
XVOID vinit(dst)
Xregister double *dst;
X{
X	register int i;
X
X	for (i=0;i++<3;)
X		*dst++ = 0.;
X}
X
XVOID minit(dst)
Xregister double *dst;
X{
X	register int i;
X
X	for (i=0;i++<9;)
X		*dst++ = 0.;
X}
END_OF_bfuncs.c
if test 739 -ne `wc -c <bfuncs.c`; then
    echo shar: \"bfuncs.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f copyright -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"copyright\"
else
echo shar: Extracting \"copyright\" \(93 characters\)
sed "s/^X//" >copyright <<'END_OF_copyright'
X/*
X * Spacewar -
X *
X * Copyright 1985 obo Systems, Inc.
X * Copyright 1985 Dan Rosenblatt
X */
END_OF_copyright
if test 93 -ne `wc -c <copyright`; then
    echo shar: \"copyright\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f dbm.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"dbm.h\"
else
echo shar: Extracting \"dbm.h\" \(128 characters\)
sed "s/^X//" >dbm.h <<'END_OF_dbm.h'
X/*
X * NOTE: VMS only
X */
X
Xtypedef	struct
X{
X	char	*dptr;
X	int	dsize;
X} datum;
X
Xdatum	fetch();
Xdatum	firstkey();
Xdatum	nextkey();
END_OF_dbm.h
if test 128 -ne `wc -c <dbm.h`; then
    echo shar: \"dbm.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f fixdir.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"fixdir.c\"
else
echo shar: Extracting \"fixdir.c\" \(788 characters\)
sed "s/^X//" >fixdir.c <<'END_OF_fixdir.c'
X/*
X * Spacewar - normalize direction vector and recompute rotation matrix
X *
X * Copyright 1985 obo Systems, Inc.
X * Copyright 1985 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X#ifndef VMS
X#include <sys/types.h>
X#else /* BSD SYSIII SYSV */
X#include <types.h>
X#endif /* VMS */
X#include "universe.h"
X#include "sys.h"
X#include "crft.h"
X#include "flds.h"
X
XVOID fixdir(pcrft)
Xregister struct crft *pcrft;
X{
X	double tmp;
X
X	unity(pcrft->cr_rmat);
X	tmp = FMOD(ADD(pcrft->cr_dir[1],TWOPI),TWOPI);
X	if (tmp != pcrft->cr_dir[1])
X	    biton(pcrft->cr_chng,BIT_DIR1);
X	pcrft->cr_dir[1] = tmp;
X	zrot(pcrft->cr_rmat,SUB(DIV(PI,2.),tmp));
X	tmp = FMOD(ADD(pcrft->cr_dir[2],TWOPI),TWOPI);
X	if (tmp != pcrft->cr_dir[2])
X	    biton(pcrft->cr_chng,BIT_DIR2);
X	pcrft->cr_dir[2] = tmp;
X	xrot(pcrft->cr_rmat,tmp);
X}
END_OF_fixdir.c
if test 788 -ne `wc -c <fixdir.c`; then
    echo shar: \"fixdir.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f globals.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"globals.c\"
else
echo shar: Extracting \"globals.c\" \(565 characters\)
sed "s/^X//" >globals.c <<'END_OF_globals.c'
X/*
X * Spacewar - file that declares all global lists
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X#ifndef VMS
X#include <sys/types.h>
X#else /* BSD SYSIII SYSV */
X#include <types.h>
X#endif /* VMS */
X#include "universe.h"
X#include "torp.h"
X#include "sys.h"
X#include "obj.h"
X#include "login.h"
X#include "crft.h"
X#include "aln.h"
X
Xstruct aln alnlst[MAXALN];
Xstruct crft crftlst[MAXCRFT];
Xstruct login loginlst[MAXLOGIN];
Xstruct obj objlst[MAXOBJ];
Xstruct torp torplst[MAXTORP];
Xstruct universe univlst[MAXUNIVERSE];
END_OF_globals.c
if test 565 -ne `wc -c <globals.c`; then
    echo shar: \"globals.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f lckmsg.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"lckmsg.c\"
else
echo shar: Extracting \"lckmsg.c\" \(1135 characters\)
sed "s/^X//" >lckmsg.c <<'END_OF_lckmsg.c'
X/*
X * Spacewar - return a lock message if the system is locked (no play allowed)
X *
X * Copyright 1985 obo Systems, Inc.
X * Copyright 1985 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X#ifndef VMS
X#include <sys/types.h>
X#else /* BSD SYSIII SYSV */
X#include <types.h>
X#endif /* VMS */
X#include <time.h>
X
Xstatic char *msg;	/* NULL if normal locking applies */
X			/* ptr to NULL str if unlocked by SWMASTER */
X			/* ptr to text if locked by SWMASTER */
X
Xchar *lckmsg()
X{
X	time_t clock;
X	struct tm *curtm,*localtime();
X
X#ifdef DEBUG
X	DBG("lckmsg()\n");
X#endif
X
X	/* controlled by SWMASTER */
X	if (msg)
X	    return((*msg) ? msg : NULL);
X
X	/* get current date&time */
X	time(&clock);
X	curtm = localtime(&clock);
X
X	/* OK if Sat or Sun */
X	if (curtm->tm_wday == 0 || curtm->tm_wday == 6)
X	    return(NULL);
X
X	/* OK if before 8AM or after 5PM */
X	if (curtm->tm_hour < 8 || curtm->tm_hour >= 17)
X	    return(NULL);
X
X	/* OK if during lunch: 1130PM to 1PM */
X	if (curtm->tm_hour < 13 && curtm->tm_hour*100 + curtm->tm_min >= 1130)
X	    return(NULL);
X
X	return("A lockout exists from 0800-1130,1300-1700 Mon-Fri");
X}
X
XVOID prvlck(s)
Xchar *s;
X{
X	msg = s;
X}
END_OF_lckmsg.c
if test 1135 -ne `wc -c <lckmsg.c`; then
    echo shar: \"lckmsg.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f login.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"login.h\"
else
echo shar: Extracting \"login.h\" \(1014 characters\)
sed "s/^X//" >login.h <<'END_OF_login.h'
X/*
X * Spacewar - include file that defines a player's login
X *	      (requires prior inclusion of universe.h)
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
Xstruct login {
X	short	ln_tty;		/* login terminal I/O channel */
X#ifdef VMS
X	int	ln_pid;
X#else /* BSD SYSIII SYSV */
X	short	ln_playpid;	/* login play process pid */
X	short	ln_readpid;	/* login read process pid */
X#endif /* VMS BSD SYSIII SYSV */
X	char	ln_name[8+1];	/* login name */
X	char	*ln_term;	/* login terminal name */
X				/* login trm. characteristics */
X	char	*ln_tcm,*ln_tcl,*ln_tce,*ln_tso,*ln_tse;
X	char	ln_rvslh;	/* login reverse low/high screen display */
X	char	ln_iomode;	/* login I/O mode */
X	char	ln_crft[12+1];	/* login craft name */
X	idxptr	ln_play;	/* login is playing */
X	char	ln_stat;	/* login status (major command) */
X	char	*ln_substat;	/* login substatus (command dependent) */
X	char	ln_input[79+1];	/* login input buffer */
X};
X
X#define MAXLOGIN	30	/* same as MAXCRFT */
X
Xextern struct login loginlst[];
END_OF_login.h
if test 1014 -ne `wc -c <login.h`; then
    echo shar: \"login.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mlbx.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"mlbx.h\"
else
echo shar: Extracting \"mlbx.h\" \(339 characters\)
sed "s/^X//" >mlbx.h <<'END_OF_mlbx.h'
X/*
X * Spacewar - include file that defines a player's mailbox
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#define MLBX	'M'	/* prefix for dbm(3) key */
X
Xstruct mlbxkey {
X	char	mb_mlbxkey;	/* prefix for dbm(3) key */
X	char	mb_plyr[8+1];	/* player(recipient) name */
X	short	mb_mlbx;	/* mailbox sequence */
X};
END_OF_mlbx.h
if test 339 -ne `wc -c <mlbx.h`; then
    echo shar: \"mlbx.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f obj.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"obj.h\"
else
echo shar: Extracting \"obj.h\" \(1014 characters\)
sed "s/^X//" >obj.h <<'END_OF_obj.h'
X/*
X * Spacewar - include file that defines a universe object
X *	      (requires prior inclusion of universe.h)
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
Xstruct obj {
X	long	oj_mass;	/* object mass (for gravity) */
X	short	oj_rad;		/* object radius */
X	char	oj_rep;		/* object representation (screen character) */
X	idxptr	oj_octr;	/* object orbital center (a previous obj) */
X	short	oj_oprd;	/* object orbital period */
X	long	oj_orad;	/* object orbital center radius */
X	double	oj_ocrpt;	/* object orbital center relative plane theta */
X	double	oj_optx;	/* object orbital plane tilt x (in degrees) */
X	double	oj_opty;	/* object orbital plane tilt y (in degrees) */
X	double	oj_optz;	/* object orbital plane tilt z (in degrees) */
X
X/* in-core only */
X	idxptr	oj_univ;	/* object universe pointer */
X	double	oj_pstn[3];	/* object position */
X	double	oj_vel[3];	/* object velocity */
X	double	oj_rmat[3][3];	/* object rotation matrix */
X};
X
X#define MAXOBJ	42
X
Xextern struct obj objlst[];
END_OF_obj.h
if test 1014 -ne `wc -c <obj.h`; then
    echo shar: \"obj.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f plyr.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"plyr.h\"
else
echo shar: Extracting \"plyr.h\" \(804 characters\)
sed "s/^X//" >plyr.h <<'END_OF_plyr.h'
X/*
X * Spacewar - include file that defines a player structure
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#define PLYR	'P'	/* prefix for dbm(3) key */
X
Xstruct plyrkey {
X	char	pl_plyrkey;	/* prefix for dbm(3) key */
X	char	pl_name[8+1];	/* player name */
X};
X
Xstruct plyr {
X	char	pl_passwd[8+1];	/* player password */
X	short	pl_numlgn;	/* player number of logins */
X	time_t	pl_lstlgn;	/* player last login */
X	short	pl_frstml;	/* player first mail sequence# */
X	short	pl_seenml;	/* player seen mail sequence# (old/new) */
X	short	pl_lstml;	/* player last mail sequence# */
X	short	pl_slst;	/* player number of ships lost */
X	short	pl_klst;	/* player number of kills lost */
X	long 	pl_plst;	/* player number of points lost */
X	time_t	pl_tlst;	/* player playing time lost */
X};
END_OF_plyr.h
if test 804 -ne `wc -c <plyr.h`; then
    echo shar: \"plyr.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f psw.sh -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"psw.sh\"
else
echo shar: Extracting \"psw.sh\" \(72 characters\)
sed "s/^X//" >psw.sh <<'END_OF_psw.sh'
Xchmod go+rw `tty`
Xtrap 'wait' 1 2 3 15
X/usr/dir/sw/psw
Xchmod go-r `tty`
END_OF_psw.sh
if test 72 -ne `wc -c <psw.sh`; then
    echo shar: \"psw.sh\" unpacked with wrong size!
fi
chmod +x psw.sh
# end of overwriting check
fi
if test -f rpt.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"rpt.c\"
else
echo shar: Extracting \"rpt.c\" \(849 characters\)
sed "s/^X//" >rpt.c <<'END_OF_rpt.c'
X/*
X * Spacewar - routines to report to a playing screen
X *
X * Copyright 1985 obo Systems, Inc.
X * Copyright 1985 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X#ifndef VMS
X#include <sys/types.h>
X#else /* BSD SYSIII SYSV */
X#include <types.h>
X#endif /* VMS */
X#include "universe.h"
X#include "login.h"
X#include "sys.h"
X#include "crft.h"
X#include "flds.h"
X
Xstatic char nxtrpt;
X
XVOID rpt(pcrft,msg)
Xstruct crft *pcrft;
Xchar *msg;
X{
X	if (nxtrpt >= flds[FLD_REPORT].f_maxg)
X		return;
X	output(pcrft->cr_lgn,'H',(nxtrpt<<8)|FLD_REPORT,msg);
X	++nxtrpt;
X}
X
X/*ARGSUSED*/
XVOID setrpt(pcrft)
Xstruct crft *pcrft;
X{
X	nxtrpt = 0;
X}
X
XVOID fnshrpt(pcrft,flsh)
Xregister struct crft *pcrft;
Xint flsh;
X{
X	int i;
X
X	for (i=nxtrpt;i <= pcrft->cr_lrpt;++i)
X		output(pcrft->cr_lgn,'H',(i<<8)|FLD_REPORT,"");
X	pcrft->cr_lrpt = nxtrpt - 1;
X	if (flsh) output(pcrft->cr_lgn,0,0,0);
X}
END_OF_rpt.c
if test 849 -ne `wc -c <rpt.c`; then
    echo shar: \"rpt.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f rsw.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"rsw.c\"
else
echo shar: Extracting \"rsw.c\" \(802 characters\)
sed "s/^X//" >rsw.c <<'END_OF_rsw.c'
X/*
X * Spacewar - program that reads a user's terminal and passes
X *	      it back to the spacewar game through a pipe in
X *	      order to present spacewar with only one file to
X *	      read for user input eliminating polling
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X#include "universe.h"
X#include "login.h"
X#include "uio.h"
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X	struct uio ttyuio;
X	register int i;
X
X	/* get, save, and clear player's login pointer */
X	if (argc != 2) exit(1);
X	ttyuio.uio_lgn = (struct login *) atoi(argv[1]);
X	argv[1] = (char *) 0;
X
X	/* read tty and forward it on */
X	for(;;) {
X		if ((i=read(0,ttyuio.uio_chrs,sizeof(ttyuio.uio_chrs)-1)) > 0) {
X			ttyuio.uio_chrs[i] = '\0';
X			write(1,&ttyuio,sizeof(ttyuio));
X		}
X	}
X}
END_OF_rsw.c
if test 802 -ne `wc -c <rsw.c`; then
    echo shar: \"rsw.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f sys.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"sys.h\"
else
echo shar: Extracting \"sys.h\" \(637 characters\)
sed "s/^X//" >sys.h <<'END_OF_sys.h'
X/*
X * Spacewar - include file that defines a craft's systems
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#define SUBSYS	'S'	/* prefix for dbm(3) key */
X
Xstruct syskey {
X	char	s_syskey;	/* prefix for dbm(3) key */
X	char	s_plyr[8+1];	/* player(owner) name */
X	char	s_crft[12+1];	/* craft name */
X	char	s_type;		/* system type */
X};
X
Xstruct sys {
X	char	s_pct;		/* system percent */
X	char	s_edmg;		/* system ease of damage */
X	char	s_dmg;		/* system current damage */
X	short	s_lvl;		/* system current level */
X	short	s_cap;		/* system capacity */
X};
X
X#define MSYS	16	/* maximum possible number of systems */
END_OF_sys.h
if test 637 -ne `wc -c <sys.h`; then
    echo shar: \"sys.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f tget.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"tget.c\"
else
echo shar: Extracting \"tget.c\" \(1042 characters\)
sed "s/^X//" >tget.c <<'END_OF_tget.c'
X/*
X * spacewar - simple simulation of termcap routines/database
X */
X
Xstatic struct {
X	char *tnam;
X	char *tcm,*tcl,*tce,*tso,*tse,*tus,*tue;
X} *tptr,ttbl[] = {
X	{"vt100","\001\033[%02d;%02dH",
X	    "\033[;H\033[2J","\033[K","\033[7m","\033[m","\033[4m","\033[m"},
X	{"tvi925","\040\033=%c%c",
X	    "\032","\033T","\033G0","\033G<","\033)","\033("},
X	{"h19","\040\033Y%c%c",
X	    "\033E","\033K","\033p","\033q"},
X	{0}
X};
X
Xtgetent(p1,termname)
Xchar *p1,*termname;
X{
X	for (tptr=ttbl;tptr->tnam && strcmp(termname,tptr->tnam);++tptr) ;
X	return((tptr->tnam) ? 1 : 0);
X}
X
Xchar *tgetstr(cap,p2)
Xchar *cap;
X{
X	if (!strcmp(cap,"cm"))
X		return(tptr->tcm);
X	if (!strcmp(cap,"cl"))
X		return(tptr->tcl);
X	if (!strcmp(cap,"ce"))
X		return(tptr->tce);
X	if (!strcmp(cap,"so"))
X		return(tptr->tso);
X	if (!strcmp(cap,"se"))
X		return(tptr->tse);
X	if (!strcmp(cap,"us"))
X		return(tptr->tus);
X	if (!strcmp(cap,"ue"))
X		return(tptr->tue);
X	return(0);
X}
X
Xchar *tgoto(cm,x,y)
Xchar *cm;
Xint x,y;
X{
X	static char buf[32];
X
X	sprintf(buf,cm+1,y+*cm,x+*cm);
X	return(buf);
X}
END_OF_tget.c
if test 1042 -ne `wc -c <tget.c`; then
    echo shar: \"tget.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f torp.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"torp.h\"
else
echo shar: Extracting \"torp.h\" \(705 characters\)
sed "s/^X//" >torp.h <<'END_OF_torp.h'
X/*
X * Spacewar - include file that defines a torpedo
X *	      (requires prior inclusion of universe.h)
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
Xstruct torp {
X	double	tp_pstn[3];	/* torpedo position */
X	double	tp_vel[3];	/* torpedo velocity */
X	double	tp_thr[3];	/* torpedo thrust */
X	idxptr	tp_aim;		/* torpedo aimed at */
X	idxptr	tp_fby;		/* torpedo fired by */
X	long	tp_dist;	/* torpedo quarry distance */
X	char	tp_dmg;		/* torpedo hull damage */
X	idxptr	tp_lhit;	/* torpedo last hit by */
X	idxptr	tp_univ;	/* torpedo universe pointer */
X};
X
X#define MAXTORP	90	/* 3*MAXCRFT */
X
Xextern struct torp torplst[];
X
X#define MAXTTHR	50	/* maximum torp thrust from rockets */
END_OF_torp.h
if test 705 -ne `wc -c <torp.h`; then
    echo shar: \"torp.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f tstsz.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"tstsz.c\"
else
echo shar: Extracting \"tstsz.c\" \(659 characters\)
sed "s/^X//" >tstsz.c <<'END_OF_tstsz.c'
X/*
X * Spacewar - test size of uio and alternate
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X#include "uio.h"
X#include "uio2.h"
X
Xmain()
X{
X#ifdef BSD
X	printf("only one uio, nothing to worry about\n");
X#else /* VMS SYSIII SYSV */
X#ifdef VMS
X	printf("only one uio, nothing to worry about\n");
X#else /* SYSIII SYSV */
X	printf("since there are two uios, they must match in size\n");
X	printf("sizeof(uio)(%d) %c= sizeof(uio2)(%d)\n", sizeof(struct uio),
X	(sizeof(struct uio) == sizeof(struct uio2)) ? '=' : '!',
X	sizeof(struct uio2));
X#endif /* VMS SYSIII SYSV */
X#endif /* BSD VMS SYSIII SYSV */
X	return(0);
X}
END_OF_tstsz.c
if test 659 -ne `wc -c <tstsz.c`; then
    echo shar: \"tstsz.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f ucmd.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ucmd.h\"
else
echo shar: Extracting \"ucmd.h\" \(400 characters\)
sed "s/^X//" >ucmd.h <<'END_OF_ucmd.h'
X/*
X * Spacewar - include file that defines a player's-defined commands
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
X#define UCMD	'U'	/* prefix for dbm(3) key */
X
Xstruct ucmdkey {
X	char	uc_ucmdkey;	/* prefix for dbm(3) key */
X	char	uc_plyr[8+1];	/* player(definer/user) name */
X	char	uc_name[8+1];	/* user-command name */
X	short	uc_ucmd;	/* user-command sequence */
X};
END_OF_ucmd.h
if test 400 -ne `wc -c <ucmd.h`; then
    echo shar: \"ucmd.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f uio.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"uio.h\"
else
echo shar: Extracting \"uio.h\" \(507 characters\)
sed "s/^X//" >uio.h <<'END_OF_uio.h'
X/*
X * Spacewar - include file that defines structure containing user input
X *	      (requires prior inclusion of login.h)
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
Xstruct uio {
X	struct login *uio_lgn;	/* user i/o pointer to login struct */
X	char	uio_chrs[16];	/* user i/o characters */
X};
X
X/*
X * bastardization for named pipe communication from psw:
X *	uio_lgn			is signal# or 0 for new login
X *	uio_chrs[0:1]		is process id
X *	uio_chrs[2:n]		is ttyname for new login
X */
END_OF_uio.h
if test 507 -ne `wc -c <uio.h`; then
    echo shar: \"uio.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f uio2.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"uio2.h\"
else
echo shar: Extracting \"uio2.h\" \(335 characters\)
sed "s/^X//" >uio2.h <<'END_OF_uio2.h'
X/*
X * Spacewar - login and signal communication structure
X *	      (alternate uio for SYSIII SYSV)
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
Xstruct uio2 {
X	int	uio2sig;	/* signal, 0 for logon */
X	short	uio2pid;	/* process-id of playsw */
X	char	uio2tty[14];	/* ttyname for logon (signal 0 only) */
X};
END_OF_uio2.h
if test 335 -ne `wc -c <uio2.h`; then
    echo shar: \"uio2.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f universe.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"universe.h\"
else
echo shar: Extracting \"universe.h\" \(819 characters\)
sed "s/^X//" >universe.h <<'END_OF_universe.h'
X/*
X * Spacewar - include file that defines objects/parameters of the universe
X *
X * ordering: objects, aliens, crafts&torpedoes (because they can come and go)
X *
X * Copyright 1984 obo Systems, Inc.
X * Copyright 1984 Dan Rosenblatt
X */
X
Xstruct universe {
X	char	uv_type;	/* universe type of object: NULL 'A|P|O|T' */
X	char	uv_pctr;	/* universe screen character of object */
X	double	*uv_pstn;	/* universe position of object */
X	long	uv_mass;	/* universe mass/hull damage of object */
X	short	uv_rad;		/* universe radius of object */
X	union {
X		struct aln *uv_aln;
X		struct crft *uv_crft;
X		struct obj *uv_obj;
X		struct torp *uv_torp;
X	} uv_ptr;
X	dsplcmnt *uv_dspl;
X};
X
X#define MAXUNIVERSE	MAXALN+MAXCRFT+MAXOBJ+MAXTORP
X
Xextern struct universe univlst[];
X
Xtypedef union {
X	struct universe *ip_ptr;
X	int		 ip_ofst;
X} idxptr;
END_OF_universe.h
if test 819 -ne `wc -c <universe.h`; then
    echo shar: \"universe.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f vmsdelmbx.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"vmsdelmbx.c\"
else
echo shar: Extracting \"vmsdelmbx.c\" \(789 characters\)
sed "s/^X//" >vmsdelmbx.c <<'END_OF_vmsdelmbx.c'
X/*
X * Spacewar - for deleting mailboxes left around if the game dies - VMS ONLY!
X *
X * Copyright 1985 obo Systems, Inc.
X * Copyright 1985 Dan Rosenblatt
X */
X
X#include <stdio.h>
X
X#include <descrip.h>
X#include <ssdef.h>
X#include <psldef.h>
X
Xmain()
X{
X	char buf[128];
X	struct dsc$descriptor_d mlbx;
X	short chan;
X	int e;
X
X	printf("mailbox name>");
X	scanf("%s",buf);
X
X	mlbx.dsc$w_length = strlen(buf);
X	mlbx.dsc$b_dtype = DSC$K_DTYPE_T;
X	mlbx.dsc$b_class = DSC$K_CLASS_S;
X	mlbx.dsc$a_pointer = buf;
X
X	if ((e=sys$assign(&mlbx,&chan,PSL$C_USER,0)) != SS$_NORMAL) {
X		printf("assign()=%d ",e);
X		perror(buf);
X		exit(SS$_ABORT);
X	}
X	if ((e=sys$delmbx(chan)) != SS$_NORMAL) {
X		printf("delmbx()=%d ",e);
X		perror(buf);
X		exit(SS$_ABORT);
X	}
X
X	printf("mailbox %s deleted\n",buf);
X	exit(SS$_NORMAL);
X}
END_OF_vmsdelmbx.c
if test 789 -ne `wc -c <vmsdelmbx.c`; then
    echo shar: \"vmsdelmbx.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f who.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"who.c\"
else
echo shar: Extracting \"who.c\" \(1121 characters\)
sed "s/^X//" >who.c <<'END_OF_who.c'
X/*
X * Spacewar - display who is logged in and what craft they are playing
X *
X * Copyright 1985 obo Systems, Inc.
X * Copyright 1985 Dan Rosenblatt
X */
X
X#include "spacewar.h"
X#include "universe.h"
X#include "login.h"
X
XVOID who(plogin)
Xregister struct login *plogin;
X{
X	register struct login *plgn=loginlst+MAXLOGIN;
X	char buf[40+1];
X
X#ifdef DEBUG
X	DBG("who(#%d/%s)\n",plogin-loginlst,plogin->ln_name);
X#endif
X
X	strcpy(buf,"\n");
X	while (--plgn >= loginlst) {
X		if (!plgn->ln_tty) continue;	/* no one there */
X		if (plgn == plogin) continue;	/* not the current player */
X
X		if (strlen(buf) + strlen(plgn->ln_name) + 1 +
X		((plgn->ln_stat == 'P') ? strlen(plgn->ln_crft)+1 : 0)) {
X			output(plogin,'C',0,buf);
X			strcpy(buf,"\n");
X		}
X		strcat(buf,plgn->ln_name);
X		if (plgn->ln_stat == 'P') {
X			strcat(buf,"/");
X			strcat(buf,plgn->ln_crft);
X		}
X		strcat(buf," ");
X	}
X	if (strlen(buf) > 1) {
X		output(plogin,'C',0,buf);
X		output(plogin,'C',0,"\n");
X	} else
X		output(plogin,'C',0,"\nNo one else\n");
X	
X	plogin->ln_stat = NULL;
X	output(plogin,'C',0,PROMPT);
X	output(plogin,0,0,0);
X#ifdef DEBUG
X	VDBG("who return\n");
X#endif
X}
END_OF_who.c
if test 1121 -ne `wc -c <who.c`; then
    echo shar: \"who.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 6 \(of 6\).
cp /dev/null ark6isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0