[comp.sources.games] v12i065: larn2 - dungeon type adventure game

billr@saab.CNA.TEK.COM (Bill Randle) (04/24/91)

Submitted-by: routley@tle.ENET.DEC.COM (Kevin Routley)
Posting-number: Volume 12, Issue 65
Archive-name: larn2/Part12
Supersedes: larn: Volume 11, Issue 84-94
Environment: Unix, VMS, MS-DOS, OS/2, termcap



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 12 (of 12)."
# Contents:  config.c descrip.mms fgetlr.c header.h help.c larn.ftn
#   larn.opt larndefs.h makefile.os2 nansisys.uue nap.c objects.h
#   player.h savelev.c termcap.vms
# Wrapped by billr@saab on Tue Apr 23 13:50:39 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'config.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.c'\"
else
echo shar: Extracting \"'config.c'\" \(2916 characters\)
sed "s/^X//" >'config.c' <<'END_OF_FILE'
X/*
X *  config.c    --  This defines the installation dependent variables.
X *                  Some strings are modified later.  ANSI C would
X *                  allow compile time string concatenation, we must
X *                  do runtime concatenation, in main.
X */
X#include "header.h"
X#include "larndefs.h"
X
X#ifndef LARNHOME
X#define LARNHOME "/usr/games/larn/"     /* normally supplied by a Makefile */
X#endif
X
X#ifndef WIZID
X#define WIZID   0
X#endif
X
X/*
X *  All these strings will be appended to in main() to be complete filenames
X */
X
X# ifndef MSDOS
X        /* the game save filename   */
Xchar savefilename[SAVEFILENAMESIZE] =   LARNHOME;
X
X        /* the score file           */
Xchar scorefile[sizeof(LARNHOME)+sizeof(SCORENAME)] =    LARNHOME;
X
X        /* the logging file         */
Xchar logfile[sizeof(LARNHOME)+sizeof(LOGFNAME)]  =      LARNHOME;
X
X        /* the help text file       */
Xchar helpfile[sizeof(LARNHOME)+sizeof(HELPNAME)] =      LARNHOME;
X
X        /* the maze data file       */
Xchar larnlevels[sizeof(LARNHOME)+sizeof(LEVELSNAME)] =  LARNHOME;
X
X        /* the fortune data file    */
Xchar fortfile[sizeof(LARNHOME)+sizeof(FORTSNAME)] =     LARNHOME;
X
X        /* the .larnopts filename */
Xchar optsfile[128];             /* the option file          */
X
X        /* the player id datafile name */
Xchar playerids[sizeof(LARNHOME)+sizeof(PLAYERIDS)] =    LARNHOME;
X
X# ifdef TIMECHECK
X        /* the holiday datafile */
Xchar holifile[sizeof(LARNHOME)+sizeof(HOLIFILE)] =      LARNHOME;
X# endif
X
Xchar ckpfile[sizeof(LARNHOME)+sizeof(CKPFILE)] = LARNHOME;
X
X# ifdef EXTRA
Xchar diagfile[] ="Diagfile";        /* the diagnostic filename  */
X# endif
X
X# else /* ndef MSDOS */
X
X/* For MSDOS, use fixed length files because of a bug in sizeof.
X */
X#   ifdef MSDOS
X/* Make LARNHOME readable from the larnopt file into a lardir variable.
X */
Xchar savefilename[PATHLEN];
Xchar scorefile[PATHLEN];
Xchar logfile[PATHLEN];
Xchar helpfile[PATHLEN];
Xchar larnlevels[PATHLEN];
Xchar fortfile[PATHLEN];
Xchar optsfile[PATHLEN];
Xchar playerids[PATHLEN];
Xchar ckpfile[PATHLEN];
Xchar swapfile[PATHLEN];
Xchar larndir[DIRLEN]        = LARNHOME;
X#   else
Xchar savefilename[PATHLEN]  = LARNHOME;
Xchar scorefile[PATHLEN]     = LARNHOME;
Xchar logfile[PATHLEN]       = LARNHOME;
Xchar helpfile[PATHLEN]      = LARNHOME;
Xchar larnlevels[PATHLEN]    = LARNHOME;
Xchar fortfile[PATHLEN]      = LARNHOME;
Xchar optsfile[PATHLEN]      = LARNHOME;
Xchar playerids[PATHLEN]     = LARNHOME;
Xchar swapfile[PATHLEN]      = LARNHOME;
Xchar ckpfile[PATHLEN]       = LARNHOME;
X#   endif
X# endif /* ndef MSDOS */
X
Xchar *password ="pvnert(x)";    /* the wizards password <=32*/
X#ifndef MSDOS
X#if WIZID == -1
Xint wisid=0;            /* the user id of the only person who can be wizard */
X#else
Xint wisid=WIZID;        /* the user id of the only person who can be wizard */
X#endif
Xchar psname[PSNAMESIZE]="larn"; /* the process name     */
X#endif MSDOS
END_OF_FILE
if test 2916 -ne `wc -c <'config.c'`; then
    echo shar: \"'config.c'\" unpacked with wrong size!
fi
# end of 'config.c'
fi
if test -f 'descrip.mms' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'descrip.mms'\"
else
echo shar: Extracting \"'descrip.mms'\" \(1809 characters\)
sed "s/^X//" >'descrip.mms' <<'END_OF_FILE'
XSOURCES = 	BILL.C, CONFIG.C, CREATE.C, DATA.C, DIAG.C, DISPLAY.C, -
X		FORTUNE.C, GLOBAL.C, HELP.C, IO.C, MAIN.C, MONSTER.C, -
X		MOREOBJ.C, MOVEM.C, NAP.C, OBJECT.C, REGEN.C, SAVELEV.C, -
X		SCORES.C, SIGNAL.C, STORE.C, TOK.C, VMS.C, -
X		ACTION.C, FGETLR.C, TGETENT.C, TGETSTR.C, TGOTO.C, TPUTS.C, -
X		SPELLS.C, SPHERES.C, IVENTORY.C
X
XOBJECTS =	BILL.OBJ, CONFIG.OBJ, CREATE.OBJ, DATA.OBJ, DIAG.OBJ, -
X		DISPLAY.OBJ, FORTUNE.OBJ, GLOBAL.OBJ, HELP.OBJ, IO.OBJ, -
X		MAIN.OBJ, MONSTER.OBJ, MOREOBJ.OBJ, MOVEM.OBJ, NAP.OBJ, -
X		OBJECT.OBJ, REGEN.OBJ, SAVELEV.OBJ, SCORES.OBJ, SIGNAL.OBJ, -
X		STORE.OBJ, TOK.OBJ, VMS.OBJ, -
X		ACTION.OBJ, FGETLR.OBJ, TGETENT.OBJ, TGETSTR.OBJ, TGOTO.OBJ, -
X		TPUTS.OBJ, SPELLS.OBJ, SPHERES.OBJ, IVENTORY.OBJ
X
XDOBJECTS =	BILL.DBJ, CONFIG.DBJ, CREATE.DBJ, DATA.DBJ, DIAG.DBJ, -
X		DISPLAY.DBJ, FORTUNE.DBJ, GLOBAL.DBJ, HELP.DBJ, IO.DBJ, -
X		MAIN.DBJ, MONSTER.DBJ, MOREOBJ.DBJ, MOVEM.DBJ, NAP.DBJ, -
X		OBJECT.DBJ, REGEN.DBJ, SAVELEV.DBJ, SCORES.DBJ, SIGNAL.DBJ, -
X		STORE.DBJ, TOK.DBJ, VMS.DBJ, -
X		ACTION.DBJ, FGETLR.DBJ, TGETENT.DBJ, TGETSTR.DBJ, TGOTO.DBJ, -
X		TPUTS.DBJ, SPELLS.DBJ, SPHERES.DBJ, IVENTORY.DBJ
X
XCDEFS =	/DEFINE=(LARNHOME="""larndir:""")
X
X.SUFFIXES
X.SUFFIXES .OBJ .DBJ .C
X
XLARN.EXE : $(OBJECTS) vaxcrtl.opt
X	LINK /NODEBUG/EXEC=LARN.EXE $(OBJECTS), vaxcrtl.opt/options
X
XLARND.EXE : $(DOBJECTS)
X	LINK/MAP/DEBUG/EXE=LARND.EXE $(DOBJECTS), sys$library:vaxcrtl.olb/libr
X
XLARNPCA.EXE : $(DOBJECTS)
X        LINK /DEBUG=SYS$LIBRARY:PCA$OBJ.OBJ/EXEC=LARNPCA.EXE $(DOBJECTS),-
X             SYS$LIBRARY:VAXCRTL.OLB/LIBR
X
X$(OBJECTS),$(DOBJECTS) : HEADER.H LARNDEFS.H MONSTERS.H PLAYER.H OBJECTS.H
X
X.C.OBJ
X	CC $(CDEFS) /NODEB/OPTIM/OBJ=$*.OBJ $*.C
X
X.C.DBJ
X	CC $(CDEFS) /DEBUG/NOOPT/OBJ=$*.DBJ $*.C
X
Xvaxcrtl.opt :
X	open/write f vaxcrtl.opt
X	write f "sys$share:vaxcrtl/share"
X	close f
X
END_OF_FILE
if test 1809 -ne `wc -c <'descrip.mms'`; then
    echo shar: \"'descrip.mms'\" unpacked with wrong size!
