[net.sources.games] Context Diffs for Larn 12.0 on MS-DOS

peter@icom.UUCP (No Zipnicks are) (09/24/86)

After a long delay due to profession exigencies, here are the diffs for
MS-DOS larn. Using context diffs vs. regular diff -c added greatly to the
bulk of this posting, I hope it's worth it. Now that I'm back in town
I can respond to question/calls about this.
pk 

#! /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:
#	makefile
#	lnkit
#	README
#	fakepwd.c
#	fortune.c
#	monster.c
#	spells.c
#	tputs.c
#	tgoto.c
#	config.diff
#	data.diff
#	diag.diff
#	display.diff
#	global.diff
#	header.diff
#	main.diff
#	nap.diff
#	savelev.diff
#	signal.diff
#	store.diff
#	tok.diff
# This archive created: Tue Sep 23 17:15:00 1986
export PATH; PATH=/bin:$PATH
echo shar: extracting "'makefile'" '(3767 characters)'
if test -f 'makefile'
then
	echo shar: will not over-write existing file "'makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'makefile'
	X# Configuration options
	X#  LARNHOME is the directory where the larn data files will be installed.
	X#  BINDIR is the directory where the larn binary will be installed.
	X
	XLARNHOME=.
	XBINDIR =/bin
	X
	X
	X# -ltermlib may need to be changed to -ltermcap on some systems
	XTERMLIB= -ltermcap
	X
	X# Available compile time options:
	X#   WIZID=xxx  - this is the userid (or playerid) of the wizard.  Default is
	X#					zero (superuser), which disables all wizard functions.
	X#					Players must have this userid (or playerid) in order to
	X#					become the non-scoring wizard player.  Definition of WIZID
	X#					to non-zero will enable the special wizard debugging
	X#					commands.  For root to become wizard, use WIZID= -1.
	X#   EXTRA      - incorporates code to gather additional performance statistics
	X#   TIMECHECK  - incorporates code to disable play during working hours (8-5)
	X#   SYSV       - use system III/V (instead of V7) type ioctl calls
	X#   BSD        - use BSD specific features (mostly timer and signal stuff)
	X
	X#   BSD4.1     - use BSD4.1 to avoid some 4.2 dependencies (must be used with
	X#					BSD above; do not mix with SYSV)
	X#   HIDEBYLINK - if defined, the program attempts to hide from ps
	X#   DOCHECKPOINTS - if not defined, checkpoint files are periodically written
	X#                   by the larn process (no forking) if enabled in the .larnopts
	X#					description file.  Checkpointing is handy on an unreliable
	X#					system, but takes CPU. Inclusion of DOCHECKPOINTS will cause
	X#					fork()ing to perform the checkpoints (again if enabled in
	X#					the .larnopts file).  This usually avoids pauses in larn
	X#					while the checkpointing is being done (on large machines).
	X#   SAVEINHOME - put save files in users HOME instead of LARNHOME the as default
	X#	VER        - This is the version of the software, example:  12
	X#	SUBVER     - This is the revision of the software, example:  1
	X#	FLUSHNO=#  - Set the input queue excess flushing threshold (default 5)
	X#	NOVARARGS  - Define for systems that don't have varargs (a default varargs
	X#					will be used).
	X#	MACRORND   - Define to use macro version of rnd() and rund() (fast & big)
	X#	UIDSCORE   - Define to use user id's to manage scoreboard.  Leaving this out
	X#					will cause player id's from the file ".playerids" to be used
	X#					instead.  (.playerids is created upon demand).  Only one
	X#					entry per id # is allowed in each scoreboard
	X#					(winning & non-winning).
	X#	VT100	  - Compile for using vt100 family of terminals.  Omission of this
	X#					define will cause larn to use termcap, but it will be MUCH
	X#					slower due to an extra layer of output interpretation. 
	X#					Also, only VT100 mode allows 2 different standout modes,
	X#					inverse video, and bold video.  And only in VT100 mode is
	X#					the scrolling region of the terminal used (much nicer than
	X#					insert/delete line sequences to simulate it, if VT100 is
	X#					omitted).
	X#	NONAP	  - This causes napms() to return immediately instead of delaying
	X#					n milliseconds.  This define may be needed on some systems
	X#					if the nap stuff does not work correctly (possible hang).
	X#					nap() is primarilly used to delay for effect when casting
	X#					missile type spells.
	X#
	X
	XOPTIONS = -DSYSV -DVER=12 -DSUBVER=0 -DNONAP -DWIZID=-1 -DEXTRA -J -Ml
	X# End of configurable make options
	X########################################################################
	X#
	XOBJS= main.obj object.obj create.obj tok.obj display.obj global.obj data.obj io.obj monster.obj\
	X	store.obj diag.obj help.obj config.obj nap.obj bill.obj scores.obj signal.obj moreobj.obj\
	X	movem.obj regen.obj fortune.obj savelev.obj fakepwd.obj spells.obj
	X
	XDOTFILES= larn.hlp larnmaze larnopts lfortune
	X
	XCFLAGS= $(OPTIONS) 
	Xlarn: larn12.exe
	Xlarn12.exe: $(OBJS) 
	X	link @lnkit
	X
	Xall: larn
	X
	X$(OBJS): header.h
	X
SHAR_EOF
if test 3767 -ne "`wc -c < 'makefile'`"
then
	echo shar: error transmitting "'makefile'" '(should have been 3767 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'lnkit'" '(414 characters)'
if test -f 'lnkit'
then
	echo shar: will not over-write existing file "'lnkit'"
else
sed 's/^	X//' << \SHAR_EOF > 'lnkit'
	XCONFIG+DISPLAY+IO+global+fortune+     
	XMAIN+MOREOBJ+MOVEM+REGEN+SAVELEV+nap+ 
	XDATA+TOK+SIGNAL+FAKEpwd+monster+(object)+(create)+(spells)+
	X(BILL+STORE+HELP)+(DIAG+scores)/noi/map/stack:5000 
	Xlarn12
	XLarn12
	X\lib\termlibl;       
	X
	X
	XBILL
	XCONFIG
	XCREATE
	XDATA  
	XDIAG  
	XDISPLAY
	XFAKEPWD
	XFORTUNE
	XGLOBAL 
	XHELP   
	XIO     
	XMAIN   
	XMONSTER
	XMOREOBJ
	XMOVEM  
	XNAP    
	XOBJECT 
	XREGEN  
	XSAVELEV
	XSCORES 
	XSIGNAL 
	XSTORE  
	XTEST   
	XTOK    
	X
SHAR_EOF
if test 414 -ne "`wc -c < 'lnkit'`"
then
	echo shar: error transmitting "'lnkit'" '(should have been 414 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'README'" '(4067 characters)'
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
sed 's/^	X//' << \SHAR_EOF > 'README'
	X    Ok, folks this is the larn port for MS-DOS.  My apologies for the
	X    delay - Work (as in being out of town) has interfered greatly with
	X    getting this product into a shipped form. These are diffs for
	X    Microsoft C, V4.0. If you have a resonably UNIX-compatable C compiler
	X    that supports "huge" model, you can get it to compile on this also.  
	X
	XDistribution Notes: 
	X
	X1. Diff files.  
	X
	X    These have been produced with the "diffc" utility that has been
	X    shipped on the net.  Apply these files to the original UNIX source
	X    shipped on the net with the "patch" utility that has been distributed
	X    on the net.  
	X    List of files: 
	X    config.diff 
	X    data.diff
	X    diag.diff
	X    display.diff 
	X    global.diff 
	X    header.diff 
	X    main.diff 
	X    savelev.diff
	X    signal.diff 
	X    store.diff 
	X    tok.diff
	X
	X2. New Files.
	X
	X    I have included a new makefile, a link command file (lnkit), source
	X    for UNIX compatability routines, and source for 2 badly hacked
	X    original source files. The makefile should work with the make utility
	X    shipped with MSC - you may have to change it for your particular
	X    make/compiler. I have also include 2 code fragments from termcap
	X    (tputs and tgoto), which came from a public domain version of the
	X    ex/vi editor.
	X    
	X    List of new files:
	X    
	X	makefile
	X	lnkit
	X	README
	X	fakepwd.c	(Unix compatability for ms-dos)
	X	fortune.c
	X	monster.c
	X	spells.c	(spell code hacked out of monster)
	X	tputs.c		(from termcap)
	X	tgoto.c		(from termcap)
	X
	X3. Compiling
	X
	X    You may find that some include files in the game source are not
	X    present in the Microsoft distribution. In this case you need to bring
	X    over the include files from a unix system, or hack out references to
	X    the included files. I chose the former alternative some 2 years ago
	X    when I bought my AT, with the reasoning that it was easier to humor
	X    the compiler that do remove the code. Unfortunately, what started out
	X    as a bit of inspired laziness grew into a mania, as my DOS machine has
	X    evolved to a highly bastardized (and unix compatable) environment. I
	X    have NOT attempted to compile this code with a stock MSC distribution.
	X    I have included all *CODE* to make the thing run on a stock ms-dos.
	X    To keep the your particular compiler happy, you are on your own....
	X
	X4. Running
	X
	X    I am using termcap routines to generate ansi crt escape sequences. You
	X    will need ansi.sys to run the program. The code as distributed will
	X    run on a 512K machine, and maybe can use less memory (again, I can't
	X    get my hands on a machine with less than 512K, so I don't know how
	X    small it can be.) The program uses overlays, with the whole idea being
	X    the best trade-off between size and disk access. You make fiddle with
	X    the overlays to suit your particular requirements. I have not made a
	X    detailed analysis of what calls what, this is a good starting point if
	X    you need to shoehorn this into a small machine. If you are running a
	X    non-pc, non-unix 8086 box, change the escape sequences in header.h and
	X    io.c to suit your particular hardware. Since I am using no fancyness
	X    whatsoever, it also should run on anything that runs ms-dos.
	X    
	X5. Bugs (*SIGH*)
	X
	X    There are 2 that I know of. The first is "phantom" items that show up
	X    in the inventory. This one is sporadic, and i believe is trigged
	X    somewhere in the object-handling code (object.c). I jus't haven't
	X    found it yet. There is also a null pointer dereference somewhere...
	X    sometime the program you run after the game will crash and burn.  No
	X    2. is going to be tough to find... but let's hope we do. If somebody
	X    out there has a 8086 ICE, you're just the man to do the job.
	X    
	X
	X6. Binaries
	X
	X    The complete source  fits on 1 360K disk. Ditto with a complete
	X    run-time disk. SOOO. if you want both, send 2(360K) or 1(1.2MB)
	X    disk(s) and a SASE to: 
	X
	X    Peter Kerrigan
	X    ICOM Systems
	X    3415 N. Kennicott Ave.
	X    Arlington Hts, IL, 60004, USA.
	X    +1 312 506 1444
	X
	X    Net: peter@icom.uucp or ..!ihnp4!icom!peter
SHAR_EOF
if test 4067 -ne "`wc -c < 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 4067 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'fakepwd.c'" '(1052 characters)'
if test -f 'fakepwd.c'
then
	echo shar: will not over-write existing file "'fakepwd.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'fakepwd.c'
	X#include <pwd.h>
	X
	Xstatic struct passwd fake = {
	X    "root",
	X    "Baldnessxxx",
	X    0,
	X    0,
	X    "old",
	X    "The Big Guy",
	X    "0000-Godlike",
	X    "/",
	X    "/command"
	X};
	X
	Xstatic struct comment hey = {
	X    "Bald",
	X    "Hello",
	X    "00000",
	X    "Gag!"
	X};
	X
	Xstatic int huh = 1;
	X
	Xstruct passwd *getpwent()
	X{
	X    if (huh) {
	X	huh = 0;
	X	return(&fake);
	X    }
	X      else return ((struct passwd *) 0);
	X}
	X
	Xstruct passwd *getpwuid(uid)
	Xint uid;
	X{
	X    if (uid == 0) {
	X	return(&fake);
	X    }
	X    else return ((struct passwd *) 0);
	X}
	X
	Xstruct passwd *getpwnam(name)
	Xchar *name;
	X{
	X    if (strcmp(fake.pw_name, name) == 0)
	X     return(&fake);
	X     else return((struct passwd *) 0);
	X}
	X
	Xvoid setpwent()
	X{
	X    huh =1;
	X}
	X
	Xvoid endpwent()
	X{
	X    huh = 1;
	X}
	X
	Xint getuid()
	X{
	X    return(0);
	X}
	X
	Xint getgid()
	X{
	X    return(0);
	X}
	X
	Xint geteuid()
	X{
	X    return(0);
	X}
	X
	Xchar *getlogin()
	X{
	X    return(fake.pw_name);
	X}
	X
	Xint ioctl()
	X{
	X	return(0);
	X}
	X
	Xint times()
	X{
	X	return(0);
	X}
	X
	Xint sleep()
	X{
	X	return(0);
	X}
	X
	Xint fork()
	X{
	X	return(-1);
	X}
	X
	Xint wait()
	X{
	X	return(0);
	X}
	X
	Xint kill()
	X{
	X	return(0);
	X}
	X
SHAR_EOF
if test 1052 -ne "`wc -c < 'fakepwd.c'`"
then
	echo shar: error transmitting "'fakepwd.c'" '(should have been 1052 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'fortune.c'" '(1400 characters)'
if test -f 'fortune.c'
then
	echo shar: will not over-write existing file "'fortune.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'fortune.c'
	X/* fortune.c		 Larn is copyrighted 1986 by Noah Morgan. */
	X#include <sys/types.h>
	X#include <sys/stat.h>
	X
	X#ifndef BSD4.1
	X#include <fcntl.h>
	X#else BSD4.1
	X#define O_RDONLY 0
	X#endif BSD4.1
	X
	X#include "header.h"
	X#define DSIZ 120
	X/*
	X *	function to return a random fortune from the fortune file
	X */
	Xstatic char *base=0;	/* pointer to the fortune text */
	Xstatic char **flines=0;	/* array of pointers to each fortune */
	Xstatic int fd = 0;		/* always true if we have load the fortune info */
	Xstatic int nlines=0;	/* # lines in fortune database */
	Xstatic char domex[DSIZ]; /* a line holding a fortune */
	Xchar *strchr();
	Xchar *fortune(file)
	X	char *file;
	X	{
	X	register char *p;
	X	register int lines,tmp;
	X	struct stat stat;
	X	if (1)
	X		{
	X		if ((fd=open(file,O_RDONLY|O_BINARY)) < 0)	/* open the file */
	X			return(0); /* can't find file */
	X
	X	/* find out how big fortune file is and get memory for it */
	X		stat.st_size = 16384;
	X		if ((fstat(fd,&stat) < 0))
	X			{
	X			close(fd); fd= -1;  return(0); 	/* can't stat file */
	X			}
	X
	X	/* read in the entire fortune file */
	X		if (lseek(fd, (long) rund((int)stat.st_size), 0) < 0)
	X				{ close(fd); return(0); }
	X
	X		if ((tmp = read(fd,domex,DSIZ)) < 0)
	X			{
	X			close(fd); fd= -1; return(0); 	/* can't read file */
	X			}
	X		close(fd);  base[DSIZ-1]=0;	/* final NULL termination */
	X
	X		base = strchr(domex,'\n');
	X		base++;
	X		p = strchr(base, '\r');
	X		*(++p) = '\0';
	X		return(base);
	X		}
	X}
	X
SHAR_EOF
if test 1400 -ne "`wc -c < 'fortune.c'`"
then
	echo shar: error transmitting "'fortune.c'" '(should have been 1400 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'monster.c'" '(25032 characters)'
