initial commit

master
Shane Thomas 2013-12-07 07:44:23 -05:00
commit c7ef476c6b
44 changed files with 17633 additions and 0 deletions

120
Makefile Normal file
View File

@ -0,0 +1,120 @@
# Makefile for dungeon
# Where to install the program
BINDIR = /usr/games
# Where to install the data file
LIBDIR = /usr/games/lib
# The dungeon program provides a ``more'' facility which tries to
# figure out how many rows the terminal has. Several mechanisms are
# supported for determining this; the most common one has been left
# uncommented. If you have trouble, especially when linking, you may
# have to select a different option.
# more option 1: use the termcap routines. On some systems the LIBS
# variable may need to be set to -lcurses. On some it may need to
# be /usr/lib/termcap.o. These options are commented out below.
LIBS = -ltermcap
TERMFLAG =
# LIBS = -lcurses
# LIBS = /usr/lib/termcap.o
# more option 2: use the terminfo routines. On some systems the LIBS
# variable needs to be -lcursesX, but probably all such systems support
# the termcap routines (option 1) anyhow.
# LIBS = -lcurses
# TERMFLAG = -DMORE_TERMINFO
# more option 3: assume all terminals have 24 rows
# LIBS =
# TERMFLAG = -DMORE_24
# more option 4: don't use the more facility at all
# LIBS =
# TERMFLAG = -DMORE_NONE
# End of more options
# Uncomment the following line if you want to have access to the game
# debugging tool. This is invoked by typing "gdt". It is not much
# use except for debugging.
GDTFLAG = -DALLOW_GDT
# Compilation flags
CFLAGS = -O2 #-static
# On SCO Unix Development System 3.2.2a, the const type qualifier does
# not work correctly when using cc. The following line will cause it
# to not be used and should be uncommented.
# CFLAGS= -O -Dconst=
##################################################################
# Source files
CSRC = actors.c ballop.c clockr.c demons.c dgame.c dinit.c dmain.c\
dso1.c dso2.c dso3.c dso4.c dso5.c dso6.c dso7.c dsub.c dverb1.c\
dverb2.c gdt.c lightp.c local.c nobjs.c np.c np1.c np2.c np3.c\
nrooms.c objcts.c rooms.c sobjs.c supp.c sverbs.c verbs.c villns.c
# Object files
OBJS = actors.o ballop.o clockr.o demons.o dgame.o dinit.o dmain.o\
dso1.o dso2.o dso3.o dso4.o dso5.o dso6.o dso7.o dsub.o dverb1.o\
dverb2.o gdt.o lightp.o local.o nobjs.o np.o np1.o np2.o np3.o\
nrooms.o objcts.o rooms.o sobjs.o supp.o sverbs.o verbs.o villns.o
dungeon: $(OBJS) dtextc.dat
$(CC) $(CFLAGS) -o zork $(OBJS) $(LIBS)
install: zork dtextc.dat
cp zork $(BINDIR)
cp dtextc.dat $(LIBDIR)
clean:
rm -f $(OBJS) zork core dsave.dat *~
dtextc.dat:
cat dtextc.uu1 dtextc.uu2 dtextc.uu3 dtextc.uu4 | uudecode
dinit.o: dinit.c funcs.h vars.h
$(CC) $(CFLAGS) $(GDTFLAG) -DTEXTFILE=\"$(LIBDIR)/dtextc.dat\" -c dinit.c
dgame.o: dgame.c funcs.h vars.h
$(CC) $(CFLAGS) $(GDTFLAG) -c dgame.c
gdt.o: gdt.c funcs.h vars.h
$(CC) $(CFLAGS) $(GDTFLAG) -c gdt.c
local.o: local.c funcs.h vars.h
$(CC) $(CFLAGS) $(GDTFLAG) -c local.c
supp.o: supp.c funcs.h vars.h
$(CC) $(CFLAGS) $(TERMFLAG) -c supp.c
actors.o: funcs.h vars.h
ballop.o: funcs.h vars.h
clockr.o: funcs.h vars.h
demons.o: funcs.h vars.h
dmain.o: funcs.h vars.h
dso1.o: funcs.h vars.h
dso2.o: funcs.h vars.h
dso3.o: funcs.h vars.h
dso4.o: funcs.h vars.h
dso5.o: funcs.h vars.h
dso6.o: funcs.h vars.h
dso7.o: funcs.h vars.h
dsub.o: funcs.h vars.h
dverb1.o: funcs.h vars.h
dverb2.o: funcs.h vars.h
lightp.o: funcs.h vars.h
nobjs.o: funcs.h vars.h
np.o: funcs.h vars.h
np1.o: funcs.h vars.h parse.h
np2.o: funcs.h vars.h parse.h
np3.o: funcs.h vars.h parse.h
nrooms.o: funcs.h vars.h
objcts.o: funcs.h vars.h
rooms.o: funcs.h vars.h
sobjs.o: funcs.h vars.h
sverbs.o: funcs.h vars.h
verbs.o: funcs.h vars.h
villns.o: funcs.h vars.h

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# DUNGEON (Zork I)
Public Domain source code to the original DUNGEON game (Zork I). Released to the PD by Infocom. Includes
source files, headers, and information.
```
$ make
```

407
actors.c Normal file
View File

@ -0,0 +1,407 @@
/* AAPPLI- APPLICABLES FOR ADVENTURERS */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
logical aappli_(ri)
integer ri;
{
/* System generated locals */
logical ret_val;
/* Local variables */
logical f;
integer i;
if (ri == 0) {
goto L10;
}
/* !IF ZERO, NO APP. */
ret_val = TRUE_;
/* !ASSUME WINS. */
switch (ri) {
case 1: goto L1000;
case 2: goto L2000;
}
/* !BRANCH ON ADV. */
bug_(11, ri);
/* COMMON FALSE RETURN. */
L10:
ret_val = FALSE_;
return ret_val;
/* A1-- ROBOT. PROCESS MOST COMMANDS GIVEN TO ROBOT. */
L1000:
if (prsvec_1.prsa != vindex_1.raisew || prsvec_1.prso != oindex_1.rcage) {
goto L1200;
}
cevent_1.cflag[cindex_1.cevsph - 1] = FALSE_;
/* !ROBOT RAISED CAGE. */
play_1.winner = aindex_1.player;
/* !RESET FOR PLAYER. */
f = moveto_(rindex_1.cager, play_1.winner);
/* !MOVE TO NEW ROOM. */
newsta_(oindex_1.cage, 567, rindex_1.cager, 0, 0);
/* !INSTALL CAGE IN ROOM. */
newsta_(oindex_1.robot, 0, rindex_1.cager, 0, 0);
/* !INSTALL ROBOT IN ROOM. */
advs_1.aroom[aindex_1.arobot - 1] = rindex_1.cager;
/* !ALSO MOVE ROBOT/ADV. */
findex_1.cagesf = TRUE_;
/* !CAGE SOLVED. */
objcts_1.oflag1[oindex_1.robot - 1] &= ~ NDSCBT;
objcts_1.oflag1[oindex_1.spher - 1] |= TAKEBT;
return ret_val;
L1200:
if (prsvec_1.prsa != vindex_1.drinkw && prsvec_1.prsa != vindex_1.eatw) {
goto L1300;
}
rspeak_(568);
/* !EAT OR DRINK, JOKE. */
return ret_val;
L1300:
if (prsvec_1.prsa != vindex_1.readw) {
goto L1400;
}
/* !READ, */
rspeak_(569);
/* !JOKE. */
return ret_val;
L1400:
if (prsvec_1.prsa == vindex_1.walkw || prsvec_1.prsa == vindex_1.takew ||
prsvec_1.prsa == vindex_1.dropw || prsvec_1.prsa == vindex_1.putw
|| prsvec_1.prsa == vindex_1.pushw || prsvec_1.prsa ==
vindex_1.throww || prsvec_1.prsa == vindex_1.turnw ||
prsvec_1.prsa == vindex_1.leapw) {
goto L10;
}
rspeak_(570);
/* !JOKE. */
return ret_val;
/* AAPPLI, PAGE 3 */
/* A2-- MASTER. PROCESS MOST COMMANDS GIVEN TO MASTER. */
L2000:
if ((objcts_1.oflag2[oindex_1.qdoor - 1] & OPENBT) != 0) {
goto L2100;
}
rspeak_(783);
/* !NO MASTER YET. */
return ret_val;
L2100:
if (prsvec_1.prsa != vindex_1.walkw) {
goto L2200;
}
/* !WALK? */
i = 784;
/* !ASSUME WONT. */
if (play_1.here == rindex_1.scorr && (prsvec_1.prso == xsrch_1.xnorth ||
prsvec_1.prso == xsrch_1.xenter) || play_1.here == rindex_1.ncorr
&& (prsvec_1.prso == xsrch_1.xsouth || prsvec_1.prso ==
xsrch_1.xenter)) {
i = 785;
}
rspeak_(i);
return ret_val;
L2200:
if (prsvec_1.prsa == vindex_1.takew || prsvec_1.prsa == vindex_1.dropw ||
prsvec_1.prsa == vindex_1.putw || prsvec_1.prsa ==
vindex_1.throww || prsvec_1.prsa == vindex_1.pushw ||
prsvec_1.prsa == vindex_1.turnw || prsvec_1.prsa ==
vindex_1.spinw || prsvec_1.prsa == vindex_1.trntow ||
prsvec_1.prsa == vindex_1.follow || prsvec_1.prsa ==
vindex_1.stayw || prsvec_1.prsa == vindex_1.openw ||
prsvec_1.prsa == vindex_1.closew || prsvec_1.prsa ==
vindex_1.killw) {
goto L10;
}
rspeak_(786);
/* !MASTER CANT DO IT. */
return ret_val;
} /* aappli_ */
/* THIEFD- INTERMOVE THIEF DEMON */
/* DECLARATIONS */
void thiefd_()
{
/* System generated locals */
integer i__1, i__2;
/* Local variables */
integer i, j, nr;
logical once;
integer rhere;
/* !SET UP DETAIL FLAG. */
once = FALSE_;
/* !INIT FLAG. */
L1025:
rhere = objcts_1.oroom[oindex_1.thief - 1];
/* !VISIBLE POS. */
if (rhere != 0) {
hack_1.thfpos = rhere;
}
if (hack_1.thfpos == play_1.here) {
goto L1100;
}
/* !THIEF IN WIN RM? */
if (hack_1.thfpos != rindex_1.treas) {
goto L1400;
}
/* !THIEF NOT IN TREAS? */
/* THIEF IS IN TREASURE ROOM, AND WINNER IS NOT. */
if (rhere == 0) {
goto L1050;
}
/* !VISIBLE? */
newsta_(oindex_1.thief, 0, 0, 0, 0);
/* !YES, VANISH. */
rhere = 0;
if (qhere_(oindex_1.still, rindex_1.treas) || objcts_1.oadv[
oindex_1.still - 1] == -oindex_1.thief) {
newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
}
L1050:
i__1 = -oindex_1.thief;
i = robadv_(i__1, hack_1.thfpos, 0, 0);
/* !DROP VALUABLES. */
if (qhere_(oindex_1.egg, hack_1.thfpos)) {
objcts_1.oflag2[oindex_1.egg - 1] |= OPENBT;
}
goto L1700;
/* THIEF AND WINNER IN SAME ROOM. */
L1100:
if (hack_1.thfpos == rindex_1.treas) {
goto L1700;
}
/* !IF TREAS ROOM, NOTHING. */
if ((rooms_1.rflag[hack_1.thfpos - 1] & RLIGHT) != 0) {
goto L1400;
}
if (hack_1.thfflg) {
goto L1300;
}
/* !THIEF ANNOUNCED? */
if (rhere != 0 || prob_(70, 70)) {
goto L1150;
}
/* !IF INVIS AND 30%. */
if (objcts_1.ocan[oindex_1.still - 1] != oindex_1.thief) {
goto L1700;
}
/* !ABORT IF NO STILLETTO. */
newsta_(oindex_1.thief, 583, hack_1.thfpos, 0, 0);
/* !INSERT THIEF INTO ROOM. */
hack_1.thfflg = TRUE_;
/* !THIEF IS ANNOUNCED. */
return;
L1150:
if (rhere == 0 || (objcts_1.oflag2[oindex_1.thief - 1] & FITEBT)
== 0) {
goto L1200;
}
if (winnin_(oindex_1.thief, play_1.winner)) {
goto L1175;
}
/* !WINNING? */
newsta_(oindex_1.thief, 584, 0, 0, 0);
/* !NO, VANISH THIEF. */
objcts_1.oflag2[oindex_1.thief - 1] &= ~ FITEBT;
if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
oindex_1.still - 1] == -oindex_1.thief) {
newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
}
return;
L1175:
if (prob_(90, 90)) {
goto L1700;
}
/* !90% CHANCE TO STAY. */
L1200:
if (rhere == 0 || prob_(70, 70)) {
goto L1250;
}
/* !IF VISIBLE AND 30% */
newsta_(oindex_1.thief, 585, 0, 0, 0);
/* !VANISH THIEF. */
if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
oindex_1.still - 1] == -oindex_1.thief) {
newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
}
return;
L1300:
if (rhere == 0) {
goto L1700;
}
/* !ANNOUNCED. VISIBLE? */
L1250:
if (prob_(70, 70)) {
return;
}
/* !70% CHANCE TO DO NOTHING. */
hack_1.thfflg = TRUE_;
i__1 = -oindex_1.thief;
i__2 = -oindex_1.thief;
nr = robrm_(hack_1.thfpos, 100, 0, 0, i__1) + robadv_(
play_1.winner, 0, 0, i__2);
i = 586;
/* !ROBBED EM. */
if (rhere != 0) {
i = 588;
}
/* !WAS HE VISIBLE? */
if (nr != 0) {
++i;
}
/* !DID HE GET ANYTHING? */
newsta_(oindex_1.thief, i, 0, 0, 0);
/* !VANISH THIEF. */
if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
oindex_1.still - 1] == -oindex_1.thief) {
newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
}
if (nr != 0 && ! lit_(hack_1.thfpos)) {
rspeak_(406);
}
rhere = 0;
goto L1700;
/* !ONWARD. */
/* NOT IN ADVENTURERS ROOM. */
L1400:
newsta_(oindex_1.thief, 0, 0, 0, 0);
/* !VANISH. */
rhere = 0;
if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
oindex_1.still - 1] == -oindex_1.thief) {
newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
}
if ((rooms_1.rflag[hack_1.thfpos - 1] & RSEEN) == 0) {
goto L1700;
}
i__1 = -oindex_1.thief;
i = robrm_(hack_1.thfpos, 75, 0, 0, i__1);
/* !ROB ROOM 75%. */
if (hack_1.thfpos < rindex_1.maze1 || hack_1.thfpos > rindex_1.maz15 ||
play_1.here < rindex_1.maze1 || play_1.here > rindex_1.maz15) {
goto L1500;
}
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !BOTH IN MAZE. */
if (! qhere_(i, hack_1.thfpos) || prob_(60, 60) || (
objcts_1.oflag1[i - 1] & VISIBT + TAKEBT) !=
VISIBT + TAKEBT) {
goto L1450;
}
rspsub_(590, objcts_1.odesc2[i - 1]);
/* !TAKE OBJECT. */
if (prob_(40, 20)) {
goto L1700;
}
i__2 = -oindex_1.thief;
newsta_(i, 0, 0, 0, i__2);
/* !MOST OF THE TIME. */
objcts_1.oflag2[i - 1] |= TCHBT;
goto L1700;
L1450:
;
}
goto L1700;
L1500:
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !NOT IN MAZE. */
if (! qhere_(i, hack_1.thfpos) || objcts_1.otval[i - 1] != 0 ||
prob_(80, 60) || (objcts_1.oflag1[i - 1] &
VISIBT + TAKEBT) != VISIBT +
TAKEBT) {
goto L1550;
}
i__2 = -oindex_1.thief;
newsta_(i, 0, 0, 0, i__2);
objcts_1.oflag2[i - 1] |= TCHBT;
goto L1700;
L1550:
;
}
/* NOW MOVE TO NEW ROOM. */
L1700:
if (objcts_1.oadv[oindex_1.rope - 1] == -oindex_1.thief) {
findex_1.domef = FALSE_;
}
if (once) {
goto L1800;
}
once = ! once;
L1750:
--hack_1.thfpos;
/* !NEXT ROOM. */
if (hack_1.thfpos <= 0) {
hack_1.thfpos = rooms_1.rlnt;
}
if ((rooms_1.rflag[hack_1.thfpos - 1] & RLAND + RSACRD +
REND) != RLAND) {
goto L1750;
}
hack_1.thfflg = FALSE_;
/* !NOT ANNOUNCED. */
goto L1025;
/* !ONCE MORE. */
/* ALL DONE. */
L1800:
if (hack_1.thfpos == rindex_1.treas) {
return;
}
/* !IN TREASURE ROOM? */
j = 591;
/* !NO, DROP STUFF. */
if (hack_1.thfpos != play_1.here) {
j = 0;
}
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
if (objcts_1.oadv[i - 1] != -oindex_1.thief || prob_(70, 70)
|| objcts_1.otval[i - 1] > 0) {
goto L1850;
}
newsta_(i, j, hack_1.thfpos, 0, 0);
j = 0;
L1850:
;
}
return;
} /* thiefd_ */

138
ballop.c Normal file
View File

@ -0,0 +1,138 @@
/* BALLOP- BALLOON FUNCTION */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
logical ballop_(arg)
integer arg;
{
/* System generated locals */
logical ret_val;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (arg != 2) {
goto L200;
}
/* !READOUT? */
if (prsvec_1.prsa != vindex_1.lookw) {
goto L10;
}
/* !ONLY PROCESS LOOK. */
if (findex_1.binff != 0) {
goto L50;
}
/* !INFLATED? */
rspeak_(543);
/* !NO. */
goto L100;
L50:
rspsub_(544, objcts_1.odesc2[findex_1.binff - 1]);
/* !YES. */
L100:
if (findex_1.btief != 0) {
rspeak_(545);
}
/* !HOOKED? */
return ret_val;
L200:
if (arg != 1) {
goto L500;
}
/* !READIN? */
if (prsvec_1.prsa != vindex_1.walkw) {
goto L300;
}
/* !WALK? */
if (findxt_(prsvec_1.prso, play_1.here)) {
goto L250;
}
/* !VALID EXIT? */
rspeak_(546);
/* !NO, JOKE. */
return ret_val;
L250:
if (findex_1.btief == 0) {
goto L275;
}
/* !TIED UP? */
rspeak_(547);
/* !YES, JOKE. */
return ret_val;
L275:
if (curxt_1.xtype != xpars_1.xnorm) {
goto L10;
}
/* !NORMAL EXIT? */
if ((rooms_1.rflag[curxt_1.xroom1 - 1] & RMUNG) == 0) {
state_1.bloc = curxt_1.xroom1;
}
L10:
ret_val = FALSE_;
return ret_val;
L300:
if (prsvec_1.prsa != vindex_1.takew || prsvec_1.prso != findex_1.binff) {
goto L350;
}
rspsub_(548, objcts_1.odesc2[findex_1.binff - 1]);
/* !RECEP CONT TOO HOT. */
return ret_val;
L350:
if (prsvec_1.prsa != vindex_1.putw || prsvec_1.prsi != oindex_1.recep ||
qempty_(oindex_1.recep)) {
goto L10;
}
rspeak_(549);
return ret_val;
L500:
if (prsvec_1.prsa != vindex_1.unboaw || (rooms_1.rflag[play_1.here - 1] &
RLAND) == 0) {
goto L600;
}
if (findex_1.binff != 0) {
cevent_1.ctick[cindex_1.cevbal - 1] = 3;
}
/* !HE GOT OUT, START BALLOON. */
goto L10;
L600:
if (prsvec_1.prsa != vindex_1.burnw || objcts_1.ocan[prsvec_1.prso - 1] !=
oindex_1.recep) {
goto L700;
}
rspsub_(550, objcts_1.odesc2[prsvec_1.prso - 1]);
/* !LIGHT FIRE IN RECEP. */
cevent_1.ctick[cindex_1.cevbrn - 1] = objcts_1.osize[prsvec_1.prso - 1] *
20;
objcts_1.oflag1[prsvec_1.prso - 1] |= ONBT + FLAMBT +
LITEBT & ~ (TAKEBT + READBT);
if (findex_1.binff != 0) {
return ret_val;
}
if (! findex_1.blabf) {
newsta_(oindex_1.blabe, 0, 0, oindex_1.ballo, 0);
}
findex_1.blabf = TRUE_;
findex_1.binff = prsvec_1.prso;
cevent_1.ctick[cindex_1.cevbal - 1] = 3;
rspeak_(551);
return ret_val;
L700:
if (prsvec_1.prsa == vindex_1.unboaw && findex_1.binff != 0 && (
rooms_1.rflag[play_1.here - 1] & RLAND) != 0) {
cevent_1.ctick[cindex_1.cevbal - 1] = 3;
}
goto L10;
} /* ballop_ */

800
clockr.c Normal file
View File

@ -0,0 +1,800 @@
/* CEVAPP- CLOCK EVENT APPLICABLES */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
static void litint_ P((integer, integer *, integer, const integer *,
integer));
void cevapp_(ri)
integer ri;
{
/* Initialized data */
static const integer cndtck[10] = { 50,20,10,5,0,156,156,156,157,0 };
static const integer lmptck[12] = { 50,30,20,10,4,0,154,154,154,154,155,0 };
/* System generated locals */
integer i__1, i__2;
/* Local variables */
logical f;
integer i, j, bc, br;
if (ri == 0) {
return;
}
/* !IGNORE DISABLED. */
switch (ri) {
case 1: goto L1000;
case 2: goto L2000;
case 3: goto L3000;
case 4: goto L4000;
case 5: goto L5000;
case 6: goto L6000;
case 7: goto L7000;
case 8: goto L8000;
case 9: goto L9000;
case 10: goto L10000;
case 11: goto L11000;
case 12: goto L12000;
case 13: goto L13000;
case 14: goto L14000;
case 15: goto L15000;
case 16: goto L16000;
case 17: goto L17000;
case 18: goto L18000;
case 19: goto L19000;
case 20: goto L20000;
case 21: goto L21000;
case 22: goto L22000;
case 23: goto L23000;
case 24: goto L24000;
}
bug_(3, ri);
/* CEV1-- CURE CLOCK. LET PLAYER SLOWLY RECOVER. */
L1000:
/* Computing MIN */
i__1 = 0, i__2 = advs_1.astren[aindex_1.player - 1] + 1;
advs_1.astren[aindex_1.player - 1] = min(i__1,i__2);
/* !RECOVER. */
if (advs_1.astren[aindex_1.player - 1] >= 0) {
return;
}
/* !FULLY RECOVERED? */
cevent_1.ctick[cindex_1.cevcur - 1] = 30;
/* !NO, WAIT SOME MORE. */
return;
/* CEV2-- MAINT-ROOM WITH LEAK. RAISE THE WATER LEVEL. */
L2000:
if (play_1.here == rindex_1.maint) {
i__1 = findex_1.rvmnt / 2 + 71;
rspeak_(i__1);
}
/* !DESCRIBE. */
++findex_1.rvmnt;
/* !RAISE WATER LEVEL. */
if (findex_1.rvmnt <= 16) {
return;
}
/* !IF NOT FULL, EXIT. */
cevent_1.ctick[cindex_1.cevmnt - 1] = 0;
/* !FULL, DISABLE CLOCK. */
rooms_1.rflag[rindex_1.maint - 1] |= RMUNG;
rrand[rindex_1.maint - 1] = 80;
/* !SAY IT IS FULL OF WATER. */
if (play_1.here == rindex_1.maint) {
jigsup_(81);
}
/* !DROWN HIM IF PRESENT. */
return;
/* CEV3-- LANTERN. DESCRIBE GROWING DIMNESS. */
L3000:
litint_(oindex_1.lamp, &findex_1.orlamp, cindex_1.cevlnt, lmptck, 12);
/* !DO LIGHT INTERRUPT. */
return;
/* CEV4-- MATCH. OUT IT GOES. */
L4000:
rspeak_(153);
/* !MATCH IS OUT. */
objcts_1.oflag1[oindex_1.match - 1] &= ~ ONBT;
return;
/* CEV5-- CANDLE. DESCRIBE GROWING DIMNESS. */
L5000:
litint_(oindex_1.candl, &findex_1.orcand, cindex_1.cevcnd, cndtck, 10);
/* !DO CANDLE INTERRUPT. */
return;
/* CEVAPP, PAGE 3 */
/* CEV6-- BALLOON */
L6000:
cevent_1.ctick[cindex_1.cevbal - 1] = 3;
/* !RESCHEDULE INTERRUPT. */
f = advs_1.avehic[play_1.winner - 1] == oindex_1.ballo;
/* !SEE IF IN BALLOON. */
if (state_1.bloc == rindex_1.vlbot) {
goto L6800;
}
/* !AT BOTTOM? */
if (state_1.bloc == rindex_1.ledg2 || state_1.bloc == rindex_1.ledg3 ||
state_1.bloc == rindex_1.ledg4 || state_1.bloc == rindex_1.vlbot)
{
goto L6700;
}
/* !ON LEDGE? */
if ((objcts_1.oflag2[oindex_1.recep - 1] & OPENBT) != 0 &&
findex_1.binff != 0) {
goto L6500;
}
/* BALLOON IS IN MIDAIR AND IS DEFLATED (OR HAS RECEPTACLE CLOSED). */
/* FALL TO NEXT ROOM. */
if (state_1.bloc != rindex_1.vair1) {
goto L6300;
}
/* !IN VAIR1? */
state_1.bloc = rindex_1.vlbot;
/* !YES, NOW AT VLBOT. */
newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
if (f) {
goto L6200;
}
/* !IN BALLOON? */
if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
rspeak_(530);
}
/* !ON LEDGE, DESCRIBE. */
return;
L6200:
f = moveto_(state_1.bloc, play_1.winner);
/* !MOVE HIM. */
if (findex_1.binff == 0) {
goto L6250;
}
/* !IN BALLOON. INFLATED? */
rspeak_(531);
/* !YES, LANDED. */
f = rmdesc_(0);
/* !DESCRIBE. */
return;
L6250:
newsta_(oindex_1.ballo, 532, 0, 0, 0);
/* !NO, BALLOON & CONTENTS DIE. */
newsta_(oindex_1.dball, 0, state_1.bloc, 0, 0);
/* !INSERT DEAD BALLOON. */
advs_1.avehic[play_1.winner - 1] = 0;
/* !NOT IN VEHICLE. */
cevent_1.cflag[cindex_1.cevbal - 1] = FALSE_;
/* !DISABLE INTERRUPTS. */
cevent_1.cflag[cindex_1.cevbrn - 1] = FALSE_;
findex_1.binff = 0;
findex_1.btief = 0;
return;
L6300:
--state_1.bloc;
/* !NOT IN VAIR1, DESCEND. */
newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
if (f) {
goto L6400;
}
/* !IS HE IN BALLOON? */
if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
rspeak_(533);
}
/* !IF ON LEDGE, DESCRIBE. */
return;
L6400:
f = moveto_(state_1.bloc, play_1.winner);
/* !IN BALLOON, MOVE HIM. */
rspeak_(534);
/* !DESCRIBE. */
f = rmdesc_(0);
return;
/* BALLOON IS IN MIDAIR AND IS INFLATED, UP-UP-AND-AWAY */
/* ! */
L6500:
if (state_1.bloc != rindex_1.vair4) {
goto L6600;
}
/* !AT VAIR4? */
cevent_1.ctick[cindex_1.cevbrn - 1] = 0;
cevent_1.ctick[cindex_1.cevbal - 1] = 0;
findex_1.binff = 0;
findex_1.btief = 0;
state_1.bloc = rindex_1.vlbot;
/* !FALL TO BOTTOM. */
newsta_(oindex_1.ballo, 0, 0, 0, 0);
/* !BALLOON & CONTENTS DIE. */
newsta_(oindex_1.dball, 0, state_1.bloc, 0, 0);
/* !SUBSTITUTE DEAD BALLOON. */
if (f) {
goto L6550;
}
/* !WAS HE IN IT? */
if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
rspeak_(535);
}
/* !IF HE CAN SEE, DESCRIBE. */
return;
L6550:
jigsup_(536);
/* !IN BALLOON AT CRASH, DIE. */
return;
L6600:
++state_1.bloc;
/* !NOT AT VAIR4, GO UP. */
newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
if (f) {
goto L6650;
}
/* !IN BALLOON? */
if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
rspeak_(537);
}
/* !CAN HE SEE IT? */
return;
L6650:
f = moveto_(state_1.bloc, play_1.winner);
/* !MOVE PLAYER. */
rspeak_(538);
/* !DESCRIBE. */
f = rmdesc_(0);
return;
/* ON LEDGE, GOES TO MIDAIR ROOM WHETHER INFLATED OR NOT. */
L6700:
state_1.bloc += rindex_1.vair2 - rindex_1.ledg2;
/* !MOVE TO MIDAIR. */
newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
if (f) {
goto L6750;
}
/* !IN BALLOON? */
if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
rspeak_(539);
}
/* !NO, STRANDED. */
cevent_1.ctick[cindex_1.cevvlg - 1] = 10;
/* !MATERIALIZE GNOME. */
return;
L6750:
f = moveto_(state_1.bloc, play_1.winner);
/* !MOVE TO NEW ROOM. */
rspeak_(540);
/* !DESCRIBE. */
f = rmdesc_(0);
return;
/* AT BOTTOM, GO UP IF INFLATED, DO NOTHING IF DEFLATED. */
L6800:
if (findex_1.binff == 0 || ! ((objcts_1.oflag2[oindex_1.recep - 1] &
OPENBT) != 0)) {
return;
}
state_1.bloc = rindex_1.vair1;
/* !INFLATED AND OPEN, */
newsta_(oindex_1.ballo, 0, state_1.bloc, 0, 0);
/* !GO UP TO VAIR1. */
if (f) {
goto L6850;
}
/* !IN BALLOON? */
if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
rspeak_(541);
}
/* !IF CAN SEE, DESCRIBE. */
return;
L6850:
f = moveto_(state_1.bloc, play_1.winner);
/* !MOVE PLAYER. */
rspeak_(542);
f = rmdesc_(0);
return;
/* CEVAPP, PAGE 4 */
/* CEV7-- BALLOON BURNUP */
L7000:
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !FIND BURNING OBJECT */
if (oindex_1.recep == objcts_1.ocan[i - 1] && (objcts_1.oflag1[i - 1]
& FLAMBT) != 0) {
goto L7200;
}
/* L7100: */
}
bug_(4, 0);
L7200:
newsta_(i, 0, 0, 0, 0);
/* !VANISH OBJECT. */
findex_1.binff = 0;
/* !UNINFLATED. */
if (play_1.here == state_1.bloc) {
rspsub_(292, objcts_1.odesc2[i - 1]);
}
/* !DESCRIBE. */
return;
/* CEV8-- FUSE FUNCTION */
L8000:
if (objcts_1.ocan[oindex_1.fuse - 1] != oindex_1.brick) {
goto L8500;
}
/* !IGNITED BRICK? */
br = objcts_1.oroom[oindex_1.brick - 1];
/* !GET BRICK ROOM. */
bc = objcts_1.ocan[oindex_1.brick - 1];
/* !GET CONTAINER. */
if (br == 0 && bc != 0) {
br = objcts_1.oroom[bc - 1];
}
newsta_(oindex_1.fuse, 0, 0, 0, 0);
/* !KILL FUSE. */
newsta_(oindex_1.brick, 0, 0, 0, 0);
/* !KILL BRICK. */
if (br != 0 && br != play_1.here) {
goto L8100;
}
/* !BRICK ELSEWHERE? */
rooms_1.rflag[play_1.here - 1] |= RMUNG;
rrand[play_1.here - 1] = 114;
/* !MUNG ROOM. */
jigsup_(150);
/* !DEAD. */
return;
L8100:
rspeak_(151);
/* !BOOM. */
state_1.mungrm = br;
/* !SAVE ROOM THAT BLEW. */
cevent_1.ctick[cindex_1.cevsaf - 1] = 5;
/* !SET SAFE INTERRUPT. */
if (br != rindex_1.msafe) {
goto L8200;
}
/* !BLEW SAFE ROOM? */
if (bc != oindex_1.sslot) {
return;
}
/* !WAS BRICK IN SAFE? */
newsta_(oindex_1.sslot, 0, 0, 0, 0);
/* !KILL SLOT. */
objcts_1.oflag2[oindex_1.safe - 1] |= OPENBT;
findex_1.safef = TRUE_;
/* !INDICATE SAFE BLOWN. */
return;
L8200:
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !BLEW WRONG ROOM. */
if (qhere_(i, br) && (objcts_1.oflag1[i - 1] & TAKEBT) !=
0) {
newsta_(i, 0, 0, 0, 0);
}
/* L8250: */
}
if (br != rindex_1.lroom) {
return;
}
/* !BLEW LIVING ROOM? */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
if (objcts_1.ocan[i - 1] == oindex_1.tcase) {
newsta_(i, 0, 0, 0, 0);
}
/* !KILL TROPHY CASE. */
/* L8300: */
}
return;
L8500:
if (qhere_(oindex_1.fuse, play_1.here) || objcts_1.oadv[oindex_1.fuse -
1] == play_1.winner) {
rspeak_(152);
}
newsta_(oindex_1.fuse, 0, 0, 0, 0);
/* !KILL FUSE. */
return;
/* CEVAPP, PAGE 5 */
/* CEV9-- LEDGE MUNGE. */
L9000:
rooms_1.rflag[rindex_1.ledg4 - 1] |= RMUNG;
rrand[rindex_1.ledg4 - 1] = 109;
if (play_1.here == rindex_1.ledg4) {
goto L9100;
}
/* !WAS HE THERE? */
rspeak_(110);
/* !NO, NARROW ESCAPE. */
return;
L9100:
if (advs_1.avehic[play_1.winner - 1] != 0) {
goto L9200;
}
/* !IN VEHICLE? */
jigsup_(111);
/* !NO, DEAD. */
return;
L9200:
if (findex_1.btief != 0) {
goto L9300;
}
/* !TIED TO LEDGE? */
rspeak_(112);
/* !NO, NO PLACE TO LAND. */
return;
L9300:
state_1.bloc = rindex_1.vlbot;
/* !YES, CRASH BALLOON. */
newsta_(oindex_1.ballo, 0, 0, 0, 0);
/* !BALLOON & CONTENTS DIE. */
newsta_(oindex_1.dball, 0, state_1.bloc, 0, 0);
/* !INSERT DEAD BALLOON. */
findex_1.btief = 0;
findex_1.binff = 0;
cevent_1.cflag[cindex_1.cevbal - 1] = FALSE_;
cevent_1.cflag[cindex_1.cevbrn - 1] = FALSE_;
jigsup_(113);
/* !DEAD */
return;
/* CEV10-- SAFE MUNG. */
L10000:
rooms_1.rflag[state_1.mungrm - 1] |= RMUNG;
rrand[state_1.mungrm - 1] = 114;
if (play_1.here == state_1.mungrm) {
goto L10100;
}
/* !IS HE PRESENT? */
rspeak_(115);
/* !LET HIM KNOW. */
if (state_1.mungrm == rindex_1.msafe) {
cevent_1.ctick[cindex_1.cevled - 1] = 8;
}
/* !START LEDGE CLOCK. */
return;
L10100:
i = 116;
/* !HE'S DEAD, */
if ((rooms_1.rflag[play_1.here - 1] & RHOUSE) != 0) {
i = 117;
}
jigsup_(i);
/* !LET HIM KNOW. */
return;
/* CEVAPP, PAGE 6 */
/* CEV11-- VOLCANO GNOME */
L11000:
if (play_1.here == rindex_1.ledg2 || play_1.here == rindex_1.ledg3 ||
play_1.here == rindex_1.ledg4 || play_1.here == rindex_1.vlbot) {
goto L11100;
}
/* !IS HE ON LEDGE? */
cevent_1.ctick[cindex_1.cevvlg - 1] = 1;
/* !NO, WAIT A WHILE. */
return;
L11100:
newsta_(oindex_1.gnome, 118, play_1.here, 0, 0);
/* !YES, MATERIALIZE GNOME. */
return;
/* CEV12-- VOLCANO GNOME DISAPPEARS */
L12000:
newsta_(oindex_1.gnome, 149, 0, 0, 0);
/* !DISAPPEAR THE GNOME. */
return;
/* CEV13-- BUCKET. */
L13000:
if (objcts_1.ocan[oindex_1.water - 1] == oindex_1.bucke) {
newsta_(oindex_1.water, 0, 0, 0, 0);
}
return;
/* CEV14-- SPHERE. IF EXPIRES, HE'S TRAPPED. */
L14000:
rooms_1.rflag[rindex_1.cager - 1] |= RMUNG;
rrand[rindex_1.cager - 1] = 147;
jigsup_(148);
/* !MUNG PLAYER. */
return;
/* CEV15-- END GAME HERALD. */
L15000:
findex_1.endgmf = TRUE_;
/* !WE'RE IN ENDGAME. */
rspeak_(119);
/* !INFORM OF ENDGAME. */
return;
/* CEVAPP, PAGE 7 */
/* CEV16-- FOREST MURMURS */
L16000:
cevent_1.cflag[cindex_1.cevfor - 1] = play_1.here == rindex_1.mtree ||
play_1.here >= rindex_1.fore1 && play_1.here < rindex_1.clear;
if (cevent_1.cflag[cindex_1.cevfor - 1] && prob_(10, 10)) {
rspeak_(635);
}
return;
/* CEV17-- SCOL ALARM */
L17000:
if (play_1.here == rindex_1.bktwi) {
cevent_1.cflag[cindex_1.cevzgi - 1] = TRUE_;
}
/* !IF IN TWI, GNOME. */
if (play_1.here == rindex_1.bkvau) {
jigsup_(636);
}
/* !IF IN VAU, DEAD. */
return;
/* CEV18-- ENTER GNOME OF ZURICH */
L18000:
cevent_1.cflag[cindex_1.cevzgo - 1] = TRUE_;
/* !EXITS, TOO. */
newsta_(oindex_1.zgnom, 0, rindex_1.bktwi, 0, 0);
/* !PLACE IN TWI. */
if (play_1.here == rindex_1.bktwi) {
rspeak_(637);
}
/* !ANNOUNCE. */
return;
/* CEV19-- EXIT GNOME */
L19000:
newsta_(oindex_1.zgnom, 0, 0, 0, 0);
/* !VANISH. */
if (play_1.here == rindex_1.bktwi) {
rspeak_(638);
}
/* !ANNOUNCE. */
return;
/* CEVAPP, PAGE 8 */
/* CEV20-- START OF ENDGAME */
L20000:
if (findex_1.spellf) {
goto L20200;
}
/* !SPELL HIS WAY IN? */
if (play_1.here != rindex_1.crypt) {
return;
}
/* !NO, STILL IN TOMB? */
if (! lit_(play_1.here)) {
goto L20100;
}
/* !LIGHTS OFF? */
cevent_1.ctick[cindex_1.cevste - 1] = 3;
/* !RESCHEDULE. */
return;
L20100:
rspeak_(727);
/* !ANNOUNCE. */
L20200:
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !STRIP HIM OF OBJS. */
newsta_(i, 0, objcts_1.oroom[i - 1], objcts_1.ocan[i - 1],
0);
/* L20300: */
}
newsta_(oindex_1.lamp, 0, 0, 0, aindex_1.player);
/* !GIVE HIM LAMP. */
newsta_(oindex_1.sword, 0, 0, 0, aindex_1.player);
/* !GIVE HIM SWORD. */
objcts_1.oflag1[oindex_1.lamp - 1] = (objcts_1.oflag1[oindex_1.lamp - 1] |
LITEBT) & ~ ONBT;
objcts_1.oflag2[oindex_1.lamp - 1] |= TCHBT;
cevent_1.cflag[cindex_1.cevlnt - 1] = FALSE_;
/* !LAMP IS GOOD AS NEW. */
cevent_1.ctick[cindex_1.cevlnt - 1] = 350;
findex_1.orlamp = 0;
objcts_1.oflag2[oindex_1.sword - 1] |= TCHBT;
hack_1.swdact = TRUE_;
hack_1.swdsta = 0;
hack_1.thfact = FALSE_;
/* !THIEF GONE. */
findex_1.endgmf = TRUE_;
/* !ENDGAME RUNNING. */
cevent_1.cflag[cindex_1.cevmat - 1] = FALSE_;
/* !MATCHES GONE, */
cevent_1.cflag[cindex_1.cevcnd - 1] = FALSE_;
/* !CANDLES GONE. */
scrupd_(rooms_1.rval[rindex_1.crypt - 1]);
/* !SCORE CRYPT, */
rooms_1.rval[rindex_1.crypt - 1] = 0;
/* !BUT ONLY ONCE. */
f = moveto_(rindex_1.tstrs, play_1.winner);
/* !TO TOP OF STAIRS, */
f = rmdesc_(3);
/* !AND DESCRIBE. */
return;
/* !BAM */
/* ! */
/* CEV21-- MIRROR CLOSES. */
L21000:
findex_1.mrpshf = FALSE_;
/* !BUTTON IS OUT. */
findex_1.mropnf = FALSE_;
/* !MIRROR IS CLOSED. */
if (play_1.here == rindex_1.mrant) {
rspeak_(728);
}
/* !DESCRIBE BUTTON. */
if (play_1.here == rindex_1.inmir || mrhere_(play_1.here) == 1) {
rspeak_(729);
}
return;
/* CEVAPP, PAGE 9 */
/* CEV22-- DOOR CLOSES. */
L22000:
if (findex_1.wdopnf) {
rspeak_(730);
}
/* !DESCRIBE. */
findex_1.wdopnf = FALSE_;
/* !CLOSED. */
return;
/* CEV23-- INQUISITOR'S QUESTION */
L23000:
if (advs_1.aroom[aindex_1.player - 1] != rindex_1.fdoor) {
return;
}
/* !IF PLAYER LEFT, DIE. */
rspeak_(769);
i__1 = findex_1.quesno + 770;
rspeak_(i__1);
cevent_1.ctick[cindex_1.cevinq - 1] = 2;
return;
/* CEV24-- MASTER FOLLOWS */
L24000:
if (advs_1.aroom[aindex_1.amastr - 1] == play_1.here) {
return;
}
/* !NO MOVEMENT, DONE. */
if (play_1.here != rindex_1.cell && play_1.here != rindex_1.pcell) {
goto L24100;
}
if (findex_1.follwf) {
rspeak_(811);
}
/* !WONT GO TO CELLS. */
findex_1.follwf = FALSE_;
return;
L24100:
findex_1.follwf = TRUE_;
/* !FOLLOWING. */
i = 812;
/* !ASSUME CATCHES UP. */
i__1 = xsrch_1.xmax;
i__2 = xsrch_1.xmin;
for (j = xsrch_1.xmin; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
if (findxt_(j, advs_1.aroom[aindex_1.amastr - 1]) && curxt_1.xroom1
== play_1.here) {
i = 813;
}
/* L24200: */
}
rspeak_(i);
newsta_(oindex_1.master, 0, play_1.here, 0, 0);
/* !MOVE MASTER OBJECT. */
advs_1.aroom[aindex_1.amastr - 1] = play_1.here;
/* !MOVE MASTER PLAYER. */
return;
} /* cevapp_ */
/* LITINT- LIGHT INTERRUPT PROCESSOR */
/* DECLARATIONS */
static void litint_(obj, ctr, cev, ticks, tickln)
integer obj;
integer *ctr;
integer cev;
const integer *ticks;
integer tickln;
{
/* Parameter adjustments */
--ticks;
/* Function Body */
++(*ctr);
/* !ADVANCE STATE CNTR. */
cevent_1.ctick[cev - 1] = ticks[*ctr];
/* !RESET INTERRUPT. */
if (cevent_1.ctick[cev - 1] != 0) {
goto L100;
}
/* !EXPIRED? */
objcts_1.oflag1[obj - 1] &= ~ (LITEBT + FLAMBT +
ONBT);
if (objcts_1.oroom[obj - 1] == play_1.here || objcts_1.oadv[obj - 1] ==
play_1.winner) {
rspsub_(293, objcts_1.odesc2[obj - 1]);
}
return;
L100:
if (objcts_1.oroom[obj - 1] == play_1.here || objcts_1.oadv[obj - 1] ==
play_1.winner) {
rspeak_(ticks[*ctr + tickln / 2]);
}
return;
} /* litint_ */

601
demons.c Normal file
View File

@ -0,0 +1,601 @@
/* FIGHTD- INTERMOVE FIGHT DEMON */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
static logical infest_ P((integer));
void fightd_()
{
/* Initialized data */
const integer rout = 1;
/* System generated locals */
integer i__1, i__2;
/* Local variables */
logical f;
integer i, j, ra;
integer obj;
integer res;
integer out;
i__1 = vill_1.vlnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP THRU VILLAINS. */
vill_1.vopps[i - 1] = 0;
/* !CLEAR OPPONENT SLOT. */
obj = vill_1.villns[i - 1];
/* !GET OBJECT NO. */
ra = objcts_1.oactio[obj - 1];
/* !GET HIS ACTION. */
if (play_1.here != objcts_1.oroom[obj - 1]) {
goto L2200;
}
/* !ADVENTURER STILL HERE? */
if (obj == oindex_1.thief && findex_1.thfenf) {
goto L2400;
}
/* !THIEF ENGROSSED? */
if (objcts_1.ocapac[obj - 1] >= 0) {
goto L2050;
}
/* !YES, VILL AWAKE? */
if (vill_1.vprob[i - 1] == 0 || ! prob_(vill_1.vprob[i - 1],
vill_1.vprob[i - 1])) {
goto L2025;
}
objcts_1.ocapac[obj - 1] = (i__2 = objcts_1.ocapac[obj - 1], abs(i__2)
);
vill_1.vprob[i - 1] = 0;
if (ra == 0) {
goto L2400;
}
/* !ANYTHING TO DO? */
prsvec_1.prsa = vindex_1.inxw;
/* !YES, WAKE HIM UP. */
f = oappli_(ra, 0);
goto L2400;
/* !NOTHING ELSE HAPPENS. */
L2025:
vill_1.vprob[i - 1] += 10;
/* !INCREASE WAKEUP PROB. */
goto L2400;
/* !NOTHING ELSE. */
L2050:
if ((objcts_1.oflag2[obj - 1] & FITEBT) == 0) {
goto L2100;
}
vill_1.vopps[i - 1] = obj;
/* !FIGHTING, SET UP OPP. */
goto L2400;
L2100:
if (ra == 0) {
goto L2400;
}
/* !NOT FIGHTING, */
prsvec_1.prsa = vindex_1.frstqw;
/* !SET UP PROBABILITY */
if (! oappli_(ra, 0)) {
goto L2400;
}
/* !OF FIGHTING. */
objcts_1.oflag2[obj - 1] |= FITEBT;
vill_1.vopps[i - 1] = obj;
/* !SET UP OPP. */
goto L2400;
L2200:
if ((objcts_1.oflag2[obj - 1] & FITEBT) == 0 || ra == 0) {
goto L2300;
}
prsvec_1.prsa = vindex_1.fightw;
/* !HAVE A FIGHT. */
f = oappli_(ra, 0);
L2300:
if (obj == oindex_1.thief) {
findex_1.thfenf = FALSE_;
}
/* !TURN OFF ENGROSSED. */
advs_1.aflag[aindex_1.player - 1] &= ~ aflags_1.astag;
objcts_1.oflag2[obj - 1] &= ~ (STAGBT + FITEBT);
if (objcts_1.ocapac[obj - 1] >= 0 || ra == 0) {
goto L2400;
}
prsvec_1.prsa = vindex_1.inxw;
/* !WAKE HIM UP. */
f = oappli_(ra, 0);
objcts_1.ocapac[obj - 1] = (i__2 = objcts_1.ocapac[obj - 1], abs(i__2)
);
L2400:
;
}
/* FIGHTD, PAGE 3 */
/* NOW DO ACTUAL COUNTERBLOWS. */
out = 0;
/* !ASSUME HERO OK. */
L2600:
i__1 = vill_1.vlnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP THRU OPPS. */
j = vill_1.vopps[i - 1];
if (j == 0) {
goto L2700;
}
/* !SLOT EMPTY? */
prsvec_1.prscon = 1;
/* !STOP CMD STREAM. */
ra = objcts_1.oactio[j - 1];
if (ra == 0) {
goto L2650;
}
/* !VILLAIN ACTION? */
prsvec_1.prsa = vindex_1.fightw;
/* !SEE IF */
if (oappli_(ra, 0)) {
goto L2700;
}
/* !SPECIAL ACTION. */
L2650:
res = blow_(aindex_1.player, j, vill_1.vmelee[i - 1], 0, out);
/* !STRIKE BLOW. */
if (res < 0) {
return;
}
/* !IF HERO DEAD, EXIT. */
if (res == rout) {
out = rnd_(3) + 2;
}
/* !IF HERO OUT, SET FLG. */
L2700:
;
}
--out;
/* !DECREMENT OUT COUNT. */
if (out > 0) {
goto L2600;
}
/* !IF STILL OUT, GO AGAIN. */
return;
} /* fightd_ */
/* BLOW- STRIKE BLOW */
/* DECLARATIONS */
integer blow_(h, v, rmk, hflg, out)
integer h;
integer v;
integer rmk;
logical hflg;
integer out;
{
/* Initialized data */
const integer rmiss = 0;
const integer rout = 1;
const integer rkill = 2;
const integer rstag = 5;
const integer rlose = 6;
const integer rhes = 7;
const integer rsit = 8;
static const integer def1r[3] = { 1,2,3 };
static const integer def2r[4] = { 13,23,24,25 };
static const integer def3r[5] = { 35,36,46,47,57 };
static const integer rvectr[66] = { 0,0,0,0,5,5,1,1,2,2,2,2,0,0,0,0,0,5,
5,3,3,1,0,0,0,5,5,3,3,3,1,2,2,2,0,0,0,0,0,5,5,3,3,4,4,0,0,0,5,5,
3,3,3,4,4,4,0,5,5,3,3,3,3,4,4,4 };
static const integer rstate[45] = { 5000,3005,3008,4011,3015,3018,1021,
0,0,5022,3027,3030,4033,3037,3040,1043,0,0,4044,2048,4050,4054,
5058,4063,4067,3071,1074,4075,1079,4080,4084,4088,4092,4096,4100,
1104,4105,2109,4111,4115,4119,4123,4127,3131,3134 };
/* System generated locals */
integer ret_val, i__1, i__2;
/* Local variables */
logical f;
integer i, j, oa, ra, od, mi, dv, def;
integer tbl;
integer att, res;
integer dweap;
integer pblose;
ra = objcts_1.oactio[v - 1];
/* !GET VILLAIN ACTION, */
dv = objcts_1.odesc2[v - 1];
/* !DESCRIPTION. */
ret_val = rmiss;
/* !ASSUME NO RESULT. */
if (! (hflg)) {
goto L1000;
}
/* !HERO STRIKING BLOW? */
/* HERO IS ATTACKER, VILLAIN IS DEFENDER. */
pblose = 10;
/* !BAD LK PROB. */
objcts_1.oflag2[v - 1] |= FITEBT;
if ((advs_1.aflag[h - 1] & aflags_1.astag) == 0) {
goto L100;
}
rspeak_(591);
/* !YES, CANT FIGHT. */
advs_1.aflag[h - 1] &= ~ aflags_1.astag;
return ret_val;
L100:
att = fights_(h, 1);
/* !GET HIS STRENGTH. */
oa = att;
def = vilstr_(v);
/* !GET VILL STRENGTH. */
od = def;
dweap = 0;
/* !ASSUME NO WEAPON. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !SEARCH VILLAIN. */
if (objcts_1.ocan[i - 1] == v && (objcts_1.oflag2[i - 1] &
WEAPBT) != 0) {
dweap = i;
}
/* L200: */
}
if (v == advs_1.aobj[aindex_1.player - 1]) {
goto L300;
}
/* !KILLING SELF? */
if (def != 0) {
goto L2000;
}
/* !DEFENDER ALIVE? */
rspsub_(592, dv);
/* !VILLAIN DEAD. */
return ret_val;
L300:
jigsup_(593);
/* !KILLING SELF. */
return ret_val;
/* VILLAIN IS ATTACKER, HERO IS DEFENDER. */
L1000:
pblose = 50;
/* !BAD LK PROB. */
advs_1.aflag[h - 1] &= ~ aflags_1.astag;
if ((objcts_1.oflag2[v - 1] & STAGBT) == 0) {
goto L1200;
}
objcts_1.oflag2[v - 1] &= ~ STAGBT;
rspsub_(594, dv);
/* !DESCRIBE. */
return ret_val;
L1200:
att = vilstr_(v);
/* !SET UP ATT, DEF. */
oa = att;
def = fights_(h, 1);
if (def <= 0) {
return ret_val;
}
/* !DONT ALLOW DEAD DEF. */
od = fights_(h, 0);
dweap = (i__1 = fwim_(0, WEAPBT, 0, 0, h, 1),
abs(i__1));
/* !FIND A WEAPON. */
/* BLOW, PAGE 4 */
/* PARTIES ARE NOW EQUIPPED. DEF CANNOT BE ZERO. */
/* ATT MUST BE > 0. */
L2000:
if (def > 0) {
goto L2100;
}
/* !DEF ALIVE? */
res = rkill;
if (hflg) {
rspsub_(595, dv);
}
/* !DEADER. */
goto L3000;
L2100:
if ((i__1 = def - 2) < 0) {
goto L2200;
} else if (i__1 == 0) {
goto L2300;
} else {
goto L2400;
}
/* !DEF <2,=2,>2 */
L2200:
att = min(att,3);
/* !SCALE ATT. */
tbl = def1r[att - 1];
/* !CHOOSE TABLE. */
goto L2500;
L2300:
att = min(att,4);
/* !SCALE ATT. */
tbl = def2r[att - 1];
/* !CHOOSE TABLE. */
goto L2500;
L2400:
att -= def;
/* !SCALE ATT. */
/* Computing MIN */
i__1 = 2, i__2 = max(-2,att);
att = min(i__1,i__2) + 3;
tbl = def3r[att - 1];
L2500:
res = rvectr[tbl + rnd_(10) - 1];
/* !GET RESULT. */
if (out == 0) {
goto L2600;
}
/* !WAS HE OUT? */
if (res == rstag) {
goto L2550;
}
/* !YES, STAG--> HES. */
res = rsit;
/* !OTHERWISE, SITTING. */
goto L2600;
L2550:
res = rhes;
L2600:
if (res == rstag && dweap != 0 && prob_(25, pblose)) {
res = rlose;
}
mi = rstate[(rmk - 1) * 9 + res];
/* !CHOOSE TABLE ENTRY. */
if (mi == 0) {
goto L3000;
}
i__1 = mi / 1000;
i = mi % 1000 + rnd_(i__1) + star_1.mbase + 1;
j = dv;
if (! (hflg) && dweap != 0) {
j = objcts_1.odesc2[dweap - 1];
}
rspsub_(i, j);
/* !PRESENT RESULT. */
/* BLOW, PAGE 5 */
/* NOW APPLY RESULT */
L3000:
switch (res + 1) {
case 1: goto L4000;
case 2: goto L3100;
case 3: goto L3200;
case 4: goto L3300;
case 5: goto L3400;
case 6: goto L3500;
case 7: goto L3600;
case 8: goto L4000;
case 9: goto L3200;
}
L3100:
if (hflg) {
def = -def;
}
/* !UNCONSCIOUS. */
goto L4000;
L3200:
def = 0;
/* !KILLED OR SITTING DUCK. */
goto L4000;
L3300:
/* Computing MAX */
i__1 = 0, i__2 = def - 1;
def = max(i__1,i__2);
/* !LIGHT WOUND. */
goto L4000;
L3400:
/* Computing MAX */
i__1 = 0, i__2 = def - 2;
def = max(i__1,i__2);
/* !SERIOUS WOUND. */
goto L4000;
L3500:
if (hflg) {
goto L3550;
}
/* !STAGGERED. */
advs_1.aflag[h - 1] |= aflags_1.astag;
goto L4000;
L3550:
objcts_1.oflag2[v - 1] |= STAGBT;
goto L4000;
L3600:
newsta_(dweap, 0, play_1.here, 0, 0);
/* !LOSE WEAPON. */
dweap = 0;
if (hflg) {
goto L4000;
}
/* !IF HERO, DONE. */
dweap = (i__1 = fwim_(0, WEAPBT, 0, 0, h, 1),
abs(i__1));
/* !GET NEW. */
if (dweap != 0) {
rspsub_(605, objcts_1.odesc2[dweap - 1]);
}
/* BLOW, PAGE 6 */
L4000:
ret_val = res;
/* !RETURN RESULT. */
if (! (hflg)) {
goto L4500;
}
/* !HERO? */
objcts_1.ocapac[v - 1] = def;
/* !STORE NEW CAPACITY. */
if (def != 0) {
goto L4100;
}
/* !DEAD? */
objcts_1.oflag2[v - 1] &= ~ FITEBT;
rspsub_(572, dv);
/* !HE DIES. */
newsta_(v, 0, 0, 0, 0);
/* !MAKE HIM DISAPPEAR. */
if (ra == 0) {
return ret_val;
}
/* !IF NX TO DO, EXIT. */
prsvec_1.prsa = vindex_1.deadxw;
/* !LET HIM KNOW. */
f = oappli_(ra, 0);
return ret_val;
L4100:
if (res != rout || ra == 0) {
return ret_val;
}
prsvec_1.prsa = vindex_1.outxw;
/* !LET HIM BE OUT. */
f = oappli_(ra, 0);
return ret_val;
L4500:
advs_1.astren[h - 1] = -10000;
/* !ASSUME DEAD. */
if (def != 0) {
advs_1.astren[h - 1] = def - od;
}
if (def >= od) {
goto L4600;
}
cevent_1.ctick[cindex_1.cevcur - 1] = 30;
cevent_1.cflag[cindex_1.cevcur - 1] = TRUE_;
L4600:
if (fights_(h, 1) > 0) {
return ret_val;
}
advs_1.astren[h - 1] = 1 - fights_(h, 0);
/* !HE'S DEAD. */
jigsup_(596);
ret_val = -1;
return ret_val;
} /* blow_ */
/* SWORDD- SWORD INTERMOVE DEMON */
/* DECLARATIONS */
void swordd_()
{
/* System generated locals */
integer i__1, i__2;
/* Local variables */
integer i, ng;
if (objcts_1.oadv[oindex_1.sword - 1] != aindex_1.player) {
goto L500;
}
/* !HOLDING SWORD? */
ng = 2;
/* !ASSUME VILL CLOSE. */
if (infest_(play_1.here)) {
goto L300;
}
/* !VILL HERE? */
ng = 1;
i__1 = xsrch_1.xmax;
i__2 = xsrch_1.xmin;
for (i = xsrch_1.xmin; i__2 < 0 ? i >= i__1 : i <= i__1; i += i__2) {
/* !NO, SEARCH ROOMS. */
if (! findxt_(i, play_1.here)) {
goto L200;
}
/* !ROOM THAT WAY? */
switch (curxt_1.xtype) {
case 1: goto L50;
case 2: goto L200;
case 3: goto L50;
case 4: goto L50;
}
/* !SEE IF ROOM AT ALL. */
L50:
if (infest_(curxt_1.xroom1)) {
goto L300;
}
/* !CHECK ROOM. */
L200:
;
}
ng = 0;
/* !NO GLOW. */
L300:
if (ng == hack_1.swdsta) {
return;
}
/* !ANY STATE CHANGE? */
i__2 = ng + 495;
rspeak_(i__2);
/* !YES, TELL NEW STATE. */
hack_1.swdsta = ng;
return;
L500:
hack_1.swdact = FALSE_;
/* !DROPPED SWORD, */
return;
/* !DISABLE DEMON. */
} /* swordd_ */
/* INFEST- SUBROUTINE TO TEST FOR INFESTED ROOM */
/* DECLARATIONS */
static logical infest_(r)
integer r;
{
/* System generated locals */
logical ret_val;
if (! findex_1.endgmf) {
ret_val = objcts_1.oroom[oindex_1.cyclo - 1] == r || objcts_1.oroom[
oindex_1.troll - 1] == r || objcts_1.oroom[oindex_1.thief -
1] == r && hack_1.thfact;
}
else {
ret_val = r == rindex_1.mrg || r == rindex_1.mrge || r ==
rindex_1.mrgw || r == rindex_1.inmir && findex_1.mloc ==
rindex_1.mrg;
}
return ret_val;
} /* infest_ */

261
dgame.c Normal file
View File

@ -0,0 +1,261 @@
/* GAME- MAIN COMMAND LOOP FOR DUNGEON */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include "funcs.h"
#include "vars.h"
/* Do all systems have <string.h>? Don't use it, just in case */
extern int strcmp P((const char *, const char *));
static logical xvehic_ P((integer));
static void xendmv_ P((logical));
void game_()
{
/* Local variables */
logical f;
integer i;
/* START UP, DESCRIBE CURRENT LOCATION. */
rspeak_(1);
/* !WELCOME ABOARD. */
f = rmdesc_(3);
/* !START GAME. */
/* NOW LOOP, READING AND EXECUTING COMMANDS. */
L100:
play_1.winner = aindex_1.player;
/* !PLAYER MOVING. */
play_1.telflg = FALSE_;
/* !ASSUME NOTHING TOLD. */
if (prsvec_1.prscon <= 1) {
rdline_(input_1.inbuf, 1);
}
#ifdef ALLOW_GDT
if (strcmp(input_1.inbuf + prsvec_1.prscon - 1, "GDT") == 0) {
/* !CALL ON GDT? */
gdt_();
/* !YES, INVOKE. */
goto L100;
/* !ONWARD. */
}
#endif /* ALLOW_GDT */
++state_1.moves;
prsvec_1.prswon = parse_(input_1.inbuf, 1);
if (! prsvec_1.prswon) {
goto L400;
}
/* !PARSE LOSES? */
if (xvehic_(1)) {
goto L400;
}
/* !VEHICLE HANDLE? */
if (prsvec_1.prsa == vindex_1.tellw) {
goto L2000;
}
/* !TELL? */
L300:
if (prsvec_1.prso == oindex_1.valua || prsvec_1.prso == oindex_1.every) {
goto L900;
}
if (! vappli_(prsvec_1.prsa)) {
goto L400;
}
/* !VERB OK? */
L350:
if (! findex_1.echof && play_1.here == rindex_1.echor) {
goto L1000;
}
f = rappli_(rooms_1.ractio[play_1.here - 1]);
L400:
xendmv_(play_1.telflg);
/* !DO END OF MOVE. */
if (! lit_(play_1.here)) {
prsvec_1.prscon = 1;
}
goto L100;
L900:
valuac_(oindex_1.valua);
goto L350;
/* GAME, PAGE 3 */
/* SPECIAL CASE-- ECHO ROOM. */
/* IF INPUT IS NOT 'ECHO' OR A DIRECTION, JUST ECHO. */
L1000:
rdline_(input_1.inbuf, 0);
++state_1.moves;
/* !CHARGE FOR MOVES. */
if (strcmp(input_1.inbuf, "ECHO") != 0)
goto L1300;
rspeak_(571);
/* !KILL THE ECHO. */
findex_1.echof = TRUE_;
objcts_1.oflag2[oindex_1.bar - 1] &= ~ SCRDBT;
prsvec_1.prswon = TRUE_;
/* !FAKE OUT PARSER. */
prsvec_1.prscon = 1;
/* !FORCE NEW INPUT. */
goto L400;
L1300:
prsvec_1.prswon = parse_(input_1.inbuf, 0);
if (! prsvec_1.prswon || prsvec_1.prsa != vindex_1.walkw) {
goto L1400;
}
if (findxt_(prsvec_1.prso, play_1.here)) {
goto L300;
}
/* !VALID EXIT? */
L1400:
more_output(input_1.inbuf);
play_1.telflg = TRUE_;
/* !INDICATE OUTPUT. */
goto L1000;
/* !MORE ECHO ROOM. */
/* GAME, PAGE 4 */
/* SPECIAL CASE-- TELL <ACTOR>, NEW COMMAND */
/* NOTE THAT WE CANNOT BE IN THE ECHO ROOM. */
L2000:
if ((objcts_1.oflag2[prsvec_1.prso - 1] & ACTRBT) != 0) {
goto L2100;
}
rspeak_(602);
/* !CANT DO IT. */
goto L350;
/* !VAPPLI SUCCEEDS. */
L2100:
play_1.winner = oactor_(prsvec_1.prso);
/* !NEW PLAYER. */
play_1.here = advs_1.aroom[play_1.winner - 1];
/* !NEW LOCATION. */
if (prsvec_1.prscon <= 1) {
goto L2700;
}
/* !ANY INPUT? */
if (parse_(input_1.inbuf, 1)) {
goto L2150;
}
L2700:
i = 341;
/* !FAILS. */
if (play_1.telflg) {
i = 604;
}
/* !GIVE RESPONSE. */
rspeak_(i);
L2600:
play_1.winner = aindex_1.player;
/* !RESTORE STATE. */
play_1.here = advs_1.aroom[play_1.winner - 1];
goto L350;
L2150:
if (aappli_(advs_1.aactio[play_1.winner - 1])) {
goto L2400;
}
/* !ACTOR HANDLE? */
if (xvehic_(1)) {
goto L2400;
}
/* !VEHICLE HANDLE? */
if (prsvec_1.prso == oindex_1.valua || prsvec_1.prso == oindex_1.every) {
goto L2900;
}
if (! vappli_(prsvec_1.prsa)) {
goto L2400;
}
/* !VERB HANDLE? */
/* L2350: */
f = rappli_(rooms_1.ractio[play_1.here - 1]);
L2400:
xendmv_(play_1.telflg);
/* !DO END OF MOVE. */
goto L2600;
/* !DONE. */
L2900:
valuac_(oindex_1.valua);
/* !ALL OR VALUABLES. */
goto L350;
} /* game_ */
/* XENDMV- EXECUTE END OF MOVE FUNCTIONS. */
/* DECLARATIONS */
static void xendmv_(flag)
logical flag;
{
/* Local variables */
logical f;
if (! (flag)) {
rspeak_(341);
}
/* !DEFAULT REMARK. */
if (hack_1.thfact) {
thiefd_();
}
/* !THIEF DEMON. */
if (prsvec_1.prswon) {
fightd_();
}
/* !FIGHT DEMON. */
if (hack_1.swdact) {
swordd_();
}
/* !SWORD DEMON. */
if (prsvec_1.prswon) {
f = clockd_();
}
/* !CLOCK DEMON. */
if (prsvec_1.prswon) {
f = xvehic_(2);
}
/* !VEHICLE READOUT. */
} /* xendmv_ */
/* XVEHIC- EXECUTE VEHICLE FUNCTION */
/* DECLARATIONS */
static logical xvehic_(n)
integer n;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer av;
ret_val = FALSE_;
/* !ASSUME LOSES. */
av = advs_1.avehic[play_1.winner - 1];
/* !GET VEHICLE. */
if (av != 0) {
ret_val = oappli_(objcts_1.oactio[av - 1], n);
}
return ret_val;
} /* xvehic_ */

465
dinit.c Normal file
View File

@ -0,0 +1,465 @@
/* INIT-- DUNGEON INITIALIZATION SUBROUTINE */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#ifdef __AMOS__
#include <amos.h>
#endif
#include "funcs.h"
#include "vars.h"
/* This is here to avoid depending on the existence of <stdlib.h> */
extern void srand P((unsigned int));
FILE *dbfile;
#ifndef TEXTFILE
#ifdef __AMOS__
#define TEXTFILE "lib:dtextc.dat"
#else /* ! __AMOS__ */
#ifdef unix
#define TEXTFILE "/usr/games/lib/dunlib/dtextc.dat"
#else /* ! unix */
I need a definition for TEXTFILE
#endif /* ! unix */
#endif /* ! __AMOS__ */
#endif /* ! TEXTFILE */
#ifndef LOCALTEXTFILE
#define LOCALTEXTFILE "dtextc.dat"
#endif
/* Read a single two byte integer from the index file */
#define rdint(indxfile) \
(ch = getc(indxfile), \
((ch > 127) ? (ch - 256) : (ch)) * 256 + getc(indxfile))
/* Read a number of two byte integers from the index file */
static void rdints(c, pi, indxfile)
integer c;
integer *pi;
FILE *indxfile;
{
integer ch; /* Local variable for rdint */
while (c-- != 0)
*pi++ = rdint(indxfile);
}
/* Read a partial array of integers. These are stored as index,value
* pairs.
*/
static void rdpartialints(c, pi, indxfile)
integer c;
integer *pi;
FILE *indxfile;
{
integer ch; /* Local variable for rdint */
while (1) {
int i;
if (c < 255) {
i = getc(indxfile);
if (i == 255)
return;
}
else {
i = rdint(indxfile);
if (i == -1)
return;
}
pi[i] = rdint(indxfile);
}
}
/* Read a number of one byte flags from the index file */
static void rdflags(c, pf, indxfile)
integer c;
logical *pf;
FILE *indxfile;
{
while (c-- != 0)
*pf++ = getc(indxfile);
}
logical init_()
{
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer xmax, r2max, dirmax, recno;
integer i, j, k;
register integer ch;
register FILE *indxfile;
integer mmax, omax, rmax, vmax, amax, cmax, fmax, smax;
more_init();
/* FIRST CHECK FOR PROTECTION VIOLATION */
if (protected()) {
goto L10000;
}
/* !PROTECTION VIOLATION? */
more_output("There appears before you a threatening figure clad all over");
more_output("in heavy black armor. His legs seem like the massive trunk");
more_output("of the oak tree. His broad shoulders and helmeted head loom");
more_output("high over your own puny frame, and you realize that his powerful");
more_output("arms could easily crush the very life from your body. There");
more_output("hangs from his belt a veritable arsenal of deadly weapons:");
more_output("sword, mace, ball and chain, dagger, lance, and trident.");
more_output("He speaks with a commanding voice:");
more_output("");
more_output(" \"You shall not pass.\"");
more_output("");
more_output("As he grabs you by the neck all grows dim about you.");
exit_();
/* NOW START INITIALIZATION PROPER */
L10000:
ret_val = FALSE_;
/* !ASSUME INIT FAILS. */
mmax = 1050;
/* !SET UP ARRAY LIMITS. */
omax = 220;
rmax = 200;
vmax = 4;
amax = 4;
cmax = 25;
fmax = 46;
smax = 22;
xmax = 900;
r2max = 20;
dirmax = 15;
rmsg_1.mlnt = 0;
/* !INIT ARRAY COUNTERS. */
objcts_1.olnt = 0;
rooms_1.rlnt = 0;
vill_1.vlnt = 0;
advs_1.alnt = 0;
cevent_1.clnt = 0;
exits_1.xlnt = 1;
oroom2_1.r2lnt = 0;
state_1.ltshft = 10;
/* !SET UP STATE VARIABLES. */
state_1.mxscor = state_1.ltshft;
state_1.egscor = 0;
state_1.egmxsc = 0;
state_1.mxload = 100;
state_1.rwscor = 0;
state_1.deaths = 0;
state_1.moves = 0;
time_1.pltime = 0;
state_1.mungrm = 0;
state_1.hs = 0;
prsvec_1.prsa = 0;
/* !CLEAR PARSE VECTOR. */
prsvec_1.prsi = 0;
prsvec_1.prso = 0;
prsvec_1.prscon = 1;
orphs_1.oflag = 0;
/* !CLEAR ORPHANS. */
orphs_1.oact = 0;
orphs_1.oslot = 0;
orphs_1.oprep = 0;
orphs_1.oname = 0;
hack_1.thfflg = FALSE_;
/* !THIEF NOT INTRODUCED BUT */
hack_1.thfact = TRUE_;
/* !IS ACTIVE. */
hack_1.swdact = FALSE_;
/* !SWORD IS INACTIVE. */
hack_1.swdsta = 0;
/* !SWORD IS OFF. */
recno = 1;
/* !INIT DB FILE POINTER. */
star_1.mbase = 0;
/* !INIT MELEE BASE. */
/* INIT, PAGE 3 */
/* INIT ALL ARRAYS. */
i__1 = cmax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR CLOCK EVENTS */
cevent_1.cflag[i - 1] = FALSE_;
cevent_1.ctick[i - 1] = 0;
cevent_1.cactio[i - 1] = 0;
/* L5: */
}
i__1 = fmax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR FLAGS. */
flags[i - 1] = FALSE_;
/* L10: */
}
findex_1.buoyf = TRUE_;
/* !SOME START AS TRUE. */
findex_1.egyptf = TRUE_;
findex_1.cagetf = TRUE_;
findex_1.mr1f = TRUE_;
findex_1.mr2f = TRUE_;
findex_1.follwf = TRUE_;
i__1 = smax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR SWITCHES. */
switch_[i - 1] = 0;
/* L12: */
}
findex_1.ormtch = 4;
/* !NUMBER OF MATCHES. */
findex_1.lcell = 1;
findex_1.pnumb = 1;
findex_1.mdir = 270;
findex_1.mloc = rindex_1.mrb;
findex_1.cphere = 10;
i__1 = r2max;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR ROOM 2 ARRAY. */
oroom2_1.rroom2[i - 1] = 0;
oroom2_1.oroom2[i - 1] = 0;
/* L15: */
}
i__1 = xmax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR TRAVEL ARRAY. */
exits_1.travel[i - 1] = 0;
/* L20: */
}
i__1 = vmax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR VILLAINS ARRAYS. */
vill_1.vopps[i - 1] = 0;
vill_1.vprob[i - 1] = 0;
vill_1.villns[i - 1] = 0;
vill_1.vbest[i - 1] = 0;
vill_1.vmelee[i - 1] = 0;
/* L30: */
}
i__1 = omax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR OBJECT ARRAYS. */
objcts_1.odesc1[i - 1] = 0;
objcts_1.odesc2[i - 1] = 0;
objcts_1.odesco[i - 1] = 0;
objcts_1.oread[i - 1] = 0;
objcts_1.oactio[i - 1] = 0;
objcts_1.oflag1[i - 1] = 0;
objcts_1.oflag2[i - 1] = 0;
objcts_1.ofval[i - 1] = 0;
objcts_1.otval[i - 1] = 0;
objcts_1.osize[i - 1] = 0;
objcts_1.ocapac[i - 1] = 0;
objcts_1.ocan[i - 1] = 0;
objcts_1.oadv[i - 1] = 0;
objcts_1.oroom[i - 1] = 0;
/* L40: */
}
i__1 = rmax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR ROOM ARRAYS. */
rooms_1.rdesc1[i - 1] = 0;
rooms_1.rdesc2[i - 1] = 0;
rooms_1.ractio[i - 1] = 0;
rooms_1.rflag[i - 1] = 0;
rooms_1.rval[i - 1] = 0;
rooms_1.rexit[i - 1] = 0;
/* L50: */
}
i__1 = mmax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR MESSAGE DIRECTORY. */
rmsg_1.rtext[i - 1] = 0;
/* L60: */
}
i__1 = amax;
for (i = 1; i <= i__1; ++i) {
/* !CLEAR ADVENTURER'S ARRAYS. */
advs_1.aroom[i - 1] = 0;
advs_1.ascore[i - 1] = 0;
advs_1.avehic[i - 1] = 0;
advs_1.aobj[i - 1] = 0;
advs_1.aactio[i - 1] = 0;
advs_1.astren[i - 1] = 0;
advs_1.aflag[i - 1] = 0;
/* L70: */
}
debug_1.dbgflg = 0;
debug_1.prsflg = 0;
debug_1.gdtflg = 0;
#ifdef ALLOW_GDT
/* allow setting gdtflg true if user id matches wizard id */
/* this way, the wizard doesn't have to recompile to use gdt */
if (wizard()) {
debug_1.gdtflg = 1;
}
#endif /* ALLOW_GDT */
screen_1.fromdr = 0;
/* !INIT SCOL GOODIES. */
screen_1.scolrm = 0;
screen_1.scolac = 0;
/* INIT, PAGE 4 */
/* NOW RESTORE FROM EXISTING INDEX FILE. */
#ifdef __AMOS__
if ((dbfile = fdopen(ropen(LOCALTEXTFILE, 0), BINREAD)) == NULL &&
(dbfile = fdopen(ropen(TEXTFILE, 0), BINREAD)) == NULL)
#else
if ((dbfile = fopen(LOCALTEXTFILE, BINREAD)) == NULL &&
(dbfile = fopen(TEXTFILE, BINREAD)) == NULL)
#endif
goto L1950;
indxfile = dbfile;
i = rdint(indxfile);
j = rdint(indxfile);
k = rdint(indxfile);
/* !GET VERSION. */
if (i != vers_1.vmaj || j != vers_1.vmin) {
goto L1925;
}
state_1.mxscor = rdint(indxfile);
star_1.strbit = rdint(indxfile);
state_1.egmxsc = rdint(indxfile);
rooms_1.rlnt = rdint(indxfile);
rdints(rooms_1.rlnt, &rooms_1.rdesc1[0], indxfile);
rdints(rooms_1.rlnt, &rooms_1.rdesc2[0], indxfile);
rdints(rooms_1.rlnt, &rooms_1.rexit[0], indxfile);
rdpartialints(rooms_1.rlnt, &rooms_1.ractio[0], indxfile);
rdpartialints(rooms_1.rlnt, &rooms_1.rval[0], indxfile);
rdints(rooms_1.rlnt, &rooms_1.rflag[0], indxfile);
exits_1.xlnt = rdint(indxfile);
rdints(exits_1.xlnt, &exits_1.travel[0], indxfile);
objcts_1.olnt = rdint(indxfile);
rdints(objcts_1.olnt, &objcts_1.odesc1[0], indxfile);
rdints(objcts_1.olnt, &objcts_1.odesc2[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.odesco[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.oactio[0], indxfile);
rdints(objcts_1.olnt, &objcts_1.oflag1[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.oflag2[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.ofval[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.otval[0], indxfile);
rdints(objcts_1.olnt, &objcts_1.osize[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.ocapac[0], indxfile);
rdints(objcts_1.olnt, &objcts_1.oroom[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.oadv[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.ocan[0], indxfile);
rdpartialints(objcts_1.olnt, &objcts_1.oread[0], indxfile);
oroom2_1.r2lnt = rdint(indxfile);
rdints(oroom2_1.r2lnt, &oroom2_1.oroom2[0], indxfile);
rdints(oroom2_1.r2lnt, &oroom2_1.rroom2[0], indxfile);
cevent_1.clnt = rdint(indxfile);
rdints(cevent_1.clnt, &cevent_1.ctick[0], indxfile);
rdints(cevent_1.clnt, &cevent_1.cactio[0], indxfile);
rdflags(cevent_1.clnt, &cevent_1.cflag[0], indxfile);
vill_1.vlnt = rdint(indxfile);
rdints(vill_1.vlnt, &vill_1.villns[0], indxfile);
rdpartialints(vill_1.vlnt, &vill_1.vprob[0], indxfile);
rdpartialints(vill_1.vlnt, &vill_1.vopps[0], indxfile);
rdints(vill_1.vlnt, &vill_1.vbest[0], indxfile);
rdints(vill_1.vlnt, &vill_1.vmelee[0], indxfile);
advs_1.alnt = rdint(indxfile);
rdints(advs_1.alnt, &advs_1.aroom[0], indxfile);
rdpartialints(advs_1.alnt, &advs_1.ascore[0], indxfile);
rdpartialints(advs_1.alnt, &advs_1.avehic[0], indxfile);
rdints(advs_1.alnt, &advs_1.aobj[0], indxfile);
rdints(advs_1.alnt, &advs_1.aactio[0], indxfile);
rdints(advs_1.alnt, &advs_1.astren[0], indxfile);
rdpartialints(advs_1.alnt, &advs_1.aflag[0], indxfile);
star_1.mbase = rdint(indxfile);
rmsg_1.mlnt = rdint(indxfile);
rdints(rmsg_1.mlnt, &rmsg_1.rtext[0], indxfile);
/* Save location of start of message text */
rmsg_1.mrloc = ftell(indxfile);
/* !INIT DONE. */
/* INIT, PAGE 5 */
/* THE INTERNAL DATA BASE IS NOW ESTABLISHED. */
/* SET UP TO PLAY THE GAME. */
itime_(&time_1.shour, &time_1.smin, &time_1.ssec);
/* srand(time_1.shour ^ (time_1.smin ^ time_1.ssec)); */
play_1.winner = aindex_1.player;
last_1.lastit = advs_1.aobj[aindex_1.player - 1];
play_1.here = advs_1.aroom[play_1.winner - 1];
hack_1.thfpos = objcts_1.oroom[oindex_1.thief - 1];
state_1.bloc = objcts_1.oroom[oindex_1.ballo - 1];
ret_val = TRUE_;
return ret_val;
/* INIT, PAGE 6 */
/* ERRORS-- INIT FAILS. */
L1925:
more_output(NULL);
printf("%s is version %1d.%1d%c.\n", TEXTFILE, i, j, k);
more_output(NULL);
printf("I require version %1d.%1d%c.\n", vers_1.vmaj, vers_1.vmin,
vers_1.vedit);
goto L1975;
L1950:
more_output(NULL);
printf("I can't open %s.\n", TEXTFILE);
L1975:
more_output("Suddenly a sinister, wraithlike figure appears before you,");
more_output("seeming to float in the air. In a low, sorrowful voice he says,");
more_output("\"Alas, the very nature of the world has changed, and the dungeon");
more_output("cannot be found. All must now pass away.\" Raising his oaken staff");
more_output("in farewell, he fades into the spreading darkness. In his place");
more_output("appears a tastefully lettered sign reading:");
more_output("");
more_output(" INITIALIZATION FAILURE");
more_output("");
more_output("The darkness becomes all encompassing, and your vision fails.");
return ret_val;
} /* init_ */

26
dmain.c Normal file
View File

@ -0,0 +1,26 @@
/* DUNGEON-- MAIN PROGRAM */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#define EXTERN
#define INIT
#include "funcs.h"
#include "vars.h"
void main(argc, argv)
int argc;
char **argv;
{
/* 1) INITIALIZE DATA STRUCTURES */
/* 2) PLAY GAME */
if (init_()) {
game_();
}
/* !IF INIT, PLAY GAME. */
exit_();
/* !DONE */
} /* MAIN__ */

181
dso1.c Normal file
View File

@ -0,0 +1,181 @@
/* PRINCR- PRINT CONTENTS OF ROOM */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
void princr_(full, rm)
logical full;
integer rm;
{
/* System generated locals */
integer i__1, i__2;
/* Local variables */
integer i, j, k;
j = 329;
/* !ASSUME SUPERBRIEF FORMAT. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP ON OBJECTS */
if (! qhere_(i, rm) || (objcts_1.oflag1[i - 1] & VISIBT +
NDSCBT) != VISIBT || i == advs_1.avehic[
play_1.winner - 1]) {
goto L500;
}
if (! (full) && (findex_1.superf || findex_1.brieff && (
rooms_1.rflag[play_1.here - 1] & RSEEN) != 0)) {
goto L200;
}
/* DO LONG DESCRIPTION OF OBJECT. */
k = objcts_1.odesco[i - 1];
/* !GET UNTOUCHED. */
if (k == 0 || (objcts_1.oflag2[i - 1] & TCHBT) != 0) {
k = objcts_1.odesc1[i - 1];
}
rspeak_(k);
/* !DESCRIBE. */
goto L500;
/* DO SHORT DESCRIPTION OF OBJECT. */
L200:
rspsub_(j, objcts_1.odesc2[i - 1]);
/* !YOU CAN SEE IT. */
j = 502;
L500:
;
}
/* NOW LOOP TO PRINT CONTENTS OF OBJECTS IN ROOM. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP ON OBJECTS. */
if (! qhere_(i, rm) || (objcts_1.oflag1[i - 1] & VISIBT +
NDSCBT) != VISIBT) {
goto L1000;
}
if ((objcts_1.oflag2[i - 1] & ACTRBT) != 0) {
i__2 = oactor_(i);
invent_(i__2);
}
if ((objcts_1.oflag1[i - 1] & TRANBT) == 0 && (
objcts_1.oflag2[i - 1] & OPENBT) == 0 || qempty_(i))
{
goto L1000;
}
/* OBJECT IS NOT EMPTY AND IS OPEN OR TRANSPARENT. */
j = 573;
if (i != oindex_1.tcase) {
goto L600;
}
/* !TROPHY CASE? */
j = 574;
if ((findex_1.brieff || findex_1.superf) && ! (full)) {
goto L1000;
}
L600:
princo_(i, j);
/* !PRINT CONTENTS. */
L1000:
;
}
} /* princr_ */
/* INVENT- PRINT CONTENTS OF ADVENTURER */
/* DECLARATIONS */
void invent_(adv)
integer adv;
{
/* System generated locals */
integer i__1;
/* Local variables */
integer i, j;
i = 575;
/* !FIRST LINE. */
if (adv != aindex_1.player) {
i = 576;
}
/* !IF NOT ME. */
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
/* !LOOP */
if (objcts_1.oadv[j - 1] != adv || (objcts_1.oflag1[j - 1] &
VISIBT) == 0) {
goto L10;
}
rspsub_(i, objcts_1.odesc2[advs_1.aobj[adv - 1] - 1]);
i = 0;
rspsub_(502, objcts_1.odesc2[j - 1]);
L10:
;
}
if (i == 0) {
goto L25;
}
/* !ANY OBJECTS? */
if (adv == aindex_1.player) {
rspeak_(578);
}
/* !NO, TELL HIM. */
return;
L25:
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
/* !LOOP. */
if (objcts_1.oadv[j - 1] != adv || (objcts_1.oflag1[j - 1] &
VISIBT) == 0 || (objcts_1.oflag1[j - 1] &
TRANBT) == 0 && (objcts_1.oflag2[j - 1] &
OPENBT) == 0) {
goto L100;
}
if (! qempty_(j)) {
princo_(j, 573);
}
/* !IF NOT EMPTY, LIST. */
L100:
;
}
} /* invent_ */
/* PRINCO- PRINT CONTENTS OF OBJECT */
/* DECLARATIONS */
void princo_(obj, desc)
integer obj;
integer desc;
{
/* System generated locals */
integer i__1;
/* Local variables */
integer i;
rspsub_(desc, objcts_1.odesc2[obj - 1]);
/* !PRINT HEADER. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP THRU. */
if (objcts_1.ocan[i - 1] == obj) {
rspsub_(502, objcts_1.odesc2[i - 1]);
}
/* L100: */
}
} /* princo_ */

188
dso2.c Normal file
View File

@ -0,0 +1,188 @@
/* MOVETO- MOVE PLAYER TO NEW ROOM */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include "funcs.h"
#include "vars.h"
logical moveto_(nr, who)
integer nr;
integer who;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer j;
logical lhr;
logical lnr, nlv;
integer bits;
ret_val = FALSE_;
/* !ASSUME FAILS. */
lhr = (rooms_1.rflag[play_1.here - 1] & RLAND) != 0;
lnr = (rooms_1.rflag[nr - 1] & RLAND) != 0;
j = advs_1.avehic[who - 1];
/* !HIS VEHICLE */
if (j != 0) {
goto L100;
}
/* !IN VEHICLE? */
if (lnr) {
goto L500;
}
/* !NO, GOING TO LAND? */
rspeak_(427);
/* !CAN'T GO WITHOUT VEHICLE. */
return ret_val;
L100:
bits = 0;
/* !ASSUME NOWHERE. */
if (j == oindex_1.rboat) {
bits = RWATER;
}
/* !IN BOAT? */
if (j == oindex_1.ballo) {
bits = RAIR;
}
/* !IN BALLOON? */
if (j == oindex_1.bucke) {
bits = RBUCK;
}
/* !IN BUCKET? */
nlv = (rooms_1.rflag[nr - 1] & bits) == 0;
if (! lnr && nlv || lnr && lhr && nlv && bits != RLAND) {
goto L800;
}
L500:
ret_val = TRUE_;
/* !MOVE SHOULD SUCCEED. */
if ((rooms_1.rflag[nr - 1] & RMUNG) == 0) {
goto L600;
}
rspeak_(rrand[nr - 1]);
/* !YES, TELL HOW. */
return ret_val;
L600:
if (who != aindex_1.player) {
newsta_(advs_1.aobj[who - 1], 0, nr, 0, 0);
}
if (j != 0) {
newsta_(j, 0, nr, 0, 0);
}
play_1.here = nr;
advs_1.aroom[who - 1] = play_1.here;
scrupd_(rooms_1.rval[nr - 1]);
/* !SCORE ROOM */
rooms_1.rval[nr - 1] = 0;
return ret_val;
L800:
rspsub_(428, objcts_1.odesc2[j - 1]);
/* !WRONG VEHICLE. */
return ret_val;
} /* moveto_ */
/* SCORE-- PRINT OUT CURRENT SCORE */
/* DECLARATIONS */
void score_(flg)
logical flg;
{
/* Initialized data */
static const integer rank[10] = { 20,19,18,16,12,8,4,2,1,0 };
static const integer erank[5] = { 20,15,10,5,0 };
/* System generated locals */
integer i__1;
/* Local variables */
integer i, as;
as = advs_1.ascore[play_1.winner - 1];
if (findex_1.endgmf) {
goto L60;
}
/* !ENDGAME? */
more_output(NULL);
printf("Your score ");
if (flg)
printf("would be");
else
printf("is");
printf(" %d [total of %d points], in %d move", as, state_1.mxscor,
state_1.moves);
if (state_1.moves != 1)
printf("s");
printf(".\n");
for (i = 1; i <= 10; ++i) {
if (as * 20 / state_1.mxscor >= rank[i - 1]) {
goto L50;
}
/* L10: */
}
L50:
i__1 = i + 484;
rspeak_(i__1);
return;
L60:
more_output(NULL);
printf("Your score in the endgame ");
if (flg)
printf("would be");
else
printf("is");
printf(" %d [total of %d points], in %d moves.\n", state_1.egscor,
state_1.egmxsc, state_1.moves);
for (i = 1; i <= 5; ++i) {
if (state_1.egscor * 20 / state_1.egmxsc >= erank[i - 1]) {
goto L80;
}
/* L70: */
}
L80:
i__1 = i + 786;
rspeak_(i__1);
} /* score_ */
/* SCRUPD- UPDATE WINNER'S SCORE */
/* DECLARATIONS */
void scrupd_(n)
integer n;
{
if (findex_1.endgmf) {
goto L100;
}
/* !ENDGAME? */
advs_1.ascore[play_1.winner - 1] += n;
/* !UPDATE SCORE */
state_1.rwscor += n;
/* !UPDATE RAW SCORE */
if (advs_1.ascore[play_1.winner - 1] < state_1.mxscor - state_1.deaths *
10) {
return;
}
cevent_1.cflag[cindex_1.cevegh - 1] = TRUE_;
/* !TURN ON END GAME */
cevent_1.ctick[cindex_1.cevegh - 1] = 15;
return;
L100:
state_1.egscor += n;
/* !UPDATE EG SCORE. */
} /* scrupd_ */

205
dso3.c Normal file
View File

@ -0,0 +1,205 @@
/* FINDXT- FIND EXIT FROM ROOM */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include "funcs.h"
#include "vars.h"
logical findxt_(dir, rm)
integer dir;
integer rm;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer i, xi;
integer xxxflg;
ret_val = TRUE_;
/* !ASSUME WINS. */
xi = rooms_1.rexit[rm - 1];
/* !FIND FIRST ENTRY. */
if (xi == 0) {
goto L1000;
}
/* !NO EXITS? */
L100:
i = exits_1.travel[xi - 1];
/* !GET ENTRY. */
curxt_1.xroom1 = i & xpars_1.xrmask;
/* mask to 16-bits to get rid of sign extension problems with 32-bit ints
*/
xxxflg = ~ xpars_1.xlflag & 65535;
curxt_1.xtype = ((i & xxxflg) / xpars_1.xfshft & xpars_1.xfmask) + 1;
switch (curxt_1.xtype) {
case 1: goto L110;
case 2: goto L120;
case 3: goto L130;
case 4: goto L130;
}
/* !BRANCH ON ENTRY. */
bug_(10, curxt_1.xtype);
L130:
curxt_1.xobj = exits_1.travel[xi + 1] & xpars_1.xrmask;
curxt_1.xactio = exits_1.travel[xi + 1] / xpars_1.xashft;
L120:
curxt_1.xstrng = exits_1.travel[xi];
/* !DOOR/CEXIT/NEXIT - STRING. */
L110:
xi += xpars_1.xelnt[curxt_1.xtype - 1];
/* !ADVANCE TO NEXT ENTRY. */
if ((i & xpars_1.xdmask) == dir) {
return ret_val;
}
if ((i & xpars_1.xlflag) == 0) {
goto L100;
}
L1000:
ret_val = FALSE_;
/* !YES, LOSE. */
return ret_val;
} /* findxt_ */
/* FWIM- FIND WHAT I MEAN */
/* DECLARATIONS */
integer fwim_(f1, f2, rm, con, adv, nocare)
integer f1;
integer f2;
integer rm;
integer con;
integer adv;
logical nocare;
{
/* System generated locals */
integer ret_val, i__1, i__2;
/* Local variables */
integer i, j;
/* OBJECTS */
ret_val = 0;
/* !ASSUME NOTHING. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP */
if ((rm == 0 || objcts_1.oroom[i - 1] != rm) && (adv == 0 ||
objcts_1.oadv[i - 1] != adv) && (con == 0 || objcts_1.ocan[
i - 1] != con)) {
goto L1000;
}
/* OBJECT IS ON LIST... IS IT A MATCH? */
if ((objcts_1.oflag1[i - 1] & VISIBT) == 0) {
goto L1000;
}
if (~ (nocare) & (objcts_1.oflag1[i - 1] & TAKEBT) == 0 || (
objcts_1.oflag1[i - 1] & f1) == 0 && (objcts_1.oflag2[i - 1]
& f2) == 0) {
goto L500;
}
if (ret_val == 0) {
goto L400;
}
/* !ALREADY GOT SOMETHING? */
ret_val = -ret_val;
/* !YES, AMBIGUOUS. */
return ret_val;
L400:
ret_val = i;
/* !NOTE MATCH. */
/* DOES OBJECT CONTAIN A MATCH? */
L500:
if ((objcts_1.oflag2[i - 1] & OPENBT) == 0) {
goto L1000;
}
i__2 = objcts_1.olnt;
for (j = 1; j <= i__2; ++j) {
/* !NO, SEARCH CONTENTS. */
if (objcts_1.ocan[j - 1] != i || (objcts_1.oflag1[j - 1] &
VISIBT) == 0 || (objcts_1.oflag1[j - 1] & f1) ==
0 && (objcts_1.oflag2[j - 1] & f2) == 0) {
goto L700;
}
if (ret_val == 0) {
goto L600;
}
ret_val = -ret_val;
return ret_val;
L600:
ret_val = j;
L700:
;
}
L1000:
;
}
return ret_val;
} /* fwim_ */
/* YESNO- OBTAIN YES/NO ANSWER */
/* CALLED BY- */
/* YES-IS-TRUE=YESNO(QUESTION,YES-STRING,NO-STRING) */
logical yesno_(q, y, n)
integer q;
integer y;
integer n;
{
/* System generated locals */
logical ret_val;
/* Local variables */
char ans[100];
L100:
rspeak_(q);
/* !ASK */
(void) fflush(stdout);
(void) fgets(ans, sizeof ans, stdin);
more_input();
/* !GET ANSWER */
if (*ans == 'Y' || *ans == 'y') {
goto L200;
}
if (*ans == 'N' || *ans == 'n') {
goto L300;
}
rspeak_(6);
/* !SCOLD. */
goto L100;
L200:
ret_val = TRUE_;
/* !YES, */
rspeak_(y);
/* !OUT WITH IT. */
return ret_val;
L300:
ret_val = FALSE_;
/* !NO, */
rspeak_(n);
/* !LIKEWISE. */
return ret_val;
} /* yesno_ */

199
dso4.c Normal file
View File

@ -0,0 +1,199 @@
/* ROBADV-- STEAL WINNER'S VALUABLES */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
integer robadv_(adv, nr, nc, na)
integer adv;
integer nr;
integer nc;
integer na;
{
/* System generated locals */
integer ret_val, i__1;
/* Local variables */
integer i;
ret_val = 0;
/* !COUNT OBJECTS */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
if (objcts_1.oadv[i - 1] != adv || objcts_1.otval[i - 1] <= 0 || (
objcts_1.oflag2[i - 1] & SCRDBT) != 0) {
goto L100;
}
newsta_(i, 0, nr, nc, na);
/* !STEAL OBJECT */
++ret_val;
L100:
;
}
return ret_val;
} /* robadv_ */
/* ROBRM-- STEAL ROOM VALUABLES */
/* DECLARATIONS */
integer robrm_(rm, pr, nr, nc, na)
integer rm;
integer pr;
integer nr;
integer nc;
integer na;
{
/* System generated locals */
integer ret_val, i__1, i__2;
/* Local variables */
integer i;
/* OBJECTS */
ret_val = 0;
/* !COUNT OBJECTS */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP ON OBJECTS. */
if (! qhere_(i, rm)) {
goto L100;
}
if (objcts_1.otval[i - 1] <= 0 || (objcts_1.oflag2[i - 1] &
SCRDBT) != 0 || (objcts_1.oflag1[i - 1] &
VISIBT) == 0 || ! prob_(pr, pr)) {
goto L50;
}
newsta_(i, 0, nr, nc, na);
++ret_val;
objcts_1.oflag2[i - 1] |= TCHBT;
goto L100;
L50:
if ((objcts_1.oflag2[i - 1] & ACTRBT) != 0) {
i__2 = oactor_(i);
ret_val += robadv_(i__2, nr, nc, na);
}
L100:
;
}
return ret_val;
} /* robrm_ */
/* WINNIN-- SEE IF VILLAIN IS WINNING */
/* DECLARATIONS */
logical winnin_(vl, hr)
integer vl;
integer hr;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer ps, vs;
/* OBJECTS */
vs = objcts_1.ocapac[vl - 1];
/* !VILLAIN STRENGTH */
ps = vs - fights_(hr, 1);
/* !HIS MARGIN OVER HERO */
ret_val = prob_(90, 100);
if (ps > 3) {
return ret_val;
}
/* !+3... 90% WINNING */
ret_val = prob_(75, 85);
if (ps > 0) {
return ret_val;
}
/* !>0... 75% WINNING */
ret_val = prob_(50, 30);
if (ps == 0) {
return ret_val;
}
/* !=0... 50% WINNING */
ret_val = prob_(25, 25);
if (vs > 1) {
return ret_val;
}
/* !ANY VILLAIN STRENGTH. */
ret_val = prob_(10, 0);
return ret_val;
} /* winnin_ */
/* FIGHTS-- COMPUTE FIGHT STRENGTH */
/* DECLARATIONS */
integer fights_(h, flg)
integer h;
logical flg;
{
/* Initialized data */
const integer smin = 2;
const integer smax = 7;
/* System generated locals */
integer ret_val;
ret_val = smin + ((smax - smin) * advs_1.ascore[h - 1] + state_1.mxscor /
2) / state_1.mxscor;
if (flg) {
ret_val += advs_1.astren[h - 1];
}
return ret_val;
} /* fights_ */
/* VILSTR- COMPUTE VILLAIN STRENGTH */
/* DECLARATIONS */
integer vilstr_(v)
integer v;
{
/* System generated locals */
integer ret_val, i__1, i__2, i__3;
/* Local variables */
integer i;
ret_val = objcts_1.ocapac[v - 1];
if (ret_val <= 0) {
return ret_val;
}
if (v != oindex_1.thief || ! findex_1.thfenf) {
goto L100;
}
findex_1.thfenf = FALSE_;
/* !THIEF UNENGROSSED. */
ret_val = min(ret_val,2);
/* !NO BETTER THAN 2. */
L100:
i__1 = vill_1.vlnt;
for (i = 1; i <= i__1; ++i) {
/* !SEE IF BEST WEAPON. */
if (vill_1.villns[i - 1] == v && prsvec_1.prsi == vill_1.vbest[i - 1]
) {
/* Computing MAX */
i__2 = 1, i__3 = ret_val - 1;
ret_val = max(i__2,i__3);
}
/* L200: */
}
return ret_val;
} /* vilstr_ */

188
dso5.c Normal file
View File

@ -0,0 +1,188 @@
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
/* GTTIME-- GET TOTAL TIME PLAYED */
void gttime_(t)
integer *t;
{
integer h, m, s;
itime_(&h, &m, &s);
*t = h * 60 + m - (time_1.shour * 60 + time_1.smin);
if (*t < 0) {
*t += 1440;
}
*t += time_1.pltime;
return;
} /* gttime_ */
/* OPNCLS-- PROCESS OPEN/CLOSE FOR DOORS */
/* DECLARATIONS */
logical opncls_(obj, so, sc)
integer obj;
integer so;
integer sc;
{
/* System generated locals */
integer i__1;
logical ret_val;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (prsvec_1.prsa == vindex_1.closew) {
goto L100;
}
/* !CLOSE? */
if (prsvec_1.prsa == vindex_1.openw) {
goto L50;
}
/* !OPEN? */
ret_val = FALSE_;
/* !LOSE */
return ret_val;
L50:
if ((objcts_1.oflag2[obj - 1] & OPENBT) != 0) {
goto L200;
}
/* !OPEN... IS IT? */
rspeak_(so);
objcts_1.oflag2[obj - 1] |= OPENBT;
return ret_val;
L100:
if (! ((objcts_1.oflag2[obj - 1] & OPENBT) != 0)) {
goto L200;
}
/* !CLOSE... IS IT? */
rspeak_(sc);
objcts_1.oflag2[obj - 1] &= ~ OPENBT;
return ret_val;
L200:
i__1 = rnd_(3) + 125;
rspeak_(i__1);
/* !DUMMY. */
return ret_val;
} /* opncls_ */
/* LIT-- IS ROOM LIT? */
/* DECLARATIONS */
logical lit_(rm)
integer rm;
{
/* System generated locals */
integer i__1, i__2;
logical ret_val;
/* Local variables */
integer i, j, oa;
ret_val = TRUE_;
/* !ASSUME WINS */
if ((rooms_1.rflag[rm - 1] & RLIGHT) != 0) {
return ret_val;
}
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOK FOR LIT OBJ */
if (qhere_(i, rm)) {
goto L100;
}
/* !IN ROOM? */
oa = objcts_1.oadv[i - 1];
/* !NO */
if (oa <= 0) {
goto L1000;
}
/* !ON ADV? */
if (advs_1.aroom[oa - 1] != rm) {
goto L1000;
}
/* !ADV IN ROOM? */
/* OBJ IN ROOM OR ON ADV IN ROOM */
L100:
if ((objcts_1.oflag1[i - 1] & ONBT) != 0) {
return ret_val;
}
if ((objcts_1.oflag1[i - 1] & VISIBT) == 0 || (
objcts_1.oflag1[i - 1] & TRANBT) == 0 && (
objcts_1.oflag2[i - 1] & OPENBT) == 0) {
goto L1000;
}
/* OBJ IS VISIBLE AND OPEN OR TRANSPARENT */
i__2 = objcts_1.olnt;
for (j = 1; j <= i__2; ++j) {
if (objcts_1.ocan[j - 1] == i && (objcts_1.oflag1[j - 1] &
ONBT) != 0) {
return ret_val;
}
/* L500: */
}
L1000:
;
}
ret_val = FALSE_;
return ret_val;
} /* lit_ */
/* WEIGHT- RETURNS SUM OF WEIGHT OF QUALIFYING OBJECTS */
/* DECLARATIONS */
integer weight_(rm, cn, ad)
integer rm;
integer cn;
integer ad;
{
/* System generated locals */
integer ret_val, i__1;
/* Local variables */
integer i, j;
ret_val = 0;
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !OMIT BIG FIXED ITEMS. */
if (objcts_1.osize[i - 1] >= 10000) {
goto L100;
}
/* !IF FIXED, FORGET IT. */
if (qhere_(i, rm) && rm != 0 || objcts_1.oadv[i - 1] == ad && ad
!= 0) {
goto L50;
}
j = i;
/* !SEE IF CONTAINED. */
L25:
j = objcts_1.ocan[j - 1];
/* !GET NEXT LEVEL UP. */
if (j == 0) {
goto L100;
}
/* !END OF LIST? */
if (j != cn) {
goto L25;
}
L50:
ret_val += objcts_1.osize[i - 1];
L100:
;
}
return ret_val;
} /* weight_ */

170
dso6.c Normal file
View File

@ -0,0 +1,170 @@
/* GHERE-- IS GLOBAL ACTUALLY IN THIS ROOM? */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
logical ghere_(obj, rm)
integer obj;
integer rm;
{
/* System generated locals */
logical ret_val;
ret_val = TRUE_;
/* !ASSUME WINS. */
switch (obj - star_1.strbit) {
case 1: goto L1000;
case 2: goto L1000;
case 3: goto L1000;
case 4: goto L1000;
case 5: goto L1000;
case 6: goto L1000;
case 7: goto L1000;
case 8: goto L1000;
case 9: goto L1000;
case 10: goto L1000;
case 11: goto L1000;
case 12: goto L2000;
case 13: goto L3000;
case 14: goto L4000;
case 15: goto L5000;
case 16: goto L5000;
case 17: goto L5000;
case 18: goto L6000;
case 19: goto L7000;
case 20: goto L8000;
case 21: goto L9000;
case 22: goto L9100;
case 23: goto L8000;
case 24: goto L10000;
case 25: goto L11000;
}
bug_(60, obj);
/* 1000-- STARS ARE ALWAYS HERE */
L1000:
return ret_val;
/* 2000-- BIRD */
L2000:
ret_val = rm >= rindex_1.fore1 && rm < rindex_1.clear || rm ==
rindex_1.mtree;
return ret_val;
/* 3000-- TREE */
L3000:
ret_val = rm >= rindex_1.fore1 && rm < rindex_1.clear && rm !=
rindex_1.fore3;
return ret_val;
/* 4000-- NORTH WALL */
L4000:
ret_val = rm >= rindex_1.bkvw && rm <= rindex_1.bkbox || rm ==
rindex_1.cpuzz;
return ret_val;
/* 5000-- EAST, SOUTH, WEST WALLS */
L5000:
ret_val = rm >= rindex_1.bkvw && rm < rindex_1.bkbox || rm ==
rindex_1.cpuzz;
return ret_val;
/* 6000-- GLOBAL WATER */
L6000:
ret_val = (rooms_1.rflag[rm - 1] & RWATER + RFILL) != 0;
return ret_val;
/* 7000-- GLOBAL GUARDIANS */
L7000:
ret_val = rm >= rindex_1.mrc && rm <= rindex_1.mrd || rm >=
rindex_1.mrce && rm <= rindex_1.mrdw || rm == rindex_1.inmir;
return ret_val;
/* 8000-- ROSE/CHANNEL */
L8000:
ret_val = rm >= rindex_1.mra && rm <= rindex_1.mrd || rm ==
rindex_1.inmir;
return ret_val;
/* 9000-- MIRROR */
/* 9100 PANEL */
L9100:
if (rm == rindex_1.fdoor) {
return ret_val;
}
/* !PANEL AT FDOOR. */
L9000:
ret_val = rm >= rindex_1.mra && rm <= rindex_1.mrc || rm >=
rindex_1.mrae && rm <= rindex_1.mrcw;
return ret_val;
/* 10000-- MASTER */
L10000:
ret_val = rm == rindex_1.fdoor || rm == rindex_1.ncorr || rm ==
rindex_1.parap || rm == rindex_1.cell;
return ret_val;
/* 11000-- LADDER */
L11000:
ret_val = rm == rindex_1.cpuzz;
return ret_val;
} /* ghere_ */
/* MRHERE-- IS MIRROR HERE? */
/* DECLARATIONS */
integer mrhere_(rm)
integer rm;
{
/* System generated locals */
integer ret_val, i__1;
if (rm < rindex_1.mrae || rm > rindex_1.mrdw) {
goto L100;
}
/* RM IS AN E-W ROOM, MIRROR MUST BE N-S (MDIR= 0 OR 180) */
ret_val = 1;
/* !ASSUME MIRROR 1 HERE. */
if ((rm - rindex_1.mrae) % 2 == findex_1.mdir / 180) {
ret_val = 2;
}
return ret_val;
/* RM IS NORTH OR SOUTH OF MIRROR. IF MIRROR IS N-S OR NOT */
/* WITHIN ONE ROOM OF RM, LOSE. */
L100:
ret_val = 0;
if ((i__1 = findex_1.mloc - rm, abs(i__1)) != 1 || findex_1.mdir % 180 ==
0) {
return ret_val;
}
/* RM IS WITHIN ONE OF MLOC, AND MDIR IS E-W */
ret_val = 1;
if (rm < findex_1.mloc && findex_1.mdir < 180 || rm > findex_1.mloc &&
findex_1.mdir > 180) {
ret_val = 2;
}
return ret_val;
} /* mrhere_ */

164
dso7.c Normal file
View File

@ -0,0 +1,164 @@
/* ENCRYP-- ENCRYPT PASSWORD */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include "funcs.h"
#include "vars.h"
void encryp_(inw, outw)
const char *inw;
char *outw;
{
/* Initialized data */
const char *keyw = "ECORMS";
integer i, j, uinw[6], usum;
char ukeyw[1*6];
integer uinws, ukeyws;
/* Parameter adjustments */
--outw;
--inw;
/* Function Body */
uinws = 0;
/* !UNBIASED INW SUM. */
ukeyws = 0;
/* !UNBIASED KEYW SUM. */
j = 1;
/* !POINTER IN KEYWORD. */
for (i = 1; i <= 6; ++i) {
/* !UNBIAS, COMPUTE SUMS. */
ukeyw[i - 1] = (keyw[i - 1] - 64);
if (inw[j] <= '@') {
j = 1;
}
uinw[i - 1] = inw[j] - 64;
ukeyws += ukeyw[i - 1];
uinws += uinw[i - 1];
++j;
/* L100: */
}
usum = uinws % 8 + (ukeyws % 8 << 3);
/* !COMPUTE MASK. */
for (i = 1; i <= 6; ++i) {
j = (uinw[i - 1] ^ ukeyw[i - 1] ^ usum) & 31;
usum = (usum + 1) % 32;
if (j > 26) {
j %= 26;
}
outw[i] = (max(1,j) + 64);
/* L200: */
}
} /* encryp_ */
/* CPGOTO-- MOVE TO NEXT STATE IN PUZZLE ROOM */
/* DECLARATIONS */
void cpgoto_(st)
integer st;
{
/* System generated locals */
integer i__1, i__2;
/* Local variables */
integer i;
rooms_1.rflag[rindex_1.cpuzz - 1] &= ~ RSEEN;
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !RELOCATE OBJECTS. */
if (objcts_1.oroom[i - 1] == rindex_1.cpuzz && (objcts_1.oflag2[i - 1]
& ACTRBT + VILLBT) == 0) {
i__2 = findex_1.cphere * hyper_1.hfactr;
newsta_(i, 0, i__2, 0, 0);
}
if (objcts_1.oroom[i - 1] == st * hyper_1.hfactr) {
newsta_(i, 0, rindex_1.cpuzz, 0, 0);
}
/* L100: */
}
findex_1.cphere = st;
} /* cpgoto_ */
/* CPINFO-- DESCRIBE PUZZLE ROOM */
/* DECLARATIONS */
void cpinfo_(rmk, st)
integer rmk;
integer st;
{
/* Initialized data */
static const integer dgmoft[8] = { -9,-8,-7,-1,1,7,8,9 };
const char *pict = "SSS M";
/* Local variables */
integer i, j, k, l;
char dgm[1*8];
rspeak_(rmk);
for (i = 1; i <= 8; ++i) {
j = dgmoft[i - 1];
dgm[i - 1] = pict[puzzle_1.cpvec[st + j - 1] + 3];
/* !GET PICTURE ELEMENT. */
if (abs(j) == 1 || abs(j) == 8) {
goto L100;
}
k = 8;
if (j < 0) {
k = -8;
}
/* !GET ORTHO DIR. */
l = j - k;
if (puzzle_1.cpvec[st + k - 1] != 0 && puzzle_1.cpvec[st + l - 1] !=
0) {
dgm[i - 1] = '?';
}
L100:
;
}
more_output(NULL);
printf(" |%c%c %c%c %c%c|\n", dgm[0], dgm[0], dgm[1], dgm[1],
dgm[2], dgm[2]);
more_output(NULL);
printf(" West |%c%c .. %c%c| East\n", dgm[3], dgm[3], dgm[4], dgm[4]);
more_output(NULL);
printf(" |%c%c %c%c %c%c|\n", dgm[5], dgm[5], dgm[6], dgm[6],
dgm[7], dgm[7]);
if (st == 10) {
rspeak_(870);
}
/* !AT HOLE? */
if (st == 37) {
rspeak_(871);
}
/* !AT NICHE? */
i = 872;
/* !DOOR OPEN? */
if (findex_1.cpoutf) {
i = 873;
}
if (st == 52) {
rspeak_(i);
}
/* !AT DOOR? */
if (puzzle_1.cpvec[st] == -2) {
rspeak_(874);
}
/* !EAST LADDER? */
if (puzzle_1.cpvec[st - 2] == -3) {
rspeak_(875);
}
/* !WEST LADDER? */
} /* cpinfo_ */

632
dsub.c Normal file
View File

@ -0,0 +1,632 @@
/* RESIDENT SUBROUTINES FOR DUNGEON */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include "funcs.h"
#include "vars.h"
#ifndef SEEK_SET
#define SEEK_SET (0)
#endif
extern FILE *dbfile;
static void rspsb2nl_ P((integer, integer, integer, logical));
/* RSPEAK-- OUTPUT RANDOM MESSAGE ROUTINE */
/* CALLED BY-- */
/* CALL RSPEAK(MSGNUM) */
void rspeak_(n)
integer n;
{
rspsb2nl_(n, 0, 0, 1);
} /* rspeak_ */
/* RSPSUB-- OUTPUT RANDOM MESSAGE WITH SUBSTITUTABLE ARGUMENT */
/* CALLED BY-- */
/* CALL RSPSUB(MSGNUM,SUBNUM) */
void rspsub_(n, s1)
integer n;
integer s1;
{
rspsb2nl_(n, s1, 0, 1);
} /* rspsub_ */
/* RSPSB2-- OUTPUT RANDOM MESSAGE WITH UP TO TWO SUBSTITUTABLE ARGUMENTS */
/* CALLED BY-- */
/* CALL RSPSB2(MSGNUM,SUBNUM1,SUBNUM2) */
void rspsb2_(n, s1, s2)
integer n;
integer s1;
integer s2;
{
rspsb2nl_(n, s1, s2, 1);
} /* rspsb2_ */
/* rspsb2nl_ Display a substitutable message with an optional newline */
static void rspsb2nl_(n, y, z, nl)
integer n;
integer y;
integer z;
logical nl;
{
const char *zkey = "IanLanceTaylorJr";
long x;
x = (long)n;
if (x > 0) {
x = rmsg_1.rtext[x - 1];
}
/* !IF >0, LOOK UP IN RTEXT. */
if (x == 0) {
return;
}
/* !ANYTHING TO DO? */
play_1.telflg = TRUE_;
/* !SAID SOMETHING. */
x = ((- x) - 1) * 8;
if (fseek(dbfile, x + (long)rmsg_1.mrloc, SEEK_SET) == EOF) {
fprintf(stderr, "Error seeking database loc %d\n", x);
exit_();
}
if (nl)
more_output(NULL);
while (1) {
integer i;
i = getc(dbfile);
if (i == EOF) {
fprintf(stderr, "Error reading database loc %d\n", x);
exit_();
}
i ^= zkey[x & 0xf] ^ (x & 0xff);
x = x + 1;
if (i == '\0')
break;
else if (i == '\n') {
putchar('\n');
if (nl)
more_output(NULL);
}
else if (i == '#' && y != 0) {
long iloc;
iloc = ftell(dbfile);
rspsb2nl_(y, 0, 0, 0);
if (fseek(dbfile, iloc, SEEK_SET) == EOF) {
fprintf(stderr, "Error seeking database loc %d\n", iloc);
exit_();
}
y = z;
z = 0;
}
else
putchar(i);
}
if (nl)
putchar('\n');
}
/* OBJACT-- APPLY OBJECTS FROM PARSE VECTOR */
/* DECLARATIONS */
logical objact_()
{
/* System generated locals */
logical ret_val;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (prsvec_1.prsi == 0) {
goto L100;
}
/* !IND OBJECT? */
if (oappli_(objcts_1.oactio[prsvec_1.prsi - 1], 0)) {
return ret_val;
}
/* !YES, LET IT HANDLE. */
L100:
if (prsvec_1.prso == 0) {
goto L200;
}
/* !DIR OBJECT? */
if (oappli_(objcts_1.oactio[prsvec_1.prso - 1], 0)) {
return ret_val;
}
/* !YES, LET IT HANDLE. */
L200:
ret_val = FALSE_;
/* !LOSES. */
return ret_val;
} /* objact_ */
/* BUG-- REPORT FATAL SYSTEM ERROR */
/* CALLED BY-- */
/* CALL BUG(NO,PAR) */
void bug_(a, b)
integer a;
integer b;
{
/* Local variables */
more_output(NULL);
printf("PROGRAM ERROR %d, PARAMETER=%d\n", a, b);
if (debug_1.dbgflg != 0) {
return;
}
exit_();
} /* bug_ */
/* NEWSTA-- SET NEW STATUS FOR OBJECT */
/* CALLED BY-- */
/* CALL NEWSTA(OBJECT,STRING,NEWROOM,NEWCON,NEWADV) */
void newsta_(o, r, rm, cn, ad)
integer o;
integer r;
integer rm;
integer cn;
integer ad;
{
rspeak_(r);
objcts_1.oroom[o - 1] = rm;
objcts_1.ocan[o - 1] = cn;
objcts_1.oadv[o - 1] = ad;
} /* newsta_ */
/* QHERE-- TEST FOR OBJECT IN ROOM */
/* DECLARATIONS */
logical qhere_(obj, rm)
integer obj;
integer rm;
{
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer i;
ret_val = TRUE_;
if (objcts_1.oroom[obj - 1] == rm) {
return ret_val;
}
/* !IN ROOM? */
i__1 = oroom2_1.r2lnt;
for (i = 1; i <= i__1; ++i) {
/* !NO, SCH ROOM2. */
if (oroom2_1.oroom2[i - 1] == obj && oroom2_1.rroom2[i - 1] == rm) {
return ret_val;
}
/* L100: */
}
ret_val = FALSE_;
/* !NOT PRESENT. */
return ret_val;
} /* qhere_ */
/* QEMPTY-- TEST FOR OBJECT EMPTY */
/* DECLARATIONS */
logical qempty_(obj)
integer obj;
{
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer i;
ret_val = FALSE_;
/* !ASSUME LOSE. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
if (objcts_1.ocan[i - 1] == obj) {
return ret_val;
}
/* !INSIDE TARGET? */
/* L100: */
}
ret_val = TRUE_;
return ret_val;
} /* qempty_ */
/* JIGSUP- YOU ARE DEAD */
/* DECLARATIONS */
void jigsup_(desc)
integer desc;
{
/* Initialized data */
static const integer rlist[9] = { 8,6,36,35,34,4,34,6,5 };
/* System generated locals */
integer i__1;
/* Local variables */
integer nonofl;
logical f;
integer i, j;
rspeak_(desc);
/* !DESCRIBE SAD STATE. */
prsvec_1.prscon = 1;
/* !STOP PARSER. */
if (debug_1.dbgflg != 0) {
return;
}
/* !IF DBG, EXIT. */
advs_1.avehic[play_1.winner - 1] = 0;
/* !GET RID OF VEHICLE. */
if (play_1.winner == aindex_1.player) {
goto L100;
}
/* !HIMSELF? */
rspsub_(432, objcts_1.odesc2[advs_1.aobj[play_1.winner - 1] - 1]);
/* !NO, SAY WHO DIED. */
newsta_(advs_1.aobj[play_1.winner - 1], 0, 0, 0, 0);
/* !SEND TO HYPER SPACE. */
return;
L100:
if (findex_1.endgmf) {
goto L900;
}
/* !NO RECOVERY IN END GAME. */
// always exit for plopbot's purposes
goto L1000;
// if (state_1.deaths >= 2) {
// goto L1000;
// }
/* !DEAD TWICE? KICK HIM OFF. */
if (! yesno_(10, 9, 8)) {
goto L1100;
}
/* !CONTINUE? */
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
/* !TURN OFF FIGHTING. */
if (qhere_(j, play_1.here)) {
objcts_1.oflag2[j - 1] &= ~ FITEBT;
}
/* L50: */
}
++state_1.deaths;
scrupd_(- 10);
/* !CHARGE TEN POINTS. */
f = moveto_(rindex_1.fore1, play_1.winner);
/* !REPOSITION HIM. */
findex_1.egyptf = TRUE_;
/* !RESTORE COFFIN. */
if (objcts_1.oadv[oindex_1.coffi - 1] == play_1.winner) {
newsta_(oindex_1.coffi, 0, rindex_1.egypt, 0, 0);
}
objcts_1.oflag2[oindex_1.door - 1] &= ~ TCHBT;
objcts_1.oflag1[oindex_1.robot - 1] = (objcts_1.oflag1[oindex_1.robot - 1]
| VISIBT) & ~ NDSCBT;
if (objcts_1.oroom[oindex_1.lamp - 1] != 0 || objcts_1.oadv[oindex_1.lamp
- 1] == play_1.winner) {
newsta_(oindex_1.lamp, 0, rindex_1.lroom, 0, 0);
}
/* NOW REDISTRIBUTE HIS VALUABLES AND OTHER BELONGINGS. */
/* THE LAMP HAS BEEN PLACED IN THE LIVING ROOM. */
/* THE FIRST 8 NON-VALUABLES ARE PLACED IN LOCATIONS AROUND THE HOUSE. */
/* HIS VALUABLES ARE PLACED AT THE END OF THE MAZE. */
/* REMAINING NON-VALUABLES ARE PLACED AT THE END OF THE MAZE. */
i = 1;
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
/* !LOOP THRU OBJECTS. */
if (objcts_1.oadv[j - 1] != play_1.winner || objcts_1.otval[j - 1] !=
0) {
goto L200;
}
++i;
if (i > 9) {
goto L400;
}
/* !MOVE TO RANDOM LOCATIONS. */
newsta_(j, 0, rlist[i - 1], 0, 0);
L200:
;
}
L400:
i = rooms_1.rlnt + 1;
/* !NOW MOVE VALUABLES. */
nonofl = RAIR + RWATER + RSACRD + REND;
/* !DONT MOVE HERE. */
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
if (objcts_1.oadv[j - 1] != play_1.winner || objcts_1.otval[j - 1] ==
0) {
goto L300;
}
L250:
--i;
/* !FIND NEXT ROOM. */
if ((rooms_1.rflag[i - 1] & nonofl) != 0) {
goto L250;
}
newsta_(j, 0, i, 0, 0);
/* !YES, MOVE. */
L300:
;
}
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
/* !NOW GET RID OF REMAINDER. */
if (objcts_1.oadv[j - 1] != play_1.winner) {
goto L500;
}
L450:
--i;
/* !FIND NEXT ROOM. */
if ((rooms_1.rflag[i - 1] & nonofl) != 0) {
goto L450;
}
newsta_(j, 0, i, 0, 0);
L500:
;
}
return;
/* CAN'T OR WON'T CONTINUE, CLEAN UP AND EXIT. */
L900:
rspeak_(625);
/* !IN ENDGAME, LOSE. */
goto L1100;
L1000:
rspeak_(7);
/* !INVOLUNTARY EXIT. */
L1100:
score_(0);
/* !TELL SCORE. */
(void) fclose(dbfile);
exit_();
} /* jigsup_ */
/* OACTOR- GET ACTOR ASSOCIATED WITH OBJECT */
/* DECLARATIONS */
integer oactor_(obj)
integer obj;
{
/* System generated locals */
integer ret_val = 1, i__1;
/* Local variables */
integer i;
i__1 = advs_1.alnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP THRU ACTORS. */
ret_val = i;
/* !ASSUME FOUND. */
if (advs_1.aobj[i - 1] == obj) {
return ret_val;
}
/* !FOUND IT? */
/* L100: */
}
bug_(40, obj);
/* !NO, DIE. */
return ret_val;
} /* oactor_ */
/* PROB- COMPUTE PROBABILITY */
/* DECLARATIONS */
logical prob_(g, b)
integer g;
integer b;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer i;
i = g;
/* !ASSUME GOOD LUCK. */
if (findex_1.badlkf) {
i = b;
}
/* !IF BAD, TOO BAD. */
ret_val = rnd_(100) < i;
/* !COMPUTE. */
return ret_val;
} /* prob_ */
/* RMDESC-- PRINT ROOM DESCRIPTION */
/* RMDESC PRINTS A DESCRIPTION OF THE CURRENT ROOM. */
/* IT IS ALSO THE PROCESSOR FOR VERBS 'LOOK' AND 'EXAMINE'. */
logical rmdesc_(full)
integer full;
{
/* System generated locals */
logical ret_val, L__1;
/* Local variables */
integer i, ra;
/* FULL= 0/1/2/3= SHORT/OBJ/ROOM/FULL */
ret_val = TRUE_;
/* !ASSUME WINS. */
if (prsvec_1.prso < xsrch_1.xmin) {
goto L50;
}
/* !IF DIRECTION, */
screen_1.fromdr = prsvec_1.prso;
/* !SAVE AND */
prsvec_1.prso = 0;
/* !CLEAR. */
L50:
if (play_1.here == advs_1.aroom[aindex_1.player - 1]) {
goto L100;
}
/* !PLAYER JUST MOVE? */
rspeak_(2);
/* !NO, JUST SAY DONE. */
prsvec_1.prsa = vindex_1.walkiw;
/* !SET UP WALK IN ACTION. */
return ret_val;
L100:
if (lit_(play_1.here)) {
goto L300;
}
/* !LIT? */
rspeak_(430);
/* !WARN OF GRUE. */
ret_val = FALSE_;
return ret_val;
L300:
ra = rooms_1.ractio[play_1.here - 1];
/* !GET ROOM ACTION. */
if (full == 1) {
goto L600;
}
/* !OBJ ONLY? */
i = rooms_1.rdesc2[play_1.here - 1];
/* !ASSUME SHORT DESC. */
if (full == 0 && (findex_1.superf || (rooms_1.rflag[play_1.here - 1] &
RSEEN) != 0 && findex_1.brieff)) {
goto L400;
}
/* The next line means that when you request VERBOSE mode, you */
/* only get long room descriptions 20% of the time. I don't either */
/* like or understand this, so the mod. ensures VERBOSE works */
/* all the time. jmh@ukc.ac.uk 22/10/87 */
/* & .AND.(BRIEFF.OR.PROB(80,80))))) GO TO 400 */
i = rooms_1.rdesc1[play_1.here - 1];
/* !USE LONG. */
if (i != 0 || ra == 0) {
goto L400;
}
/* !IF GOT DESC, SKIP. */
prsvec_1.prsa = vindex_1.lookw;
/* !PRETEND LOOK AROUND. */
if (! rappli_(ra)) {
goto L100;
}
/* !ROOM HANDLES, NEW DESC? */
prsvec_1.prsa = vindex_1.foow;
/* !NOP PARSER. */
goto L500;
L400:
rspeak_(i);
/* !OUTPUT DESCRIPTION. */
L500:
if (advs_1.avehic[play_1.winner - 1] != 0) {
rspsub_(431, objcts_1.odesc2[advs_1.avehic[play_1.winner - 1] -
1]);
}
L600:
if (full != 2) {
L__1 = full != 0;
princr_(L__1, play_1.here);
}
rooms_1.rflag[play_1.here - 1] |= RSEEN;
if (full != 0 || ra == 0) {
return ret_val;
}
/* !ANYTHING MORE? */
prsvec_1.prsa = vindex_1.walkiw;
/* !GIVE HIM A SURPISE. */
if (! rappli_(ra)) {
goto L100;
}
/* !ROOM HANDLES, NEW DESC? */
prsvec_1.prsa = vindex_1.foow;
return ret_val;
} /* rmdesc_ */
/* RAPPLI- ROUTING ROUTINE FOR ROOM APPLICABLES */
/* DECLARATIONS */
logical rappli_(ri)
integer ri;
{
/* Initialized data */
const integer newrms = 38;
/* System generated locals */
logical ret_val;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (ri == 0) {
return ret_val;
}
/* !IF ZERO, WIN. */
if (ri < newrms) {
ret_val = rappl1_(ri);
}
/* !IF OLD, PROCESSOR 1. */
if (ri >= newrms) {
ret_val = rappl2_(ri);
}
/* !IF NEW, PROCESSOR 2. */
return ret_val;
} /* rappli_ */

BIN
dtextc.dat Normal file

Binary file not shown.

251
dungeon.6 Normal file
View File

@ -0,0 +1,251 @@
.TH DUNGEON 6 "March 11, 1991"
.SH NAME
dungeon\ -\ Adventures in the Dungeons of Doom
.SH SYNOPSIS
.B dungeon
.SH DESCRIPTION
Dungeon is a game of adventure, danger, and low cunning. In it
you will explore some of the most amazing territory ever seen by mortal
man. Hardened adventurers have run screaming from the terrors contained
within.
.LP
In Dungeon, the intrepid explorer delves into the forgotten secrets
of a lost labyrinth deep in the bowels of the earth, searching for
vast treasures long hidden from prying eyes, treasures guarded by
fearsome monsters and diabolical traps!
.LP
Dungeon was created at the Programming Technology Division of the MIT
Laboratory for Computer Science by Tim Anderson, Marc Blank, Bruce
Daniels, and Dave Lebling. It was inspired by the Adventure game of
Crowther and Woods, and the Dungeons and Dragons game of Gygax
and Arneson. The original version was written in MDL (alias MUDDLE).
The current version was translated from MDL into FORTRAN IV by
a somewhat paranoid DEC engineer who prefers to remain anonymous.
.LP
On-line information may be obtained with the commands HELP and INFO.
.SH DETAILS
Following is the summary produced by the
.B info
command:
.RS
.LP
Welcome to Zork!
.PP
You are near a large dungeon, which is reputed to contain vast
quantities of treasure. Naturally, you wish to acquire some of it.
In order to do so, you must of course remove it from the dungeon. To
receive full credit for it, you must deposit it safely in the trophy
case in the living room of the house.
.PP
In addition to valuables, the dungeon contains various objects
which may or may not be useful in your attempt to get rich. You may
need sources of light, since dungeons are often dark, and weapons,
since dungeons often have unfriendly things wandering about. Reading
material is scattered around the dungeon as well; some of it
is rumored to be useful.
.PP
To determine how successful you have been, a score is kept.
When you find a valuable object and pick it up, you receive a
certain number of points, which depends on the difficulty of finding
the object. You receive extra points for transporting the treasure
safely to the living room and placing it in the trophy case. In
addition, some particularly interesting rooms have a value associated
with visiting them. The only penalty is for getting yourself killed,
which you may do only twice.
.PP
Of special note is a thief (always carrying a large bag) who
likes to wander around in the dungeon (he has never been seen by the
light of day). He likes to take things. Since he steals for pleasure
rather than profit and is somewhat sadistic, he only takes things which
you have seen. Although he prefers valuables, sometimes in his haste
he may take something which is worthless. From time to time, he examines
his take and discards objects which he doesn't like. He may occasionally
stop in a room you are visiting, but more often he just wanders
through and rips you off (he is a skilled pickpocket).
.RE
.SH COMMANDS
.LP
.TP 15
.B brief
suppresses printing of long room descriptions
for rooms which have been visited.
.TP
.B superbrief
suppresses
printing of long room descriptions for all rooms.
.TP
.B verbose
restores long descriptions.
.TP
.B info
prints information which might give some idea
of what the game is about.
.TP
.B quit
prints your score and asks whether you wish
to continue playing.
.TP
.B save
saves the state of the game for later continuation.
.TP
.B restore
restores a saved game.
.TP
.B inventory
lists the objects in your possession.
.TP
.B look
prints a description of your surroundings.
.TP
.B score
prints your current score and ranking.
.TP
.B time
tells you how long you have been playing.
.TP
.B diagnose
reports on your injuries, if any.
.LP
The
.B inventory
command may be abbreviated
.BR i ;
the
.B look
command may be abbreviated
.BR l ;
the
.B quit
command may be abbreviated
.BR q .
.LP
A command that begins with '!' as the first character is taken to
be a shell command and is passed unchanged to the shell via
.I system(3).
.SH CONTAINMENT
.LP
Some objects can contain other objects. Many such containers can
be opened and closed. The rest are always open. They may or may
not be transparent. For you to access (e.g., take) an object
which is in a container, the container must be open. For you
to see such an object, the container must be either open or
transparent. Containers have a capacity, and objects have sizes;
the number of objects which will fit therefore depends on their
sizes. You may put any object you have access to (it need not be
in your hands) into any other object. At some point, the program
will attempt to pick it up if you don't already have it, which
process may fail if you're carrying too much. Although containers
can contain other containers, the program doesn't access more than
one level down.
.SH FIGHTING
.LP
Occupants of the dungeon will, as a rule, fight back when
attacked. In some cases, they may attack even if unprovoked.
Useful verbs here are
.I attack
<villain>
.I with
<weapon>,
.IR kill ,
etc. Knife-throwing may or may not be useful. You have a
fighting strength which varies with time. Being in a fight,
getting killed, and being injured all lower this strength.
Strength is regained with time. Thus, it is not a good idea to
fight someone immediately after being killed. Other details
should become apparent after a few melees or deaths.
.SH COMMAND\ PARSER
.LP
A command is one line of text terminated by a carriage return.
For reasons of simplicity, all words are distinguished by their
first six letters. All others are ignored. For example, typing
.I disassemble the encyclopedia
is not only meaningless, it also
creates excess effort for your fingers. Note that this truncation
may produce ambiguities in the intepretation of longer words.
[Also note that upper and lower case are equivalent.]
.LP
You are dealing with a fairly stupid parser, which understands
the following types of things:
.RS
.TP 5
.B Actions:
Among the more obvious of these, such as
.I take, put, drop,
etc.
Fairly general forms of these may be used, such as
.I pick up, put down,
etc.
.TP
.B Directions:
.I north, south, up, down,
etc. and their various abbreviations.
Other more obscure directions
.RI ( land,
.IR cross )
are appropriate in only certain situations.
.TP
.B Objects:
Most objects have names and can be referenced by them.
.TP
.B Adjectives:
Some adjectives are understood and required when there are
two objects which can be referenced with the same 'name' (e.g.,
.I doors,
.IR buttons ).
.TP
.B Prepositions:
It may be necessary in some cases to include prepositions, but
the parser attempts to handle cases which aren't ambiguous
without. Thus
.I give car to demon
will work, as will
.I give demon
.IR car .
.I give car demon
probably won't do anything interesting.
When a preposition is used, it should be appropriate;
.I give car with demon
won't parse.
.TP
.B Sentences:
The parser understands a reasonable number of syntactic construc-
tions. In particular, multiple commands (separated by commas)
can be placed on the same line.
.TP
.B Ambiguity:
The parser tries to be clever about what to do in the case of
actions which require objects that are not explicitly specified.
If there is only one possible object, the parser will assume
that it should be used. Otherwise, the parser will ask.
Most questions asked by the parser can be answered.
.RE
.SH FILES
dtextc.dat - encoded messages and initialization information
.br
dsave.dat - save file
.SH BUGS
For those familiar with the MDL version of the game on the ARPAnet,
the following is a list of the major incompatabilties:
.RS
-The first six letters of a word are considered
significant, instead of the first five.
.br
-The syntax for
.I tell, answer,
and
.I incant
is different.
.br
-Compound objects are not recognized.
.br
-Compound commands can be delimited with comma as well
as period.
.RE
.LP
Also, the palantir, brochure, and dead man problems are not
implemented.
.SH AUTHORS
.LP
Many people have had a hand in this version. See the "History" and
"README" files for credits. Send bug reports to ian@airs.com
(or uunet!airs!ian).

447
dverb1.c Normal file
View File

@ -0,0 +1,447 @@
/* TAKE-- BASIC TAKE SEQUENCE */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
/* TAKE AN OBJECT (FOR VERBS TAKE, PUT, DROP, READ, ETC.) */
logical take_(flg)
logical flg;
{
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer oa;
integer x;
ret_val = FALSE_;
/* !ASSUME LOSES. */
oa = objcts_1.oactio[prsvec_1.prso - 1];
/* !GET OBJECT ACTION. */
if (prsvec_1.prso <= star_1.strbit) {
goto L100;
}
/* !STAR? */
ret_val = objact_();
/* !YES, LET IT HANDLE. */
return ret_val;
L100:
x = objcts_1.ocan[prsvec_1.prso - 1];
/* !INSIDE? */
if (prsvec_1.prso != advs_1.avehic[play_1.winner - 1]) {
goto L400;
}
/* !HIS VEHICLE? */
rspeak_(672);
/* !DUMMY. */
return ret_val;
L400:
if ((objcts_1.oflag1[prsvec_1.prso - 1] & TAKEBT) != 0) {
goto L500;
}
if (! oappli_(oa, 0)) {
i__1 = rnd_(5) + 552;
rspeak_(i__1);
}
return ret_val;
/* OBJECT IS TAKEABLE AND IN POSITION TO BE TAKEN. */
L500:
if (x != 0 || qhere_(prsvec_1.prso, play_1.here)) {
goto L600;
}
if (objcts_1.oadv[prsvec_1.prso - 1] == play_1.winner) {
rspeak_(557);
}
/* !ALREADY GOT IT? */
return ret_val;
L600:
if (x != 0 && objcts_1.oadv[x - 1] == play_1.winner || weight_(0,
prsvec_1.prso, play_1.winner) + objcts_1.osize[prsvec_1.prso - 1]
<= state_1.mxload) {
goto L700;
}
rspeak_(558);
/* !TOO MUCH WEIGHT. */
return ret_val;
L700:
ret_val = TRUE_;
/* !AT LAST. */
if (oappli_(oa, 0)) {
return ret_val;
}
/* !DID IT HANDLE? */
newsta_(prsvec_1.prso, 0, 0, 0, play_1.winner);
/* !TAKE OBJECT FOR WINNER. */
objcts_1.oflag2[prsvec_1.prso - 1] |= TCHBT;
scrupd_(objcts_1.ofval[prsvec_1.prso - 1]);
/* !UPDATE SCORE. */
objcts_1.ofval[prsvec_1.prso - 1] = 0;
/* !CANT BE SCORED AGAIN. */
if (flg) {
rspeak_(559);
}
/* !TELL TAKEN. */
return ret_val;
} /* take_ */
/* DROP- DROP VERB PROCESSOR */
/* DECLARATIONS */
logical drop_(z)
logical z;
{
/* System generated locals */
logical ret_val;
/* Local variables */
logical f;
integer i, x;
ret_val = TRUE_;
/* !ASSUME WINS. */
x = objcts_1.ocan[prsvec_1.prso - 1];
/* !GET CONTAINER. */
if (x == 0) {
goto L200;
}
/* !IS IT INSIDE? */
if (objcts_1.oadv[x - 1] != play_1.winner) {
goto L1000;
}
/* !IS HE CARRYING CON? */
if ((objcts_1.oflag2[x - 1] & OPENBT) != 0) {
goto L300;
}
rspsub_(525, objcts_1.odesc2[x - 1]);
/* !CANT REACH. */
return ret_val;
L200:
if (objcts_1.oadv[prsvec_1.prso - 1] != play_1.winner) {
goto L1000;
}
/* !IS HE CARRYING OBJ? */
L300:
if (advs_1.avehic[play_1.winner - 1] == 0) {
goto L400;
}
/* !IS HE IN VEHICLE? */
prsvec_1.prsi = advs_1.avehic[play_1.winner - 1];
/* !YES, */
f = put_(1);
/* !DROP INTO VEHICLE. */
prsvec_1.prsi = 0;
/* !DISARM PARSER. */
return ret_val;
/* !DONE. */
L400:
newsta_(prsvec_1.prso, 0, play_1.here, 0, 0);
/* !DROP INTO ROOM. */
if (play_1.here == rindex_1.mtree) {
newsta_(prsvec_1.prso, 0, rindex_1.fore3, 0, 0);
}
scrupd_(objcts_1.ofval[prsvec_1.prso - 1]);
/* !SCORE OBJECT. */
objcts_1.ofval[prsvec_1.prso - 1] = 0;
/* !CANT BE SCORED AGAIN. */
objcts_1.oflag2[prsvec_1.prso - 1] |= TCHBT;
if (objact_()) {
return ret_val;
}
/* !DID IT HANDLE? */
i = 0;
/* !ASSUME NOTHING TO SAY. */
if (prsvec_1.prsa == vindex_1.dropw) {
i = 528;
}
if (prsvec_1.prsa == vindex_1.throww) {
i = 529;
}
if (i != 0 && play_1.here == rindex_1.mtree) {
i = 659;
}
rspsub_(i, objcts_1.odesc2[prsvec_1.prso - 1]);
return ret_val;
L1000:
rspeak_(527);
/* !DONT HAVE IT. */
return ret_val;
} /* drop_ */
/* PUT- PUT VERB PROCESSOR */
/* DECLARATIONS */
logical put_(flg)
logical flg;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer j;
integer svi, svo;
ret_val = FALSE_;
if (prsvec_1.prso <= star_1.strbit && prsvec_1.prsi <= star_1.strbit) {
goto L200;
}
if (! objact_()) {
rspeak_(560);
}
/* !STAR */
ret_val = TRUE_;
return ret_val;
L200:
if ((objcts_1.oflag2[prsvec_1.prsi - 1] & OPENBT) != 0 || (
objcts_1.oflag1[prsvec_1.prsi - 1] & DOORBT +
CONTBT) != 0 || (objcts_1.oflag2[prsvec_1.prsi - 1] &
VEHBT) != 0) {
goto L300;
}
rspeak_(561);
/* !CANT PUT IN THAT. */
return ret_val;
L300:
if ((objcts_1.oflag2[prsvec_1.prsi - 1] & OPENBT) != 0) {
goto L400;
}
/* !IS IT OPEN? */
rspeak_(562);
/* !NO, JOKE */
return ret_val;
L400:
if (prsvec_1.prso != prsvec_1.prsi) {
goto L500;
}
/* !INTO ITSELF? */
rspeak_(563);
/* !YES, JOKE. */
return ret_val;
L500:
if (objcts_1.ocan[prsvec_1.prso - 1] != prsvec_1.prsi) {
goto L600;
}
/* !ALREADY INSIDE. */
rspsb2_(564, objcts_1.odesc2[prsvec_1.prso - 1], objcts_1.odesc2[
prsvec_1.prsi - 1]);
ret_val = TRUE_;
return ret_val;
L600:
if (weight_(0, prsvec_1.prso, 0) + weight_(0, prsvec_1.prsi,
0) + objcts_1.osize[prsvec_1.prso - 1] <= objcts_1.ocapac[
prsvec_1.prsi - 1]) {
goto L700;
}
rspeak_(565);
/* !THEN CANT DO IT. */
return ret_val;
/* NOW SEE IF OBJECT (OR ITS CONTAINER) IS IN ROOM */
L700:
j = prsvec_1.prso;
/* !START SEARCH. */
L725:
if (qhere_(j, play_1.here)) {
goto L750;
}
/* !IS IT HERE? */
j = objcts_1.ocan[j - 1];
if (j != 0) {
goto L725;
}
/* !MORE TO DO? */
goto L800;
/* !NO, SCH FAILS. */
L750:
svo = prsvec_1.prso;
/* !SAVE PARSER. */
svi = prsvec_1.prsi;
prsvec_1.prsa = vindex_1.takew;
prsvec_1.prsi = 0;
if (! take_(0)) {
return ret_val;
}
/* !TAKE OBJECT. */
prsvec_1.prsa = vindex_1.putw;
prsvec_1.prso = svo;
prsvec_1.prsi = svi;
goto L1000;
/* NOW SEE IF OBJECT IS ON PERSON. */
L800:
if (objcts_1.ocan[prsvec_1.prso - 1] == 0) {
goto L1000;
}
/* !INSIDE? */
if ((objcts_1.oflag2[objcts_1.ocan[prsvec_1.prso - 1] - 1] &
OPENBT) != 0) {
goto L900;
}
/* !OPEN? */
rspsub_(566, objcts_1.odesc2[prsvec_1.prso - 1]);
/* !LOSE. */
return ret_val;
L900:
scrupd_(objcts_1.ofval[prsvec_1.prso - 1]);
/* !SCORE OBJECT. */
objcts_1.ofval[prsvec_1.prso - 1] = 0;
objcts_1.oflag2[prsvec_1.prso - 1] |= TCHBT;
newsta_(prsvec_1.prso, 0, 0, 0, play_1.winner);
/* !TEMPORARILY ON WINNER. */
L1000:
if (objact_()) {
return ret_val;
}
/* !NO, GIVE OBJECT A SHOT. */
newsta_(prsvec_1.prso, 2, 0, prsvec_1.prsi, 0);
/* !CONTAINED INSIDE. */
ret_val = TRUE_;
return ret_val;
} /* put_ */
/* VALUAC- HANDLES VALUABLES/EVERYTHING */
void valuac_(v)
integer v;
{
/* System generated locals */
integer i__1;
/* Local variables */
logical f;
integer i;
logical f1;
integer savep, saveh;
f = TRUE_;
/* !ASSUME NO ACTIONS. */
i = 579;
/* !ASSUME NOT LIT. */
if (! lit_(play_1.here)) {
goto L4000;
}
/* !IF NOT LIT, PUNT. */
i = 677;
/* !ASSUME WRONG VERB. */
savep = prsvec_1.prso;
/* !SAVE PRSO. */
saveh = play_1.here;
/* !SAVE HERE. */
/* L100: */
if (prsvec_1.prsa != vindex_1.takew) {
goto L1000;
}
/* !TAKE EVERY/VALUA? */
i__1 = objcts_1.olnt;
for (prsvec_1.prso = 1; prsvec_1.prso <= i__1; ++prsvec_1.prso) {
/* !LOOP THRU OBJECTS. */
if (! qhere_(prsvec_1.prso, play_1.here) || (objcts_1.oflag1[
prsvec_1.prso - 1] & VISIBT) == 0 || (
objcts_1.oflag2[prsvec_1.prso - 1] & ACTRBT) != 0 ||
savep == v && objcts_1.otval[prsvec_1.prso - 1] <= 0) {
goto L500;
}
if ((objcts_1.oflag1[prsvec_1.prso - 1] & TAKEBT) == 0 && (
objcts_1.oflag2[prsvec_1.prso - 1] & TRYBT) == 0) {
goto L500;
}
f = FALSE_;
rspsub_(580, objcts_1.odesc2[prsvec_1.prso - 1]);
f1 = take_(1);
if (saveh != play_1.here) {
return;
}
L500:
;
}
goto L3000;
L1000:
if (prsvec_1.prsa != vindex_1.dropw) {
goto L2000;
}
/* !DROP EVERY/VALUA? */
i__1 = objcts_1.olnt;
for (prsvec_1.prso = 1; prsvec_1.prso <= i__1; ++prsvec_1.prso) {
if (objcts_1.oadv[prsvec_1.prso - 1] != play_1.winner || savep == v
&& objcts_1.otval[prsvec_1.prso - 1] <= 0) {
goto L1500;
}
f = FALSE_;
rspsub_(580, objcts_1.odesc2[prsvec_1.prso - 1]);
f1 = drop_(1);
if (saveh != play_1.here) {
return;
}
L1500:
;
}
goto L3000;
L2000:
if (prsvec_1.prsa != vindex_1.putw) {
goto L3000;
}
/* !PUT EVERY/VALUA? */
i__1 = objcts_1.olnt;
for (prsvec_1.prso = 1; prsvec_1.prso <= i__1; ++prsvec_1.prso) {
/* !LOOP THRU OBJECTS. */
if (objcts_1.oadv[prsvec_1.prso - 1] != play_1.winner ||
prsvec_1.prso == prsvec_1.prsi || savep == v &&
objcts_1.otval[prsvec_1.prso - 1] <= 0 || (objcts_1.oflag1[
prsvec_1.prso - 1] & VISIBT) == 0) {
goto L2500;
}
f = FALSE_;
rspsub_(580, objcts_1.odesc2[prsvec_1.prso - 1]);
f1 = put_(1);
if (saveh != play_1.here) {
return;
}
L2500:
;
}
L3000:
i = 581;
if (savep == v) {
i = 582;
}
/* !CHOOSE MESSAGE. */
L4000:
if (f) {
rspeak_(i);
}
/* !IF NOTHING, REPORT. */
} /* valuac_ */

688
dverb2.c Normal file
View File

@ -0,0 +1,688 @@
/* SAVE- SAVE GAME STATE */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include "funcs.h"
#include "vars.h"
/* DECLARATIONS */
static integer cxappl_ P((integer));
void savegm_()
{
/* Local variables */
integer i;
FILE *e;
prsvec_1.prswon = FALSE_;
/* !DISABLE GAME. */
/* Note: save file format is different for PDP vs. non-PDP versions */
if ((e = fopen("dsave.dat", BINWRITE)) == NULL)
goto L100;
gttime_(&i);
/* !GET TIME. */
#define do_uio(i, zbuf, cbytes) \
(void) fwrite((const char *)(zbuf), (cbytes), (i), e)
do_uio(1, &vers_1.vmaj, sizeof(integer));
do_uio(1, &vers_1.vmin, sizeof(integer));
do_uio(1, &vers_1.vedit, sizeof(integer));
do_uio(1, &play_1.winner, sizeof(integer));
do_uio(1, &play_1.here, sizeof(integer));
do_uio(1, &hack_1.thfpos, sizeof(integer));
do_uio(1, &play_1.telflg, sizeof(logical));
do_uio(1, &hack_1.thfflg, sizeof(logical));
do_uio(1, &hack_1.thfact, sizeof(logical));
do_uio(1, &hack_1.swdact, sizeof(logical));
do_uio(1, &hack_1.swdsta, sizeof(integer));
do_uio(64, &puzzle_1.cpvec[0], sizeof(integer));
do_uio(1, &i, sizeof(integer));
do_uio(1, &state_1.moves, sizeof(integer));
do_uio(1, &state_1.deaths, sizeof(integer));
do_uio(1, &state_1.rwscor, sizeof(integer));
do_uio(1, &state_1.egscor, sizeof(integer));
do_uio(1, &state_1.mxload, sizeof(integer));
do_uio(1, &state_1.ltshft, sizeof(integer));
do_uio(1, &state_1.bloc, sizeof(integer));
do_uio(1, &state_1.mungrm, sizeof(integer));
do_uio(1, &state_1.hs, sizeof(integer));
do_uio(1, &screen_1.fromdr, sizeof(integer));
do_uio(1, &screen_1.scolrm, sizeof(integer));
do_uio(1, &screen_1.scolac, sizeof(integer));
do_uio(220, &objcts_1.odesc1[0], sizeof(integer));
do_uio(220, &objcts_1.odesc2[0], sizeof(integer));
do_uio(220, &objcts_1.oflag1[0], sizeof(integer));
do_uio(220, &objcts_1.oflag2[0], sizeof(integer));
do_uio(220, &objcts_1.ofval[0], sizeof(integer));
do_uio(220, &objcts_1.otval[0], sizeof(integer));
do_uio(220, &objcts_1.osize[0], sizeof(integer));
do_uio(220, &objcts_1.ocapac[0], sizeof(integer));
do_uio(220, &objcts_1.oroom[0], sizeof(integer));
do_uio(220, &objcts_1.oadv[0], sizeof(integer));
do_uio(220, &objcts_1.ocan[0], sizeof(integer));
do_uio(200, &rooms_1.rval[0], sizeof(integer));
do_uio(200, &rooms_1.rflag[0], sizeof(integer));
do_uio(4, &advs_1.aroom[0], sizeof(integer));
do_uio(4, &advs_1.ascore[0], sizeof(integer));
do_uio(4, &advs_1.avehic[0], sizeof(integer));
do_uio(4, &advs_1.astren[0], sizeof(integer));
do_uio(4, &advs_1.aflag[0], sizeof(integer));
do_uio(46, &flags[0], sizeof(logical));
do_uio(22, &switch_[0], sizeof(integer));
do_uio(4, &vill_1.vprob[0], sizeof(integer));
do_uio(25, &cevent_1.cflag[0], sizeof(logical));
do_uio(25, &cevent_1.ctick[0], sizeof(integer));
#undef do_uio
if (fclose(e) == EOF)
goto L100;
rspeak_(597);
return;
L100:
rspeak_(598);
/* !CANT DO IT. */
} /* savegm_ */
/* RESTORE- RESTORE GAME STATE */
/* DECLARATIONS */
void rstrgm_()
{
/* Local variables */
integer i, j, k;
FILE *e;
prsvec_1.prswon = FALSE_;
/* !DISABLE GAME. */
/* Note: save file format is different for PDP vs. non-PDP versions */
if ((e = fopen("dsave.dat", BINREAD)) == NULL)
goto L100;
#define do_uio(i, zbuf, cbytes) \
(void)fread((char *)(zbuf), (cbytes), (i), e)
do_uio(1, &i, sizeof(integer));
do_uio(1, &j, sizeof(integer));
do_uio(1, &k, sizeof(integer));
if (i != vers_1.vmaj | j != vers_1.vmin) {
goto L200;
}
do_uio(1, &play_1.winner, sizeof(integer));
do_uio(1, &play_1.here, sizeof(integer));
do_uio(1, &hack_1.thfpos, sizeof(integer));
do_uio(1, &play_1.telflg, sizeof(logical));
do_uio(1, &hack_1.thfflg, sizeof(logical));
do_uio(1, &hack_1.thfact, sizeof(logical));
do_uio(1, &hack_1.swdact, sizeof(logical));
do_uio(1, &hack_1.swdsta, sizeof(integer));
do_uio(64, &puzzle_1.cpvec[0], sizeof(integer));
do_uio(1, &time_1.pltime, sizeof(integer));
do_uio(1, &state_1.moves, sizeof(integer));
do_uio(1, &state_1.deaths, sizeof(integer));
do_uio(1, &state_1.rwscor, sizeof(integer));
do_uio(1, &state_1.egscor, sizeof(integer));
do_uio(1, &state_1.mxload, sizeof(integer));
do_uio(1, &state_1.ltshft, sizeof(integer));
do_uio(1, &state_1.bloc, sizeof(integer));
do_uio(1, &state_1.mungrm, sizeof(integer));
do_uio(1, &state_1.hs, sizeof(integer));
do_uio(1, &screen_1.fromdr, sizeof(integer));
do_uio(1, &screen_1.scolrm, sizeof(integer));
do_uio(1, &screen_1.scolac, sizeof(integer));
do_uio(220, &objcts_1.odesc1[0], sizeof(integer));
do_uio(220, &objcts_1.odesc2[0], sizeof(integer));
do_uio(220, &objcts_1.oflag1[0], sizeof(integer));
do_uio(220, &objcts_1.oflag2[0], sizeof(integer));
do_uio(220, &objcts_1.ofval[0], sizeof(integer));
do_uio(220, &objcts_1.otval[0], sizeof(integer));
do_uio(220, &objcts_1.osize[0], sizeof(integer));
do_uio(220, &objcts_1.ocapac[0], sizeof(integer));
do_uio(220, &objcts_1.oroom[0], sizeof(integer));
do_uio(220, &objcts_1.oadv[0], sizeof(integer));
do_uio(220, &objcts_1.ocan[0], sizeof(integer));
do_uio(200, &rooms_1.rval[0], sizeof(integer));
do_uio(200, &rooms_1.rflag[0], sizeof(integer));
do_uio(4, &advs_1.aroom[0], sizeof(integer));
do_uio(4, &advs_1.ascore[0], sizeof(integer));
do_uio(4, &advs_1.avehic[0], sizeof(integer));
do_uio(4, &advs_1.astren[0], sizeof(integer));
do_uio(4, &advs_1.aflag[0], sizeof(integer));
do_uio(46, &flags[0], sizeof(logical));
do_uio(22, &switch_[0], sizeof(integer));
do_uio(4, &vill_1.vprob[0], sizeof(integer));
do_uio(25, &cevent_1.cflag[0], sizeof(logical));
do_uio(25, &cevent_1.ctick[0], sizeof(integer));
(void)fclose(e);
rspeak_(599);
return;
L100:
rspeak_(598);
/* !CANT DO IT. */
return;
L200:
rspeak_(600);
/* !OBSOLETE VERSION */
(void)fclose(e);
} /* rstrgm_ */
/* WALK- MOVE IN SPECIFIED DIRECTION */
/* DECLARATIONS */
logical walk_()
{
/* System generated locals */
logical ret_val;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (play_1.winner != aindex_1.player || lit_(play_1.here) || prob_(25,
25)) {
goto L500;
}
if (! findxt_(prsvec_1.prso, play_1.here)) {
goto L450;
}
/* !INVALID EXIT? GRUE */
/* ! */
switch (curxt_1.xtype) {
case 1: goto L400;
case 2: goto L200;
case 3: goto L100;
case 4: goto L300;
}
/* !DECODE EXIT TYPE. */
bug_(9, curxt_1.xtype);
L100:
if (cxappl_(curxt_1.xactio) != 0) {
goto L400;
}
/* !CEXIT... RETURNED ROOM? */
if (flags[*xflag - 1]) {
goto L400;
}
/* !NO, FLAG ON? */
L200:
jigsup_(523);
/* !BAD EXIT, GRUE */
/* ! */
return ret_val;
L300:
if (cxappl_(curxt_1.xactio) != 0) {
goto L400;
}
/* !DOOR... RETURNED ROOM? */
if ((objcts_1.oflag2[curxt_1.xobj - 1] & OPENBT) != 0) {
goto L400;
}
/* !NO, DOOR OPEN? */
jigsup_(523);
/* !BAD EXIT, GRUE */
/* ! */
return ret_val;
L400:
if (lit_(curxt_1.xroom1)) {
goto L900;
}
/* !VALID ROOM, IS IT LIT? */
L450:
jigsup_(522);
/* !NO, GRUE */
/* ! */
return ret_val;
/* ROOM IS LIT, OR WINNER IS NOT PLAYER (NO GRUE). */
L500:
if (findxt_(prsvec_1.prso, play_1.here)) {
goto L550;
}
/* !EXIT EXIST? */
L525:
curxt_1.xstrng = 678;
/* !ASSUME WALL. */
if (prsvec_1.prso == xsrch_1.xup) {
curxt_1.xstrng = 679;
}
/* !IF UP, CANT. */
if (prsvec_1.prso == xsrch_1.xdown) {
curxt_1.xstrng = 680;
}
/* !IF DOWN, CANT. */
if ((rooms_1.rflag[play_1.here - 1] & RNWALL) != 0) {
curxt_1.xstrng = 524;
}
rspeak_(curxt_1.xstrng);
prsvec_1.prscon = 1;
/* !STOP CMD STREAM. */
return ret_val;
L550:
switch (curxt_1.xtype) {
case 1: goto L900;
case 2: goto L600;
case 3: goto L700;
case 4: goto L800;
}
/* !BRANCH ON EXIT TYPE. */
bug_(9, curxt_1.xtype);
L700:
if (cxappl_(curxt_1.xactio) != 0) {
goto L900;
}
/* !CEXIT... RETURNED ROOM? */
if (flags[*xflag - 1]) {
goto L900;
}
/* !NO, FLAG ON? */
L600:
if (curxt_1.xstrng == 0) {
goto L525;
}
/* !IF NO REASON, USE STD. */
rspeak_(curxt_1.xstrng);
/* !DENY EXIT. */
prsvec_1.prscon = 1;
/* !STOP CMD STREAM. */
return ret_val;
L800:
if (cxappl_(curxt_1.xactio) != 0) {
goto L900;
}
/* !DOOR... RETURNED ROOM? */
if ((objcts_1.oflag2[curxt_1.xobj - 1] & OPENBT) != 0) {
goto L900;
}
/* !NO, DOOR OPEN? */
if (curxt_1.xstrng == 0) {
curxt_1.xstrng = 525;
}
/* !IF NO REASON, USE STD. */
rspsub_(curxt_1.xstrng, objcts_1.odesc2[curxt_1.xobj - 1]);
prsvec_1.prscon = 1;
/* !STOP CMD STREAM. */
return ret_val;
L900:
ret_val = moveto_(curxt_1.xroom1, play_1.winner);
/* !MOVE TO ROOM. */
if (ret_val) {
ret_val = rmdesc_(0);
}
/* !DESCRIBE ROOM. */
return ret_val;
} /* walk_ */
/* CXAPPL- CONDITIONAL EXIT PROCESSORS */
/* DECLARATIONS */
static integer cxappl_(ri)
integer ri;
{
/* System generated locals */
integer ret_val, i__1;
/* Local variables */
integer i, j, k;
integer nxt;
integer ldir;
ret_val = 0;
/* !NO RETURN. */
if (ri == 0) {
return ret_val;
}
/* !IF NO ACTION, DONE. */
switch (ri) {
case 1: goto L1000;
case 2: goto L2000;
case 3: goto L3000;
case 4: goto L4000;
case 5: goto L5000;
case 6: goto L6000;
case 7: goto L7000;
case 8: goto L8000;
case 9: goto L9000;
case 10: goto L10000;
case 11: goto L11000;
case 12: goto L12000;
case 13: goto L13000;
case 14: goto L14000;
}
bug_(5, ri);
/* C1- COFFIN-CURE */
L1000:
findex_1.egyptf = objcts_1.oadv[oindex_1.coffi - 1] != play_1.winner;
/* !T IF NO COFFIN. */
return ret_val;
/* C2- CAROUSEL EXIT */
/* C5- CAROUSEL OUT */
L2000:
if (findex_1.caroff) {
return ret_val;
}
/* !IF FLIPPED, NOTHING. */
L2500:
rspeak_(121);
/* !SPIN THE COMPASS. */
L5000:
i = xpars_1.xelnt[xpars_1.xcond - 1] * rnd_(8);
/* !CHOOSE RANDOM EXIT. */
curxt_1.xroom1 = exits_1.travel[rooms_1.rexit[play_1.here - 1] + i - 1] &
xpars_1.xrmask;
ret_val = curxt_1.xroom1;
/* !RETURN EXIT. */
return ret_val;
/* C3- CHIMNEY FUNCTION */
L3000:
findex_1.litldf = FALSE_;
/* !ASSUME HEAVY LOAD. */
j = 0;
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !COUNT OBJECTS. */
if (objcts_1.oadv[i - 1] == play_1.winner) {
++j;
}
/* L3100: */
}
if (j > 2) {
return ret_val;
}
/* !CARRYING TOO MUCH? */
curxt_1.xstrng = 446;
/* !ASSUME NO LAMP. */
if (objcts_1.oadv[oindex_1.lamp - 1] != play_1.winner) {
return ret_val;
}
/* !NO LAMP? */
findex_1.litldf = TRUE_;
/* !HE CAN DO IT. */
if ((objcts_1.oflag2[oindex_1.door - 1] & OPENBT) == 0) {
objcts_1.oflag2[oindex_1.door - 1] &= ~ TCHBT;
}
return ret_val;
/* C4- FROBOZZ FLAG (MAGNET ROOM, FAKE EXIT) */
/* C6- FROBOZZ FLAG (MAGNET ROOM, REAL EXIT) */
L4000:
if (findex_1.caroff) {
goto L2500;
}
/* !IF FLIPPED, GO SPIN. */
findex_1.frobzf = FALSE_;
/* !OTHERWISE, NOT AN EXIT. */
return ret_val;
L6000:
if (findex_1.caroff) {
goto L2500;
}
/* !IF FLIPPED, GO SPIN. */
findex_1.frobzf = TRUE_;
/* !OTHERWISE, AN EXIT. */
return ret_val;
/* C7- FROBOZZ FLAG (BANK ALARM) */
L7000:
findex_1.frobzf = objcts_1.oroom[oindex_1.bills - 1] != 0 &
objcts_1.oroom[oindex_1.portr - 1] != 0;
return ret_val;
/* CXAPPL, PAGE 3 */
/* C8- FROBOZZ FLAG (MRGO) */
L8000:
findex_1.frobzf = FALSE_;
/* !ASSUME CANT MOVE. */
if (findex_1.mloc != curxt_1.xroom1) {
goto L8100;
}
/* !MIRROR IN WAY? */
if (prsvec_1.prso == xsrch_1.xnorth || prsvec_1.prso == xsrch_1.xsouth) {
goto L8200;
}
if (findex_1.mdir % 180 != 0) {
goto L8300;
}
/* !MIRROR MUST BE N-S. */
curxt_1.xroom1 = (curxt_1.xroom1 - rindex_1.mra << 1) + rindex_1.mrae;
/* !CALC EAST ROOM. */
if (prsvec_1.prso > xsrch_1.xsouth) {
++curxt_1.xroom1;
}
/* !IF SW/NW, CALC WEST. */
L8100:
ret_val = curxt_1.xroom1;
return ret_val;
L8200:
curxt_1.xstrng = 814;
/* !ASSUME STRUC BLOCKS. */
if (findex_1.mdir % 180 == 0) {
return ret_val;
}
/* !IF MIRROR N-S, DONE. */
L8300:
ldir = findex_1.mdir;
/* !SEE WHICH MIRROR. */
if (prsvec_1.prso == xsrch_1.xsouth) {
ldir = 180;
}
curxt_1.xstrng = 815;
/* !MIRROR BLOCKS. */
if (ldir > 180 && ! findex_1.mr1f || ldir < 180 && ! findex_1.mr2f) {
curxt_1.xstrng = 816;
}
return ret_val;
/* C9- FROBOZZ FLAG (MIRIN) */
L9000:
if (mrhere_(play_1.here) != 1) {
goto L9100;
}
/* !MIRROR 1 HERE? */
if (findex_1.mr1f) {
curxt_1.xstrng = 805;
}
/* !SEE IF BROKEN. */
findex_1.frobzf = findex_1.mropnf;
/* !ENTER IF OPEN. */
return ret_val;
L9100:
findex_1.frobzf = FALSE_;
/* !NOT HERE, */
curxt_1.xstrng = 817;
/* !LOSE. */
return ret_val;
/* CXAPPL, PAGE 4 */
/* C10- FROBOZZ FLAG (MIRROR EXIT) */
L10000:
findex_1.frobzf = FALSE_;
/* !ASSUME CANT. */
ldir = (prsvec_1.prso - xsrch_1.xnorth) / xsrch_1.xnorth * 45;
/* !XLATE DIR TO DEGREES. */
if (! findex_1.mropnf || (findex_1.mdir + 270) % 360 != ldir &&
prsvec_1.prso != xsrch_1.xexit) {
goto L10200;
}
curxt_1.xroom1 = (findex_1.mloc - rindex_1.mra << 1) + rindex_1.mrae + 1
- findex_1.mdir / 180;
/* !ASSUME E-W EXIT. */
if (findex_1.mdir % 180 == 0) {
goto L10100;
}
/* !IF N-S, OK. */
curxt_1.xroom1 = findex_1.mloc + 1;
/* !ASSUME N EXIT. */
if (findex_1.mdir > 180) {
curxt_1.xroom1 = findex_1.mloc - 1;
}
/* !IF SOUTH. */
L10100:
ret_val = curxt_1.xroom1;
return ret_val;
L10200:
if (! findex_1.wdopnf || (findex_1.mdir + 180) % 360 != ldir &&
prsvec_1.prso != xsrch_1.xexit) {
return ret_val;
}
curxt_1.xroom1 = findex_1.mloc + 1;
/* !ASSUME N. */
if (findex_1.mdir == 0) {
curxt_1.xroom1 = findex_1.mloc - 1;
}
/* !IF S. */
rspeak_(818);
/* !CLOSE DOOR. */
findex_1.wdopnf = FALSE_;
ret_val = curxt_1.xroom1;
return ret_val;
/* C11- MAYBE DOOR. NORMAL MESSAGE IS THAT DOOR IS CLOSED. */
/* BUT IF LCELL.NE.4, DOOR ISNT THERE. */
L11000:
if (findex_1.lcell != 4) {
curxt_1.xstrng = 678;
}
/* !SET UP MSG. */
return ret_val;
/* C12- FROBZF (PUZZLE ROOM MAIN ENTRANCE) */
L12000:
findex_1.frobzf = TRUE_;
/* !ALWAYS ENTER. */
findex_1.cphere = 10;
/* !SET SUBSTATE. */
return ret_val;
/* C13- CPOUTF (PUZZLE ROOM SIZE ENTRANCE) */
L13000:
findex_1.cphere = 52;
/* !SET SUBSTATE. */
return ret_val;
/* CXAPPL, PAGE 5 */
/* C14- FROBZF (PUZZLE ROOM TRANSITIONS) */
L14000:
findex_1.frobzf = FALSE_;
/* !ASSSUME LOSE. */
if (prsvec_1.prso != xsrch_1.xup) {
goto L14100;
}
/* !UP? */
if (findex_1.cphere != 10) {
return ret_val;
}
/* !AT EXIT? */
curxt_1.xstrng = 881;
/* !ASSUME NO LADDER. */
if (puzzle_1.cpvec[findex_1.cphere] != -2) {
return ret_val;
}
/* !LADDER HERE? */
rspeak_(882);
/* !YOU WIN. */
findex_1.frobzf = TRUE_;
/* !LET HIM OUT. */
return ret_val;
L14100:
if (findex_1.cphere != 52 || prsvec_1.prso != xsrch_1.xwest || !
findex_1.cpoutf) {
goto L14200;
}
findex_1.frobzf = TRUE_;
/* !YES, LET HIM OUT. */
return ret_val;
L14200:
for (i = 1; i <= 16; i += 2) {
/* !LOCATE EXIT. */
if (prsvec_1.prso == puzzle_1.cpdr[i - 1]) {
goto L14400;
}
/* L14300: */
}
return ret_val;
/* !NO SUCH EXIT. */
L14400:
j = puzzle_1.cpdr[i];
/* !GET DIRECTIONAL OFFSET. */
nxt = findex_1.cphere + j;
/* !GET NEXT STATE. */
k = 8;
/* !GET ORTHOGONAL DIR. */
if (j < 0) {
k = -8;
}
if ((abs(j) == 1 || abs(j) == 8 || (puzzle_1.cpvec[findex_1.cphere + k -
1] == 0 || puzzle_1.cpvec[nxt - k - 1] == 0)) && puzzle_1.cpvec[
nxt - 1] == 0) {
goto L14500;
}
return ret_val;
L14500:
cpgoto_(nxt);
/* !MOVE TO STATE. */
curxt_1.xroom1 = rindex_1.cpuzz;
/* !STAY IN ROOM. */
ret_val = curxt_1.xroom1;
return ret_val;
} /* cxappl_ */

135
funcs.h Normal file
View File

@ -0,0 +1,135 @@
/* funcs.h -- functions for dungeon */
#ifndef FUNCS_H
#define FUNCS_H
/* If __STDC__ is not defined, don't use function prototypes, void, or
* const.
*/
#ifdef __STDC__
#define P(x) x
#else
#define P(x) ()
#define void int
#define const
#endif
/* Try to guess whether we need "rb" to open files in binary mode.
* If this is unix, it doesn't matter. Otherwise, assume that if
* __STDC__ is defined we can use "rb". Otherwise, assume that we
* had better use "r" or fopen will fail.
*/
#ifdef unix
#define BINREAD "r"
#define BINWRITE "w"
#else /* ! unix */
#ifdef __STDC__
#define BINREAD "rb"
#define BINWRITE "wb"
#else /* ! __STDC__ */
#define BINREAD "r"
#define BINWRITE "w"
#endif /* ! __STDC__ */
#endif /* ! unix */
typedef int integer;
typedef int logical;
#define TRUE_ (1)
#define FALSE_ (0)
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define min(a,b) ((a) <= (b) ? (a) : (b))
#define max(a,b) ((a) >= (b) ? (a) : (b))
extern logical
protected P((void)),
wizard P((void));
extern void
more_init P((void)),
more_output P((const char *)),
more_input P((void));
extern void
bug_ P((integer, integer)),
cevapp_ P((integer)),
cpgoto_ P((integer)),
cpinfo_ P((integer, integer)),
encryp_ P((const char *, char *)),
exit_ P((void)),
fightd_ P((void)),
game_ P((void)),
gdt_ P((void)),
gttime_ P((integer *)),
invent_ P((integer)),
itime_ P((integer *, integer *, integer *)),
jigsup_ P((integer)),
newsta_ P((integer, integer, integer, integer, integer)),
orphan_ P((integer, integer, integer, integer, integer)),
princo_ P((integer, integer)),
princr_ P((logical, integer)),
rdline_ P((char *, integer)),
rspeak_ P((integer)),
rspsb2_ P((integer, integer, integer)),
rspsub_ P((integer, integer)),
rstrgm_ P((void)),
savegm_ P((void)),
score_ P((logical)),
scrupd_ P((integer)),
swordd_ P((void)),
thiefd_ P((void)),
valuac_ P((integer));
extern integer
blow_ P((integer, integer, integer, logical, integer)),
fights_ P((integer, logical)),
fwim_ P((integer, integer, integer, integer, integer, logical)),
getobj_ P((integer, integer, integer)),
schlst_ P((integer, integer, integer, integer, integer, integer)),
mrhere_ P((integer)),
oactor_ P((integer)),
rnd_ P((integer)),
robadv_ P((integer, integer, integer, integer)),
robrm_ P((integer, integer, integer, integer, integer)),
sparse_ P((const integer *, integer, logical)),
vilstr_ P((integer)),
weight_ P((integer, integer, integer));
extern logical
aappli_ P((integer)),
ballop_ P((integer)),
clockd_ P((void)),
cyclop_ P((integer)),
drop_ P((logical)),
findxt_ P((integer, integer)),
ghere_ P((integer, integer)),
init_ P((void)),
lightp_ P((integer)),
lit_ P((integer)),
moveto_ P((integer, integer)),
nobjs_ P((integer, integer)),
oappli_ P((integer, integer)),
objact_ P((void)),
opncls_ P((integer, integer, integer)),
parse_ P((char *, logical)),
prob_ P((integer, integer)),
put_ P((logical)),
rappli_ P((integer)),
rappl1_ P((integer)),
rappl2_ P((integer)),
rmdesc_ P((integer)),
sobjs_ P((integer, integer)),
sverbs_ P((integer)),
synmch_ P((void)),
take_ P((logical)),
thiefp_ P((integer)),
trollp_ P((integer)),
qempty_ P((integer)),
qhere_ P((integer, integer)),
vappli_ P((integer)),
walk_ P((void)),
winnin_ P((integer, integer)),
yesno_ P((integer, integer, integer));
#endif

788
gdt.c Normal file
View File

@ -0,0 +1,788 @@
/* GDT- GAME DEBUGGING TOOL */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include <ctype.h>
#include "funcs.h"
#include "vars.h"
#include "parse.h"
#ifdef ALLOW_GDT
void gdt_()
{
/* Initialized data */
const integer cmdmax = 38;
const char *dbgcmd =
"DRDODADCDXDHDLDVDFDSAFHENRNTNCNDRRRTRCRDTKEXARAOAAACAXAVD2DNANDMDTAHDPPDDZAZ";
static const integer argtyp[38] = { 2,2,2,2,2,0,0,2,2,0,1,0,0,0,0,0,0,
0,0,0,1,0,3,3,3,3,1,3,2,2,1,2,1,0,0,0,0,1 };
/* System generated locals */
integer i__1, i__2;
/* Local variables */
integer i, j, k, l, l1;
char cmd[3];
integer fmax, smax;
char buf[80];
char *z;
/* FIRST, VALIDATE THAT THE CALLER IS AN IMPLEMENTER. */
fmax = 46;
/* !SET ARRAY LIMITS. */
smax = 22;
if (debug_1.gdtflg != 0) {
goto L2000;
}
/* !IF OK, SKIP. */
more_output("You are not an authorized user.");
/* !NOT AN IMPLEMENTER. */
return;
/* !BOOT HIM OFF */
/* GDT, PAGE 2A */
/* HERE TO GET NEXT COMMAND */
L2000:
printf("GDT>");
/* !OUTPUT PROMPT. */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
cmd[0] = ' ';
cmd[1] = ' ';
sscanf(buf, "%2s", cmd);
/* !GET COMMAND. */
if (cmd[0] == '\0')
goto L2000;
/* !IGNORE BLANKS. */
if (islower(cmd[0]))
cmd[0] = toupper(cmd[0]);
if (islower(cmd[1]))
cmd[1] = toupper(cmd[1]);
i__1 = cmdmax;
for (i = 1; i <= i__1; ++i) {
/* !LOOK IT UP. */
if (cmd[0] == dbgcmd[(i - 1) << 1] &&
cmd[1] == dbgcmd[((i - 1) << 1) + 1]) {
goto L2300;
}
/* !FOUND? */
/* L2100: */
}
L2200:
more_output("?");
/* !NO, LOSE. */
goto L2000;
/* L230: */
/* L240: */
/* L225: */
/* L235: */
/* L245: */
L2300:
switch (argtyp[i - 1] + 1) {
case 1: goto L2400;
case 2: goto L2500;
case 3: goto L2600;
case 4: goto L2700;
}
/* !BRANCH ON ARG TYPE. */
goto L2200;
/* !ILLEGAL TYPE. */
L2700:
printf("Idx,Ary: ");
/* !TYPE 3, REQUEST ARRAY COORDS. */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
for (z = buf; *z != '\0'; z++)
if (*z == ',')
*z = ' ';
j = 0;
k = 0;
sscanf(buf, "%d %d", &j, &k);
goto L2400;
L2600:
printf("Limits: ");
/* !TYPE 2, READ BOUNDS. */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
for (z = buf; *z != '\0'; z++)
if (*z == ',')
*z = ' ';
j = 0;
k = 0;
sscanf(buf, "%d %d", &j, &k);
if (k == 0) {
k = j;
}
goto L2400;
L2500:
printf("Entry: ");
/* !TYPE 1, READ ENTRY NO. */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
j = 0;
sscanf(buf, "%d", &j);
L2400:
switch (i) {
case 1: goto L10000;
case 2: goto L11000;
case 3: goto L12000;
case 4: goto L13000;
case 5: goto L14000;
case 6: goto L15000;
case 7: goto L16000;
case 8: goto L17000;
case 9: goto L18000;
case 10: goto L19000;
case 11: goto L20000;
case 12: goto L21000;
case 13: goto L22000;
case 14: goto L23000;
case 15: goto L24000;
case 16: goto L25000;
case 17: goto L26000;
case 18: goto L27000;
case 19: goto L28000;
case 20: goto L29000;
case 21: goto L30000;
case 22: goto L31000;
case 23: goto L32000;
case 24: goto L33000;
case 25: goto L34000;
case 26: goto L35000;
case 27: goto L36000;
case 28: goto L37000;
case 29: goto L38000;
case 30: goto L39000;
case 31: goto L40000;
case 32: goto L41000;
case 33: goto L42000;
case 34: goto L43000;
case 35: goto L44000;
case 36: goto L45000;
case 37: goto L46000;
case 38: goto L47000;
}
goto L2200;
/* !WHAT??? */
/* GDT, PAGE 3 */
/* DR-- DISPLAY ROOMS */
L10000:
if (! (j > 0 && j <= rooms_1.rlnt && (k > 0 && k <= rooms_1.rlnt) && j <=
k)) {
goto L2200;
}
/* !ARGS VALID? */
more_output("RM# DESC1 DESC2 EXITS ACTION VALUE FLAGS");
/* !COL HDRS. */
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("%3d", i);
for (l = 1; l <= 6; ++l)
printf(" %6d", eqr[i + l * 200 - 201]);
printf("\n");
/* L10100: */
}
goto L2000;
/* DO-- DISPLAY OBJECTS */
L11000:
if (! (j > 0 && j <= objcts_1.olnt && (k > 0 && k <= objcts_1.olnt) && j
<= k)) {
goto L2200;
}
/* !ARGS VALID? */
more_output("OB# DESC1 DESC2 DESCO ACT FLAGS1 FLAGS2 FVL TVL SIZE CAPAC ROOM ADV CON READ");
/* !COL HDRS */
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("%3d%6d%6d%6d%4d%7d%7d%4d%4d%6d%6d %4d%4d%4d%6d\n",
i, eqo[i + 1 * 220 - 221], eqo[i + 2 * 220 - 221],
eqo[i + 3 * 220 - 221], eqo[i + 4 * 220 - 221],
eqo[i + 5 * 220 - 221], eqo[i + 6 * 220 - 221],
eqo[i + 7 * 220 - 221], eqo[i + 8 * 220 - 221],
eqo[i + 9 * 220 - 221], eqo[i + 10 * 220 - 221],
eqo[i + 11 * 220 - 221], eqo[i + 12 * 220 - 221],
eqo[i + 13 * 220 - 221], eqo[i + 14 * 220 - 221]);
/* L11100: */
}
goto L2000;
/* DA-- DISPLAY ADVENTURERS */
L12000:
if (! (j > 0 && j <= advs_1.alnt && (k > 0 && k <= advs_1.alnt) && j <= k)
) {
goto L2200;
}
/* !ARGS VALID? */
more_output("AD# ROOM SCORE VEHIC OBJECT ACTION STREN FLAGS");
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("%3d", i);
for (l = 1; l <= 7; ++l)
printf(" %6d", eqa[i + (l << 2) - 5]);
printf("\n");
/* L12100: */
}
goto L2000;
/* DC-- DISPLAY CLOCK EVENTS */
L13000:
if (! (j > 0 && j <= cevent_1.clnt && (k > 0 && k <= cevent_1.clnt) && j
<= k)) {
goto L2200;
}
/* !ARGS VALID? */
more_output("CL# TICK ACTION FLAG");
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("%3d %6d %6d %c\n", i, eqc[i + 1 * 25 - 26],
eqc[i + 2 * 25 - 26],
cevent_1.cflag[i - 1] ? 'T' : 'F');
/* L13100: */
}
goto L2000;
/* DX-- DISPLAY EXITS */
L14000:
if (! (j > 0 && j <= exits_1.xlnt && (k > 0 && k <= exits_1.xlnt) && j <=
k)) {
goto L2200;
}
/* !ARGS VALID? */
more_output(" RANGE CONTENTS");
/* !COL HDRS. */
i__1 = k;
for (i = j; i <= i__1; i += 10) {
/* !TEN PER LINE. */
/* Computing MIN */
i__2 = i + 9;
l = min(i__2,k);
/* !COMPUTE END OF LINE. */
more_output(NULL);
printf("%3d-%3d ", i, l);
for (l1 = i; l1 <= l; ++l1)
printf("%7d", exits_1.travel[l1 - 1]);
printf("\n");
/* L14100: */
}
goto L2000;
/* DH-- DISPLAY HACKS */
L15000:
more_output(NULL);
printf("THFPOS= %d, THFFLG= %c, THFACT= %c\n",
hack_1.thfpos, hack_1.thfflg ? 'T' : 'F',
hack_1.thfact ? 'T' : 'F');
more_output(NULL);
printf("SWDACT= %c, SWDSTA= %d\n", hack_1.swdact ? 'T' : 'F',
hack_1.swdsta);
goto L2000;
/* DL-- DISPLAY LENGTHS */
L16000:
more_output(NULL);
printf("R=%d, X=%d, O=%d, C=%d\n", rooms_1.rlnt, exits_1.xlnt,
objcts_1.olnt, cevent_1.clnt);
more_output(NULL);
printf("V=%d, A=%d, M=%d, R2=%d\n", vill_1.vlnt, advs_1.alnt,
rmsg_1.mlnt, oroom2_1.r2lnt);
more_output(NULL);
printf("MBASE=%d, STRBIT=%d\n", star_1.mbase, star_1.strbit);
goto L2000;
/* DV-- DISPLAY VILLAINS */
L17000:
if (! (j > 0 && j <= vill_1.vlnt && (k > 0 && k <= vill_1.vlnt) && j <= k)
) {
goto L2200;
}
/* !ARGS VALID? */
more_output("VL# OBJECT PROB OPPS BEST MELEE");
/* !COL HDRS */
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("%3d", i);
for (l = 1; l <= 5; ++l)
printf(" %6d", eqv[i + (l << 2) - 5]);
printf("\n");
/* L17100: */
}
goto L2000;
/* DF-- DISPLAY FLAGS */
L18000:
if (! (j > 0 && j <= fmax && (k > 0 && k <= fmax) && j <= k)) {
goto L2200;
}
/* !ARGS VALID? */
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("Flag #%-2d = %c\n", i, flags[i - 1] ? 'T' : 'F');
/* L18100: */
}
goto L2000;
/* DS-- DISPLAY STATE */
L19000:
more_output(NULL);
printf("Parse vector= %6d %6d %6d %c %6d\n",
prsvec_1.prsa, prsvec_1.prso, prsvec_1.prsi,
prsvec_1.prswon ? 'T' : 'F', prsvec_1.prscon);
more_output(NULL);
printf("Play vector= %6d %6d %c\n", play_1.winner, play_1.here,
play_1.telflg ? 'T' : 'F');
more_output(NULL);
printf("State vector= %6d %6d %6d %6d %6d %6d %6d %6d %6d\n",
state_1.moves, state_1.deaths, state_1.rwscor, state_1.mxscor,
state_1.mxload, state_1.ltshft, state_1.bloc, state_1.mungrm,
state_1.hs);
more_output(NULL);
printf(" %6d %6d\n", state_1.egscor, state_1.egmxsc);
more_output(NULL);
printf("Scol vector= %6d %6d %6d\n", screen_1.fromdr,
screen_1.scolrm, screen_1.scolac);
goto L2000;
/* GDT, PAGE 4 */
/* AF-- ALTER FLAGS */
L20000:
if (! (j > 0 && j <= fmax)) {
goto L2200;
}
/* !ENTRY NO VALID? */
printf("Old= %c New= ", flags[j - 1] ? 'T' : 'F');
/* !TYPE OLD, GET NEW. */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
for (z = buf; *z != '\0'; z++) {
if (! isspace(*z)) {
if (*z == 't' || *z == 'T')
flags[j - 1] = 1;
else if (*z == 'f' || *z == 'F')
flags[j - 1] = 0;
break;
}
}
goto L2000;
/* 21000-- HELP */
L21000:
more_output("Valid commands are:");
more_output("AA- Alter ADVS DR- Display ROOMS");
more_output("AC- Alter CEVENT DS- Display state");
more_output("AF- Alter FINDEX DT- Display text");
more_output("AH- Alter HERE DV- Display VILLS");
more_output("AN- Alter switches DX- Display EXITS");
more_output("AO- Alter OBJCTS DZ- Display PUZZLE");
more_output("AR- Alter ROOMS D2- Display ROOM2");
more_output("AV- Alter VILLS EX- Exit");
more_output("AX- Alter EXITS HE- Type this message");
more_output("AZ- Alter PUZZLE NC- No cyclops");
more_output("DA- Display ADVS ND- No deaths");
more_output("DC- Display CEVENT NR- No robber");
more_output("DF- Display FINDEX NT- No troll");
more_output("DH- Display HACKS PD- Program detail");
more_output("DL- Display lengths RC- Restore cyclops");
more_output("DM- Display RTEXT RD- Restore deaths");
more_output("DN- Display switches RR- Restore robber");
more_output("DO- Display OBJCTS RT- Restore troll");
more_output("DP- Display parser TK- Take");
goto L2000;
/* NR-- NO ROBBER */
L22000:
hack_1.thfflg = FALSE_;
/* !DISABLE ROBBER. */
hack_1.thfact = FALSE_;
newsta_(oindex_1.thief, 0, 0, 0, 0);
/* !VANISH THIEF. */
more_output("No robber.");
goto L2000;
/* NT-- NO TROLL */
L23000:
findex_1.trollf = TRUE_;
newsta_(oindex_1.troll, 0, 0, 0, 0);
more_output("No troll.");
goto L2000;
/* NC-- NO CYCLOPS */
L24000:
findex_1.cyclof = TRUE_;
newsta_(oindex_1.cyclo, 0, 0, 0, 0);
more_output("No cyclops.");
goto L2000;
/* ND-- IMMORTALITY MODE */
L25000:
debug_1.dbgflg = 1;
more_output("No deaths.");
goto L2000;
/* RR-- RESTORE ROBBER */
L26000:
hack_1.thfact = TRUE_;
more_output("Restored robber.");
goto L2000;
/* RT-- RESTORE TROLL */
L27000:
findex_1.trollf = FALSE_;
newsta_(oindex_1.troll, 0, rindex_1.mtrol, 0, 0);
more_output("Restored troll.");
goto L2000;
/* RC-- RESTORE CYCLOPS */
L28000:
findex_1.cyclof = FALSE_;
findex_1.magicf = FALSE_;
newsta_(oindex_1.cyclo, 0, rindex_1.mcycl, 0, 0);
more_output("Restored cyclops.");
goto L2000;
/* RD-- MORTAL MODE */
L29000:
debug_1.dbgflg = 0;
more_output("Restored deaths.");
goto L2000;
/* GDT, PAGE 5 */
/* TK-- TAKE */
L30000:
if (! (j > 0 && j <= objcts_1.olnt)) {
goto L2200;
}
/* !VALID OBJECT? */
newsta_(j, 0, 0, 0, play_1.winner);
/* !YES, TAKE OBJECT. */
more_output("Taken.");
/* !TELL. */
goto L2000;
/* EX-- GOODBYE */
L31000:
prsvec_1.prscon = 1;
return;
/* AR-- ALTER ROOM ENTRY */
L32000:
if (! (j > 0 && j <= rooms_1.rlnt && (k > 0 && k <= 5))) {
goto L2200;
}
/* !INDICES VALID? */
printf("Old = %6d New = ", eqr[j + k * 200 - 201]);
/* !TYPE OLD, GET NEW. */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &eqr[j + k * 200 - 201]);
goto L2000;
/* AO-- ALTER OBJECT ENTRY */
L33000:
if (! (j > 0 && j <= objcts_1.olnt && (k > 0 && k <= 14))) {
goto L2200;
}
/* !INDICES VALID? */
printf("Old = %6d New = ", eqo[j + k * 200 - 201]);
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &eqo[j + k * 220 - 221]);
goto L2000;
/* AA-- ALTER ADVS ENTRY */
L34000:
if (! (j > 0 && j <= advs_1.alnt && (k > 0 && k <= 7))) {
goto L2200;
}
/* !INDICES VALID? */
printf("Old = %6d New = ", eqa[j + (k << 2) - 5]);
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &eqa[j + (k << 2) - 5]);
goto L2000;
/* AC-- ALTER CLOCK EVENTS */
L35000:
if (! (j > 0 && j <= cevent_1.clnt && (k > 0 && k <= 3))) {
goto L2200;
}
/* !INDICES VALID? */
if (k == 3) {
goto L35500;
}
/* !FLAGS ENTRY? */
printf("Old = %6d New = ", eqc[j + k * 25 - 26]);
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &eqc[j + k * 25 - 26]);
goto L2000;
L35500:
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
for (z = buf; *z != '\0'; z++) {
if (! isspace(*z)) {
if (*z == 't' || *z == 'T')
cevent_1.cflag[j - 1] = 1;
else if (*z == 'f' || *z == 'F')
cevent_1.cflag[j - 1] = 0;
break;
}
}
goto L2000;
/* GDT, PAGE 6 */
/* AX-- ALTER EXITS */
L36000:
if (! (j > 0 && j <= exits_1.xlnt)) {
goto L2200;
}
/* !ENTRY NO VALID? */
printf("Old= %6d New= ", exits_1.travel[j - 1]);
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &exits_1.travel[j - 1]);
goto L2000;
/* AV-- ALTER VILLAINS */
L37000:
if (! (j > 0 && j <= vill_1.vlnt && (k > 0 && k <= 5))) {
goto L2200;
}
/* !INDICES VALID? */
printf("Old = %6d New= ", eqv[j + (k << 2) - 5]);
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &eqv[j + (k << 2) - 5]);
goto L2000;
/* D2-- DISPLAY ROOM2 LIST */
L38000:
if (! (j > 0 && j <= oroom2_1.r2lnt && (k > 0 && k <= oroom2_1.r2lnt) &&
j <= k)) {
goto L2200;
}
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("#%2d Room=%6d Obj=%6d\n", i,
oroom2_1.rroom2[i - 1], oroom2_1.oroom2[i - 1]);
/* L38100: */
}
goto L2000;
/* DN-- DISPLAY SWITCHES */
L39000:
if (! (j > 0 && j <= smax && (k > 0 && k <= smax) && j <= k)) {
goto L2200;
}
/* !VALID? */
i__1 = k;
for (i = j; i <= i__1; ++i) {
more_output(NULL);
printf("Switch #%-2d = %d\n", i, switch_[i - 1]);
/* L39100: */
}
goto L2000;
/* AN-- ALTER SWITCHES */
L40000:
if (! (j > 0 && j <= smax)) {
goto L2200;
}
/* !VALID ENTRY? */
printf("Old= %6d New= ", switch_[j - 1]);
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &switch_[j - 1]);
goto L2000;
/* DM-- DISPLAY MESSAGES */
L41000:
if (! (j > 0 && j <= rmsg_1.mlnt && (k > 0 && k <= rmsg_1.mlnt) && j <= k)
) {
goto L2200;
}
/* !VALID LIMITS? */
more_output(" RANGE CONTENTS");
i__1 = k;
for (i = j; i <= i__1; i += 10) {
more_output(NULL);
/* Computing MIN */
i__2 = i + 9;
l = min(i__2,k);
printf("%3d-%3d ", i, l);
for (l1 = i; l1 <= l; ++l1)
printf(" %6d", rmsg_1.rtext[l1 - 1]);
printf("\n");
/* L41100: */
}
goto L2000;
/* DT-- DISPLAY TEXT */
L42000:
rspeak_(j);
goto L2000;
/* AH-- ALTER HERE */
L43000:
printf("Old= %6d New= ", play_1.here);
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &play_1.here);
eqa[0] = play_1.here;
goto L2000;
/* DP-- DISPLAY PARSER STATE */
L44000:
more_output(NULL);
printf("ORPHS= %7d%7d%7d%7d%7d%7d\n",
orp[0], orp[1], orp[2], orp[3], orp[4], last_1.lastit);
more_output(NULL);
printf("PV= %7d%7d%7d%7d%7d\n",
pvec[0], pvec[1], pvec[2], pvec[3], pvec[4]);
more_output(NULL);
printf("SYN= %7d%7d%7d%7d%7d%7d\n",
syn[0], syn[1], syn[2], syn[3], syn[4], syn[5]);
more_output(NULL);
printf(" %7d%7d%7d%7d%7d\n",
syn[6], syn[7], syn[8], syn[9], syn[10]);
goto L2000;
/* PD-- PROGRAM DETAIL DEBUG */
L45000:
printf("Old= %6d New= ", debug_1.prsflg);
/* !TYPE OLD, GET NEW. */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &debug_1.prsflg);
goto L2000;
/* DZ-- DISPLAY PUZZLE ROOM */
L46000:
for (i = 1; i <= 64; i += 8) {
/* !DISPLAY PUZZLE */
more_output(NULL);
printf(" ");
for (j = i; j <= i + 7; ++j)
printf("%3d", puzzle_1.cpvec[j - 1]);
printf("\n");
/* L46100: */
}
goto L2000;
/* AZ-- ALTER PUZZLE ROOM */
L47000:
if (! (j > 0 && j <= 64)) {
goto L2200;
}
/* !VALID ENTRY? */
printf("Old= %6d New= ", puzzle_1.cpvec[j - 1]);
/* !OUTPUT OLD, */
(void) fflush(stdout);
(void) fgets(buf, sizeof buf, stdin);
more_input();
sscanf(buf, "%d", &puzzle_1.cpvec[j - 1]);
goto L2000;
} /* gdt_ */
#endif /* ALLOW_GDT */

114
history Normal file
View File

@ -0,0 +1,114 @@
History of the C Implementation of Dungeon
==========================================
This version of dungeon has been modified from FORTRAN to C. The
original was written in DEC FORTRAN, translated from MDL. It was then
translated to f77 for UN*X systems, from which it was translated to C.
The C translation was done with the help of f2c, the FORTRAN to C
translator written by David Gay (AT&T Bell Labs), Stu Feldman
(Bellcore), Mark Maimone (Carnegie-Mellon University), and Norm
Schryer (AT&T Bell Labs).
I. From the original documentation...
To: Dungeon Players
From: "The Translator"
Subj: Game Information
Date: 8-OCT-80
This is the first (and last) source release of the PDP-11 version of
Dungeon.
Please note that Dungeon has been superceded by the game ZORK(tm).
The following is an extract from the new product announcement for
ZORK in the September, 1980 issue of the RT-11 SIG newsletter:
"'ZORK: The Great Underground Empire - Part I' ...was developed
by the original authors based on their ZORK (Dungeon) game for
the PDP-10. It features a greatly improved parser; command
input and transcript output files; SAVEs to any device and
file name; and adaptation to different terminal types,
including a status line on VT100s. Note: this is not the
FORTRAN version that has been available through DECUS. This
version has been completely rewritten to run efficiently on
small machines - up to 10 times as fast as the DECUS version.
...ZORK runs under RT-ll, HT-ll, or RSTS/E and requires as
little as 20K words of memory and a single floppy disk drive.
The game package, consisting of an RX01-format diskette and
an instruction booklet, is available from Infocom, Inc.,
P.O. Box 120, Kendall Station, Cambridge, Ma. 02142."
ZORK(tm) is a trademark of Infocom, Inc. It is available for several
popular personal computers as well as for the PDP-ll.
SUMMARY
-------
Welcome to Dungeon!
Dungeon is a game of adventure, danger, and low cunning. In it
you will explore some of the most amazing territory ever seen by mortal
man. Hardened adventurers have run screaming from the terrors contained
within.
In Dungeon, the intrepid explorer delves into the forgotten secrets
of a lost labyrinth deep in the bowels of the earth, searching for
vast treasures long hidden from prying eyes, treasures guarded by
fearsome monsters and diabolical traps!
No DECsystem should be without one!
Dungeon was created at the Programming Technology Division of the MIT
Laboratory for Computer Science by Tim Anderson, Marc Blank, Bruce
Daniels, and Dave Lebling. It was inspired by the Adventure game of
Crowther and Woods, and the Dungeons and Dragons game of Gygax
and Arneson. The original version was written in MDL (alias MUDDLE).
The current version was translated from MDL into FORTRAN IV by
a somewhat paranoid DEC engineer who prefers to remain anonymous.
On-line information may be obtained with the commands HELP and INFO.
II. DEC FORTRAN to f77 Conversion (17-nov-81)
The conversion from DEC FORTRAN to Unix f77 was done by Randy
Dietrich, Lynn Cochran and Sig Peterson. Much hacking was done to get
it to fit in the limited address space of a PDP-11/44 (split I/D).
Suffice it to say that by leaving out the debugging package and not
linking in the f77 i/o library they managed to get it to run.
III. PDP to VAX (dec-85)
Based on the work of Randy, Lynn and Sig, Bill Randle folded in the
full save/restore functions and the game debugging package (gdt) into
the pdp version to create a Vax/Unix version. This version also uses
f77 i/o, thus eliminating the extra speak and listen processes needed
on the pdp.
IV. Cleanup I (11-dec-86)
John Gilmore (hoptoad!gnu) cleaned up the source files by moving
most of the common declarations into include files and added
comments from the original (FORTRAN or MDL?) source. His efforts
are greatly appreciated.
V. Cleanup II (9-feb-87)
Bill Randle (billr@tekred.tek.com) added the pdp dependencies back
into the Vax source files with #ifdefs in order to have just one
set of sources. Previously, there were two sets of source: one for
the pdp and one for the Vax. In addition, a shell escape of the
form !cmd was added and the wizard can enter the gdt without having
to recompile the source. Finally, a man page was generated, based
on the dungeon.doc file.
VI. f77 to C (11-mar-91)
Ian Lance Taylor (ian@airs.com or uunet!airs!ian) used the f2c
translator to generate C source code. The resulting code was modified
to remove the FORTRAN I/O library, to add simple more processing, and
to change the format of the database file. Andre Srinivasan
(andre@cs.pitt.edu) help test it. Jonathan Mark
(uunet!microsoft!jonm) made it work under MS-DOS and Microsoft C.

13
input Normal file
View File

@ -0,0 +1,13 @@
l
l
w
w
n
e
u
get egg
d
e
move leaves
l
use leaf blower on leaves

159
lightp.c Normal file
View File

@ -0,0 +1,159 @@
/* LIGHTP- LIGHT PROCESSOR */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
logical lightp_(obj)
integer obj;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer flobts;
integer i;
ret_val = TRUE_;
/* !ASSUME WINS */
flobts = FLAMBT + LITEBT + ONBT;
if (obj != oindex_1.candl) {
goto L20000;
}
/* !CANDLE? */
if (findex_1.orcand != 0) {
goto L19100;
}
/* !FIRST REF? */
findex_1.orcand = 1;
/* !YES, CANDLES ARE */
cevent_1.ctick[cindex_1.cevcnd - 1] = 50;
/* !BURNING WHEN SEEN. */
L19100:
if (prsvec_1.prsi == oindex_1.candl) {
goto L10;
}
/* !IGNORE IND REFS. */
if (prsvec_1.prsa != vindex_1.trnofw) {
goto L19200;
}
/* !TURN OFF? */
i = 513;
/* !ASSUME OFF. */
if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
i = 514;
}
/* !IF ON, DIFFERENT. */
cevent_1.cflag[cindex_1.cevcnd - 1] = FALSE_;
/* !DISABLE COUNTDOWN. */
objcts_1.oflag1[oindex_1.candl - 1] &= ~ ONBT;
rspeak_(i);
return ret_val;
L19200:
if (prsvec_1.prsa != vindex_1.burnw && prsvec_1.prsa != vindex_1.trnonw) {
goto L10;
}
if ((objcts_1.oflag1[oindex_1.candl - 1] & LITEBT) != 0) {
goto L19300;
}
rspeak_(515);
/* !CANDLES TOO SHORT. */
return ret_val;
L19300:
if (prsvec_1.prsi != 0) {
goto L19400;
}
/* !ANY FLAME? */
rspeak_(516);
/* !NO, LOSE. */
prsvec_1.prswon = FALSE_;
return ret_val;
L19400:
if (prsvec_1.prsi != oindex_1.match || ! ((objcts_1.oflag1[oindex_1.match
- 1] & ONBT) != 0)) {
goto L19500;
}
i = 517;
/* !ASSUME OFF. */
if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
i = 518;
}
/* !IF ON, JOKE. */
objcts_1.oflag1[oindex_1.candl - 1] |= ONBT;
cevent_1.cflag[cindex_1.cevcnd - 1] = TRUE_;
/* !RESUME COUNTDOWN. */
rspeak_(i);
return ret_val;
L19500:
if (prsvec_1.prsi != oindex_1.torch || ! ((objcts_1.oflag1[oindex_1.torch
- 1] & ONBT) != 0)) {
goto L19600;
}
if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
goto L19700;
}
/* !ALREADY ON? */
newsta_(oindex_1.candl, 521, 0, 0, 0);
/* !NO, VAPORIZE. */
return ret_val;
L19600:
rspeak_(519);
/* !CANT LIGHT WITH THAT. */
return ret_val;
L19700:
rspeak_(520);
/* !ALREADY ON. */
return ret_val;
L20000:
if (obj != oindex_1.match) {
bug_(6, obj);
}
if (prsvec_1.prsa != vindex_1.trnonw || prsvec_1.prso != oindex_1.match) {
goto L20500;
}
if (findex_1.ormtch != 0) {
goto L20100;
}
/* !ANY MATCHES LEFT? */
rspeak_(183);
/* !NO, LOSE. */
return ret_val;
L20100:
--findex_1.ormtch;
/* !DECREMENT NO MATCHES. */
objcts_1.oflag1[oindex_1.match - 1] |= flobts;
cevent_1.ctick[cindex_1.cevmat - 1] = 2;
/* !COUNTDOWN. */
rspeak_(184);
return ret_val;
L20500:
if (prsvec_1.prsa != vindex_1.trnofw || (objcts_1.oflag1[oindex_1.match -
1] & ONBT) == 0) {
goto L10;
}
objcts_1.oflag1[oindex_1.match - 1] &= ~ flobts;
cevent_1.ctick[cindex_1.cevmat - 1] = 0;
rspeak_(185);
return ret_val;
/* HERE FOR FALSE RETURN */
L10:
ret_val = FALSE_;
return ret_val;
} /* lightp_ */

81
local.c Normal file
View File

@ -0,0 +1,81 @@
/* local.c -- dungeon functions which need local definition */
#include "funcs.h"
#ifdef __AMOS__
#include <moncal.h>
#endif
/* This function should return TRUE_ if it's OK for people to play the
* game, FALSE_ otherwise. If you have a working <time.h> library,
* you can define NONBUSINESS to disallow play Monday to Friday, 9-5
* (this is only checked at the start of the game, though). For more
* complex control you will have to write your own version of this
* function.
*/
#ifdef NONBUSINESS
#ifdef BSD4_2
#include <sys/timeb.h>
#else /* ! BSD4_2 */
#include <time.h>
#endif /* ! BSD4_2 */
#endif /* NONBUSINESS */
logical protected()
{
#ifndef NONBUSINESS
return TRUE_;
#else /* NONBUSINESS */
time_t t;
struct tm *q;
(void)time(&t);
q = localtime(&t);
/* Return TRUE_ if it's Sunday or Saturday or before 9 or after 5 */
if (q->tm_wday == 0 || q->tm_wday == 6)
return TRUE_;
else if (q->tm_hour < 9 || q->tm_hour >= 17)
return TRUE_;
else
return FALSE_;
#endif /* NONBUSINESS */
}
#ifdef ALLOW_GDT
/* This function should return TRUE_ if the user is allowed to invoke the
* game debugging tool by typing "gdt". This isn't very useful without
* the source code, and it's mainly for people trying to debug the game.
* You can define WIZARDID to specify a user id on a UNIX system. On a
* non AMOS, non unix system this function will have to be changed if
* you want to use gdt.
*/
#ifndef WIZARDID
#define WIZARDID (0)
#endif
logical wizard()
{
#ifdef __AMOS__
if (jobidx()->jobusr == 0x102)
return TRUE_;
#else
#ifdef unix
if (getuid() == 0 || getuid() == WIZARDID)
return TRUE_;
#endif
#endif
return TRUE_;
}
#endif

943
nobjs.c Normal file
View File

@ -0,0 +1,943 @@
/* NOBJS- NEW OBJECTS PROCESSOR */
/* OBJECTS IN THIS MODULE CANNOT CALL RMINFO, JIGSUP, */
/* MAJOR VERBS, OR OTHER NON-RESIDENT SUBROUTINES */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
static logical mirpan_ P((integer, logical));
logical nobjs_(ri, arg)
integer ri;
integer arg;
{
/* System generated locals */
integer i__1, i__2;
logical ret_val;
/* Local variables */
logical f;
integer target;
integer i;
integer j;
integer av, wl;
integer nxt, odi2 = 0, odo2 = 0;
if (prsvec_1.prso != 0) {
odo2 = objcts_1.odesc2[prsvec_1.prso - 1];
}
if (prsvec_1.prsi != 0) {
odi2 = objcts_1.odesc2[prsvec_1.prsi - 1];
}
av = advs_1.avehic[play_1.winner - 1];
ret_val = TRUE_;
switch (ri - 31) {
case 1: goto L1000;
case 2: goto L2000;
case 3: goto L3000;
case 4: goto L4000;
case 5: goto L5000;
case 6: goto L6000;
case 7: goto L7000;
case 8: goto L8000;
case 9: goto L9000;
case 10: goto L10000;
case 11: goto L11000;
case 12: goto L12000;
case 13: goto L13000;
case 14: goto L14000;
case 15: goto L15000;
case 16: goto L16000;
case 17: goto L17000;
case 18: goto L18000;
case 19: goto L19000;
case 20: goto L20000;
case 21: goto L21000;
}
bug_(6, ri);
/* RETURN HERE TO DECLARE FALSE RESULT */
L10:
ret_val = FALSE_;
return ret_val;
/* O32-- BILLS */
L1000:
if (prsvec_1.prsa != vindex_1.eatw) {
goto L1100;
}
/* !EAT? */
rspeak_(639);
/* !JOKE. */
return ret_val;
L1100:
if (prsvec_1.prsa == vindex_1.burnw) {
rspeak_(640);
}
/* !BURN? JOKE. */
goto L10;
/* !LET IT BE HANDLED. */
/* NOBJS, PAGE 3 */
/* O33-- SCREEN OF LIGHT */
L2000:
target = oindex_1.scol;
/* !TARGET IS SCOL. */
L2100:
if (prsvec_1.prso != target) {
goto L2400;
}
/* !PRSO EQ TARGET? */
if (prsvec_1.prsa != vindex_1.pushw && prsvec_1.prsa != vindex_1.movew &&
prsvec_1.prsa != vindex_1.takew && prsvec_1.prsa != vindex_1.rubw)
{
goto L2200;
}
rspeak_(673);
/* !HAND PASSES THRU. */
return ret_val;
L2200:
if (prsvec_1.prsa != vindex_1.killw && prsvec_1.prsa != vindex_1.attacw &&
prsvec_1.prsa != vindex_1.mungw) {
goto L2400;
}
rspsub_(674, odi2);
/* !PASSES THRU. */
return ret_val;
L2400:
if (prsvec_1.prsa != vindex_1.throww || prsvec_1.prsi != target) {
goto L10;
}
if (play_1.here == rindex_1.bkbox) {
goto L2600;
}
/* !THRU SCOL? */
newsta_(prsvec_1.prso, 0, rindex_1.bkbox, 0, 0);
/* !NO, THRU WALL. */
rspsub_(675, odo2);
/* !ENDS UP IN BOX ROOM. */
cevent_1.ctick[cindex_1.cevscl - 1] = 0;
/* !CANCEL ALARM. */
screen_1.scolrm = 0;
/* !RESET SCOL ROOM. */
return ret_val;
L2600:
if (screen_1.scolrm == 0) {
goto L2900;
}
/* !TRIED TO GO THRU? */
newsta_(prsvec_1.prso, 0, screen_1.scolrm, 0, 0);
/* !SUCCESS. */
rspsub_(676, odo2);
/* !ENDS UP SOMEWHERE. */
cevent_1.ctick[cindex_1.cevscl - 1] = 0;
/* !CANCEL ALARM. */
screen_1.scolrm = 0;
/* !RESET SCOL ROOM. */
return ret_val;
L2900:
rspeak_(213);
/* !CANT DO IT. */
return ret_val;
/* NOBJS, PAGE 4 */
/* O34-- GNOME OF ZURICH */
L3000:
if (prsvec_1.prsa != vindex_1.givew && prsvec_1.prsa != vindex_1.throww) {
goto L3200;
}
if (objcts_1.otval[prsvec_1.prso - 1] != 0) {
goto L3100;
}
/* !THROW A TREASURE? */
newsta_(prsvec_1.prso, 641, 0, 0, 0);
/* !NO, GO POP. */
return ret_val;
L3100:
newsta_(prsvec_1.prso, 0, 0, 0, 0);
/* !YES, BYE BYE TREASURE. */
rspsub_(642, odo2);
newsta_(oindex_1.zgnom, 0, 0, 0, 0);
/* !BYE BYE GNOME. */
cevent_1.ctick[cindex_1.cevzgo - 1] = 0;
/* !CANCEL EXIT. */
f = moveto_(rindex_1.bkent, play_1.winner);
/* !NOW IN BANK ENTRANCE. */
return ret_val;
L3200:
if (prsvec_1.prsa != vindex_1.attacw && prsvec_1.prsa != vindex_1.killw &&
prsvec_1.prsa != vindex_1.mungw) {
goto L3300;
}
newsta_(oindex_1.zgnom, 643, 0, 0, 0);
/* !VANISH GNOME. */
cevent_1.ctick[cindex_1.cevzgo - 1] = 0;
/* !CANCEL EXIT. */
return ret_val;
L3300:
rspeak_(644);
/* !GNOME IS IMPATIENT. */
return ret_val;
/* O35-- EGG */
L4000:
if (prsvec_1.prsa != vindex_1.openw || prsvec_1.prso != oindex_1.egg) {
goto L4500;
}
if (! ((objcts_1.oflag2[oindex_1.egg - 1] & OPENBT) != 0)) {
goto L4100;
}
/* !OPEN ALREADY? */
rspeak_(649);
/* !YES. */
return ret_val;
L4100:
if (prsvec_1.prsi != 0) {
goto L4200;
}
/* !WITH SOMETHING? */
rspeak_(650);
/* !NO, CANT. */
return ret_val;
L4200:
if (prsvec_1.prsi != oindex_1.hands) {
goto L4300;
}
/* !WITH HANDS? */
rspeak_(651);
/* !NOT RECOMMENDED. */
return ret_val;
L4300:
i = 652;
/* !MUNG MESSAGE. */
if ((objcts_1.oflag1[prsvec_1.prsi - 1] & TOOLBT) != 0 || (
objcts_1.oflag2[prsvec_1.prsi - 1] & WEAPBT) != 0) {
goto L4600;
}
i = 653;
/* !NOVELTY 1. */
if ((objcts_1.oflag2[prsvec_1.prso - 1] & FITEBT) != 0) {
i = 654;
}
objcts_1.oflag2[prsvec_1.prso - 1] |= FITEBT;
rspsub_(i, odi2);
return ret_val;
L4500:
if (prsvec_1.prsa != vindex_1.openw && prsvec_1.prsa != vindex_1.mungw) {
goto L4800;
}
i = 655;
/* !YOU BLEW IT. */
L4600:
newsta_(oindex_1.begg, i, objcts_1.oroom[oindex_1.egg - 1],
objcts_1.ocan[oindex_1.egg - 1], objcts_1.oadv[oindex_1.egg - 1])
;
newsta_(oindex_1.egg, 0, 0, 0, 0);
/* !VANISH EGG. */
objcts_1.otval[oindex_1.begg - 1] = 2;
/* !BAD EGG HAS VALUE. */
if (objcts_1.ocan[oindex_1.canar - 1] != oindex_1.egg) {
goto L4700;
}
/* !WAS CANARY INSIDE? */
rspeak_(objcts_1.odesco[oindex_1.bcana - 1]);
/* !YES, DESCRIBE RESULT. */
objcts_1.otval[oindex_1.bcana - 1] = 1;
return ret_val;
L4700:
newsta_(oindex_1.bcana, 0, 0, 0, 0);
/* !NO, VANISH IT. */
return ret_val;
L4800:
if (prsvec_1.prsa != vindex_1.dropw || play_1.here != rindex_1.mtree) {
goto L10;
}
newsta_(oindex_1.begg, 658, rindex_1.fore3, 0, 0);
/* !DROPPED EGG. */
newsta_(oindex_1.egg, 0, 0, 0, 0);
objcts_1.otval[oindex_1.begg - 1] = 2;
if (objcts_1.ocan[oindex_1.canar - 1] != oindex_1.egg) {
goto L4700;
}
objcts_1.otval[oindex_1.bcana - 1] = 1;
/* !BAD CANARY. */
return ret_val;
/* NOBJS, PAGE 5 */
/* O36-- CANARIES, GOOD AND BAD */
L5000:
if (prsvec_1.prsa != vindex_1.windw) {
goto L10;
}
/* !WIND EM UP? */
if (prsvec_1.prso == oindex_1.canar) {
goto L5100;
}
/* !RIGHT ONE? */
rspeak_(645);
/* !NO, BAD NEWS. */
return ret_val;
L5100:
if (! findex_1.singsf && (play_1.here == rindex_1.mtree || play_1.here >=
rindex_1.fore1 && play_1.here < rindex_1.clear)) {
goto L5200;
}
rspeak_(646);
/* !NO, MEDIOCRE NEWS. */
return ret_val;
L5200:
findex_1.singsf = TRUE_;
/* !SANG SONG. */
i = play_1.here;
if (i == rindex_1.mtree) {
i = rindex_1.fore3;
}
/* !PLACE BAUBLE. */
newsta_(oindex_1.baubl, 647, i, 0, 0);
return ret_val;
/* O37-- WHITE CLIFFS */
L6000:
if (prsvec_1.prsa != vindex_1.clmbw && prsvec_1.prsa != vindex_1.clmbuw &&
prsvec_1.prsa != vindex_1.clmbdw) {
goto L10;
}
rspeak_(648);
/* !OH YEAH? */
return ret_val;
/* O38-- WALL */
L7000:
if ((i__1 = play_1.here - findex_1.mloc, abs(i__1)) != 1 || mrhere_(
play_1.here) != 0 || prsvec_1.prsa != vindex_1.pushw) {
goto L7100;
}
rspeak_(860);
/* !PUSHED MIRROR WALL. */
return ret_val;
L7100:
if ((rooms_1.rflag[play_1.here - 1] & RNWALL) == 0) {
goto L10;
}
rspeak_(662);
/* !NO WALL. */
return ret_val;
/* NOBJS, PAGE 6 */
/* O39-- SONG BIRD GLOBAL */
L8000:
if (prsvec_1.prsa != vindex_1.findw) {
goto L8100;
}
/* !FIND? */
rspeak_(666);
return ret_val;
L8100:
if (prsvec_1.prsa != vindex_1.examiw) {
goto L10;
}
/* !EXAMINE? */
rspeak_(667);
return ret_val;
/* O40-- PUZZLE/SCOL WALLS */
L9000:
if (play_1.here != rindex_1.cpuzz) {
goto L9500;
}
/* !PUZZLE WALLS? */
if (prsvec_1.prsa != vindex_1.pushw) {
goto L10;
}
/* !PUSH? */
for (i = 1; i <= 8; i += 2) {
/* !LOCATE WALL. */
if (prsvec_1.prso == puzzle_1.cpwl[i - 1]) {
goto L9200;
}
/* L9100: */
}
bug_(80, prsvec_1.prso);
/* !WHAT? */
L9200:
j = puzzle_1.cpwl[i];
/* !GET DIRECTIONAL OFFSET. */
nxt = findex_1.cphere + j;
/* !GET NEXT STATE. */
wl = puzzle_1.cpvec[nxt - 1];
/* !GET C(NEXT STATE). */
switch (wl + 4) {
case 1: goto L9300;
case 2: goto L9300;
case 3: goto L9300;
case 4: goto L9250;
case 5: goto L9350;
}
/* !PROCESS. */
L9250:
rspeak_(876);
/* !CLEAR CORRIDOR. */
return ret_val;
L9300:
if (puzzle_1.cpvec[nxt + j - 1] == 0) {
goto L9400;
}
/* !MOVABLE, ROOM TO MOVE? */
L9350:
rspeak_(877);
/* !IMMOVABLE, NO ROOM. */
return ret_val;
L9400:
i = 878;
/* !ASSUME FIRST PUSH. */
if (findex_1.cpushf) {
i = 879;
}
/* !NOT? */
findex_1.cpushf = TRUE_;
puzzle_1.cpvec[nxt + j - 1] = wl;
/* !MOVE WALL. */
puzzle_1.cpvec[nxt - 1] = 0;
/* !VACATE NEXT STATE. */
cpgoto_(nxt);
/* !ONWARD. */
cpinfo_(i, nxt);
/* !DESCRIBE. */
princr_(1, play_1.here);
/* !PRINT ROOMS CONTENTS. */
rooms_1.rflag[play_1.here - 1] |= RSEEN;
return ret_val;
L9500:
if (play_1.here != screen_1.scolac) {
goto L9700;
}
/* !IN SCOL ACTIVE ROOM? */
for (i = 1; i <= 12; i += 3) {
target = screen_1.scolwl[i];
/* !ASSUME TARGET. */
if (screen_1.scolwl[i - 1] == play_1.here) {
goto L2100;
}
/* !TREAT IF FOUND. */
/* L9600: */
}
L9700:
if (play_1.here != rindex_1.bkbox) {
goto L10;
}
/* !IN BOX ROOM? */
target = oindex_1.wnort;
goto L2100;
/* NOBJS, PAGE 7 */
/* O41-- SHORT POLE */
L10000:
if (prsvec_1.prsa != vindex_1.raisew) {
goto L10100;
}
/* !LIFT? */
i = 749;
/* !ASSUME UP. */
if (findex_1.poleuf == 2) {
i = 750;
}
/* !ALREADY UP? */
rspeak_(i);
findex_1.poleuf = 2;
/* !POLE IS RAISED. */
return ret_val;
L10100:
if (prsvec_1.prsa != vindex_1.lowerw && prsvec_1.prsa != vindex_1.pushw) {
goto L10;
}
if (findex_1.poleuf != 0) {
goto L10200;
}
/* !ALREADY LOWERED? */
rspeak_(751);
/* !CANT DO IT. */
return ret_val;
L10200:
if (findex_1.mdir % 180 != 0) {
goto L10300;
}
/* !MIRROR N-S? */
findex_1.poleuf = 0;
/* !YES, LOWER INTO */
rspeak_(752);
/* !CHANNEL. */
return ret_val;
L10300:
if (findex_1.mdir != 270 || findex_1.mloc != rindex_1.mrb) {
goto L10400;
}
findex_1.poleuf = 0;
/* !LOWER INTO HOLE. */
rspeak_(753);
return ret_val;
L10400:
i__1 = findex_1.poleuf + 753;
rspeak_(i__1);
/* !POLEUF = 1 OR 2. */
findex_1.poleuf = 1;
/* !NOW ON FLOOR. */
return ret_val;
/* O42-- MIRROR SWITCH */
L11000:
if (prsvec_1.prsa != vindex_1.pushw) {
goto L10;
}
/* !PUSH? */
if (findex_1.mrpshf) {
goto L11300;
}
/* !ALREADY PUSHED? */
rspeak_(756);
/* !BUTTON GOES IN. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !BLOCKED? */
if (qhere_(i, rindex_1.mreye) && i != oindex_1.rbeam) {
goto L11200;
}
/* L11100: */
}
rspeak_(757);
/* !NOTHING IN BEAM. */
return ret_val;
L11200:
cevent_1.cflag[cindex_1.cevmrs - 1] = TRUE_;
/* !MIRROR OPENS. */
cevent_1.ctick[cindex_1.cevmrs - 1] = 7;
findex_1.mrpshf = TRUE_;
findex_1.mropnf = TRUE_;
return ret_val;
L11300:
rspeak_(758);
/* !MIRROR ALREADYOPEN. */
return ret_val;
/* NOBJS, PAGE 8 */
/* O43-- BEAM FUNCTION */
L12000:
if (prsvec_1.prsa != vindex_1.takew || prsvec_1.prso != oindex_1.rbeam) {
goto L12100;
}
rspeak_(759);
/* !TAKE BEAM, JOKE. */
return ret_val;
L12100:
i = prsvec_1.prso;
/* !ASSUME BLK WITH DIROBJ. */
if (prsvec_1.prsa == vindex_1.putw && prsvec_1.prsi == oindex_1.rbeam) {
goto L12200;
}
if (prsvec_1.prsa != vindex_1.mungw || prsvec_1.prso != oindex_1.rbeam ||
prsvec_1.prsi == 0) {
goto L10;
}
i = prsvec_1.prsi;
L12200:
if (objcts_1.oadv[i - 1] != play_1.winner) {
goto L12300;
}
/* !CARRYING? */
newsta_(i, 0, play_1.here, 0, 0);
/* !DROP OBJ. */
rspsub_(760, objcts_1.odesc2[i - 1]);
return ret_val;
L12300:
j = 761;
/* !ASSUME NOT IN ROOM. */
if (qhere_(j, play_1.here)) {
i = 762;
}
/* !IN ROOM? */
rspsub_(j, objcts_1.odesc2[i - 1]);
/* !DESCRIBE. */
return ret_val;
/* O44-- BRONZE DOOR */
L13000:
if (play_1.here == rindex_1.ncell || findex_1.lcell == 4 && (play_1.here
== rindex_1.cell || play_1.here == rindex_1.scorr)) {
goto L13100;
}
rspeak_(763);
/* !DOOR NOT THERE. */
return ret_val;
L13100:
if (! opncls_(oindex_1.odoor, 764, 765)) {
goto L10;
}
/* !OPEN/CLOSE? */
if (play_1.here == rindex_1.ncell && (objcts_1.oflag2[oindex_1.odoor - 1]
& OPENBT) != 0) {
rspeak_(766);
}
return ret_val;
/* O45-- QUIZ DOOR */
L14000:
if (prsvec_1.prsa != vindex_1.openw && prsvec_1.prsa != vindex_1.closew) {
goto L14100;
}
rspeak_(767);
/* !DOOR WONT MOVE. */
return ret_val;
L14100:
if (prsvec_1.prsa != vindex_1.knockw) {
goto L10;
}
/* !KNOCK? */
if (findex_1.inqstf) {
goto L14200;
}
/* !TRIED IT ALREADY? */
findex_1.inqstf = TRUE_;
/* !START INQUISITION. */
cevent_1.cflag[cindex_1.cevinq - 1] = TRUE_;
cevent_1.ctick[cindex_1.cevinq - 1] = 2;
findex_1.quesno = rnd_(8);
/* !SELECT QUESTION. */
findex_1.nqatt = 0;
findex_1.corrct = 0;
rspeak_(768);
/* !ANNOUNCE RULES. */
rspeak_(769);
i__1 = findex_1.quesno + 770;
rspeak_(i__1);
/* !ASK QUESTION. */
return ret_val;
L14200:
rspeak_(798);
/* !NO REPLY. */
return ret_val;
/* O46-- LOCKED DOOR */
L15000:
if (prsvec_1.prsa != vindex_1.openw) {
goto L10;
}
/* !OPEN? */
rspeak_(778);
/* !CANT. */
return ret_val;
/* O47-- CELL DOOR */
L16000:
ret_val = opncls_(oindex_1.cdoor, 779, 780);
/* !OPEN/CLOSE? */
return ret_val;
/* NOBJS, PAGE 9 */
/* O48-- DIALBUTTON */
L17000:
if (prsvec_1.prsa != vindex_1.pushw) {
goto L10;
}
/* !PUSH? */
rspeak_(809);
/* !CLICK. */
if ((objcts_1.oflag2[oindex_1.cdoor - 1] & OPENBT) != 0) {
rspeak_(810);
}
/* !CLOSE CELL DOOR. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !RELOCATE OLD TO HYPER. */
if (objcts_1.oroom[i - 1] == rindex_1.cell && (objcts_1.oflag1[i - 1]
& DOORBT) == 0) {
i__2 = findex_1.lcell * hyper_1.hfactr;
newsta_(i, 0, i__2, 0, 0);
}
if (objcts_1.oroom[i - 1] == findex_1.pnumb * hyper_1.hfactr) {
newsta_(i, 0, rindex_1.cell, 0, 0);
}
/* L17100: */
}
objcts_1.oflag2[oindex_1.odoor - 1] &= ~ OPENBT;
objcts_1.oflag2[oindex_1.cdoor - 1] &= ~ OPENBT;
objcts_1.oflag1[oindex_1.odoor - 1] &= ~ VISIBT;
if (findex_1.pnumb == 4) {
objcts_1.oflag1[oindex_1.odoor - 1] |= VISIBT;
}
if (advs_1.aroom[aindex_1.player - 1] != rindex_1.cell) {
goto L17400;
}
/* !PLAYER IN CELL? */
if (findex_1.lcell != 4) {
goto L17200;
}
/* !IN RIGHT CELL? */
objcts_1.oflag1[oindex_1.odoor - 1] |= VISIBT;
f = moveto_(rindex_1.ncell, aindex_1.player);
/* !YES, MOVETO NCELL. */
goto L17400;
L17200:
f = moveto_(rindex_1.pcell, aindex_1.player);
/* !NO, MOVETO PCELL. */
L17400:
findex_1.lcell = findex_1.pnumb;
return ret_val;
/* NOBJS, PAGE 10 */
/* O49-- DIAL INDICATOR */
L18000:
if (prsvec_1.prsa != vindex_1.spinw) {
goto L18100;
}
/* !SPIN? */
findex_1.pnumb = rnd_(8) + 1;
/* !WHEE */
/* ! */
i__1 = findex_1.pnumb + 712;
rspsub_(797, i__1);
return ret_val;
L18100:
if (prsvec_1.prsa != vindex_1.movew && prsvec_1.prsa != vindex_1.putw &&
prsvec_1.prsa != vindex_1.trntow) {
goto L10;
}
if (prsvec_1.prsi != 0) {
goto L18200;
}
/* !TURN DIAL TO X? */
rspeak_(806);
/* !MUST SPECIFY. */
return ret_val;
L18200:
if (prsvec_1.prsi >= oindex_1.num1 && prsvec_1.prsi <= oindex_1.num8) {
goto L18300;
}
rspeak_(807);
/* !MUST BE DIGIT. */
return ret_val;
L18300:
findex_1.pnumb = prsvec_1.prsi - oindex_1.num1 + 1;
/* !SET UP NEW. */
i__1 = findex_1.pnumb + 712;
rspsub_(808, i__1);
return ret_val;
/* O50-- GLOBAL MIRROR */
L19000:
ret_val = mirpan_(832, 0);
return ret_val;
/* O51-- GLOBAL PANEL */
L20000:
if (play_1.here != rindex_1.fdoor) {
goto L20100;
}
/* !AT FRONT DOOR? */
if (prsvec_1.prsa != vindex_1.openw && prsvec_1.prsa != vindex_1.closew) {
goto L10;
}
rspeak_(843);
/* !PANEL IN DOOR, NOGO. */
return ret_val;
L20100:
ret_val = mirpan_(838, 1);
return ret_val;
/* O52-- PUZZLE ROOM SLIT */
L21000:
if (prsvec_1.prsa != vindex_1.putw || prsvec_1.prsi != oindex_1.cslit) {
goto L10;
}
if (prsvec_1.prso != oindex_1.gcard) {
goto L21100;
}
/* !PUT CARD IN SLIT? */
newsta_(prsvec_1.prso, 863, 0, 0, 0);
/* !KILL CARD. */
findex_1.cpoutf = TRUE_;
/* !OPEN DOOR. */
objcts_1.oflag1[oindex_1.stldr - 1] &= ~ VISIBT;
return ret_val;
L21100:
if ((objcts_1.oflag1[prsvec_1.prso - 1] & VICTBT) == 0 && (
objcts_1.oflag2[prsvec_1.prso - 1] & VILLBT) == 0) {
goto L21200;
}
i__1 = rnd_(5) + 552;
rspeak_(i__1);
/* !JOKE FOR VILL, VICT. */
return ret_val;
L21200:
newsta_(prsvec_1.prso, 0, 0, 0, 0);
/* !KILL OBJECT. */
rspsub_(864, odo2);
/* !DESCRIBE. */
return ret_val;
} /* nobjs_ */
/* MIRPAN-- PROCESSOR FOR GLOBAL MIRROR/PANEL */
/* DECLARATIONS */
static logical mirpan_(st, pnf)
integer st;
logical pnf;
{
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer num;
integer mrbf;
ret_val = TRUE_;
num = mrhere_(play_1.here);
/* !GET MIRROR NUM. */
if (num != 0) {
goto L100;
}
/* !ANY HERE? */
rspeak_(st);
/* !NO, LOSE. */
return ret_val;
L100:
mrbf = 0;
/* !ASSUME MIRROR OK. */
if (num == 1 && ! findex_1.mr1f || num == 2 && ! findex_1.mr2f) {
mrbf = 1;
}
if (prsvec_1.prsa != vindex_1.movew && prsvec_1.prsa != vindex_1.openw) {
goto L200;
}
i__1 = st + 1;
rspeak_(i__1);
/* !CANT OPEN OR MOVE. */
return ret_val;
L200:
if (pnf || prsvec_1.prsa != vindex_1.lookiw && prsvec_1.prsa !=
vindex_1.examiw && prsvec_1.prsa != vindex_1.lookw) {
goto L300;
}
i__1 = mrbf + 844;
rspeak_(i__1);
/* !LOOK IN MIRROR. */
return ret_val;
L300:
if (prsvec_1.prsa != vindex_1.mungw) {
goto L400;
}
/* !BREAK? */
i__1 = st + 2 + mrbf;
rspeak_(i__1);
/* !DO IT. */
if (num == 1 && ! (pnf)) {
findex_1.mr1f = FALSE_;
}
if (num == 2 && ! (pnf)) {
findex_1.mr2f = FALSE_;
}
return ret_val;
L400:
if (pnf || mrbf == 0) {
goto L500;
}
/* !BROKEN MIRROR? */
rspeak_(846);
return ret_val;
L500:
if (prsvec_1.prsa != vindex_1.pushw) {
goto L600;
}
/* !PUSH? */
i__1 = st + 3 + num;
rspeak_(i__1);
return ret_val;
L600:
ret_val = FALSE_;
/* !CANT HANDLE IT. */
return ret_val;
} /* mirpan_ */

292
np.c Normal file
View File

@ -0,0 +1,292 @@
/* RDLINE- READ INPUT LINE */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include <ctype.h>
#include "funcs.h"
#include "vars.h"
/* This declaration is here since many systems don't have <stdlib.h> */
extern int system P((const char *));
static logical lex_ P((char *, integer *, integer *, logical));
void rdline_(buffer, who)
char *buffer;
integer who;
{
/* Local variables */
char *z, *zlast;
/* Function Body */
L5:
switch (who + 1) {
case 1: goto L90;
case 2: goto L10;
}
/* !SEE WHO TO PROMPT FOR. */
L10:
printf(">");
/* !PROMPT FOR GAME. */
L90:
(void) fflush(stdout);
if (fgets(buffer, 78, stdin) == NULL)
exit_();
more_input();
if (buffer[0] == '!') {
system(buffer + 1);
goto L5;
}
zlast = buffer - 1;
for (z = buffer; *z != '\0' && *z != '\n'; z++) {
if (*z != ' ')
zlast = z;
if (islower(*z))
*z = toupper(*z);
}
z = zlast + 1;
if (z == buffer)
goto L5;
*z = '\0';
prsvec_1.prscon = 1;
/* !RESTART LEX SCAN. */
} /* rdline_ */
/* PARSE- TOP LEVEL PARSE ROUTINE */
/* THIS ROUTINE DETAILS ON BIT 0 OF PRSFLG */
logical parse_(inbuf, vbflag)
char *inbuf;
logical vbflag;
{
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer outbuf[40], outlnt;
/* Parameter adjustments */
--inbuf;
/* Function Body */
ret_val = FALSE_;
/* !ASSUME FAILS. */
prsvec_1.prsa = 0;
/* !ZERO OUTPUTS. */
prsvec_1.prsi = 0;
prsvec_1.prso = 0;
if (! lex_(inbuf + 1, outbuf, &outlnt, vbflag)) {
goto L100;
}
if ((i__1 = sparse_(outbuf, outlnt, vbflag)) < 0) {
goto L100;
} else if (i__1 == 0) {
goto L200;
} else {
goto L300;
}
/* !DO SYN SCAN. */
/* PARSE REQUIRES VALIDATION */
L200:
if (! (vbflag)) {
goto L350;
}
/* !ECHO MODE, FORCE FAIL. */
if (! synmch_()) {
goto L100;
}
/* !DO SYN MATCH. */
if (prsvec_1.prso > 0 & prsvec_1.prso < xsrch_1.xmin) {
last_1.lastit = prsvec_1.prso;
}
/* SUCCESSFUL PARSE OR SUCCESSFUL VALIDATION */
L300:
ret_val = TRUE_;
L350:
orphan_(0, 0, 0, 0, 0);
/* !CLEAR ORPHANS. */
return ret_val;
/* PARSE FAILS, DISALLOW CONTINUATION */
L100:
prsvec_1.prscon = 1;
return ret_val;
} /* parse_ */
/* ORPHAN- SET UP NEW ORPHANS */
/* DECLARATIONS */
void orphan_(o1, o2, o3, o4, o5)
integer o1;
integer o2;
integer o3;
integer o4;
integer o5;
{
orphs_1.oflag = o1;
/* !SET UP NEW ORPHANS. */
orphs_1.oact = o2;
orphs_1.oslot = o3;
orphs_1.oprep = o4;
orphs_1.oname = o5;
} /* orphan_ */
/* LEX- LEXICAL ANALYZER */
/* THIS ROUTINE DETAILS ON BIT 1 OF PRSFLAG */
static logical lex_(inbuf, outbuf, op, vbflag)
char *inbuf;
integer *outbuf;
integer *op;
logical vbflag;
{
/* Initialized data */
static const char dlimit[9] = { 'A', 'Z', 'A' - 1,
'1', '9', '1' - 31,
'-', '-', '-' - 27 };
/* System generated locals */
logical ret_val;
/* Local variables */
integer i;
char j;
integer k, j1, j2, cp;
/* Parameter adjustments */
--outbuf;
--inbuf;
/* Function Body */
for (i = 1; i <= 40; ++i) {
/* !CLEAR OUTPUT BUF. */
outbuf[i] = 0;
/* L100: */
}
ret_val = FALSE_;
/* !ASSUME LEX FAILS. */
*op = -1;
/* !OUTPUT PTR. */
L50:
*op += 2;
/* !ADV OUTPUT PTR. */
cp = 0;
/* !CHAR PTR=0. */
L200:
j = inbuf[prsvec_1.prscon];
/* !GET CHARACTER */
if (j == '\0')
goto L1000;
/* !END OF INPUT? */
++prsvec_1.prscon;
/* !ADVANCE PTR. */
if (j == '.') {
goto L1000;
}
/* !END OF COMMAND? */
if (j == ',') {
goto L1000;
}
/* !END OF COMMAND? */
if (j == ' ') {
goto L6000;
}
/* !SPACE? */
for (i = 1; i <= 9; i += 3) {
/* !SCH FOR CHAR. */
if (j >= dlimit[i - 1] & j <= dlimit[i]) {
goto L4000;
}
/* L500: */
}
if (vbflag) {
rspeak_(601);
}
/* !GREEK TO ME, FAIL. */
return ret_val;
/* END OF INPUT, SEE IF PARTIAL WORD AVAILABLE. */
L1000:
if (inbuf[prsvec_1.prscon] == '\0') {
prsvec_1.prscon = 1;
}
/* !FORCE PARSE RESTART. */
if (cp == 0 & *op == 1) {
return ret_val;
}
if (cp == 0) {
*op += -2;
}
/* !ANY LAST WORD? */
ret_val = TRUE_;
return ret_val;
/* LEGITIMATE CHARACTERS: LETTER, DIGIT, OR HYPHEN. */
L4000:
j1 = j - dlimit[i + 1];
if (cp >= 6) {
goto L200;
}
/* !IGNORE IF TOO MANY CHAR. */
k = *op + cp / 3;
/* !COMPUTE WORD INDEX. */
switch (cp % 3 + 1) {
case 1: goto L4100;
case 2: goto L4200;
case 3: goto L4300;
}
/* !BRANCH ON CHAR. */
L4100:
j2 = j1 * 780;
/* !CHAR 1... *780 */
outbuf[k] = outbuf[k] + j2 + j2;
/* !*1560 (40 ADDED BELOW). */
L4200:
outbuf[k] += j1 * 39;
/* !*39 (1 ADDED BELOW). */
L4300:
outbuf[k] += j1;
/* !*1. */
++cp;
goto L200;
/* !GET NEXT CHAR. */
/* SPACE */
L6000:
if (cp == 0) {
goto L200;
}
/* !ANY WORD YET? */
goto L50;
/* !YES, ADV OP. */
} /* lex_ */

415
np1.c Normal file
View File

@ -0,0 +1,415 @@
/* SPARSE- START OF PARSE */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
#undef EXTERN
#define EXTERN
#define INIT
#include "parse.h"
/* THIS ROUTINE DETAILS ON BIT 2 OF PRSFLG */
integer sparse_(lbuf, llnt, vbflag)
const integer *lbuf;
integer llnt;
logical vbflag;
{
/* Initialized data */
/* DATA R50MIN/1RA/,R50WAL/3RWAL/ */
const integer r50min = 1600;
const integer r50wal = 36852;
/* System generated locals */
integer ret_val, i__1, i__2;
/* Local variables */
integer i, j, adj;
integer obj;
integer prep, pptr, lbuf1, lbuf2;
integer buzlnt, prplnt, dirlnt;
/* Parameter adjustments */
--lbuf;
/* Function Body */
/* SET UP FOR PARSING */
ret_val = -1;
/* !ASSUME PARSE FAILS. */
adj = 0;
/* !CLEAR PARTS HOLDERS. */
pv_1.act = 0;
prep = 0;
pptr = 0;
pv_1.o1 = 0;
pv_1.o2 = 0;
pv_1.p1 = 0;
pv_1.p2 = 0;
buzlnt = 20;
prplnt = 48;
dirlnt = 75;
/* SPARSE, PAGE 8 */
/* NOW LOOP OVER INPUT BUFFER OF LEXICAL TOKENS. */
i__1 = llnt;
for (i = 1; i <= i__1; i += 2) {
/* !TWO WORDS/TOKEN. */
lbuf1 = lbuf[i];
/* !GET CURRENT TOKEN. */
lbuf2 = lbuf[i + 1];
if (lbuf1 == 0) {
goto L1500;
}
/* !END OF BUFFER? */
/* CHECK FOR BUZZ WORD */
i__2 = buzlnt;
for (j = 1; j <= i__2; j += 2) {
if (lbuf1 == buzvoc_1.bvoc[j - 1] && lbuf2 == buzvoc_1.bvoc[j]) {
goto L1000;
}
/* L50: */
}
/* CHECK FOR ACTION OR DIRECTION */
if (pv_1.act != 0) {
goto L75;
}
/* !GOT ACTION ALREADY? */
j = 1;
/* !CHECK FOR ACTION. */
L125:
if (lbuf1 == vvoc[j - 1] && lbuf2 == vvoc[j]) {
goto L3000;
}
/* L150: */
j += 2;
/* !ADV TO NEXT SYNONYM. */
if (! (vvoc[j - 1] > 0 && vvoc[j - 1] < r50min)) {
goto L125;
}
/* !ANOTHER VERB? */
j = j + vvoc[j - 1] + 1;
/* !NO, ADVANCE OVER SYNTAX. */
if (vvoc[j - 1] != -1) {
goto L125;
}
/* !TABLE DONE? */
L75:
if (pv_1.act != 0 && (vvoc[pv_1.act - 1] != r50wal || prep != 0)) {
goto L200;
}
i__2 = dirlnt;
for (j = 1; j <= i__2; j += 3) {
/* !THEN CHK FOR DIR. */
if (lbuf1 == dirvoc_1.dvoc[j - 1] && lbuf2 == dirvoc_1.dvoc[j]) {
goto L2000;
}
/* L100: */
}
/* NOT AN ACTION, CHECK FOR PREPOSITION, ADJECTIVE, OR OBJECT. */
L200:
i__2 = prplnt;
for (j = 1; j <= i__2; j += 3) {
/* !LOOK FOR PREPOSITION. */
if (lbuf1 == prpvoc_1.pvoc[j - 1] && lbuf2 == prpvoc_1.pvoc[j]) {
goto L4000;
}
/* L250: */
}
j = 1;
/* !LOOK FOR ADJECTIVE. */
L300:
if (lbuf1 == avoc[j - 1] && lbuf2 == avoc[j]) {
goto L5000;
}
++j;
L325:
++j;
/* !ADVANCE TO NEXT ENTRY. */
if (avoc[j - 1] > 0 && avoc[j - 1] < r50min) {
goto L325;
}
/* !A RADIX 50 CONSTANT? */
if (avoc[j - 1] != -1) {
goto L300;
}
/* !POSSIBLY, END TABLE? */
j = 1;
/* !LOOK FOR OBJECT. */
L450:
if (lbuf1 == ovoc[j - 1] && lbuf2 == ovoc[j]) {
goto L600;
}
++j;
L500:
++j;
if (ovoc[j - 1] > 0 && ovoc[j - 1] < r50min) {
goto L500;
}
if (ovoc[j - 1] != -1) {
goto L450;
}
/* NOT RECOGNIZABLE */
if (vbflag) {
rspeak_(601);
}
return ret_val;
/* SPARSE, PAGE 9 */
/* OBJECT PROCESSING (CONTINUATION OF DO LOOP ON PREV PAGE) */
L600:
obj = getobj_(j, adj, 0);
/* !IDENTIFY OBJECT. */
if (obj <= 0) {
goto L6000;
}
/* !IF LE, COULDNT. */
if (obj != oindex_1.itobj) {
goto L650;
}
/* !"IT"? */
obj = getobj_(0, 0, last_1.lastit);
/* !FIND LAST. */
if (obj <= 0) {
goto L6000;
}
/* !IF LE, COULDNT. */
L650:
if (prep == 9) {
goto L8000;
}
/* !"OF" OBJ? */
if (pptr == 2) {
goto L7000;
}
/* !TOO MANY OBJS? */
++pptr;
objvec[pptr - 1] = obj;
/* !STUFF INTO VECTOR. */
prpvec[pptr - 1] = prep;
L700:
prep = 0;
adj = 0;
/* Go to end of do loop (moved "1000 CONTINUE" to end of module, to av
oid */
/* complaints about people jumping back into the doloop.) */
goto L1000;
/* SPARSE, PAGE 10 */
/* SPECIAL PARSE PROCESSORS */
/* 2000-- DIRECTION */
L2000:
prsvec_1.prsa = vindex_1.walkw;
prsvec_1.prso = dirvoc_1.dvoc[j + 1];
ret_val = 1;
return ret_val;
/* 3000-- ACTION */
L3000:
pv_1.act = j;
orphs_1.oact = 0;
goto L1000;
/* 4000-- PREPOSITION */
L4000:
if (prep != 0) {
goto L4500;
}
prep = prpvoc_1.pvoc[j + 1];
adj = 0;
goto L1000;
L4500:
if (vbflag) {
rspeak_(616);
}
return ret_val;
/* 5000-- ADJECTIVE */
L5000:
adj = j;
j = orphs_1.oname & orphs_1.oflag;
if (j != 0 && i >= llnt) {
goto L600;
}
goto L1000;
/* 6000-- UNIDENTIFIABLE OBJECT (INDEX INTO OVOC IS J) */
L6000:
if (obj < 0) {
goto L6100;
}
j = 579;
if (lit_(play_1.here)) {
j = 618;
}
if (vbflag) {
rspeak_(j);
}
return ret_val;
L6100:
if (obj != -10000) {
goto L6200;
}
if (vbflag) {
rspsub_(620, objcts_1.odesc2[advs_1.avehic[play_1.winner - 1]
- 1]);
}
return ret_val;
L6200:
if (vbflag) {
rspeak_(619);
}
if (pv_1.act == 0) {
pv_1.act = orphs_1.oflag & orphs_1.oact;
}
orphan_(- 1, pv_1.act, pv_1.o1, prep, j);
return ret_val;
/* 7000-- TOO MANY OBJECTS. */
L7000:
if (vbflag) {
rspeak_(617);
}
return ret_val;
/* 8000-- RANDOMNESS FOR "OF" WORDS */
L8000:
if (objvec[pptr - 1] == obj) {
goto L700;
}
if (vbflag) {
rspeak_(601);
}
return ret_val;
/* End of do-loop. */
L1000:
;
}
/* !AT LAST. */
/* NOW SOME MISC CLEANUP -- We fell out of the do-loop */
L1500:
if (pv_1.act == 0) {
pv_1.act = orphs_1.oflag & orphs_1.oact;
}
if (pv_1.act == 0) {
goto L9000;
}
/* !IF STILL NONE, PUNT. */
if (adj != 0) {
goto L10000;
}
/* !IF DANGLING ADJ, PUNT. */
if (orphs_1.oflag != 0 && orphs_1.oprep != 0 && prep == 0 && pv_1.o1 != 0
&& pv_1.o2 == 0 && pv_1.act == orphs_1.oact) {
goto L11000;
}
ret_val = 0;
/* !PARSE SUCCEEDS. */
if (prep == 0) {
goto L1750;
}
/* !IF DANGLING PREP, */
if (pptr == 0 || prpvec[pptr - 1] != 0) {
goto L12000;
}
prpvec[pptr - 1] = prep;
/* !CVT TO 'PICK UP FROB'. */
/* 1750-- RETURN A RESULT */
L1750:
/* !WIN. */
return ret_val;
/* !LOSE. */
/* 9000-- NO ACTION, PUNT */
L9000:
if (pv_1.o1 == 0) {
goto L10000;
}
/* !ANY DIRECT OBJECT? */
if (vbflag) {
rspsub_(621, objcts_1.odesc2[pv_1.o1 - 1]);
}
/* !WHAT TO DO? */
orphan_(- 1, 0, pv_1.o1, 0, 0);
return ret_val;
/* 10000-- TOTAL CHOMP */
L10000:
if (vbflag) {
rspeak_(622);
}
/* !HUH? */
return ret_val;
/* 11000-- ORPHAN PREPOSITION. CONDITIONS ARE */
/* O1.NE.0, O2=0, PREP=0, ACT=OACT */
L11000:
if (orphs_1.oslot != 0) {
goto L11500;
}
/* !ORPHAN OBJECT? */
pv_1.p1 = orphs_1.oprep;
/* !NO, JUST USE PREP. */
goto L1750;
L11500:
pv_1.o2 = pv_1.o1;
/* !YES, USE AS DIRECT OBJ. */
pv_1.p2 = orphs_1.oprep;
pv_1.o1 = orphs_1.oslot;
pv_1.p1 = 0;
goto L1750;
/* 12000-- TRUE HANGING PREPOSITION. */
/* ORPHAN FOR LATER. */
L12000:
orphan_(- 1, pv_1.act, 0, prep, 0);
/* !ORPHAN PREP. */
goto L1750;
} /* sparse_ */

315
np2.c Normal file
View File

@ -0,0 +1,315 @@
/* GETOBJ-- FIND OBJ DESCRIBED BY ADJ, NAME PAIR */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
#include "parse.h"
static logical thisit_ P((integer, integer, integer, integer));
/* THIS ROUTINE DETAILS ON BIT 3 OF PRSFLG */
integer getobj_(oidx, aidx, spcobj)
integer oidx;
integer aidx;
integer spcobj;
{
/* System generated locals */
integer ret_val, i__1;
/* Local variables */
integer i, av;
integer obj;
integer nobj;
logical chomp;
/* GETOBJ, PAGE 2 */
chomp = FALSE_;
av = advs_1.avehic[play_1.winner - 1];
obj = 0;
/* !ASSUME DARK. */
if (! lit_(play_1.here)) {
goto L200;
}
/* !LIT? */
obj = schlst_(oidx, aidx, play_1.here, 0, 0, spcobj);
/* !SEARCH ROOM. */
if (obj < 0) {
goto L1000;
} else if (obj == 0) {
goto L200;
} else {
goto L100;
}
/* !TEST RESULT. */
L100:
if (av == 0 || av == obj || (objcts_1.oflag2[obj - 1] & FINDBT)
!= 0) {
goto L200;
}
if (objcts_1.ocan[obj - 1] == av) {
goto L200;
}
/* !TEST IF REACHABLE. */
chomp = TRUE_;
/* !PROBABLY NOT. */
L200:
if (av == 0) {
goto L400;
}
/* !IN VEHICLE? */
nobj = schlst_(oidx, aidx, 0, av, 0, spcobj);
/* !SEARCH VEHICLE. */
if (nobj < 0) {
goto L1100;
} else if (nobj == 0) {
goto L400;
} else {
goto L300;
}
/* !TEST RESULT. */
L300:
chomp = FALSE_;
/* !REACHABLE. */
if (obj == nobj) {
goto L400;
}
/* !SAME AS BEFORE? */
if (obj != 0) {
nobj = -nobj;
}
/* !AMB RESULT? */
obj = nobj;
L400:
nobj = schlst_(oidx, aidx, 0, 0, play_1.winner, spcobj);
/* !SEARCH ADVENTURER. */
if (nobj < 0) {
goto L1100;
} else if (nobj == 0) {
goto L600;
} else {
goto L500;
}
/* !TEST RESULT */
L500:
if (obj != 0) {
nobj = -nobj;
}
/* !AMB RESULT? */
L1100:
obj = nobj;
/* !RETURN NEW OBJECT. */
L600:
if (chomp) {
obj = -10000;
}
/* !UNREACHABLE. */
L1000:
ret_val = obj;
if (ret_val != 0) {
goto L1500;
}
/* !GOT SOMETHING? */
i__1 = objcts_1.olnt;
for (i = star_1.strbit + 1; i <= i__1; ++i) {
/* !NO, SEARCH GLOBALS. */
if (! thisit_(oidx, aidx, i, spcobj)) {
goto L1200;
}
if (! ghere_(i, play_1.here)) {
goto L1200;
}
/* !CAN IT BE HERE? */
if (ret_val != 0) {
ret_val = -i;
}
/* !AMB MATCH? */
if (ret_val == 0) {
ret_val = i;
}
L1200:
;
}
L1500:
/* !END OF SEARCH. */
return ret_val;
} /* getobj_ */
/* SCHLST-- SEARCH FOR OBJECT */
/* DECLARATIONS */
integer schlst_(oidx, aidx, rm, cn, ad, spcobj)
integer oidx;
integer aidx;
integer rm;
integer cn;
integer ad;
integer spcobj;
{
/* System generated locals */
integer ret_val, i__1, i__2;
/* Local variables */
integer i, j, x;
ret_val = 0;
/* !NO RESULT. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !SEARCH OBJECTS. */
if ((objcts_1.oflag1[i - 1] & VISIBT) == 0 || (rm == 0 || !
qhere_(i, rm)) && (cn == 0 || objcts_1.ocan[i - 1] != cn)
&& (ad == 0 || objcts_1.oadv[i - 1] != ad)) {
goto L1000;
}
if (! thisit_(oidx, aidx, i, spcobj)) {
goto L200;
}
if (ret_val != 0) {
goto L2000;
}
/* !GOT ONE ALREADY? */
ret_val = i;
/* !NO. */
/* IF OPEN OR TRANSPARENT, SEARCH THE OBJECT ITSELF. */
L200:
if ((objcts_1.oflag1[i - 1] & TRANBT) == 0 && (
objcts_1.oflag2[i - 1] & OPENBT) == 0) {
goto L1000;
}
/* SEARCH IS CONDUCTED IN REVERSE. ALL OBJECTS ARE CHECKED TO */
/* SEE IF THEY ARE AT SOME LEVEL OF CONTAINMENT INSIDE OBJECT 'I'. */
/* IF THEY ARE AT LEVEL 1, OR IF ALL LINKS IN THE CONTAINMENT */
/* CHAIN ARE OPEN, VISIBLE, AND HAVE SEARCHME SET, THEY CAN QUALIFY */
/* AS A POTENTIAL MATCH. */
i__2 = objcts_1.olnt;
for (j = 1; j <= i__2; ++j) {
/* !SEARCH OBJECTS. */
if ((objcts_1.oflag1[j - 1] & VISIBT) == 0 || ! thisit_(
oidx, aidx, j, spcobj)) {
goto L500;
}
x = objcts_1.ocan[j - 1];
/* !GET CONTAINER. */
L300:
if (x == i) {
goto L400;
}
/* !INSIDE TARGET? */
if (x == 0) {
goto L500;
}
/* !INSIDE ANYTHING? */
if ((objcts_1.oflag1[x - 1] & VISIBT) == 0 || (
objcts_1.oflag1[x - 1] & TRANBT) == 0 && (
objcts_1.oflag2[x - 1] & OPENBT) == 0 || (
objcts_1.oflag2[x - 1] & SCHBT) == 0) {
goto L500;
}
x = objcts_1.ocan[x - 1];
/* !GO ANOTHER LEVEL. */
goto L300;
L400:
if (ret_val != 0) {
goto L2000;
}
/* !ALREADY GOT ONE? */
ret_val = j;
/* !NO. */
L500:
;
}
L1000:
;
}
return ret_val;
L2000:
ret_val = -ret_val;
/* !AMB RETURN. */
return ret_val;
} /* schlst_ */
/* THISIT-- VALIDATE OBJECT VS DESCRIPTION */
/* DECLARATIONS */
static logical thisit_(oidx, aidx, obj, spcobj)
integer oidx;
integer aidx;
integer obj;
integer spcobj;
{
/* Initialized data */
/* THE FOLLOWING DATA STATEMENT USED RADIX-50 NOTATION (R50MIN/1RA/) */
/* IN RADIX-50 NOTATION, AN "A" IN THE FIRST POSITION IS */
/* ENCODED AS 1*40*40 = 1600. */
const integer r50min = 1600;
/* System generated locals */
logical ret_val;
/* Local variables */
integer i;
ret_val = FALSE_;
/* !ASSUME NO MATCH. */
if (spcobj != 0 && obj == spcobj) {
goto L500;
}
/* CHECK FOR OBJECT NAMES */
i = oidx + 1;
L100:
++i;
if (ovoc[i - 1] <= 0 || ovoc[i - 1] >= r50min) {
return ret_val;
}
/* !IF DONE, LOSE. */
if (ovoc[i - 1] != obj) {
goto L100;
}
/* !IF FAIL, CONT. */
if (aidx == 0) {
goto L500;
}
/* !ANY ADJ? */
i = aidx + 1;
L200:
++i;
if (avoc[i - 1] <= 0 || avoc[i - 1] >= r50min) {
return ret_val;
}
/* !IF DONE, LOSE. */
if (avoc[i - 1] != obj) {
goto L200;
}
/* !IF FAIL, CONT. */
L500:
ret_val = TRUE_;
return ret_val;
} /* thisit_ */

492
np3.c Normal file
View File

@ -0,0 +1,492 @@
/* SYNMCH-- SYNTAX MATCHER */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
#include "parse.h"
static void unpack_ P((integer, integer *));
static integer gwim_ P((integer, integer, integer));
static logical syneql_ P((integer, integer, integer, integer, integer));
static logical takeit_ P((integer, integer));
/* THIS ROUTINE DETAILS ON BIT 4 OF PRSFLG */
logical synmch_()
{
/* Initialized data */
/* THE FOLLOWING DATA STATEMENT WAS ORIGINALLY: */
/* DATA R50MIN/1RA/ */
const integer r50min = 1600;
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer j;
integer newj;
integer drive, limit, qprep, sprep, dforce;
ret_val = FALSE_;
j = pv_1.act;
/* !SET UP PTR TO SYNTAX. */
drive = 0;
/* !NO DEFAULT. */
dforce = 0;
/* !NO FORCED DEFAULT. */
qprep = orphs_1.oflag & orphs_1.oprep;
L100:
j += 2;
/* !FIND START OF SYNTAX. */
if (vvoc[j - 1] <= 0 || vvoc[j - 1] >= r50min) {
goto L100;
}
limit = j + vvoc[j - 1] + 1;
/* !COMPUTE LIMIT. */
++j;
/* !ADVANCE TO NEXT. */
L200:
unpack_(j, &newj);
/* !UNPACK SYNTAX. */
sprep = syntax_1.dobj & VPMASK;
if (! syneql_(pv_1.p1, pv_1.o1, syntax_1.dobj, syntax_1.dfl1,
syntax_1.dfl2)) {
goto L1000;
}
sprep = syntax_1.iobj & VPMASK;
if (syneql_(pv_1.p2, pv_1.o2, syntax_1.iobj, syntax_1.ifl1,
syntax_1.ifl2)) {
goto L6000;
}
/* SYNTAX MATCH FAILS, TRY NEXT ONE. */
if (pv_1.o2 != 0) {
goto L3000;
} else {
goto L500;
}
/* !IF O2=0, SET DFLT. */
L1000:
if (pv_1.o1 != 0) {
goto L3000;
} else {
goto L500;
}
/* !IF O1=0, SET DFLT. */
L500:
if (qprep == 0 || qprep == sprep) {
dforce = j;
}
/* !IF PREP MCH. */
if ((syntax_1.vflag & SDRIV) != 0) {
drive = j;
}
L3000:
j = newj;
if (j < limit) {
goto L200;
}
/* !MORE TO DO? */
/* SYNMCH, PAGE 2 */
/* MATCH HAS FAILED. IF DEFAULT SYNTAX EXISTS, TRY TO SNARF */
/* ORPHANS OR GWIMS, OR MAKE NEW ORPHANS. */
if (drive == 0) {
drive = dforce;
}
/* !NO DRIVER? USE FORCE. */
if (drive == 0) {
goto L10000;
}
/* !ANY DRIVER? */
unpack_(drive, &dforce);
/* !UNPACK DFLT SYNTAX. */
/* TRY TO FILL DIRECT OBJECT SLOT IF THAT WAS THE PROBLEM. */
if ((syntax_1.vflag & SDIR) == 0 || pv_1.o1 != 0) {
goto L4000;
}
/* FIRST TRY TO SNARF ORPHAN OBJECT. */
pv_1.o1 = orphs_1.oflag & orphs_1.oslot;
if (pv_1.o1 == 0) {
goto L3500;
}
/* !ANY ORPHAN? */
if (syneql_(pv_1.p1, pv_1.o1, syntax_1.dobj, syntax_1.dfl1,
syntax_1.dfl2)) {
goto L4000;
}
/* ORPHAN FAILS, TRY GWIM. */
L3500:
pv_1.o1 = gwim_(syntax_1.dobj, syntax_1.dfw1, syntax_1.dfw2);
/* !GET GWIM. */
if (pv_1.o1 > 0) {
goto L4000;
}
/* !TEST RESULT. */
i__1 = syntax_1.dobj & VPMASK;
orphan_(- 1, pv_1.act, 0, i__1, 0);
rspeak_(623);
return ret_val;
/* TRY TO FILL INDIRECT OBJECT SLOT IF THAT WAS THE PROBLEM. */
L4000:
if ((syntax_1.vflag & SIND) == 0 || pv_1.o2 != 0) {
goto L6000;
}
pv_1.o2 = gwim_(syntax_1.iobj, syntax_1.ifw1, syntax_1.ifw2);
/* !GWIM. */
if (pv_1.o2 > 0) {
goto L6000;
}
if (pv_1.o1 == 0) {
pv_1.o1 = orphs_1.oflag & orphs_1.oslot;
}
i__1 = syntax_1.dobj & VPMASK;
orphan_(- 1, pv_1.act, pv_1.o1, i__1, 0);
rspeak_(624);
return ret_val;
/* TOTAL CHOMP */
L10000:
rspeak_(601);
/* !CANT DO ANYTHING. */
return ret_val;
/* SYNMCH, PAGE 3 */
/* NOW TRY TO TAKE INDIVIDUAL OBJECTS AND */
/* IN GENERAL CLEAN UP THE PARSE VECTOR. */
L6000:
if ((syntax_1.vflag & SFLIP) == 0) {
goto L5000;
}
j = pv_1.o1;
/* !YES. */
pv_1.o1 = pv_1.o2;
pv_1.o2 = j;
L5000:
prsvec_1.prsa = syntax_1.vflag & SVMASK;
prsvec_1.prso = pv_1.o1;
/* !GET DIR OBJ. */
prsvec_1.prsi = pv_1.o2;
/* !GET IND OBJ. */
if (! takeit_(prsvec_1.prso, syntax_1.dobj)) {
return ret_val;
}
/* !TRY TAKE. */
if (! takeit_(prsvec_1.prsi, syntax_1.iobj)) {
return ret_val;
}
/* !TRY TAKE. */
ret_val = TRUE_;
return ret_val;
} /* synmch_ */
/* UNPACK- UNPACK SYNTAX SPECIFICATION, ADV POINTER */
/* DECLARATIONS */
static void unpack_(oldj, j)
integer oldj;
integer *j;
{
/* Local variables */
integer i;
for (i = 1; i <= 11; ++i) {
/* !CLEAR SYNTAX. */
syn[i - 1] = 0;
/* L10: */
}
syntax_1.vflag = vvoc[oldj - 1];
*j = oldj + 1;
if ((syntax_1.vflag & SDIR) == 0) {
return;
}
syntax_1.dfl1 = -1;
/* !ASSUME STD. */
syntax_1.dfl2 = -1;
if ((syntax_1.vflag & SSTD) == 0) {
goto L100;
}
syntax_1.dfw1 = -1;
/* !YES. */
syntax_1.dfw2 = -1;
syntax_1.dobj = VABIT + VRBIT + VFBIT;
goto L200;
L100:
syntax_1.dobj = vvoc[*j - 1];
/* !NOT STD. */
syntax_1.dfw1 = vvoc[*j];
syntax_1.dfw2 = vvoc[*j + 1];
*j += 3;
if ((syntax_1.dobj & VEBIT) == 0) {
goto L200;
}
syntax_1.dfl1 = syntax_1.dfw1;
/* !YES. */
syntax_1.dfl2 = syntax_1.dfw2;
L200:
if ((syntax_1.vflag & SIND) == 0) {
return;
}
syntax_1.ifl1 = -1;
/* !ASSUME STD. */
syntax_1.ifl2 = -1;
syntax_1.iobj = vvoc[*j - 1];
syntax_1.ifw1 = vvoc[*j];
syntax_1.ifw2 = vvoc[*j + 1];
*j += 3;
if ((syntax_1.iobj & VEBIT) == 0) {
return;
}
syntax_1.ifl1 = syntax_1.ifw1;
/* !YES. */
syntax_1.ifl2 = syntax_1.ifw2;
} /* unpack_ */
/* SYNEQL- TEST FOR SYNTAX EQUALITY */
/* DECLARATIONS */
static logical syneql_(prep, obj, sprep, sfl1, sfl2)
integer prep;
integer obj;
integer sprep;
integer sfl1;
integer sfl2;
{
/* System generated locals */
logical ret_val;
if (obj == 0) {
goto L100;
}
/* !ANY OBJECT? */
ret_val = prep == (sprep & VPMASK) && (sfl1 & objcts_1.oflag1[
obj - 1] | sfl2 & objcts_1.oflag2[obj - 1]) != 0;
return ret_val;
L100:
ret_val = prep == 0 && sfl1 == 0 && sfl2 == 0;
return ret_val;
} /* syneql_ */
/* TAKEIT- PARSER BASED TAKE OF OBJECT */
/* DECLARATIONS */
static logical takeit_(obj, sflag)
integer obj;
integer sflag;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer x;
integer odo2;
/* TAKEIT, PAGE 2 */
ret_val = FALSE_;
/* !ASSUME LOSES. */
if (obj == 0 || obj > star_1.strbit) {
goto L4000;
}
/* !NULL/STARS WIN. */
odo2 = objcts_1.odesc2[obj - 1];
/* !GET DESC. */
x = objcts_1.ocan[obj - 1];
/* !GET CONTAINER. */
if (x == 0 || (sflag & VFBIT) == 0) {
goto L500;
}
if ((objcts_1.oflag2[x - 1] & OPENBT) != 0) {
goto L500;
}
rspsub_(566, odo2);
/* !CANT REACH. */
return ret_val;
L500:
if ((sflag & VRBIT) == 0) {
goto L1000;
}
if ((sflag & VTBIT) == 0) {
goto L2000;
}
/* SHOULD BE IN ROOM (VRBIT NE 0) AND CAN BE TAKEN (VTBIT NE 0) */
if (schlst_(0, 0, play_1.here, 0, 0, obj) <= 0) {
goto L4000;
}
/* !IF NOT, OK. */
/* ITS IN THE ROOM AND CAN BE TAKEN. */
if ((objcts_1.oflag1[obj - 1] & TAKEBT) != 0 && (
objcts_1.oflag2[obj - 1] & TRYBT) == 0) {
goto L3000;
}
/* NOT TAKEABLE. IF WE CARE, FAIL. */
if ((sflag & VCBIT) == 0) {
goto L4000;
}
rspsub_(445, odo2);
return ret_val;
/* 1000-- IT SHOULD NOT BE IN THE ROOM. */
/* 2000-- IT CANT BE TAKEN. */
L2000:
if ((sflag & VCBIT) == 0) {
goto L4000;
}
L1000:
if (schlst_(0, 0, play_1.here, 0, 0, obj) <= 0) {
goto L4000;
}
rspsub_(665, odo2);
return ret_val;
/* TAKEIT, PAGE 3 */
/* OBJECT IS IN THE ROOM, CAN BE TAKEN BY THE PARSER, */
/* AND IS TAKEABLE IN GENERAL. IT IS NOT A STAR. */
/* TAKING IT SHOULD NOT HAVE SIDE AFFECTS. */
/* IF IT IS INSIDE SOMETHING, THE CONTAINER IS OPEN. */
/* THE FOLLOWING CODE IS LIFTED FROM SUBROUTINE TAKE. */
L3000:
if (obj != advs_1.avehic[play_1.winner - 1]) {
goto L3500;
}
/* !TAKE VEHICLE? */
rspeak_(672);
return ret_val;
L3500:
if (x != 0 && objcts_1.oadv[x - 1] == play_1.winner || weight_(0, obj,
play_1.winner) + objcts_1.osize[obj - 1] <= state_1.mxload) {
goto L3700;
}
rspeak_(558);
/* !TOO BIG. */
return ret_val;
L3700:
newsta_(obj, 559, 0, 0, play_1.winner);
/* !DO TAKE. */
objcts_1.oflag2[obj - 1] |= TCHBT;
scrupd_(objcts_1.ofval[obj - 1]);
objcts_1.ofval[obj - 1] = 0;
L4000:
ret_val = TRUE_;
/* !SUCCESS. */
return ret_val;
} /* takeit_ */
/* GWIM- GET WHAT I MEAN IN AMBIGOUS SITUATIONS */
/* DECLARATIONS */
static integer gwim_(sflag, sfw1, sfw2)
integer sflag;
integer sfw1;
integer sfw2;
{
/* System generated locals */
integer ret_val;
/* Local variables */
integer av;
integer nobj, robj;
logical nocare;
/* GWIM, PAGE 2 */
ret_val = -1;
/* !ASSUME LOSE. */
av = advs_1.avehic[play_1.winner - 1];
nobj = 0;
nocare = (sflag & VCBIT) == 0;
/* FIRST SEARCH ADVENTURER */
if ((sflag & VABIT) != 0) {
nobj = fwim_(sfw1, sfw2, 0, 0, play_1.winner, nocare);
}
if ((sflag & VRBIT) != 0) {
goto L100;
}
L50:
ret_val = nobj;
return ret_val;
/* ALSO SEARCH ROOM */
L100:
robj = fwim_(sfw1, sfw2, play_1.here, 0, 0, nocare);
if (robj < 0) {
goto L500;
} else if (robj == 0) {
goto L50;
} else {
goto L200;
}
/* !TEST RESULT. */
/* ROBJ > 0 */
L200:
if (av == 0 || robj == av || (objcts_1.oflag2[robj - 1] & FINDBT)
!= 0) {
goto L300;
}
if (objcts_1.ocan[robj - 1] != av) {
goto L50;
}
/* !UNREACHABLE? TRY NOBJ */
L300:
if (nobj != 0) {
return ret_val;
}
/* !IF AMBIGUOUS, RETURN. */
if (! takeit_(robj, sflag)) {
return ret_val;
}
/* !IF UNTAKEABLE, RETURN */
ret_val = robj;
L500:
return ret_val;
} /* gwim_ */

522
nrooms.c Normal file
View File

@ -0,0 +1,522 @@
/* RAPPL2- SPECIAL PURPOSE ROOM ROUTINES, PART 2 */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
static void ewtell_ P((integer, integer));
static void lookto_ P((integer, integer, integer, integer, integer));
logical rappl2_(ri)
integer ri;
{
/* Initialized data */
const integer newrms = 38;
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer i;
integer j;
ret_val = TRUE_;
switch (ri - newrms + 1) {
case 1: goto L38000;
case 2: goto L39000;
case 3: goto L40000;
case 4: goto L41000;
case 5: goto L42000;
case 6: goto L43000;
case 7: goto L44000;
case 8: goto L45000;
case 9: goto L46000;
case 10: goto L47000;
case 11: goto L48000;
case 12: goto L49000;
case 13: goto L50000;
case 14: goto L51000;
case 15: goto L52000;
case 16: goto L53000;
case 17: goto L54000;
case 18: goto L55000;
case 19: goto L56000;
case 20: goto L57000;
case 21: goto L58000;
case 22: goto L59000;
case 23: goto L60000;
}
bug_(70, ri);
return ret_val;
/* R38-- MIRROR D ROOM */
L38000:
if (prsvec_1.prsa == vindex_1.lookw) {
lookto_(rindex_1.fdoor, rindex_1.mrg, 0, 682, 681);
}
return ret_val;
/* R39-- MIRROR G ROOM */
L39000:
if (prsvec_1.prsa == vindex_1.walkiw) {
jigsup_(685);
}
return ret_val;
/* R40-- MIRROR C ROOM */
L40000:
if (prsvec_1.prsa == vindex_1.lookw) {
lookto_(rindex_1.mrg, rindex_1.mrb, 683, 0, 681);
}
return ret_val;
/* R41-- MIRROR B ROOM */
L41000:
if (prsvec_1.prsa == vindex_1.lookw) {
lookto_(rindex_1.mrc, rindex_1.mra, 0, 0, 681);
}
return ret_val;
/* R42-- MIRROR A ROOM */
L42000:
if (prsvec_1.prsa == vindex_1.lookw) {
lookto_(rindex_1.mrb, 0, 0, 684, 681);
}
return ret_val;
/* RAPPL2, PAGE 3 */
/* R43-- MIRROR C EAST/WEST */
L43000:
if (prsvec_1.prsa == vindex_1.lookw) {
ewtell_(play_1.here, 683);
}
return ret_val;
/* R44-- MIRROR B EAST/WEST */
L44000:
if (prsvec_1.prsa == vindex_1.lookw) {
ewtell_(play_1.here, 686);
}
return ret_val;
/* R45-- MIRROR A EAST/WEST */
L45000:
if (prsvec_1.prsa == vindex_1.lookw) {
ewtell_(play_1.here, 687);
}
return ret_val;
/* R46-- INSIDE MIRROR */
L46000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(688);
/* !DESCRIBE */
/* NOW DESCRIBE POLE STATE. */
/* CASES 1,2-- MDIR=270 & MLOC=MRB, POLE IS UP OR IN HOLE */
/* CASES 3,4-- MDIR=0 V MDIR=180, POLE IS UP OR IN CHANNEL */
/* CASE 5-- POLE IS UP */
i = 689;
/* !ASSUME CASE 5. */
if (findex_1.mdir == 270 && findex_1.mloc == rindex_1.mrb) {
i = min(findex_1.poleuf,1) + 690;
}
if (findex_1.mdir % 180 == 0) {
i = min(findex_1.poleuf,1) + 692;
}
rspeak_(i);
/* !DESCRIBE POLE. */
i__1 = findex_1.mdir / 45 + 695;
rspsub_(694, i__1);
/* !DESCRIBE ARROW. */
return ret_val;
/* RAPPL2, PAGE 4 */
/* R47-- MIRROR EYE ROOM */
L47000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 704;
/* !ASSUME BEAM STOP. */
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
if (qhere_(j, play_1.here) && j != oindex_1.rbeam) {
goto L47200;
}
/* L47100: */
}
i = 703;
L47200:
rspsub_(i, objcts_1.odesc2[j - 1]);
/* !DESCRIBE BEAM. */
lookto_(rindex_1.mra, 0, 0, 0, 0);
/* !LOOK NORTH. */
return ret_val;
/* R48-- INSIDE CRYPT */
L48000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 46;
/* !CRYPT IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.tomb - 1] & OPENBT) != 0) {
i = 12;
}
rspsub_(705, i);
return ret_val;
/* R49-- SOUTH CORRIDOR */
L49000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(706);
/* !DESCRIBE. */
i = 46;
/* !ODOOR IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.odoor - 1] & OPENBT) != 0) {
i = 12;
}
if (findex_1.lcell == 4) {
rspsub_(707, i);
}
/* !DESCRIBE ODOOR IF THERE. */
return ret_val;
/* R50-- BEHIND DOOR */
L50000:
if (prsvec_1.prsa != vindex_1.walkiw) {
goto L50100;
}
/* !WALK IN? */
cevent_1.cflag[cindex_1.cevfol - 1] = TRUE_;
/* !MASTER FOLLOWS. */
cevent_1.ctick[cindex_1.cevfol - 1] = -1;
return ret_val;
L50100:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 46;
/* !QDOOR IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.qdoor - 1] & OPENBT) != 0) {
i = 12;
}
rspsub_(708, i);
return ret_val;
/* RAPPL2, PAGE 5 */
/* R51-- FRONT DOOR */
L51000:
if (prsvec_1.prsa == vindex_1.walkiw) {
cevent_1.ctick[cindex_1.cevfol - 1] = 0;
}
/* !IF EXITS, KILL FOLLOW. */
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
lookto_(0, rindex_1.mrd, 709, 0, 0);
/* !DESCRIBE SOUTH. */
i = 46;
/* !PANEL IS OPEN/CLOSED. */
if (findex_1.inqstf) {
i = 12;
}
/* !OPEN IF INQ STARTED. */
j = 46;
/* !QDOOR IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.qdoor - 1] & OPENBT) != 0) {
j = 12;
}
rspsb2_(710, i, j);
return ret_val;
/* R52-- NORTH CORRIDOR */
L52000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 46;
if ((objcts_1.oflag2[oindex_1.cdoor - 1] & OPENBT) != 0) {
i = 12;
}
/* !CDOOR IS OPEN/CLOSED. */
rspsub_(711, i);
return ret_val;
/* R53-- PARAPET */
L53000:
if (prsvec_1.prsa == vindex_1.lookw) {
i__1 = findex_1.pnumb + 712;
rspsub_(712, i__1);
}
return ret_val;
/* R54-- CELL */
L54000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 721;
/* !CDOOR IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.cdoor - 1] & OPENBT) != 0) {
i = 722;
}
rspeak_(i);
i = 46;
/* !ODOOR IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.odoor - 1] & OPENBT) != 0) {
i = 12;
}
if (findex_1.lcell == 4) {
rspsub_(723, i);
}
/* !DESCRIBE. */
return ret_val;
/* R55-- PRISON CELL */
L55000:
if (prsvec_1.prsa == vindex_1.lookw) {
rspeak_(724);
}
/* !LOOK? */
return ret_val;
/* R56-- NIRVANA CELL */
L56000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 46;
/* !ODOOR IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.odoor - 1] & OPENBT) != 0) {
i = 12;
}
rspsub_(725, i);
return ret_val;
/* RAPPL2, PAGE 6 */
/* R57-- NIRVANA AND END OF GAME */
L57000:
if (prsvec_1.prsa != vindex_1.walkiw) {
return ret_val;
}
/* !WALKIN? */
rspeak_(726);
score_(0);
/* moved to exit routine CLOSE(DBCH) */
exit_();
/* R58-- TOMB ROOM */
L58000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 46;
/* !TOMB IS OPEN/CLOSED. */
if ((objcts_1.oflag2[oindex_1.tomb - 1] & OPENBT) != 0) {
i = 12;
}
rspsub_(792, i);
return ret_val;
/* R59-- PUZZLE SIDE ROOM */
L59000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 861;
/* !ASSUME DOOR CLOSED. */
if (findex_1.cpoutf) {
i = 862;
}
/* !OPEN? */
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* R60-- PUZZLE ROOM */
L60000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
if (findex_1.cpushf) {
goto L60100;
}
/* !STARTED PUZZLE? */
rspeak_(868);
/* !NO, DESCRIBE. */
if ((objcts_1.oflag2[oindex_1.warni - 1] & TCHBT) != 0) {
rspeak_(869);
}
return ret_val;
L60100:
cpinfo_(880, findex_1.cphere);
/* !DESCRIBE ROOM. */
return ret_val;
} /* rappl2_ */
/* LOOKTO-- DESCRIBE VIEW IN MIRROR HALLWAY */
/* DECLARATIONS */
static void lookto_(nrm, srm, nt, st, ht)
integer nrm;
integer srm;
integer nt;
integer st;
integer ht;
{
/* System generated locals */
integer i__1;
/* Local variables */
integer i, m1, dir, mrbf;
rspeak_(ht);
/* !DESCRIBE HALL. */
rspeak_(nt);
/* !DESCRIBE NORTH VIEW. */
rspeak_(st);
/* !DESCRIBE SOUTH VIEW. */
dir = 0;
/* !ASSUME NO DIRECTION. */
if ((i__1 = findex_1.mloc - play_1.here, abs(i__1)) != 1) {
goto L200;
}
/* !MIRROR TO N OR S? */
if (findex_1.mloc == nrm) {
dir = 695;
}
if (findex_1.mloc == srm) {
dir = 699;
}
/* !DIR=N/S. */
if (findex_1.mdir % 180 != 0) {
goto L100;
}
/* !MIRROR N-S? */
rspsub_(847, dir);
/* !YES, HE SEES PANEL */
rspsb2_(848, dir, dir);
/* !AND NARROW ROOMS. */
goto L200;
L100:
m1 = mrhere_(play_1.here);
/* !WHICH MIRROR? */
mrbf = 0;
/* !ASSUME INTACT. */
if (m1 == 1 && ! findex_1.mr1f || m1 == 2 && ! findex_1.mr2f) {
mrbf = 1;
}
i__1 = mrbf + 849;
rspsub_(i__1, dir);
/* !DESCRIBE. */
if (m1 == 1 && findex_1.mropnf) {
i__1 = mrbf + 823;
rspeak_(i__1);
}
if (mrbf != 0) {
rspeak_(851);
}
L200:
i = 0;
/* !ASSUME NO MORE TO DO. */
if (nt == 0 && (dir == 0 || dir == 699)) {
i = 852;
}
if (st == 0 && (dir == 0 || dir == 695)) {
i = 853;
}
if (nt + st + dir == 0) {
i = 854;
}
if (ht != 0) {
rspeak_(i);
}
/* !DESCRIBE HALLS. */
} /* lookto_ */
/* EWTELL-- DESCRIBE E/W NARROW ROOMS */
/* DECLARATIONS */
static void ewtell_(rm, st)
integer rm;
integer st;
{
/* System generated locals */
integer i__1;
/* Local variables */
integer i;
logical m1;
/* NOTE THAT WE ARE EAST OR WEST OF MIRROR, AND */
/* MIRROR MUST BE N-S. */
m1 = findex_1.mdir + (rm - rindex_1.mrae) % 2 * 180 == 180;
i = (rm - rindex_1.mrae) % 2 + 819;
/* !GET BASIC E/W STRING. */
if (m1 && ! findex_1.mr1f || ! m1 && ! findex_1.mr2f) {
i += 2;
}
rspeak_(i);
if (m1 && findex_1.mropnf) {
i__1 = (i - 819) / 2 + 823;
rspeak_(i__1);
}
rspeak_(825);
rspeak_(st);
} /* ewtell_ */

1140
objcts.c Normal file

File diff suppressed because it is too large Load Diff

36
output Normal file
View File

@ -0,0 +1,36 @@
Welcome to Dungeon. This version created 11-MAR-91.
You are in an open field west of a big white house with a boarded
front door.
There is a small mailbox here.
>You are in an open field west of a big white house with a boarded
front door.
There is a small mailbox here.
>You are in an open field west of a big white house with a boarded
front door.
There is a small mailbox here.
>You are in a forest, with trees in all directions around you.
>You are in a forest, with trees in all directions around you.
>You are in a forest, with trees in all directions around you.
>You are in a dimly lit forest, with large trees all around. One
particularly large tree with some low branches stands here.
You hear in the distance the chirping of a song bird.
>You are about ten feet above the ground nestled among some large
branches. The nearest branch above you is beyond your reach.
On the branch is a small birds nest.
The birds nest contains:
A jewel-encrusted egg.
>Taken.
>You are in a dimly lit forest, with large trees all around. One
particularly large tree with some low branches stands here.
You hear in the distance the chirping of a song bird.
>You are in a clearing, with a forest surrounding you on the west
and south.
There is a pile of leaves on the ground.
>Done.
A grating appears on the ground.
>You are in a clearing, with a forest surrounding you on the west
and south.
There is a grating securely fastened into the ground.
There is a pile of leaves on the ground.
>I don't understand that.
>

694
parse.h Normal file
View File

@ -0,0 +1,694 @@
/* parse.h -- header file for parsing structures used by dungeon */
/* These structures are only used by the parsing routines. They are in
* their own file since they are so large.
*/
#ifndef PARSE_H
#define PARSE_H
#ifndef EXTERN
#define EXTERN extern
#endif
EXTERN struct {
integer act, o1, o2, p1, p2;
} pv_;
#define pv_1 pv_
#define pvec ((integer *)&pv_1)
#define objvec ((integer *)&pv_1 + 1)
#define prpvec ((integer *)&pv_1 + 3)
EXTERN struct {
integer vflag, dobj, dfl1, dfl2, dfw1, dfw2, iobj, ifl1, ifl2, ifw1, ifw2;
} syntax_;
#define syntax_1 syntax_
#define syn ((integer *)&syntax_1)
/* Object flags (objflg) */
#define VABIT (16384)
#define VRBIT (8192)
#define VTBIT (4096)
#define VCBIT (2048)
#define VEBIT (1024)
#define VFBIT (512)
#define VPMASK (511)
/* Syntax flags (synflg) */
#define SDIR (16384)
#define SIND (8192)
#define SSTD (4096)
#define SFLIP (2048)
#define SDRIV (1024)
#define SVMASK (511)
/* BUZZ WORDS-- IGNORED IN SYNTACTIC PROCESSING */
/* THE FOLLOWING DATA STATEMENT WAS CONVERTED FROM: */
/* DATA BVOC/3RAND,0,2RBY,0,2RIS,0,1RA,0, */
/* & 2RAN,0,3RTHE,0,3RRUN,0,2RGO,0,3RPRO,3RCEE,0,0/ */
EXTERN const struct {
integer bvoc[20];
} buzvoc_
#ifdef INIT
= { 2164, 0, 4200, 0, 15160, 0, 1600, 0, 2160, 0, 32325, 0,
29654, 0, 11800, 0, 26335, 5005, 0, 0 }
#endif
;
#define buzvoc_1 buzvoc_
/* PREPOSITIONS-- MAPS PREPOSITIONS TO INDICES */
/* THE FOLLOWING DATA STATEMENT WAS CONVERTED FROM: */
/* DATA PVOC/3ROVE,1RR,1,3RWIT,1RH,2,3RUSI,2RNG,2,3RTHR,3ROUG,2, */
/* & 2RAT,0,3,2RTO,0,4,2RIN,0,5,3RINS,3RIDE,5,3RINT,1RO,5, */
/* & 3RDOW,1RN,6,2RUP,0,7,3RUND,2RER,8,2ROF,0,9,2RON,0,10, */
/* & 3ROFF,0,11/ */
EXTERN const struct {
integer pvoc[45];
} prpvoc_
#ifdef INIT
= { 24885, 28800, 1, 37180, 12800, 2, 34369, 22680, 2, 32338,
24847, 2, 2400, 0, 3, 32600, 0, 4, 14960, 0, 5, 14979, 14565, 5,
14980, 0, 5, 7023, 22400, 6, 34240, 0, 7, 34164, 8720, 8, 24240,
0, 9, 24560, 0, 10, 24246, 0, 11 }
#endif
;
#define prpvoc_1 prpvoc_
/* DIRECTIONS-- MAPS DIRECTIONS TO INDICES */
/* THE FOLLOWING DATA STATEMENT WAS CONVERTED FROM: */
/* DATA DVOC/1RN,0,"2000,3RNOR,2RTH,"2000,1RS,0,"12000, */
/* & 1RE,0,"6000,3REAS,1RT,"6000,1RW,0,"16000,3RWES,1RT,"16000, */
/* & 2RSE,0,"10000,2RSW,0,"14000, */
/* & 2RNE,0,"4000,2RNW,0,"20000, */
/* & 1RU,0,"22000,2RUP,0,"22000,1RD,0,"24000,3RDOW,1RN,"24000, */
/* & 3RLAU,3RNCH,"26000,3RLAN,1RD,"30000,3RENT,2RER,"32000, */
/* & 3REXI,1RT,"34000,3ROUT,0,"34000,3RLEA,2RVE,"34000, */
/* & 3RTRA,3RVEL,"36000,3RSOU,2RTH,"12000, */
/* & 2RIN,0,"32000, */
/* & 3RCRO,2RSS,"36000/ */
EXTERN const struct {
integer dvoc[75];
} dirvoc_
#ifdef INIT
= { 22400, 0, 1024, 23018, 32320, 1024, 30400, 0, 5120, 8000, 0,
3072, 8059, 32000, 3072, 36800, 0, 7168, 37019, 32000, 7168,
30600, 0, 4096, 31320, 0, 6144, 22600, 0, 2048, 23320, 0, 8192,
33600, 0, 9216, 34240, 0, 9216, 6400, 0, 10240, 7023, 22400,
10240, 19261, 22528, 11264, 19254, 6400, 12288, 8580, 8720, 13312,
8969, 32000, 14336, 24860, 0, 14336, 19401, 35400, 14336, 32721,
35412, 15360, 31021, 32320, 5120, 14960, 0, 13312, 5535, 31160,
15360 }
#endif
;
#define dirvoc_1 dirvoc_
/* ADJECTIVES-- MAPS ADJECTIVES TO OBJECT NUMBERS */
/* EACH ENTRY IS VARIABLE LENGTH AND CONSISTS OF A TWO WORD */
/* ADJECTIVE IN RADIX-50 FOLLOWED BY ONE OR MORE OBJECT NUMBERS. */
/* NOTE THAT ADJECTIVES CAN BE DISTINGUISHED FROM OBJECTS AS */
/* FOLLOWS-- ALL ADJECTIVES ARE .GE. 1RA (1600), WHILE ALL OBJECTS */
/* ARE .LE. OLNT (255 MAX). */
/* THE DATA STATEMENT BELOW WAS CONVERTED FROM: */
/* DATA AVOC1/3RBRO,2RWN,1,81,3RELO,3RNGA,1,3RHOT,0,3,3RPEP,3RPER,3, */
/* & 3RVIT,3RREO,4,3RJAD,1RE,6,3RHUG,1RE,8,3RENO,3RRMO,8,122, */
/* & 3RTRO,3RPHY,9,3RCLE,2RAR,10,3RLAR,2RGE,12,26,47,95,96,123, */
/* & 133,135,146,147,150,176,3RNAS,2RTY,13,3RELV,3RISH,14, */
/* & 3RBRA,2RSS,15,16,46,156, */
/* & 3RBRO,3RKEN,16,22,92,113,155,158,3RORI,3RENT,17, */
/* & 3RBLO,3RODY,20,3RRUS,2RTY,21,3RBUR,3RNED,22, */
/* & 3RDEA,1RD,22,3ROLD,0,25,41,44,45,3RLEA,3RTHE,25, */
/* & 3RPLA,3RTIN,26,3RPEA,2RRL,27, */
/* & 3RMOB,1RY,31,3RCRY,3RSTA,32,126, */
/* & 3RGOL,1RD,33,85,104,157,158,188, */
/* & 3RIVO,2RRY,34,3RSAP,3RPHI,37,3RWOO,3RDEN,38,67,136,137, */
/* & 165,173,174,175,3RWOO,1RD,38,67,136,137,165,173,174,175, */
/* & 3RSTE,2REL,39,125,189, */
/* & 3RDEN,3RTED,39,3RFAN,2RCY,40,3RANC,3RIEN,41,44, */
/* & 3RSMA,2RLL,5,46,52,53,89,102,103,153,187, */
/* & 3RBLA,2RCK,47,162,3RTOU,1RR,49, */
/* & 3RVIS,3RCOU,55,3RVIC,3RIOU,62, */
/* & 3RGLA,2RSS,10,126,132,3RTRA,1RP,66/ */
/* DATA AVOC2/3RFRO,2RNT,68,3RSTO,2RNE,69,150,214,3RMAN,3RGLE,72, */
/* & 3RRED,0,79,94,140,161,170,171,3RYEL,3RLOW,80,159, */
/* & 3RBLU,1RE,82,112,114,141, */
/* & 3RVAM,3RPIR,83,3RMAG,2RIC,90, */
/* & 3RSEA,3RWOR,90,3RTAN,0,91,3RSHA,2RRP,92, */
/* & 3RWIC,3RKER,98,3RCLO,2RTH,100, */
/* & 3RBRA,3RIDE,101, */
/* & 3RGAU,2RDY,108,3RSQU,3RARE,109,127,3RCLA,1RY,109, */
/* & 3RSHI,2RNY,110,3RTHI,1RN,110, */
/* & 3RGRE,2REN,115,143,3RPUR,3RPLE,116,3RWHI,2RTE,117,147,160, */
/* & 3RMAR,3RBLE,119,3RCOK,1RE,121,3REMP,2RTY,121, */
/* & 3RROU,2RND,128,3RTRI,3RANG,129, */
/* & 2 3RRAR,1RE,134,3ROBL,3RONG,135,3REAT,3R$ME,138, */
/* & 3REAT,2RME,138,3RORA,3RNGE,139,3RECC,1RH,141/ */
/* DATA AVOC3/3RROC,2RKY,147,3RSHE,2RER,147, */
/* & 3R200,0,148,3RNEA,1RT,148,3RSHI,3RMME,151, */
/* & 3RZUR,3RICH,152,3RBIR,2RDS,153,154,155, */
/* & 3RENC,3RRUS,154,155,3RBEA,3RUTI,156,3RCLO,3RCKW,157,158, */
/* & 3RMEC,3RHAN,157,158, */
/* & 3RMAH,3ROGA,163,3RPIN,1RE,164,3RLON,1RG,166, */
/* & 3RCEN,3RTER,166,3RSHO,2RRT,167,1RT,0,168, */
/* & 3RCOM,3RPAS,169,211,3RBRO,3RNZE,172,3RCEL,1RL,174,175, */
/* & 3RLOC,3RKED,174,3RSUN,0,177, */
/* & 3RBAR,1RE,200,3RSON,1RG,203, */
/* & 3RNOR,2RTH,205,3RNOR,3RTHE,205,3RSOU,2RTH,206, */
/* & 3RSOU,3RTHE,206,3REAS,1RT,207,3REAS,3RTER,207, */
/* & 3RWES,1RT,208,3RWES,3RTER,208,3RDUN,3RGEO,215/ */
EXTERN const integer avoc[]
#ifdef INIT
= { 3935, 37360, 1, 81, 8495, 22681, 1, 13420, 0, 3, 25816,
25818, 3, 35580, 29015, 4, 16044, 8000, 6, 13647, 8000, 8, 8575,
29335, 8, 122, 32735, 25945, 9, 5285, 2320, 10, 19258, 11400, 12,
26, 47, 95, 96, 123, 133, 135, 146, 147, 150, 176, 22459, 33000,
13, 8502, 15168, 14, 3921, 31160, 15, 16, 46, 156, 3935, 17814,
16, 22, 92, 113, 155, 158, 24729, 8580, 17, 3695, 24185, 20,
29659, 33000, 21, 4058, 22604, 22, 6601, 6400, 22, 24484, 0, 25,
41, 44, 45, 19401, 32325, 25, 26081, 32374, 26, 25801, 29280, 27,
21402, 40000, 31, 5545, 31201, 32, 126, 11812, 6400, 33, 85, 104,
157, 158, 188, 15295, 29800, 34, 30456, 25929, 37, 37415, 6614,
38, 67, 136, 137, 165, 173, 174, 175, 37415, 6400, 38, 67, 136,
137, 165, 173, 174, 175, 31205, 8480, 39, 125, 189, 6614, 32204,
39, 9654, 5800, 40, 2163, 14614, 41, 44, 30921, 19680, 5, 46, 52,
53, 89, 102, 103, 153, 187, 3681, 5240, 47, 162, 32621, 28800, 49,
35579, 5421, 55, 35563, 15021, 62, 11681, 31160, 10, 126, 132,
32721, 25600, 66, 10335, 23200, 68, 31215, 22600, 69, 150, 214,
20854, 11685, 72, 29004, 0, 79, 94, 140, 161, 170, 171, 40212,
19823, 80, 159, 3701, 8000, 82, 112, 114, 141, 35253, 25978, 83,
20847, 14520, 90, 30601, 37418, 90, 32054, 0, 91, 30721, 29440,
92, 37163, 17818, 98, 5295, 32320, 100, 3921, 14565, 101, 11261,
7400, 108, 31101, 2325, 109, 127, 5281, 4000, 109, 30729, 23400,
110, 32329, 22400, 110, 11925, 8560, 115, 143, 26458, 26085, 116,
37129, 32200, 117, 147, 160, 20858, 3685, 119, 5411, 8000, 121,
8536, 33000, 121, 29421, 22560, 128, 32729, 2167, 129, 28858,
8000, 134, 24092, 24567, 135, 8060, 43725, 138, 8060, 21000, 138,
24721, 22685, 139, 8123, 12800, 141, 29403, 18600, 147, 30725,
8720, 147, 52430, 0, 148, 22601, 32000, 148, 30729, 21325, 151,
42458, 14528, 152, 3578, 7160, 153, 154, 155, 8563, 29659, 154,
155, 3401, 34409, 156, 5295, 5263, 157, 158, 21003, 12854, 157,
158, 20848, 24281, 163, 25974, 8000, 164, 19814, 11200, 166, 5014,
32218, 166, 30735, 29600, 167, 32000, 0, 168, 5413, 25659, 169,
211, 3935, 23445, 172, 5012, 19200, 174, 175, 19803, 17804, 174,
31254, 0, 177, 3258, 8000, 200, 31014, 11200, 203, 23018, 32320,
205, 23018, 32325, 205, 31021, 32320, 206, 31021, 32325, 206,
8059, 32000, 207, 8059, 32218, 207, 37019, 32000, 208, 37019,
32218, 208, 7254, 11415, 215, -1 }
#endif
;
/* VERBS-- MAPS VERBS TO SYNTAX SLOTS */
/* EACH ENTRY IS VARIABLE LENGTH AND CONSISTS OF ONE OR MORE */
/* TWO WORD VERBS IN RADIX-50 FOLLOWED BY A SYNTAX WORD COUNT */
/* FOLLOWED BY ONE OR MORE SYNTAXES. NOTE THAT VERBS CAN BE */
/* DISTINGUISHED FROM WORD COUNTS AS FOLLOWS-- */
/* ALL VERBS ARE .GE. 1RA (1600), WHILE ALL SYNTAX WORD COUNTS */
/* ARE .LE. 255. */
/* SYNTAX ENTRIES CONSIST OF A FLAG WORD FOLLOWED BY 0, 1, OR 2 */
/* OBJECT DESCRIPTIONS. THE FLAG WORD HAS THE FOLLOWING FORMAT-- */
/* BIT <14> IF 1, SYNTAX INCLUDES DIRECT OBJECT */
/* BIT <13> IF 1, SYNTAX INCLUDES INDIRECT OBJECT */
/* BIT <12> IF 1, DIRECT OBJECT IS IMPLICIT (STANDARD FORM) */
/* BIT <11> IF 1, DIRECT AND INDIRECT OBJECT MUST BE SWAPPED */
/* AFTER SYNTAX PROCESSING */
/* BIT <10> IF 1, THIS IS DEFAULT SYNTAX FOR ORPHANERY */
/* BITS <8:0> VERB NUMBER FOR VAPPLI */
/* OBJECT DESCRIPTIONS CONSIST OF A FLAG WORD AND TWO FWIM WORDS. */
/* THE FLAG WORD HAS THE FOLLOWING FORMAT-- */
/* BIT <14> IF 1, SEARCH ADVENTURER FOR OBJECT */
/* BIT <13> IF 1, SEARCH ROOM FOR OBJECT */
/* BIT <12> IF 1, PARSER WILL TRY TO TAKE OBJECT */
/* BIT <11> IF 1, ADVENTURER MUST HAVE OBJECT */
/* BIT <10> IF 1, QUALIFYING BITS (NORMALLY -1,-1) ARE SAME */
/* AS FWIM BITS */
/* BIT <9> IF 1, OBJECT MUST BE REACHABLE */
/* BITS <8:0> PREPOSITION NUMBER FOR SYNMCH */
/* THE FWIM WORDS HAVE THE SAME FORMAT AS THE TWO OBJECT FLAG WORDS. */
/* NOTE THAT BITS 12 AND 11 OF OBJECT DESCRIPTIONS ACTUALLY HAVE */
/* FOUR DISTINCT STATES-- */
/* BIT 12 BIT 11 MDLDESC INTERPRETATION */
/* ------ ------ ------- --------------- */
/* 0 0 -- NO PARSER ACTION */
/* 0 1 HAVE ADVENTURER MUST HAVE OBJECT */
/* 1 0 TRY TRY TO TAKE, DONT CARE IF FAIL */
/* 1 1 TAKE TRY TO TAKE, CARE IF FAIL */
/* THE FOLLOWING DATA STATEMENT WAS ORIGINALLY: */
/* DATA VVOC1/3RBRI,2REF,1,70,3RVER,3RBOS,1,71, */
/* & 3RSUP,3RERB,1,72,3RSTA,1RY,1,73,3RVER,3RSIO,1,74, */
/* & 3RSWI,1RM,3RBAT,2RHE,3RWAD,1RE,1,75,3RGER,3RONI,1,76, */
/* & 3RULY,3RSSE,3RODY,3RSSE,1,77, */
/* & 3RWEL,1RL,1,78,3RPRA,1RY,1,79,3RTRE,3RASU,1,80, */
/* & 3RTEM,3RPLE,1,81,3RBLA,2RST,1,82,3RSCO,2RRE,1,83, */
/* & 1RQ,0,3RQUI,1RT,1,84,3RHEL,1RP,1,40,3RINF,1RO,1,41, */
/* & 3RHIS,3RTOR,3RUPD,3RATE,1,42,3RBAC,1RK,1,43, */
/* & 3RSIG,1RH,3RMUM,3RBLE,1,44/ */
/* DATA VVOC1A/3RCHO,2RMP,3RLOS,1RE,3RBAR,1RF,1,45, */
/* & 3RDUN,3RGEO,1,46,3RFRO,3RBOZ,1,47,3RFOO,0,3RBLE,3RTCH, */
/* & 3RBAR,0,1,48,3RREP,3RENT,1,49,3RHOU,2RRS,3RSCH,3REDU,1,50, */
/* & 3RWIN,0,1,51,3RYEL,1RL,3RSCR,3REAM,3RSHO,2RUT,1,52, */
/* & 3RHOP,0,3RSKI,1RP,1,53,3RFUC,1RK,3RSHI,1RT,3RDAM,1RN, */
/* & 3RCUR,2RSE,1,54,3RZOR,1RK,1,55,3RGRA,3RNIT,1,"50070, */
/* & 3RSAV,1RE,1,149,3RRES,3RTOR,1,150,3RTIM,1RE,1,90, */
/* & 3RDIA,3RGNO,1,94,3REXO,3RRCI,1,105,3RINV,3RENT, */
/* & 1RI,0,1,133,3RWAI,1RT,1,128, */
/* & 3RINC,3RANT,1,95,3RANS,3RWER,1,96/ */
/* DATA VVOC1B/3RAGA,2RIN,1,57,3RNOO,2RBJ,1,58, */
/* & 3RBUG,0,3RGRI,2RPE,3RCOM,3RPLA,1,59, */
/* & 3RFEA,3RTUR,3RCOM,3RMEN,3RSUG,3RGES,3RIDE,1RA,1,60, */
/* & 3RROO,1RM,1,65,3ROBJ,3RECT,1,66,3RRNA,2RME,1,67/ */
/* DATA VVOC2/3RDEF,3RLAT,1,"50147, */
/* & 3RDES,3RCRI,3RWHA,1RT,3REXA,3RMIN,1,"50170, */
/* & 3RFIL,1RL,11,"60206,"61000,"200,0,"61002,"400,0, */
/* & "40206,"61000,"200,0, */
/* & 3RFIN,1RD,3RSEE,1RK,3RWHE,2RRE,3RSEE,0,4,"40177,"60000,-1,-1, */
/* & 3RFOL,3RLOW,2,"125,"50125, */
/* & 3RKIC,1RK,3RBIT,1RE,3RTAU,2RNT,1,"50153,3RLOW,2RER,1,"50156, */
/* & 3RPUS,1RH,3RPRE,2RSS,1,"50160,3RRIN,1RG,3RPEA,1RL,1,"50127, */
/* & 3RRUB,0,3RCAR,3RESS,3RTOU,2RCH,3RFON,3RDLE,1,"50157, */
/* & 3RSHA,2RKE,1,"50171,3RSPI,1RN,1,"50201, */
/* & 3RUNT,2RIE,3RFRE,1RE,1,"50161,3RWAL,1RK,9,"50216, */
/* & "40126,"61002,-1,-1,"40126,"61005,-1,-1/ */
/* DATA VVOC3/3RATT,3RACK,3RFIG,2RHT,3RINJ,3RURE,3RHIT,0,3RHUR,1RT, */
/* & 7,"60215,"21000,0,"200,"44002,0,"1000, */
/* & 3RBOA,2RRD,4,"40202,"21000,0,"2, */
/* & 3RBRU,2RSH,3RCLE,2RAN,5,"52130,"70130,"61002,-1,-1, */
/* & 3RBUR,1RN,3RIGN,3RITE,3RINC,3RINE,7,"60211,"61000,"20,0, */
/* & "64002,"10,0, */
/* & 3RCLI,2RMB,12,"40235,"20007,0,"4000, */
/* & "40236,"20006,0,"4000,"40234,"20000,0,"4000, */
/* & 3RCLO,2RSE,4,"40176,"61000,"10200,0, */
/* & 3RDIG,0,4,"40131,"44002,"4,0, */
/* & 3RDIS,3REMB,4,"40203,"20000,0,"2, */
/* & 3RDRI,2RNK,3RIMB,3RIBE,3RSWA,3RLLO,4,"40210,"61000,"400,0, */
/* & 3RDRO,1RP,3RREL,3REAS,11,"42221,"41000,-1,-1, */
/* & "60221,"41000,-1,-1,"61005,-1,-1, */
/* & 3REAT,0,3RCON,3RSUM,3RGOB,3RBLE,3RMUN,2RCH,3RTAS,2RTE, */
/* & 4,"40207,"75000,"2000,0, */
/* & 3REXT,3RING,3RDOU,2RSE,4,"40174,"75000,"100,0/ */
/* DATA VVOC4/3RGIV,1RE,3RHAN,1RD,3RDON,3RATE,11,"72222,"21004, */
/* & "40,0,"64222,"21000,"40,0,"61000,-1,-1, */
/* & 3RHEL,2RLO,2RHI,0,2,"2227,"50227, */
/* & 3RBLO,1RW,15,"62146,"61007,-1,-1,"61002,"4,0, */
/* & "40160,"61007,-1,-1,"40165,"61005,-1,-1, */
/* & 3RINF,3RLAT,4,"70146,"61002,"4,0, */
/* & 3RJUM,1RP,3RLEA,1RP,5,"133,"40133,"61001,-1,-1, */
/* & 3RKIL,1RL,3RMUR,3RDER,3RSLA,1RY,3RSTA,1RB,3RDIS,3RPAT, */
/* & 7,"60213,"21000,0,"200, */
/* & "44002,0,"1000, */
/* & 3RKNO,2RCK,3RRAP,0,12,"42166,"61003,-1,-1, */
/* & "40166,"61012,-1,-1,"40215,"23006,"40,0, */
/* & 3RLIG,2RHT,11,"42173,"75000,"100,0, */
/* & "60211,"61000,"100,0,"54002,"10,0, */
/* & 3RLOC,1RK,4,"40134,"20000,-1,-1/ */
/* DATA VVOC5/3RLOO,1RK,1RL,0,3RSTA,2RRE,3RGAZ,1RE, */
/* & 13,"167,"40167,"60003,-1,-1, */
/* & "40231,"61010,-1,-1,"40230,"60005,-1,-1, */
/* & 3RMEL,1RT,3RLIQ,3RUIF,4,"70145,"61002,"10,0, */
/* & 3RMOV,1RE,4,"40172,"20000,-1,-1, */
/* & 3RPUL,1RL,3RTUG,0,8,"42172,"21000,-1,-1, */
/* & "40172,"21012,-1,-1, */
/* & 3RMUN,1RG,3RHAC,1RK,3RFRO,1RB,3RDAM,3RAGE, */
/* & 5,"52212,"70212,"44002,-1,-1, */
/* & 3ROPE,1RN,11,"42175,"61000,"10200,0, */
/* & "60175,"61000,"10200,0,"54002,"4,"1000, */
/* & 3RPIC,1RK,4,"40204,"61007,"20000,"40, */
/* & 3RPLU,1RG,3RGLU,1RE,3RPAT,2RCH,4,"70152,"61002,-1,-1, */
/* & 3RPOK,1RE,3RBRE,2RAK,3RJAB,0,7,"60212,"21000,0,"200, */
/* & "44002,0,"1000, */
/* & 3RPOU,1RR,3RSPI,2RLL,11,"42223,"42000,"400,0, */
/* & "60223,"42000,"400,0,"60005,-1,-1, */
/* & 3RPUM,1RP,4,"60232,"60007,-1,-1/ */
/* DATA VVOC6/3RPUT,0,3RINS,3RERT,3RSTU,2RFF,3RPLA,2RCE, */
/* & 8,"72220,"61005,-1,-1, */
/* & "40221,"61006,-1,-1, */
/* & 3RRAI,2RSE,3RLIF,1RT,5,"52155,"40155,"61007,-1,-1, */
/* & 3RREA,1RD,3RSKI,1RM,11,"42144,"71000,"40000,0, */
/* & "60144,"71000,"40000,0,"61002,-1,-1, */
/* & 3RSTR,3RIKE,12,"60215,"23000,"40,0, */
/* & "44002,0,"1000,"42215,"23000,"40,0,"50173, */
/* & 3RSWI,2RNG,3RTHR,3RUST,7,"60214,"44000,0,"1000, */
/* & "21003,0,"200, */
/* & 3RTAK,1RE,3RGET,0,3RHOL,1RD,3RCAR,2RRY,3RREM,3ROVE, */
/* & 4,"40204,"61000,"20000,"40, */
/* & 3RTEL,1RL,3RCOM,3RMAN,3RREQ,3RUES,4,"40217,"20000,0,"2000, */
/* & 3RTHR,2ROW,3RHUR,1RL,3RCHU,2RCK,14,"60224,"44000,-1,-1, */
/* & "21003,"40,0,"60224,"44000,-1,-1,"21002,"40,0/ */
/* DATA VVOC7/3RTIE,0,3RFAS,3RTEN,11,"70162,"61004,-1,-1, */
/* & "60163,"21000,"40,0,"65002,"4,0, */
/* & 3RTUR,1RN,3RSET,0,22,"62164,"61000,"2,0, */
/* & "64002,"4,0, */
/* & "40173,"75012,"100,0,"40174,"75013,"100,0, */
/* & "60237,"61000,"2,0,"20004,-1,-1, */
/* & 3RUNL,3ROCK,7,"60135,"21000,-1,-1, */
/* & "74002,"4,0, */
/* & 3RWAK,1RE,3RSUR,3RPRI,3RALA,2RRM,3RSTA,3RRTL, */
/* & 8,"42150,"20000,"40,0, */
/* & "40150,"20007,"40,0, */
/* & 3RWAV,1RE,3RFLA,3RUNT,3RBRA,3RNDI,4,"40154,"40000,-1,-1, */
/* & 3RWIN,1RD,5,"50233,"40233,"61007,-1,-1/ */
EXTERN const integer vvoc[]
#ifdef INIT
= { 3929, 8240, 1, 70, 35418, 3819, 1, 71, 31256, 8722, 1, 72,
31201, 40000, 1, 73, 35418, 30775, 1, 74, 31329, 20800, 3260,
13000, 36844, 8000, 1, 75, 11418, 24569, 1, 76, 34105, 31165,
24185, 31165, 1, 77, 37012, 19200, 1, 78, 26321, 40000, 1, 79,
32725, 2381, 1, 80, 32213, 26085, 1, 81, 3681, 31200, 1, 82,
30535, 29000, 1, 83, 27200, 0, 28049, 32000, 1, 84, 13012, 25600,
1, 40, 14966, 24000, 1, 41, 13179, 32618, 34244, 2405, 1, 42,
3243, 17600, 1, 43, 30767, 12800, 21653, 3685, 1, 44, 5135, 21440,
19819, 8000, 3258, 9600, 1, 45, 7254, 11415, 1, 46, 10335, 3826,
1, 47, 10215, 0, 3685, 32128, 3258, 0, 1, 48, 29016, 8580, 1, 49,
13421, 29560, 30528, 8181, 1, 50, 37174, 0, 1, 51, 40212, 19200,
30538, 8053, 30735, 34400, 1, 52, 13416, 0, 30849, 25600, 1, 53,
10443, 17600, 30729, 32000, 6453, 22400, 5658, 30600, 1, 54,
42218, 17600, 1, 55, 11921, 22780, 1, 20536, 30462, 8000, 1, 149,
29019, 32618, 1, 150, 32373, 8000, 1, 90, 6761, 11775, 1, 94,
8975, 28929, 1, 105, 14982, 8580, 14400, 0, 1, 133, 36849, 32000,
1, 128, 14963, 2180, 1, 95, 2179, 37018, 1, 96, 1881, 14960, 1,
57, 23015, 3600, 1, 58, 4047, 0, 11929, 25800, 5413, 26081, 1, 59,
9801, 32858, 5413, 21014, 31247, 11419, 14565, 1600, 1, 60,
29415, 20800, 1, 65, 24090, 8140, 1, 66, 29361, 21000, 1, 67,
6606, 19260, 1, 20583, 6619, 5529, 37121, 32000, 8961, 21174, 1,
20600, 9972, 19200, 11, 24710, 25088, 128, 0, 25090, 256, 0,
16518, 25088, 128, 0, 9974, 6400, 30605, 17600, 37125, 29000,
30605, 0, 4, 16511, 24576, -1, -1, 10212, 19823, 2, 85, 20565,
17963, 17600, 3580, 8000, 32061, 23200, 1, 20587, 19823, 8720, 1,
20590, 26459, 12800, 26325, 31160, 1, 20592, 29174, 11200, 25801,
19200, 1, 20567, 29642, 0, 4858, 8779, 32621, 5120, 10214, 6885,
1, 20591, 30721, 17800, 1, 20601, 31049, 22400, 1, 20609, 34180,
14600, 10325, 8000, 1, 20593, 36852, 17600, 9, 20622, 16470,
25090, -1, -1, 16470, 25093, -1, -1, 2420, 1731, 9967, 13600,
14970, 34325, 13180, 0, 13658, 32000, 7, 24717, 8704, 0, 128,
18434, 0, 512, 3801, 28960, 4, 16514, 8704, 0, 2, 3941, 30720,
5285, 2160, 5, 21592, 28760, 25090, -1, -1, 4058, 22400, 14694,
15205, 14963, 14965, 7, 24713, 25088, 16, 0, 26626, 8, 0, 5289,
20880, 12, 16541, 8199, 0, 2048, 16542, 8198, 0, 2048, 16540,
8192, 0, 2048, 5295, 30600, 4, 16510, 25088, 4224, 0, 6767, 0, 4,
16473, 18434, 4, 0, 6779, 8522, 4, 16515, 8192, 0, 2, 7129, 22840,
14922, 14485, 31321, 19695, 4, 16520, 25088, 256, 0, 7135, 25600,
29012, 8059, 11, 17553, 16896, -1, -1, 24721, 16896, -1, -1,
25093, -1, -1, 8060, 0, 5414, 31253, 11802, 3685, 21654, 5120,
32059, 32200, 4, 16519, 31232, 1024, 0, 8980, 14967, 7021, 30600,
4, 16508, 31232, 64, 0, 11582, 8000, 12854, 6400, 7014, 2405, 11,
29842, 8708, 32, 0, 26770, 8704, 32, 0, 25088, -1, -1, 13012,
19800, 13160, 0, 2, 1175, 20631, 3695, 36800, 15, 25702, 25095,
-1, -1, 25090, 4, 0, 16496, 25095, -1, -1, 16501, 25093, -1, -1,
14966, 19260, 4, 28774, 25090, 4, 0, 16853, 25600, 19401, 25600,
5, 91, 16475, 25089, -1, -1, 17972, 19200, 21658, 6618, 30881,
40000, 31201, 3200, 6779, 25660, 7, 24715, 8704, 0, 128, 18434, 0,
512, 18175, 5240, 28856, 0, 12, 17526, 25091, -1, -1, 16502,
25098, -1, -1, 16525, 9734, 32, 0, 19567, 13600, 11, 17531, 31232,
64, 0, 24713, 25088, 64, 0, 22530, 8, 0, 19803, 17600, 4, 16476,
8192, -1, -1, 19815, 17600, 19200, 0, 31201, 29000, 11266, 8000,
13, 119, 16503, 24579, -1, -1, 16537, 25096, -1, -1, 16536, 24581,
-1, -1, 21012, 32000, 19577, 33966, 4, 28773, 25090, 8, 0, 21422,
8000, 4, 16506, 8192, -1, -1, 26452, 19200, 32847, 0, 8, 17530,
8704, -1, -1, 16506, 8714, -1, -1, 21654, 11200, 12843, 17600,
10335, 3200, 6453, 1885, 5, 21642, 28810, 18434, -1, -1, 24645,
22400, 11, 17533, 25088, 4224, 0, 24701, 25088, 4224, 0, 22530, 4,
512, 25963, 17600, 4, 16516, 25095, 8192, 32, 26101, 11200,
11701, 8000, 25660, 5120, 4, 28778, 25090, -1, -1, 26211, 8000,
3925, 2040, 16042, 0, 7, 24714, 8704, 0, 128, 18434, 0, 512,
26221, 28800, 31049, 19680, 11, 17555, 17408, 256, 0, 24723,
17408, 256, 0, 24581, -1, -1, 26453, 25600, 4, 24730, 24583, -1,
-1, 26460, 0, 14979, 8740, 31221, 9840, 26081, 5000, 8, 29840,
25093, -1, -1, 16529, 25094, -1, -1, 28849, 30600, 19566, 32000,
5, 21613, 16493, 25095, -1, -1, 29001, 6400, 30849, 20800, 11,
17508, 29184, 16384, 0, 24676, 29184, 16384, 0, 25090, -1, -1,
31218, 14845, 12, 24717, 9728, 32, 0, 18434, 0, 512, 17549, 9728,
32, 0, 20603, 31329, 22680, 32338, 34380, 7, 24716, 18432, 0, 512,
8707, 0, 128, 32051, 8000, 11420, 0, 13412, 6400, 4858, 29800,
29013, 24885, 4, 16516, 25088, 8192, 32, 32212, 19200, 5413,
20854, 29017, 33819, 4, 16527, 8192, 0, 1024, 32338, 24920, 13658,
19200, 5141, 5240, 14, 24724, 18432, -1, -1, 8707, 32, 0, 24724,
18432, -1, -1, 8706, 32, 0, 32365, 0, 9659, 32214, 11, 28786,
25092, -1, -1, 24691, 8704, 32, 0, 27138, 4, 0, 32858, 22400,
30620, 0, 22, 25716, 25088, 2, 0, 26626, 4, 0, 16507, 31242, 64,
0, 16508, 31243, 64, 0, 24735, 25088, 2, 0, 8196, -1, -1, 34172,
24131, 7, 24669, 8704, -1, -1, 30722, 4, 0, 36851, 8000, 31258,
26329, 2081, 29320, 31201, 29612, 8, 17512, 8192, 32, 0, 16488,
8199, 32, 0, 36862, 8000, 10081, 34180, 3921, 22569, 4, 16492,
16384, -1, -1, 37174, 6400, 5, 20635, 16539, 25095, -1, -1, -1 }
#endif
;
/* OBJECTS-- MAPS OBJECTS TO OBJECT INDICES */
/* SAME FORMAT AS AVOC. */
/* THE FOLLOWING DATA STATEMENT WAS ORIGINALLY: */
/* DATA OVOC1/3RBAG,0,1,25,100,3RSAC,1RK,1,3RGAR,3RLIC,2, */
/* & 3RCLO,2RVE,2,3RFOO,1RD,3,3RSAN,3RDWI,3,3RLUN,2RCH,3, */
/* & 3RDIN,3RNER,3, */
/* & 3RGUN,1RK,4,55,3RPIE,2RCE,4,143,186,3RSLA,1RG,4,3RCOA,1RL,5, */
/* & 3RPIL,1RE,5,18,38,78,87,88,122,3RHEA,1RP,5, */
/* & 3RFIG,3RURI,6, */
/* & 3RMAC,3RHIN,7,3RPDP,2R10,7,3RPDP,2R11,7,3RDRY,2RER,7, */
/* & 3RLID,0,7,3RDIA,3RMON,8,3RCAS,1RE,9,123,3RBOT,3RTLE,10,121, */
/* & 3RCON,3RTAI,10,3RWAT,2RER,11,209,3RQUA,3RNTI,11,209, */
/* & 3RLIQ,3RUID,11,209,3RH2O,0,11,209, */
/* & 3RROP,1RE,12,101,3RHEM,1RP,12,3RCOI,1RL,12,110, */
/* & 3RKNI,2RFE,13,21,3RBLA,2RDE,13,14,3RSWO,2RRD,14,3RORC,3RHRI,14, */
/* & 3RGLA,3RMDR,14,3RLAM,1RP,15,16,22,3RLAN,3RTER,15,16,22, */
/* & 3RRUG,0,17,3RCAR,3RPET,17, */
/* & 3RLEA,3RVES,18,3RLEA,1RF,18,3RTRO,2RLL,19, */
/* & 3RAXE,0,20,3RDIN,3RNER,3/ */
/* DATA OVOC2/3RKEY,1RS,23,3RKEY,0,23, */
/* & 3RSET,0,23,3RBON,2RES,24,3RSKE,3RLET,24,3RBOD,1RY,24,73, */
/* & 3RCOI,2RNS,25,3RBAR,0,26,165,168, */
/* & 3RNEC,3RKLA,27,3RPEA,3RRLS,27,3RMIR,3RROR,28,29,212, */
/* & 3RICE,0,30,3RMAS,1RS,30,3RGLA,3RCIE,30,3RRUB,1RY,31, */
/* & 3RTRI,3RDEN,32,3RFOR,1RK,32,3RCOF,3RFIN,33,3RCAS,3RKET,33, */
/* & 3RTOR,2RCH,34,3RCAG,1RE,35,36,124,125,3RDUM,3RBWA,35,36, */
/* & 3RBAS,3RKET,35,36,98,113,3RBRA,3RCEL,37, */
/* & 3RJEW,2REL,37,3RTIM,3RBER,38,3RBOX,0,39,53,105,3RSTR,3RADI,40, */
/* & 3RVIO,3RLIN,40,3RENG,3RRAV,41,3RINS,3RCRI,41,44,3RGHO,2RST,42, */
/* & 3RSPI,3RRIT,42,3RFIE,2RND,42,3RGRA,2RIL,43,3RPRA,3RYER,44,47, */
/* & 3RTRU,2RNK,45,3RCHE,2RST,45,3RBEL,1RL,46, */
/* & 3RBOO,1RK,47,49,114,115,116,117,3RBIB,2RLE,47/ */
/* DATA OVOC3/3RGOO,3RDBO,47,3RCAN,3RDLE,48,3RPAI,1RR,48, */
/* & 3RGUI,3RDEB,49, */
/* & 3RGUI,2RDE,49,3RPAP,2RER,50,122,143,186,3RNEW,3RSPA,50, */
/* & 3RISS,2RUE,50,3RREP,3RORT,50,3RMAG,3RAZI,50,3RNEW,1RS,50, */
/* & 3RMAT,3RCHB,51, */
/* & 3RMAT,2RCH,51,3RMAT,3RCHE,51,3RADV,3RERT,52,3RPAM,3RPHL,52, */
/* & 3RLEA,3RFLE,52,3RBOO,3RKLE,52,3RMAI,3RLBO,53, */
/* & 3RTUB,1RE,54,3RTOO,3RTHP,54,3RPUT,2RTY,55,3RMAT,3RERI,55, */
/* & 3RGLU,1RE,55,3RWRE,3RNCH,56,3RSCR,3REWD,57, */
/* & 3RCYC,3RLOP,58,3RMON,3RSTE,58,3RCHA,3RLIC,59,3RCUP,0,59, */
/* & 3RGOB,3RLET,59,3RPAI,3RNTI,60,149,3RART,0,60,149, */
/* & 3RCAN,3RVAS,60,3RPIC,3RTUR,60,3RWOR,1RK,60, */
/* & 3RMAS,3RTER,60,215,3RTHI,2REF,61,3RROB,3RBER,61, */
/* & 3RCRI,3RMIN,61,3RBAN,3RDIT,61,3RCRO,2ROK,61,3RGEN,1RT,61, */
/* & 3RGEN,3RTLE,61,3RMAN,0,61,3RTHU,1RG,61, */
/* & 3RBAG,3RMAN,61,3RSTI,3RLLE,62/ */
/* DATA OVOC4/3RWIN,3RDOW,63,3RBOL,1RT,64,3RNUT,0,64, */
/* & 3RGRA,2RTE,65,3RGRA,3RTIN,65,3RDOO,1RR,66,67,68,69, */
/* & 164,172,173,174,175,189,3RTRA,3RPDO,66, */
/* & 3RTRA,3RP$D,66,3RSWI,3RTCH,70,76,79,80,81,82,170, */
/* & 3RHEA,1RD,71,120,3RCOR,3RPSE,72,73,3RBOD,3RIES,73, */
/* & 3RDAM,0,74,3RGAT,2RES,74,76,3RGAT,1RE,74,76, */
/* & 3RFCD,0,74,3RRAI,1RL,75,3RRAI,3RLIN,75, */
/* & 3RBUT,3RTON,76,79,80,81,82,127,128,129,170,176, */
/* & 3RBUB,3RBLE,77,3RLEA,1RK,78,3RDRI,1RP,78, */
/* & 3RHOL,1RE,78,107, */
/* & 3RBAT,0,83,3RRAI,3RNBO,84, */
/* & 3RPOT,0,85,3RSTA,3RTUE,86,3RSCU,3RLPT,86,3RROC,1RK,86, */
/* & 3RBOA,1RT,87,88,90,3RPLA,3RSTI,87,88, */
/* & 3RPUM,1RP,89/ */
/* DATA OVOC5/3RAIR,3RPUM,89,3RAIR,3R$PU,89,3RLAB,2REL,91,112, */
/* & 3RFIN,3REPR,91,3RSTI,2RCK,92,3RBAR,3RREL,93,3RBUO,1RY,94, */
/* & 3REME,3RRAL,95,3RSHO,3RVEL,96,3RGUA,2RNO,97,3RCRA,1RP,97, */
/* & 3RSHI,1RT,97,3RHUN,1RK,97,3RBAL,3RLOO,98,113, */
/* & 3RREC,3REPT,99,3RWIR,1RE,101,110, */
/* & 3RHOO,1RK,102,103,3RZOR,3RKMI,104,148,3RCOI,1RN,104, */
/* & 3RSAF,1RE,105,3RCAR,1RD,106,188,3RNOT,1RE,106,186, */
/* & 3RSLO,1RT,107,187,3RCRO,2RWN,108,3RBRI,2RCK,109, */
/* & 3RFUS,1RE,110,3RGNO,2RME,111,152, */
/* & 3RSTA,2RMP,118, */
/* & 3RTOM,1RB,119,3RCRY,2RPT,119,3RGRA,2RVE,119,3RHEA,2RDS,120, */
/* & 3RPOL,2RES,120,3RIMP,3RLEM,120/ */
/* DATA OVOC6/3RLOS,3RERS,120,3RCOK,2RES,121, */
/* & 3RLIS,3RTIN,122,3RSTA,2RCK,122, */
/* & 3RPRI,3RNTO,122, */
/* & 3RSPH,3RERE,126,3RBAL,1RL,126, */
/* & 3RETC,3RHIN,130,131, */
/* & 3RWAL,2RLS,130,131,198,205,206,207,208,3RWAL,1RL, */
/* & 130,131,159,160,161,162,163,164,198,205,206,207,208, */
/* & 3RFLA,2RSK,132,3RPOO,1RL,133,3RSEW,3RAGE,133, */
/* & 3RTIN,0,134,3RSAF,3RFRO,134,3RSPI,3RCES,134,3RTAB,2RLE,135, */
/* & 3RPOS,1RT,136,166,167,3RPOS,2RTS,136,3RBUC,3RKET,137, */
/* & 3RCAK,1RE,138,139,140,141,3RICI,2RNG,139,140,141, */
/* & 3RROB,2ROT,142,3RROB,2RBY,142, */
/* & 3RC3P,1RO,142,3RR2D,1R2,142/ */
/* DATA OVOC6A/3RPAN,2REL,159,160,161,162,163,164,213, */
/* & 3RPOL,1RE,166,167,3RTBA,1RR,168,3RT$B,2RAR,168, */
/* & 3RARR,2ROW,169,3RPOI,2RNT,169,3RBEA,1RM,171, */
/* & 3RDIA,1RL,177,3RSUN,3RDIA,177,1R1,0,178, */
/* & 3RONE,0,178,1R2,0,179,3RTWO,0,179,1R3,0,180, */
/* & 3RTHR,2REE,180,1R4,0,181,3RFOU,1RR,181,1R5,0,182, */
/* & 3RFIV,1RE,182,1R6,0,183,3RSIX,0,183,1R7,0,184, */
/* & 3RSEV,2REN,184,1R8,0,185,3REIG,2RHT,185, */
/* & 3RWAR,3RNIN,186,3RSLI,1RT,187, */
/* & 2RIT,0,192,3RTHA,1RT,192,3RTHI,1RS,192/ */
/* DATA OVOC7/2RME,0,193,3RMYS,3RELF,193,3RCRE,3RTIN,193, */
/* & 3RALL,0,194,3REVE,3RRYT,194, */
/* & 3RTRE,3RASU,195,3RVAL,3RUAB,195,3RSAI,3RLOR,196,3RTEE,2RTH,197, */
/* & 3RGRU,1RE,199,3RHAN,1RD,200,3RHAN,2RDS,200, */
/* & 3RLUN,2RGS,201,3RAIR,0,201,3RAVI,3RATO,202, */
/* & 3RFLY,2RER,202,3RTRE,1RE,144,145,204, */
/* & 3RCLI,2RFF,146,147,3RLED,2RGE,146,147,3RPOR,3RTRA,149, */
/* & 3RSTA,2RCK,148,3RBIL,2RLS,148, */
/* & 3RVAU,2RLT,150,3RCUB,1RE,150,3RLET,3RTER,67,150, */
/* & 3RCUR,3RTAI,151,3RLIG,2RHT,151,3RNES,1RT,153, */
/* & 3REGG,0,154,155,3RBAU,3RBLE,156,3RCAN,3RARY,157,158, */
/* & 3RBIR,1RD,203,3RSON,3RGBI,203, */
/* & 3RGUA,2RRD,210,3RGUA,3RRDI,210,3RROS,1RE,211, */
/* & 3RSTR,3RUCT,212,3RCHA,3RNNE,214, */
/* & 3RKEE,3RPER,215,3RLAD,3RDER,216/ */
EXTERN const integer ovoc[]
#ifdef INIT
= { 3247, 0, 1, 25, 100, 30443, 17600, 1, 11258, 19563, 2, 5295,
35400, 2, 10215, 6400, 3, 30454, 7329, 3, 20054, 5120, 3, 6774,
22618, 3, 12054, 17600, 4, 55, 25965, 5000, 4, 143, 186, 30881,
11200, 4, 5401, 19200, 5, 25972, 8000, 5, 18, 38, 78, 87, 88, 122,
13001, 25600, 5, 9967, 34329, 6, 20843, 13174, 7, 25776, 50800,
7, 25776, 50840, 7, 7145, 8720, 7, 19564, 0, 7, 6761, 21414, 8,
4859, 8000, 9, 123, 3820, 32485, 10, 121, 5414, 32049, 10, 36860,
8720, 11, 209, 28041, 23209, 11, 209, 19577, 33964, 11, 209,
14095, 0, 11, 209, 29416, 8000, 12, 101, 13013, 25600, 12, 5409,
19200, 12, 110, 18169, 9800, 13, 21, 3681, 6600, 13, 14, 31335,
28960, 14, 24723, 13529, 14, 11681, 20978, 14, 19253, 25600, 15,
16, 22, 19254, 32218, 15, 16, 22, 29647, 0, 17, 4858, 25820, 17,
19401, 35419, 18, 19401, 9600, 18, 32735, 19680, 19, 2565, 0, 20,
6774, 22618, 3, 17825, 30400, 23, 17825, 0, 23, 30620, 0, 23,
3814, 8760, 24, 30845, 19420, 24, 3804, 40000, 24, 73, 5409,
23160, 25, 3258, 0, 26, 165, 168, 22603, 18081, 27, 25801, 29299,
27, 21178, 29418, 28, 29, 212, 14525, 0, 30, 20859, 30400, 30,
11681, 5165, 30, 29642, 40000, 31, 32729, 6614, 32, 10218, 17600,
32, 5406, 9974, 33, 4859, 17820, 33, 32618, 5120, 34, 4847, 8000,
35, 36, 124, 125, 7253, 4121, 35, 36, 3259, 17820, 35, 36, 98,
113, 3921, 5012, 37, 16223, 8480, 37, 32373, 3418, 38, 3824, 0,
39, 53, 105, 31218, 1769, 40, 35575, 19574, 40, 8567, 28862, 41,
14979, 5529, 41, 44, 11535, 31200, 42, 31049, 29180, 42, 9965,
22560, 42, 11921, 14880, 43, 26321, 40218, 44, 47, 32741, 22840,
45, 5125, 31200, 45, 3412, 19200, 46, 3815, 17600, 47, 49, 114,
115, 116, 117, 3562, 19400, 47, 11815, 6495, 47, 4854, 6885, 48,
25649, 28800, 48, 12049, 6602, 49, 12049, 6600, 49, 25656, 8720,
50, 122, 143, 186, 22623, 31041, 50, 15179, 33800, 50, 29016,
24740, 50, 20847, 2649, 50, 22623, 30400, 50, 20860, 5122, 51,
20860, 5120, 51, 20860, 5125, 51, 1782, 8740, 52, 25653, 25932,
52, 19401, 10085, 52, 3815, 18085, 52, 20849, 19295, 53, 32842,
8000, 54, 32615, 32336, 54, 26460, 33000, 55, 20860, 8729, 55,
11701, 8000, 55, 37525, 22528, 56, 30538, 8924, 57, 5803, 19816,
58, 21414, 31205, 58, 5121, 19563, 59, 5656, 0, 59, 11802, 19420,
59, 25649, 23209, 60, 149, 2340, 0, 60, 149, 4854, 35259, 60,
25963, 32858, 60, 37418, 17600, 60, 20859, 32218, 60, 215, 32329,
8240, 61, 29402, 3418, 61, 5529, 21175, 61, 3254, 6780, 61, 5535,
24440, 61, 11414, 32000, 61, 11414, 32485, 61, 20854, 0, 61,
32341, 11200, 61, 3247, 20854, 61, 31209, 19685, 62, 37174, 7023,
63, 3812, 32000, 64, 23260, 0, 64, 11921, 32200, 65, 11921, 32374,
65, 7015, 28800, 66, 67, 68, 69, 164, 172, 173, 174, 175, 189,
32721, 25775, 66, 32721, 26684, 66, 31329, 32128, 70, 76, 79, 80,
81, 82, 170, 13001, 6400, 71, 120, 5418, 26365, 72, 73, 3804,
14619, 73, 6453, 0, 74, 11260, 8760, 74, 76, 11260, 8000, 74, 76,
9724, 0, 74, 28849, 19200, 75, 28849, 19574, 75, 4060, 32614, 76,
79, 80, 81, 82, 127, 128, 129, 170, 176, 4042, 3685, 77, 19401,
17600, 78, 7129, 25600, 78, 13412, 8000, 78, 107, 3260, 0, 83,
28849, 22495, 84, 26220, 0, 85, 31201, 32845, 86, 30541, 19860,
86, 29403, 17600, 86, 3801, 32000, 87, 88, 90, 26081, 31209, 87,
88, 26453, 25600, 89, 1978, 26453, 89, 1978, 43861, 89, 19242,
8480, 91, 112, 9974, 8658, 91, 31209, 5240, 92, 3258, 29012, 93,
4055, 40000, 94, 8525, 28852, 95, 30735, 35412, 96, 12041, 23000,
97, 5521, 25600, 97, 30729, 32000, 97, 13654, 17600, 97, 3252,
19815, 98, 113, 29003, 8660, 99, 37178, 8000, 101, 110, 13415,
17600, 102, 103, 42218, 18129, 104, 148, 5409, 22400, 104, 30446,
8000, 105, 4858, 6400, 106, 188, 23020, 8000, 106, 186, 30895,
32000, 107, 187, 5535, 37360, 108, 3929, 5240, 109, 10459, 8000,
110, 11775, 21000, 111, 152, 31201, 21440, 118, 32613, 3200, 119,
5545, 26400, 119, 11921, 35400, 119, 13001, 7160, 120, 26212,
8760, 120, 14936, 19413, 120, 19819, 8739, 120, 5411, 8760, 121,
19579, 32374, 122, 31201, 5240, 122, 26329, 23215, 122, 31048,
8725, 126, 3252, 19200, 126, 8803, 13174, 130, 131, 36852, 19960,
130, 131, 198, 205, 206, 207, 208, 36852, 19200, 130, 131, 159,
160, 161, 162, 163, 164, 198, 205, 206, 207, 208, 10081, 30840,
132, 26215, 19200, 133, 30623, 1885, 133, 32374, 0, 134, 30446,
10335, 134, 31049, 5019, 134, 32042, 19400, 135, 26219, 32000,
136, 166, 167, 26219, 32760, 136, 4043, 17820, 137, 4851, 8000,
138, 139, 140, 141, 14529, 22680, 139, 140, 141, 29402, 24800,
142, 29402, 4200, 142, 6136, 24000, 142, 30084, 51200, 142, 25654,
8480, 159, 160, 161, 162, 163, 164, 213, 26212, 8000, 166, 167,
32081, 28800, 168, 33082, 2320, 168, 2338, 24920, 169, 26209,
23200, 169, 3401, 20800, 171, 6761, 19200, 177, 31254, 6761, 177,
49600, 0, 178, 24565, 0, 178, 51200, 0, 179, 32935, 0, 179, 52800,
0, 180, 32338, 8200, 180, 54400, 0, 181, 10221, 28800, 181,
56000, 0, 182, 9982, 8000, 182, 57600, 0, 183, 30784, 0, 183,
59200, 0, 184, 30622, 8560, 184, 60800, 0, 185, 8367, 13600, 185,
36858, 22774, 186, 30889, 32000, 187, 15200, 0, 192, 32321, 32000,
192, 32329, 30400, 192, 21000, 0, 193, 21819, 8486, 193, 5525,
32374, 193, 2092, 0, 194, 8885, 29820, 194, 32725, 2381, 195,
35252, 33642, 195, 30449, 19818, 196, 32205, 32320, 197, 11941,
8000, 199, 12854, 6400, 200, 12854, 7160, 200, 20054, 11960, 201,
1978, 0, 201, 2489, 2415, 202, 10105, 8720, 202, 32725, 8000, 144,
145, 204, 5289, 9840, 146, 147, 19404, 11400, 146, 147, 26218,
32721, 149, 31201, 5240, 148, 3572, 19960, 148, 35261, 20000, 150,
5642, 8000, 150, 19420, 32218, 67, 150, 5658, 32049, 151, 19567,
13600, 151, 22619, 32000, 153, 8287, 0, 154, 155, 3261, 3685, 156,
4854, 2345, 157, 158, 3578, 6400, 203, 31014, 11289, 203, 12041,
28960, 210, 12041, 28969, 210, 29419, 8000, 211, 31218, 33740,
212, 5121, 22965, 214, 17805, 25818, 215, 19244, 6618, 216, -1 }
#endif
;
#endif

1
readme.txt Normal file
View File

@ -0,0 +1 @@
Public Domain source code to the original DUNGEON game (Zork I). Released to the PD by Infocom. Includes source files, headers, and information.

940
rooms.c Normal file
View File

@ -0,0 +1,940 @@
/* RAPPL1- SPECIAL PURPOSE ROOM ROUTINES, PART 1 */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
logical rappl1_(ri)
integer ri;
{
/* System generated locals */
integer i__1, i__2;
logical ret_val;
/* Local variables */
logical f;
integer i;
integer j;
ret_val = TRUE_;
/* !USUALLY IGNORED. */
if (ri == 0) {
return ret_val;
}
/* !RETURN IF NAUGHT. */
/* !SET TO FALSE FOR */
/* !NEW DESC NEEDED. */
switch (ri) {
case 1: goto L1000;
case 2: goto L2000;
case 3: goto L3000;
case 4: goto L4000;
case 5: goto L5000;
case 6: goto L6000;
case 7: goto L7000;
case 8: goto L8000;
case 9: goto L9000;
case 10: goto L10000;
case 11: goto L11000;
case 12: goto L12000;
case 13: goto L13000;
case 14: goto L14000;
case 15: goto L15000;
case 16: goto L16000;
case 17: goto L17000;
case 18: goto L18000;
case 19: goto L19000;
case 20: goto L20000;
case 21: goto L21000;
case 22: goto L22000;
case 23: goto L23000;
case 24: goto L24000;
case 25: goto L25000;
case 26: goto L26000;
case 27: goto L27000;
case 28: goto L28000;
case 29: goto L29000;
case 30: goto L30000;
case 31: goto L31000;
case 32: goto L32000;
case 33: goto L33000;
case 34: goto L34000;
case 35: goto L35000;
case 36: goto L36000;
case 37: goto L37000;
}
bug_(1, ri);
/* R1-- EAST OF HOUSE. DESCRIPTION DEPENDS ON STATE OF WINDOW */
L1000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 13;
/* !ASSUME CLOSED. */
if ((objcts_1.oflag2[oindex_1.windo - 1] & OPENBT) != 0) {
i = 12;
}
/* !IF OPEN, AJAR. */
rspsub_(11, i);
/* !DESCRIBE. */
return ret_val;
/* R2-- KITCHEN. SAME VIEW FROM INSIDE. */
L2000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 13;
/* !ASSUME CLOSED. */
if ((objcts_1.oflag2[oindex_1.windo - 1] & OPENBT) != 0) {
i = 12;
}
/* !IF OPEN, AJAR. */
rspsub_(14, i);
/* !DESCRIBE. */
return ret_val;
/* R3-- LIVING ROOM. DESCRIPTION DEPENDS ON MAGICF (STATE OF */
/* DOOR TO CYCLOPS ROOM), RUG (MOVED OR NOT), DOOR (OPEN OR CLOSED) */
L3000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L3500;
}
/* !LOOK? */
i = 15;
/* !ASSUME NO HOLE. */
if (findex_1.magicf) {
i = 16;
}
/* !IF MAGICF, CYCLOPS HOLE. */
rspeak_(i);
/* !DESCRIBE. */
i = findex_1.orrug + 17;
/* !ASSUME INITIAL STATE. */
if ((objcts_1.oflag2[oindex_1.door - 1] & OPENBT) != 0) {
i += 2;
}
/* !DOOR OPEN? */
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* NOT A LOOK WORD. REEVALUATE TROPHY CASE. */
L3500:
if (prsvec_1.prsa != vindex_1.takew && (prsvec_1.prsa != vindex_1.putw ||
prsvec_1.prsi != oindex_1.tcase)) {
return ret_val;
}
advs_1.ascore[play_1.winner - 1] = state_1.rwscor;
/* !SCORE TROPHY CASE. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !RETAIN RAW SCORE AS WELL. */
j = i;
/* !FIND OUT IF IN CASE. */
L3550:
j = objcts_1.ocan[j - 1];
/* !TRACE OWNERSHIP. */
if (j == 0) {
goto L3600;
}
if (j != oindex_1.tcase) {
goto L3550;
}
/* !DO ALL LEVELS. */
advs_1.ascore[play_1.winner - 1] += objcts_1.otval[i - 1];
L3600:
;
}
scrupd_(0);
/* !SEE IF ENDGAME TRIG. */
return ret_val;
/* RAPPL1, PAGE 3 */
/* R4-- CELLAR. SHUT DOOR AND BAR IT IF HE JUST WALKED IN. */
L4000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L4500;
}
/* !LOOK? */
rspeak_(21);
/* !DESCRIBE CELLAR. */
return ret_val;
L4500:
if (prsvec_1.prsa != vindex_1.walkiw) {
return ret_val;
}
/* !WALKIN? */
if ((objcts_1.oflag2[oindex_1.door - 1] & OPENBT +
TCHBT) != OPENBT) {
return ret_val;
}
objcts_1.oflag2[oindex_1.door - 1] = (objcts_1.oflag2[oindex_1.door - 1] |
TCHBT) & ~ OPENBT;
rspeak_(22);
/* !SLAM AND BOLT DOOR. */
return ret_val;
/* R5-- MAZE11. DESCRIBE STATE OF GRATING. */
L5000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(23);
/* !DESCRIBE. */
i = 24;
/* !ASSUME LOCKED. */
if (findex_1.grunlf) {
i = 26;
}
/* !UNLOCKED? */
if ((objcts_1.oflag2[oindex_1.grate - 1] & OPENBT) != 0) {
i = 25;
}
/* !OPEN? */
rspeak_(i);
/* !DESCRIBE GRATE. */
return ret_val;
/* R6-- CLEARING. DESCRIBE CLEARING, MOVE LEAVES. */
L6000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L6500;
}
/* !LOOK? */
rspeak_(27);
/* !DESCRIBE. */
if (findex_1.rvclr == 0) {
return ret_val;
}
/* !LEAVES MOVED? */
i = 28;
/* !YES, ASSUME GRATE CLOSED. */
if ((objcts_1.oflag2[oindex_1.grate - 1] & OPENBT) != 0) {
i = 29;
}
/* !OPEN? */
rspeak_(i);
/* !DESCRIBE GRATE. */
return ret_val;
L6500:
if (findex_1.rvclr != 0 || qhere_(oindex_1.leave, rindex_1.clear) && (
prsvec_1.prsa != vindex_1.movew || prsvec_1.prso !=
oindex_1.leave)) {
return ret_val;
}
rspeak_(30);
/* !MOVE LEAVES, REVEAL GRATE. */
findex_1.rvclr = 1;
/* !INDICATE LEAVES MOVED. */
return ret_val;
/* RAPPL1, PAGE 4 */
/* R7-- RESERVOIR SOUTH. DESCRIPTION DEPENDS ON LOW TIDE FLAG. */
L7000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 31;
/* !ASSUME FULL. */
if (findex_1.lwtidf) {
i = 32;
}
/* !IF LOW TIDE, EMPTY. */
rspeak_(i);
/* !DESCRIBE. */
rspeak_(33);
/* !DESCRIBE EXITS. */
return ret_val;
/* R8-- RESERVOIR. STATE DEPENDS ON LOW TIDE FLAG. */
L8000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 34;
/* !ASSUME FULL. */
if (findex_1.lwtidf) {
i = 35;
}
/* !IF LOW TIDE, EMTPY. */
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* R9-- RESERVOIR NORTH. ALSO DEPENDS ON LOW TIDE FLAG. */
L9000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 36;
/* !YOU GET THE IDEA. */
if (findex_1.lwtidf) {
i = 37;
}
rspeak_(i);
rspeak_(38);
return ret_val;
/* R10-- GLACIER ROOM. STATE DEPENDS ON MELTED, VANISHED FLAGS. */
L10000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(39);
/* !BASIC DESCRIPTION. */
i = 0;
/* !ASSUME NO CHANGES. */
if (findex_1.glacmf) {
i = 40;
}
/* !PARTIAL MELT? */
if (findex_1.glacrf) {
i = 41;
}
/* !COMPLETE MELT? */
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* R11-- FOREST ROOM */
L11000:
if (prsvec_1.prsa == vindex_1.walkiw) {
cevent_1.cflag[cindex_1.cevfor - 1] = TRUE_;
}
/* !IF WALK IN, BIRDIE. */
return ret_val;
/* R12-- MIRROR ROOM. STATE DEPENDS ON MIRROR INTACT. */
L12000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(42);
/* !DESCRIBE. */
if (findex_1.mirrmf) {
rspeak_(43);
}
/* !IF BROKEN, NASTY REMARK. */
return ret_val;
/* RAPPL1, PAGE 5 */
/* R13-- CAVE2 ROOM. BLOW OUT CANDLES WITH 50% PROBABILITY. */
L13000:
if (prsvec_1.prsa != vindex_1.walkiw) {
return ret_val;
}
/* !WALKIN? */
if (prob_(50, 50) || objcts_1.oadv[oindex_1.candl - 1] !=
play_1.winner || ! ((objcts_1.oflag1[oindex_1.candl - 1] &
ONBT) != 0)) {
return ret_val;
}
objcts_1.oflag1[oindex_1.candl - 1] &= ~ ONBT;
rspeak_(47);
/* !TELL OF WINDS. */
cevent_1.cflag[cindex_1.cevcnd - 1] = FALSE_;
/* !HALT CANDLE COUNTDOWN. */
return ret_val;
/* R14-- BOOM ROOM. BLOW HIM UP IF CARRYING FLAMING OBJECT. */
L14000:
j = objcts_1.odesc2[oindex_1.candl - 1];
/* !ASSUME CANDLE. */
if (objcts_1.oadv[oindex_1.candl - 1] == play_1.winner && (
objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
goto L14100;
}
j = objcts_1.odesc2[oindex_1.torch - 1];
/* !ASSUME TORCH. */
if (objcts_1.oadv[oindex_1.torch - 1] == play_1.winner && (
objcts_1.oflag1[oindex_1.torch - 1] & ONBT) != 0) {
goto L14100;
}
j = objcts_1.odesc2[oindex_1.match - 1];
if (objcts_1.oadv[oindex_1.match - 1] == play_1.winner && (
objcts_1.oflag1[oindex_1.match - 1] & ONBT) != 0) {
goto L14100;
}
return ret_val;
/* !SAFE */
L14100:
if (prsvec_1.prsa != vindex_1.trnonw) {
goto L14200;
}
/* !TURN ON? */
rspsub_(294, j);
/* !BOOM */
/* ! */
jigsup_(44);
return ret_val;
L14200:
if (prsvec_1.prsa != vindex_1.walkiw) {
return ret_val;
}
/* !WALKIN? */
rspsub_(295, j);
/* !BOOM */
/* ! */
jigsup_(44);
return ret_val;
/* R15-- NO-OBJS. SEE IF EMPTY HANDED, SCORE LIGHT SHAFT. */
L15000:
findex_1.empthf = TRUE_;
/* !ASSUME TRUE. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !SEE IF CARRYING. */
if (objcts_1.oadv[i - 1] == play_1.winner) {
findex_1.empthf = FALSE_;
}
/* L15100: */
}
if (play_1.here != rindex_1.bshaf || ! lit_(play_1.here)) {
return ret_val;
}
scrupd_(state_1.ltshft);
/* !SCORE LIGHT SHAFT. */
state_1.ltshft = 0;
/* !NEVER AGAIN. */
return ret_val;
/* RAPPL1, PAGE 6 */
/* R16-- MACHINE ROOM. DESCRIBE MACHINE. */
L16000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
i = 46;
/* !ASSUME LID CLOSED. */
if ((objcts_1.oflag2[oindex_1.machi - 1] & OPENBT) != 0) {
i = 12;
}
/* !IF OPEN, OPEN. */
rspsub_(45, i);
/* !DESCRIBE. */
return ret_val;
/* R17-- BAT ROOM. UNLESS CARRYING GARLIC, FLY AWAY WITH ME... */
L17000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L17500;
}
/* !LOOK? */
rspeak_(48);
/* !DESCRIBE ROOM. */
if (objcts_1.oadv[oindex_1.garli - 1] == play_1.winner) {
rspeak_(49);
}
/* !BAT HOLDS NOSE. */
return ret_val;
L17500:
if (prsvec_1.prsa != vindex_1.walkiw || objcts_1.oadv[oindex_1.garli - 1]
== play_1.winner) {
return ret_val;
}
rspeak_(50);
/* !TIME TO FLY, JACK. */
f = moveto_(bats_1.batdrp[rnd_(9)], play_1.winner);
/* !SELECT RANDOM DEST. */
ret_val = FALSE_;
/* !INDICATE NEW DESC NEEDED. */
return ret_val;
/* R18-- DOME ROOM. STATE DEPENDS ON WHETHER ROPE TIED TO RAILING. */
L18000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L18500;
}
/* !LOOK? */
rspeak_(51);
/* !DESCRIBE. */
if (findex_1.domef) {
rspeak_(52);
}
/* !IF ROPE, DESCRIBE. */
return ret_val;
L18500:
if (prsvec_1.prsa == vindex_1.leapw) {
jigsup_(53);
}
/* !DID HE JUMP??? */
return ret_val;
/* R19-- TORCH ROOM. ALSO DEPENDS ON WHETHER ROPE TIED TO RAILING. */
L19000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(54);
/* !DESCRIBE. */
if (findex_1.domef) {
rspeak_(55);
}
/* !IF ROPE, DESCRIBE. */
return ret_val;
/* R20-- CAROUSEL ROOM. SPIN HIM OR KILL HIM. */
L20000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L20500;
}
/* !LOOK? */
rspeak_(56);
/* !DESCRIBE. */
if (! findex_1.caroff) {
rspeak_(57);
}
/* !IF NOT FLIPPED, SPIN. */
return ret_val;
L20500:
if (prsvec_1.prsa == vindex_1.walkiw && findex_1.carozf) {
jigsup_(58);
}
/* !WALKED IN. */
return ret_val;
/* RAPPL1, PAGE 7 */
/* R21-- LLD ROOM. HANDLE EXORCISE, DESCRIPTIONS. */
L21000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L21500;
}
/* !LOOK? */
rspeak_(59);
/* !DESCRIBE. */
if (! findex_1.lldf) {
rspeak_(60);
}
/* !IF NOT VANISHED, GHOSTS. */
return ret_val;
L21500:
if (prsvec_1.prsa != vindex_1.exorcw) {
return ret_val;
}
/* !EXORCISE? */
if (objcts_1.oadv[oindex_1.bell - 1] == play_1.winner && objcts_1.oadv[
oindex_1.book - 1] == play_1.winner && objcts_1.oadv[
oindex_1.candl - 1] == play_1.winner && (objcts_1.oflag1[
oindex_1.candl - 1] & ONBT) != 0) {
goto L21600;
}
rspeak_(62);
/* !NOT EQUIPPED. */
return ret_val;
L21600:
if (qhere_(oindex_1.ghost, play_1.here)) {
goto L21700;
}
/* !GHOST HERE? */
jigsup_(61);
/* !NOPE, EXORCISE YOU. */
return ret_val;
L21700:
newsta_(oindex_1.ghost, 63, 0, 0, 0);
/* !VANISH GHOST. */
findex_1.lldf = TRUE_;
/* !OPEN GATE. */
return ret_val;
/* R22-- LLD2-ROOM. IS HIS HEAD ON A POLE? */
L22000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(64);
/* !DESCRIBE. */
if (findex_1.onpolf) {
rspeak_(65);
}
/* !ON POLE? */
return ret_val;
/* R23-- DAM ROOM. DESCRIBE RESERVOIR, PANEL. */
L23000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(66);
/* !DESCRIBE. */
i = 67;
if (findex_1.lwtidf) {
i = 68;
}
rspeak_(i);
/* !DESCRIBE RESERVOIR. */
rspeak_(69);
/* !DESCRIBE PANEL. */
if (findex_1.gatef) {
rspeak_(70);
}
/* !BUBBLE IS GLOWING. */
return ret_val;
/* R24-- TREE ROOM */
L24000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(660);
/* !DESCRIBE. */
i = 661;
/* !SET FLAG FOR BELOW. */
i__1 = objcts_1.olnt;
for (j = 1; j <= i__1; ++j) {
/* !DESCRIBE OBJ IN FORE3. */
if (! qhere_(j, rindex_1.fore3) || j == oindex_1.ftree) {
goto L24200;
}
rspeak_(i);
/* !SET STAGE, */
i = 0;
rspsub_(502, objcts_1.odesc2[j - 1]);
/* !DESCRIBE. */
L24200:
;
}
return ret_val;
/* RAPPL1, PAGE 8 */
/* R25-- CYCLOPS-ROOM. DEPENDS ON CYCLOPS STATE, ASLEEP FLAG, MAGIC FLAG.
*/
L25000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(606);
/* !DESCRIBE. */
i = 607;
/* !ASSUME BASIC STATE. */
if (findex_1.rvcyc > 0) {
i = 608;
}
/* !>0? HUNGRY. */
if (findex_1.rvcyc < 0) {
i = 609;
}
/* !<0? THIRSTY. */
if (findex_1.cyclof) {
i = 610;
}
/* !ASLEEP? */
if (findex_1.magicf) {
i = 611;
}
/* !GONE? */
rspeak_(i);
/* !DESCRIBE. */
if (! findex_1.cyclof && findex_1.rvcyc != 0) {
i__1 = abs(findex_1.rvcyc) + 193;
rspeak_(i__1);
}
return ret_val;
/* R26-- BANK BOX ROOM. */
L26000:
if (prsvec_1.prsa != vindex_1.walkiw) {
return ret_val;
}
/* !SURPRISE HIM. */
for (i = 1; i <= 8; i += 2) {
/* !SCOLRM DEPENDS ON */
if (screen_1.fromdr == screen_1.scoldr[i - 1]) {
screen_1.scolrm = screen_1.scoldr[i];
}
/* L26100: */
}
/* !ENTRY DIRECTION. */
return ret_val;
/* R27-- TREASURE ROOM. */
L27000:
if (prsvec_1.prsa != vindex_1.walkiw || ! hack_1.thfact) {
return ret_val;
}
if (objcts_1.oroom[oindex_1.thief - 1] != play_1.here) {
newsta_(oindex_1.thief, 82, play_1.here, 0, 0);
}
hack_1.thfpos = play_1.here;
/* !RESET SEARCH PATTERN. */
objcts_1.oflag2[oindex_1.thief - 1] |= FITEBT;
if (objcts_1.oroom[oindex_1.chali - 1] == play_1.here) {
objcts_1.oflag1[oindex_1.chali - 1] &= ~ TAKEBT;
}
/* VANISH EVERYTHING IN ROOM */
j = 0;
/* !ASSUME NOTHING TO VANISH. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
if (i == oindex_1.chali || i == oindex_1.thief || ! qhere_(i,
play_1.here)) {
goto L27200;
}
j = 83;
/* !FLAG BYEBYE. */
objcts_1.oflag1[i - 1] &= ~ VISIBT;
L27200:
;
}
rspeak_(j);
/* !DESCRIBE. */
return ret_val;
/* R28-- CLIFF FUNCTION. SEE IF CARRYING INFLATED BOAT. */
L28000:
findex_1.deflaf = objcts_1.oadv[oindex_1.rboat - 1] != play_1.winner;
/* !TRUE IF NOT CARRYING. */
return ret_val;
/* RAPPL1, PAGE 9 */
/* R29-- RIVR4 ROOM. PLAY WITH BUOY. */
L29000:
if (! findex_1.buoyf || objcts_1.oadv[oindex_1.buoy - 1] != play_1.winner)
{
return ret_val;
}
rspeak_(84);
/* !GIVE HINT, */
findex_1.buoyf = FALSE_;
/* !THEN DISABLE. */
return ret_val;
/* R30-- OVERFALLS. DOOM. */
L30000:
if (prsvec_1.prsa != vindex_1.lookw) {
jigsup_(85);
}
/* !OVER YOU GO. */
return ret_val;
/* R31-- BEACH ROOM. DIG A HOLE. */
L31000:
if (prsvec_1.prsa != vindex_1.digw || prsvec_1.prso != oindex_1.shove) {
return ret_val;
}
++findex_1.rvsnd;
/* !INCREMENT DIG STATE. */
switch (findex_1.rvsnd) {
case 1: goto L31100;
case 2: goto L31100;
case 3: goto L31100;
case 4: goto L31400;
case 5: goto L31500;
}
/* !PROCESS STATE. */
bug_(2, findex_1.rvsnd);
L31100:
i__1 = findex_1.rvsnd + 85;
rspeak_(i__1);
/* !1-3... DISCOURAGE HIM. */
return ret_val;
L31400:
i = 89;
/* !ASSUME DISCOVERY. */
if ((objcts_1.oflag1[oindex_1.statu - 1] & VISIBT) != 0) {
i = 88;
}
rspeak_(i);
objcts_1.oflag1[oindex_1.statu - 1] |= VISIBT;
return ret_val;
L31500:
findex_1.rvsnd = 0;
/* !5... SAND COLLAPSES */
jigsup_(90);
/* !AND SO DOES HE. */
return ret_val;
/* R32-- TCAVE ROOM. DIG A HOLE IN GUANO. */
L32000:
if (prsvec_1.prsa != vindex_1.digw || prsvec_1.prso != oindex_1.shove) {
return ret_val;
}
i = 91;
/* !ASSUME NO GUANO. */
if (! qhere_(oindex_1.guano, play_1.here)) {
goto L32100;
}
/* !IS IT HERE? */
/* Computing MIN */
i__1 = 4, i__2 = findex_1.rvgua + 1;
findex_1.rvgua = min(i__1,i__2);
/* !YES, SET NEW STATE. */
i = findex_1.rvgua + 91;
/* !GET NASTY REMARK. */
L32100:
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* R33-- FALLS ROOM */
L33000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(96);
/* !DESCRIBE. */
i = 97;
/* !ASSUME NO RAINBOW. */
if (findex_1.rainbf) {
i = 98;
}
/* !GOT ONE? */
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* RAPPL1, PAGE 10 */
/* R34-- LEDGE FUNCTION. LEDGE CAN COLLAPSE. */
L34000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(100);
/* !DESCRIBE. */
i = 102;
/* !ASSUME SAFE ROOM OK. */
if ((rooms_1.rflag[rindex_1.msafe - 1] & RMUNG) != 0) {
i = 101;
}
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* R35-- SAFE ROOM. STATE DEPENDS ON WHETHER SAFE BLOWN. */
L35000:
if (prsvec_1.prsa != vindex_1.lookw) {
return ret_val;
}
/* !LOOK? */
rspeak_(104);
/* !DESCRIBE. */
i = 105;
/* !ASSUME OK. */
if (findex_1.safef) {
i = 106;
}
/* !BLOWN? */
rspeak_(i);
/* !DESCRIBE. */
return ret_val;
/* R36-- MAGNET ROOM. DESCRIBE, CHECK FOR SPINDIZZY DOOM. */
L36000:
if (prsvec_1.prsa != vindex_1.lookw) {
goto L36500;
}
/* !LOOK? */
rspeak_(107);
/* !DESCRIBE. */
return ret_val;
L36500:
if (prsvec_1.prsa != vindex_1.walkiw || ! findex_1.caroff) {
return ret_val;
}
/* !WALKIN ON FLIPPED? */
if (findex_1.carozf) {
goto L36600;
}
/* !ZOOM? */
rspeak_(108);
/* !NO, SPIN HIS COMPASS. */
return ret_val;
L36600:
i = 58;
/* !SPIN HIS INSIDES. */
if (play_1.winner != aindex_1.player) {
i = 99;
}
/* !SPIN ROBOT. */
jigsup_(i);
/* !DEAD. */
return ret_val;
/* R37-- CAGE ROOM. IF SOLVED CAGE, MOVE TO OTHER CAGE ROOM. */
L37000:
if (findex_1.cagesf) {
f = moveto_(rindex_1.cager, play_1.winner);
}
/* !IF SOLVED, MOVE. */
return ret_val;
} /* rappl1_ */

1023
sobjs.c Normal file

File diff suppressed because it is too large Load Diff

231
supp.c Normal file
View File

@ -0,0 +1,231 @@
/* supp.c -- support routines for dungeon */
#include <stdio.h>
#ifdef unix
#include <sys/types.h>
#endif
#ifdef BSD4_2
#include <sys/time.h>
#else /* ! BSD4_2 */
#include <time.h>
#endif /* ! BSD4_2 */
#include "funcs.h"
/* Define these here to avoid using <stdlib.h> */
extern void exit P((int));
extern int rand P((void));
/* We should have a definition for time_t and struct tm by now. Make
* sure we have definitions for the functions we want to call.
* The argument to localtime should be P((const time_t *)), but Ultrix
* 4.0 leaves out the const in their prototype. Damn them.
*/
extern time_t time P((time_t *));
extern struct tm *localtime ();
/* Terminate the game */
void exit_()
{
fprintf(stderr, "The game is over.\n");
exit(0);
}
/* Get time in hours, minutes and seconds */
void itime_(hrptr, minptr, secptr)
integer *hrptr;
integer *minptr;
integer *secptr;
{
time_t timebuf;
struct tm *tmptr;
time(&timebuf);
tmptr = localtime(&timebuf);
*hrptr = tmptr->tm_hour;
*minptr = tmptr->tm_min;
*secptr = tmptr->tm_sec;
}
/* Random number generator */
integer rnd_(maxval)
integer maxval;
{
return rand() % maxval;
}
/* Terminal support routines for dungeon */
/* By Ian Lance Taylor ian@airs.com or uunet!airs!ian */
/* The dungeon game can often output long strings, more than enough
* to overwhelm a typical 24 row terminal (I assume that back when
* dungeon was written people generally used paper terminals (I know
* I did) so this was not a problem). The functions in this file
* provide a very simplistic ``more'' facility. They are necessarily
* somewhat operating system dependent, although I have tried to
* minimize it as much as I could.
*/
/* The following macro definitions may be used to control how these
* functions work:
*
* MORE_NONE Don't use the more facility at all
* MORE_24 Always assume a 24 row terminal
* MORE_TERMCAP Use termcap routines to get rows of terminal
* MORE_TERMINFO Use terminfo routines to get rows of terminal
* MORE_AMOS Use AMOS monitor calls to get rows of terminal
*
* If none of these are defined then this will use termcap routines on
* unix and AMOS routines on AMOS.
*/
#ifndef MORE_NONE
#ifndef MORE_24
#ifndef MORE_TERMCAP
#ifndef MORE_TERMINFO
#ifndef MORE_AMOS
#ifdef __AMOS__
#define MORE_AMOS
#else /* ! __AMOS__ */
#ifdef unix
#define MORE_TERMCAP
#else /* ! unix */
#define MORE_NONE
#endif /* ! unix */
#endif /* ! __AMOS__ */
#endif /* ! MORE_AMOS */
#endif /* ! MORE_TERMINFO */
#endif /* ! MORE_TERMCAP */
#endif /* ! MORE_24 */
#endif /* ! MORE_NONE */
#ifdef MORE_TERMCAP
extern char *getenv P((const char *));
extern void tgetent P((char *, const char *));
extern int tgetnum P((const char *));
#else /* ! MORE_TERMCAP */
#ifdef MORE_TERMINFO
#include <cursesX.h>
#include <term.h>
extern void setupterm P((const char *, int, int));
#else /* ! MORE_TERMINFO */
#ifdef MORE_AMOS
#include <moncal.h>
#include <unistd.h>
#endif /* MORE_AMOS */
#endif /* ! MORE_TERMINFO */
#endif /* ! MORE_TERMCAP */
/* Initialize the more waiting facility (determine how many rows the
* terminal has).
*/
static integer crows;
static integer coutput;
void more_init()
{
#ifdef MORE_NONE
crows = 0;
#else /* ! MORE_NONE */
#ifdef MORE_24
crows = 24;
#else /* ! MORE_24 */
#ifdef MORE_TERMCAP
char buf[2048];
char *term;
term = getenv("TERM");
if (term == NULL)
crows = 0;
else {
tgetent(buf, term);
crows = tgetnum("li");
}
#else /* ! MORE_TERMCAP */
#ifdef MORE_TERMINFO
int i;
setupterm(NULL, 1, &i);
if (i != 1)
crows = 0;
else
crows = lines;
#else /* ! MORE_TERMINFO */
#ifdef MORE_AMOS
trm_char st;
if (isatty(fileno(stdin)) == 0)
crows = 0;
else {
trmchr(&st, 0);
crows = st.row;
}
#else /* ! MORE_AMOS */
This should be impossible
#endif /* ! MORE_AMOS */
#endif /* ! MORE_TERMINFO */
#endif /* ! MORE_TERMCAP */
#endif /* ! MORE_24 */
#endif /* ! MORE_NONE */
}
/* The program wants to output a line to the terminal. If z is not
* NULL it is a simple string which is output here; otherwise it
* needs some sort of formatting, and is output after this function
* returns (if all computers had vprintf I would just it, but they
* probably don't).
*/
void more_output(z)
const char *z;
{
/* pager code remarked out to allow streamed input and output */
/*
if (crows > 0 && coutput > crows - 2) {
printf("Press return to continue: ");
(void) fflush(stdout);
while (getchar() != '\n')
;
coutput = 0;
}
*/
if (z != NULL)
printf("%s\n", z);
coutput++;
}
/* The terminal is waiting for input (clear the number of output lines) */
void more_input()
{
coutput = 0;
}

871
sverbs.c Normal file
View File

@ -0,0 +1,871 @@
/* SVERBS- SIMPLE VERBS PROCESSOR */
/* ALL VERBS IN THIS ROUTINE MUST BE INDEPENDANT */
/* OF OBJECT ACTIONS */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include <stdio.h>
#include "funcs.h"
#include "vars.h"
logical sverbs_(ri)
integer ri;
{
/* Initialized data */
const integer mxnop = 39;
const integer mxjoke = 64;
static const integer jokes[25] = { 4,5,3,304,305,306,307,308,309,310,311,
312,313,5314,5319,324,325,883,884,120,120,0,0,0,0 };
static const integer answer[14] = { 0,1,2,3,4,4,4,4,5,5,5,6,7,7};
static const char * const ansstr[14] =
{ "TEMPLE", "FOREST", "30003", "FLASK", "RUB", "FONDLE",
"CARRES", "TOUCH", "BONES", "BODY", "SKELE", "RUSTYKNIFE",
"NONE", "NOWHER" };
/* System generated locals */
integer i__1, i__2;
logical ret_val;
/* Local variables */
logical f;
const char *z, *z2;
integer i, j;
integer k;
integer l;
char ch[1*6];
integer cp, wp;
char pp1[1*6], pp2[1*6];
integer odi2 = 0, odo2 = 0;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (prsvec_1.prso != 0) {
odo2 = objcts_1.odesc2[prsvec_1.prso - 1];
}
/* !SET UP DESCRIPTORS. */
if (prsvec_1.prsi != 0) {
odi2 = objcts_1.odesc2[prsvec_1.prsi - 1];
}
if (ri == 0) {
bug_(7, ri);
}
/* !ZERO IS VERBOTEN. */
if (ri <= mxnop) {
return ret_val;
}
/* !NOP? */
if (ri <= mxjoke) {
goto L100;
}
/* !JOKE? */
switch (ri - mxjoke) {
case 1: goto L65000;
case 2: goto L66000;
case 3: goto L67000;
case 4: goto L68000;
case 5: goto L69000;
case 6: goto L1000;
case 7: goto L2000;
case 8: goto L3000;
case 9: goto L4000;
case 10: goto L5000;
case 11: goto L6000;
case 12: goto L7000;
case 13: goto L8000;
case 14: goto L9000;
case 15: goto L10000;
case 16: goto L11000;
case 17: goto L12000;
case 18: goto L13000;
case 19: goto L14000;
case 20: goto L15000;
case 21: goto L16000;
case 22: goto L17000;
case 23: goto L18000;
case 24: goto L19000;
case 25: goto L20000;
case 26: goto L21000;
case 27: goto L22000;
case 28: goto L23000;
case 29: goto L24000;
case 30: goto L25000;
case 31: goto L26000;
case 32: goto L27000;
}
bug_(7, ri);
/* ALL VERB PROCESSORS RETURN HERE TO DECLARE FAILURE. */
/* L10: */
ret_val = FALSE_;
/* !LOSE. */
return ret_val;
/* JOKE PROCESSOR. */
/* FIND PROPER ENTRY IN JOKES, USE IT TO SELECT STRING TO PRINT. */
L100:
i = jokes[ri - mxnop - 1];
/* !GET TABLE ENTRY. */
j = i / 1000;
/* !ISOLATE # STRINGS. */
if (j != 0) {
i = i % 1000 + rnd_(j);
}
/* !IF RANDOM, CHOOSE. */
rspeak_(i);
/* !PRINT JOKE. */
return ret_val;
/* SVERBS, PAGE 2A */
/* V65-- ROOM */
L65000:
ret_val = rmdesc_(2);
/* !DESCRIBE ROOM ONLY. */
return ret_val;
/* V66-- OBJECTS */
L66000:
ret_val = rmdesc_(1);
/* !DESCRIBE OBJ ONLY. */
if (! play_1.telflg) {
rspeak_(138);
}
/* !NO OBJECTS. */
return ret_val;
/* V67-- RNAME */
L67000:
i__1 = rooms_1.rdesc2[play_1.here - 1];
rspeak_(i__1);
/* !SHORT ROOM NAME. */
return ret_val;
/* V68-- RESERVED */
L68000:
return ret_val;
/* V69-- RESERVED */
L69000:
return ret_val;
/* SVERBS, PAGE 3 */
/* V70-- BRIEF. SET FLAG. */
L1000:
findex_1.brieff = TRUE_;
/* !BRIEF DESCRIPTIONS. */
findex_1.superf = FALSE_;
rspeak_(326);
return ret_val;
/* V71-- VERBOSE. CLEAR FLAGS. */
L2000:
findex_1.brieff = FALSE_;
/* !LONG DESCRIPTIONS. */
findex_1.superf = FALSE_;
rspeak_(327);
return ret_val;
/* V72-- SUPERBRIEF. SET FLAG. */
L3000:
findex_1.superf = TRUE_;
rspeak_(328);
return ret_val;
/* V73-- STAY (USED IN ENDGAME). */
L4000:
if (play_1.winner != aindex_1.amastr) {
goto L4100;
}
/* !TELL MASTER, STAY. */
rspeak_(781);
/* !HE DOES. */
cevent_1.ctick[cindex_1.cevfol - 1] = 0;
/* !NOT FOLLOWING. */
return ret_val;
L4100:
if (play_1.winner == aindex_1.player) {
rspeak_(664);
}
/* !JOKE. */
return ret_val;
/* V74-- VERSION. PRINT INFO. */
L5000:
more_output(NULL);
printf("V%1d.%1d%c\n", vers_1.vmaj, vers_1.vmin, vers_1.vedit);
play_1.telflg = TRUE_;
return ret_val;
/* V75-- SWIM. ALWAYS A JOKE. */
L6000:
i = 330;
/* !ASSUME WATER. */
if ((rooms_1.rflag[play_1.here - 1] & RWATER + RFILL) ==
0) {
i = rnd_(3) + 331;
}
rspeak_(i);
return ret_val;
/* V76-- GERONIMO. IF IN BARREL, FATAL, ELSE JOKE. */
L7000:
if (play_1.here == rindex_1.mbarr) {
goto L7100;
}
/* !IN BARREL? */
rspeak_(334);
/* !NO, JOKE. */
return ret_val;
L7100:
jigsup_(335);
/* !OVER FALLS. */
return ret_val;
/* V77-- SINBAD ET AL. CHASE CYCLOPS, ELSE JOKE. */
L8000:
if (play_1.here == rindex_1.mcycl && qhere_(oindex_1.cyclo, play_1.here)
) {
goto L8100;
}
rspeak_(336);
/* !NOT HERE, JOKE. */
return ret_val;
L8100:
newsta_(oindex_1.cyclo, 337, 0, 0, 0);
/* !CYCLOPS FLEES. */
findex_1.cyclof = TRUE_;
/* !SET ALL FLAGS. */
findex_1.magicf = TRUE_;
objcts_1.oflag2[oindex_1.cyclo - 1] &= ~ FITEBT;
return ret_val;
/* V78-- WELL. OPEN DOOR, ELSE JOKE. */
L9000:
if (findex_1.riddlf || play_1.here != rindex_1.riddl) {
goto L9100;
}
/* !IN RIDDLE ROOM? */
findex_1.riddlf = TRUE_;
/* !YES, SOLVED IT. */
rspeak_(338);
return ret_val;
L9100:
rspeak_(339);
/* !WELL, WHAT? */
return ret_val;
/* V79-- PRAY. IF IN TEMP2, POOF */
/* ! */
L10000:
if (play_1.here != rindex_1.temp2) {
goto L10050;
}
/* !IN TEMPLE? */
if (moveto_(rindex_1.fore1, play_1.winner)) {
goto L10100;
}
/* !FORE1 STILL THERE? */
L10050:
rspeak_(340);
/* !JOKE. */
return ret_val;
L10100:
f = rmdesc_(3);
/* !MOVED, DESCRIBE. */
return ret_val;
/* V80-- TREASURE. IF IN TEMP1, POOF */
/* ! */
L11000:
if (play_1.here != rindex_1.temp1) {
goto L11050;
}
/* !IN TEMPLE? */
if (moveto_(rindex_1.treas, play_1.winner)) {
goto L10100;
}
/* !TREASURE ROOM THERE? */
L11050:
rspeak_(341);
/* !NOTHING HAPPENS. */
return ret_val;
/* V81-- TEMPLE. IF IN TREAS, POOF */
/* ! */
L12000:
if (play_1.here != rindex_1.treas) {
goto L12050;
}
/* !IN TREASURE? */
if (moveto_(rindex_1.temp1, play_1.winner)) {
goto L10100;
}
/* !TEMP1 STILL THERE? */
L12050:
rspeak_(341);
/* !NOTHING HAPPENS. */
return ret_val;
/* V82-- BLAST. USUALLY A JOKE. */
L13000:
i = 342;
/* !DONT UNDERSTAND. */
if (prsvec_1.prso == oindex_1.safe) {
i = 252;
}
/* !JOKE FOR SAFE. */
rspeak_(i);
return ret_val;
/* V83-- SCORE. PRINT SCORE. */
L14000:
score_(0);
return ret_val;
/* V84-- QUIT. FINISH OUT THE GAME. */
L15000:
score_(1);
/* !TELLL SCORE. */
if (! yesno_(343, 0, 0)) {
return ret_val;
}
/* !ASK FOR Y/N DECISION. */
exit_();
/* !BYE. */
/* SVERBS, PAGE 4 */
/* V85-- FOLLOW (USED IN ENDGAME) */
L16000:
if (play_1.winner != aindex_1.amastr) {
return ret_val;
}
/* !TELL MASTER, FOLLOW. */
rspeak_(782);
cevent_1.ctick[cindex_1.cevfol - 1] = -1;
/* !STARTS FOLLOWING. */
return ret_val;
/* V86-- WALK THROUGH */
L17000:
if (screen_1.scolrm == 0 || prsvec_1.prso != oindex_1.scol && (
prsvec_1.prso != oindex_1.wnort || play_1.here != rindex_1.bkbox))
{
goto L17100;
}
screen_1.scolac = screen_1.scolrm;
/* !WALKED THRU SCOL. */
prsvec_1.prso = 0;
/* !FAKE OUT FROMDR. */
cevent_1.ctick[cindex_1.cevscl - 1] = 6;
/* !START ALARM. */
rspeak_(668);
/* !DISORIENT HIM. */
f = moveto_(screen_1.scolrm, play_1.winner);
/* !INTO ROOM. */
f = rmdesc_(3);
/* !DESCRIBE. */
return ret_val;
L17100:
if (play_1.here != screen_1.scolac) {
goto L17300;
}
/* !ON OTHER SIDE OF SCOL? */
for (i = 1; i <= 12; i += 3) {
/* !WALK THRU PROPER WALL? */
if (screen_1.scolwl[i - 1] == play_1.here && screen_1.scolwl[i] ==
prsvec_1.prso) {
goto L17500;
}
/* L17200: */
}
L17300:
if ((objcts_1.oflag1[prsvec_1.prso - 1] & TAKEBT) != 0) {
goto L17400;
}
i = 669;
/* !NO, JOKE. */
if (prsvec_1.prso == oindex_1.scol) {
i = 670;
}
/* !SPECIAL JOKE FOR SCOL. */
rspsub_(i, odo2);
return ret_val;
L17400:
i = 671;
/* !JOKE. */
if (objcts_1.oroom[prsvec_1.prso - 1] != 0) {
i = rnd_(5) + 552;
}
/* !SPECIAL JOKES IF CARRY. */
rspeak_(i);
return ret_val;
L17500:
prsvec_1.prso = screen_1.scolwl[i + 1];
/* !THRU SCOL WALL... */
for (i = 1; i <= 8; i += 2) {
/* !FIND MATCHING ROOM. */
if (prsvec_1.prso == screen_1.scoldr[i - 1]) {
screen_1.scolrm = screen_1.scoldr[i];
}
/* L17600: */
}
/* !DECLARE NEW SCOLRM. */
cevent_1.ctick[cindex_1.cevscl - 1] = 0;
/* !CANCEL ALARM. */
rspeak_(668);
/* !DISORIENT HIM. */
f = moveto_(rindex_1.bkbox, play_1.winner);
/* !BACK IN BOX ROOM. */
f = rmdesc_(3);
return ret_val;
/* V87-- RING. A JOKE. */
L18000:
i = 359;
/* !CANT RING. */
if (prsvec_1.prso == oindex_1.bell) {
i = 360;
}
/* !DING, DONG. */
rspeak_(i);
/* !JOKE. */
return ret_val;
/* V88-- BRUSH. JOKE WITH OBSCURE TRAP. */
L19000:
if (prsvec_1.prso == oindex_1.teeth) {
goto L19100;
}
/* !BRUSH TEETH? */
rspeak_(362);
/* !NO, JOKE. */
return ret_val;
L19100:
if (prsvec_1.prsi != 0) {
goto L19200;
}
/* !WITH SOMETHING? */
rspeak_(363);
/* !NO, JOKE. */
return ret_val;
L19200:
if (prsvec_1.prsi == oindex_1.putty && objcts_1.oadv[oindex_1.putty - 1]
== play_1.winner) {
goto L19300;
}
rspsub_(364, odi2);
/* !NO, JOKE. */
return ret_val;
L19300:
jigsup_(365);
/* !YES, DEAD */
/* ! */
/* ! */
/* ! */
/* ! */
/* ! */
return ret_val;
/* SVERBS, PAGE 5 */
/* V89-- DIG. UNLESS SHOVEL, A JOKE. */
L20000:
if (prsvec_1.prso == oindex_1.shove) {
return ret_val;
}
/* !SHOVEL? */
i = 392;
/* !ASSUME TOOL. */
if ((objcts_1.oflag1[prsvec_1.prso - 1] & TOOLBT) == 0) {
i = 393;
}
rspsub_(i, odo2);
return ret_val;
/* V90-- TIME. PRINT OUT DURATION OF GAME. */
L21000:
gttime_(&k);
/* !GET PLAY TIME. */
i = k / 60;
j = k % 60;
more_output(NULL);
printf("You have been playing Dungeon for ");
if (i >= 1) {
printf("%d hour", i);
if (i >= 2)
printf("s");
printf(" and ");
}
printf("%d minute", j);
if (j != 1)
printf("s");
printf(".\n");
play_1.telflg = TRUE_;
return ret_val;
/* V91-- LEAP. USUALLY A JOKE, WITH A CATCH. */
L22000:
if (prsvec_1.prso == 0) {
goto L22200;
}
/* !OVER SOMETHING? */
if (qhere_(prsvec_1.prso, play_1.here)) {
goto L22100;
}
/* !HERE? */
rspeak_(447);
/* !NO, JOKE. */
return ret_val;
L22100:
if ((objcts_1.oflag2[prsvec_1.prso - 1] & VILLBT) == 0) {
goto L22300;
}
rspsub_(448, odo2);
/* !CANT JUMP VILLAIN. */
return ret_val;
L22200:
if (! findxt_(xsrch_1.xdown, play_1.here)) {
goto L22300;
}
/* !DOWN EXIT? */
if (curxt_1.xtype == xpars_1.xno || curxt_1.xtype == xpars_1.xcond && !
flags[*xflag - 1]) {
goto L22400;
}
L22300:
i__1 = rnd_(5) + 314;
rspeak_(i__1);
/* !WHEEEE */
/* ! */
return ret_val;
L22400:
i__1 = rnd_(4) + 449;
jigsup_(i__1);
/* !FATAL LEAP. */
return ret_val;
/* SVERBS, PAGE 6 */
/* V92-- LOCK. */
L23000:
if (prsvec_1.prso == oindex_1.grate && play_1.here == rindex_1.mgrat) {
goto L23200;
}
L23100:
rspeak_(464);
/* !NOT LOCK GRATE. */
return ret_val;
L23200:
findex_1.grunlf = FALSE_;
/* !GRATE NOW LOCKED. */
rspeak_(214);
exits_1.travel[rooms_1.rexit[play_1.here - 1]] = 214;
/* !CHANGE EXIT STATUS. */
return ret_val;
/* V93-- UNLOCK */
L24000:
if (prsvec_1.prso != oindex_1.grate || play_1.here != rindex_1.mgrat) {
goto L23100;
}
if (prsvec_1.prsi == oindex_1.keys) {
goto L24200;
}
/* !GOT KEYS? */
rspsub_(465, odi2);
/* !NO, JOKE. */
return ret_val;
L24200:
findex_1.grunlf = TRUE_;
/* !UNLOCK GRATE. */
rspeak_(217);
exits_1.travel[rooms_1.rexit[play_1.here - 1]] = 217;
/* !CHANGE EXIT STATUS. */
return ret_val;
/* V94-- DIAGNOSE. */
L25000:
i = fights_(play_1.winner, 0);
/* !GET FIGHTS STRENGTH. */
j = advs_1.astren[play_1.winner - 1];
/* !GET HEALTH. */
/* Computing MIN */
i__1 = i + j;
k = min(i__1,4);
/* !GET STATE. */
if (! cevent_1.cflag[cindex_1.cevcur - 1]) {
j = 0;
}
/* !IF NO WOUNDS. */
/* Computing MIN */
i__1 = 4, i__2 = abs(j);
l = min(i__1,i__2);
/* !SCALE. */
i__1 = l + 473;
rspeak_(i__1);
/* !DESCRIBE HEALTH. */
i = (-j - 1) * 30 + cevent_1.ctick[cindex_1.cevcur - 1];
/* !COMPUTE WAIT. */
if (j != 0) {
more_output(NULL);
printf("You will be cured after %d moves.\n", i);
}
i__1 = k + 478;
rspeak_(i__1);
/* !HOW MUCH MORE? */
if (state_1.deaths != 0) {
i__1 = state_1.deaths + 482;
rspeak_(i__1);
}
/* !HOW MANY DEATHS? */
return ret_val;
/* SVERBS, PAGE 7 */
/* V95-- INCANT */
L26000:
for (i = 1; i <= 6; ++i) {
/* !SET UP PARSE. */
pp1[i - 1] = ' ';
pp2[i - 1] = ' ';
/* L26100: */
}
wp = 1;
/* !WORD POINTER. */
cp = 1;
/* !CHAR POINTER. */
if (prsvec_1.prscon <= 1) {
goto L26300;
}
for (z = input_1.inbuf + prsvec_1.prscon - 1; *z != '\0'; ++z) {
/* !PARSE INPUT */
if (*z == ',')
goto L26300;
/* !END OF PHRASE? */
if (*z != ' ')
goto L26150;
/* !SPACE? */
if (cp != 1) {
++wp;
}
cp = 1;
goto L26200;
L26150:
if (wp == 1) {
pp1[cp - 1] = *z;
}
/* !STUFF INTO HOLDER. */
if (wp == 2) {
pp2[cp - 1] = *z;
}
/* Computing MIN */
i__2 = cp + 1;
cp = min(i__2,6);
L26200:
;
}
L26300:
prsvec_1.prscon = 1;
/* !KILL REST OF LINE. */
if (pp1[0] != ' ') {
goto L26400;
}
/* !ANY INPUT? */
rspeak_(856);
/* !NO, HO HUM. */
return ret_val;
L26400:
encryp_(pp1, ch);
/* !COMPUTE RESPONSE. */
if (pp2[0] != ' ') {
goto L26600;
}
/* !TWO PHRASES? */
if (findex_1.spellf) {
goto L26550;
}
/* !HE'S TRYING TO LEARN. */
if ((rooms_1.rflag[rindex_1.tstrs - 1] & RSEEN) == 0) {
goto L26575;
}
findex_1.spellf = TRUE_;
/* !TELL HIM. */
play_1.telflg = TRUE_;
more_output(NULL);
printf("A hollow voice replies: \"%.6s %.6s\".\n", pp1, ch);
return ret_val;
L26550:
rspeak_(857);
/* !HE'S GOT ONE ALREADY. */
return ret_val;
L26575:
rspeak_(858);
/* !HE'S NOT IN ENDGAME. */
return ret_val;
L26600:
if ((rooms_1.rflag[rindex_1.tstrs - 1] & RSEEN) != 0) {
goto L26800;
}
for (i = 1; i <= 6; ++i) {
if (pp2[i - 1] != ch[i - 1]) {
goto L26575;
}
/* !WRONG. */
/* L26700: */
}
findex_1.spellf = TRUE_;
/* !IT WORKS. */
rspeak_(859);
cevent_1.ctick[cindex_1.cevste - 1] = 1;
/* !FORCE START. */
return ret_val;
L26800:
rspeak_(855);
/* !TOO LATE. */
return ret_val;
/* SVERBS, PAGE 8 */
/* V96-- ANSWER */
L27000:
if (prsvec_1.prscon > 1 && play_1.here == rindex_1.fdoor &&
findex_1.inqstf) {
goto L27100;
}
rspeak_(799);
/* !NO ONE LISTENS. */
prsvec_1.prscon = 1;
return ret_val;
L27100:
for (j = 1; j <= 14; j ++) {
/* !CHECK ANSWERS. */
if (findex_1.quesno != answer[j - 1])
goto L27300;
/* !ONLY CHECK PROPER ANS. */
z = ansstr[j - 1];
z2 = input_1.inbuf + prsvec_1.prscon - 1;
while (*z != '\0') {
while (*z2 == ' ')
z2++;
/* !STRIP INPUT BLANKS. */
if (*z++ != *z2++)
goto L27300;
}
goto L27500;
/* !RIGHT ANSWER. */
L27300:
;
}
prsvec_1.prscon = 1;
/* !KILL REST OF LINE. */
++findex_1.nqatt;
/* !WRONG, CRETIN. */
if (findex_1.nqatt >= 5) {
goto L27400;
}
/* !TOO MANY WRONG? */
i__1 = findex_1.nqatt + 800;
rspeak_(i__1);
/* !NO, TRY AGAIN. */
return ret_val;
L27400:
rspeak_(826);
/* !ALL OVER. */
cevent_1.cflag[cindex_1.cevinq - 1] = FALSE_;
/* !LOSE. */
return ret_val;
L27500:
prsvec_1.prscon = 1;
/* !KILL REST OF LINE. */
++findex_1.corrct;
/* !GOT IT RIGHT. */
rspeak_(800);
/* !HOORAY. */
if (findex_1.corrct >= 3) {
goto L27600;
}
/* !WON TOTALLY? */
cevent_1.ctick[cindex_1.cevinq - 1] = 2;
/* !NO, START AGAIN. */
findex_1.quesno = (findex_1.quesno + 3) % 8;
findex_1.nqatt = 0;
rspeak_(769);
/* !ASK NEXT QUESTION. */
i__1 = findex_1.quesno + 770;
rspeak_(i__1);
return ret_val;
L27600:
rspeak_(827);
/* !QUIZ OVER, */
cevent_1.cflag[cindex_1.cevinq - 1] = FALSE_;
objcts_1.oflag2[oindex_1.qdoor - 1] |= OPENBT;
return ret_val;
} /* sverbs_ */

417
vars.h Normal file
View File

@ -0,0 +1,417 @@
/* vars.h -- variables for dungeon */
/* These variable definitions are really ugly because they are actually
* translations of FORTRAN common blocks. In the original FORTRAN source
* the common blocks were included many times by each function that
* needed them; I have changed this to define them all in this one file,
* and include this in every source file. It's less modular, and it
* makes everything slower to compile, but it's easier on me.
* A few structures used only by the parsing routines are in parse.h.
*/
#ifndef VARS_H
#define VARS_H
#ifndef EXTERN
#define EXTERN extern
#endif
EXTERN struct {
integer prsa, prsi, prso;
logical prswon;
integer prscon;
} prsvec_;
#define prsvec_1 prsvec_
EXTERN struct {
integer oflag, oact, oslot, oprep, oname;
} orphs_;
#define orphs_1 orphs_
#define orp ((integer *)&orphs_1)
EXTERN struct {
integer lastit;
} last_;
#define last_1 last_
EXTERN struct {
integer winner, here;
logical telflg;
} play_;
#define play_1 play_
EXTERN struct {
integer rlnt, rdesc1[200], rdesc2[200], rexit[200], ractio[200],
rval[200], rflag[200];
} rooms_;
#define rooms_1 rooms_
#define eqr ((integer *)&rooms_1 + 1)
#define rrand ((integer *)&rooms_1 + 601)
/* Room flags */
#define RSEEN (32768)
#define RLIGHT (16384)
#define RLAND (8192)
#define RWATER (4096)
#define RAIR (2048)
#define RSACRD (1024)
#define RFILL (512)
#define RMUNG (256)
#define RBUCK (128)
#define RHOUSE (64)
#define RNWALL (32)
#define REND (16)
EXTERN const struct {
integer whous, lroom, cella, mtrol, maze1, mgrat, maz15, fore1, fore3,
clear, reser, strea, egypt, echor, tshaf, bshaf, mmach, dome,
mtorc, carou, riddl, lld2, temp1, temp2, maint, blroo, treas,
rivr1, rivr2, rivr3, mcycl, rivr4, rivr5, fchmp, falls, mbarr,
mrain, pog, vlbot, vair1, vair2, vair3, vair4, ledg2, ledg3,
ledg4, msafe, cager, caged, twell, bwell, alice, alism, alitr,
mtree, bkent, bkvw, bktwi, bkvau, bkbox, crypt, tstrs, mrant,
mreye, mra, mrb, mrc, mrg, mrd, fdoor, mrae, mrce, mrcw, mrge,
mrgw, mrdw, inmir, scorr, ncorr, parap, cell, pcell, ncell, cpant,
cpout, cpuzz;
} rindex_
#ifdef INIT
= { 2, 8, 9, 10, 11, 25, 30, 31, 33, 36, 40, 42, 44, 49, 61, 76,
77, 79, 80, 83, 91, 94, 96, 97, 100, 102, 103, 107, 108, 109,
101, 112, 113, 114, 120, 119, 121, 122, 126, 127, 128, 129, 130,
131, 132, 133, 135, 140, 141, 142, 143, 144, 145, 146, 147, 148,
151, 153, 154, 155, 157, 158, 159, 160, 161, 162, 163, 164, 165,
166, 167, 171, 172, 173, 174, 176, 177, 179, 182, 183, 184, 185,
186, 188, 189, 190 }
#endif
;
#define rindex_1 rindex_
EXTERN const struct {
integer xmin, xmax, xdown, xup, xnorth, xsouth, xenter, xexit, xeast,
xwest;
} xsrch_
#ifdef INIT
= { 1024, 16384, 10240, 9216, 1024, 5120, 13312, 14336, 3072,
7168 }
#endif
;
#define xsrch_1 xsrch_
EXTERN struct {
integer olnt, odesc1[220], odesc2[220], odesco[220], oactio[220], oflag1[
220], oflag2[220], ofval[220], otval[220], osize[220], ocapac[220]
, oroom[220], oadv[220], ocan[220], oread[220];
} objcts_;
#define objcts_1 objcts_
#define eqo ((integer *)&objcts_1 + 1)
EXTERN struct {
integer r2lnt, oroom2[20], rroom2[20];
} oroom2_;
#define oroom2_1 oroom2_
/* Object flags (oflags) */
#define VISIBT (32768)
#define READBT (16384)
#define TAKEBT (8192)
#define DOORBT (4096)
#define TRANBT (2048)
#define FOODBT (1024)
#define NDSCBT (512)
#define DRNKBT (256)
#define CONTBT (128)
#define LITEBT (64)
#define VICTBT (32)
#define BURNBT (16)
#define FLAMBT (8)
#define TOOLBT (4)
#define TURNBT (2)
#define ONBT (1)
#define FINDBT (32768)
#define SLEPBT (16384)
#define SCRDBT (8192)
#define TIEBT (4096)
#define CLMBBT (2048)
#define ACTRBT (1024)
#define WEAPBT (512)
#define FITEBT (256)
#define VILLBT (128)
#define STAGBT (64)
#define TRYBT (32)
#define NOCHBT (16)
#define OPENBT (8)
#define TCHBT (4)
#define VEHBT (2)
#define SCHBT (1)
EXTERN const struct {
integer garli, food, gunk, coal, machi, diamo, tcase, bottl, water, rope,
knife, sword, lamp, blamp, rug, leave, troll, axe, rknif, keys,
ice, bar, coffi, torch, tbask, fbask, irbox, ghost, trunk, bell,
book, candl, match, tube, putty, wrenc, screw, cyclo, chali,
thief, still, windo, grate, door, hpole, leak, rbutt, raili, pot,
statu, iboat, dboat, pump, rboat, stick, buoy, shove, ballo,
recep, guano, brope, hook1, hook2, safe, sslot, brick, fuse,
gnome, blabe, dball, tomb, lcase, cage, rcage, spher, sqbut,
flask, pool, saffr, bucke, ecake, orice, rdice, blice, robot,
ftree, bills, portr, scol, zgnom, egg, begg, baubl, canar, bcana,
ylwal, rdwal, pindr, rbeam, odoor, qdoor, cdoor, num1, num8,
warni, cslit, gcard, stldr, hands, wall, lungs, sailo, aviat,
teeth, itobj, every, valua, oplay, wnort, gwate, master;
} oindex_
#ifdef INIT
= { 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 23, 30, 26, 33, 34, 35, 36, 39, 42, 45, 46, 47, 48, 51,
54, 55, 56, 57, 58, 59, 61, 62, 63, 65, 66, 71, 78, 79, 75, 85,
86, 87, 88, 89, 90, 92, 94, 96, 98, 99, 97, 101, 102, 103, 105,
107, 109, 110, 111, 112, 113, 119, 123, 124, 125, 126, 127, 132,
133, 134, 137, 138, 139, 140, 141, 142, 145, 148, 149, 151, 152,
154, 155, 156, 157, 158, 159, 161, 164, 171, 172, 173, 175, 178,
185, 186, 187, 188, 189, 200, 198, 201, 196, 202, 197, 192, 194,
195, 193, 205, 209, 215 }
#endif
;
#define oindex_1 oindex_
EXTERN struct {
integer clnt, ctick[25], cactio[25];
logical cflag[25];
} cevent_;
#define cevent_1 cevent_
#define eqc ((integer *)&cevent_1 + 1)
EXTERN const struct {
integer cevcur, cevmnt, cevlnt, cevmat, cevcnd, cevbal, cevbrn, cevfus,
cevled, cevsaf, cevvlg, cevgno, cevbuc, cevsph, cevegh, cevfor,
cevscl, cevzgi, cevzgo, cevste, cevmrs, cevpin, cevinq, cevfol;
} cindex_
#ifdef INIT
= { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24 }
#endif
;
#define cindex_1 cindex_
EXTERN struct {
integer alnt, aroom[4], ascore[4], avehic[4], aobj[4], aactio[4], astren[
4], aflag[4];
} advs_;
#define advs_1 advs_
#define eqa ((integer *)&advs_1 + 1)
EXTERN const struct {
integer astag;
} aflags_
#ifdef INIT
= { 32768 }
#endif
;
#define aflags_1 aflags_
EXTERN const struct {
integer player, arobot, amastr;
} aindex_
#ifdef INIT
= { 1, 2, 3 }
#endif
;
#define aindex_1 aindex_
EXTERN const struct {
integer cintw, deadxw, frstqw, inxw, outxw, walkiw, fightw, foow, meltw,
readw, inflaw, deflaw, alarmw, exorcw, plugw, kickw, wavew,
raisew, lowerw, rubw, pushw, untiew, tiew, tieupw, turnw, breatw,
knockw, lookw, examiw, shakew, movew, trnonw, trnofw, openw,
closew, findw, waitw, spinw, boardw, unboaw, takew, invenw, fillw,
eatw, drinkw, burnw, mungw, killw, attacw, swingw, walkw, tellw,
putw, dropw, givew, pourw, throww, digw, leapw, stayw, follow,
hellow, lookiw, lookuw, pumpw, windw, clmbw, clmbuw, clmbdw,
trntow;
} vindex_
#ifdef INIT
= { 1, 2, 3, 4, 5, 6, 7, 8, 101, 100, 102, 103, 104, 105, 106,
107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
133, 134, 135, 136, 137, 138, 139, 141, 140, 142, 143, 144, 145,
146, 147, 148, 89, 91, 73, 85, 151, 152, 153, 154, 155, 156, 157,
158, 159 }
#endif
;
#define vindex_1 vindex_
EXTERN struct {
logical trollf, cagesf, bucktf, caroff, carozf, lwtidf, domef, glacrf,
echof, riddlf, lldf, cyclof, magicf, litldf, safef, gnomef,
gnodrf, mirrmf, egyptf, onpolf, blabf, brieff, superf, buoyf,
grunlf, gatef, rainbf, cagetf, empthf, deflaf, glacmf, frobzf,
endgmf, badlkf, thfenf, singsf, mrpshf, mropnf, wdopnf, mr1f,
mr2f, inqstf, follwf, spellf, cpoutf, cpushf;
integer btief, binff, rvmnt, rvclr, rvcyc, rvsnd, rvgua, orrug, orcand,
ormtch, orlamp, mdir, mloc, poleuf, quesno, nqatt, corrct, lcell,
pnumb, acell, dcell, cphere;
} findex_;
#define findex_1 findex_
#define flags ((logical *)&findex_1)
#define switch_ ((integer *)&findex_1 + 46)
EXTERN struct {
integer dbgflg, prsflg, gdtflg;
} debug_;
#define debug_1 debug_
EXTERN struct {
integer thfpos;
logical thfflg, thfact, swdact;
integer swdsta;
} hack_;
#define hack_1 hack_
EXTERN struct {
integer vlnt, villns[4], vprob[4], vopps[4], vbest[4], vmelee[4];
} vill_;
#define vill_1 vill_
#define eqv ((integer *)&vill_1 + 1)
EXTERN struct {
integer moves, deaths, rwscor, mxscor, mxload, ltshft, bloc, mungrm, hs,
egscor, egmxsc;
} state_;
#define state_1 state_
EXTERN struct {
integer xtype, xroom1, xstrng, xactio, xobj;
} curxt_;
#define curxt_1 curxt_
#define xflag ((integer *)&curxt_1 + 4)
EXTERN const struct {
integer xrmask, xdmask, xfmask, xfshft, xashft, xelnt[4], xnorm, xno,
xcond, xdoor, xlflag;
} xpars_
#ifdef INIT
= { 255, 31744, 3, 256, 256, { 1, 2, 3, 3 }, 1, 2, 3, 4, 32768 }
#endif
;
#define xpars_1 xpars_
EXTERN struct {
integer mbase, strbit;
} star_;
#define star_1 star_
EXTERN struct {
integer inlnt;
char inbuf[78];
} input_;
#define input_1 input_
EXTERN struct {
integer fromdr, scolrm, scolac;
const integer scoldr[8], scolwl[12];
} screen_
#ifdef INIT
= { 0, 0, 0, { 1024, 153, 5120, 154, 3072, 152, 7168, 151 },
{ 151, 207, 3072, 152, 208, 7168, 153, 206, 5120, 154, 205,
1024 } }
#endif
;
#define screen_1 screen_
EXTERN struct {
integer mlnt, mrloc, rtext[1050];
} rmsg_;
#define rmsg_1 rmsg_
EXTERN const struct {
integer vmaj, vmin, vedit;
} vers_
#ifdef INIT
= { 2, 7, 'A' }
#endif
;
#define vers_1 vers_
EXTERN struct {
integer pltime, shour, smin, ssec;
} time_;
#define time_1 time_
EXTERN const struct {
integer hfactr;
} hyper_
#ifdef INIT
= { 500 }
#endif
;
#define hyper_1 hyper_
EXTERN struct {
integer xlnt, travel[900];
} exits_;
#define exits_1 exits_
EXTERN struct {
const integer cpdr[16], cpwl[8];
integer cpvec[64];
} puzzle_
#ifdef INIT
= { { 1024, -8, 2048, -7, 3072, 1, 4096, 9, 5120, 8, 6144, 7,
7168, -1, 8192, -9 },
{ 205, -8, 206, 8, 207, 1, 208, -1 },
{ 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, -1, 0, 0, -1, 0, 1,
1, -1, 0, 1, 0, -2, 0, 1,
1, 0, 0, 0, 0, 1, 0, 1,
1, -3, 0, 0, -1, -1, 0, 1,
1, 0, 0, -1, 0, 0, 0, 1,
1, 1, 1, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1 } }
#endif
;
#define puzzle_1 puzzle_
EXTERN const struct {
const integer batdrp[9];
} bats_
#ifdef INIT
= { 66, 67, 68, 69, 70, 71, 72, 65, 73 }
#endif
;
#define bats_1 bats_
#endif

1343
verbs.c Normal file

File diff suppressed because it is too large Load Diff

528
villns.c Normal file
View File

@ -0,0 +1,528 @@
/* TROLLP- TROLL FUNCTION */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
logical trollp_(arg)
integer arg;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer i;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (prsvec_1.prsa != vindex_1.fightw) {
goto L1100;
}
/* !FIGHT? */
if (objcts_1.ocan[oindex_1.axe - 1] == oindex_1.troll) {
goto L10;
}
/* !GOT AXE? NOTHING. */
i = 433;
/* !ASSUME CANT GET. */
if (! qhere_(oindex_1.axe, play_1.here)) {
goto L1050;
}
/* !HERE? */
i = 434;
/* !YES, RECOVER. */
newsta_(oindex_1.axe, 0, 0, oindex_1.troll, 0);
L1050:
if (qhere_(oindex_1.troll, play_1.here)) {
rspeak_(i);
}
/* !IF PLAYER HERE. */
return ret_val;
L1100:
if (prsvec_1.prsa != vindex_1.deadxw) {
goto L1200;
}
/* !DEAD? */
findex_1.trollf = TRUE_;
/* !PERMIT EXITS. */
return ret_val;
L1200:
if (prsvec_1.prsa != vindex_1.outxw) {
goto L1300;
}
/* !OUT? */
findex_1.trollf = TRUE_;
/* !PERMIT EXITS. */
objcts_1.oflag1[oindex_1.axe - 1] &= ~ VISIBT;
objcts_1.odesc1[oindex_1.troll - 1] = 435;
/* !TROLL OUT. */
return ret_val;
L1300:
if (prsvec_1.prsa != vindex_1.inxw) {
goto L1400;
}
/* !WAKE UP? */
findex_1.trollf = FALSE_;
/* !FORBID EXITS. */
objcts_1.oflag1[oindex_1.axe - 1] |= VISIBT;
objcts_1.odesc1[oindex_1.troll - 1] = 436;
/* !TROLL IN. */
if (qhere_(oindex_1.troll, play_1.here)) {
rspeak_(437);
}
return ret_val;
L1400:
if (prsvec_1.prsa != vindex_1.frstqw) {
goto L1500;
}
/* !FIRST ENCOUNTER? */
ret_val = prob_(33, 66);
/* !33% TRUE UNLESS BADLK. */
return ret_val;
L1500:
if (prsvec_1.prsa != vindex_1.movew && prsvec_1.prsa != vindex_1.takew &&
prsvec_1.prsa != vindex_1.mungw && prsvec_1.prsa !=
vindex_1.throww && prsvec_1.prsa != vindex_1.givew) {
goto L2000;
}
if (objcts_1.ocapac[oindex_1.troll - 1] >= 0) {
goto L1550;
}
/* !TROLL OUT? */
objcts_1.ocapac[oindex_1.troll - 1] = -objcts_1.ocapac[oindex_1.troll - 1]
;
/* !YES, WAKE HIM. */
objcts_1.oflag1[oindex_1.axe - 1] |= VISIBT;
findex_1.trollf = FALSE_;
objcts_1.odesc1[oindex_1.troll - 1] = 436;
rspeak_(437);
L1550:
if (prsvec_1.prsa != vindex_1.takew && prsvec_1.prsa != vindex_1.movew) {
goto L1600;
}
rspeak_(438);
/* !JOKE. */
return ret_val;
L1600:
if (prsvec_1.prsa != vindex_1.mungw) {
goto L1700;
}
/* !MUNG? */
rspeak_(439);
/* !JOKE. */
return ret_val;
L1700:
if (prsvec_1.prso == 0) {
goto L10;
}
/* !NO OBJECT? */
i = 440;
/* !ASSUME THROW. */
if (prsvec_1.prsa == vindex_1.givew) {
i = 441;
}
/* !GIVE? */
rspsub_(i, objcts_1.odesc2[prsvec_1.prso - 1]);
/* !TROLL TAKES. */
if (prsvec_1.prso == oindex_1.knife) {
goto L1900;
}
/* !OBJ KNIFE? */
newsta_(prsvec_1.prso, 442, 0, 0, 0);
/* !NO, EATS IT. */
return ret_val;
L1900:
rspeak_(443);
/* !KNIFE, THROWS IT BACK */
objcts_1.oflag2[oindex_1.troll - 1] |= FITEBT;
return ret_val;
L2000:
if (! findex_1.trollf || prsvec_1.prsa != vindex_1.hellow) {
goto L10;
}
rspeak_(366);
/* !TROLL OUT. */
return ret_val;
L10:
ret_val = FALSE_;
/* !COULDNT HANDLE IT. */
return ret_val;
} /* trollp_ */
/* CYCLOP- CYCLOPS FUNCTION */
/* DECLARATIONS */
logical cyclop_(arg)
integer arg;
{
/* System generated locals */
integer i__1, i__2;
logical ret_val;
/* Local variables */
integer i;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (! findex_1.cyclof) {
goto L100;
}
/* !ASLEEP? */
if (prsvec_1.prsa != vindex_1.alarmw && prsvec_1.prsa != vindex_1.mungw &&
prsvec_1.prsa != vindex_1.hellow && prsvec_1.prsa !=
vindex_1.burnw && prsvec_1.prsa != vindex_1.killw &&
prsvec_1.prsa != vindex_1.attacw) {
goto L10;
}
findex_1.cyclof = FALSE_;
/* !WAKE CYCLOPS. */
rspeak_(187);
/* !DESCRIBE. */
findex_1.rvcyc = abs(findex_1.rvcyc);
objcts_1.oflag2[oindex_1.cyclo - 1] = (objcts_1.oflag2[oindex_1.cyclo - 1]
| FITEBT) & ~ SLEPBT;
return ret_val;
L100:
if (prsvec_1.prsa == vindex_1.fightw || prsvec_1.prsa == vindex_1.frstqw)
{
goto L10;
}
if (abs(findex_1.rvcyc) <= 5) {
goto L200;
}
/* !ANNOYED TOO MUCH? */
findex_1.rvcyc = 0;
/* !RESTART COUNT. */
jigsup_(188);
/* !YES, EATS PLAYER. */
return ret_val;
L200:
if (prsvec_1.prsa != vindex_1.givew) {
goto L500;
}
/* !GIVE? */
if (prsvec_1.prso != oindex_1.food || findex_1.rvcyc < 0) {
goto L300;
}
/* !FOOD WHEN HUNGRY? */
newsta_(oindex_1.food, 189, 0, 0, 0);
/* !EATS PEPPERS. */
/* Computing MIN */
i__1 = -1, i__2 = -findex_1.rvcyc;
findex_1.rvcyc = min(i__1,i__2);
/* !GETS THIRSTY. */
return ret_val;
L300:
if (prsvec_1.prso != oindex_1.water) {
goto L400;
}
/* !DRINK WHEN THIRSTY? */
if (findex_1.rvcyc >= 0) {
goto L350;
}
newsta_(prsvec_1.prso, 190, 0, 0, 0);
/* !DRINKS AND */
findex_1.cyclof = TRUE_;
/* !FALLS ASLEEP. */
objcts_1.oflag2[oindex_1.cyclo - 1] = (objcts_1.oflag2[oindex_1.cyclo - 1]
| SLEPBT) & ~ FITEBT;
return ret_val;
L350:
rspeak_(191);
/* !NOT THIRSTY. */
L10:
ret_val = FALSE_;
/* !FAILS. */
return ret_val;
L400:
i = 192;
/* !ASSUME INEDIBLE. */
if (prsvec_1.prso == oindex_1.garli) {
i = 193;
}
/* !GARLIC IS JOKE. */
L450:
rspeak_(i);
/* !DISDAIN IT. */
if (findex_1.rvcyc < 0) {
--findex_1.rvcyc;
}
if (findex_1.rvcyc >= 0) {
++findex_1.rvcyc;
}
if (! findex_1.cyclof) {
i__1 = abs(findex_1.rvcyc) + 193;
rspeak_(i__1);
}
return ret_val;
L500:
i = 0;
/* !ASSUME NOT HANDLED. */
if (prsvec_1.prsa == vindex_1.hellow) {
goto L450;
}
/* !HELLO IS NO GO. */
if (prsvec_1.prsa == vindex_1.throww || prsvec_1.prsa == vindex_1.mungw) {
i = rnd_(2) + 200;
}
if (prsvec_1.prsa == vindex_1.takew) {
i = 202;
}
if (prsvec_1.prsa == vindex_1.tiew) {
i = 203;
}
if (i <= 0) {
goto L10;
} else {
goto L450;
}
/* !SEE IF HANDLED. */
} /* cyclop_ */
/* THIEFP- THIEF FUNCTION */
/* DECLARATIONS */
logical thiefp_(arg)
integer arg;
{
/* System generated locals */
integer i__1;
logical ret_val;
/* Local variables */
integer i, j;
ret_val = TRUE_;
/* !ASSUME WINS. */
if (prsvec_1.prsa != vindex_1.fightw) {
goto L100;
}
/* !FIGHT? */
if (objcts_1.ocan[oindex_1.still - 1] == oindex_1.thief) {
goto L10;
}
/* !GOT STILLETTO? F. */
if (qhere_(oindex_1.still, hack_1.thfpos)) {
goto L50;
}
/* !CAN HE RECOVER IT? */
newsta_(oindex_1.thief, 0, 0, 0, 0);
/* !NO, VANISH. */
if (qhere_(oindex_1.thief, play_1.here)) {
rspeak_(498);
}
/* !IF HERO, TELL. */
return ret_val;
L50:
newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
/* !YES, RECOVER. */
if (qhere_(oindex_1.thief, play_1.here)) {
rspeak_(499);
}
/* !IF HERO, TELL. */
return ret_val;
L100:
if (prsvec_1.prsa != vindex_1.deadxw) {
goto L200;
}
/* !DEAD? */
hack_1.thfact = FALSE_;
/* !DISABLE DEMON. */
objcts_1.oflag1[oindex_1.chali - 1] |= TAKEBT;
j = 0;
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !CARRYING ANYTHING? */
/* L125: */
if (objcts_1.oadv[i - 1] == -oindex_1.thief) {
j = 500;
}
}
rspeak_(j);
/* !TELL IF BOOTY REAPPEARS. */
j = 501;
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
/* !LOOP. */
if (i == oindex_1.chali || i == oindex_1.thief || play_1.here !=
rindex_1.treas || ! qhere_(i, play_1.here)) {
goto L135;
}
objcts_1.oflag1[i - 1] |= VISIBT;
rspsub_(j, objcts_1.odesc2[i - 1]);
/* !DESCRIBE. */
j = 502;
goto L150;
L135:
if (objcts_1.oadv[i - 1] == -oindex_1.thief) {
newsta_(i, 0, play_1.here, 0, 0);
}
L150:
;
}
return ret_val;
L200:
if (prsvec_1.prsa != vindex_1.frstqw) {
goto L250;
}
/* !FIRST ENCOUNTER? */
ret_val = prob_(20, 75);
return ret_val;
L250:
if (prsvec_1.prsa != vindex_1.hellow || objcts_1.odesc1[oindex_1.thief -
1] != 504) {
goto L300;
}
rspeak_(626);
return ret_val;
L300:
if (prsvec_1.prsa != vindex_1.outxw) {
goto L400;
}
/* !OUT? */
hack_1.thfact = FALSE_;
/* !DISABLE DEMON. */
objcts_1.odesc1[oindex_1.thief - 1] = 504;
/* !CHANGE DESCRIPTION. */
objcts_1.oflag1[oindex_1.still - 1] &= ~ VISIBT;
objcts_1.oflag1[oindex_1.chali - 1] |= TAKEBT;
return ret_val;
L400:
if (prsvec_1.prsa != vindex_1.inxw) {
goto L500;
}
/* !IN? */
if (qhere_(oindex_1.thief, play_1.here)) {
rspeak_(505);
}
/* !CAN HERO SEE? */
hack_1.thfact = TRUE_;
/* !ENABLE DEMON. */
objcts_1.odesc1[oindex_1.thief - 1] = 503;
/* !CHANGE DESCRIPTION. */
objcts_1.oflag1[oindex_1.still - 1] |= VISIBT;
if (play_1.here == rindex_1.treas && qhere_(oindex_1.chali, play_1.here)
) {
objcts_1.oflag1[oindex_1.chali - 1] &= ~ TAKEBT;
}
return ret_val;
L500:
if (prsvec_1.prsa != vindex_1.takew) {
goto L600;
}
/* !TAKE? */
rspeak_(506);
/* !JOKE. */
return ret_val;
L600:
if (prsvec_1.prsa != vindex_1.throww || prsvec_1.prso != oindex_1.knife ||
(objcts_1.oflag2[oindex_1.thief - 1] & FITEBT) != 0) {
goto L700;
}
if (prob_(10, 10)) {
goto L650;
}
/* !THREW KNIFE, 10%? */
rspeak_(507);
/* !NO, JUST MAKES */
objcts_1.oflag2[oindex_1.thief - 1] |= FITEBT;
return ret_val;
L650:
j = 508;
/* !THIEF DROPS STUFF. */
i__1 = objcts_1.olnt;
for (i = 1; i <= i__1; ++i) {
if (objcts_1.oadv[i - 1] != -oindex_1.thief) {
goto L675;
}
/* !THIEF CARRYING? */
j = 509;
newsta_(i, 0, play_1.here, 0, 0);
L675:
;
}
newsta_(oindex_1.thief, j, 0, 0, 0);
/* !THIEF VANISHES. */
return ret_val;
L700:
if (prsvec_1.prsa != vindex_1.throww && prsvec_1.prsa != vindex_1.givew ||
prsvec_1.prso == 0 || prsvec_1.prso == oindex_1.thief) {
goto L10;
}
if (objcts_1.ocapac[oindex_1.thief - 1] >= 0) {
goto L750;
}
/* !WAKE HIM UP. */
objcts_1.ocapac[oindex_1.thief - 1] = -objcts_1.ocapac[oindex_1.thief - 1]
;
hack_1.thfact = TRUE_;
objcts_1.oflag1[oindex_1.still - 1] |= VISIBT;
objcts_1.odesc1[oindex_1.thief - 1] = 503;
rspeak_(510);
L750:
if (prsvec_1.prso != oindex_1.brick || objcts_1.ocan[oindex_1.fuse - 1] !=
oindex_1.brick || cevent_1.ctick[cindex_1.cevfus - 1] == 0) {
goto L800;
}
rspeak_(511);
/* !THIEF REFUSES BOMB. */
return ret_val;
L800:
i__1 = -oindex_1.thief;
newsta_(prsvec_1.prso, 0, 0, 0, i__1);
/* !THIEF TAKES GIFT. */
if (objcts_1.otval[prsvec_1.prso - 1] > 0) {
goto L900;
}
/* !A TREASURE? */
rspsub_(512, objcts_1.odesc2[prsvec_1.prso - 1]);
return ret_val;
L900:
rspsub_(627, objcts_1.odesc2[prsvec_1.prso - 1]);
/* !THIEF ENGROSSED. */
findex_1.thfenf = TRUE_;
return ret_val;
L10:
ret_val = FALSE_;
return ret_val;
} /* thiefp_ */