[comp.sources.amiga] v89i014: world - text adventure, Part07/07

page@swan.ulowell.edu (Bob Page) (02/02/89)

Submitted-by: ejkst@unix.cis.pittsburgh.edu (Eric J. Kennedy)
Posting-number: Volume 89, Issue 14
Archive-name: fun/world.7

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar:    Shell Archiver
#	Run the following text with /bin/sh to create:
#	arrays.h
#	demons.c
#	makefile
#	makefile.old
#	variab.h
#	vcnvrt.c
#	vtxtcn.c
#	wbstuff.c
#	world.c
# This archive created: Mon Jan 30 18:12:28 1989
cat << \SHAR_EOF > arrays.h

/* The arrays declared elsewhere are used starting with index 0;
   those declared below starting with index 1     */
  int  gtext[5];
  short locdat[LOCNUM+1], odistb[OBJMX2+1];
  short obnoun[OBJMAX+1], obadjv[OBJMAX+1], obw3[OBJMAX+1];
  short obw4[OBJMAX+1], obpprp[OBJMAX+1], obimpr[OBJMAX+1], obloc[MOVMAX+1];
SHAR_EOF
cat << \SHAR_EOF > demons.c
#include "parame.inc"
#include "variab.h"
#include "arrays.h"

/* World C Version 1.00 copyright 1987 J.D.McDonald 
   Use as you like for non-commercial purposes, but please
   leave this note, and document any changes you make as yours */

mdemon()
{

    int             qtim, z, i, kkwr;
    /*
     * subroutine to care for comings and goings of martians 
     */

    qtim = (turns % 100) < 75;
    /*
     * the player must have entered mars once in the day and once at night,
     * and then wait 4 turns before they come close 
     */

    if (martim < 7) {
	if (loc == 27 || loc == 50 || loc == 41) {
	    oldloc = 0;
	    speak(152);
	}
	if (loc >= 26 && loc <= 50) {
	    if (qtim && (martim == 0 || martim == 2))
		martim |= 1;
	    if (!qtim && (martim == 0 || martim == 1))
		martim |= 2;
	    if (martim >= 3)
		martim += 1;
	}
    }
    if (qtim)
	return;
    /*
     * they will appear at once if he falls in their hockey rink 
     */

    if (loc == 38 && !marflg[5]) {
	marflg[5] = 1;
	martim = 7;
	speak(169);
	return;
    }
    for (i = 0; i < 5; i++)
	marflg[i] = 0;
    z = (turns % 100);
    /* wont come close if martim < 7 */

    if (martim < 7) {
	if (loc != 51)
	    speak(141);
	goto lab60;
    }
    if (z > 75 && z < 99)
	marflg[4] = 1;
    if (z > 76 && z < 98)
	marflg[0] = 1;
    if (z > 78 && z < 95)
	marflg[3] = 1;
    if (z > 78 && z < 96)
	marflg[2] = 1;
    if (z > 77 && z < 97 && obloc[HPUCK] == 38)
	marflg[1] = 1;
    /* announce the goings on of the martians */

    if (marflg[5] && z == 75 && loc != 38)
	speak(154);
    if (marflg[5] && z == 99 && loc != 38)
	speak(155);
    /* the first time they come close */

    if (!marflg[5] && loc < 51) {
	marflg[5] = 1;
	speak(142);
    }
    if (loc == 28) {
	if (marflg[3])
	    speak(143);
    } else if (loc >= 43 && loc <= 45) {
	if (marflg[4])
	    speak(144);
    }
    /* at home */

    else if (loc == 42 || loc == 30) {
	if (marflg[0]) {
	    if (!marflg[6] || pct(20)) {
		speak(145);
		marflg[6] = 1;
	    } else
		speak(146);
	}
    }
    /* the hockey game  */

    else if (loc == 29 || (loc >= 31 && loc <= 38)) {
	if (marflg[1]) {
	    if (!marflg[7] || pct(20)) {
		speak(147);
		marflg[7] = 1;
	    } else
		speak(148);
	}
    } else if (loc == 40) {
	if (marflg[2])
	    speak(149);
    } else;
    if (((loc == 42 && marflg[0]) || (loc == 38)) && !deadf) {
	/* oops! he ran inot one and got fried  */

	if (loc == 42)
	    speak(150);
	if (loc == 38) {
	    if (marflg[1])
		speak(151);
	    else
		speak(171);
	    for (i = 32; i <= 37; i++)
		locdat[i] |= 16384;
	}
	vdead();
	oldlc2 = 0;
	oldloc = 0;
    }
    /* move his belongings to the dump */

lab60:
    for (i = 1; i <= MOVMAX; i++) {
	if (obloc[i] == loc || (obloc[i] == 48 && loc == 49) || obloc[i] < 27 ||
	    obloc[i] > 50)
	    continue;
	if (i == ZWIRE) {
	    if (obloc[i] == 1000 || wirelc[0] == 1000 || wirelc[5]
		== 1000 || wirelc[0] == loc || wirelc[1] == loc
		|| wirelc[2] == loc || wirelc[3] == loc
		|| wirelc[4] == loc || wirelc[5] == loc)
		continue;
	    obimpr[ZWIRE] = (obimpr[ZWIRE] & ~56) + 8;
	    /* ~56=177707 octal */

	    for (kkwr = 0; kkwr < 6; kkwr++)
		wirelc[kkwr] = 0;
	}
	if (obloc[i] >= 27 && obloc[i] <= 50)
	    obloc[i] = 40;
	if (i == HPUCK)
	    obloc[i] = 38;
	if (i == ZDIAMO) {
	    obimpr[i] = (obimpr[i] & ~56) + 8;
	    obloc[i] = 49;
	}
	if (i == RBOULD)
	    obloc[i] = 27;
    }
    return;
}

wdemon()
{
    int             i, n, i2, vloc;
    /*
     * take care of playing out and taking in the wire take it in  
     */

    if (wirelc[5] == 1000) {
	for (i = 1; i <= 4; i++) {
	    n = 5 - i;
	    if (wirelc[n] == oldloc && wirelc[n - 1] == loc) {
		wirelc[n] = 1000;
		speak(216);
		if (wirelc[1] == 1000 && obloc[ZWIRE] == 1000 && wirelc[0] == loc) {
		    for (i2 = 0; i2 < 5; i2++)
			wirelc[i2] = 0;
		    speak(219);
		}
		return;
	    }
	}
	if (wirelc[1] == 1000 && wirelc[0] == oldloc && obloc[ZWIRE]
	    == loc) {
	    wirelc[0] = 1000;
	    speak(216);
	    return;
	}
	/* play it out  */

	if (loc >= 32 && loc <= 38) {
	    speak(257);
	    if (oldloc == 31 || oldloc == 32)
		vloc = 32;
	    else
		vloc = 37;
	    for (i = 0; i < 6; i++)
		if (wirelc[i] == 1000)
		    wirelc[i] = vloc;
	    return;
	}
	for (i = 0; i < 4; i++) {
	    if (wirelc[i] == oldloc && wirelc[i + 1] == 1000) {
		wirelc[i + 1] = loc;
		speak(217);
		return;
	    }
	}
	if (wirelc[0] == 1000 && obloc[ZWIRE] == oldloc) {
	    wirelc[0] = loc;
	    speak(217);
	    return;
	}
	/* out of wire   */

	if (wirelc[4] == oldloc) {
	    speak(218);
	    wirelc[5] = wirelc[4];
	    return;
	}
    } else;
}