if test -f 'monster.c'
then
	echo shar: will not over-write existing file "'monster.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'monster.c'
	X/*
	X *	monster.c		Larn is copyrighted 1986 by Noah Morgan. 
	X *
	X *	This file contains the following functions:
	X *	----------------------------------------------------------------------------
	X *
	X *	createmonster(monstno) 		Function to create a monster next to the player
	X *		int monstno;
	X *
	X *	int cgood(x,y,itm,monst)	Function to check location for emptiness
	X *		int x,y,itm,monst;
	X *
	X *	createitem(it,arg) 			Routine to place an item next to the player
	X *		int it,arg;
	X *
	X *	cast() 				Subroutine called by parse to cast a spell for the user
	X *
	X *	speldamage(x) 		Function to perform spell functions cast by the player
	X *		int x;
	X *
	X *	loseint()			Routine to decrement your int (intelligence) if > 3
	X *
	X *	isconfuse() 		Routine to check to see if player is confused
	X *
	X *	nospell(x,monst)	Routine to return 1 if a spell doesn't affect a monster
	X *		int x,monst;
	X *
	X *	fullhit(xx)			Function to return full damage against a monst (aka web)
	X *		int xx;
	X *
	X *	direct(spnum,dam,str,arg)	Routine to direct spell damage 1 square in 1 dir
	X *		int spnum,dam,arg;
	X *		char *str;
	X *
	X *	godirect(spnum,dam,str,delay,cshow)		Function to perform missile attacks
	X *		int spnum,dam,delay;
	X *		char *str,cshow;
	X *
	X *	ifblind(x,y)	Routine to put "monster" or the monster name into lastmosnt
	X *		int x,y;
	X *
	X *	tdirect(spnum)			Routine to teleport away a monster
	X *		int spnum;
	X *
	X *	omnidirect(sp,dam,str)  Routine to damage all monsters 1 square from player
	X *		int sp,dam;
	X *		char *str;
	X *
	X *	dirsub(x,y)			Routine to ask for direction, then modify x,y for it
	X *		int *x,*y;
	X *
	X *	vxy(x,y)		  	Routine to verify/fix (*x,*y) for being within bounds
	X *		int *x,*y;
	X *
	X *	dirpoly(spnum)		Routine to ask for a direction and polymorph a monst
	X *		int spnum;
	X *
	X *	hitmonster(x,y) 	Function to hit a monster at the designated coordinates
	X *		int x,y;
	X *
	X *	hitm(x,y,amt)		Function to just hit a monster at a given coordinates
	X *		int x,y,amt;
	X *
	X *	hitplayer(x,y) 		Function for the monster to hit the player from (x,y)
	X *		int x,y;
	X *
	X *	dropsomething(monst) 	Function to create an object when a monster dies
	X *		int monst;
	X *
	X *	dropgold(amount) 		Function to drop some gold around player
	X *		int amount;
	X *
	X *	something(level) 		Function to create a random item around player
	X *		int level;
	X *
	X *	newobject(lev,i) 		Routine to return a randomly selected new object
	X *		int lev,*i;
	X *
	X *  spattack(atckno,xx,yy) 	Function to process special attacks from monsters
	X *  	int atckno,xx,yy;
	X *
	X *	checkloss(x) 	Routine to subtract hp from user and flag bottomline display
	X *		int x;
	X *
	X *	annihilate()   Routine to annihilate monsters around player, playerx,playery
	X *
	X *	newsphere(x,y,dir,lifetime)  Function to create a new sphere of annihilation
	X *		int x,y,dir,lifetime;
	X *
	X *	rmsphere(x,y)		Function to delete a sphere of annihilation from list
	X *		int x,y;
	X *
	X *	sphboom(x,y)		Function to perform the effects of a sphere detonation
	X *		int x,y;
	X *
	X *	genmonst()			Function to ask for monster and genocide from game
	X *
	X */
	X#include "header.h"
	X
	X/*
	X *	createmonster(monstno) 		Function to create a monster next to the player
	X *		int monstno;
	X *
	X *	Enter with the monster number (1 to MAXMONST+8)
	X *	Returns no value.
	X */
	Xcreatemonster(mon)
	X	int mon;
	X	{
	X	register int x,y,k,i;
	X	if (mon<1 || mon>MAXMONST+8)	/* check for monster number out of bounds */
	X		{
	X		beep(); lprintf("\ncan't createmonst(%d)\n",(long)mon); nap(3000); return;
	X		}
	X	while (monster[mon].genocided && mon<MAXMONST) mon++; /* genocided? */
	X	for (k=rnd(8), i= -8; i<0; i++,k++)	/* choose direction, then try all */
	X		{
	X		if (k>8) k=1;	/* wraparound the diroff arrays */
	X		x = playerx + diroffx[k];		y = playery + diroffy[k];
	X		if (cgood(x,y,0,1))	/* if we can create here */
	X			{
	X			mitem[x][y] = mon;
	X			hitp[x][y] = monster[mon].hitpoints;
	X			stealth[x][y]=know[x][y]=0;
	X			switch(mon)
	X				{
	X				case ROTHE: case POLTERGEIST: case VAMPIRE: stealth[x][y]=1;
	X				};
	X			return;
	X			}
	X		}
	X	}
	X
	X/*
	X *	int cgood(x,y,itm,monst)	  Function to check location for emptiness
	X *		int x,y,itm,monst;
	X *
	X *	Routine to return TRUE if a location does not have itm or monst there
	X *	returns FALSE (0) otherwise
	X *	Enter with itm or monst TRUE or FALSE if checking it
	X *	Example:  if itm==TRUE check for no item at this location
	X *			  if monst==TRUE check for no monster at this location
	X *	This routine will return FALSE if at a wall or the dungeon exit on level 1
	X */
	Xint cgood(x,y,itm,monst)
	X	register int x,y;
	X	int itm,monst;
	X	{
	X	if ((y>=0) && (y<=MAXY-1) && (x>=0) && (x<=MAXX-1)) /* within bounds? */
	X	  if (item[x][y]!=OWALL)	/* can't make anything on walls */
	X		if (itm==0 || (item[x][y]==0))	/* is it free of items? */
	X		  if (monst==0 || (mitem[x][y]==0))	/* is it free of monsters? */
	X		    if ((level!=1) || (x!=33) || (y!=MAXY-1)) /* not exit to level 1 */
	X			  return(1);
	X	return(0);
	X	}
	X
	X/*
	X *	createitem(it,arg) 		Routine to place an item next to the player
	X *		int it,arg;
	X *
	X *	Enter with the item number and its argument (iven[], ivenarg[])
	X *	Returns no value, thus we don't know about createitem() failures.
	X */
	Xcreateitem(it,arg)
	X	int it,arg;
	X	{
	X	register int x,y,k,i;
	X	if (it >= MAXOBJ) return;	/* no such object */
	X	for (k=rnd(8), i= -8; i<0; i++,k++)	/* choose direction, then try all */
	X		{
	X		if (k>8) k=1;	/* wraparound the diroff arrays */
	X		x = playerx + diroffx[k];		y = playery + diroffy[k];
	X		if (cgood(x,y,1,0))	/* if we can create here */
	X			{
	X			item[x][y] = it;  know[x][y]=0;  iarg[x][y]=arg;  return;
	X			}
	X		}
	X	}
	X
	X/*
	X *	fullhit(xx)		Function to return full damage against a monster (aka web)
	X *		int xx;
	X *
	X *	Function to return hp damage to monster due to a number of full hits
	X *	Enter with the number of full hits being done
	X */
	Xfullhit(xx)
	X	int xx;
	X	{
	X	register int i;
	X	if (xx<0 || xx>20) return(0);	/* fullhits are out of range */
	X	if (c[LANCEDEATH]) return(10000);	/* lance of death */
	X	i = xx * ((c[WCLASS]>>1)+c[STRENGTH]+c[STREXTRA]-c[HARDGAME]-12+c[MOREDAM]); 
	X	return( (i>=1) ? i : xx );
	X	}
	X
	X/*
	X *	ifblind(x,y)	Routine to put "monster" or the monster name into lastmosnt
	X *		int x,y;
	X *
	X *	Subroutine to copy the word "monster" into lastmonst if the player is blind
	X *	Enter with the coordinates (x,y) of the monster
	X *	Returns no value.
	X */
	Xifblind(x,y)
	X	int x,y;
	X	{
	X	char *p;
	X	vxy(&x,&y);	/* verify correct x,y coordinates */
	X	if (c[BLINDCOUNT]) { lastnum=279;  p="monster"; }
	X		else { lastnum=mitem[x][y];  p=monster[lastnum].name; }
	X	strcpy(lastmonst,p);
	X	}
	X
	X/*
	X *	vxy(x,y)	   Routine to verify/fix coordinates for being within bounds
	X *		int *x,*y;
	X *
	X *	Function to verify x & y are within the bounds for a level
	X *	If *x or *y is not within the absolute bounds for a level, fix them so that
	X *	  they are on the level.
	X *	Returns TRUE if it was out of bounds, and the *x & *y in the calling
	X *	routine are affected.
	X */
	Xvxy(x,y)
	X	int *x,*y;
	X	{
	X	int flag=0;
	X	if (*x<0) { *x=0; flag++; }
	X	if (*y<0) { *y=0; flag++; }
	X	if (*x>=MAXX) { *x=MAXX-1; flag++; }
	X	if (*y>=MAXY) { *y=MAXY-1; flag++; }
	X	return(flag);
	X	}
	X
	X/*
	X *	hitmonster(x,y) 	Function to hit a monster at the designated coordinates
	X *		int x,y;
	X *
	X *	This routine is used for a bash & slash type attack on a monster
	X *	Enter with the coordinates of the monster in (x,y).
	X *	Returns no value.
	X */
	Xhitmonster(x,y)
	X	int x,y;
	X	{
	X	register int tmp,monst,damag,flag;
	X	if (c[TIMESTOP])  return;  /* not if time stopped */
	X	vxy(&x,&y);	/* verify coordinates are within range */
	X	if ((monst = mitem[x][y]) == 0) return;
	X	hit3flag=1;  ifblind(x,y);
	X	tmp = monster[monst].armorclass + c[LEVEL] + c[DEXTERITY] + c[WCLASS]/4 - 12;
	X	cursors();
	X	if ((rnd(20) < tmp-c[HARDGAME]) || (rnd(71) < 5)) /* need at least random chance to hit */
	X		{
	X		lprcat("\nYou hit");  flag=1;
	X		damag = fullhit(1);  
	X		if (damag<9999) damag=rnd(damag)+1;
	X		}
	X	else
	X		{
	X		lprcat("\nYou missed");  flag=0;
	X		}
	X	lprcat(" the "); lprcat(lastmonst);
	X	if (flag)	/* if the monster was hit */
	X	  if ((monst==RUSTMONSTER) || (monst==DISENCHANTRESS) || (monst==CUBE))
	X		if (c[WIELD]>0)
	X		  if (ivenarg[c[WIELD]] > -10)
	X			{
	X			lprintf("\nYour weapon is dulled by the %s",lastmonst); beep();
	X			--ivenarg[c[WIELD]];
	X			}
	X	if (flag)  hitm(x,y,damag);
	X	if (monst == VAMPIRE) if (hitp[x][y]<25)  { mitem[x][y]=BAT; know[x][y]=0; }
	X	}
	X
	X/*
	X *	hitm(x,y,amt)		Function to just hit a monster at a given coordinates
	X *		int x,y,amt;
	X *
	X *	Returns the number of hitpoints the monster absorbed
	X *	This routine is used to specifically damage a monster at a location (x,y)
	X *	Called by hitmonster(x,y)
	X */
	Xhitm(x,y,amt)
	X	int x,y;
	X	register amt;
	X	{
	X	register int monst;
	X	int hpoints,amt2;
	X	vxy(&x,&y);	/* verify coordinates are within range */
	X	amt2 = amt;		/* save initial damage so we can return it */
	X	monst = mitem[x][y];
	X	if (c[HALFDAM]) amt >>= 1;	/* if half damage curse adjust damage points */
	X	if (amt<=0) amt2 = amt = 1;
	X	lasthx=x;  lasthy=y;
	X	stealth[x][y]=1;	/* make sure hitting monst breaks stealth condition */
	X	c[HOLDMONST]=0;	/* hit a monster breaks hold monster spell	*/
	X	switch(monst) /* if a dragon and orb(s) of dragon slaying	*/
	X		{
	X		case WHITEDRAGON:		case REDDRAGON:			case GREENDRAGON:
	X		case BRONZEDRAGON:		case PLATINUMDRAGON:	case SILVERDRAGON:
	X			amt *= 1+(c[SLAYING]<<1);	break;
	X		}
	X/* invincible monster fix is here */
	X	if (hitp[x][y] > monster[monst].hitpoints)
	X		hitp[x][y] = monster[monst].hitpoints;
	X	if ((hpoints = hitp[x][y]) <= amt)
	X		{
	X#ifdef EXTRA
	X		c[MONSTKILLED]++;
	X#endif
	X		lprintf("\nThe %s died!",lastmonst);
	X		raiseexperience((long)monster[monst].experience);
	X		amt = monster[monst].gold;  if (amt>0) dropgold(rnd(amt)+amt);
	X		dropsomething(monst);	disappear(x,y);	bottomline();
	X		return(hpoints);
	X		}
	X	hitp[x][y] = hpoints-amt;	return(amt2);
	X	}
	X
	X/*
	X *	hitplayer(x,y) 		Function for the monster to hit the player from (x,y)
	X *		int x,y;
	X *
	X *	Function for the monster to hit the player with monster at location x,y
	X *	Returns nothing of value.
	X */
	Xhitplayer(x,y)
	X	int x,y;
	X	{
	X	register int dam,tmp,mster,bias;
	X	vxy(&x,&y);	/* verify coordinates are within range */
	X	lastnum = mster = mitem[x][y];
	X/*	spirit naga's and poltergeist's do nothing if scarab of negate spirit	*/
	X	if (c[NEGATESPIRIT] || c[SPIRITPRO])  if ((mster ==POLTERGEIST) || (mster ==SPIRITNAGA))  return;
	X/*	if undead and cube of undead control	*/
	X	if (c[CUBEofUNDEAD] || c[UNDEADPRO]) if ((mster ==VAMPIRE) || (mster ==WRAITH) || (mster ==ZOMBIE)) return;
	X	if ((know[x][y]&1) == 0)
	X		{
	X		know[x][y]=1; show1cell(x,y);
	X		}
	X	bias = (c[HARDGAME]) + 1;
	X	hitflag = hit2flag = hit3flag = 1;
	X	yrepcount=0;
	X	cursors();	ifblind(x,y);
	X	if (c[INVISIBILITY]) if (rnd(33)<20) 
	X		{
	X		lprintf("\nThe %s misses wildly",lastmonst);	return;
	X		}
	X	if (c[CHARMCOUNT]) if (rnd(30)+5*monster[mster].level-c[CHARISMA]<30)
	X		{
	X		lprintf("\nThe %s is awestruck at your magnificence!",lastmonst);
	X		return;
	X		}
	X	if (mster==BAT) dam=1;
	X	else
	X		{
	X		dam = monster[mster].damage;
	X		dam += rnd((int)((dam<1)?1:dam)) + monster[mster].level;
	X		}
	X	tmp = 0;
	X	if (monster[mster].attack>0)
	X	  if (((dam + bias + 8) > c[AC]) || (rnd((int)((c[AC]>0)?c[AC]:1))==1))
	X		{ if (spattack(monster[mster].attack,x,y)) { flushall(); return; }
	X		  tmp = 1;  bias -= 2; cursors(); }
	X	if (((dam + bias) > c[AC]) || (rnd((int)((c[AC]>0)?c[AC]:1))==1))
	X		{
	X		lprintf("\n  The %s hit you ",lastmonst);	tmp = 1;
	X		if ((dam -= c[AC]) < 0) dam=0;
	X		if (dam > 0) { losehp(dam); bottomhp(); flushall(); }
	X		}
	X	if (tmp == 0)  lprintf("\n  The %s missed ",lastmonst);
	X	}
	X
	X/*
	X *	dropsomething(monst) 	Function to create an object when a monster dies
	X *		int monst;
	X *
	X *	Function to create an object near the player when certain monsters are killed
	X *	Enter with the monster number
	X *	Returns nothing of value.
	X */
	Xdropsomething(monst)
	X	int monst;
	X	{
	X	switch(monst)
	X		{
	X		case ORC:			  case NYMPH:	   case ELF:	  case TROGLODYTE:
	X		case TROLL:			  case ROTHE:	   case VIOLETFUNGI:
	X		case PLATINUMDRAGON:  case GNOMEKING:  case REDDRAGON:
	X			something(level); return;
	X
	X		case LEPRECHAUN: if (rnd(101)>=75) creategem();
	X						 if (rnd(5)==1) dropsomething(LEPRECHAUN);   return;
	X		}
	X	}
	X
	X/*
	X *	dropgold(amount) 	Function to drop some gold around player
	X *		int amount;
	X *
	X *	Enter with the number of gold pieces to drop
	X *	Returns nothing of value.
	X */
	Xdropgold(amount)
	X	register int amount;
	X	{
	X	if (amount > 250) createitem(OMAXGOLD,amount/100);  else  createitem(OGOLDPILE,amount);
	X	}
	X
	X/*
	X *	something(level) 	Function to create a random item around player
	X *		int level;
	X *
	X *	Function to create an item from a designed probability around player
	X *	Enter with the cave level on which something is to be dropped
	X *	Returns nothing of value.
	X */
	Xsomething(level)
	X	int level;
	X	{
	X	register int j;
	X	int i;
	X	if (level<0 || level>MAXLEVEL+MAXVLEVEL) return;	/* correct level? */
	X	if (rnd(101)<8) something(level); /* possibly more than one item */
	X	j = newobject(level,&i);		createitem(j,i);
	X	}
	X
	X/*
	X *	newobject(lev,i) 	Routine to return a randomly selected new object
	X *		int lev,*i;
	X *
	X *	Routine to return a randomly selected object to be created
	X *	Returns the object number created, and sets *i for its argument
	X *	Enter with the cave level and a pointer to the items arg
	X */
	Xstatic char nobjtab[] = { 0, OSCROLL,  OSCROLL,  OSCROLL,  OSCROLL, OPOTION,
	X	OPOTION, OPOTION, OPOTION, OGOLDPILE, OGOLDPILE, OGOLDPILE, OGOLDPILE, 
	X	OBOOK, OBOOK, OBOOK, OBOOK, ODAGGER, ODAGGER, ODAGGER, OLEATHER, OLEATHER,
	X	OLEATHER, OREGENRING, OPROTRING, OENERGYRING, ODEXRING, OSTRRING, OSPEAR,
	X	OBELT, ORING, OSTUDLEATHER, OSHIELD, OFLAIL, OCHAIN, O2SWORD, OPLATE,
	X	OLONGSWORD };
	X
	Xnewobject(lev,i)
	X	register int lev,*i;
	X	{
	X	register int tmp=32,j;
	X	if (level<0 || level>MAXLEVEL+MAXVLEVEL) return(0);	/* correct level? */
	X	if (lev>6) tmp=37; else if (lev>4) tmp=35; 
	X	j = nobjtab[tmp=rnd(tmp)];	/* the object type */
	X	switch(tmp)
	X		{
	X		case 1: case 2: case 3: case 4:	*i=newscroll();	break;
	X		case 5: case 6: case 7: case 8:	*i=newpotion();	break;
	X		case 9: case 10: case 11: case 12: *i=rnd((lev+1)*10)+lev*10+10; break;
	X		case 13: case 14: case 15: case 16:	*i=lev;	break;
	X		case 17: case 18: case 19: if (!(*i=newdagger()))  return(0);  break;
	X		case 20: case 21: case 22: if (!(*i=newleather()))  return(0);  break;
	X		case 23: case 32: case 35: *i=rund(lev/3+1); break;
	X		case 24: case 26: *i=rnd(lev/4+1);   break;
	X		case 25: *i=rund(lev/4+1); break;
	X		case 27: *i=rnd(lev/2+1);   break;
	X		case 30: case 33: *i=rund(lev/2+1);   break;
	X		case 28: *i=rund(lev/3+1); if (*i==0) return(0); break;
	X		case 29: case 31: *i=rund(lev/2+1); if (*i==0) return(0); break;
	X		case 34: *i=newchain();   	break;
	X		case 36: *i=newplate();   	break;
	X		case 37: *i=newsword();		break; 
	X		}
	X	return(j);
	X	}
	X
	X/*
	X *  spattack(atckno,xx,yy) 	Function to process special attacks from monsters
	X *  	int atckno,xx,yy;
	X *
	X *	Enter with the special attack number, and the coordinates (xx,yy)
	X *		of the monster that is special attacking
	X *	Returns 1 if must do a show1cell(xx,yy) upon return, 0 otherwise
	X *
	X * atckno   monster     effect
	X * ---------------------------------------------------
	X *	0	none
	X *	1	rust monster	eat armor
	X *	2	hell hound		breathe light fire
	X *	3	dragon			breathe fire
	X *	4	giant centipede	weakening sing
	X *	5	white dragon	cold breath
	X *	6	wraith			drain level
	X *	7	waterlord		water gusher
	X *	8	leprechaun		steal gold
	X *	9	disenchantress	disenchant weapon or armor
	X *	10	ice lizard		hits with barbed tail
	X *	11	umber hulk		confusion
	X *	12	spirit naga		cast spells	taken from special attacks
	X *	13	platinum dragon	psionics
	X *	14	nymph			steal objects
	X *	15	bugbear			bite
	X *	16	osequip			bite
	X *
	X *	char rustarm[ARMORTYPES][2];
	X *	special array for maximum rust damage to armor from rustmonster
	X *	format is: { armor type , minimum attribute 
	X */
	X#define ARMORTYPES 6
	Xstatic char rustarm[ARMORTYPES][2] = { OSTUDLEATHER,-2,	ORING,-4, OCHAIN,-5,
	X	OSPLINT,-6,		OPLATE,-8,		OPLATEARMOR,-9  };
	Xstatic char spsel[] = { 1, 2, 3, 5, 6, 8, 9, 11, 13, 14 };
	Xspattack(x,xx,yy)
	X	int x,xx,yy;
	X	{
	X	register int i,j=0,k,m;
	X	register char *p=0;
	X	if (c[CANCELLATION]) return(0);
	X	vxy(&xx,&yy);	/* verify x & y coordinates */
	X	switch(x)
	X		{
	X		case 1:	/* rust your armor, j=1 when rusting has occurred */
	X				m = k = c[WEAR];
	X				if ((i=c[SHIELD]) != -1)
	X					if (--ivenarg[i] < -1) ivenarg[i]= -1; else j=1;
	X				if ((j==0) && (k != -1))
	X				  {
	X				  m = iven[k];
	X				  for (i=0; i<ARMORTYPES; i++)
	X					if (m == rustarm[i][0]) /* find his armor in table */
	X						{
	X						if (--ivenarg[k]< rustarm[i][1])
	X							ivenarg[k]= rustarm[i][1]; else j=1; 
	X						break;
	X						}
	X				  }
	X				if (j==0)	/* if rusting did not occur */
	X				  switch(m)
	X					{
	X					case OLEATHER:	p = "\nThe %s hit you -- Your lucky you have leather on";
	X									break;
	X				    case OSSPLATE:	p = "\nThe %s hit you -- Your fortunate to have stainless steel armor!";
	X									break;
	X					}
	X				else  { beep(); p = "\nThe %s hit you -- your armor feels weaker"; }
	X				break;
	X
	X		case 2:		i = rnd(15)+8-c[AC];
	X			spout:	p="\nThe %s breathes fire at you!";
	X					if (c[FIRERESISTANCE])
	X					  p="\nThe %s's flame doesn't phase you!";
	X					else
	X			spout2: if (p) { lprintf(p,lastmonst); beep(); }
	X					checkloss(i);
	X					return(0);
	X
	X		case 3:		i = rnd(20)+25-c[AC];  goto spout;
	X
	X		case 4:	if (c[STRENGTH]>3)
	X					{
	X					p="\nThe %s stung you!  You feel weaker"; beep();
	X					--c[STRENGTH];
	X					}
	X				else p="\nThe %s stung you!";
	X				break;
	X
	X		case 5:		p="\nThe %s blasts you with his cold breath";
	X					i = rnd(15)+18-c[AC];  goto spout2;
	X
	X		case 6:		lprintf("\nThe %s drains you of your life energy!",lastmonst);
	X					loselevel();  beep();  return(0);
	X
	X		case 7:		p="\nThe %s got you with a gusher!";
	X					i = rnd(15)+25-c[AC];  goto spout2;
	X
	X		case 8:		if (c[NOTHEFT]) return(0); /* he has a device of no theft */
	X					if (c[GOLD])
	X						{
	X						p="\nThe %s hit you -- Your purse feels lighter";
	X						if (c[GOLD]>32767)  c[GOLD]>>=1;
	X							else c[GOLD] -= rnd((int)(1+(c[GOLD]>>1)));
	X						if (c[GOLD] < 0) c[GOLD]=0;
	X						}
	X					else  p="\nThe %s couldn't find any gold to steal";
	X					lprintf(p,lastmonst); disappear(xx,yy); beep();
	X					bottomgold();  return(1);
	X
	X		case 9:	for(j=50; ; )	/* disenchant */
	X					{
	X					i=rund(26);  m=iven[i]; /* randomly select item */
	X					if (m>0 && ivenarg[i]>0 && m!=OSCROLL && m!=OPOTION)
	X						{
	X						if ((ivenarg[i] -= 3)<0) ivenarg[i]=0;
	X						lprintf("\nThe %s hits you -- you feel a sense of loss",lastmonst);
	X						srcount=0; beep(); show3(i);  bottomline();  return(0);
	X						}
	X					if (--j<=0)
	X						{
	X						p="\nThe %s nearly misses"; break;
	X						}
	X					break;
	X					}		
	X				break;
	X
	X		case 10:   p="\nThe %s hit you with his barbed tail";
	X				   i = rnd(25)-c[AC];  goto spout2;
	X
	X		case 11:	p="\nThe %s has confused you"; beep();
	X					c[CONFUSE]+= 10+rnd(10);		break;
	X
	X		case 12:	/*	performs any number of other special attacks	*/
	X					return(spattack(spsel[rund(10)],xx,yy));
	X
	X		case 13:	p="\nThe %s flattens you with his psionics!";
	X					i = rnd(15)+30-c[AC];  goto spout2;
	X
	X		case 14:	if (c[NOTHEFT]) return(0); /* he has device of no theft */
	X					if (emptyhanded()==1)
	X					  {
	X					  p="\nThe %s couldn't find anything to steal";
	X					  break;
	X					  }
	X					lprintf("\nThe %s picks your pocket and takes:",lastmonst);
	X					beep();
	X					if (stealsomething()==0) lprcat("  nothing"); disappear(xx,yy);
	X					bottomline();  return(1);
	X
	X		case 15:	i= rnd(10)+ 5-c[AC];
	X			spout3:	p="\nThe %s bit you!";
	X					goto spout2;
	X
	X		case 16:	i= rnd(15)+10-c[AC];  goto spout3;
	X		};
	X	if (p) { lprintf(p,lastmonst); bottomline(); }
	X	return(0);
	X	}
	X
	X/*
	X *	checkloss(x) 	Routine to subtract hp from user and flag bottomline display
	X *		int x;
	X *
	X *	Routine to subtract hitpoints from the user and flag the bottomline display
	X *	Enter with the number of hit points to lose
	X *	Note: if x > c[HP] this routine could kill the player!
	X */
	Xcheckloss(x)
	X	int x;
	X	{
	X	if (x>0) { losehp(x);  bottomhp(); }
	X	}
	X
	X/*
	X *	annihilate() 	Routine to annihilate all monsters around player (playerx,playery)
	X *
	X *	Gives player experience, but no dropped objects
	X *	Returns the experience gained from all monsters killed
	X */
	Xannihilate()
	X	{
	X	int i,j;
	X	register long k;
	X	register char *p;
	X	for (k=0, i=playerx-1; i<=playerx+1; i++)
	X	  for (j=playery-1; j<=playery+1; j++)
	X		if (!vxy(&i,&j)) /* if not out of bounds */
	X			if (*(p= &mitem[i][j]))	/* if a monster there */
	X				if (*p<DEMONLORD+2)
	X					{
	X					k += monster[*p].experience;	*p=know[i][j]=0;
	X					}
	X				else
	X					{
	X					lprintf("\nThe %s barely escapes being annihilated!",monster[*p].name);
	X					hitp[i][j] = (hitp[i][j]>>1) + 1; /* lose half hit points*/
	X					}
	X	if (k>0)
	X		{
	X		lprcat("\nYou hear loud screams of agony!");	raiseexperience((long)k);
	X		}
	X	return(k);
	X	}
	X
	X/*
	X *	newsphere(x,y,dir,lifetime)  Function to create a new sphere of annihilation
	X *		int x,y,dir,lifetime;
	X *
	X *	Enter with the coordinates of the sphere in x,y
	X *	  the direction (0-8 diroffx format) in dir, and the lifespan of the
	X *	  sphere in lifetime (in turns)
	X *	Returns the number of spheres currently in existence
	X */
	Xnewsphere(x,y,dir,life)
	X	int x,y,dir,life;
	X	{
	X	int m;
	X	struct sphere *sp;
	X	if (((sp=(struct sphere *)malloc(sizeof(struct sphere)))) == 0)
	X		return(c[SPHCAST]);	/* can't malloc, therefore failure */
	X	if (dir>=9) dir=0;	/* no movement if direction not found */
	X	if (level==0) vxy(&x,&y);	/* don't go out of bounds */
	X	else
	X		{
	X		if (x<1) x=1;  if (x>=MAXX-1) x=MAXX-2;
	X		if (y<1) y=1;  if (y>=MAXY-1) y=MAXY-2;
	X		}
	X	if ((m=mitem[x][y]) >= DEMONLORD+4)	/* demons dispel spheres */
	X		{
	X		know[x][y]=1; show1cell(x,y);	/* show the demon (ha ha) */
	X		cursors(); lprintf("\nThe %s dispels the sphere!",monster[m].name);
	X		beep(); rmsphere(x,y);	/* remove any spheres that are here */
	X		return(c[SPHCAST]);
	X		}
	X	if (m==DISENCHANTRESS) /* disenchantress cancels spheres */
	X		{
	X		cursors(); lprintf("\nThe %s causes cancellation of the sphere!",monster[m].name); beep();
	Xboom:	sphboom(x,y);	/* blow up stuff around sphere */
	X		rmsphere(x,y);	/* remove any spheres that are here */
	X		return(c[SPHCAST]);
	X		}
	X	if (c[CANCELLATION]) /* cancellation cancels spheres */
	X		{
	X		cursors(); lprcat("\nAs the cancellation takes effect, you hear a great earth shaking blast!"); beep();
	X		goto boom;
	X		}
	X	if (item[x][y]==OANNIHILATION) /* collision of spheres detonates spheres */
	X		{
	X		cursors(); lprcat("\nTwo spheres of annihilation collide! You hear a great earth shaking blast!"); beep();
	X		rmsphere(x,y);
	X		goto boom;
	X		}
	X	if (playerx==x && playery==y) /* collision of sphere and player! */
	X		{
	X		cursors();
	X		lprcat("\nYou have been enveloped by the zone of nothingness!\n");
	X		beep(); rmsphere(x,y);	/* remove any spheres that are here */
	X		nap(4000);  died(258);
	X		}
	X	item[x][y]=OANNIHILATION;  mitem[x][y]=0;  know[x][y]=1;
	X	show1cell(x,y);	/* show the new sphere */
	X	sp->x=x;  sp->y=y;  sp->lev=level;  sp->dir=dir;  sp->lifetime=life;  sp->p=0;
	X	if (spheres==0) spheres=sp;	/* if first node in the sphere list */
	X	else	/* add sphere to beginning of linked list */
	X		{
	X		sp->p = spheres;	spheres = sp;
	X		}
	X	return(++c[SPHCAST]);	/* one more sphere in the world */
	X	}
	X
	X/*
	X *	rmsphere(x,y)		Function to delete a sphere of annihilation from list
	X *		int x,y;
	X *
	X *	Enter with the coordinates of the sphere (on current level)
	X *	Returns the number of spheres currently in existence
	X */
	Xrmsphere(x,y)
	X	int x,y;
	X	{
	X	register struct sphere *sp,*sp2=0;
	X	for (sp=spheres; sp; sp2=sp,sp=sp->p)
	X	  if (level==sp->lev)	/* is sphere on this level? */
	X	    if ((x==sp->x) && (y==sp->y))	/* locate sphere at this location */
	X			{
	X			item[x][y]=mitem[x][y]=0;  know[x][y]=1;
	X			show1cell(x,y);	/* show the now missing sphere */
	X			--c[SPHCAST];	
	X			if (sp==spheres) { sp2=sp; spheres=sp->p; free((char*)sp2); }
	X			else
	X				{ sp2->p = sp->p;  free((char*)sp); }
	X			break;
	X			}
	X	return(c[SPHCAST]);	/* return number of spheres in the world */
	X	}
	X
	X/*
	X *	sphboom(x,y)	Function to perform the effects of a sphere detonation
	X *		int x,y;
	X *
	X *	Enter with the coordinates of the blast, Returns no value
	X */
	Xsphboom(x,y)
	X	int x,y;
	X	{
	X	register int i,j;
	X	if (c[HOLDMONST]) c[HOLDMONST]=1;
	X	if (c[CANCELLATION]) c[CANCELLATION]=1;
	X	for (j=max(1,x-2); j<min(x+3,MAXX-1); j++)
	X	  for (i=max(1,y-2); i<min(y+3,MAXY-1); i++)
	X		{
	X		item[j][i]=mitem[j][i]=0;
	X		show1cell(j,i);
	X		if (playerx==j && playery==i)
	X			{
	X			cursors(); beep();
	X			lprcat("\nYou were too close to the sphere!");
	X			nap(3000);
	X			died(283); /* player killed in explosion */
	X			}
	X		}
	X	}
	X
	X/*
	X *	genmonst()		Function to ask for monster and genocide from game
	X *
	X *	This is done by setting a flag in the monster[] structure
	X */
	Xgenmonst()
	X	{
	X	register int i,j;
	X	cursors();  lprcat("\nGenocide what monster? ");
	X	for (i=0; (!isalpha(i)) && (i!=' '); i=getchar());
	X	lprc(i);
	X	for (j=0; j<MAXMONST; j++)	/* search for the monster type */
	X		if (monstnamelist[j]==i)	/* have we found it? */
	X			{
	X			monster[j].genocided=1;	/* genocided from game */
	X			lprintf("  There will be no more %s's",monster[j].name);
	X			/* now wipe out monsters on this level */
	X			newcavelevel(level); draws(0,MAXX,0,MAXY); bot_linex();
	X			return;
	X			}
	X	lprcat("  You sense failure!");
	X	}
	X
	X
