v07i008: ularn - ultra-larn, an enhancement of the larn adventure game, Part08/08

16 views
Skip to first unread message

Bill Randle

unread,
Jul 6, 1989, 10:06:05 AM7/6/89
to
Submitted-by: "Philip A. Cordier" <ph...@sco.COM>
Posting-number: Volume 7, Issue 8
Archive-name: ularn/Part08

#! /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 8 (of 8)."
# Contents: Uhelp.no_control config.c tok.c
# Wrapped by billr@saab on Thu Jun 29 08:10:23 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Uhelp.no_control' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Uhelp.no_control'\"
else
echo shar: Extracting \"'Uhelp.no_control'\" \(5998 characters\)
sed "s/^X//" >'Uhelp.no_control' <<'END_OF_FILE'
X5 Welcome to the game of Ularn. At this moment, you face a great problem.
XYour daughter has contracted a strange disease, and none of your home remedies
Xseem to have any effect. You sense that she is in mortal danger, and you must
Xtry to save her. Time ago you heard of a land of great danger and opportunity.
XPerhaps here is the solution you need.
X
X It has been said that there once was a great magician who called himself
XPolinneaus. Many years ago, after having many miraculous successes, Polinneaus
Xretired to the caverns of Ularn, where he devoted most of his time to the
Xcreation of magic. Rumors have it that one day Polinneaus set out to dispel
Xan attacking army in a forest some distance to the north. It is believed that
Xhere he met his demise.
X
X The caverns of Ularn, it is thought, must be magnificent in design,
Xand contain much magic and treasure. One option you have is to undertake a
Xjourney into these caverns.
X
X
X Good Luck! (You're going to need it.)
X
X
X
X
X ^[[4mHelp File for The Caverns of Ularn^[[m
X
Xh move to the left H run left . stay here
Xj move down J run down Z teleport yourself
Xk move up K run up c cast a spell
Xl move to the right L run right r read a scroll
Xy move northwest Y run northwest q quaff a potion
Xu move northeast U run northeast W wear armor
Xb move southwest B run southwest T take off armor
Xn move southeast N run southeast w wield a weapon
X^ identify a trap g give present pack weight P give tax status
Xd drop an item i inventory your pockets Q quit the game
Xv print program version S save the game D list all items found
X? this help screen A create diagnostic file e eat something
X (wizards only)
XUlarn ++ restore checkpointed game
XUlarn -s list the scoreboard
XUlarn -i list scores with inventories
XUlarn -n suppress welcome message when beginning a game
XUlarn -h print out all the command line options
XUlarn -<number> specify difficulty of the game (may be used with -n)
XUlarn -o<optsfile> specify the .Ularnopts file to be used
XUlarn -c create new scoreboards -- prompts for a password
X ^[[7mSpecial Notes^[[m
X
XWhen ^[[7mdropping gold^[[m, if you type '*' as your amount, all your gold gets dropped.
XIn general, typing in '*' means all of what your interested in. This is true
Xwhen visiting the bank, or when contributing at altars.
X
XWhen in the store, trading post, school, or home, an ^[[7m<escape>^[[m will get you out.
X
XWhen casting a spell, if you need a list of spells you can cast, type '^[[7mD^[[m' as
Xthe first letter of your spell. The available list of spells will be shown,
Xafter which you may enter the spell code. This only works on the 1st letter
Xof the spell you are casting. You may also type 'D' at any time - this will
Xshow all the spells you know, as well as all the potions and scrolls you have
Xencountered and identified so far.
X
X
X
X
X
X
X
X
X
X ^[[7mBackground Information for Ularn^[[m
X
X Welcome to the game of Ularn. At this moment, you face a great problem.
XYour daughter has contracted a strange disease, and none of your home remedies
Xseem to have any effect. You sense that she is in mortal danger, and you must
Xtry to save her. Time ago you heard of a land of great danger and opportunity.
XPerhaps here is the solution you need.
X
X It has been said that there once was a great magician who called himself
XPolinneaus. Many years ago, after having many miraculous successes, Polinneaus
Xretired to the caverns of Ularn, where he devoted most of his time to the
Xcreation of magic. Rumors have it that one day Polinneaus set out to dispel
Xan attacking army in a forest some distance to the north. It is believed that
Xhere he met his demise.
X
X The caverns of Ularn, it is thought, must be magnificent in design,
Xand contain much magic and treasure. One option you have is to undertake a
Xjourney into these caverns.
X
X Good Luck! You're going to need it!
X
X
X
X ^[[7mHow to use the .Ularnopts option file^[[m
X
XThe file ".Ularnopts", if used, should be in your home directory (see -o).
XA sequence of words terminated by whitespace is used to specify options.
X
X Word Meaning
X no-introduction do not display intro message
X enable-checkpointing turn on periodic checkpointing
X no-beep disable beeping of the terminal
X bold-off turn off highliting
X male choose your sex to be a man
X female choose your sex to be a woman
X name: "your name" choose your playing name
X monster: "monstname" choose a new name for the monster- first
X letter of name is monster's character.
X savefile: save-file-name full pathname of savefile
X character: character choose your character
X
XYour name and monster names must be enclosed in double quotation marks and may
Xbe up to 34 characters long. Longer names are truncated. Anything enclosed in
Xquotation marks is considered one word, and must be separated from other words
Xby whitespace.
X
X ^[[7mExplanation of the Ularn scoreboard facility^[[m
X
X Ularn supports TWO scoreboards, one for winners, and one for deceased
Xcharacters. Each player (by userid or playerid, see UIDSCORE in Makefile)
Xis allowed one slot on each scoreboard, if the score is in the top ten for
Xthat scoreboard. This design helps insure that frequent players of Ularn
Xdo not hog the scoreboard, and gives more players a chance for glory. Level
Xof difficulty is also noted on the scoreboards, and this takes precedence
Xover score for determining what entry is on the scoreboard. For example:
Xif "Yar, the Bug Slayer" has a score of 128003 on the scoreboard at diff 0,
Xthen his game at diff 1 and a score of 4112 would replace his previous
Xentry on the scoreboard. Note that when a player dies, his inventory is
Xstored in the scoreboard so that everyone can see what items the player had
Xat the time of his death.
X
X
X
X
X
X
X
X
X
X
X
END_OF_FILE
if test 5998 -ne `wc -c <'Uhelp.no_control'`; then
echo shar: \"'Uhelp.no_control'\" unpacked with wrong size!
fi
# end of 'Uhelp.no_control'
fi
if test -f 'config.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'config.c'\"
else
echo shar: Extracting \"'config.c'\" \(1039 characters\)
sed "s/^X//" >'config.c' <<'END_OF_FILE'
X/*
X * config.c
X * 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
X/* the game save filename */
Xchar savefilename[SAVEFILENAMESIZE] = HOME;
X
X/* the score file */
Xchar scorefile[sizeof(HOME)+sizeof(SCORENAME)] = HOME;
X
X/* the logging file */
Xchar logfile[sizeof(HOME)+sizeof(LOGFNAME)] = HOME;
X
X/* the help text file */
Xchar helpfile[sizeof(HOME)+sizeof(HELPNAME)] = HOME;
X
X/* the maze data file */
Xchar larnlevels[sizeof(HOME)+sizeof(LEVELSNAME)] = HOME;
X
X/* the fortune data file */
Xchar fortfile[sizeof(HOME)+sizeof(FORTSNAME)] = HOME;
X
X/* the .Ularnopts filename */
Xchar optsfile[128] ="/.Ularnopts"; /* the option file */
X
Xchar diagfile[] ="Diagfile"; /* the diagnostic filename */
Xchar ckpfile[] ="Ularn.ckp"; /* the checkpoint filename */
Xchar *password ="takala"; /* the wizards password */
END_OF_FILE
if test 1039 -ne `wc -c <'config.c'`; then
echo shar: \"'config.c'\" unpacked with wrong size!
fi
# end of 'config.c'
fi
if test -f 'tok.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tok.c'\"
else
echo shar: Extracting \"'tok.c'\" \(5635 characters\)
sed "s/^X//" >'tok.c' <<'END_OF_FILE'
X/* tok.c */
X#include "header.h"
X
X#define FLUSHNO 5
X#define MAXUM 52 /* maximum number of user re-named monsters */
X#define MAXMNAME 40 /* max length of a monster re-name */
X
Xstatic char lastok=0;
Xint yrepcount=0,dayplay=0;
X#ifdef BSD
Xstatic int flushno=FLUSHNO; /* input queue flushing threshold */
X#endif /* BSD */
Xstatic char usermonster[MAXUM][MAXMNAME];
Xstatic char usermpoint=0; /* the user monster pointer */
X
X/*
X lexical analyzer for larn
X */
Xyylex()
X{
X char cc;
X int i, ic;
X
X if (hit2flag) {
X hit2flag=0;
X yrepcount=0;
X return(' ');
X }
X if (yrepcount>0) {
X --yrepcount;
X return(lastok);
X }
X else yrepcount=0;
X
X /*show where the player is*/
X if (yrepcount==0) {
X bottomdo();
X showplayer();
X }
X lflush();
X while (1) {
X c[BYTESIN]++;
X if (ckpflag)
X /* check for periodic checkpointing */
X if ( c[BYTESIN] == 1 || (c[BYTESIN] % 400) == 0) {
X wait((int *)0);/* wait for other forks to finish */
X if (fork() == 0) {
X savegame(ckpfile);
X exit(0);
X }
X }
X#ifdef BSD
X /* if keyboard input buffer is too big, flush some of it */
X do {
X ioctl(0,FIONREAD,&ic);
X if (ic>flushno)
X read(0,&cc,1);
X }
X while (ic>flushno);
X#endif
X if (read(0,&cc,1) != 1)
X return(lastok = -1);
X
X if (cc == '!') /* shell escape */
X {
X resetscroll();
X clear();
X sncbr();
X cl_dn(0,0);
X lflush();
X if ((ic=fork())==0) {
X execl("/bin/csh", "/bin/csh", (char *)0);
X exit(1);
X }
X do {
X i = wait(0);
X } while (i != ic && i != -1);
X
X if (ic<0) {
X fprintf(stderr,"Can't fork /bin/csh!\n");
X fflush(stderr);
X sleep(2);
X }
X setscroll();
X scbr();
X return(lastok = 'L'-64); /* redisplay screen */
X }
X if ((cc <= '9') && (cc >= '0'))
X yrepcount = yrepcount*10 + cc - '0';
X else {
X if (yrepcount>0) --yrepcount;
X return(lastok = cc);
X }
X }
X}
X
X/*
X * flushall() Function to flush all type-ahead in the input buffer
X */
Xflushall()
X{
X#ifdef BSD
X char cc;
X int ic;
X
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) {
X read(0,&cc,1);
X --ic;
X } /* gobble up the byte */
X }
X#else /* SYSV */
X# ifdef unix
X tcflush(0, TCIFLUSH); /* unix SYSV only, not XENIX */
X# endif /* unix */
X#endif /* BSD */
X}
X
X/*
X function to set the desired hardness
X enter with hard= -1 for default hardness, else any desired hardness
X */
Xsethard(hard)
Xint hard;
X{
X register int j,k,i;
X
X if (restorflag==0) { /* don't set c[HARDGAME] if restoring game */
X if (hashewon() == 0) {
X if (hard >= 0)
X c[HARDGAME] = hard;
X }
X else if (hard > c[HARDGAME]) c[HARDGAME] = hard;
X }
X
X if (k=c[HARDGAME])
X for (j=0; j<=MAXMONST+8; j++) {
X i = ((6+k)*monster[j].hitpoints+1)/6;
X monster[j].hitpoints = (i<0) ? 32767 : i;
X i = ((6+k)*monster[j].damage+1)/5;
X monster[j].damage = (i>127) ? 127 : i;
X i = (10*monster[j].gold)/(10+k);
X monster[j].gold = (i>32767) ? 32767 : i;
X i = monster[j].armorclass - k;
X monster[j].armorclass = (i< -127) ? -127 : i;
X i = (7*monster[j].experience)/(7+k) + 1;
X monster[j].experience = (i<=0) ? 1 : i;
X }
X}
X
X/*
X function to read and process the larn options file
X */
Xreadopts()
X{
X register char *i;
X register int j,k;
X extern int char_picked;
X int flag=1;
X
X if (lopen(optsfile) < 0) {
X strcpy(logname,loginname);
X return; /* user name if no character name */
X }
X i = " ";
X while (*i) {
X if ((i=(char *)lgetw()) == 0) break; /* check for EOF */
X while ((*i==' ') || (*i=='\t')) i++; /* eat leading whitespace*/
X switch(*i) {
X case 'b':
X if (strcmp(i,"bold-off") == 0)
X boldon=0;
X break;
X
X case 'e':
X if (strcmp(i,"enable-checkpointing") == 0)
X ckpflag=1;
X break;
X
X case 'f':
X if (strcmp(i,"female") == 0)
X sex=0; /* male or female */
X break;
X
X /* name favorite monster */
X case 'm':
X if (strcmp(i,"monster:")== 0) {
X if ((i=lgetw())==0) break;
X if (strlen(i)>=MAXMNAME) i[MAXMNAME-1]=0;
X strcpy(usermonster[usermpoint],i);
X /* defined all of em */
X if (usermpoint >= MAXUM) break;
X if (isalpha(j=usermonster[usermpoint][0])) {
X for (k=1; k<MAXMONST+8; k++)
X if (monstnamelist[k] == j) {
X monster[k].name = &usermonster[usermpoint++][0];
X break;
X }
X }
X }
X else if (strcmp(i,"male") == 0) sex=1;
X break;
X
X case 'n':
X if (strcmp(i,"name:") == 0) {
X if ((i=lgetw())==0) break;
X if (strlen(i)>=LOGNAMESIZE)
X i[LOGNAMESIZE-1]=0;
X strcpy(logname,i);
X flag=0;
X }
X else if (strcmp(i,"no-introduction") == 0)
X nowelcome=1;
X else if (strcmp(i,"no-beep") == 0)
X nobeep=1;
X break;
X
X case 'c':
X if (strncmp(i,"character:",strlen("character:")) == 0) {
X int k=0, j=0;
X j = strlen("character:");
X do {
X char_class[k++] = i[j];
X } while (i[j++] != '\0');
X flag = 0;
X if (!strcmp(char_class, "ogre"))
X char_picked = 'a';
X else if (!strcmp(char_class, "wizard"))
X char_picked = 'b';
X else if (!strcmp(char_class, "klingon"))
X char_picked = 'c';
X else if (!strcmp(char_class, "elf"))
X char_picked = 'd';
X else if (!strcmp(char_class, "rogue"))
X char_picked = 'e';
X else if (!strcmp(char_class, "geek"))
X char_picked = 'f';
X else if (!strcmp(char_class, "dwarf"))
X char_picked = 'g';
X else if (!strcmp(char_class, "rambo"))
X char_picked = 'h';
X }
X break;
X case 's':
X if (strcmp(i,"savefile:") == 0) {
X if ((i=lgetw())==0) break;
X if (strlen(i)>=SAVEFILENAMESIZE)
X i[SAVEFILENAMESIZE-1]=0;
X strcpy(savefilename,i);
X flag=0;
X }
X break;
X };
X }
X if (flag) strcpy(logname,loginname);
X}
END_OF_FILE
if test 5635 -ne `wc -c <'tok.c'`; then
echo shar: \"'tok.c'\" unpacked with wrong size!
fi
# end of 'tok.c'
fi
echo shar: End of archive 8 \(of 8\).
cp /dev/null ark8isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 8 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0

Reply all
Reply to author
Forward
0 new messages