fi
# end of 'descrip.mms'
fi
if test -f 'fgetlr.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fgetlr.c'\"
else
echo shar: Extracting \"'fgetlr.c'\" \(2942 characters\)
sed "s/^X//" >'fgetlr.c' <<'END_OF_FILE'
X/************************************************************************
X *                                  *
X *          Copyright (c) 1982, Fred Fish           *
X *              All Rights Reserved             *
X *                                  *
X *  This software and/or documentation is released for public   *
X *  distribution for personal, non-commercial use only.     *
X *  Limited rights to use, modify, and redistribute are hereby  *
X *  granted for non-commercial purposes, provided that all      *
X *  copyright notices remain intact and all changes are clearly *
X *  documented.  The author makes no warranty of any kind with  *
X *  respect to this product and explicitly disclaims any implied    *
X *  warranties of merchantability or fitness for any particular *
X *  purpose.                            *
X *                                  *
X ************************************************************************
X */
X
X
X/*
X *  LIBRARY FUNCTION
X *
X *  fgetlr    get logical record from a file
X *
X *  KEY WORDS
X *
X *  fgetlr
X *  string functions
X *
X *  SYNOPSIS
X *
X *  char *fgetlr(bp,bpsize,fp)
X *  char *bp;
X *  int bpsize;
X *  FILE *fp;
X *
X *  DESCRIPTION
X *
X *  Reads the next logical record from stream "fp" into buffer "bp"
X *  until next unescaped newline, "bpsize" minus one characters
X *  have been read, end of file, or read error.
X *  The last character read is followed by a NULL.
X *
X *  A logical record may span several physical records by having
X *  each newline escaped with the standard C escape character
X *  (backslash).
X *
X *  This is particularly useful for things like the termcap
X *  file, where a single entry is too long for one physical
X *  line, yet needs to be treated as a single record.
X *
X *  Returns its first argument unless an end of file or read
X *  error occurs prior to any characters being read.
X *
X *  BUGS
X *
X *  The only way to know if read was terminated due to buffer size
X *  limitation is to test for a newline before the terminating
X *  null.
X *
X */
X
X#include <stdio.h>
X
X/*
X *  PSEUDO CODE
X *
X *  Begin fgetlr
X *      If read fails then
X *      Return NULL.
X *      Else
X *      Find out how many characters were read.
X *      Initialize pointer to terminating null.
X *      If last char read was newline then
X *          If newline was escaped then
X *          Replace backslash with the newline.
X *          Replace newline with null.
X *          Read and append more.
X *          End if
X *      End if
X *      Return buffer pointer.
X *      End if
X *  End fgetlr
X *
X */
X
Xchar *fgetlr(bp,bpsize,fp)
Xchar *bp;
Xint bpsize;
XFILE *fp;
X{
X    int numch;
X    char *cp;
X
X    if (fgets(bp,bpsize,fp) == NULL) {
X    return(NULL);
X    } else {
X    numch = strlen(bp);
X    cp = &bp[numch];
X    if (*--cp == '\n') {
X        if (numch > 1 && *--cp == '\\') {
X        *cp++ = '\n';
X        *cp = (char) NULL;
X        fgetlr(cp,bpsize-numch+1,fp);
X        }
X    }
X    return(bp);
X    }
X}
END_OF_FILE
if test 2942 -ne `wc -c <'fgetlr.c'`; then
    echo shar: \"'fgetlr.c'\" unpacked with wrong size!
fi
# end of 'fgetlr.c'
fi
if test -f 'header.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'header.h'\"
else
echo shar: Extracting \"'header.h'\" \(3559 characters\)
sed "s/^X//" >'header.h' <<'END_OF_FILE'
X/*  header.h        Larn is copyrighted 1986 by Noah Morgan. */
X
X#ifdef MSDOS
X#   define LARNHOME ""
X#endif
X
X#ifndef WIZID
X#   define WIZID  1000
X#endif
X
X#define TRUE 1
X#define FALSE 0
X
X#ifdef VMS
X#define unlink(x)   delete(x)    /* remove a file */
X#endif
X
X#define SCORENAME   "larn.scr"
X#define LOGFNAME    "larn.log"
X#define HELPNAME    "larn.hlp"
X#define LEVELSNAME  "larn.maz"
X#define FORTSNAME   "larn.ftn"
X#define PLAYERIDS   "larn.pid"
X#define HOLIFILE    "holidays"
X#ifdef MSDOS
X#   define LARNOPTS "larn.opt"
X#   define SAVEFILE "larn.sav"
X#   define SWAPFILE "larn.swp"
X#   define CKPFILE  "larn.ckp"
X#else
X# ifdef VMS
X#   define LARNOPTS "larn.opt"
X#   define SAVEFILE "larn.sav"
X#   define CKPFILE  "larn.ckp"
X# else
X#   define LARNOPTS ".larnopts"
X#   define SAVEFILE "Larn.sav"
X#   define CKPFILE  "Larn.ckp"
X#   define MAIL     /* disable the mail routines for MSDOS */
X# endif VMS
X#endif MSDOS
X
X#define MAXLEVEL 11    /*  max # levels in the dungeon         */
X#define MAXVLEVEL 3    /*  max # of levels in the temple of the luran  */
X#define MAXX 67
X#define MAXY 17
X
X#define SCORESIZE 10    /* this is the number of people on a scoreboard max */
X#define MAXPLEVEL 100   /* maximum player level allowed        */
X#define SPNUM 38        /* maximum number of spells in existance   */
X#define TIMELIMIT 30000 /* maximum number of moves before the game is called */
X#define TAXRATE 1/20    /* tax rate for the LRS */
X
X
X/*  this is the structure that holds the entire dungeon specifications  */
Xstruct cel
X    {
X    short   hitp;   /*  monster's hit points    */
X    char    mitem;  /*  the monster ID          */
X    char    item;   /*  the object's ID         */
X    short   iarg;   /*  the object's argument   */
X    char    know;   /*  have we been here before*/
X    };
X
X/* this is the structure for maintaining & moving the spheres of annihilation */
Xstruct sphere
X    {
X    struct sphere *p;   /* pointer to next structure */
X    char x,y,lev;       /* location of the sphere */
X    char dir;           /* direction sphere is going in */
X    char lifetime;      /* duration of the sphere */
X    };
X
X# ifdef MSDOS
X/* Since only 1 level is needed at one time, each level can be swapped
X * to disk if there is not enough memory to allocate it.  Thus, there
X * need only be room for 1 level.  When a level is needed, if it is
X * already in memory, there is nothing to do.  If it isn't, get it from
X * disk after swapping out the oldest level - dgk.
X */
X# define FREEBLOCK  -99
Xtypedef struct _ramblock RAMBLOCK;
Xtypedef struct _diskblock DISKBLOCK;
Xstruct _ramblock {
X    RAMBLOCK    *next;          /* For a linked list */
X    int     level;          /* Level stored or FREEBLOCK */
X    long        gtime;          /* The time stored */
X    struct  cel cell[MAXX * MAXY];  /* The storage */
X};
Xstruct _diskblock {
X    DISKBLOCK   *next;          /* For linked list */
X    int     level;          /* Level stored or FREEBLOCK */
X    long        gtime;          /* The time stored */
X    long        fpos;           /* The disk position */
X};
Xextern RAMBLOCK *ramblks;
Xextern DISKBLOCK *diskblks;
X
X# endif MSDOS
X
X# ifdef MSDOS
X#  define NULL 0L       /* For large model only */
X# else
X#  define NULL 0
X# endif MSDOS
X#define BUFBIG  4096            /* size of the output buffer */
X#define MAXIBUF 4096            /* size of the input buffer */
X#define LOGNAMESIZE 40          /* max size of the players name */
X#define PSNAMESIZE 40           /* max size of the process name */
X#define SAVEFILENAMESIZE 128    /* max size of the savefile path */
END_OF_FILE
if test 3559 -ne `wc -c <'header.h'`; then
    echo shar: \"'header.h'\" unpacked with wrong size!