SHAR_EOF
if test 25032 -ne "`wc -c < 'monster.c'`"
then
	echo shar: error transmitting "'monster.c'" '(should have been 25032 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'spells.c'" '(16779 characters)'
if test -f 'spells.c'
then
	echo shar: will not over-write existing file "'spells.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'spells.c'
	X#include "header.h"
	X
	Xstruct isave	/* used for altar reality */
	X	{
	X	char type;	/* 0=item,  1=monster */
	X	char id;	/* item number or monster number */
	X	short arg;	/* the type of item or hitpoints of monster */
	X	};
	X
	X
	X/*
	X *	speldamage(x) 		Function to perform spell functions cast by the player
	X *		int x;
	X *
	X *	Enter with the spell number, returns no value.
	X *	Please insure that there are 2 spaces before all messages here
	X */
	Xspeldamage(x)
	X	int x;
	X	{
	X	register int i,j,clev;
	X	int xl,xh,yl,yh;
	X	register char *p,*kn,*pm;
	X	if (x>=SPNUM) return;	/* no such spell */
	X	if (c[TIMESTOP])  { lprcat("  It didn't seem to work"); return; }  /* not if time stopped */
	X	clev = c[LEVEL];
	X	if ((rnd(23)==7) || (rnd(18) > c[INTELLIGENCE]))
	X		{ lprcat("  It didn't work!");  return; }
	X	if (clev*3+2 < x) { lprcat("  Nothing happens.  You seem inexperienced at this"); return; }
	X
	X	switch(x)
	X		{
	X/* ----- LEVEL 1 SPELLS ----- */
	X
	X		case 0:	if (c[PROTECTIONTIME]==0)	c[MOREDEFENSES]+=2; /* protection field +2 */
	X				c[PROTECTIONTIME] += 250;   return;
	X
	X		case 1: i = rnd(((clev+1)<<1)) + clev + 3;
	X				godirect(x,i,(clev>=2)?"  Your missiles hit the %s":"  Your missile hit the %s",100,'+'); /* magic missile */
	X
	X				return;
	X
	X		case 2:	if (c[DEXCOUNT]==0)	c[DEXTERITY]+=3; /*	dexterity	*/
	X				c[DEXCOUNT] += 400;  	return;
	X
	X		case 3: i=rnd(3)+1;
	X				p="  While the %s slept, you smashed it %d times";
	X			ws:	direct(x,fullhit(i),p,i); /*	sleep	*/	return;
	X
	X		case 4:	/*	charm monster	*/	c[CHARMCOUNT] += c[CHARISMA]<<1;	return;
	X
	X		case 5:	godirect(x,rnd(10)+15+clev,"  The sound damages the %s",70,'@'); /*	sonic spear */
	X				return;
	X
	X/* ----- LEVEL 2 SPELLS ----- */
	X
	X		case 6: i=rnd(3)+2;	p="  While the %s is entangled, you hit %d times";
	X				goto ws; /* web */
	X
	X		case 7:	if (c[STRCOUNT]==0) c[STREXTRA]+=3;	/*	strength	*/
	X				c[STRCOUNT] += 150+rnd(100);    return;
	X
	X		case 8:	yl = playery-5;     /* enlightenment */
	X				yh = playery+6;   xl = playerx-15;   xh = playerx+16;
	X				vxy(&xl,&yl);   vxy(&xh,&yh); /* check bounds */
	X				for (i=yl; i<=yh; i++) /* enlightenment	*/
	X					for (j=xl; j<=xh; j++)	know[j][i]=1;
	X				draws(xl,xh+1,yl,yh+1);	return;
	X
	X		case 9:	raisehp(20+(clev<<1));  return;  /* healing */
	X
	X		case 10:	c[BLINDCOUNT]=0;	return;	/* cure blindness	*/
	X
	X		case 11:	createmonster(makemonst(level+1)+8);  return;
	X
	X		case 12:	if (rnd(11)+7 <= c[WISDOM]) direct(x,rnd(20)+20+clev,"  The %s believed!",0);
	X					else lprcat("  It didn't believe the illusions!");
	X					return;
	X
	X		case 13:	/* if he has the amulet of invisibility then add more time */
	X					for (j=i=0; i<26; i++)
	X						if (iven[i]==OAMULET) j+= 1+ivenarg[i];
	X					c[INVISIBILITY] += (j<<7)+12;   return;
	X
	X/* ----- LEVEL 3 SPELLS ----- */
	X
	X		case 14:	godirect(x,rnd(25+clev)+25+clev,"  The fireball hits the %s",40,'*'); return; /*	fireball */
	X
	X		case 15:	godirect(x,rnd(25)+20+clev,"  Your cone of cold strikes the %s",60,'O');	/*	cold */
	X					return;
	X
	X		case 16:	dirpoly(x);  return;	/*	polymorph */
	X
	X		case 17:	c[CANCELLATION]+= 5+clev;	return;	/*	cancellation	*/
	X
	X		case 18:	c[HASTESELF]+= 7+clev;  return;  /*	haste self	*/
	X
	X		case 19:	omnidirect(x,30+rnd(10),"  The %s gasps for air");	/* cloud kill */
	X					return;
	X
	X		case 20:	vapid();
	X				return;
	X
	X/* ----- LEVEL 4 SPELLS ----- */
	X
	X		case 21:	direct(x,100+clev,"  The %s shrivels up",0); /* dehydration */
	X					return;
	X
	X		case 22:	godirect(x,rnd(25)+20+(clev<<1),"  A lightning bolt hits the %s",1,'~');	/*	lightning */
	X					return;
	X
	X		case 23:	i=min(c[HP]-1,c[HPMAX]/2);	/* drain life */
	X					direct(x,i+i,"",0);	c[HP] -= i;  	return;
	X
	X		case 24:	if (c[GLOBE]==0) c[MOREDEFENSES] += 10;
	X					c[GLOBE] += 200;  loseint();  /* globe of invulnerability */
	X					return;
	X
	X		case 25:	omnidirect(x,32+clev,"  The %s struggles for air in your flood!"); /* flood */
	X					return;
	X
	X		case 26:	if (rnd(151)==63) { beep(); lprcat("\nYour heart stopped!\n"); nap(4000);  died(270); return; }
	X					if (c[WISDOM]>rnd(10)+10) direct(x,2000,"  The %s's heart stopped",0); /* finger of death */
	X					else lprcat("  It didn't work"); return;
	X
	X/* ----- LEVEL 5 SPELLS ----- */
	X
	X		case 27:	c[SCAREMONST] += rnd(10)+clev;  return;  /* scare monster */
	X
	X		case 28:	c[HOLDMONST] += rnd(10)+clev;  return;  /* hold monster */
	X
	X		case 29:	c[TIMESTOP] += rnd(20)+(clev<<1);  return;  /* time stop */
	X
	X		case 30:	tdirect(x);  return;  /* teleport away */
	X
	X		case 31:	omnidirect(x,35+rnd(10)+clev,"  The %s cringes from the flame"); /* magic fire */
	X					return;
	X
	X/* ----- LEVEL 6 SPELLS ----- */
	X
	X		case 32:	if ((rnd(23)==5) && (wizard==0)) /* sphere of annihilation */
	X						{
	X						beep(); lprcat("\nYou have been enveloped by the zone of nothingness!\n");
	X						nap(4000);  died(258); return;
	X						}
	X					xl=playerx; yl=playery;
	X					loseint();
	X					i=dirsub(&xl,&yl); /* get direction of sphere */
	X					newsphere(xl,yl,i,rnd(20)+11);	/* make a sphere */
	X					return;
	X
	X		case 33:	genmonst();  spelknow[33]=0;  /* genocide */
	X					loseint();
	X					return;
	X
	X		case 34:	/* summon demon */
	X					if (rnd(100) > 30) { direct(x,150,"  The demon strikes at the %s",0);  return; }
	X					if (rnd(100) > 15) { lprcat("  Nothing seems to have happened");  return; }
	X					lprcat("  The demon turned on you and vanished!"); beep();
	X					i=rnd(40)+30;  lastnum=277;
	X					losehp(i); /* must say killed by a demon */ return;
	X
	X		case 35:	/* walk through walls */
	X					c[WTW] += rnd(10)+5;	return;
	X
	X		case 36:	/* alter reality */
	X					altreal();
	X					return;
	X
	X		case 37:	/* permanence */ adjtime(-99999L);  spelknow[37]=0; /* forget */
	X					loseint();
	X					return;
	X
	X		default:	lprintf("  spell %d not available!",(long)x); beep();  return;
	X		};
	X	}
	X
	Xstatic int altreal()
	X					{
	X
	X					struct isave *save;	/* pointer to item save structure */
	X					register int i,j;
	X					int sc, xl;
	X					sc=0;	/* # items saved */
	X					save = (struct isave *)malloc(sizeof(struct isave)*MAXX*MAXY*2);
	X					if (save == (struct isave *) 0) died(-285); /* croak */
	X					for (j=0; j<MAXY; j++)
	X						for (i=0; i<MAXX; i++) /* save all items and monsters */
	X							{
	X							xl = item[i][j];
	X							if (xl && xl!=OWALL && xl!=OANNIHILATION) 
	X								{
	X								save[sc].type=0;  save[sc].id=item[i][j];
	X								sc++;
	X								save[sc].arg=iarg[i][j];
	X								}
	X							if (mitem[i][j]) 
	X								{
	X								save[sc].type=1;  save[sc].id=mitem[i][j];
	X								sc++;
	X								save[sc].arg=hitp[i][j];
	X								}
	X							item[i][j]=OWALL;   mitem[i][j]=0;
	X							if (wizard) know[i][j]=1; else know[i][j]=0;
	X							}
	X					eat(1,1);	if (level==1) item[33][MAXY-1]=0;
	X					for (j=rnd(MAXY-2), i=1; i<MAXX-1; i++) item[i][j]=0;
	X					while (sc>0) /* put objects back in level */
	X						{
	X						--sc;
	X						if (save[sc].type == 0)
	X							{
	X							int trys;
	X							for (trys=100, i=j=1; --trys>0 && item[i][j]; i=rnd(MAXX-1), j=rnd(MAXY-1));
	X							if (trys) { item[i][j]=save[sc].id; iarg[i][j]=save[sc].arg; }
	X							}
	X						else
	X							{ /* put monsters back in */
	X							int trys;
	X							for (trys=100, i=j=1; --trys>0 && (item[i][j]==OWALL || mitem[i][j]); i=rnd(MAXX-1), j=rnd(MAXY-1));
	X							if (trys) { mitem[i][j]=save[sc].id; hitp[i][j]=save[sc].arg; }
	X							}
	X						}
	X					loseint();
	X					draws(0,MAXX,0,MAXY);  if (wizard==0) spelknow[36]=0;
	X					free((char *) save);positionplayer();  return;
	X					}
	X
	Xstatic int vapid()
	X{
	X	register int i,j;
	X	int xl,xh,yl,yh;
	X	register char *p,*kn,*pm;
	X
	X		xh = min(playerx+1,MAXX-2);		yh = min(playery+1,MAXY-2);
	X					for (i=max(playerx-1,1); i<=xh; i++) /* vaporize rock */
	X					  for (j=max(playery-1,1); j<=yh; j++)
	X						{
	X						kn = &know[i][j];    pm = &mitem[i][j];
	X						switch(*(p= &item[i][j]))
	X						  {
	X						  case OWALL: if (level < MAXLEVEL+MAXVLEVEL-1)
	X											*p = *kn = 0;
	X										break;
	X
	X						  case OSTATUE: if (c[HARDGAME]<3)
	X											 {
	X											 *p=OBOOK; iarg[i][j]=level;  *kn=0;
	X											 }
	X										break;
	X	
	X						  case OTHRONE: *pm=GNOMEKING;  *kn=0;  *p= OTHRONE2;
	X										hitp[i][j]=monster[GNOMEKING].hitpoints; break;
	X
	X						  case OALTAR:	*pm=DEMONPRINCE;  *kn=0;
	X										hitp[i][j]=monster[DEMONPRINCE].hitpoints; break;
	X						  };
	X						switch(*pm)
	X							{
	X							case XORN:	ifblind(i,j);  hitm(i,j,200); break; /* Xorn takes damage from vpr */
	X							}
	X						}
	X
	X}
	X
	X
	X/*
	X *	cast() 		Subroutine called by parse to cast a spell for the user
	X *
	X *	No arguments and no return value.
	X */
	Xstatic char eys[] = "\nEnter your spell: ";
	Xcast()
	X	{
	X	register int i,j,a,b,d;
	X	cursors();
	X	if (c[SPELLS]<=0) {	lprcat("\nYou don't have any spells!");	return;	}
	X	lprcat(eys);		--c[SPELLS];
	X	while ((a=getchar())=='D')
	X		{ seemagic(-1); cursors();  lprcat(eys); }
	X	if (a=='\33') goto over; /*	to escape casting a spell	*/
	X	if ((b=getchar())=='\33') goto over; /*	to escape casting a spell	*/
	X	if ((d=getchar())=='\33')
	X		{ over: lprcat(aborted); c[SPELLS]++; return; } /*	to escape casting a spell	*/
	X#ifdef EXTRA
	X	c[SPELLSCAST]++;
	X#endif
	X	for (lprc('\n'),j= -1,i=0; i<SPNUM; i++) /*seq search for his spell, hash?*/
	X		if ((spelcode[i][0]==a) && (spelcode[i][1]==b) && (spelcode[i][2]==d))
	X			if (spelknow[i])
	X				{  speldamage(i);  j = 1;  i=SPNUM; }
	X
	X	if (j == -1) lprcat("  Nothing Happened ");
	X	bottomline();
	X	}
	X
	X/*
	X *	loseint()		Routine to subtract 1 from your int (intelligence) if > 3
	X *
	X *	No arguments and no return value
	X */
	Xloseint()
	X	{
	X	if (--c[INTELLIGENCE]<3)  c[INTELLIGENCE]=3;
	X	}
	X
	X/*
	X *	isconfuse() 		Routine to check to see if player is confused
	X *
	X *	This routine prints out a message saying "You can't aim your magic!"
	X *	returns 0 if not confused, non-zero (time remaining confused) if confused
	X */
	Xisconfuse()
	X	{
	X	if (c[CONFUSE]) { lprcat(" You can't aim your magic!"); beep(); }
	X	return(c[CONFUSE]);
	X	}
	X
	X/*
	X *	nospell(x,monst)	Routine to return 1 if a spell doesn't affect a monster
	X *		int x,monst;
	X *
	X *	Subroutine to return 1 if the spell can't affect the monster
	X *	  otherwise returns 0
	X *	Enter with the spell number in x, and the monster number in monst.
	X */
	Xnospell(x,monst)
	X	int x,monst;
	X	{
	X	register int tmp;
	X	if (x>=SPNUM || monst>=MAXMONST+8 || monst<0 || x<0) return(0);	/* bad spell or monst */
	X	if ((tmp=spelweird[monst-1][x])==0) return(0);
	X	cursors();  lprc('\n');  lprintf(spelmes[tmp],monster[monst].name);  return(1);
	X	}
	X
	X
	X/*
	X *	direct(spnum,dam,str,arg)	Routine to direct spell damage 1 square in 1 dir
	X *		int spnum,dam,arg;
	X *		char *str;
	X *
	X *	Routine to ask for a direction to a spell and then hit the monster
	X *	Enter with the spell number in spnum, the damage to be done in dam,
	X *	  lprintf format string in str, and lprintf's argument in arg.
	X *	Returns no value.
	X */
	Xdirect(spnum,dam,str,arg)
	X	int spnum,dam,arg;
	X	char *str;
	X	{
	X	int x,y;
	X	register int m;
	X	if (spnum<0 || spnum>=SPNUM || str==0) return; /* bad arguments */
	X	if (isconfuse()) return;
	X	dirsub(&x,&y);
	X	m = mitem[x][y];
	X	if (item[x][y]==OMIRROR)
	X		{
	X		if (spnum==3) /* sleep */
	X			{
	X			lprcat("You fall asleep! "); beep();
	X		fool:
	X			arg += 2;
	X			while (arg-- > 0) { parse2(); nap(1000); }
	X			return;
	X			}
	X		else if (spnum==6) /* web */
	X			{
	X			lprcat("You get stuck in your own web! "); beep();
	X			goto fool;
	X			}
	X		else
	X			{
	X			lastnum=278; 
	X			lprintf(str,"spell caster (thats you)",(long)arg);
	X			beep(); losehp(dam); return;
	X			}
	X		}
	X	if (m==0)
	X		{	lprcat("  There wasn't anything there!");	return;  }
	X	ifblind(x,y);
	X	if (nospell(spnum,m)) { lasthx=x;  lasthy=y; return; }
	X	lprintf(str,lastmonst,(long)arg);       hitm(x,y,dam);
	X	}
	X
	X/*
	X *	godirect(spnum,dam,str,delay,cshow)		Function to perform missile attacks
	X *		int spnum,dam,delay;
	X *		char *str,cshow;
	X *
	X *	Function to hit in a direction from a missile weapon and have it keep
	X *	on going in that direction until its power is exhausted
	X *	Enter with the spell number in spnum, the power of the weapon in hp,
	X *	  lprintf format string in str, the # of milliseconds to delay between 
	X *	  locations in delay, and the character to represent the weapon in cshow.
	X *	Returns no value.
	X */
	Xgodirect(spnum,dam,str,delay,cshow)
	X	int spnum,dam,delay;
	X	char *str,cshow;
	X	{
	X	register char *p;
	X	register int x,y,m;
	X	int dx,dy;
	X	if (spnum<0 || spnum>=SPNUM || str==0 || delay<0) return; /* bad args */
	X	if (isconfuse()) return;
	X	dirsub(&dx,&dy);	x=dx;	y=dy;
	X	dx = x-playerx;		dy = y-playery;		x = playerx;	y = playery;
	X	while (dam>0)
	X		{
	X		x += dx;    y += dy;
	X	    if ((x > MAXX-1) || (y > MAXY-1) || (x < 0) || (y < 0))
	X			{
	X			dam=0;	break;  /* out of bounds */
	X			}
	X		if ((x==playerx) && (y==playery)) /* if energy hits player */
	X			{
	X			cursors(); lprcat("\nYou are hit my your own magic!"); beep();
	X			lastnum=278;  losehp(dam);  return;
	X			}
	X		if (c[BLINDCOUNT]==0) /* if not blind show effect */
	X			{
	X			cursor(x+1,y+1); lprc(cshow); nap(delay); show1cell(x,y);
	X			}
	X		if ((m=mitem[x][y]))	/* is there a monster there? */
	X			{
	X			ifblind(x,y);
	X			if (nospell(spnum,m)) { lasthx=x;  lasthy=y; return; }
	X			cursors(); lprc('\n');
	X			lprintf(str,lastmonst);		dam -= hitm(x,y,dam);
	X			show1cell(x,y);  nap(1000);		x -= dx;	y -= dy;
	X			}
	X		else switch (*(p= &item[x][y]))
	X			{
	X			case OWALL:	cursors(); lprc('\n'); lprintf(str,"wall");
	X						if (dam>=50+c[HARDGAME]) /* enough damage? */
	X						 if (level<MAXLEVEL+MAXVLEVEL-1) /* not on V3 */
	X						  if ((x<MAXX-1) && (y<MAXY-1) && (x) && (y))
	X							{
	X							lprcat("  The wall crumbles");
	X					god3:	*p=0;
	X					god:	know[x][y]=0;
	X							show1cell(x,y);
	X							}
	X				god2:	dam = 0;	break;
	X
	X			case OCLOSEDDOOR:	cursors(); lprc('\n'); lprintf(str,"door");
	X						if (dam>=40)
	X							{
	X							lprcat("  The door is blasted apart");
	X							goto god3;
	X							}
	X						goto god2;
	X
	X			case OSTATUE:	cursors(); lprc('\n'); lprintf(str,"statue");
	X						if (c[HARDGAME]<3)
	X						  if (dam>44)
	X							{
	X							lprcat("  The statue crumbles");
	X							*p=OBOOK; iarg[x][y]=level;
	X							goto god;
	X							}
	X						goto god2;
	X
	X			case OTHRONE:	cursors(); lprc('\n'); lprintf(str,"throne");
	X					if (dam>39)
	X						{
	X						mitem[x][y]=GNOMEKING; hitp[x][y]=monster[GNOMEKING].hitpoints;
	X						*p = OTHRONE2;
	X						goto god;
	X						}
	X					goto god2;
	X
	X			case OMIRROR:	dx *= -1;	dy *= -1;	break;
	X			};
	X		dam -= 3 + (c[HARDGAME]>>1);
	X		}
	X	}
	X
	X/*
	X *	dirpoly(spnum)		Routine to ask for a direction and polymorph a monst
	X *		int spnum;
	X *
	X *	Subroutine to polymorph a monster and ask for the direction its in
	X *	Enter with the spell number in spmun.
	X *	Returns no value.
	X */
	Xdirpoly(spnum)
	X	int spnum;
	X	{
	X	int x,y,m;
	X	if (spnum<0 || spnum>=SPNUM) return; /* bad args */
	X	if (isconfuse()) return;	/* if he is confused, he can't aim his magic */
	X	dirsub(&x,&y);
	X	if (mitem[x][y]==0)
	X		{	lprcat("  There wasn't anything there!");	return;  }
	X	ifblind(x,y);
	X	if (nospell(spnum,mitem[x][y])) { lasthx=x;  lasthy=y; return; }
	X	while ( monster[m = mitem[x][y] = rnd(MAXMONST+7)].genocided );
	X	hitp[x][y] = monster[m].hitpoints;
	X	show1cell(x,y);  /* show the new monster */
	X	}
	X
	X/*
	X *	tdirect(spnum)		Routine to teleport away a monster
	X *		int spnum;
	X *
	X *	Routine to ask for a direction to a spell and then teleport away monster
	X *	Enter with the spell number that wants to teleport away
	X *	Returns no value.
	X */
	Xtdirect(spnum)
	X	int spnum;
	X	{
	X	int x,y;
	X	register int m;
	X	if (spnum<0 || spnum>=SPNUM) return; /* bad args */
	X	if (isconfuse()) return;
	X	dirsub(&x,&y);
	X	if ((m=mitem[x][y])==0)
	X		{	lprcat("  There wasn't anything there!");	return;  }
	X	ifblind(x,y);
	X	if (nospell(spnum,m)) { lasthx=x;  lasthy=y; return; }
	X	fillmonst(m);  mitem[x][y]=know[x][y]=0;
	X	}
	X
	X/*
	X *	omnidirect(sp,dam,str)   Routine to damage all monsters 1 square from player
	X *		int sp,dam;
	X *		char *str;
	X *
	X *	Routine to cast a spell and then hit the monster in all directions
	X *	Enter with the spell number in sp, the damage done to wach square in dam,
	X *	  and the lprintf string to identify the spell in str.
	X *	Returns no value.
	X */
	Xomnidirect(spnum,dam,str)
	X	int spnum,dam;
	X	char *str;
	X	{
	X	register int x,y,m;
	X	if (spnum<0 || spnum>=SPNUM || str==0) return; /* bad args */
	X	for (x=playerx-1; x<playerx+2; x++)
	X		for (y=playery-1; y<playery+2; y++)
	X			{
	X			if (m=mitem[x][y])
	X				if (nospell(spnum,m) == 0)
	X					{
	X					ifblind(x,y);
	X					cursors(); lprc('\n'); lprintf(str,lastmonst);
	X					hitm(x,y,dam);  nap(800);
	X					}
	X				else  { lasthx=x;  lasthy=y; }
	X			}
	X	}
	X
	X/*
	X *	static dirsub(x,y)		Routine to ask for direction, then modify x,y for it
	X *		int *x,*y;
	X *
	X *	Function to ask for a direction and modify an x,y for that direction
	X *	Enter with the origination coordinates in (x,y).
	X *	Returns index into diroffx[] (0-8).
	X */
	Xstatic dirsub(x,y)
	X	int *x,*y;
	X	{
	X	register int i;
	X	lprcat("\nIn What Direction? ");
	X	for (i=0; ; )
	X		switch(getchar())
	X			{
	X			case 'b':	i++;
	X			case 'n':	i++;	
	X			case 'y':	i++;	
	X			case 'u':	i++;
	X			case 'h':	i++;	
	X			case 'k':	i++;
	X			case 'l':	i++;	
	X			case 'j':	i++;		goto out;
	X			};
	Xout:
	X	*x = playerx+diroffx[i];		*y = playery+diroffy[i];
	X	vxy(x,y);  return(i);
	X	}
	X
	X
	X