timer(xloc)
    int             xloc;
{
    int             bplce, cplce, gplce, iplce, objen, qq, i;

    /* prevent him from being outside the valley at sunset */

    if (loc <= 3 && loc * 15 < turns) {
	speak(255);
	oldlc2 = oldloc;
	oldloc = loc;
	loc += 1;
    }
    /*
     * daytim=1 if it is intrinsically light here (i.e. lights are always on
     * or it is outside and the sun is up or he is carrying sphere or bead  
     */

    if ((locdat[loc] & 17) != 0 || ((locdat[loc] & 8) != 0
			     && (turns % 100) < 75) || obloc[GSPHER] == 1000
	|| obloc[GSPHER] == loc || obloc[ZBEAD] == 1000 ||
	obloc[ZBEAD] == loc)
	daytim = 1;
    else
	daytim = 0;
    /* he is killed if on tower in daytime  */

    if (loc == 49 && daytim == 1 && !deadf) {
	speak(166);
	oldlc2 = 0;
	oldloc = 0;
	loc = 48;
	vdead();
    }
    /* announce rising and setting of both suns  */

    if ((locdat[loc] & 8) != 0) {
	if (daytim == 0)
	    speak(124);
	else if ((turns % 100) >= 72 && (turns % 100) < 75)
	    speak(125);
	else if ((turns % 100) < 3 && turns > 4)
	    speak(126);
	else;
    }
    /*
     * check to see if he is not wearing shoes or boots if too long without
     * them, he dies  
     */

    if ((obloc[CSHOES] != 3000 && obloc[HBOOTS] != 3000) &&
	!deadf && (loc != 16 && loc < 153)) {
	noshoe -= 1;
	if (noshoe == 0)
	    speak(99);
	else if (noshoe < -6 && pct(10 * (-6 - noshoe))) {
	    speak(100);
	    vdead();
	}
    }
    /* fish need water to live!  */

    if (obloc[DFISH] == 0) {
	if (obloc[CFISH] != 16 && !(obloc[CFISH] == (2000 + PLBAG)
				    && (((obimpr[PLBAG] / 512) % 8) == 5))) {
	    fshlif -= 1;
	    if (fshlif == 0) {
		obloc[DFISH] = obloc[CFISH];
		obloc[CFISH] = 0;
		obimpr[CFISH] = 0;
		obimpr[DFISH] = 137;
	    }
	}
    }
    /* check on status of bug repellent  */

    if (obimpr[ZDEET] >= 4096)
	obimpr[ZDEET] -= 4096;
    /* check on radioactive exposure of film in camera  */

    itsher(ZBEAD, &bplce);
    itsher(GSPHER, &gplce);
    if (oextim < 8000) {
	itsher(ICAMER, &iplce);
	if (obloc[GSPHER] == obloc[ICAMER])
	    oextim += 1;
	else {
	    if (iplce != 0 && gplce != 0)
		oextim += 1;
	}
	if (obloc[ZBEAD] == obloc[ICAMER])
	    oextim += 7;
	else {
	    if (iplce != 0 && bplce != 0)
		oextim += 4;
	}
    }
    /* check on radiation poisoning  */

    if (!deadf && bplce != 0 && obloc[ZBEAD] != 2000 + ZSINK) {
	rdietm = (rdietm / 5) * 5;
	rdietm += 5;
	if (rdietm > 0 && (rdietm % 10) == 0)
	    speak(rdietm / 10 + 320);
    } else {
	rdietm -= 1;
	if (rdietm <= 0)
	    rdietm = 0;
	if (rdietm == 36)
	    speak(326);
	if (rdietm == 24)
	    speak(327);
	if (rdietm == 12)
	    speak(328);
    }
    /* check on changing of loc 89 */

    if (easttm == 1)
	speak(376);
    if (easttm == 15)
	speak(377);
    if (easttm == 50)
	speak(378);
    if (easttm >= 1 && easttm <= 50)
	easttm += 1;
    if (!deadf)
	eattim += 1;
    if (eattim == 170)
	speak(367);
    if (eattim == 240)
	speak(368);
    if (eattim == 270)
	speak(369);
    if (eattim == 300) {
	speak(384);
	vdead();
    }
    /* exposing the x-ray film  */

    itsher(ZCASSE, &cplce);
    if (obloc[ZCASSE] == 2000 + ZRACK && obloc[ZBEAD] == 2000 + ZTRAY) {
	objen = 0;
	for (i = 0; i <= MOVMAX; i++) {
	    if (obloc[i] == ZENLAR + 2000) {
		if (fimage != 0 && fimage != i)
		    filmst = 1;
		qq = i;
		objen += 1;
	    }
	}
	if (objen > 1)
	    filmst = 1;
	if (objen == 0)
	    filmtm += 10;
	if (objen >= 1) {
	    filmtm += 1;
	    fimage = qq;
	}
    } else if (obloc[ZBEAD] == obloc[ZCASSE] || (obloc[ZBEAD] != ZSINK
					+ 2000 && bplce != 0 && cplce != 0))
	filmtm += 1000;
    else;
    if (filmtm > 3000)
	filmtm = 3000;
    /*
     * dispersing of the cloud from the seed we are using obimpr(zseed) as a
     * clock; this is ok since it no longer exists (  o.e. obloc(zseed)=0 )
     * despite this being stupid  
     */

    if (obloc[ZSEED] == 0 && obimpr[ZSEED] > 0) {
	if ((loc == 99 || loc == 131) && obimpr[ZSEED] == 1)
	    speak(406);
	obimpr[ZSEED] -= 1;
    }
    if (screef > 0)
	screef -= 1;
    /* the chase is on!!!!    */

    if (chaset != 0) {
	if (adverb == QUICKL)
	    chaser += 1;
	if (chaset <= 8) {
	    if (xloc == loc || loc == oldlc2 || loc == 174 || loc == 166) {
		if (chaset != 1) {
		    speak(557);
		    vdead();
		} else
		    speak(554);
	    } else if (chaset >= 5 && chaser < 3)
		speak(556);
	    else
		speak(555);
	} else if (chaset == 9) {
	    if (chaser >= 3) {
		speak(558);
		guardl = loc;
	    } else {
		speak(557);
		vdead();
	    }
	} else if ((chaset > 9 && chaset < 18) && loc == guardl) {
	    speak(563);
	    vdead();
	} else if (loc < 176 && chaset == 18) {
	    if (!(loc == 175 && (obimpr[BDOOR] & 2) != 0)) {
		speak(560);
		vdead();
	    }
	}
	chaset += 1;
	if (chaset == 19)
	    chaset = 0;
    }
}
SHAR_EOF
cat << \SHAR_EOF > makefile
# Makefile for world and support programs for Amiga
#
# Compiled with Manx 3.4a
#
# The program has been tested and compiles and runs properly on the
# following systems:
# 
# 1)  VAX/VMS Digital CC compiler. No particular tricks are needed.
# 2)  IBM PC-AT Xenix 1.00. It eems to be necessary to use the large
#     memory model, although I'm not sure why since it runs on the
#     same machine under DOS in the small model.
# 3)  IBM PC under Microsoft C version 4.00. It works in the default
#     small memory model if you compile with the -Os switch. Note
#     that on this setup you MUST link the main program World with
#     binmode.obj, provided by Microsoft, for it to work right.
#     Vtxtcn and vcnvrt must NOT be lined with binmode.obj.
#     This compiler generates a few harmless warning messages.
#     You may need to use EXEMOD to increase the stack size.
# 4)  VAX/4.3bsd Unix. No particular tricks needed.
#
# NOTE: Edit helper.c to adjust the pathname for q1text.dat for
# your particular system.
#

WHEADERS = arrays.h variab.h
WOBJS = demons.o helper.o motion.o parser.o verbs1.o verbs2.o world.o wbstuff.o
CSRC = demons.c helper.c motion.c parser.c verbs1.c verbs2.c world.c wbstuff.c
LNFLAGS = -o world -lm -lc
CFLAGS = +fi -DAMIGA
DEST = dh0:rec/world