fi
# end of 'header.h'
fi
if test -f 'help.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'help.c'\"
else
echo shar: Extracting \"'help.c'\" \(2982 characters\)
sed "s/^X//" >'help.c' <<'END_OF_FILE'
X/* help.c */
X#include "header.h"
X#include "larndefs.h"
X
X/*
X *  help function to display the help info
X *
X *  format of the .larn.help file
X *
X *  1st character of file:  # of pages of help available (ascii digit)
X *  page (23 lines) for the introductory message (not counted in above)
X *  pages of help text (23 lines per page)
X */
Xextern char helpfile[];
Xhelp()
X    {
X    register int i,j,maxj;
X#ifndef VT100
X#ifndef MSDOS
X    char tmbuf[128];    /* intermediate translation buffer when not a VT100 */
X#endif
X#endif
X
X    /* open the help file and get # pages 
X    */
X    if ((j=openhelp()) < 0)  
X    return;
X
X    /* skip over intro message 
X    */
X    for (i=0; i<23; i++) 
X    lgetl();
X
X    /* if command mode, skip over the second page (prompt mode help)
X    */
X    if (!prompt_mode)
X    {
X    for (i=0; i<23; i++)
X        lgetl();
X    j--;
X    }
X
X    for (maxj = j;  j>0; j--)
X    {
X    clear();
X    for (i=0; i<23; i++)
X#if (defined(VT100) || defined(MSDOS))
X        lprcat(lgetl());    /* print out each line that we read in */
X#else
X        { 
X        tmcapcnv(tmbuf,lgetl());  
X        lprcat(tmbuf); 
X        } /* intercept \33's */
X#endif
X    if (j>1)
X        {
X        lprcat("    ---- Press ");  standout("return");
X        lprcat(" to exit, ");       standout("space");
X        lprcat(" for more help ---- ");
X        i=0; while ((i!=' ') && (i!='\n') && (i!='\33')) i=ttgetch();
X        if ((i=='\n') || (i=='\33'))
X        {
X        lrclose();  
X        setscroll();  
X        drawscreen();  
X        return;
X        }
X        }
X
X    /* For prompt mode, skip over the third page (command mode help)
X       This could be done more efficiently, but its not worth the trouble.
X    */
X    if ((prompt_mode) && (j==maxj))
X        {
X        for (i=0; i<23; i++)
X        lgetl();
X        j--;
X        }
X
X    }
X    lrclose();  
X    retcont();  
X    drawscreen();
X    }
X
X/*
X *  function to display the welcome message and background
X */
Xwelcome()
X    {
X    register int i;
X#ifndef VT100
X    char tmbuf[128];    /* intermediate translation buffer when not a VT100 */
X#endif
X    if (openhelp() < 0)  return;    /* open the help file */
X    clear();
X    for(i=0; i<23; i++)
X#ifdef VT100
X            lprcat(lgetl());    /* print out each line that we read in */
X#else
X            { tmcapcnv(tmbuf,lgetl());  lprcat(tmbuf); } /* intercept \33's */
X#endif
X    lrclose();  retcont();  /* press return to continue */
X    }
X
X/*
X *  function to say press return to continue and reset scroll when done
X */
Xretcont()
X    {
X    cursor(1,24); lprcat("Press "); standout("return");
X    lprcat(" to continue: ");   while (ttgetch() != '\n');
X    setscroll();
X    }
X
X/*
X *  routine to open the help file and return the first character - '0'
X */
Xstatic openhelp()
X    {
X    if (lopen(helpfile)<0)
X        {
X        lprintf("Can't open help file \"%s\" ",helpfile);
X        lflush(); sleep(4); drawscreen();   setscroll(); return(-1);
X        }
X    resetscroll();  return(lgetc() - '0');
X    }
END_OF_FILE
if test 2982 -ne `wc -c <'help.c'`; then
    echo shar: \"'help.c'\" unpacked with wrong size!
fi
# end of 'help.c'
fi
if test -f 'larn.ftn' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'larn.ftn'\"
else
echo shar: Extracting \"'larn.ftn'\" \(1382 characters\)
sed "s/^X//" >'larn.ftn' <<'END_OF_FILE'
Xgem value = gem * 2 ^ perfection
Xsitting down can have unexpected results
Xdon't pry into the affairs of others
Xdrinking can be hazardous to your health
Xbeware of the gusher!
Xsome monsters are greedy
Xnymphs have light fingers
Xtry kissing a disenchantress!
Xthe Eye of Larn improves with time
Xhammers and brains don't mix
Xwhat does a potion of cure dianthroritis taste like?
Xhit point gain/loss when raising a level depends on constitution
Xhealing a mighty wizard can be exhilarating
Xbe sure to pay your taxes
Xare Vampires afraid of something?
Xsome dragons can fly
Xdos thou strive for perfection?
Xpatience is a virtue, unless your daughter dies
Xwhat does the Eye of Larn see in its guardian?
Xa level 25 player casts like crazy!
Xenergy rings affect spell regeneration
Xmy, aren't you clever!
Xdifficulty affects regeneration
Xcontrol of the pesty spirits is most helpful
Xdon't fall into a bottomless pit
Xdexterity allows you to carry more
Xyou can get 2 points of WC for the price of one
Xnever enter the dungeon naked!  the monsters will laugh at you!
Xdid someone put itching powder in your armor?
Xyou klutz!
Xavoid opening doors.  you never know whats on the other side.
Xinfinite regeneration ---> temptation
Xthe greatest weapon in the game has not the highest Weapon Class
Xyou can't buy the most powerful scroll
Xidentify things before you use them
Xthere's more than one way through a wall
END_OF_FILE
if test 1382 -ne `wc -c <'larn.ftn'`; then
    echo shar: \"'larn.ftn'\" unpacked with wrong size!
fi
# end of 'larn.ftn'
fi
if test -f 'larn.opt' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'larn.opt'\"
else
echo shar: Extracting \"'larn.opt'\" \(1467 characters\)
sed "s/^X//" >'larn.opt' <<'END_OF_FILE'
X#
X# This is a sample LARN.OPT (.larnopts on Unix) options file.  It shows
X# all the possible options and provides examples.  For information about each
X# option, see the LARN.DOC file.  You can edit this sample file to produce a
X# real options file.
X#
X# The '#' character is a comment character; any line in the options file that
X# begins with this character will be ignored when the options file is read.
X#
X# Note that case-sensitivity is important when specifying options.
X#
X# The following options are allowed on MS-DOS and OS/2 only:
X#
X# cursor: 1 9
X# DECRainbow
X# graphics: 176 46
X# keypad
X# larndir: c:\games\larn
X# ramlevels
X# rawio
X# swapfile: c:\games\larn\larn.swp
X#
X# The following options can be used on all systems:
X#
X# auto-pickup
X# bold-objects
X# enable-checkpointing
X# highlight-objects
X# inverse-objects
X#                         You can rename monsters.  The first letter indicates
X#                         which monster changes.  The two examples have changed
X#                         the name of the Ant and Centaur, respectively.
X# monster: Aardvark
X# monster: "Charlie Chan"
X#                         You can specify your character's name.
X# name: Shogun
X#                         Note that names with spaces must be quoted
X# name: "Mr. Wizard"
X# original-objects
X# no-beep
X# no-introduction
X# prompt-on-objects
X# savefile: c:\games\larn\mygame.sav
X#
X# The following options are not allowed on MS-DOS or OS/2:
X#
X# play-day-play
X# process-name
END_OF_FILE
if test 1467 -ne `wc -c <'larn.opt'`; then
    echo shar: \"'larn.opt'\" unpacked with wrong size!