SHAR_EOF
if test 16779 -ne "`wc -c < 'spells.c'`"
then
	echo shar: error transmitting "'spells.c'" '(should have been 16779 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'tputs.c'" '(1768 characters)'
if test -f 'tputs.c'
then
	echo shar: will not over-write existing file "'tputs.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'tputs.c'
	X/* Copyright (c) 1979 Regents of the University of California */
	X#include <ctype.h>
	X
	X/*
	X * The following array gives the number of tens of milliseconds per
	X * character for each speed as returned by gtty.  Thus since 300
	X * baud returns a 7, there are 33.3 milliseconds per char at 300 baud.
	X */
	Xstatic
	Xshort	tmspc10[] = {
	X	0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10
	X};
	X
	Xshort	ospeed;
	Xchar	PC;
	X
	X/*
	X * Put the character string cp out, with padding.
	X * The number of affected lines is affcnt, and the routine
	X * used to output one character is outc.
	X */
	Xtputs(cp, affcnt, outc)
	X	register char *cp;
	X	int affcnt;
	X	int (*outc)();
	X{
	X	register int i = 0;
	X	register int mspc10;
	X
	X	if (cp == 0)
	X		return;
	X
	X	/*
	X	 * Convert the number representing the delay.
	X	 */
	X	if (isdigit(*cp)) {
	X		do
	X			i = i * 10 + *cp++ - '0';
	X		while (isdigit(*cp));
	X	}
	X	i *= 10;
	X	if (*cp == '.') {
	X		cp++;
	X		if (isdigit(*cp))
	X			i += *cp - '0';
	X		/*
	X		 * Only one digit to the right of the decimal point.
	X		 */
	X		while (isdigit(*cp))
	X			cp++;
	X	}
	X
	X	/*
	X	 * If the delay is followed by a `*', then
	X	 * multiply by the affected lines count.
	X	 */
	X	if (*cp == '*')
	X		cp++, i *= affcnt;
	X
	X	/*
	X	 * The guts of the string.
	X	 */
	X	while (*cp)
	X		(*outc)(*cp++);
	X
	X	/*
	X	 * If no delay needed, or output speed is
	X	 * not comprehensible, then don't try to delay.
	X	 */
	X	if (i == 0)
	X		return;
	X	if (ospeed <= 0 || ospeed >= (sizeof tmspc10 / sizeof tmspc10[0]))
	X		return;
	X
	X	/*
	X	 * Round up by a half a character frame,
	X	 * and then do the delay.
	X	 * Too bad there are no user program accessible programmed delays.
	X	 * Transmitting pad characters slows many
	X	 * terminals down and also loads the system.
	X	 */
	X	mspc10 = tmspc10[ospeed];
	X	i += mspc10 / 2;
	X	for (i /= mspc10; i > 0; i--)
	X		(*outc)(PC);
	X}
	X
