Path: utzoo!attcan!uunet!ispi!jbayer
From: jbayer@ispi.UUCP (id for use with uunet/usenet)
Newsgroups: comp.sources.games.bugs
Subject: Re: Bug in Spacewars
Summary: Spacewar works (I think) on Xenix 386
Keywords: Spacewars, UNIX V
Message-ID: <143@ispi.UUCP>
Date: 7 Jun 88 00:07:31 GMT
References: <314@psldev.Dayton.NCR.COM> <1157@ddsw1.UUCP>
Distribution: na
Organization: Intelligent Software Products, Inc.
Lines: 325

In article <1157@ddsw1.UUCP>, karl@ddsw1.UUCP (Karl Denninger) writes:
> In article <314@psldev.Dayton.NCR.COM> scott@psldev.Dayton.NCR.COM (Scott Thomas) writes:
> >
> >I have just received the spacewars sources and have run into a problem in
> >compiling them.  I have tried this on two different UNIX V boxes so I think that
> >something is wrong with the original sources(I hope).
> >
> >The problem is in the area of the references to "dbm.h" and libdbm.a.  These are
> >nowhere to be found on my systems and the README file makes no reference on how
> >this is to be handled.  There is a program by the name dbm.c but it requires a
> >rms.h header file and that is not on any of my UNIX systems either.  
> 
> They aren't there on SV systems, period.  (ouch)
> 
> These routines are, though, in Xenix (386 V2.2.1).  Not that it matters, the
> program compiles ok, but when run you simply get the "wait while the game
> cranks up" and then you're out to the shell again.
> 
> The daemon process keeps running until killed, but no joy on being able to
> get it to run.
> 
> Has anyone gotten it to work on a Xenix machine?  Xenix V/386 is very close
> to true "System V".  Would greatly appreciate any hints/tricks if you
> have...
> 

I have gotten spacewar to work on an SCO Xenix version 2.2.1 system.  I changed
the two files spacewar.h and Makefile (included below).  It seems to work,
although I don't have anybody else on my system.  I think the system
only processes a turn about every 15 seconds.

	Jonathan Bayer
	Intelligent Software Products, Inc.
	Rockville Centre, NY   11570

	uunet!ispi!jbayer


- - - - - cut here - - - -
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	spacewar.h
#	Makefile
# This archive created: Thu Jun  2 10:52:25 1988
export PATH; PATH=/bin:$PATH
if test -f 'spacewar.h'
then
	echo shar: will not over-write existing file "'spacewar.h'"
else
cat << \SHAR_EOF > 'spacewar.h'
/*
 * Spacewar - include file for general stuff
 *
 * Copyright 1984 obo Systems, Inc.
 * Copyright 1984 Dan Rosenblatt
 */

#ifdef VMS
#define VOID
#define delete dbmdelete
#endif /* VMS */

#ifdef BSD
#	define SWPIDFILE	"/usr/dir/sw/swpid"
#	define SWLGNFILE	"/usr/dir/sw/swlgn"
#else /* VMS SYSIII SYSV */
#ifdef VMS
#	define SWCOMFILE	"swmlbx"
#else /* SYSIII SYSV */
#	define SWCOMFILE	"/u/games/sw/swcomm"
#endif /* VMS SYSIII SYSV */
#endif /* BSD VMS SYSIII SYSV */

#ifdef VMS
#	define SWDATABASE	"$DISK2:[TSDIR.SW]swdb."
#	define SWGAME		"$DISK2:[TSDIR.SW]sw"
#	define SWREAD		"$DISK2:[TSDIR.SW]vmsrsw"
#	define SWNEWS		"$DISK2:[TSDIR.SW]swnews"
#	define SWERR		"$DISK2:[TSDIR.SW]swerr"
#	define SWOBJ		"$DISK2:[TSDIR.SW]swobj"
#else /* BSD SYSIII SYSV */
#	define SWDATABASE	"/u/games/sw/swdb"
#	define SWGAME		"/u/games/sw/sw"
#	define SWREAD		"/u/games/sw/rsw"
#	define SWNEWS		"/u/games/sw/swnews"
#	define SWERR		"/u/games/sw/swerr"
#	define SWOBJ		"/u/games/sw/swobj" /* see objupdate.c */
#endif /* VMS BSD SYSIII SYSV */

#define SWMASTER	"Jonathan"