fi
# end of 'larn.opt'
fi
if test -f 'larndefs.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'larndefs.h'\"
else
echo shar: Extracting \"'larndefs.h'\" \(5196 characters\)
sed "s/^X//" >'larndefs.h' <<'END_OF_FILE'
X/*
X  Function, data declarations
X*/
Xextern char regen_bottom;
Xextern char floorc, wallc;
Xextern char boldobjects;
Xextern char auto_pickup;
Xextern char VERSION,SUBVERSION;
Xextern char aborted[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
Xextern char *class[],course[],diagfile[],fortfile[],helpfile[],holifile[];
Xextern char ckpfile[];
X# ifdef MSDOS
Xextern int  swapfd;
Xextern char swapfile[];
Xextern long tell(), lseek();
X# endif
Xextern char *inbuffer;
Xextern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
Xextern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
Xextern char *lpnt,mitem[MAXX][MAXY],monstlevel[];
Xextern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
Xextern char nplt[],nsw[],*objectname[];
Xextern char hacklike_objnamelist[];
Xextern char original_objnamelist[];
Xextern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[];
Xextern char predostuff,psname[],restorflag,savefilename[],scorefile[],scprob[];
Xextern char screen[MAXX][MAXY],*scrollname[],sex,*spelcode[],*speldescript[];
Xextern char spelknow[],*spelname[],*spelmes[];
Xextern char splev[],stealth[MAXX][MAXY],wizard;
Xextern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY];
Xextern short iarg[MAXX][MAXY],ivenarg[],lasthx,lasthy,lastnum,lastpx,lastpy;
Xextern short nobeep,oldx,oldy,playerx,playery;
Xextern int dayplay,enable_scroll,yrepcount,userid,wisid,lfd,fd;
Xextern long initialtime,outstanding_taxes,skill[],gtime,c[],cbak[];
Xextern unsigned long lrandx;
X# ifndef MSDOS      /* Different storage under MSDOS */
Xextern struct cel *cell;
X# endif
Xextern struct sphere *spheres;
X
Xvoid *malloc();
Xchar *fortune(),*getenv(),*getlogin(),*lgetw(),*lgetl(),*ctime();
Xchar *tmcapcnv(),*tgetstr(),*tgoto();
Xlong paytaxes(),lgetc(),lrint(),time();
Xunsigned long readnum();
X
X    /* macro to create scroll #'s with probability of occurrence */
X#define newscroll() (scprob[rund(81)])
X    /* macro to return a potion # created with probability of occurrence */
X#define newpotion() (potprob[rund(41)])
X    /* macro to return the + points on created leather armor */
X#define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
X    /* macro to return the + points on chain armor */
X#define newchain() (nch[rund(10)])
X    /* macro to return + points on plate armor */
X#define newplate() (nplt[rund(c[HARDGAME]?4:12)])
X    /* macro to return + points on new daggers */
X#define newdagger() (ndgg[rund(13)])
X    /* macro to return + points on new swords */
X#define newsword() (nsw[rund(c[HARDGAME]?6:13)])
X    /* macro to destroy object at present location */
X#define forget() (item[playerx][playery]=know[playerx][playery]=0)
X    /* macro to wipe out a monster at a location */
X#define disappear(x,y) (mitem[x][y]=know[x][y]=0)
X
X#ifdef VT100
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() (lprcat("\33[20;24r"))
X    /* macro to clear the scrolling region for the terminal */
X#define resetscroll() (lprcat("\33[;24r"))
X    /* macro to clear the screen and home the cursor */
X#define clear() (lprcat("\33[2J\33[f"), regen_bottom=TRUE)
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#define BOLD     3
X#define END_BOLD 4
X#define CLEAR    5
X#define CL_LINE  6
X#define T_INIT   7
X#define T_END    8
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#define setscroll() enable_scroll=1
X    /* macro to clear the scrolling region for the terminal */
X#define resetscroll() enable_scroll=0
X    /* macro to clear the screen and home the cursor */
X#define clear() (*lpnt++ =CLEAR, regen_bottom=TRUE)
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    /* macro to seed the random number generator */
X#define srand(x) (lrandx=x)
X#ifdef MACRORND
X    /* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
X#define rnd(x)  ((((lrandx=lrandx*1103515245+12345)>>7)%(x))+1)
X#define rund(x) ((((lrandx=lrandx*1103515245+12345)>>7)%(x))  )
X#endif /* MACRORND */
X
X#define KNOWNOT   0x00
X#define HAVESEEN  0x1
X#define KNOWHERE  0x2
X#define KNOWALL   (HAVESEEN | KNOWHERE)
X#ifdef MSDOS
X# ifdef OS2LARN
X#  define PATHLEN   256
X#  define DIRLEN    256
X#  define INCL_BASE
X#  include <os2.h>
X#  define sleep(x)	DosSleep(x*1000L);
X# else
X#  define PATHLEN   80
X#  define DIRLEN    64
X# endif
X  extern   char    larndir[];
X  extern int       raw_io, DECRainbow, keypad, ramlevels, cursorset;
X  extern unsigned char cursorstart, cursorend;
X#endif MSDOS
X
Xextern char prompt_mode ;
END_OF_FILE
if test 5196 -ne `wc -c <'larndefs.h'`; then
    echo shar: \"'larndefs.h'\" unpacked with wrong size!
fi
# end of 'larndefs.h'
fi
if test -f 'makefile.os2' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makefile.os2'\"
else
echo shar: Extracting \"'makefile.os2'\" \(2576 characters\)
sed "s/^X//" >'makefile.os2' <<'END_OF_FILE'
X#
X# This is a makefile for OS/2 LARN V12.3
X#
X# This is written for MSC V6.00; it assumes NMAKE.
X#
X# This could probably build a DOS larn also, if the definition
X# of OS2LARN was removed from the cc command.
X#
X#
XOBJ = obj\ 
XCDEFS = -DOS2LARN -DDGK -DMSDOS -DSYSV -DDGK_MSDOS -DNOVARARGS
Xcc    = cl $(CDEFS) -nologo -Zi -c -AL -Fo$(OBJ)
X
XOBJS =    $(OBJ)action.obj    $(OBJ)bill.obj      \
X  $(OBJ)config.obj    $(OBJ)create.obj    \
X  $(OBJ)data.obj      $(OBJ)diag.obj      \
X  $(OBJ)display.obj   $(OBJ)fgetlr.obj    \
X  $(OBJ)fortune.obj   $(OBJ)global.obj    \
X  $(OBJ)help.obj      $(OBJ)io.obj        \
X  $(OBJ)main.obj      $(OBJ)monster.obj   \
X  $(OBJ)moreobj.obj   $(OBJ)movem.obj     \
X  $(OBJ)msdos.obj     $(OBJ)nap.obj       \
X  $(OBJ)object.obj    $(OBJ)regen.obj     \
X  $(OBJ)savelev.obj   $(OBJ)scores.obj    \
X  $(OBJ)signal.obj    $(OBJ)spells.obj    \
X  $(OBJ)spheres.obj   $(OBJ)store.obj     \
X  $(OBJ)tgetent.obj   $(OBJ)tgetstr.obj   \
X  $(OBJ)tgoto.obj     $(OBJ)tputs.obj     \
X  $(OBJ)tok.obj       $(OBJ)vms.obj	  \
X  $(OBJ)iventory.obj
X
Xlarn.exe : $(OBJS)
X  link /CODEVIEW @os2larn.lnk
X
X$(OBJ)action.obj : action.c
X  $(cc) action.c
X
X$(OBJ)bill.obj : bill.c
X  $(cc) bill.c
X
X$(OBJ)config.obj : config.c
X  $(cc) config.c
X
X$(OBJ)create.obj : create.c
X  $(cc) create.c
X
X$(OBJ)data.obj : data.c
X  $(cc) data.c
X
X$(OBJ)diag.obj : diag.c
X  $(cc) diag.c
X
X$(OBJ)display.obj : display.c
X  $(cc) display.c
X
X$(OBJ)fgetlr.obj : fgetlr.c
X  $(cc) fgetlr.c
X
X$(OBJ)fortune.obj : fortune.c
X  $(cc) fortune.c
X
X$(OBJ)global.obj : global.c
X  $(cc) global.c
X
X$(OBJ)help.obj : help.c
X  $(cc) help.c
X
X$(OBJ)io.obj : io.c
X  $(cc) io.c
X
X$(OBJ)iventory.obj : iventory.c
X  $(cc) iventory.c
X
X$(OBJ)main.obj : main.c
X  $(cc) main.c
X
X$(OBJ)monster.obj : monster.c
X  $(cc) monster.c
X
X$(OBJ)moreobj.obj : moreobj.c
X  $(cc) moreobj.c
X
X$(OBJ)movem.obj : movem.c
X  $(cc) movem.c
X
X$(OBJ)msdos.obj : msdos.c
X  $(cc) msdos.c
X
X$(OBJ)nap.obj : nap.c
X  $(cc) nap.c
X
X$(OBJ)object.obj : object.c
X  $(cc) object.c
X
X$(OBJ)regen.obj : regen.c
X  $(cc) regen.c
X
X$(OBJ)savelev.obj : savelev.c
X  $(cc) savelev.c
X
X$(OBJ)scores.obj : scores.c
X  $(cc) scores.c
X
X$(OBJ)signal.obj : signal.c
X  $(cc) signal.c
X
X$(OBJ)spells.obj : spells.c
X  $(cc) spells.c
X
X$(OBJ)spheres.obj : spheres.c
X  $(cc) spheres.c
X
X$(OBJ)store.obj : store.c
X  $(cc) store.c
X
X$(OBJ)tgetent.obj : tgetent.c
X  $(cc) tgetent.c
X
X$(OBJ)tgetstr.obj : tgetstr.c
X  $(cc) tgetstr.c
X
X$(OBJ)tgoto.obj : tgoto.c
X  $(cc) tgoto.c
X
X$(OBJ)tputs.obj : tputs.c
X  $(cc) tputs.c
X
X$(OBJ)tok.obj : tok.c
X  $(cc) tok.c
X
X$(OBJ)vms.obj : vms.c
X  $(cc) vms.c
END_OF_FILE
if test 2576 -ne `wc -c <'makefile.os2'`; then
    echo shar: \"'makefile.os2'\" unpacked with wrong size!