SHAR_EOF
if test 1768 -ne "`wc -c < 'tputs.c'`"
then
	echo shar: error transmitting "'tputs.c'" '(should have been 1768 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'tgoto.c'" '(2253 characters)'
if test -f 'tgoto.c'
then
	echo shar: will not over-write existing file "'tgoto.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'tgoto.c'
	X/* Copyright (c) 1979 Regents of the University of California */
	X#define	CTRL(c)	( 'c' & 037 )
	X
	Xchar	*UP;
	Xchar	*BC;
	X
	X/*
	X * Routine to perform cursor addressing.
	X * CM is a string containing printf type escapes to allow
	X * cursor addressing.  We start out ready to print the destination
	X * line, and switch each time we print row or column.
	X * The following escapes are defined for substituting row/column:
	X *
	X *	%d	as in printf
	X *	%2	like %2d
	X *	%3	like %3d
	X *	%.	gives %c hacking special case characters
	X *	%+x	like %c but adding x first
	X *	%<xy	if value < x add y, else just use valueindexing)
	X *	%r	reverses row/column
	X *	%i	increments row/column (for one origin indexing)
	X *	%%	gives %
	X *
	X * all other characters are ``self-inserting''.
	X */
	Xchar *
	Xtgoto(CM, destcol, destline)
	X	char *CM;
	X	int destcol, destline;
	X{
	X	static char result[16];
	X	static char added[10];
	X	char *cp = CM;
	X	register char *dp = result;
	X	register int c;
	X	int oncol = 0;
	X	register int which;
	X
	X	if (cp == 0) {
	Xtoohard:
	X		/*
	X		 * ``We don't do that under BOZO's big top''
	X		 */
	X		strcpy(result, "OOPS");
	X		return (result);
	X	}
	X	added[0] = 0;
	X	while (c = *cp++) {
	X		if (c != '%') {
	X			*dp++ = c;
	X			continue;
	X		}
	X		which = oncol ? destcol : destline;
	X		switch (c = *cp++) {
	X
	X		case 'n':
	X			destcol ^= 0140;
	X			destline ^= 0140;
	X			continue;
	X
	X		case 'd':
	X			if (which < 10)
	X				goto one;
	X			if (which < 100)
	X				goto two;
	X			/* fall into... */
	X
	X		case '3':
	X			*dp++ = (which / 100) | '0';
	X			which %= 100;
	X			/* fall into... */
	X
	X		case '2':
	Xtwo:	
	X			*dp++ = which / 10 | '0';
	Xone:
	X			*dp++ = which % 10 | '0';
	X			oncol = 1 - oncol;
	X			continue;
	X
	X		case '<':
	X			if (which < *dp++)
	X				which += *dp++;
	X			else
	X				dp++;
	X			goto casedot;
	X
	X		case '+':
	X			which += *cp++;
	X			/* fall into... */
	X
	X		case '.':
	Xcasedot:
	X			if (!UP)
	X				goto toohard;
	X			if (which == 0 || which == CTRL(d) || which == '\t' || which == '\n') {
	X				do {
	X					strcat(added, oncol ? (BC ? BC : "\b") : UP);
	X					which++;
	X				} while (which == '\n');
	X			}
	X			*dp++ = which;
	X			/* fall into... */
	X
	X		case 'r':
	X			oncol = 1 - oncol;
	X			continue;
	X
	X		case 'i':
	X			destcol++;
	X			destline++;
	X			continue;
	X
	X		case '%':
	X			*dp++ = c;
	X			continue;
	X
	X		default:
	X			goto toohard;
	X		}
	X	}
	X	strcpy(dp, added);
	X	return (result);
	X}
	X
SHAR_EOF
if test 2253 -ne "`wc -c < 'tgoto.c'`"
then
	echo shar: error transmitting "'tgoto.c'" '(should have been 2253 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'config.diff'" '(1848 characters)'