all:	world


$(WOBJS): $(WHEADERS) convert


vtext.dat:
	join vtext.dat.aa vtext.dat.ab vtext.dat.ac AS vtext.dat 


convert:	vcnvrt vtxtcn vtext.dat
	@echo "creating data files..."
	vtxtcn
	vcnvrt
	@type nil: TO convert
# the 'type nil: to convert' stuff is a kludge.  Manx 'touch' won't create a
# file if it doesn't exist.

vtxtcn:	vtxtcn.o
	ln vtxtcn.o -lc

vcnvrt: vcnvrt.o
	ln vcnvrt.o -lc

zoo:  readme world world.info q1text.dat q1text.dat.info readme.info
	-delete world.zoo
	zoo a world world world.info q1text.dat README q1text.dat.info readme.info

zoosrc: readme $(CSRC) $(WHEADERS) vtext.dat.aa vtext.dat.ab vtext.dat.ac\
        vocab.dat vtxtcn.c vcnvrt.c 
	-delete worldsrc.zoo
	zoo a worldsrc $(CSRC) $(WHEADERS) vtext.dat.aa vtext.dat.ab vtext.dat.ac\
	     data.dat vocab.dat vtxtcn.c vcnvrt.c makefile.old makefile readme

clean:
	delete #?.o

install: 	world q1text.dat
	copy world $(DEST)
	copy q1text.dat $(DEST)
    copy world.info $(DEST)
	copy q1text.dat.info $(DEST)


world:	$(WOBJS) convert
	ln $(WOBJS) $(LNFLAGS) 
SHAR_EOF
cat << \SHAR_EOF > makefile.old
# Makefile for world and support programs for Unix
#
# The program has been tested and compiles and runs properly on the
# following systems:
# 
# 1)  VAX/VMS Digital CC compiler. No particular tricks are needed.
# 2)  IBM PC-AT Xenix 1.00. It seems to be necessary to use the large
#     memory model, although I'm not sure why since it runs on the
#     same machine under DOS in the small model.
# 3)  IBM PC under Microsoft C version 4.00. It works in the default
#     small memory model if you compile with the -Os switch. Note
#     that on this setup you MUST link the main program World with
#     binmode.obj, provided by Microsoft, for it to work right.
#     Vtxtcn and vcnvrt must NOT be linked with binmode.obj.
#     This compiler generates a few harmless warning messages.
#     You may need to use EXEMOD to increase the stack size.
# 4)  VAX/4.3bsd Unix. No particular tricks needed.
#
# NOTE: Edit helper.c to adjust the pathname for q1text.dat for
# your particular system.
#

WHEADERS = arrays.h variab.h
WOBJS = demons.o helper.o motion.o parser.o verbs1.o verbs2.o world.o
CFLAGS = -O

all:	world

install: 	world
	cp world /usr/games/world
	cp q1text.dat /usr/games/lib/q1text.dat

convert:	vcnvrt vtxtcn vtext.dat
	@echo "creating data files..."
	./vtxtcn
	./vcnvrt
	touch convert

vtext.dat:
	cat vtext.dat.aa vtext.dat.ab vtext.dat.ac >vtext.dat

vcnvrt:	vcnvrt.c
	cc $(CFLAGS) -o vcnvrt vcnvrt.c

vtxtcn:	vtxtcn.c
	cc $(CFLAGS) -o vtxtcn vtxtcn.c

world:	convert $(WOBJS) $(WHEADERS) 
	cc -s -o world $(WOBJS)
SHAR_EOF
cat << \SHAR_EOF > variab.h

  int horflg, wirelc[6], punct, three[3] ,eolflg ,lptr ,dotflg ,clause;  
  int zadjs[12], zobjs[12], ziadj, ziobj, zpdo, zpio, zactor, zadvrb;
  int zverb, znumb, zall, zbut;
  int wrdnum[30], wrdtyp[30], adverb, actor;
  int dobjs[30], iobj, doadjs[12], ioadj, prepdo, prepio;
  int numdo, butflg, allflg, turns, loc, oldloc, oldlc2, brfflg;
  int deadf, dirty, nonext ,spcloc;
  int fshlif, noshoe, daytim, martim ,marflg[9] ,oextim, rdietm;
  int rvtim, gvtim, eattim, easttm, filmtm, screef;
  int filmst, machst, fimage, dial1, dial2, dial1x, dial2x;
  int wwflag, kmax, xindnt, slflag, more, nomor, rmove, chgact;
  int eastsc, cactsc, diesc, bonus, jackpo, lpill, pbstat, decset;
  int raset, dcombi, chaset, chaser, guardl;
  char outst2[66];
  char inbuf[128];
SHAR_EOF
cat << \SHAR_EOF > vcnvrt.c
#include <stdio.h>

/* World C Version 1.00 copyright 1987 J.D.McDonald 
   Use as you like for non-commercial purposes, but please
   leave this note, and document any changes you make as yours */

int             three[3], vrbpdo[100], vrbpio[100], vrbobj[100];
int             pp1[15], pp2[15], pp3[8];
int             obloc[200], obw3[200];
int             obw4[200], obpprp[200], obimpr[200];
int             dispat[300];
char            chrbuf[81];
char            astr[2], bstr[2], cstr[3], dstr[7];
char            outstr[81], estr[8], fstr[7];
char            obnoun[1200], obadjv[1400];
char           *nounptr, *adjptr;

int             pnum, number, i, q, numx, vocdim, nvrbob, vocsz, m, q1;
int             loxx, loxxx, ppq1, ppq2, zz1, zz2, ttabsz, locat, qq1, qq2;
int             objmax, movmax, z, wt, size, value, floc, pprp, imprp;
int             iloc, cval, qqqq, ib;

FILE           *vocab_dat, *vocab_inc, *parame_inc, *verbtb_inc;
FILE           *data_dat, *trvtbl_inc, *locdat_inc, *objdat_inc;