fi
# end of 'makefile.os2'
fi
if test -f 'nansisys.uue' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nansisys.uue'\"
else
echo shar: Extracting \"'nansisys.uue'\" \(3474 characters\)
sed "s/^X//" >'nansisys.uue' <<'END_OF_FILE'
Xbegin 666 nansi.sys
XM_____Q. RP#6 $-/3B @(" @&ULR2DYA;G-I+G-Y<R!V,BXR.B!.97<@04Y3
XM22!D<FEV97(@*$,I($1A;FEE;"!+96=E;"P@4&%S861E;F$L($-!(#$Y.#8-
XM"AH      0   QA/       '               #            6QL  '@ 
XM        =P      H64 B]BT )**Q[0 *]!"BL/^P/8F9P "QX#4  / E\-P
XM"2,!(P$? 28!-0%) 50!F &8 2,!(P$NB1Y< "Z,!EX R_M04U%25597'@8N
XMQ1Y< (I' L1W#HM/$CP,=R"3T>.,R([8_Y>S "[%'EP #0 !B4<#!Q]?7EU:
XM65M8R^@* .OF+L<&BP ! ,^X$PC#,\##XPJ+_E'HXP)9JN+X,\##Z",#= O%
XM'EP B$<-,\#K [@  L/H#P.X  )T C/ PS/ HX, HX< HXL HX\ N$  CL F
XMH1H )J,< #/ PP#['@904U%25597N0$ C,N.PX[;OG(!B 3H"@!?7EU:65M8
XM!Q_/C 9O +A  ([8H4D +J)C /[,+H@F90"@8@"8 \"3BX=0 "ZC9@"A8P N
XMHW, H4X T>C1Z-'HT>B Q+ N@#YC  =T X#$" X?HVT CL#HJ_[H% %R ^B?
XM 8L>=0"*)FL CAYO /SC(RZ#/F$  '50Z/4 <@/I# &L/!QR(B[7JTK@]70$
XMZP3@YW1HC,B.V*!E /[ *L*B9@#H+0$SP,,\&W0:/ UT+SP*=& \"70+/ AT
XM$#P'=!CIP@#K>9#II +IE (N.A9E '<#3T]"Z[CH(@(*P.NQ+J!E /[ *L*T
XM "OX*_@NBA9E $(NBB9K  P!ZY1!+O8&8  !=05/3T+KABZ*%F4 0BOZ*_HN
XMH&0 +C@&9P!R!>@% >L0+OX&9P NH&4 M !  \ #^"Z*)FL # 'I4O\NH&4 
XM_L JPE&U (K(@.$']MF P0@KT9RP(.@6 ','\ZN=6>DL_P/1Z#P 2N+ZG5GI
XM'_\N@#YC  1R"BZ /F, !W0"^,/YP^CI_W,(Z?G^K#P<<@TNU^@. $K@\W0&
XMZ?7^Z0;_Z5?_4E%34"Z@90#^P"K"+J)F "Z+%F8 ,]NT LT0N0$ 6%"*W+< 
XMM G-$%A;65K#Z)S_<RJ+W]'KBQ9S + .[NL 0HK'[NL 2K /[NL 0HK#[KA 
XM ([8+J%F *-0 ,.X%H_HGO_#M #H9/]S%RZ*)FL @.1_+H ^8P '=0> _ %U
XM K0'PU!345+HVO^*_+ !M :Q +4 +HH690 NBC9D ,T06EE;6,.+-N $"L!T
XM K0 .S;>!'8.BPP[1/YT"X/N!"OQZ^P+]NL'@^X"*_$ZP,.Y! "[?P"#PP2+
XM-POVX??#Z.W_="G_#TZ+;P(^B@*#[@%R&8'[@P!T$PK =0__#SZ*(L<&@P !
XM (@F> #K&[0 S18+P'3XZ(W_=0J)#H\ B3:1 .N[/ !TV</HH_]T"4Z+;P(^
XMB@+K&K0!S19T%PO =0:T ,T6Z_#H6_]U!0/QBD3_@,P!PQ0% P!04U%25597
XML+:Z0P#N2BZAAP3K .Z&X.L [KIA .L [% , ^L [@:X0 ".P":+'FP +@,>
XMB02Y__\FH6P .\-_ N+V!U@D_.Y?7EU:65M8PP  ,# P,# NB1YQ "ZC80#I
XM-/TNBQYQ "[_)F$ Z9D X@6X @7KX*P\6W7Q+HL>W 0NQ@< +L8&VP0 X@6X
XM'07KQ:P\/70'/#]T T[K!^(%N# %Z[*L/#!R%CPY=Q(L,"Z(!R[&!ML$ >)B
XMN*@%ZY<\(G0$/"=U="ZB:@#B!;A>!>N$K"XZ!FH =!,NB <N.Q[>!(/3 .+K
XMN%X%Z6G_+L8' .(&N(4%Z5W_K#P[= )!3N*BN# %Z4[_+L<&80   "Z*)FL 
XM+HL>=0#I:_VL/#!R&CPY=Q8L,"Z&!U*R"O;B6BX !^+GN*@%Z1O_/#MU$"X[
XM'MX$@], +L8&VP0 ZYX\0'*U/'IWL3Q:=@8\87*I+ 9641X.'RQ F / !44&
XMB\LNBS;<!"O.+O8&VP0!= %!DZ!E $ JPJ)F +0 K K =0% _Q<?65XNBB9K
XM "Z+'G4 +L<&80    O2Z>7[U H%,#"&X*J&X*K#30@ !_H&YP;M!J\&KP:O
XM!K &KP9/!T8'(P@?"*\&KP91"*\&KP:O!J\&KP:O!J\&KP:O!J\&KP:O!J\&
XMKP:O!K &KP:2"*\&KP:O!@H)' =S!Z\&J >O!J\&#0>O!A0'KP:O!J\&#@FO
XM!L,*P'0!2*)G #/ @_D"<@:L"L!T 4BB9@"A9@ Z!F4 =@:@90"B9@ Z)F0 
XM=@:@9 "B9P#HK?G#  9F .O;* 9F ',%Q@9F  #KS@ &9P#KR"@&9P!S!<8&
XM9P  Z[NA9@"C: ##H6@ HV8 ZZQ."\EU!,8$ $&L4;D6 )"[*PF#PP,Z!^#Y
XM=0N+1P$@!FL ""9K %GBX,-2BPYF (KUZQ0\ G4?QP9F    Z#?Y4C/)BC9D
XM .@P_(K\BA9E +@ !LT06L-74@:,R([ _;^  *!G /[ Z+/^L#NJH&8 _L#H
XMJ/ZP4JJP#8D^B0"JN(( *\>CAP#\!UI?PPO)=%G\3DE)K0K = )!3E<&45;]
XM'@?H%OQU%H/!!(LNW@0!#MX$3HO^ _F+SBO-\Z1>68L^W@2#[P2+WRO9@^L0
XM.Q[<!'(2B4T#B44!XP:D@\8"XOJ)/MX$!U_\PP8>!_V+/N $N $ J[@ <JNP
XM$*J)/MX$!^ODM ;K K0'BCYD "H^9P ZQW8"L !0Z%_[BOQ8L0"*+F< 4HH6
XM90"*-F0 S1!:P[4!ZP*U .BI^G,Y.L)V HK"5Y&+Z;4 B_<#\0/Q]MD"RK4 
XM_/;$ 70,A_[]B\%( \ #^ /P!A_SI8O-Z O[L"#SJ_Q?P['_/ =U!H@.8 #K
XM:SPK=4*T$KL0_\T0]\/\_G5:Z$WZ<U6T *!C ,T0N!(1LP#-$+@ $K,@S1"T
XM ;D'!\T0BQ9S + *[NL 0K '[L8&9  JZPFT ,T0Q@9D !BX0  >CMBA20 ?
XMHF, _LR()F4 QP9F    Z(KWP[$ ZX:+'G4 XP].K4EU HK@ MB UP"()\,S
XMP(@'0_[ =?GK]   !P'_" 3X 07_@ ?X< B( ![X !_X!"#X B'X!B+X 2/X
XM!23X R7X!RB/ "F/0"J/("N/8"R/$"V/4"Z/,"^/<#/ CMB[; #'!Q<!C$\"
XMNZ0 QP=S 8Q/ @X?#@?\OW )B3[<!(''  *)/MX$1[ 0JK@ <JNX 0")/N $
X9JXD^=0 SP*K^P'7[,\#%-EP B7P.C$P0PP*)
X 
Xend
END_OF_FILE
if test 3474 -ne `wc -c <'nansisys.uue'`; then
    echo shar: \"'nansisys.uue'\" unpacked with wrong size!
fi
# end of 'nansisys.uue'
fi
if test -f 'nap.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nap.c'\"
else
echo shar: Extracting \"'nap.c'\" \(3719 characters\)
sed "s/^X//" >'nap.c' <<'END_OF_FILE'
X/* nap.c */
X#ifdef VMS
X#include <signal.h>
X#include <types.h>
X#include <time.h>
X#else
X#include <signal.h>
X#include <sys/types.h>
X#ifdef SYSV
X# ifdef MSDOS
X#  ifdef    OS2LARN
X#   define   INCL_BASE
X#   include <os2.h>
X#   define sleep(x)	DosSleep(x*1000L)
X#  endif
X#   include <dos.h>
X# else
X#   include <sys/times.h>
X# endif
X#else
X#ifdef BSD
X#include <sys/timeb.h>
X#endif BSD
X#endif SYSV
X#endif
X/*
X *  routine to take a nap for n milliseconds
X */
Xnap(x)
X    register int x;
X    {
X    if (x<=0) return; /* eliminate chance for infinite loop */
X    lflush();
X    if (x > 999) sleep(x/1000); else napms(x);
X    }
X
X#ifdef NONAP
Xstatic napms(x)    /* do nothing */
X    int x;
X    {
X    }
X#else NONAP
X#ifdef SYSV
X/*  napms - sleep for time milliseconds - uses times() */
X/* this assumes that times returns a relative time in 60ths of a second */
X/* this will do horrible things if your times() returns seconds! */
X
X#ifdef MSDOS
Xunsigned long
Xstatic dosgetms()
X{
X#ifdef    OS2LARN
X  DATETIME dt;
X  DosGetDateTime(&dt);
X
X  /* return hundreths of seconds */
X  return ( 360000L * dt.hours   +
X       6000L   * dt.minutes +
X       100L    * dt.seconds + dt.hundredths );
X#else
X    union REGS regs;
X
X    regs.h.ah = 0x2C;
X    intdos(&regs, &regs);
X
X    /* return hundreths of seconds
X    */
X    return ( 360000L * regs.h.ch +
X           6000L * regs.h.cl +
X        100L * regs.h.dh + regs.h.dl );
X#endif
X}
X
Xstatic napms(time)
Xint time;
X{
X    unsigned long matchclock;
X
X    if (time <= 0)
X        time = 1;   /* eliminate chance of infinite loop */
X    matchclock = dosgetms() + (time + 5) / 10;
X    if (matchclock > 8640000L)   /* total 100ths-of-seconds in 24 hrs */
X        return;
X
X    while (matchclock > dosgetms())
X        ;
X}
X
X# else
Xstatic napms(time)
X    int time;
X    {
X    long matchclock, times();
X    struct tms stats;
X
X    if (time<=0) time=1; /* eliminate chance for infinite loop */
X    if ((matchclock = times(&stats)) == -1 || matchclock == 0)
X        return; /* error, or BSD style times() */
X    matchclock += (time / 17);      /*17 ms/tic is 1000 ms/sec / 60 tics/sec */
X
X    while(matchclock < times(&stats))
X        ;
X    }
X# endif /* MSDOS */
X
X#else not SYSV
X#ifdef BSD
X#ifdef SIGVTALRM
X/* This must be BSD 4.2!  */
X#include <sys/time.h>
X#define bit(_a) (1<<((_a)-1))
X
Xstatic void nullf()
X    {
X    }
X
X/*  napms - sleep for time milliseconds - uses setitimer() */
Xstatic napms(time)
X    int time;
X    {
X    struct itimerval    timeout;
X#ifdef SIG_RTNS_INT
X    int     (*oldhandler) ();
X#else
X    void     (*oldhandler) ();
X#endif
X    int     oldsig;
X
X    if (time <= 0) return;
X
X    timerclear(&timeout.it_interval);
X    timeout.it_value.tv_sec = time / 1000;
X    timeout.it_value.tv_usec = (time % 1000) * 1000;
X
X    oldsig = sigblock(bit(SIGALRM));
X    setitimer(ITIMER_REAL, &timeout, (struct itimerval *)0);
X    oldhandler = signal(SIGALRM, nullf);
X    sigpause(oldsig);
X    signal(SIGALRM, oldhandler);
X    sigsetmask(oldsig);
X    }
X
X#else
X/*  napms - sleep for time milliseconds - uses ftime() */
X
Xstatic napms(time)
X    int time;
X    {
X    /* assumed to be BSD UNIX */
X    struct timeb _gtime;
X    time_t matchtime;
X    unsigned short matchmilli;
X    register struct timeb *tp = & _gtime;
X
X    if (time <= 0) return;
X    ftime(tp);
X    matchmilli = tp->millitm + time;
X    matchtime  = tp->time;
X    while (matchmilli >= 1000)
X        {
X        ++matchtime;
X        matchmilli -= 1000;
X        }
X
X    while(1)
X        {
X        ftime(tp);
X        if ((tp->time > matchtime) ||
X            ((tp->time == matchtime) && (tp->millitm >= matchmilli)))
X            break;
X        }
X    }
X#endif
X#else not BSD
Xstatic napms(time) int time; {} /* do nothing, forget it */
X#endif BSD
X#endif SYSV
X#endif NONAP
END_OF_FILE
if test 3719 -ne `wc -c <'nap.c'`; then
    echo shar: \"'nap.c'\" unpacked with wrong size!
fi
# end of 'nap.c'
fi
if test -f 'objects.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'objects.h'\"
else
echo shar: Extracting \"'objects.h'\" \(2633 characters\)
sed "s/^X//" >'objects.h' <<'END_OF_FILE'
X/*
X  Object definitions
X*/
X#define MAXSCROLL 28    /* maximum number of scrolls that are possible */
X#define MAXPOTION 35    /* maximum number of potions that are possible */
X
X#define MAXOBJ 93       /* the maximum number of objects   n < MAXOBJ */
X
X/*  this is the structure definition for the items in the dnd store */
Xstruct _itm
X    {
X    short   price;
X    char    **mem;
X    char    obj;
X    char    arg;
X    char    qty;
X    };
X
Xextern struct _itm itm[];
X
X/*  defines for the objects in the game     */
X#define MAXOBJECT  92
X
X#define OALTAR 1
X#define OTHRONE 2
X#define OORB 3
X#define OPIT 4
X#define OSTAIRSUP 5
X#define OELEVATORUP 6
X#define OFOUNTAIN 7
X#define OSTATUE 8
X#define OTELEPORTER 9
X#define OSCHOOL 10
X#define OMIRROR 11
X#define ODNDSTORE 12
X#define OSTAIRSDOWN 13
X#define OELEVATORDOWN 14
X#define OBANK2 15
X#define OBANK 16
X#define ODEADFOUNTAIN 17
X#define OMAXGOLD 70
X#define OGOLDPILE 18
X#define OOPENDOOR 19
X#define OCLOSEDDOOR 20
X#define OWALL 21
X#define OTRAPARROW 66
X#define OTRAPARROWIV 67
X
X#define OLARNEYE 22
X
X#define OPLATE 23
X#define OCHAIN 24
X#define OLEATHER 25
X#define ORING 60
X#define OSTUDLEATHER 61
X#define OSPLINT 62
X#define OPLATEARMOR 63
X#define OSSPLATE 64
X#define OSHIELD 68
X#define OELVENCHAIN 92
X
X#define OSWORDofSLASHING 26
X#define OHAMMER 27
X#define OSWORD 28
X#define O2SWORD 29
X#define OSPEAR 30
X#define ODAGGER 31
X#define OBATTLEAXE 57
X#define OLONGSWORD 58
X#define OFLAIL 59
X#define OLANCE 65
X#define OVORPAL 90
X#define OSLAYER 91
X
X#define ORINGOFEXTRA 32
X#define OREGENRING 33
X#define OPROTRING 34
X#define OENERGYRING 35
X#define ODEXRING 36
X#define OSTRRING 37
X#define OCLEVERRING 38
X#define ODAMRING 39
X
X#define OBELT 40
X
X#define OSCROLL 41
X#define OPOTION 42
X#define OBOOK 43
X#define OCHEST 44             
X#define OAMULET 45
X
X#define OORBOFDRAGON 46
X#define OSPIRITSCARAB 47
X#define OCUBEofUNDEAD 48
X#define ONOTHEFT 49
X
X#define ODIAMOND 50
X#define ORUBY 51
X#define OEMERALD 52
X#define OSAPPHIRE 53
X
X#define OENTRANCE 54
X#define OVOLDOWN 55
X#define OVOLUP 56
X#define OHOME 69
X
X#define OKGOLD 71
X#define ODGOLD 72
X#define OIVDARTRAP 73
X#define ODARTRAP 74
X#define OTRAPDOOR 75
X#define OIVTRAPDOOR 76
X#define OTRADEPOST 77
X#define OIVTELETRAP 78
X#define ODEADTHRONE 79
X#define OANNIHILATION 80        /* sphere of annihilation */
X#define OTHRONE2 81
X#define OLRS 82             /* Larn Revenue Service */
X#define OCOOKIE 83
X#define OURN 84
X#define OBRASSLAMP 85
X#define OHANDofFEAR 86      /* hand of fear */
X#define OSPHTAILSMAN 87     /* tailsman of the sphere */
X#define OWWAND 88           /* wand of wonder */
X#define OPSTAFF 89          /* staff of power */
X/* used up to 92 */
END_OF_FILE
if test 2633 -ne `wc -c <'objects.h'`; then
    echo shar: \"'objects.h'\" unpacked with wrong size!
fi
# end of 'objects.h'
fi
if test -f 'player.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'player.h'\"
else
echo shar: Extracting \"'player.h'\" \(1895 characters\)
sed "s/^X//" >'player.h' <<'END_OF_FILE'
X/*  defines for the character attribute array   c[] 
X*/
X#define STRENGTH 0      /* characters physical strength not due to objects */
X#define INTELLIGENCE 1
X#define WISDOM 2
X#define CONSTITUTION 3
X#define DEXTERITY 4
X#define CHARISMA 5
X#define HPMAX 6
X#define HP 7
X#define GOLD 8
X#define EXPERIENCE 9
X#define LEVEL 10
X#define REGEN 11
X#define WCLASS 12
X#define AC 13
X#define BANKACCOUNT 14
X#define SPELLMAX 15
X#define SPELLS 16
X#define ENERGY 17
X#define ECOUNTER 18
X#define MOREDEFENSES 19
X#define WEAR 20
X#define PROTECTIONTIME 21
X#define WIELD 22
X#define AMULET 23
X#define REGENCOUNTER 24
X#define MOREDAM 25
X#define DEXCOUNT 26
X#define STRCOUNT 27
X#define BLINDCOUNT 28
X#define CAVELEVEL 29
X#define CONFUSE 30
X#define ALTPRO 31
X#define HERO 32
X#define CHARMCOUNT 33
X#define INVISIBILITY 34
X#define CANCELLATION 35
X#define HASTESELF 36
X#define EYEOFLARN 37
X#define AGGRAVATE 38
X#define GLOBE 39
X#define TELEFLAG 40
X#define SLAYING 41
X#define NEGATESPIRIT 42
X#define SCAREMONST 43
X#define AWARENESS 44
X#define HOLDMONST 45
X#define TIMESTOP 46
X#define HASTEMONST 47
X#define CUBEofUNDEAD 48
X#define GIANTSTR 49
X#define FIRERESISTANCE 50
X#define BESSMANN 51
X#define NOTHEFT 52
X#define HARDGAME 53
X#define CPUTIME 54
X#define BYTESIN 55
X#define BYTESOUT 56
X#define MOVESMADE 57
X#define MONSTKILLED 58
X#define SPELLSCAST 59
X#define LANCEDEATH 60
X#define SPIRITPRO 61
X#define UNDEADPRO 62
X#define SHIELD 63
X#define STEALTH 64
X#define ITCHING 65
X#define LAUGHING 66
X#define DRAINSTRENGTH 67
X#define CLUMSINESS 68
X#define INFEEBLEMENT 69
X#define HALFDAM 70
X#define SEEINVISIBLE 71
X#define FILLROOM 72
X#define RANDOMWALK 73
X#define SPHCAST 74  /* nz if an active sphere of annihilation */
X#define WTW 75      /* walk through walls */
X#define STREXTRA 76 /* character strength due to objects or enchantments */
X#define TMP 77      /* misc scratch space */
X#define LIFEPROT 78 /* life protection counter */
END_OF_FILE
if test 1895 -ne `wc -c <'player.h'`; then
    echo shar: \"'player.h'\" unpacked with wrong size!
fi
# end of 'player.h'
fi
if test -f 'savelev.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'savelev.c'\"
else
echo shar: Extracting \"'savelev.c'\" \(4091 characters\)
sed "s/^X//" >'savelev.c' <<'END_OF_FILE'
X/* savelev.c */
X#include "header.h"
X#include "larndefs.h"
X
X# ifdef MSDOS
X
Xextern int swapfd;      /* swap file file descriptor */
X
XDISKBLOCK *
Xgetfreediskblk()
X{
X    DISKBLOCK   *dp;
X
X    for (dp = diskblks; dp; dp = dp->next)
X        if (dp->level == FREEBLOCK)
X            return dp;
X    levelinfo();
X    error("Can't find a free disk block ?\n");
X}
X
XRAMBLOCK *
Xgetramblk(lev)
X{
X    RAMBLOCK    *rp, *orp;
X    DISKBLOCK   *dp;
X    long        otime;
X    unsigned int    bytes;
X
X    /* Check if the level is in memory already.
X     */
X    for (rp = ramblks; rp; rp = rp->next)
X        if (rp->level == lev)
X            return rp;
X
X    /* Else grab the first available one.
X     */
X    for (rp = ramblks; rp; rp = rp->next)
X        if (rp->level == FREEBLOCK)
X            return rp;
X
X    /* No ramblocks free, so swap out the oldest level
X     */
X    dp = getfreediskblk();
X
X# ifdef ndef
Xwarn("\nTrying to swap\n");
X# endif
X
X    /* Find the oldest level for swapping out.
X     */
X    otime = ramblks->gtime;
X    orp = ramblks;
X    for (rp = ramblks->next; rp; rp = rp->next) {
X        if (rp->gtime < otime) {
X            otime = rp->gtime;
X            orp = rp;
X        }
X    }
X
X    /* Send the oldest level out to disk.
X     */
X    if (lseek(swapfd, dp->fpos, 0) < 0)
X        error("Can't seek to %ld\n", dp->fpos);
X
X    bytes = sizeof rp->cell;
X    if (write(swapfd, (char *) orp->cell, bytes) != bytes)
X        error("Out of space writing swap file !\n");
X
X    /* Update the level information
X     */
X    dp->level = orp->level;
X    dp->gtime = orp->gtime;
X    orp->level = FREEBLOCK;
X# ifdef ndef
Xwarn("Successful swap\n");
X# endif
X    return orp;
X}
X
X
X# endif
X
X/*
X *  routine to save the present level into storage
X */
Xsavelevel()
X    {
X    register struct cel *pcel;
X    register char *pitem,*pknow,*pmitem;
X    register short *phitp,*piarg;
X    register struct cel *pecel;
X
X# ifdef MSDOS
X    RAMBLOCK    *rp;
X
X    rp = getramblk(level);
X    pcel = rp->cell;
X    rp->gtime = gtime;
X    rp->level = level;
X# else
X    pcel = &cell[level*MAXX*MAXY];  /* pointer to this level's cells */
X# endif
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    while (pcel < pecel)
X        {
X        pcel->mitem  = *pmitem++;
X        pcel->hitp   = *phitp++;
X        pcel->item   = *pitem++;
X        pcel->know   = *pknow++;
X        pcel->iarg   = *piarg++;
X        pcel++;
X        }
X    }
X
X
X/*
X *  routine to restore a level from storage
X */
Xgetlevel()
X    {
X    register struct cel *pcel;
X    register char *pitem,*pknow,*pmitem;
X    register short *phitp,*piarg;
X    register struct cel *pecel;
X
X# ifdef MSDOS
X    RAMBLOCK    *rp;
X    DISKBLOCK   *dp;
X    unsigned int    bytes;
X
X    /* Is the level in memory already ?
X     */
X    for (rp = ramblks; rp; rp = rp->next)
X        if (rp->level == level)
X            goto haverp;
X
X    /* Is it on disk ?
X     */
X    for (dp = diskblks; dp; dp = dp->next)
X        if (dp->level == level)
X            break;
X    if (dp == NULL) {
X        levelinfo();
X        error("Level %d is neither in memory nor on disk\n", level);
X    }
X
X    /* Make room for it and read it in.
X     */
X    rp = getramblk(level);
X    if (lseek(swapfd, dp->fpos, 0) < 0)
X        error("Can't seek to %ld\n", dp->fpos);
X    bytes = sizeof rp->cell;
X    if (read(swapfd, (char *) rp->cell, bytes) != bytes)
X        error("Didn't read %u bytes\n", bytes);
X
X    /* The disk space is available for future swaps.
X     */
X    dp->level = FREEBLOCK;
Xhaverp:
X    pcel = rp->cell;
X    rp->level = FREEBLOCK;
X# else
X    pcel = &cell[level*MAXX*MAXY];  /* pointer to this level's cells */
X# endif
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    while (pcel < pecel)
X        {
X        *pmitem++ = pcel->mitem;
X        *phitp++ = pcel->hitp;
X        *pitem++ = pcel->item;
X        *pknow++ = pcel->know;
X        *piarg++ = pcel->iarg;
X        pcel++;
X        }
X    }
END_OF_FILE
if test 4091 -ne `wc -c <'savelev.c'`; then
    echo shar: \"'savelev.c'\" unpacked with wrong size!
fi
# end of 'savelev.c'
fi
if test -f 'termcap.vms' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'termcap.vms'\"
else
echo shar: Extracting \"'termcap.vms'\" \(4005 characters\)
sed "s/^X//" >'termcap.vms' <<'END_OF_FILE'
Xsl|lpr|printer|print|printing|line printer:\
X	:cr=^M:do=^J:nl=^J:bl=^G:le=^H:bs:co#132:hc:os:
Xsu|dumb|un|unknown:\
X	:am:bl=^G:co#80:cr=^M:do=^J:nl=^J:
Xsx|ansi|any ansi terminal with pessimistic assumptions:\
X	:co#80:li#24:cl=50\E[;H\E[2J:\
X	:bs:am:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\
X	:ce=\E[K:ho=\E[H:pt:
X#
X# not sure if vt102 belongs exactly here, but it works with rainbow
X# emulation of a vt102...
X#
Xdr|vt100p|vt102-80|vt100p-nam|dec vt100p:\
X	:am:al=\E[L:bl=^G:bs:cd=50\E[J:ce=3\E[K:cl=50\E[;H\E[2J:\
X	:cm=10\E[%i%d;%dH:co#80:cr=^M:cs=\E[%i%d;%dr:dc=\E[P:\
X	:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:im=\E[4h:is=\E[1;24r\E[24;1H:\
X	:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:\
X	:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:li#24:md=2\E[1m:\
X	:mr=2\E[7m:mb=2\E[5m:me=2\E[m:mi:nd=\E[C:nl=^J:pt:rc=\E8:\
X	:rf=/usr/lib/tabset/vt100:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\
X	:sc=\E7:se=\E[m:so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:\
X	:vt#3:xn:
Xda|vt200|VT200-80|vt2xx|vt200-80|vt220|vt220-80|vt200-nam|dec vt200:\
X	:ae=4\E(B:as=2\E(<:se=2\E[27m:ue=2\E[24m:tc=vt100p:
Xdd|vt200-132|vt220-132|VT200-132|vt200-w|dec vt200 132 cols:\
X	:co#132:tc=vt200:
Xdb|vt300|vt300-80|vt3xx|dec vt300|vt320|vt320-80|vt300-nam|VT300-80|dec vt300 80 cols:\
X	:ds=\E[1$}\E[;H\E[K\E[0$}:\
X	:es:fs=\E[0$}:hs:ts=\E[1$}\E[;H\E[K:\
X	:tc=vt200:
Xdc|vt300-132|vt320-132|vt300-w|VT300-132|dec vt300 132 cols:\
X	:co#132:tc=vt300:
Xd0|vt100|VT100-80|vt100-80|vt100-am|dec vt100:\
X	:cr=^M:do=^J:nl=^J:bl=^G:co#80:li#24:cl=50\E[;H\E[2J:\
X	:le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
X	:ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
X	:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
X	:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
X	:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
X	:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ta=^I:pt:sr=5\EM:vt#3:xn:\
X	:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:
Xd1|vt100-nam|vt100 w/no am:\
X	:am@:xn@:tc=vt100-am:
Xd3|vt132|vt132-80|dec vt132:\
X	:al=99\E[L:dl=99\E[M:ip=7:dc=7\E[P:ei=\E[4l:im=\E[4h:xn:dN#30:tc=vt100:
Xd4|vt132-132|vt132 132 cols:\
X	:co#132:tc=vt132:
Xd6|vt125|vt125-80|vt125-am|DEC vt125:\
X	:cr=^M:do=^J:nl=^J:bl=^G:co#80:li#24:cl=50\E[H\E[2J:\
X	:le=^H:am:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:ce=3\E[K:cd=50\E[J:\
X	:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:\
X	:me=2\E[m:is=\E[1;24r\E[24;1H\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\
X	:ks=\E[?1h\E=:ke=\E[?1l\E>:ku=\EOA:kd=\EOB:\
X	:kr=\EOC:kl=\EOD:kb=^H:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ta=^I:\
X	:pt:sr=5\EM:vt#3:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:
Xdt|vt100-132|vt100-w|dec vt100 132 cols (w/advanced video):\
X	:co#132:li#24:rs=\E>\E[?3h\E[?4l\E[?5l\E[?8h:tc=vt100-am:
Xdv|vt100-w-nam|dec vt100 132 cols (w/advanced video), no am:\
X	:co#132:li#24:rs=\E>\E[?3h\E[?4l\E[?5l\E[?8h:vt@:tc=vt100-nam:
Xdw|vt52|vt52-80|dec vt52:\
X	:cr=^M:do=^J:nl=^J:bl=^G:\
X	:le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :co#80:li#24:nd=\EC:\
X	:ta=^I:pt:sr=\EI:up=\EA:ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H:
Xkb|h19|heath|h19-b|h19b|heathkit|heath-19|z19|zenith|heathkit h19:\
X	:cr=^M:nl=^J:bl=^G:\
X	:al=1*\EL:am:le=^H:bs:cd=\EJ:ce=\EK:cl=\EE:cm=\EY%+ %+ :co#80:dc=\EN:\
X	:dl=1*\EM:do=\EB:ei=\EO:ho=\EH:im=\E@:li#24:mi:nd=\EC:as=\EF:ae=\EG:\
X	:ms:ta=^I:pt:sr=\EI:se=\Eq:so=\Ep:up=\EA:vs=\Ex4:ve=\Ey4:\
X	:kb=^h:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\EH:kn#8:\
X	:k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:\
X	:l6=blue:l7=red:l8=white:k6=\EP:k7=\EQ:k8=\ER:\
X	:es:hs:ts=\Ej\Ex5\Ex1\EY8%+ \Eo:fs=\Ek\Ey5:ds=\Ey1:
XkA|h19-a|h19a|heath-ansi|heathkit-a|heathkit h19 ansi mode:\
X	:cr=^M:nl=^J:bl=^G:\
X	:al=1*\E[1L:am:le=^H:bs:cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%2;%2H:co#80:\
X	:dc=\E[1P:dl=1*\E[1M:do=\E[1B:ei=\E[4l:ho=\E[H:im=\E[4h:li#24:mi:\
X	:nd=\E[1C:as=\E[10m:ae=\E[11m:ms:ta=^I:pt:se=\E[0m:so=\E[7m:up=\E[1A:\
X	:vs=\E[>4h:ve=\E[>4l:kb=^h:ku=\E[1A:kd=\E[1B:kl=\E[1D:kr=\E[1C:\
X	:kh=\E[H:kn#8:k1=\EOS:k2=\EOT:k3=\EOU:k4=\EOV:k5=\EOW:l6=blue:\
X	:l7=red:l8=white:k6=\EOP:k7=\EOQ:k8=\EOR:\
X	:sr=\EM:is=\E<\E[>1;2;3;4;5;6;7;8;9l\E[0m\E[11m\E[?7h:
END_OF_FILE
if test 4005 -ne `wc -c <'termcap.vms'`; then
    echo shar: \"'termcap.vms'\" unpacked with wrong size!
fi
# end of 'termcap.vms'
fi
echo shar: End of archive 12 \(of 12\).
cp /dev/null ark12isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 12 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0