if test -f 'config.diff'
then
	echo shar: will not over-write existing file "'config.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'config.diff'
	X*** ../olarn/config.c	Mon Sep 22 17:47:23 1986
	X--- config.c	Tue Sep 23 14:24:09 1986
	X***************
	X*** 7,13
	X   *		Larn is copyrighted 1986 by Noah Morgan.
	X   */
	X  #include "header.h"
	X! 
	X  #ifndef LARNHOME
	X  #define LARNHOME "/usr/games/larn/"		/* normally supplied by a Makefile */
	X  #endif
	X
	X--- 7,13 -----
	X   *		Larn is copyrighted 1986 by Noah Morgan.
	X   */
	X  #include "header.h"
	X! #define LARNHOME "./"
	X  #ifndef LARNHOME
	X  #define LARNHOME "/usr/games/larn/"		/* normally supplied by a Makefile */
	X  #endif
	X***************
	X*** 39,45
	X  char fortfile[sizeof(LARNHOME)+sizeof(FORTSNAME)] =		LARNHOME;
	X  
	X  		/* the .larnopts filename */
	X! char optsfile[128] ="/.larnopts";				/* the option file			*/
	X  
	X  		/* the player id datafile name */
	X  char playerids[sizeof(LARNHOME)+sizeof(PLAYERIDS)] =	LARNHOME;
	X
	X--- 39,45 -----
	X  char fortfile[sizeof(LARNHOME)+sizeof(FORTSNAME)] =		LARNHOME;
	X  
	X  		/* the .larnopts filename */
	X! char optsfile[128] ="/larnopts";				/* the option file			*/
	X  
	X  		/* the player id datafile name */
	X  char playerids[sizeof(LARNHOME)+sizeof(PLAYERIDS)] =	LARNHOME;
	X***************
	X*** 48,54
	X  char holifile[sizeof(LARNHOME)+sizeof(HOLIFILE)] =		LARNHOME;
	X  
	X  char diagfile[] ="Diagfile";					/* the diagnostic filename	*/
	X! char ckpfile[] ="Larn12.0.ckp";					/* the checkpoint filename	*/
	X  char *password ="pvnert(x)";					/* the wizards password <=32*/
	X  #if WIZID == -1
	X  int wisid=0;			/* the user id of the only person who can be wizard */
	X
	X--- 48,54 -----
	X  char holifile[sizeof(LARNHOME)+sizeof(HOLIFILE)] =		LARNHOME;
	X  
	X  char diagfile[] ="Diagfile";					/* the diagnostic filename	*/
	X! char ckpfile[] ="Larn12.ckp";					/* the checkpoint filename	*/
	X  char *password ="pvnert(x)";					/* the wizards password <=32*/
	X  #if WIZID == -1
	X  int wisid=0;			/* the user id of the only person who can be wizard */
SHAR_EOF
if test 1848 -ne "`wc -c < 'config.diff'`"
then
	echo shar: error transmitting "'config.diff'" '(should have been 1848 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'data.diff'" '(4689 characters)'