main()
{

    astr[1] = 0;
    bstr[1] = 0;
    cstr[2] = 0;
    dstr[6] = 0;
    estr[7] = 0;
    fstr[6] = 0;
    obloc[0] = 0;
    obnoun[0] = 0;
    obadjv[0] = 0;
    obw3[0] = 0;
    obw4[0] = 0;
    obpprp[0] = 0;
    obimpr[0] = 0;
    dispat[0] = 0;
    vocab_dat = fopen("vocab.dat", "r");
    vocab_inc = fopen("vocab.inc", "w");
    parame_inc = fopen("parame.inc", "w");
    verbtb_inc = fopen("verbtb.inc", "w");
    fprintf(parame_inc, "#define ACTMAX     1\n");
    number = 0;
    pnum = 0;
lab110:
    for (i = 0; i < 81; i++)
	chrbuf[i] = ' ';
    if (fgets(chrbuf, 80, vocab_dat) == NULL)
	goto lab500;
    q = strlen(chrbuf) - 1;
    for (i = q; i < 80; i++)
	chrbuf[i] = ' ';
    if (chrbuf[0] == '*')
	goto lab110;
    if (chrbuf[0] < '0' || chrbuf[0] >= '9')
	goto lab111;
    numx = pnum + 1;
    if (chrbuf[0] == '1') {
	fprintf(parame_inc, "#define BUZMAX %5d\n", pnum);
	fprintf(parame_inc, "#define ADVMIN %5d\n", numx);
    } else if (chrbuf[0] == '2') {
	fprintf(parame_inc, "#define ADVMAX %5d\n", pnum);
	fprintf(parame_inc, "#define VRBMIN %5d\n", numx);
    } else if (chrbuf[0] == '3') {
	fprintf(parame_inc, "#define VRBMAX %5d\n", pnum);
	fprintf(parame_inc, "#define ADJMIN %5d\n", numx);
    } else if (chrbuf[0] == '4') {
	fprintf(parame_inc, "#define ADJMAX %5d\n", pnum);
	fprintf(parame_inc, "#define NUNMIN %5d\n", numx);
    } else if (chrbuf[0] == '5') {
	fprintf(parame_inc, "#define NUNMAX %5d\n", pnum);
	fprintf(parame_inc, "#define PRPMIN %5d\n", numx);
    } else if (chrbuf[0] == '6') {
	fprintf(parame_inc, "#define PRPMAX %5d\n", pnum);
    } else;

    if (chrbuf[0] != '6')
	goto lab110;
    goto lab500;
lab111:
    number += 1;
    if (chrbuf[0] == '+')
	goto lab110;
    pnum += 1;
    for (i = 0; i < 6; i++)
	outstr[i] = chrbuf[i];
    if (chrbuf[59] >= 'A' && chrbuf[59] <= 'Z') {
	for (i = 0; i < 6; i++)
	    outstr[i] = chrbuf[59 + i];
    }
    fprintf(parame_inc, "#define %6s %5d\n", outstr, pnum);
    goto lab110;
lab500:
    fprintf(parame_inc, "#define VOCMAX %5d\n", number);
    vocdim = number * 3;

    fseek(vocab_dat, 0l, 0);

    fprintf(vocab_inc, "    short vocab[%5d] = { 0 \n", vocdim + 1);
    nvrbob = 0;
lab600:
    fgets(chrbuf, 80, vocab_dat);
    q = strlen(chrbuf) - 1;
    for (i = q; i < 80; i++)
	chrbuf[i] = ' ';
    if (chrbuf[0] == '*')
	goto lab600;
    vocsz = 0;
lab820:
    if (fgets(chrbuf, 80, vocab_dat) == NULL)
	goto lab6000;
    q = strlen(chrbuf) - 1;
    for (i = q; i < 80; i++)
	chrbuf[i] = ' ';
    if (chrbuf[0] == '*')
	goto lab820;
    if (chrbuf[0] > '0' && chrbuf[0] < '9')
	goto lab820;
    m = 0;
    if (chrbuf[0] == '+')
	m = 1;
    cvt(&chrbuf[m]);
    if (m == 1)
	three[0] = -three[0];
    vocsz += 3;
    q1 = (q < 9) ? q : 9;	/* q1 = min (q,9)  */
    fprintf(vocab_inc, "  , %6d, %6d, %6d  /* %12.13s */\n", three[0],
	    three[1], three[2], chrbuf);
    if (chrbuf[15] == ' ')
	goto lab820;
    for (i = 0; i < 15; i++) {
	pp1[i] = chrbuf[i + 14] - '0';
	pp2[i] = chrbuf[i + 31] - '0';
    }
    for (i = 0; i < 8; i++)
	pp3[i] = chrbuf[i + 49] - '0';

    nvrbob += 1;
    vrbpdo[nvrbob] = 0;
    vrbpio[nvrbob] = 0;
    vrbobj[nvrbob] = 0;
    for (i = 0; i < 15; i++) {
	vrbpdo[nvrbob] = vrbpdo[nvrbob] * 2 + pp1[i];
	vrbpio[nvrbob] = vrbpio[nvrbob] * 2 + pp2[i];
    }
    for (i = 0; i < 8; i++)
	vrbobj[nvrbob] = vrbobj[nvrbob] * 2 + pp3[i];
    goto lab820;
lab6000:
    fprintf(verbtb_inc, "   short vrbpdo[ %3d ] = { 0 \n", nvrbob + 1);
    for (i = 1; i <= nvrbob; i++)
	fprintf(verbtb_inc,
		"   , %7d \n", vrbpdo[i]);
    fprintf(verbtb_inc, "   } ; \n");

    fprintf(verbtb_inc, "   short vrbpio[ %3d ] = { 0 \n", nvrbob + 1);
    for (i = 1; i <= nvrbob; i++)
	fprintf(verbtb_inc,
		"   , %7d \n", vrbpio[i]);
    fprintf(verbtb_inc, "   } ; \n");

    fprintf(verbtb_inc, "   short vrbobj[ %3d ] = { 0 \n", nvrbob + 1);
    for (i = 1; i <= nvrbob; i++)
	fprintf(verbtb_inc,
		"   , %7d \n", vrbobj[i]);
    fprintf(verbtb_inc, "   } ; \n");


    fprintf(vocab_inc, "  } ;  \n");
    fclose(vocab_dat);
    fclose(vocab_inc);
    fclose(verbtb_inc);

    data_dat = fopen("data.dat", "r");
    trvtbl_inc = fopen("trvtbl.inc", "w");
    locdat_inc = fopen("locdat.inc", "w");
    objdat_inc = fopen("objdat.inc", "w");

    ttabsz = 0;
    fprintf(trvtbl_inc, "  short trvtbl[] = { 0  \n");
lab1000:
    fgets(chrbuf, 80, data_dat);
    if (chrbuf[0] == '*')
	goto lab1000;
    locat = atoi(&chrbuf[1]);
    qq1 = atoi(&chrbuf[13]);
    qq2 = atoi(&chrbuf[16]);
    astr[0] = chrbuf[0];
    cstr[0] = chrbuf[8];
    cstr[1] = chrbuf[9];
    bstr[0] = chrbuf[11];
    if (locat == 9999)
	goto lab1200;
    ttabsz += 1;
    if (strcmp(cstr, "N ") == 0)
	ppq1 = 1;
    else if (strcmp(cstr, "NE") == 0)
	ppq1 = 2;
    else if (strcmp(cstr, "E ") == 0)
	ppq1 = 3;
    else if (strcmp(cstr, "SE") == 0)
	ppq1 = 4;
    else if (strcmp(cstr, "S ") == 0)
	ppq1 = 5;
    else if (strcmp(cstr, "SW") == 0)
	ppq1 = 6;
    else if (strcmp(cstr, "W ") == 0)
	ppq1 = 7;
    else if (strcmp(cstr, "NW") == 0)
	ppq1 = 8;
    else if (strcmp(cstr, "U ") == 0)
	ppq1 = 9;
    else if (strcmp(cstr, "D ") == 0)
	ppq1 = 10;
    else
	printf(" error in travel table\n");
    if (bstr[0] == 'C')
	ppq1 += 16;
    if (bstr[0] == 'S')
	ppq1 += 32;
    if (bstr[0] == 'Q')
	ppq1 += 64;
    ppq2 = 512 * qq1 + qq2;
    zz2 = ttabsz * 2;
    zz1 = zz2 - 1;
    {
	if (locat != 0) {
	    dispat[locat] = zz1;
	    loxx = locat;
	}
    }

    fprintf(trvtbl_inc, "  , %7d , %7d \n", ppq1, ppq2);

    goto lab1000;
lab1200:
    loxxx = loxx + 1;
    fprintf(trvtbl_inc, " } ;\n");
    fprintf(trvtbl_inc, " short dispat[] = { 0 \n");
    for (i = 1; i < loxxx; i++)
	fprintf(trvtbl_inc, "   , %5d \n", dispat[i]);
    fprintf(trvtbl_inc, "   , %5d }; \n", zz2 + 1);
    fprintf(parame_inc, "#define LOCNUM %5d \n", loxx);
    fprintf(parame_inc, "#define TTABSZ %5d \n", zz2);

    fclose(trvtbl_inc);

    fprintf(locdat_inc, "   short locdat[] = { 0 \n");

    while (1) {
	do
	    fgets(chrbuf, 80, data_dat);
	while (chrbuf[0] == '*');
	locat = atoi(&chrbuf[1]);
	if (locat == 9999)
	    break;
	ppq1 = atoi(&chrbuf[6]);
	fprintf(locdat_inc, "   , %6d \n", ppq1);
    }
    fprintf(locdat_inc, "  } ; \n");
    fclose(locdat_inc);

    objmax = 0;
    movmax = 0;
    nounptr = obnoun;
    adjptr = obadjv;

    while (1) {
	do
	    fgets(chrbuf, 80, data_dat);
	while (chrbuf[0] == '*');
	z = atoi(&chrbuf[1]);
	if (z == 9999)
	    break;
	for (i = 0; i < 6; i++)
	    *nounptr++ = chrbuf[i + 7];
	for (i = 0; i < 7; i++)
	    *adjptr++ = chrbuf[i + 16];
	wt = atoi(&chrbuf[24]);
	size = atoi(&chrbuf[30]);
	value = atoi(&chrbuf[36]);
	floc = atoi(&chrbuf[42]);
	pprp = atoi(&chrbuf[48]);
	imprp = atoi(&chrbuf[54]);
	iloc = atoi(&chrbuf[60]);
	cval = atoi(&chrbuf[66]);
	for (i = 0; i < 6; i++)
	    fstr[i] = chrbuf[i + 72];
	objmax += 1;
	movmax += 1;
	obw3[z] = wt * 256 + size;
	obw4[z] = value * 4096 + floc;
	obpprp[z] = pprp + 2048 * cval;
	obloc[z] = iloc;
	obimpr[z] = imprp;
	for (i = 0; i < 6; i++)
	    if (fstr[i] == '\n')
		fstr[i] = ' ';
	fprintf(parame_inc, "#define  %7.6s %5d\n", fstr, z);
    }

    while (1) {
	do
	    fgets(chrbuf, 80, data_dat);
	while (chrbuf[0] == '*');
	z = atoi(&chrbuf[1]);
	if (z == 9999)
	    break;
	for (i = 0; i < 6; i++)
	    *nounptr++ = chrbuf[i + 7];
	for (i = 0; i < 7; i++)
	    *adjptr++ = chrbuf[i + 16];
	objmax += 1;
	obw3[objmax] = atoi(&chrbuf[30]);
	obw4[objmax] = atoi(&chrbuf[42]);
	pprp = atoi(&chrbuf[48]);
	obimpr[objmax] = atoi(&chrbuf[54]);
	cval = atoi(&chrbuf[66]);
	for (i = 0; i < 6; i++)
	    fstr[i] = chrbuf[i + 72];
	for (i = 0; i < 6; i++)
	    if (fstr[i] == '\n')
		fstr[i] = ' ';
	obpprp[objmax] = pprp + 2048 * cval;

	fprintf(parame_inc, "#define  %7.6s %5d\n", fstr, objmax);
    }
    fclose(data_dat);

    fprintf(parame_inc, "#define OBJMAX %5d\n", objmax);
    fprintf(parame_inc, "#define MOVMAX %5d\n", movmax);
    fprintf(parame_inc, "#define OBJMX2 %5d\n", objmax + 1);
    fclose(parame_inc);

    fprintf(objdat_inc, "   short obloc[] = { 0 \n");
    for (i = 1; i <= movmax; i++) {
	qqqq = obloc[i];
	if (qqqq > 6000)
	    qqqq += movmax - 4000;
	fprintf(objdat_inc, "  , %7d \n", qqqq);
    }
    fprintf(objdat_inc, " } ;\n");

    fprintf(objdat_inc, "   short obw3[] = { 0 \n");
    for (i = 1; i <= objmax; i++) {
	fprintf(objdat_inc, "  , %7d \n", obw3[i]);
    }
    fprintf(objdat_inc, " } ;\n");

    fprintf(objdat_inc, "   short obw4[] = { 0 \n");
    for (i = 1; i <= objmax; i++) {
	fprintf(objdat_inc, "  , %7d \n", obw4[i]);
    }
    fprintf(objdat_inc, " } ;\n");

    fprintf(objdat_inc, "   short obpprp[] = { 0 \n");
    for (i = 1; i <= objmax; i++) {
	fprintf(objdat_inc, "  , %7d \n", obpprp[i]);
    }
    fprintf(objdat_inc, " } ;\n");

    fprintf(objdat_inc, "   short obimpr[] = { 0 \n");
    for (i = 1; i <= objmax; i++) {
	fprintf(objdat_inc, "  , %7d \n", obimpr[i]);
    }
    fprintf(objdat_inc, " } ;\n");

    nounptr = obnoun;
    fprintf(objdat_inc, "   short obnoun[] =  { 0 \n");
    for (i = 1; i <= objmax; i++) {
	for (ib = 0; ib < 6; ib++)
	    dstr[ib] = *nounptr++;
	fprintf(objdat_inc, "  , %7s \n", dstr);
    }
    fprintf(objdat_inc, " } ;\n");

    adjptr = obadjv;
    fprintf(objdat_inc, "   short obadjv[] = { 0 \n");
    for (i = 1; i <= objmax; i++) {
	for (ib = 0; ib < 7; ib++)
	    estr[ib] = *adjptr++;
	fprintf(objdat_inc, "  , %8s \n", estr);
    }
    fprintf(objdat_inc, " } ;\n");


    fclose(objdat_inc);

}