#define PI		(3.1415926536)
#define TWOPI		(6.2831853072)
#define DEGTORAD	DIV(TWOPI,360.)
#define PROMPT		"\nPlay/See/Info/Complain/Mail/reBuild/Usercmd/Logoff/Who>"
#ifdef NULL
#undef	NULL
#endif
#define	NULL		(0)

/* uninteresting fudge factors */
#define VANGVDST	(3084.2514)		/* makes 45deg match 5000 */

/*
 * all floating-point operations through these macros
 * allowing co-processor routines to be substituted for in-line code
 */
#define ADD(x,y)	((x)+(y))
#define SUB(x,y)	((x)-(y))
#define	MUL(x,y)	((x)*(y))
#define DIV(x,y)	((x)/(y))
#define SQUARE(x)	((x)*(x))
#define CUBE(x)		((x)*(x)*(x))

extern double sqrt();
extern int rand();
#define SQRT(x)		(sqrt(x))
#define RANDOM(x)	(rand()%(x))

extern double atan2(),sin(),cos();
#define ATAN2(x,y)	(atan2((x),(y)))
#define SIN(x)		(sin(x))
#define COS(x)		(cos(x))

extern double fmod();
#define FMOD(x,y)	(fmod((x),(y)))
#define NEG(x)		(-(x))
#define INT(x)		((long)(x))
#define FLOAT(i)	((double)(i))
#define MAX(x,y)	(((x) > (y)) ? (x) : (y))
#define MIN(x,y)	(((x) < (y)) ? (x) : (y))

#ifdef DEBUG
extern VOID DBG(),VDBG();
#endif

typedef struct {
	double vec[3];
	double dst;
	char valid;
} dsplcmnt;
#define VECVALID 1
#define DSTVALID 2

dsplcmnt vdisp();
SHAR_EOF
fi # end of overwriting check
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
cat << \SHAR_EOF > 'Makefile'
#
#  Spacewar - makefile
# 
#  Copyright 1984 obo Systems, Inc.
#  Copyright 1984 Dan Rosenblatt
#
LDFLAGS= 
CFLAGS= -O -DVOID=void
LPR= lpr

INCLUDES= aln.h build.h crft.h flds.h login.h mlbx.h obj.h plyr.h \
	spacewar.h sys.h torp.h ucmd.h uio.h uio2.h universe.h
SOURCES= sw.c globals.c lckmsg.c proctrap.c shutdown.c \
	alninit.c objinit.c crftupdate.c objupdate.c \
	logon.c logoff.c \
	cmd.c prvcmd.c \
	build.c mail.c see.c usrcmd.c who.c \
	play.c plinit.c unplay.c \
	update.c \
	updaln.c upddmg.c upddsh.c updmov.c updobjs.c updsys.c updtorp.c \
	bfuncs.c bits.c damage.c fixdir.c mutils.c vdisp.c remove.c rpt.c \
	output.c scrn.c
OBJECTS= sw.o globals.o lckmsg.o proctrap.o shutdown.o \
	alninit.o objinit.o crftupdate.o objupdate.o \
	logon.o logoff.o \
	cmd.o prvcmd.o \
	build.o mail.o see.o usrcmd.o who.o \
	play.o plinit.o unplay.o \
	update.o \
	updaln.o upddmg.o upddsh.o updmov.o updobjs.o updsys.o updtorp.o \
	bfuncs.o bits.o damage.o fixdir.o mutils.o vdisp.o remove.o rpt.o \
	output.o scrn.o

all : sw psw rsw dmpdbm upddbm tstsz

.PRECIOUS: print send

print : Makefile ${INCLUDES} ${SOURCES} psw.c psw.sh vmspsw.c rsw.c vmsrsw.c \
	tget.c dmpdbm.c upddbm.c tstsz.c swobj.init dbm.h dbm.c \
	vmsdelmbx.c
	pr $? | ${LPR}
	touch print

send : Makefile ${INCLUDES} ${SOURCES} psw.c psw.sh vmspsw.c rsw.c vmsrsw.c \
	tget.c dmpdbm.c upddbm.c tstsz.c swobj.init doc dbm.h dbm.c \
	vmsdelmbx.c swnews
	uucp $? 'obo586!~/sw/'
	touch send

clean :
	rm *.o sw psw rsw dmpdbm upddbm tstsz

sw : ${OBJECTS}
	${CC} ${CFLAGS} ${LDFLAGS} -o sw ${OBJECTS} -ltermlib -ldbm -lm
	chmod u+s sw

psw : psw.c spacewar.h uio2.h
	${CC} ${CFLAGS} ${LDFLAGS} psw.c -o psw
	chmod u+s psw