if test -f 'data.diff'
then
	echo shar: will not over-write existing file "'data.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'data.diff'
	X*** ../olarn/data.c	Mon Sep 22 17:47:37 1986
	X--- data.c	Tue Sep 23 14:29:33 1986
	X***************
	X*** 81,87
	X  char mitem[MAXX][MAXY];	/*	monster item array 		*/
	X  char moved[MAXX][MAXY];	/*	monster movement flags  */
	X  char stealth[MAXX][MAXY];	/*  0=sleeping 1=awake monst*/
	X- char iven[26];			/*	inventory for player			*/
	X  short ivenarg[26];		/*	inventory for player			*/
	X  char lastmonst[40];		/*	this has the name of the current monster	*/
	X  char beenhere[MAXLEVEL+MAXVLEVEL]=0;	/*  1 if have been on this level */
	X
	X--- 81,86 -----
	X  char mitem[MAXX][MAXY];	/*	monster item array 		*/
	X  char moved[MAXX][MAXY];	/*	monster movement flags  */
	X  char stealth[MAXX][MAXY];	/*  0=sleeping 1=awake monst*/
	X  short ivenarg[26];		/*	inventory for player			*/
	X  char lastmonst[40];		/*	this has the name of the current monster	*/
	X  char beenhere[MAXLEVEL+MAXVLEVEL]={0};	/*  1 if have been on this level */
	X***************
	X*** 84,90
	X  char iven[26];			/*	inventory for player			*/
	X  short ivenarg[26];		/*	inventory for player			*/
	X  char lastmonst[40];		/*	this has the name of the current monster	*/
	X! char beenhere[MAXLEVEL+MAXVLEVEL]=0;	/*  1 if have been on this level */
	X  char VERSION=VER;	/*	this is the present version # of the program	*/
	X  char SUBVERSION=SUBVER;
	X  char nosignal=0;	/* set to 1 to disable the signals from doing anything */
	X
	X--- 83,90 -----
	X  char stealth[MAXX][MAXY];	/*  0=sleeping 1=awake monst*/
	X  short ivenarg[26];		/*	inventory for player			*/
	X  char lastmonst[40];		/*	this has the name of the current monster	*/
	X! char beenhere[MAXLEVEL+MAXVLEVEL]={0};	/*  1 if have been on this level */
	X! char iven[26];			/*	inventory for player			*/
	X  char VERSION=VER;	/*	this is the present version # of the program	*/
	X  char SUBVERSION=SUBVER;
	X  char nosignal=0;	/* set to 1 to disable the signals from doing anything */
	X***************
	X*** 121,128
	X  char *levelname[]=
	X  { " H"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10","V1","V2","V3" };
	X  
	X! char objnamelist[]=" ATOP%^F&^+M=%^$$f*OD#~][[)))(((||||||||{?!BC}o:@.<<<<EVV))([[]]](^ [H*** ^^ S tsTLc............................................";
	X! char monstnamelist[]=" BGHJKOScjtAELNQRZabhiCTYdegmvzFWflorXV pqsyUkMwDDPxnDDuD        ...............................................................";
	X  char *objectname[]=
	X  { 0,"a holy altar","a handsome jewel encrusted throne","the orb","a pit",
	X    "a staircase leading upwards","an elevator going up","a bubbling fountain",
	X
	X--- 121,130 -----
	X  char *levelname[]=
	X  { " H"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10","V1","V2","V3" };
	X  
	X! char objnamelist[]=
	X! " ATOP%^F&^+M=%^$$f*OD#~][[)))(((||||||||{?!BC}o:@.<<<<EVV))([[]]](^ [H*** ^^ S tsTLc......................................";
	X! char monstnamelist[]=
	X! " BGHJKOScjtAELNQRZabhiCTYdegmvzFWflorXV pqsyUkMwDDPxnDDuD        .......................................................";
	X  char *objectname[]=
	X  { 0,"a holy altar","a handsome jewel encrusted throne","the orb","a pit",
	X    "a staircase leading upwards","an elevator going up","a bubbling fountain",
	X***************
	X*** 332,338
	X  /*
	X  	spell data
	X   */
	X! char spelknow[SPNUM]=0;
	X  char splev[] = { 1, 4, 9, 14, 18, 22, 26, 29, 32, 35, 37, 37, 37, 37, 37 };
	X  
	X  char *spelcode[]={
	X
	X--- 334,340 -----
	X  /*
	X  	spell data
	X   */
	X! char spelknow[SPNUM]={0};
	X  char splev[] = { 1, 4, 9, 14, 18, 22, 26, 29, 32, 35, 37, 37, 37, 37, 37 };
	X  
	X  char *spelcode[]={
	X***************
	X*** 602,608
	X   *	18 - fire resistance	19 - treasure finding		20 - instant healing
	X   *	21 - cure dianthroritis	22 - poison					23 - see invisible
	X   */
	X! char potprob[] = { 0, 0, 1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 20, 22, 22, 23, 23 };
	X  
	X  char nlpts[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7 };
	X  char nch[] = { 0, 0, 0, 1, 1, 1, 2, 2, 3, 4 };
	X
	X--- 604,611 -----
	X   *	18 - fire resistance	19 - treasure finding		20 - instant healing
	X   *	21 - cure dianthroritis	22 - poison					23 - see invisible
	X   */
	X! char potprob[] = { 0, 0, 1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 
	X! 	14, 15, 16, 17, 18, 19, 19, 20, 21,22 } ;
	X  
	X  char nlpts[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7 };
	X  char nch[] = { 0, 0, 0, 1, 1, 1, 2, 2, 3, 4 };
	X***************
	X*** 609,612
	X  char nplt[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 4 };
	X  char ndgg[] = { 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5 };
	X  char nsw[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3 };
	X  
	X
	X--- 612,616 -----
	X  char nplt[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 4 };
	X  char ndgg[] = { 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5 };
	X  char nsw[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3 };
	X+ 
	X  
SHAR_EOF
if test 4689 -ne "`wc -c < 'data.diff'`"
then
	echo shar: error transmitting "'data.diff'" '(should have been 4689 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'diag.diff'" '(1645 characters)'
if test -f 'diag.diff'
then
	echo shar: will not over-write existing file "'diag.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'diag.diff'
	X*** ../olarn/diag.c	Mon Sep 22 17:47:28 1986
	X--- diag.c	Tue Sep 23 12:47:22 1986
	X***************
	X*** 163,169
	X  	lwrite((char*)beenhere,MAXLEVEL+MAXVLEVEL);
	X  	for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
	X  		if (beenhere[k])
	X! 			lwrite((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
	X  	times(&cputime);	/* get cpu time */
	X  	c[CPUTIME] += (cputime.tms_utime+cputime.tms_stime)/60;
	X  	lwrite((char*)&c[0],100*sizeof(long));
	X
	X--- 163,169 -----
	X  	lwrite((char*)beenhere,MAXLEVEL+MAXVLEVEL);
	X  	for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
	X  		if (beenhere[k])
	X! 			lwrite((char huge*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
	X  	times(&cputime);	/* get cpu time */
	X  	c[CPUTIME] += (cputime.tms_utime+cputime.tms_stime)/60;
	X  	lwrite((char*)&c[0],100*sizeof(long));
	X***************
	X*** 207,213
	X  	lrfill((char*)beenhere,MAXLEVEL+MAXVLEVEL);
	X  	for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
	X  		if (beenhere[k])
	X! 			lrfill((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
	X  
	X  	lrfill((char*)&c[0],100*sizeof(long));	gtime = lrint();
	X  	level = c[CAVELEVEL] = lgetc();
	X
	X--- 207,213 -----
	X  	lrfill((char*)beenhere,MAXLEVEL+MAXVLEVEL);
	X  	for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
	X  		if (beenhere[k])
	X! 			lrfill((char huge*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
	X  
	X  	lrfill((char*)&c[0],100*sizeof(long));	gtime = lrint();
	X  	level = c[CAVELEVEL] = lgetc();
	X***************
	X*** 312,314
	X  	lprcat("cannot let you play this game.\n");
	X  	nap(5000);  c[GOLD]=c[BANKACCOUNT]=0;  died(-268); return;
	X  	}
	X
	X--- 312,315 -----
	X  	lprcat("cannot let you play this game.\n");
	X  	nap(5000);  c[GOLD]=c[BANKACCOUNT]=0;  died(-268); return;
	X  	}
	X+ 
SHAR_EOF
if test 1645 -ne "`wc -c < 'diag.diff'`"
then
	echo shar: error transmitting "'diag.diff'" '(should have been 1645 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'display.diff'" '(989 characters)'
if test -f 'display.diff'
then
	echo shar: will not over-write existing file "'display.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'display.diff'
	X*** ../olarn/display.c	Mon Sep 22 17:47:40 1986
	X--- display.c	Tue Sep 23 12:47:25 1986
	X***************
	X*** 1,6
	X  /*	display.c		Larn is copyrighted 1986 by Noah Morgan. */
	X  #include "header.h"
	X! #define makecode(_a,_b,_c) (((_a)<<16) + ((_b)<<8) + (_c))
	X  
	X  static int minx,maxx,miny,maxy,k,m;
	X  static char bot1f=0,bot2f=0,bot3f=0;
	X
	X--- 1,6 -----
	X  /*	display.c		Larn is copyrighted 1986 by Noah Morgan. */
	X  #include "header.h"
	X! #define makecode(_a,_b,_c) (((long)(_a)<<16) + ((_b)<<8) + (_c))
	X  
	X  static int minx,maxx,miny,maxy,k,m;
	X  static char bot1f=0,bot2f=0,bot3f=0;
	X***************
	X*** 145,151
	X  	}
	X  
	X  static botsub(idx,str)
	X! 	register int idx;
	X  	char *str;
	X  	{
	X  	register int x,y;
	X
	X--- 145,151 -----
	X  	}
	X  
	X  static botsub(idx,str)
	X! 	long idx;
	X  	char *str;
	X  	{
	X  	register int x,y;
	X***************
	X*** 429,431
	X  		if (lincount>17) {	lincount=0;  more();  clear();	}
	X  		}
	X  	}
	X
	X--- 429,432 -----
	X  		if (lincount>17) {	lincount=0;  more();  clear();	}
	X  		}
	X  	}
	X+ 
SHAR_EOF
if test 989 -ne "`wc -c < 'display.diff'`"
then
	echo shar: error transmitting "'display.diff'" '(should have been 989 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'global.diff'" '(1487 characters)'
if test -f 'global.diff'
then
	echo shar: will not over-write existing file "'global.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'global.diff'
	X*** ../olarn/global.c	Mon Sep 22 17:47:43 1986
	X--- global.c	Tue Sep 23 12:47:34 1986
	X***************
	X*** 557,563
	X  	scbr();	/*	system("stty -echo cbreak"); */
	X  	gpwp = gpwbuf;	lprcat("\nEnter Password: "); lflush();
	X  	i = strlen(password);
	X! 	for (j=0; j<i; j++) read(0,gpwp++,1);	  gpwbuf[i]=0;
	X  	sncbr(); /* system("stty echo -cbreak"); */
	X  	if (strcmp(gpwbuf,password) != 0)
	X  		{	lprcat("\nSorry\n");  lflush(); return(0);	}
	X
	X--- 557,563 -----
	X  	scbr();	/*	system("stty -echo cbreak"); */
	X  	gpwp = gpwbuf;	lprcat("\nEnter Password: "); lflush();
	X  	i = strlen(password);
	X! 	for (j=0; j<i; j++) *gpwp++ = getchar();	  gpwbuf[i]=0;
	X  	sncbr(); /* system("stty echo -cbreak"); */
	X  	if (strcmp(gpwbuf,password) != 0)
	X  		{	lprcat("\nSorry\n");  lflush(); return(0);	}
	X***************
	X*** 610,616
	X  rnd(x)
	X  	int x;
	X  	{
	X! 	return((((randx=randx*1103515245+12345)>>7)%(x))+1);
	X  	}
	X  
	X  rund(x)
	X
	X--- 610,616 -----
	X  rnd(x)
	X  	int x;
	X  	{
	X! 	return((((randx=randx*1103515245L+12345)>>7)%(x))+1);
	X  	}
	X  
	X  rund(x)
	X***************
	X*** 616,621
	X  rund(x)
	X  	int x;
	X  	{
	X! 	return((((randx=randx*1103515245+12345)>>7)%(x))  );
	X  	}
	X  #endif MACRORND
	X
	X--- 616,622 -----
	X  rund(x)
	X  	int x;
	X  	{
	X! 	return((((randx=randx*1103515245L+12345)>>7)%(x))  );
	X  	}
	X  #endif MACRORND
	X  
	X***************
	X*** 619,621
	X  	return((((randx=randx*1103515245+12345)>>7)%(x))  );
	X  	}
	X  #endif MACRORND
	X
	X--- 619,622 -----
	X  	return((((randx=randx*1103515245L+12345)>>7)%(x))  );
	X  	}
	X  #endif MACRORND
	X+ 
SHAR_EOF
if test 1487 -ne "`wc -c < 'global.diff'`"
then
	echo shar: error transmitting "'global.diff'" '(should have been 1487 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'header.diff'" '(8889 characters)'
if test -f 'header.diff'
then
	echo shar: will not over-write existing file "'header.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'header.diff'
	X*** ../olarn/header.h	Mon Sep 22 17:47:48 1986
	X--- header.h	Tue Sep 23 14:25:21 1986
	X***************
	X*** 1,4
	X! /*	header.h		Larn is copyrighted 1986 by Noah Morgan. */
	X  
	X  #define SCORENAME   ".lscore12.0"
	X  #define LOGFNAME    ".llog12.0"
	X
	X--- 1,4 -----
	X! /*	heade.h		Larn is copyrighted 1986 by Noah Morgan. */
	X  
	X  #define SCORENAME   "lscore12.0"
	X  #define LOGFNAME    "llog12.0"
	X***************
	X*** 1,12
	X  /*	header.h		Larn is copyrighted 1986 by Noah Morgan. */
	X  
	X! #define SCORENAME   ".lscore12.0"
	X! #define LOGFNAME    ".llog12.0"
	X! #define HELPNAME    ".larn.help"
	X! #define LEVELSNAME  ".larnmaze"
	X! #define FORTSNAME   ".lfortune"
	X! #define PLAYERIDS	".playerids"
	X! #define HOLIFILE	".holidays"
	X  
	X  #define MAXLEVEL 11
	X  	/*	max # levels in the dungeon			*/
	X
	X--- 1,12 -----
	X  /*	heade.h		Larn is copyrighted 1986 by Noah Morgan. */
	X  
	X! #define SCORENAME   "lscore12.0"
	X! #define LOGFNAME    "llog12.0"
	X! #define HELPNAME    "larn.hlp"
	X! #define LEVELSNAME  "larnmaze"
	X! #define FORTSNAME   "lfortune"
	X! #define PLAYERIDS	"playerids"
	X! #define HOLIFILE	"holidays"
	X  
	X  #define MAXLEVEL 11
	X  	/*	max # levels in the dungeon			*/
	X***************
	X*** 53,59
	X  /*	this is the structure definition for the items in the dnd store */
	X  struct _itm
	X  	{
	X! 	short	price;
	X  	char	**mem;
	X  	char	obj;
	X  	char	arg;
	X
	X--- 53,59 -----
	X  /*	this is the structure definition for the items in the dnd store */
	X  struct _itm
	X  	{
	X! 	short price;
	X  	char	**mem;
	X  	char	obj;
	X  	char	arg;
	X***************
	X*** 70,75
	X  	char	know;	/*	have we been here before*/
	X  	};
	X  
	X  /* this is the structure for maintaining & moving the spheres of annihilation */
	X  struct sphere
	X  	{
	X
	X--- 70,76 -----
	X  	char	know;	/*	have we been here before*/
	X  	};
	X  
	X+ 
	X  /* this is the structure for maintaining & moving the spheres of annihilation */
	X  struct sphere
	X  	{
	X***************
	X*** 336,341
	X  
	X  #ifndef NODEFS
	X  extern char VERSION,SUBVERSION;
	X  extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
	X  extern char *class[],course[],diagfile[],fortfile[],helpfile[],holifile[];
	X  extern char *inbuffer,is_alpha[],is_digit[];
	X
	X--- 337,343 -----
	X  
	X  #ifndef NODEFS
	X  extern char VERSION,SUBVERSION;
	X+ extern char far* lpbuf, far* inbuffer;
	X  extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
	X  extern char *class[],course[],diagfile[],fortfile[],helpfile[],holifile[];
	X  extern char is_alpha[],is_digit[];
	X***************
	X*** 338,344
	X  extern char VERSION,SUBVERSION;
	X  extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
	X  extern char *class[],course[],diagfile[],fortfile[],helpfile[],holifile[];
	X! extern char *inbuffer,is_alpha[],is_digit[];
	X  extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
	X  extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
	X  extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
	X
	X--- 340,346 -----
	X  extern char far* lpbuf, far* inbuffer;
	X  extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
	X  extern char *class[],course[],diagfile[],fortfile[],helpfile[],holifile[];
	X! extern char is_alpha[],is_digit[];
	X  extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
	X  extern char level,*levelname[],logfile[],loginname[],logname[],far* lpend;
	X  extern char far* lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
	X***************
	X*** 340,347
	X  extern char *class[],course[],diagfile[],fortfile[],helpfile[],holifile[];
	X  extern char *inbuffer,is_alpha[],is_digit[];
	X  extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
	X! extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
	X! extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
	X  extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
	X  extern char nplt[],nsw[],*objectname[];
	X  extern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[];
	X
	X--- 342,349 -----
	X  extern char *class[],course[],diagfile[],fortfile[],helpfile[],holifile[];
	X  extern char is_alpha[],is_digit[];
	X  extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
	X! extern char level,*levelname[],logfile[],loginname[],logname[],far* lpend;
	X! extern char far* lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
	X  extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
	X  extern char nplt[],nsw[],*objectname[];
	X  extern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[];
	X***************
	X*** 355,361
	X  extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd;
	X  extern long initialtime,outstanding_taxes,skill[],gtime,c[],cbak[];
	X  extern unsigned long randx;
	X! extern struct cel *cell;
	X  extern struct monst monster[];
	X  extern struct sphere *spheres;
	X  extern struct _itm itm[];
	X
	X--- 357,363 -----
	X  extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd;
	X  extern long initialtime,outstanding_taxes,skill[],gtime,c[],cbak[];
	X  extern unsigned long randx;
	X! extern struct cel huge* cell;
	X  extern struct monst monster[];
	X  extern struct sphere *spheres;
	X  extern struct _itm itm[];
	X***************
	X*** 396,402
	X  	/* macro to clear the screen and home the cursor */
	X  #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
	X  #define cltoeoln() lprcat("\33[K")
	X! #else VT100
	X  	/* defines below are for use in the termcap mode only */
	X  #define ST_START 1
	X  #define ST_END   2
	X
	X--- 398,404 -----
	X  	/* macro to clear the screen and home the cursor */
	X  #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
	X  #define cltoeoln() lprcat("\33[K")
	X! #else
	X  	/* defines below are for use in the termcap mode only */
	X  #define ST_START 1
	X  #define ST_END   2
	X***************
	X*** 407,413
	X  #define CL_DOWN 14
	X  #define CURSOR  15
	X  	/* macro to turn on bold display for the terminal */
	X! #define setbold() (*lpnt++ = ST_START)
	X  	/* macro to turn off bold display for the terminal */
	X  #define resetbold() (*lpnt++ = ST_END)
	X  	/* macro to setup the scrolling region for the terminal */
	X
	X--- 409,415 -----
	X  #define CL_DOWN 14
	X  #define CURSOR  15
	X  	/* macro to turn on bold display for the terminal */
	X! #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
	X  	/* macro to turn off bold display for the terminal */
	X  #define resetbold() (lprcat("\33[m"))
	X  /* macro to setup the scrolling region for the terminal */
	X***************
	X*** 409,416
	X  	/* macro to turn on bold display for the terminal */
	X  #define setbold() (*lpnt++ = ST_START)
	X  	/* macro to turn off bold display for the terminal */
	X! #define resetbold() (*lpnt++ = ST_END)
	X! 	/* macro to setup the scrolling region for the terminal */
	X  #define setscroll() enable_scroll=1
	X  	/* macro to clear the scrolling region for the terminal */
	X  #define resetscroll() enable_scroll=0
	X
	X--- 411,418 -----
	X  	/* macro to turn on bold display for the terminal */
	X  #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
	X  	/* macro to turn off bold display for the terminal */
	X! #define resetbold() (lprcat("\33[m"))
	X! /* macro to setup the scrolling region for the terminal */
	X  #define setscroll() enable_scroll=1
	X  	/* macro to clear the scrolling region for the terminal */
	X  #define resetscroll() enable_scroll=0
	X***************
	X*** 418,424
	X  #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
	X  	/* macro to clear to end of line */
	X  #define cltoeoln() (*lpnt++ = CL_LINE)
	X! #endif VT100
	X  
	X  	/* macro to output one byte to the output buffer */
	X  #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
	X
	X--- 420,426 -----
	X  #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
	X  	/* macro to clear to end of line */
	X  #define cltoeoln() (*lpnt++ = CL_LINE)
	X! #endif
	X  
	X  	/* macro to output one byte to the output buffer */
	X  #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
	X***************
	X*** 429,435
	X  	/* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
	X  #define rnd(x)  ((((randx=randx*1103515245+12345)>>7)%(x))+1)
	X  #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x))  )
	X! #endif MACRORND
	X  	/* macros for miscellaneous data conversion */
	X  #define min(x,y) (((x)>(y))?(y):(x))
	X  #define max(x,y) (((x)>(y))?(x):(y))
	X
	X--- 431,437 -----
	X  	/* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
	X  #define rnd(x)  ((((randx=randx*1103515245+12345)>>7)%(x))+1)
	X  #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x))  )
	X! #endif
	X  	/* macros for miscellaneous data conversion */
	X  #define min(x,y) (((x)>(y))?(y):(x))
	X  #define max(x,y) (((x)>(y))?(x):(y))
	X***************
	X*** 439,443
	X  #define toupper(x) (to_upper[x])
	X  #define lcc(x) (to_lower[x])
	X  #define ucc(x) (to_upper[x])
	X! #endif NODEFS
	X  
	X
	X--- 441,445 -----
	X  #define toupper(x) (to_upper[x])
	X  #define lcc(x) (to_lower[x])
	X  #define ucc(x) (to_upper[x])
	X! #endif
	X  
SHAR_EOF
if test 8889 -ne "`wc -c < 'header.diff'`"
then
	echo shar: error transmitting "'header.diff'" '(should have been 8889 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'main.diff'" '(1265 characters)'
if test -f 'main.diff'
then
	echo shar: will not over-write existing file "'main.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'main.diff'
	X*** ../olarn/main.c	Mon Sep 22 17:47:58 1986
	X--- main.c	Tue Sep 23 14:35:05 1986
	X***************
	X*** 40,46
	X  	int hard;
	X  	char *ptr=0,*ttype;
	X  	struct passwd *pwe,*getpwuid();
	X! 
	X  /*
	X   *	first task is to identify the player
	X   */
	X
	X--- 40,50 -----
	X  	int hard;
	X  	char *ptr=0,*ttype;
	X  	struct passwd *pwe,*getpwuid();
	X! 	static struct cel huge Excell[(MAXLEVEL+MAXVLEVEL)*MAXX*MAXY]; 
	X! 	static char far Exlpbuf[(5* BUFBIG)>>2];	/* output buffer */
	X! 	static char far Exinbuffer[(5*MAXIBUF)>>2];	/* output buffer */
	X! 	cell = Excell; lpbuf = Exlpbuf; inbuffer = Exinbuffer;
	X! 	
	X  /*
	X   *	first task is to identify the player
	X   */
	X***************
	X*** 84,94
	X  /*
	X   *	now malloc the memory for the dungeon 
	X   */
	X- 	cell = (struct cel *)malloc(sizeof(struct cel)*(MAXLEVEL+MAXVLEVEL)*MAXX*MAXY);
	X- 	if (cell == 0) died(-285);	/* malloc failure */
	X- 	lpbuf    = malloc((5* BUFBIG)>>2);	/* output buffer */
	X- 	inbuffer = malloc((5*MAXIBUF)>>2);	/* output buffer */
	X- 	if ((lpbuf==0) || (inbuffer==0)) died(-285); /* malloc() failure */
	X  
	X  	lcreat((char*)0);	newgame();		/*	set the initial clock  */ hard= -1;
	X  
	X
	X--- 88,93 -----
	X  /*
	X   *	now malloc the memory for the dungeon 
	X   */
	X  
	X  	lcreat((char*)0);	newgame();		/*	set the initial clock  */ hard= -1;
	X  
SHAR_EOF
if test 1265 -ne "`wc -c < 'main.diff'`"
then
	echo shar: error transmitting "'main.diff'" '(should have been 1265 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'nap.diff'" '(504 characters)'
if test -f 'nap.diff'
then
	echo shar: will not over-write existing file "'nap.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'nap.diff'
	X*** ../olarn/nap.c	Mon Sep 22 17:47:44 1986
	X--- nap.c	Tue Sep 23 12:48:13 1986
	X***************
	X*** 1,4
	X  /* nap.c		 Larn is copyrighted 1986 by Noah Morgan. */
	X  #include <signal.h>
	X  #include <sys/types.h>
	X  #ifdef SYSV
	X
	X--- 1,5 -----
	X  /* nap.c		 Larn is copyrighted 1986 by Noah Morgan. */
	X+ #define NONAP
	X  #include <signal.h>
	X  #include <sys/types.h>
	X  #ifdef SYSV
	X***************
	X*** 114,116
	X  #endif BSD
	X  #endif SYSV
	X  #endif NONAP
	X
	X--- 115,118 -----
	X  #endif BSD
	X  #endif SYSV
	X  #endif NONAP
	X+ 
SHAR_EOF
if test 504 -ne "`wc -c < 'nap.diff'`"
then
	echo shar: error transmitting "'nap.diff'" '(should have been 504 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'savelev.diff'" '(3374 characters)'
if test -f 'savelev.diff'
then
	echo shar: will not over-write existing file "'savelev.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'savelev.diff'
	X*** ../olarn/savelev.c	Mon Sep 22 17:47:32 1986
	X--- savelev.c	Tue Sep 23 12:48:25 1986
	X***************
	X*** 1,6
	X  /* savelev.c		 Larn is copyrighted 1986 by Noah Morgan. */
	X  #include "header.h"
	X- extern struct cel *cell;
	X  
	X  /*
	X   *	routine to save the present level into storage
	X
	X--- 1,5 -----
	X  /* savelev.c		 Larn is copyrighted 1986 by Noah Morgan. */
	X  #include "header.h"
	X  
	X  /*
	X   *	routine to save the present level into storage
	X***************
	X*** 7,13
	X   */
	X  savelevel()
	X  	{
	X! 	register struct cel *pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X  	register struct cel *pecel;
	X
	X--- 6,12 -----
	X   */
	X  savelevel()
	X  	{
	X! 	struct cel huge* pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X  	struct cel huge* pecel;
	X***************
	X*** 10,16
	X  	register struct cel *pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X! 	register struct cel *pecel;
	X  	pcel = &cell[level*MAXX*MAXY];	/* pointer to this level's cells */
	X  	pecel = pcel + MAXX*MAXY;	/* pointer to past end of this level's cells */
	X  	pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
	X
	X--- 9,15 -----
	X  	struct cel huge* pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X! 	struct cel huge* pecel;
	X  	pcel = &cell[level*MAXX*MAXY];	/* pointer to this level's cells */
	X  	pecel = pcel + MAXX*MAXY;	/* pointer to past end of this level's cells */
	X  	pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
	X***************
	X*** 20,26
	X  		pcel->hitp   = *phitp++;
	X  		pcel->item   = *pitem++;
	X  		pcel->know   = *pknow++;
	X! 		pcel++->iarg = *piarg++;
	X  		}
	X  	}
	X  
	X
	X--- 19,26 -----
	X  		pcel->hitp   = *phitp++;
	X  		pcel->item   = *pitem++;
	X  		pcel->know   = *pknow++;
	X! 		pcel->iarg = *piarg++;
	X! 		pcel++;
	X  		}
	X  	}
	X  
	X***************
	X*** 29,35
	X   */
	X  getlevel()
	X  	{
	X! 	register struct cel *pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X  	register struct cel *pecel;
	X
	X--- 29,35 -----
	X   */
	X  getlevel()
	X  	{
	X! 	struct cel huge* pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X  	struct cel huge* pecel;
	X***************
	X*** 32,38
	X  	register struct cel *pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X! 	register struct cel *pecel;
	X  	pcel = &cell[level*MAXX*MAXY];	/* pointer to this level's cells */
	X  	pecel = pcel + MAXX*MAXY;	/* pointer to past end of this level's cells */
	X  	pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
	X
	X--- 32,38 -----
	X  	struct cel huge* pcel;
	X  	register char *pitem,*pknow,*pmitem;
	X  	register short *phitp,*piarg;
	X! 	struct cel huge* pecel;
	X  	pcel = &cell[level*MAXX*MAXY];	/* pointer to this level's cells */
	X  	pecel = pcel + MAXX*MAXY;	/* pointer to past end of this level's cells */
	X  	pitem=item[0]; piarg=iarg[0]; pknow=know[0]; pmitem=mitem[0]; phitp=hitp[0];
	X***************
	X*** 42,47
	X  		*phitp++ = pcel->hitp;
	X  		*pitem++ = pcel->item;
	X  		*pknow++ = pcel->know;
	X! 		*piarg++ = pcel++->iarg;
	X  		}
	X  	}
	X
	X--- 42,49 -----
	X  		*phitp++ = pcel->hitp;
	X  		*pitem++ = pcel->item;
	X  		*pknow++ = pcel->know;
	X! 		*piarg++ = pcel->iarg;
	X! 		pcel++;
	X  		}
	X  	}
	X  
	X***************
	X*** 45,47
	X  		*piarg++ = pcel++->iarg;
	X  		}
	X  	}
	X
	X--- 46,49 -----
	X  		pcel++;
	X  		}
	X  	}
	X+ 
SHAR_EOF
if test 3374 -ne "`wc -c < 'savelev.diff'`"
then
	echo shar: error transmitting "'savelev.diff'" '(should have been 3374 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'signal.diff'" '(4449 characters)'