cvt(strptr)
    char           *strptr;
{
    int             ii, ij, k;

    for (ii = 0; ii < 3; ii++) {
	three[ii] = 0;
	for (ij = 0; ij < 3; ij++) {
	    k = *strptr++;
	    if (k == 45)
		k = 91;
	    k -= 64;
	    if (k < 1 || k > 27)
		k = 0;
	    three[ii] = three[ii] * 32 + k;
	}
    }
}
SHAR_EOF
cat << \SHAR_EOF > vtxtcn.c
#include <stdio.h>
/* World C Version 1.00 copyright 1987 J.D.McDonald 
   Use as you like for non-commercial purposes, but please
   leave this note, and document any changes you make as yours */

long            z, zbig, zsmall;
long            htext[2000];
int             gtext[5];
char            chrbuf[90];
FILE           *vtext_dat, *qtext_inc, *objdes_inc;
FILE           *gtext_inc;
int             q1text_dat;
short           packch;
int             i, u, kk, nold, size, number, nnmax, kq;
short           buffer[512];
int             bi;
main()
{

    vtext_dat = fopen("vtext.dat", "r");
    q1text_dat = creat("q1text.dat", 0600);
    qtext_inc = fopen("qtext.inc", "w");
    objdes_inc = fopen("objdes.inc", "w");

    fprintf(objdes_inc, " short odistb[] = { 0 \n");
    for (i = 0; i < 2000; i++)
	htext[i] = 0;
    z = 0;
    zbig = 0;
    zsmall = 0;
    u = 0;
    nold = 0;
    bi = 0;

    do {
	fgets(chrbuf, 80, vtext_dat);
	for (i = 0; i < 85; i++) {
	    if (chrbuf[i] == '\012' || chrbuf[i] == '\015' || chrbuf[i]
		== '\0')
		break;
	}
	size = i;
	for (i = size - 1; i > 3; i--) {
	    if (chrbuf[i] != ' ')
		break;
	}
	size = i + 1;
	if (size < 9) {
	    chrbuf[8] = ' ';
	    size = 9;
	}
	number = atoi(chrbuf);

	if (number != nold)
	    u += 1;
	if (number < 1001)
	    gtext[1] = u;
	if (number < 2001)
	    gtext[2] = u;
	if (number < 3001)
	    gtext[3] = u;
	if (number < 9999)
	    gtext[4] = u;
	if (number > 3000 && number < 3999) {
	    fprintf(objdes_inc, "  , %6d \n", u);
	    nnmax = number - 3000;
	} else if (number > 5000 && number < 5999) {
	    fprintf(objdes_inc, "   , %6d \n", u);
	} else;
	if (number != nold)
	    htext[u] = z;
	nold = number;
	chrbuf[size] = '{';
	for (i = size + 1; i < 90; i++)
	    chrbuf[i] = '}';
	for (i = 8; i < size; i++) {
	    if (chrbuf[i] == ' ')
		chrbuf[i] = '`';
	    if (chrbuf[i] == '.')
		chrbuf[i] = '|';
	}
	kk = 8;
	while (1) {
	    if (bi == 512)
		dump_buf();

	    if (chrbuf[kk] < '`' || chrbuf[kk + 1]
		< '`' || chrbuf[kk + 2] < '`') {
		packch = -(chrbuf[kk] + (chrbuf[kk + 1] << 8));
		buffer[bi] = packch;
		kk += 2;
		zbig++;
		bi++;
		z++;
		if (chrbuf[kk - 1] == '{' || chrbuf[kk - 2] == '{')
		    break;
	    } else {
		packch = (chrbuf[kk + 2] - 96) * 1024 + (chrbuf[kk + 1] - 96)
                    * 32 + chrbuf[kk] - 96;
		if ((packch & 0377) == 10 || ((packch >> 8) & 0377) == 10) {
		    packch = -(chrbuf[kk] + (chrbuf[kk + 1] << 8));
		    buffer[bi] = packch;
		    kk += 2;
		    zbig++;
		    bi++;
		    z++;
		    if (chrbuf[kk - 1] == '{' || chrbuf[kk - 2] == '{')
			break;
		} else {
		    buffer[bi] = packch;
		    kk += 3;
		    zsmall++;
		    bi++;
		    z++;
		    if (chrbuf[kk - 1] == '{' || chrbuf[kk - 2] == '{' ||
			chrbuf[kk - 3] == '{')
			break;
		}
	    }
	}
    } while (number != 9999);
    dump_buf();
    fprintf(objdes_inc, "  } ; \n");
    u = ((u + 2) / 3) * 3;
    fprintf(qtext_inc, "#define RTSIZE %6d \n", u + 1);
    fprintf(qtext_inc, " unsigned short rtext[] = { 0 \n");

    for (kk = 1; kk <= u / 3; kk++) {
	kq = (kk - 1) * 3;
	fprintf(qtext_inc, " , %5ld, %5ld, %5ld \n", htext[kq + 1],
		htext[kq + 2], htext[kq + 3]);
    }
    fprintf(qtext_inc, "  }; \n");

    fclose(vtext_dat);
    close(q1text_dat);
    fclose(qtext_inc);
    fclose(objdes_inc);
    gtext_inc = fopen("gtext.inc", "w");
    fprintf(gtext_inc, "  int gtext[5] = { 0, %6d, %6d, %6d, %6d };\n"
	    ,gtext[1], gtext[2], gtext[3], gtext[4]);
    fclose(gtext_inc);
    printf(" packed: %8ld unpacked: %8ld \n", zsmall, zbig);
}

