games-request@tekred.TEK.COM (01/13/88)
Submitted by: nrcvax!kosman!kevin Comp.sources.games: Volume 3, Issue 37 Archive-name: crystal/Part05 #! /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 5 (of 5)." # Contents: Files Install MAKEcpio Makefile Name Office PORTING Remove # Size Toybox cvand.c cvcode.h cvcopy.c cvinit.c cvinit.h cvlocs.h # cvmisc.h cvmotd.c cvmsg.h cvobj.h cvorcs.h # Wrapped by billr@tekred on Tue Jan 12 10:11:37 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f Files -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Files\" else echo shar: Extracting \"Files\" \(71 characters\) sed "s/^X//" >Files <<'END_OF_Files' XSize XName XRemove XInstall Xcrystal XToybox XOffice XMAKEcpio XMAKEflop XFiles END_OF_Files if test 71 -ne `wc -c <Files`; then echo shar: \"Files\" unpacked with wrong size! fi # end of overwriting check fi if test -f Install -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Install\" else echo shar: Extracting \"Install\" \(814 characters\) sed "s/^X//" >Install <<'END_OF_Install' Xecho "Installing Crystal Cave adventure game .... Please wait" Xif [ ! -d /usr/games ] ; then X mkdir /usr/games X chmod +rwx /usr/games X chown root /usr/games Xfi Xif [ ! -d /usr/games/lib ] ; then X mkdir /usr/games/lib X chmod +rwx /usr/games/lib X chown root /usr/games/lib Xfi Xif [ ! -d /usr/games/lib/crystal ] ; then X mkdir /usr/games/lib/crystal X chmod +rwx /usr/games/lib/crystal X chown root /usr/games/lib/crystal Xfi X Xln crystal /usr/games/crystal Xecho "Beware the Gruesome Balrog...." X Xuaupd -r Toybox -a Office Office X Xif [ -r $UA/Toybox ] ; then X uaupd -r Crystal -a Toybox Toybox Xelse X ln Toybox $UA/Toybox X chmod 666 $UA/Toybox Xfi X Xmessage -i "Crystal is now installed. After logging out and back in, the selection will appear in your Toybox.\n\nPlease report bugs or problems to Kevin O'Gorman....thanks!" END_OF_Install if test 814 -ne `wc -c <Install`; then echo shar: \"Install\" unpacked with wrong size! fi chmod +x Install # end of overwriting check fi if test -f MAKEcpio -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MAKEcpio\" else echo shar: Extracting \"MAKEcpio\" \(121 characters\) sed "s/^X//" >MAKEcpio <<'END_OF_MAKEcpio' Xecho "you must be root for this one ... crystal is 111 owned by bin ..\c" Xread xyzzy Xcat Files | cpio -ocBv > CRYSTAL+IN END_OF_MAKEcpio if test 121 -ne `wc -c <MAKEcpio`; then echo shar: \"MAKEcpio\" unpacked with wrong size! fi chmod +x MAKEcpio # end of overwriting check fi if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(1960 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' X# the following lets me use a local version of shlib.ifile XLOCSHARE = /lib/crt0s.o shlib.ifile XSHAREDLIB = /lib/crt0s.o /lib/shlib.ifile X Xcrystal: Makefile crycopy cryfile X rm -f crystal X ln cryfile crystal X crystal 1 X crycopy Xinstall: crystal X /bin/su root -c "make rootinstall" Xrootinstall: X strip crystal X chgrp bin crystal X chown bin crystal X chmod 111 crystal X rm -f /usr/games/crystal X ln crystal /usr/games X uaupd -r Crystal -a Toybox Toybox X -cat Files | cpio -ocBv > CRYSTAL+IN Xcvlint: X lint cvmain.c cvmsg.c cvlocs.c cvocab.c cvobj.c cvmove.c \ X cvmotd.c cvspk.c cvdwrf.c cvdie.c cvgo.c cvact.c \ X cvatt.c cvand.c cvend.c cvinit.c cvsave.c XCRYOBJ = cvmain.o cvmsg.o cvlocs.o cvocab.o cvobj.o cvmove.o cvmotd.o \ X cvspk.o cvdwrf.o cvdie.o cvgo.o cvact.o cvatt.o cvand.o \ X cvend.o cvinit.o cvsave.o Xcryfile: Makefile shlib.ifile $(CRYOBJ) X rm -f cryfile X $(LD) $(LDFLAGS) $(LOCSHARE) -o cryfile $(CRYOBJ) -lm Xshlib.ifile: shlib.head X (cat shlib.head;\ X sed -e '/timezone/p' -e '1,/timezone/d' /lib/shlib.ifile) >shlib.ifile Xcrycopy: cvcopy.o X $(LD) $(LDFLAGS) $(SHAREDLIB) -o crycopy cvcopy.o -lld Xcvmain.o: cvmain.c cvobj.h cvlocs.h cvocab.h cvmsg.h cvmisc.h random.h X Xcvmsg.o: cvmsg.c cvmsg.h X Xcvlocs.o: cvlocs.c cvobj.h cvlocs.h X Xcvmove.o: cvmove.c cvobj.h cvlocs.h X Xcvsave.o: cvsave.c cvobj.h cvlocs.h X Xcvobj.o: cvobj.c cvobj.h cvlocs.h X Xcvocab.o: cvocab.c cvocab.h X Xcvspk.o: cvspk.c cvmsg.h cvlocs.h cvobj.h X Xcvdwrf.o: cvdwrf.c cvlocs.h cvobj.h cvocab.h cvmisc.h random.h X Xcvdie.o: cvdie.c cvlocs.h cvobj.h cvocab.h cvorcs.h cvmisc.h X Xcvgo.o: cvgo.c cvlocs.h cvobj.h cvorcs.h cvocab.h cvmisc.h random.h X Xcvact.o: cvact.c cvlocs.h cvobj.h cvocab.h cvmisc.h cvorcs.h random.h X Xcvatt.o: cvatt.c cvlocs.h cvobj.h cvocab.h cvmisc.h cvorcs.h random.h X Xcvand.o: cvand.c cvlocs.h cvocab.h cvobj.h cvmisc.h cvorcs.h X Xcvend.o: cvend.c cvmisc.h X Xcvmotd.o: cvmotd.c cvmisc.h X Xcvinit.o: cvinit.c cvmisc.h cvinit.h X Xcvcopy.o: cvcopy.c cvmisc.h cvinit.h X END_OF_Makefile if test 1960 -ne `wc -c <Makefile`; then echo shar: \"Makefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f Name -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Name\" else echo shar: Extracting \"Name\" \(28 characters\) sed "s/^X//" >Name <<'END_OF_Name' XCrystal Cave Adventure Game END_OF_Name if test 28 -ne `wc -c <Name`; then echo shar: \"Name\" unpacked with wrong size! fi # end of overwriting check fi if test -f Office -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Office\" else echo shar: Extracting \"Office\" \(40 characters\) sed "s/^X//" >Office <<'END_OF_Office' XName=Toybox XDefault=Open XOpen=UA Toybox END_OF_Office if test 40 -ne `wc -c <Office`; then echo shar: \"Office\" unpacked with wrong size! fi # end of overwriting check fi if test -f PORTING -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"PORTING\" else echo shar: Extracting \"PORTING\" \(2395 characters\) sed "s/^X//" >PORTING <<'END_OF_PORTING' XThis version is "mostly" portable, except for X 1) the usual index/strchr things X 2) Some very funny (but easily eliminated) UNIX PC hacks. X XThe hacks are all designed to make it hard to read core files or the Xbinary with strings(1). After all, that would give away lots of the Xgame. X XFor hackers wanting to change this, here's some basic information: X XThe stuff in the makefile relating to shlib.ifile does two things. First, Xit makes the resulting binary use the UNIX PC shared library, which makes Xit smaller and faster than it would otherwise be. Second, it supplies the Xaddresses of the start and end of the initialized data region to the linker, Xand thus to cvinit.c. X XCvinit.c calls several routines to fix up a few problems with my C compiler X(I don't think you have to pay any attention to this) and to encode the XASCII strings in the messages, objects and locations. This encoding is done Xby encode() in cvspk.c. Finally, the entire initialized data region is Xwritten to a file -- this depends on the memory treatment of the linker. X XThis encoded form is written back into the binary by the routine crycopy, Xsince crystal is not allowed to write on itself. Anyway, the result is that Xthe binary contains the encoded forms of all these strings. X XWhen strings are written out during play, this is done by putcode() in Xcvspk.c, which reverses the encoding. Thus, the sources have intelligible XASCII strings, but strings(1) cannot see them in the binaries or core files. X X------------------------------------ X XIf all this gives you a headache, you can get rid of shlib.ifile (and also Xcrt0s.o) and crycopy. You will want to reorganize cvinit.c so that it is Xcalled regardless of the arguments to crystal, because of the other fixup work Xthat it does. The result will be that the strings are encoded at the start of Xeach run, so that core files are still unreadable, but the binary can be Xbrowsed. You will want to remove the invocation of crystal in the makefile. X XI'm sure there are better ways to do this encoding stuff, my only excuse is that Xthis is my very first C program, and I never even knew there was BSD at the Xtime, and had not a hint about the ways in which UNIX implementations differ. XThis was written for the AT&T 7300, with no help from (or access to) UNIX or XC expertise other than the manuals I got with my machine. What the hey, it Xworks fine on MY machine. END_OF_PORTING if test 2395 -ne `wc -c <PORTING`; then echo shar: \"PORTING\" unpacked with wrong size! fi # end of overwriting check fi if test -f Remove -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Remove\" else echo shar: Extracting \"Remove\" \(51 characters\) sed "s/^X//" >Remove <<'END_OF_Remove' Xrm /usr/games/crystal Xrm -r /usr/games/lib/crystal END_OF_Remove if test 51 -ne `wc -c <Remove`; then echo shar: \"Remove\" unpacked with wrong size! fi chmod +x Remove # end of overwriting check fi if test -f Size -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Size\" else echo shar: Extracting \"Size\" \(4 characters\) sed "s/^X//" >Size <<'END_OF_Size' X300 END_OF_Size if test 4 -ne `wc -c <Size`; then echo shar: \"Size\" unpacked with wrong size! fi # end of overwriting check fi if test -f Toybox -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Toybox\" else echo shar: Extracting \"Toybox\" \(58 characters\) sed "s/^X//" >Toybox <<'END_OF_Toybox' XName=Crystal XDefault=Run XRun=EXEC -pwd /usr/games/crystal END_OF_Toybox if test 58 -ne `wc -c <Toybox`; then echo shar: \"Toybox\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvand.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvand.c\" else echo shar: Extracting \"cvand.c\" \(857 characters\) sed "s/^X//" >cvand.c <<'END_OF_cvand.c' X/* cvand.c X * perform acts of vandalism in the "outer" game X *************************************************************************/ X X#include <stdio.h> X#include "cvobj.h" X#include "cvlocs.h" X#include "cvocab.h" X#include "cvmisc.h" X#include "cvorcs.h" X#include "cvcode.h" X Xint Xmutilate(object) register struct cvobj *object; X{ if (object->prop) {rspeak(25); return 0;} /*already broken*/ X object->prop = 1; X if (DAM->prop) {rspeak(197); return 0;} /* bust it, but that's all */ X return getrick(); X} X X Xint Xgetrick() X{ register struct cvloc *dest; X register int p; X X dest = loc; X rspeak(18); /* He says: */ X pspeak(RICK, p = (RICK->prop++)); /* depends on how annoyed he is */ X DOOR->prop = 1; X if (p > 1) dest = O_GATE->conn1.where; X if (p > 2) dest = DOOR->conn1.where; X if (p > 3) DOOR->prop = 0; X if (p > 4) destry(KEY); X return (int)(dest - cvloc); X} END_OF_cvand.c if test 857 -ne `wc -c <cvand.c`; then echo shar: \"cvand.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvcode.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvcode.h\" else echo shar: Extracting \"cvcode.h\" \(267 characters\) sed "s/^X//" >cvcode.h <<'END_OF_cvcode.h' X/* cvcode.h X* return-codes from cvact X**************************************************************************/ X X#define S_move 555 X#define S_okay 556 X#define S_obj 557 X#define S_what 558 X#define S_light 559 X#define S_show 560 X#define S_dark 561 X#define S_miss 562 END_OF_cvcode.h if test 267 -ne `wc -c <cvcode.h`; then echo shar: \"cvcode.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvcopy.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvcopy.c\" else echo shar: Extracting \"cvcopy.c\" \(1566 characters\) sed "s/^X//" >cvcopy.c <<'END_OF_cvcopy.c' X/* cvcopy.c X * copy initialization code into the crystal file X ************************************************************************/ X X#include <stdio.h> X#include <filehdr.h> X#include <ldfcn.h> X#include <fcntl.h> X#include <sys/stat.h> X X#include "cvmisc.h" X#include "cvinit.h" X Xextern char *malloc(); X Xstatic char crynam[] = "crystal"; X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X auto int r, w; X auto char *abuff; X auto unsigned length, rlen; X auto long where,offset; X auto FILE *stream; X auto LDFILE *ldptr; X auto struct stat cstat; X X ldptr = NULL; X if ((ldptr = ldopen(crynam,ldptr)) == NULL ) { X perror(argv[0]); X exit(1); X } X if (ldnsseek(ldptr,".data") == FAILURE) { X perror(argv[0]); X exit(1); X } X if ( (r = open(path,O_RDWR)) == EOF) { X perror(argv[0]); X exit(1); X } X if ( (w = open(crynam,O_RDWR)) == EOF) { X perror(argv[0]); X exit(1); X } X stream = IOPTR(ldptr); X offset = ftell(stream); X if ((where = lseek(w,offset,0)) == (long)-1 ) { X perror(argv[0]); X exit(1); X } X if (fstat(r,&cstat)) { X perror(argv[0]); X exit(1); X } X length = cstat.st_size; X if ((abuff = malloc(length)) == NULL ) { X perror(argv[0]); X exit(1); X } X if ((rlen = read(r,abuff,length)) == EOF || rlen != length) { X perror(argv[0]); X exit(1); X } X if (write(w,abuff,length) == EOF) { X perror(argv[0]); X exit(1); X } X free(abuff); X X if (close(r)) { X perror(argv[0]); X exit(1); X } X if (close(w)) { X perror(argv[0]); X exit(1); X } X if (ldclose(ldptr) == FAILURE) { X perror(argv[0]); X exit(1); X } X if (unlink(path) == EOF) { X perror(argv[0]); X exit(1); X } X return; X} END_OF_cvcopy.c if test 1566 -ne `wc -c <cvcopy.c`; then echo shar: \"cvcopy.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvinit.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvinit.c\" else echo shar: Extracting \"cvinit.c\" \(864 characters\) sed "s/^X//" >cvinit.c <<'END_OF_cvinit.c' X/* cvinit.c X * initialization called the first time (taken care of by the X * makefile. X ************************************************************************/ X X#include <stdio.h> X#include <fcntl.h> X#include "cvmisc.h" X#include "cvinit.h" X Xextern long time(); Xextern long ptime; X Xcvinit(argc,argv) Xint argc; Xchar *argv[]; X{ X auto int r; X auto unsigned length; X auto long where,offset; X extern char datastart,bssstart; X if ( (r = open(path,O_RDWR|O_EXCL|O_CREAT,0700)) == EOF) { X perror(argv[0]); X exit(1); X } X fixrmsg(); /* fix up messages that are too long for C */ X checkloc(); /* check the location array */ X checkobj(); /* check the objects array */ X saved = 1; X (void) time(&ptime); X length = &bssstart - &datastart; X if (write(r,&datastart,length) == EOF) { X perror(argv[0]); X exit(1); X } X if (close(r)) { X perror(argv[0]); X exit(1); X } X return; X} END_OF_cvinit.c if test 864 -ne `wc -c <cvinit.c`; then echo shar: \"cvinit.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvinit.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvinit.h\" else echo shar: Extracting \"cvinit.h\" \(173 characters\) sed "s/^X//" >cvinit.h <<'END_OF_cvinit.h' X/* cvinit.h X * header for some of the initialization stuff X *************************************************************************/ X Xstatic char path[] = "crystal_tmp"; END_OF_cvinit.h if test 173 -ne `wc -c <cvinit.h`; then echo shar: \"cvinit.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvlocs.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvlocs.h\" else echo shar: Extracting \"cvlocs.h\" \(2347 characters\) sed "s/^X//" >cvlocs.h <<'END_OF_cvlocs.h' X/* cvlocs.h X * include file for adventure locations X *********************************************************************/ X X#define DUNGEON 81 X Xstruct rtr { X int top,mid,bot,drop,rug;}; Xextern struct rtr rtrav[]; X Xstruct hint { X int turns,points,quest,hmsg,bit,lc,hinted;}; X Xextern struct hint hints[] ; X X#define IF_HAVE 1 X#define IF_NHAVE 2 X#define IF_WITH 3 X#define IF_NWITH 4 X#define IF_PROP 5 X#define IF_NPROP 6 X Xstruct cvtrav { X int word; X unsigned int l:10; /* location / message */ X unsigned int n:8; /* probability / object */ X unsigned int v:4; /* prop # / flag */ X unsigned int m:3; /* type */ X unsigned int s:1; /* continue flag */ X }; X Xstruct cvloc { X long flags; X struct cvtrav *travel; X char *sdesc, *ldesc; X int abb; X struct conn atloc; X }; X Xextern struct cvloc *loc ; X#define BOATPLC (&(cvloc[32])) Xextern struct cvloc cvloc[] ; Xextern struct cvloc *newloc, *oldloc, *knfloc, *oldlc2; Xextern int tally, tally2 ; X X X#define LAMPLOC (&(cvloc[2])) X#define SEARSL (&(cvloc[78])) X#define CHLOC (&(cvloc[87])) X#define DALTLC (&(cvloc[84])) X#define OFFICE (&(cvloc[149])) X#define REPOS (&(cvloc[150])) X#define DEAD LOST X X#define FORCED(lpt) ((lpt)->flags == C_FORCED) X#define LIQLOC(lpt) (((lpt)->flags & C_WINE) \ X ? (((lpt)->flags & C_WINE) == C_WINE ? _WINE : _WATER) : 0 ) X#define DARKRM (((loc->flags & LIGHT) == 0) \ X && ((LAMP->prop == 0) || !HERE(LAMP))) X#define DARK (DARKRM && ((UNICRN->prop == 0) || !HERE(UNICRN))) X#define BADPLC(lpt) ((lpt)->flags & ESCAPE) X#define LNUM(lpt) ((lpt) - cvloc) X#define INMAZE(lpt) ((lpt)->flags & (HINT3 | HINT4)) X X#define LIGHT 1 /* light here always */ X#define LIQUID 4 /* there's something liquid here */ X#define C_WATER LIQUID /* it's water */ X#define C_WINE (LIQUID+2) /* it's wine */ X#define C_FORCED 2 /* special: loc with forced motion */ X#define ESCAPE 8 /* you can avoid some dwarves here */ X#define HINT1 16 /* trying to find the cave? */ X#define HINT2 32 /* trying to find the real adventure? */ X#define HINT3 64 /* lost in time maze */ X#define HINT4 128 /* trying to get back to time maze */ X#define HINT5 256 /* trying to get out of the woods? */ X#define HINT6 512 /* trying to get down the hole */ X#define SECRET 1024 /* secret passage here */ X#define RANGER 2048 /* ranger rick annoys you here */ X#define DROWN 4096 /* don't drop boat or carpet here! */ END_OF_cvlocs.h if test 2347 -ne `wc -c <cvlocs.h`; then echo shar: \"cvlocs.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvmisc.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvmisc.h\" else echo shar: Extracting \"cvmisc.h\" \(1068 characters\) sed "s/^X//" >cvmisc.h <<'END_OF_cvmisc.h' X/* cvmisc.h X * miscellaneous flags and things X ************************************************************************/ X X#define TRUE (1) X#define FALSE (0) X#define MIN(a,b) (((a) < (b)) ? (a) : (b)) X Xextern int saved; /* this one gets initial data */ X Xextern int dflag , X demo , X score , X mxscore , X limit , /* how long his lamp will last on current power */ X setup , /* state of setup */ X inorth , /* # of times he said NORTH instead of N */ X detail , /* # of times we said "not allowed . . */ X numdie , /* # of times he died so far */ X maxdie , /* # of ways to resurrect him */ X holding , /* # objects he's carrying */ X dkill , /* # of dwarves killed */ X turns , X nxtchr , X abbnum , /* how often he gets long description */ X clock1 , /* time from last treasure to closing */ X clock2 , /* time from closing to closed */ X /* LOGICALS FOLLOW */ X bonus , /* gets bonus for correct finish */ X closing , /* are we closing? */ X panic , /* has he panicked */ X wzdark , X closed , X gaveup , X scoring , X mltcmd , X blklin , X samvrb , X finish , X lmwarn ; X END_OF_cvmisc.h if test 1068 -ne `wc -c <cvmisc.h`; then echo shar: \"cvmisc.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvmotd.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvmotd.c\" else echo shar: Extracting \"cvmotd.c\" \(1905 characters\) sed "s/^X//" >cvmotd.c <<'END_OF_cvmotd.c' X/* cvmotd.c X *************************************************************************/ X X#include <stdio.h> X#include <time.h> X#include <filehdr.h> X#include <ldfcn.h> X#include "cvmisc.h" X X#define MLEN 500 X Xextern long time(); Xextern char *crypt(); Xextern char *malloc(); Xextern void free(); Xextern char *word1; X Xstatic char msg[MLEN] = "\nUNIX PC Crystal version 1.7\n"; Xstatic char salt[2] = '\0\0'; /* To get this in the .data section */ Xstatic char password[14] = '\0'; Xstatic char nums[65] = /* remember the terminating null */ X "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; X Xvoid Xmotd() { X (void) fputs(msg, stdout); X} X Xstatic void Xnewmotd() { X register char *m, *line; X#define lim 70 X printf("\nLimit lines to %d bytes. End with a null line.\n",lim); X m = msg; X line = malloc(lim+2); X do { X fgets(line,lim+2,stdin); X if (strlen(line) == lim+1 && *(line+lim) != '\n') { X while (getchar() != '\n') ; X puts("\nLine too long, retype:"); X } else { X if (*line == '\n') break; X strcpy(m,line); X m += strlen(line); X *m = '\0'; X if (m - msg + 71 > MLEN) { X puts("\nNot enough room for another line. Ending here.\n"); X *line = '\n'; X } X } X } while (*line != '\n'); X free(line); X} X Xstatic int Xwizard() { X auto long now; X auto struct tm *local; X X if (!yes(227,0,228)) return FALSE; X if (password[0] != '\0') { X puts("\nProve it! Say the magic word!\n"); X getin(); X if (strcmp(crypt(word1,salt),password)) { X puts("\nFoo, you are nothing but a charlatan!\n"); X return FALSE; X } X } X return TRUE; X} X Xvoid Xmaint(argv) char *argv; X{ X auto long now; X X if (!wizard()) return; X blklin = FALSE; X puts("\nNew magic word (null to leave it unchanged):"); X getin(); X now = time((long *)0); X *salt = nums[(now/64)%64]; X *(salt+1) = nums[now%64]; X strcpy(password,crypt(word1,salt)); X X if (yes(229,0,0)) newmotd(); X X puts("Okay. Now being saved.\n"); X X X X return; X} END_OF_cvmotd.c if test 1905 -ne `wc -c <cvmotd.c`; then echo shar: \"cvmotd.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvmsg.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvmsg.h\" else echo shar: Extracting \"cvmsg.h\" \(172 characters\) sed "s/^X//" >cvmsg.h <<'END_OF_cvmsg.h' X/* cvmsg.h X * include file for special message arrays X ************************************************************************/ X Xstruct cmsg { X int score; X char *msg; X }; END_OF_cvmsg.h if test 172 -ne `wc -c <cvmsg.h`; then echo shar: \"cvmsg.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvobj.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvobj.h\" else echo shar: Extracting \"cvobj.h\" \(1232 characters\) sed "s/^X//" >cvobj.h <<'END_OF_cvobj.h' X/* cvobj.h X * include file for objects list X *********************************************************************/ X Xstruct conn { X struct cvobj *who; X struct cvloc *where; X struct conn *link; X }; X Xstruct cvobj { X char *desc; /* object description */ X char *props; /* all property messages, in order */ X int iloc, /* initial location */ X iloc2, /* initial second location */ X iprop; /* initial property */ X int prop; /* current property number */ X struct conn conn1, /* link to next obj here */ X conn2; /* link to next obj at 2nd loc */ X }; X Xextern struct cvobj cvobj[] ; X X#define TAKEN (&(cvloc[0])) /* use that place for something */ X#define LOST ((struct cvloc *) 0) X#define FIXED TAKEN X X#define OBJSIZ 100 X#define ISOBJ(object) ((object) < OBJSIZ) X#define INBARN(object) ((object)->conn1.where == &(cvloc[2])) X#define AT(object) ( ((object)->conn1.where == loc ) \ X || ((object)->conn2.where == loc) ) X#define HERE(object) ( ((object)->conn1.where == loc ) \ X || (TOTING(object)) ) X#define TOTING(object) ( (object)->conn1.where == TAKEN ) X#define FOUND(object) ( (object)->prop >= 0 ) X#define LIQ(object) ((object->prop) ? (_WATER - 1 + (object->prop)) : 0) X#define ONUM(object) ( (object) - cvobj ) END_OF_cvobj.h if test 1232 -ne `wc -c <cvobj.h`; then echo shar: \"cvobj.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f cvorcs.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cvorcs.h\" else echo shar: Extracting \"cvorcs.h\" \(791 characters\) sed "s/^X//" >cvorcs.h <<'END_OF_cvorcs.h' X/* cvorcs.h X * define the monster array X ***********************************************************************/ X Xstruct monster { X int iloc, dw, dseen ; X struct cvloc *dloc, *oloc; X } ; X Xextern struct monster orcs[] ; X X#define ORC(o) (&(orcs[(o)])) X#define IGRENDL 0 X#define GRENDL ORC(IGRENDL) X#define IDRAGON 1 X#define PUFF ORC(IDRAGON) X#define IKING 2 X#define ARTHUR ORC(IKING) X#define IDJINN 3 X#define JEANNIE ORC(IDJINN) X#define IKOBOLD 4 X#define SLASHER ORC(IKOBOLD) X#define IBEAR 5 X#define YOGI ORC(IBEAR) X#define IUNICRN 6 X#define EINHORN ORC(IUNICRN) X#define IPRIEST 7 X#define PRIEST ORC(IPRIEST) X#define IBALROG 8 X#define BALLY ORC(IBALROG) X#define MINDWR ORC(9) X#define MAXDWR ORC(14) X#define IPIRAT 15 X#define PIRATE (&(orcs[IPIRAT])) X#define ISELF 16 X#define ME ORC(ISELF) X END_OF_cvorcs.h if test 791 -ne `wc -c <cvorcs.h`; then echo shar: \"cvorcs.h\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 5 \(of 5\). cp /dev/null ark5isdone MISSING="" for I in 1 2 3 4 5 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 5 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