if test -f 'signal.diff'
then
	echo shar: will not over-write existing file "'signal.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'signal.diff'
	X*** ../olarn/signal.c	Mon Sep 22 17:48:27 1986
	X--- signal.c	Tue Sep 23 12:48:29 1986
	X***************
	X*** 11,17
	X  static cntlc()	/* what to do for a ^C */
	X  	{
	X  	if (nosignal) return;	/* don't do anything if inhibited */
	X! 	signal(SIGQUIT,SIG_IGN);	signal(SIGINT,SIG_IGN);
	X  	quit(); if (predostuff==1) s2choose(); else showplayer();
	X  	lflush();
	X  	signal(SIGQUIT,cntlc);	signal(SIGINT,cntlc);
	X
	X--- 11,17 -----
	X  static cntlc()	/* what to do for a ^C */
	X  	{
	X  	if (nosignal) return;	/* don't do anything if inhibited */
	X! 	signal(SIGINT,SIG_IGN);
	X  	quit(); if (predostuff==1) s2choose(); else showplayer();
	X  	lflush();
	X  	signal(SIGINT,cntlc);
	X***************
	X*** 14,20
	X  	signal(SIGQUIT,SIG_IGN);	signal(SIGINT,SIG_IGN);
	X  	quit(); if (predostuff==1) s2choose(); else showplayer();
	X  	lflush();
	X! 	signal(SIGQUIT,cntlc);	signal(SIGINT,cntlc);
	X  	}
	X  
	X  /*
	X
	X--- 14,20 -----
	X  	signal(SIGINT,SIG_IGN);
	X  	quit(); if (predostuff==1) s2choose(); else showplayer();
	X  	lflush();
	X! 	signal(SIGINT,cntlc);
	X  	}
	X  
	X  /*
	X***************
	X*** 45,50
	X  /*
	X   *	subroutine to issue the needed signal traps  called from main()
	X   */
	X  static sigill()  { sigpanic(SIGILL); }	 static sigtrap() { sigpanic(SIGTRAP); }
	X  static sigiot()  { sigpanic(SIGIOT); }   static sigemt()  { sigpanic(SIGEMT); }
	X  static sigfpe()  { sigpanic(SIGFPE); }   static sigbus()  { sigpanic(SIGBUS); }
	X
	X--- 45,51 -----
	X  /*
	X   *	subroutine to issue the needed signal traps  called from main()
	X   */
	X+ /*
	X  static sigill()  { sigpanic(SIGILL); }	 static sigtrap() { sigpanic(SIGTRAP); }
	X  static sigiot()  { sigpanic(SIGIOT); }   static sigemt()  { sigpanic(SIGEMT); }
	X  static sigfpe()  { sigpanic(SIGFPE); }   static sigbus()  { sigpanic(SIGBUS); }
	X***************
	X*** 50,55
	X  static sigfpe()  { sigpanic(SIGFPE); }   static sigbus()  { sigpanic(SIGBUS); }
	X  static sigsegv() { sigpanic(SIGSEGV); }  static sigsys()  { sigpanic(SIGSYS); }
	X  static sigpipe() { sigpanic(SIGPIPE); }  static sigterm() { sigpanic(SIGTERM); }
	X  sigsetup()
	X  	{
	X  	signal(SIGQUIT, cntlc); 		signal(SIGINT,  cntlc); 
	X
	X--- 51,57 -----
	X  static sigfpe()  { sigpanic(SIGFPE); }   static sigbus()  { sigpanic(SIGBUS); }
	X  static sigsegv() { sigpanic(SIGSEGV); }  static sigsys()  { sigpanic(SIGSYS); }
	X  static sigpipe() { sigpanic(SIGPIPE); }  static sigterm() { sigpanic(SIGTERM); }
	X+ */
	X  sigsetup()
	X  	{
	X  			signal(SIGINT,  cntlc); 
	X***************
	X*** 52,64
	X  static sigpipe() { sigpanic(SIGPIPE); }  static sigterm() { sigpanic(SIGTERM); }
	X  sigsetup()
	X  	{
	X! 	signal(SIGQUIT, cntlc); 		signal(SIGINT,  cntlc); 
	X! 	signal(SIGKILL, SIG_IGN);		signal(SIGHUP,  sgam);
	X! 	signal(SIGILL,  sigill);		signal(SIGTRAP, sigtrap);
	X! 	signal(SIGIOT,  sigiot);		signal(SIGEMT,  sigemt);
	X! 	signal(SIGFPE,  sigfpe);		signal(SIGBUS,  sigbus);
	X! 	signal(SIGSEGV, sigsegv);		signal(SIGSYS,  sigsys);
	X! 	signal(SIGPIPE, sigpipe);		signal(SIGTERM, sigterm);
	X  #ifdef SIGTSTP
	X  	signal(SIGTSTP,tstop);		signal(SIGSTOP,tstop);
	X  #endif SIGTSTP
	X
	X--- 54,60 -----
	X  */
	X  sigsetup()
	X  	{
	X! 			signal(SIGINT,  cntlc); 
	X  #ifdef SIGTSTP
	X  	signal(SIGTSTP,tstop);		signal(SIGSTOP,tstop);
	X  #endif SIGTSTP
	X***************
	X*** 101,124
	X  static char *signame[NSIG] = { "",
	X  "SIGHUP",  /*	1	 hangup */
	X  "SIGINT",  /*	2	 interrupt */
	X! "SIGQUIT", /*	3	 quit */
	X! "SIGILL",  /*	4	 illegal instruction (not reset when caught) */
	X! "SIGTRAP", /*	5	 trace trap (not reset when caught) */
	X! "SIGIOT",  /*	6	 IOT instruction */
	X! "SIGEMT",  /*	7	 EMT instruction */
	X! "SIGFPE",  /*	8	 floating point exception */
	X! "SIGKILL", /*	9	 kill (cannot be caught or ignored) */
	X! "SIGBUS",  /*	10	 bus error */
	X! "SIGSEGV", /*	11	 segmentation violation */
	X! "SIGSYS",  /*	12	 bad argument to system call */
	X! "SIGPIPE", /*	13	 write on a pipe with no one to read it */
	X! "SIGALRM", /*	14	 alarm clock */
	X! "SIGTERM", /*	15	 software termination signal from kill */
	X! "SIGUSR1",  /*	16	 user defines signal 1 */
	X! "SIGUSR2", /*	17	 user defines signal 2 */
	X! "SIGCLD",  /*	18	 child death */
	X! "SIGPWR",  /*	19	 power fail */
	X! "","","","","","","","","","","","" };
	X  
	X  #endif BSD
	X  
	X
	X--- 97,103 -----
	X  static char *signame[NSIG] = { "",
	X  "SIGHUP",  /*	1	 hangup */
	X  "SIGINT",  /*	2	 interrupt */
	X! };
	X  
	X  #endif BSD
	X  
	X***************
	X*** 136,138
	X  	savegame(savefilename); 
	X  	kill(getpid(),sig); /* this will terminate us */
	X  	}
	X
	X--- 115,118 -----
	X  	savegame(savefilename); 
	X  	kill(getpid(),sig); /* this will terminate us */
	X  	}
	X+ 
SHAR_EOF
if test 4449 -ne "`wc -c < 'signal.diff'`"
then
	echo shar: error transmitting "'signal.diff'" '(should have been 4449 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'store.diff'" '(4342 characters)'
if test -f 'store.diff'
then
	echo shar: will not over-write existing file "'store.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'store.diff'
	X*** ../olarn/store.c	Mon Sep 22 17:48:38 1986
	X--- store.c	Tue Sep 23 14:03:37 1986
	X***************
	X*** 221,227
	X  	else if (itm[i].obj == OSCROLL)
	X  		{ lprcat("scroll of "); lprintf("%s",&scrollname[itm[i].arg][1]); }
	X  	else lprintf("%s",objectname[itm[i].obj]);
	X! 	cursor( j+31,k );  lprintf("%6d",(long)(itm[i].price*10));
	X  	}
	X  
	X  
	X
	X--- 221,227 -----
	X  	else if (itm[i].obj == OSCROLL)
	X  		{ lprcat("scroll of "); lprintf("%s",&scrollname[itm[i].arg][1]); }
	X  	else lprintf("%s",objectname[itm[i].obj]);
	X! 	cursor( j+31,k );  lprintf("%6d",((long)itm[i].price)*10);
	X  	}
	X  
	X  
	X***************
	X*** 228,234
	X  /*
	X  	for the college of larn
	X   */
	X! char course[26]=0;	/*	the list of courses taken	*/
	X  char coursetime[] = { 10, 15, 10, 20, 10, 10, 10, 5 };
	X  /*
	X  	function to display the header info for the school
	X
	X--- 228,234 -----
	X  /*
	X  	for the college of larn
	X   */
	X! char course[26]={0};	/*	the list of courses taken	*/
	X  char coursetime[] = { 10, 15, 10, 20, 10, 10, 10, 5 };
	X  /*
	X  	function to display the header info for the school
	X***************
	X*** 388,394
	X  	{
	X  	register int i;
	X  	if (c[BANKACCOUNT]<0) c[BANKACCOUNT] = 0;
	X! 	else if ((c[BANKACCOUNT]>0) && (c[BANKACCOUNT]<500000))
	X  		{
	X  		i = (gtime-lasttime)/100; /* # mobuls elapsed */
	X  		while ((i-- > 0) && (c[BANKACCOUNT]<500000))
	X
	X--- 388,394 -----
	X  	{
	X  	register int i;
	X  	if (c[BANKACCOUNT]<0) c[BANKACCOUNT] = 0;
	X! 	else if ((c[BANKACCOUNT]>0) && (c[BANKACCOUNT]<500000L))
	X  		{
	X  		i = (gtime-lasttime)/100; /* # mobuls elapsed */
	X  		while ((i-- > 0) && (c[BANKACCOUNT]<500000L))
	X***************
	X*** 391,397
	X  	else if ((c[BANKACCOUNT]>0) && (c[BANKACCOUNT]<500000))
	X  		{
	X  		i = (gtime-lasttime)/100; /* # mobuls elapsed */
	X! 		while ((i-- > 0) && (c[BANKACCOUNT]<500000))
	X  			c[BANKACCOUNT] += c[BANKACCOUNT]/250;
	X  		if (c[BANKACCOUNT]>500000) c[BANKACCOUNT]=500000; /* interest limit */
	X  		}
	X
	X--- 391,397 -----
	X  	else if ((c[BANKACCOUNT]>0) && (c[BANKACCOUNT]<500000L))
	X  		{
	X  		i = (gtime-lasttime)/100; /* # mobuls elapsed */
	X! 		while ((i-- > 0) && (c[BANKACCOUNT]<500000L))
	X  			c[BANKACCOUNT] += c[BANKACCOUNT]/250;
	X  		if (c[BANKACCOUNT]>500000L) c[BANKACCOUNT]=500000L; /* interest limit */
	X  		}
	X***************
	X*** 393,399
	X  		i = (gtime-lasttime)/100; /* # mobuls elapsed */
	X  		while ((i-- > 0) && (c[BANKACCOUNT]<500000))
	X  			c[BANKACCOUNT] += c[BANKACCOUNT]/250;
	X! 		if (c[BANKACCOUNT]>500000) c[BANKACCOUNT]=500000; /* interest limit */
	X  		}
	X  	lasttime = (gtime/100)*100;
	X  	}
	X
	X--- 393,399 -----
	X  		i = (gtime-lasttime)/100; /* # mobuls elapsed */
	X  		while ((i-- > 0) && (c[BANKACCOUNT]<500000L))
	X  			c[BANKACCOUNT] += c[BANKACCOUNT]/250;
	X! 		if (c[BANKACCOUNT]>500000L) c[BANKACCOUNT]=500000L; /* interest limit */
	X  		}
	X  	lasttime = (gtime/100)*100;
	X  	}
	X***************
	X*** 398,405
	X  	lasttime = (gtime/100)*100;
	X  	}
	X  
	X! static short gemorder[26]=0;	/* the reference to screen location for each */
	X! static long gemvalue[26]=0;	/* the appraisal of the gems */
	X  obanksub()
	X  	{
	X  	unsigned long amt;
	X
	X--- 398,405 -----
	X  	lasttime = (gtime/100)*100;
	X  	}
	X  
	X! static short gemorder[26]={0};	/* the reference to screen location for each */
	X! static long gemvalue[26]={0};	/* the appraisal of the gems */
	X  obanksub()
	X  	{
	X  	unsigned long amt;
	X***************
	X*** 531,537
	X  
	X  otradepost()
	X    {
	X!   register int i,j,value,isub,izarg;
	X    dnditm = dndcount = 0;
	X    nosignal = 1; /* disable signals */
	X    resetscroll();	otradhead();
	X
	X--- 531,538 -----
	X  
	X  otradepost()
	X    {
	X!   register int i,j, isub, izarg;
	X!   unsigned long value;
	X    dnditm = dndcount = 0;
	X    nosignal = 1; /* disable signals */
	X    resetscroll();	otradhead();
	X***************
	X*** 553,559
	X  	else
	X  		{
	X  		for (j=0; j<maxitm; j++)
	X! 		  if ((itm[j].obj == iven[isub]) || (iven[isub] == ODIAMOND) || (iven[isub] == ORUBY) || (iven[isub] == OEMERALD) || (iven[isub] == OSAPPHIRE))
	X  			{
	X  			srcount=0;  show3(isub);	/* show what the item was */
	X  			if ((iven[isub] == ODIAMOND) || (iven[isub] == ORUBY)
	X
	X--- 554,561 -----
	X  	else
	X  		{
	X  		for (j=0; j<maxitm; j++)
	X! 		  if ((itm[j].obj == iven[isub]) || (iven[isub] == ODIAMOND) || (iven[isub] == ORUBY)
	X! 		 || (iven[isub] == OEMERALD) || (iven[isub] == OSAPPHIRE))
	X  			{
	X  			srcount=0;  show3(isub);	/* show what the item was */
	X  			if ((iven[isub] == ODIAMOND) || (iven[isub] == ORUBY)
SHAR_EOF
if test 4342 -ne "`wc -c < 'store.diff'`"
then
	echo shar: error transmitting "'store.diff'" '(should have been 4342 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'tok.diff'" '(1452 characters)'
if test -f 'tok.diff'
then
	echo shar: will not over-write existing file "'tok.diff'"
else
sed 's/^	X//' << \SHAR_EOF > 'tok.diff'
	X*** ../olarn/tok.c	Mon Sep 22 17:48:29 1986
	X--- tok.c	Tue Sep 23 12:48:43 1986
	X***************
	X*** 57,68
	X  
	X  			}
	X  
	X! 		do		/* if keyboard input buffer is too big, flush some of it */
	X! 			{
	X! 			ioctl(0,FIONREAD,&ic);
	X! 			if (ic>flushno)   read(0,&cc,1);
	X! 			}
	X! 		while (ic>flushno);
	X  
	X  		if (read(0,&cc,1) != 1) return(lastok = -1);
	X  
	X
	X--- 57,64 -----
	X  
	X  			}
	X  
	X! 				/* if keyboard input buffer is too big, flush some of it */
	X! 			ioctl(0,TCFLSH,0);
	X  
	X  		if ((cc = getchar()) == 4) return(lastok = -1);
	X  
	X***************
	X*** 64,70
	X  			}
	X  		while (ic>flushno);
	X  
	X! 		if (read(0,&cc,1) != 1) return(lastok = -1);
	X  
	X  		if (cc == 'Y'-64)	/* control Y -- shell escape */
	X  			{
	X
	X--- 60,66 -----
	X  				/* if keyboard input buffer is too big, flush some of it */
	X  			ioctl(0,TCFLSH,0);
	X  
	X! 		if ((cc = getchar()) == 4) return(lastok = -1);
	X  
	X  		if (cc == 'Y'-64)	/* control Y -- shell escape */
	X  			{
	X***************
	X*** 94,107
	X   */
	X  flushall()
	X  	{
	X! 	char cc;
	X! 	int ic;
	X! 	for (;;)		/* if keyboard input buffer is too big, flush some of it */
	X! 		{
	X! 		ioctl(0,FIONREAD,&ic);
	X! 		if (ic<=0) return;
	X! 		while (ic>0)   { read(0,&cc,1); --ic; } /* gobble up the byte */
	X! 		}
	X  	}
	X  
	X  /*
	X
	X--- 90,96 -----
	X   */
	X  flushall()
	X  	{
	X! 		ioctl(0,TCFLSH,0);
	X  	}
	X  
	X  /*
	X***************
	X*** 217,220
	X  	  }
	X  	if (flag)  strcpy(logname,loginname);
	X  	}
	X  
	X
	X--- 206,210 -----
	X  	  }
	X  	if (flag)  strcpy(logname,loginname);
	X  	}
	X+ 
	X  
SHAR_EOF
if test 1452 -ne "`wc -c < 'tok.diff'`"
then
	echo shar: error transmitting "'tok.diff'" '(should have been 1452 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0

-- 
	Peter Kerrigan -- peter@icom.uccp, ..!ihnp4!icom!peter
	ICOM Systems, Inc.
	3415 N. Kennicott ave., Arlington Hts, IL, USA 60004