dump_buf()
{
    write(q1text_dat, buffer, 512*sizeof(short));
    bi = 0;
}
SHAR_EOF
cat << \SHAR_EOF > wbstuff.c
#include "exec/types.h" 
#include "exec/memory.h" 
#include "exec/io.h"
#include "exec/libraries.h"
#include "exec/execbase.h"
#include "libraries/dos.h" 
#include "libraries/dosextens.h"
#include "workbench/startup.h"
#include "workbench/workbench.h"
#include <ctype.h>
#include <functions.h>

#define NOBUF 512

char Q1TEXT[80] =	"q1text.dat";
extern int q1text_dat;

struct FileHandle *tty;

char    obuf[NOBUF];    /* Output buffer        */
static char *ob = obuf;
int nobuf;              /* # of bytes in above      */

extern struct WBStartup *WBenchMsg;

struct Library *IconBase = NULL;

char WindowName[256] = "NEWCON:0/0/640/200/   World   ";

AmigaInit(argc,argv)
char *argv[]; 
{
   
   if(argc==0)
     getWbArgs(WBenchMsg);
   else
     getCLIargs(argc,argv);
}

getWbArgs(wbMsg)
struct WBStartup *wbMsg;
{
   struct WBArg  *wbArg;
   struct DiskObject *diskobj;
   char **toolarray;
   char *s;
   
   struct Lock *olddir;
   

   /* Defaults */

   wbArg = wbMsg->sm_ArgList;
   
   if((IconBase = OpenLibrary("icon.library", 0L)))
   {
      diskobj=(struct DiskObject *)GetDiskObject(wbArg->wa_Name);
      if(diskobj)
      {
         toolarray = (char **)diskobj->do_ToolTypes;

         if(s=(char *)FindToolType(toolarray,"WIN"))  strcpy(WindowName,s);
         FreeDiskObject(diskobj);
      }
      CloseLibrary(IconBase);
   }
   
   ttopen();

   if(wbMsg->sm_NumArgs > 1L)       /* use second arg as file instead */
   {                               /* of "q1text.dat" */
     wbArg++;
     
     if(wbArg->wa_Lock==NULL)
     {
       printf("Could not open file %s!\n",Q1TEXT);
       ttclose();
       _exit(20L);
     }
     
     olddir=CurrentDir(wbArg->wa_Lock);
     
     q1text_dat = open(Q1TEXT,0);    /* open data file */
     
     if(q1text_dat<0)
     {
       printf("Could not open file %s!\n",Q1TEXT);
       ttclose();
       _exit(20L);
     }
     
     CurrentDir(olddir);
     
   }
   else
   {
     q1text_dat = open(Q1TEXT,0);    /* open data file */
     
     if(q1text_dat<0)
     {
       printf("Could not open file %s!\n",Q1TEXT);
       ttclose();
       _exit(20L);
     }
   }
     
}

getCLIargs(argc,argv)
int argc;
char *argv[];
{
  int arg;
  int lace, newcon;
  
  lace=FALSE;
  newcon=TRUE;
  for(arg=1;arg<argc;arg++)
  {
    if(argv[arg][0]=='-')
    {
      switch(argv[arg][1])
      {
        case 'n':     /* use NEWCON: window */
          newcon=TRUE;
          break;
     
        case 'c':    /* use CON: window */
          newcon=FALSE;
          break;
           
        case 'i':    /* use 400 line interlaced window */
          lace=TRUE;
          break;
          
		case 'N':   /* use 200 line (non-interlaced) window */
		  lace=FALSE;
		  break;
             
        default:     /* ignore */
          ;

      }
    }
    else
    {
      strcpy(Q1TEXT,argv[arg]);        /* alternate name for data file */
    }
  }
     
   
  if(newcon && lace)
    strcpy(WindowName,"NEWCON:0/0/640/400/   WORLD   ");
  if(newcon && !lace)
    strcpy(WindowName,"NEWCON:0/0/640/200/   WORLD   ");
  if(!newcon && lace)
    strcpy(WindowName,"CON:0/0/640/400/   WORLD   ");
  if(!newcon && !lace)
    strcpy(WindowName,"CON:0/0/640/200/   WORLD   ");
  ttopen();
  
  q1text_dat = open(Q1TEXT,0);    /* open data file */
     
  if(q1text_dat<0)
  {
    printf("Could not open file %s!\n",Q1TEXT);
    ttclose();
    _exit(20L);
  }
}   

ttopen()
{
    
    nobuf=0;

    tty = Open(WindowName, MODE_NEWFILE);
    if (tty == NULL)
        exit(20);
}


ttclose()
{
    char t[256];
    
    printf("Press Return...");
    gets(t);
    if (tty != NULL) {
        ttflush();
        Close(tty);
    }
    tty = NULL;
}


getc()
{
    char c;
    int result;

    do
    {
        flush();
        result = Read(tty, &c, 1L);
    } while (result != 1);
    return (c & 0177);
}