rsw : rsw.c login.h uio.h universe.h spacewar.h
	${CC} ${CFLAGS} ${LDFLAGS} rsw.c -o rsw

dmpdbm : dmpdbm.c spacewar.h universe.h login.h sys.h crft.h mlbx.h \
	plyr.h ucmd.h bfuncs.o
	${CC} ${CFLAGS} ${LDFLAGS} dmpdbm.c bfuncs.o -ldbm -o dmpdbm

upddbm : upddbm.c spacewar.h universe.h login.h sys.h crft.h mlbx.h \
	plyr.h ucmd.h bfuncs.o
	${CC} ${CFLAGS} ${LDFLAGS} upddbm.c bfuncs.o -ldbm -o upddbm

tstsz : tstsz.c uio.h uio2.h spacewar.h
	${CC} ${CFLAGS} ${LDFLAGS} tstsz.c -o tstsz
	tstsz

lint : ${SOURCES} psw.c rsw.c dmpdbm.c upddbm.c tstsz.c
	lint ${CFLAGS} ${SOURCES}
	lint ${CFLAGS} psw.c
	lint ${CFLAGS} rsw.c
	lint ${CFLAGS} dmpdbm.c bfuncs.c
	lint ${CFLAGS} upddbm.c bfuncs.c
	lint ${CFLAGS} tstsz.c

bfuncs.o : spacewar.h

bits.o : spacewar.h

sw.o : spacewar.h

proctrap.o : spacewar.h universe.h login.h uio2.h

globals.o : universe.h torp.h sys.h obj.h login.h crft.h aln.h spacewar.h

logon.o : spacewar.h universe.h login.h

logoff.o : universe.h login.h spacewar.h

output.o : spacewar.h universe.h login.h flds.h sys.h

cmd.o : spacewar.h universe.h login.h uio.h plyr.h mlbx.h uio2.h

shutdown.o : spacewar.h universe.h login.h

mail.o : spacewar.h universe.h login.h mlbx.h plyr.h

build.o : universe.h login.h build.h sys.h crft.h obj.h spacewar.h

see.o : universe.h login.h sys.h crft.h plyr.h spacewar.h

usrcmd.o : spacewar.h universe.h login.h ucmd.h

objinit.o : spacewar.h universe.h obj.h

objupdate.o : spacewar.h universe.h obj.h

alninit.o : spacewar.h universe.h sys.h aln.h obj.h build.h

prvcmd.o : spacewar.h universe.h login.h sys.h aln.h build.h obj.h crft.h torp.h

who.o : spacewar.h universe.h login.h

play.o : spacewar.h universe.h login.h sys.h crft.h flds.h build.h aln.h obj.h \
	torp.h ucmd.h

plinit.o : spacewar.h universe.h login.h sys.h crft.h obj.h aln.h torp.h build.h

updobjs.o : spacewar.h universe.h obj.h

damage.o : spacewar.h universe.h sys.h login.h crft.h aln.h flds.h build.h \
	obj.h torp.h

lckmsg.o : spacewar.h

fixdir.o : spacewar.h universe.h sys.h crft.h flds.h

crftupdate.o : universe.h login.h sys.h crft.h spacewar.h

unplay.o : spacewar.h universe.h plyr.h login.h crft.h sys.h

rpt.o : universe.h login.h sys.h crft.h flds.h spacewar.h

remove.o : spacewar.h sys.h login.h crft.h obj.h torp.h universe.h flds.h aln.h

scrn.o : universe.h login.h flds.h spacewar.h sys.h crft.h build.h aln.h obj.h \
	torp.h

update.o : spacewar.h universe.h login.h sys.h aln.h build.h flds.h torp.h \
	crft.h

upddmg.o : spacewar.h universe.h sys.h login.h crft.h build.h aln.h flds.h \
	obj.h torp.h

updsys.o : spacewar.h universe.h login.h sys.h obj.h aln.h crft.h build.h \
	flds.h torp.h

upddsh.o : spacewar.h universe.h login.h sys.h aln.h crft.h flds.h obj.h torp.h

updmov.o : spacewar.h universe.h sys.h login.h obj.h crft.h aln.h torp.h \
	build.h flds.h

updtorp.o : spacewar.h universe.h sys.h login.h crft.h aln.h torp.h obj.h

updaln.o : spacewar.h universe.h sys.h aln.h build.h login.h crft.h torp.h \
	obj.h flds.h

vdisp.o : spacewar.h universe.h login.h sys.h aln.h crft.h obj.h torp.h
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0