flush()
{

    ttflush();
    Write(tty, obuf, (long) ob-obuf);
    ob = obuf;
}
/*
 * This function does the real work of
 * flushing out buffered I/O on the Amiga. All
 * we do is blast out the block with a write call.
 */


ttflush()
{
    if (nobuf > 0) {
        Write(tty, obuf, (long) nobuf);
        nobuf = 0;
    }
}




/*
 * Output a character.
 */
putc(c)
int c;
{
    if (ob >= &obuf[sizeof(obuf)])
        flush();

    if(c=='\n')
    {
      *ob++ = c;
      flush();
    }
    else
      *ob++ = c;
}
SHAR_EOF
cat << \SHAR_EOF > world.c

#include "parame.inc"
#include "variab.h"
#include "locdat.inc"
#include "objdat.inc"
#include "objdes.inc"
#include "gtext.inc"

/* World C Version 1.00 copyright 1987 J.D.McDonald 
   Use as you like for non-commercial purposes, but please
   leave this note, and document any changes you make as yours */

static int     i, xloc, mxscor, succes, mloc, ikk, verb, vretrn;
static int     scor, xretn, yretn, h, errflg;

main(argc,argv)
char *argv[];
{

#ifdef AMIGA
	AmigaInit(argc,argv);
#endif
    rdinit();
    wwflag = 0;
    nomor = 0;
    speak(29);
    linout(" ", 1);
    slflag = 0;
    speak(gtext[1] + 1);
    xindnt = 0;
    for (i = 0; i < 9; i++)
	marflg[i] = 0;
    for (i = 0; i < 6; i++)
	wirelc[i] = 0;
    brfflg = 1;
    deadf = 0;
    dirty = 0;
    turns = 0;
    more = 0;
    diesc = 0;
    horflg = 0;
    nonext = 0;
    screef = 0;
    spcloc = 0;
    oldloc = 1;
    oldlc2 = 1;
    loc = 1;
    xloc = 0;
    oextim = 0;
    rdietm = 0;
    rvtim = 0;
    gvtim = 0;
    eattim = 0;
    easttm = 0;
    filmtm = 0;
    filmst = 0;
    machst = 0;
    fimage = 0;
    dial1x = -1;
    dial2x = -1;
    dial1 = 0;
    dial2 = 0;
    eastsc = 0;
    cactsc = 0;
    mxscor = 450;
    bonus = 0;
    jackpo = 0;
    lpill = 0;
    pbstat = 0;
    dcombi = -1;
    chaset = 0;
    chaser = 0;
    fshlif = 8;
    noshoe = 8;
    guardl = 0;
    eolflg = 1;
    linout(" ", 1);
    /* the main command loop!!!!!  */

lab1:
    if (eolflg) {
	getln();
	dotflg = 0;
	clause = 1;
	actor = 1;
	lptr = 0;
    }
    succes = scan();
    if (!succes)
	eolflg = 1;
    if (!succes)
	goto lab1;
    succes = parse();
    clause += 1;
    if (!succes)
	eolflg = 1;
    if (!succes)
	goto lab1;
    errflg = 0;
    /******        for "tell someone" or "ask someone"  */

    if (actor != 1) {

	otheract();	/* perform verbs for other than player */


	timer(xloc);
	/* this goto is for permanent death due to radiation poisoning */

	{
	    if (rdietm == 50)
		goto lab9000;
	    nonext = 1;
	    goto lab3000;
	}
    }
    /******/




    verb = wrdnum[0];

    playerv();	/* this does all the verbs for player */


    if (errflg == 1)
	goto lab9000;
    if (errflg == 2)
	goto lab9990;
    {
	if (deadf && loc >= 153)
	    goto lab9000;
    }
    timer(xloc);
    /*
     * this goto is for permanent death due to radiation poisoning or death
     * in endgame 
     */

    {
	if (rdietm == 50 || (loc >= 153 && deadf))
	    goto lab9000;
    }
    h = 0;
    {
	if (loc != xloc) {
	    /* get out of any special locations (like on glass) */

	    if (!(loc == 187 || loc == 184 || (loc >= 175
					       && loc <= 181)))
		spcloc = 0;
	    if (wirelc[5] == 1000 || obloc[ZWIRE] == 1000)
		wdemon();
	    h = 1;
	}
    }
    /* announce new location  */

    {
	if (!nonext || (loc >= 7 && loc <= 11) ||
	    (loc >= 100 && loc <= 116)) {
	    linout(" ", 1);
	    if (loc >= 7 && loc <= 11)
		h = 1;
	    vlocat(0, h);
	}
	if (loc >= 26 && loc <= 51) {
	    linout(" ", 1);
	    mdemon();
	}
    }

    /* cat function */

lab3000:
    {
	if (obloc[ZCAT] == 1000 || (obloc[ZCAT] == (2000 + ZKNAPS) &&
			 (obloc[ZKNAPS] == 3000 || obloc[ZKNAPS] == loc))) {
	    if (loc == 149 && obloc[ZCART] == 0) {
		speak(290);
		obloc[ZCAT] = loc;
		obloc[ZCART] = loc;
	    } else if (obloc[ZCAT] == 2000 + ZKNAPS && obloc[ZKNAPS] == 3000
		       && pct(5)) {
		speak(287);
		obloc[ZCAT] = 1000;
	    } else if (pct(3))
		speak(288);
	    else if (pct(3))
		speak(289);
	}
    }
    /* robot activation */

    {
	if ((obimpr[RSLOT] & 8192) == 8192) {
	    obimpr[RSLOT] -= 8192;
	    if (obloc[ZCART] == 2000 + RSLOT)
		speak(310);
	    else
		speak(365);
	}
    }
    /* give bonus for reaching cygnus or deneb */

    {
	if (loc == 183) {
	    if ((locdat[183] & 16384) == 0) {
		speak(549);
		bonus += 5;
	    } else if (xloc != loc)
		speak(550);
	} else if (loc == 186) {
	    if ((locdat[186] & 16384) == 0)
		speak(547);
	    else if (xloc != loc)
		speak(548);
	} else if (loc == 190) {
	    speak(551);
	    bonus += 5;
	    goto lab9000;
	}
    }
    {
	if (loc == xloc && loc == 171) {
	    speak(557);
	    vdead();
	    goto lab9000;
	}
    }
    xloc = loc;
    turns += 1;
    nonext = 0;
    /* we have visited this location  */

    locdat[loc] |= 16384;
    linout(" ", 1);
    goto lab1;
lab9000:
    linout(" ", 1);
    scor = scorng() + bonus * 5;
    scorpt(scor, mxscor);
    goto lab9999;
lab9990:
    endsl();
lab9999:
#ifdef AMIGA
    ttclose();
#endif
}

/* end of main program  */


otheract()
{
    static int      actok;

    if (actor == MARTIA) {
	if (martim == 7 && loc >= 27 && loc <= 51)
	    speak(167);
	else
	    speak(168);
    } else if (actor == ROBOT) {
	{
	    if (chgact == 1)
		actok = 1;
	}
	/* test to see if robot can "hear"  */

	if (chgact == 1 && obloc[CCART] == (2000 + RSLOT) &&
	    (loc == 146 || obloc[ZROBOT] == loc)) {
	    speak(366);
	    actok = 0;
	} else if (chgact == 1 && !((loc == obloc[ZROBOT] ||
			   loc == 146) && obloc[ZCART] == (2000 + RSLOT))) {
	    speak(314);
	    actok = 0;
	} else if (chgact == 0 && actok == 0);
	else if (wrdnum[0] == GO) {
	    mloc = obloc[ZROBOT];
	    vgo();
	    {
		if (obloc[ZROBOT] == 90)
		    obimpr[ZROBOT] = 2257;
	    }
	    {
		if (rmove == 1 && (loc == mloc))
		    speak(316);
		else if (rmove == 1 && mloc != loc && obloc[ZROBOT] == loc)
		    speak(317);
		else if (rmove == 1 && loc == 146)
		    robdsc();
	    }
	    {
		if (obloc[ZROBOT] == 90) {
		    if (obloc[ZORCHI] == 2000 + ZROBOT)
			obloc[ZORCHI] = 0;
		    else if (obloc[ZFLYTR] == 2000 + ZROBOT)
			obloc[ZFLYTR] = 0;
		}
	    }
	} else if (wrdnum[0] == TAKE || wrdnum[0] == DROP ||
		   wrdnum[0] == PUT || wrdnum[0] == IS || wrdnum[0] ==
		   TRANSL || wrdnum[0] == WASH || wrdnum[0] == QWATER
		   || wrdnum[0] == HOLD || wrdnum[0] == GIVE)
	    vrobot();
	else
	    speak(315);
    } else if (actor == FERRET) {
	if (loc != 131 && loc != 99 && loc != 100)
	    speak(435);
	else
	    speak(436);
    } else if (actor == CACTUS) {
	if (loc != 82)
	    speak(437);
	else if (cactsc != 3)
	    speak(438);
	/* cactus freezing scree sclope */

	else if ((wrdnum[0] == HOLD || wrdnum[0] == FREEZE) &&
		 dobjs[0] == GRAVEL) {
	    screef = 4;
	    speak(441);
	} else
	    speak(237);
    } else if (actor == GUARD) {
	if (loc == guardl || loc == 171 || (chaset != 0 &&
					    chaset <= 9))
	    speak(562);
	else
	    speak(561);
    } else
	speak(251);
}

playerv()
{
    if (verb < TAKE) {
	vretrn = 1;
	{
	    if (verb == RUN)
		vretrn = vrun();
	    else if (verb == CRAWL)
		vretrn = vcrawl();
	    else if (verb == CROSS)
		vretrn = vcross();
	    else if (verb == JUMP)
		vretrn = vjump();
	    else if (verb == ASCEND) {
		prepdo = UP;
		vretrn = vclimb();
	    } else if (verb == DESCEN) {
		prepdo = DOWN;
		vretrn = vclimb();
	    } else if (verb == CLIMB)
		vretrn = vclimb();
	    else if (verb == SWIM)
		vretrn = vswim();
	}

	/*
	 * if vretrn=0, then the action is complete if vretrn=1, then a
	 * translation to "go" occured or the verb was actually "go" 
         */

	{
	    if (vretrn == 1)
		vgo();
	}
    } else if (verb == QUIT) {
	if (yesx(101))
	    errflg = 1;	/* out after scoring */

    } else if (verb == DAMN)
	dirty += 1;
    else if (verb == SUSPEN)
	if (chaset == 0)
	    vsuspe(0);
	else
	    speak(559);
    else if (verb == RESTOR) {
	if (vsuspe(1)) {
	    eolflg = 1;
	    nonext = 0;
	    actor = 1;
	    xloc = loc;
	}
    } else if (verb == BRIEF)
	brfflg = 1;
    else if (verb == VERBOS)
	brfflg = 2;
    else if (verb == SUPERB)
	brfflg = 0;
    else if (verb == QMORE)
	nomor = 0;
    else if (verb == NOMORE)
	nomor = 1;
    else if (verb == SCORE) {
	scor = scorng() + bonus * 5;
	scorpt(scor, mxscor);
    } else if (verb == HELP)
	vhelp();
    else if (verb == RETREA)
	vretre();
    else if (verb == PRAY) {
	if (!deadf || loc != 61)
	    speak(44);
	else {
	    deadf = 0;
	    speak(45);
	    nonext = 1;
	    noshoe = 8;
	}
    } else if (verb == DEBUG)
	dbg();
    else if (verb == LOCATE) {
	vlocat(1, 1);
	nonext = 1;
    } else if (!deadf) {
	if (verb == TAKE || verb == REMOVE || verb == CARRY ||
	    verb == HOLD)
	    vtake();
	else if (verb == DROP)
	    vdrop();
	else if (verb == THROW) {
	    if (!vthrow())
		vdrop();
	} else if (verb == SIT)
	    vsit();
	else if (verb == STAND)
	    vstand();
	else if (verb == GET) {
	    xretn = vget();
	    {
		if (xretn == 1)
		    vtake();
	    }
	} else if (verb == SHOOT)
	    vshoot();
	else if (verb == OPEN)
	    vopen();
	else if (verb == SHUT)
	    vshut();
	else if (verb == LAND || verb == ACTIVA)
	    vship();
	else if (verb == SCRATC)
	    vscrat();
	else if (verb == TRANSL)
	    speak(71);
	else if (verb == ATTACH)
	    vattac();
	else if (verb == POUR || verb == QWATER) {
	    if (vpour() == 1)
		vput();
	} else if (verb == WASH)
	    vwash();
	else if (verb == EAT)
	    veat();
	else if (verb == DRINK)
	    vdrink();
	else if (verb == FILL) {
	    if (vfill() == 1)
		vpour();
	} else if (verb == IGNITE)
	    speak(39);
	else if (verb == TURN)
	    vturn();
	else if (verb == READ)
	    vread();
	else if (verb == BREAK)
	    vbreak();
	else if (verb == FREEZE)
	    speak(442);
	else if (verb == PICK) {
	    xretn = vpick();
	    {
		if (xretn == 1)
		    vtake();
	    }
	} else if (verb == WEAR)
	    vwear();
	else if (verb == PUT) {
	    xretn = vput();
	    {
		if (xretn == 1)
		    vwear();
		if (xretn == 2)
		    vdrop();
		if (xretn == 3)
		    vpour();
	    }
	} else if (verb == LOCK || verb == UNLOCK)
	    vlocks();
	else if (verb == LOOK || verb == EXAMIN)
	    vlooks();
	else if (verb == PUSH || verb == KISS) {
	    {
		if (verb == KISS)
		    yretn = vkiss();
	    }
	    if (yretn == 1 || verb == PUSH) {
		xretn = vpush();
		/* oops! the nova button */

		if (xretn == 1)
		    errflg = 2;	/* instant out */

		else if (xretn > 1) {
		    bonus = xretn * 2;
		    {
			if (xretn < 5)
			    errflg = 1;	/* out after scoring */

		    }
		    /* change to the "endgame" */

		    scor = scorng();
		    bonus += scor / 5;
		    loc = 153;
		    oldloc = 0;
		    oldlc2 = 0;
		    {
			for (ikk = 1; ikk <= SCOIN; ikk++)
			    if (obloc[ikk] != 1000 && obloc[ikk] != 3000)
				obloc[ikk] = 0;
		    }
		    obloc[ZKNAPS] = 0;
		}
	    }
	} else if (verb == PUNCH) {
	    if (vpunch() == 1)
		vbreak();
	} else if (verb == ATTACK)
	    vattak();
	else if (verb == DIG)
	    vdig();
	else if (verb == GIVE || verb == FEED)
	    vgive();
	else if (verb == IS)
	    speak(467);
	else if (verb == FUCK) {
	    dirty += 1;
	    vfuck();
	} else if (loc == 127 && (verb == SHIT || verb == EXHALE
				  || verb == PISS)) {
	    loc = 126;
	    oldloc = 0;
	    oldlc2 = 0;
	    speak(312);
	} else if (verb == EXHALE)
	    speak(313);
	else if (verb == PISS) 
            vpiss();
	else if (verb == SHIT) 
            vshit();
	else if (verb == INVENT)
	    vinven();
	else;
    }
    else speak(46);

}
SHAR_EOF
#	End of shell archive
exit 0
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
Have five nice days.