billr@saab.CNA.TEK.COM (Bill Randle) (05/15/91)
Submitted-by: ian@airs.COM Posting-number: Volume 12, Issue 76 Archive-name: cdungeon/Part09 Environment: Unix, MS-DOS #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 9 (of 12)." # Contents: demons.c dso2.c dverb2.c sverbs.c # Wrapped by billr@saab on Tue May 14 16:27:42 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'demons.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'demons.c'\" else echo shar: Extracting \"'demons.c'\" \(12498 characters\) sed "s/^X//" >'demons.c' <<'END_OF_FILE' X/* FIGHTD- INTERMOVE FIGHT DEMON */ X X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/ X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */ X/* WRITTEN BY R. M. SUPNIK */ X X#include "funcs.h" X#include "vars.h" X Xstatic logical infest_ P((integer)); X Xvoid fightd_() X{ X /* Initialized data */ X X const integer rout = 1; X X /* System generated locals */ X integer i__1, i__2; X X /* Local variables */ X logical f; X integer i, j, ra; X integer obj; X integer res; X integer out; X X i__1 = vill_1.vlnt; X for (i = 1; i <= i__1; ++i) { X/* !LOOP THRU VILLAINS. */ X vill_1.vopps[i - 1] = 0; X/* !CLEAR OPPONENT SLOT. */ X obj = vill_1.villns[i - 1]; X/* !GET OBJECT NO. */ X ra = objcts_1.oactio[obj - 1]; X/* !GET HIS ACTION. */ X if (play_1.here != objcts_1.oroom[obj - 1]) { X goto L2200; X } X/* !ADVENTURER STILL HERE? */ X if (obj == oindex_1.thief && findex_1.thfenf) { X goto L2400; X } X/* !THIEF ENGROSSED? */ X if (objcts_1.ocapac[obj - 1] >= 0) { X goto L2050; X } X/* !YES, VILL AWAKE? */ X if (vill_1.vprob[i - 1] == 0 || ! prob_(vill_1.vprob[i - 1], X vill_1.vprob[i - 1])) { X goto L2025; X } X objcts_1.ocapac[obj - 1] = (i__2 = objcts_1.ocapac[obj - 1], abs(i__2) X ); X vill_1.vprob[i - 1] = 0; X if (ra == 0) { X goto L2400; X } X/* !ANYTHING TO DO? */ X prsvec_1.prsa = vindex_1.inxw; X/* !YES, WAKE HIM UP. */ X f = oappli_(ra, 0); X goto L2400; X/* !NOTHING ELSE HAPPENS. */ X XL2025: X vill_1.vprob[i - 1] += 10; X/* !INCREASE WAKEUP PROB. */ X goto L2400; X/* !NOTHING ELSE. */ X XL2050: X if ((objcts_1.oflag2[obj - 1] & FITEBT) == 0) { X goto L2100; X } X vill_1.vopps[i - 1] = obj; X/* !FIGHTING, SET UP OPP. */ X goto L2400; X XL2100: X if (ra == 0) { X goto L2400; X } X/* !NOT FIGHTING, */ X prsvec_1.prsa = vindex_1.frstqw; X/* !SET UP PROBABILITY */ X if (! oappli_(ra, 0)) { X goto L2400; X } X/* !OF FIGHTING. */ X objcts_1.oflag2[obj - 1] |= FITEBT; X vill_1.vopps[i - 1] = obj; X/* !SET UP OPP. */ X goto L2400; X XL2200: X if ((objcts_1.oflag2[obj - 1] & FITEBT) == 0 || ra == 0) { X goto L2300; X } X prsvec_1.prsa = vindex_1.fightw; X/* !HAVE A FIGHT. */ X f = oappli_(ra, 0); XL2300: X if (obj == oindex_1.thief) { X findex_1.thfenf = FALSE_; X } X/* !TURN OFF ENGROSSED. */ X advs_1.aflag[aindex_1.player - 1] &= ~ aflags_1.astag; X objcts_1.oflag2[obj - 1] &= ~ (STAGBT + FITEBT); X if (objcts_1.ocapac[obj - 1] >= 0 || ra == 0) { X goto L2400; X } X prsvec_1.prsa = vindex_1.inxw; X/* !WAKE HIM UP. */ X f = oappli_(ra, 0); X objcts_1.ocapac[obj - 1] = (i__2 = objcts_1.ocapac[obj - 1], abs(i__2) X ); XL2400: X ; X } X/* FIGHTD, PAGE 3 */ X X/* NOW DO ACTUAL COUNTERBLOWS. */ X X out = 0; X/* !ASSUME HERO OK. */ XL2600: X i__1 = vill_1.vlnt; X for (i = 1; i <= i__1; ++i) { X/* !LOOP THRU OPPS. */ X j = vill_1.vopps[i - 1]; X if (j == 0) { X goto L2700; X } X/* !SLOT EMPTY? */ X prsvec_1.prscon = 1; X/* !STOP CMD STREAM. */ X ra = objcts_1.oactio[j - 1]; X if (ra == 0) { X goto L2650; X } X/* !VILLAIN ACTION? */ X prsvec_1.prsa = vindex_1.fightw; X/* !SEE IF */ X if (oappli_(ra, 0)) { X goto L2700; X } X/* !SPECIAL ACTION. */ XL2650: X res = blow_(aindex_1.player, j, vill_1.vmelee[i - 1], 0, out); X X/* !STRIKE BLOW. */ X if (res < 0) { X return; X } X/* !IF HERO DEAD, EXIT. */ X if (res == rout) { X out = rnd_(3) + 2; X } X/* !IF HERO OUT, SET FLG. */ XL2700: X ; X } X --out; X/* !DECREMENT OUT COUNT. */ X if (out > 0) { X goto L2600; X } X/* !IF STILL OUT, GO AGAIN. */ X return; X X} /* fightd_ */ X X/* BLOW- STRIKE BLOW */ X X/* DECLARATIONS */ X Xinteger blow_(h, v, rmk, hflg, out) Xinteger h; Xinteger v; Xinteger rmk; Xlogical hflg; Xinteger out; X{ X /* Initialized data */ X X const integer rmiss = 0; X const integer rout = 1; X const integer rkill = 2; X const integer rstag = 5; X const integer rlose = 6; X const integer rhes = 7; X const integer rsit = 8; X static const integer def1r[3] = { 1,2,3 }; X static const integer def2r[4] = { 13,23,24,25 }; X static const integer def3r[5] = { 35,36,46,47,57 }; X static const integer rvectr[66] = { 0,0,0,0,5,5,1,1,2,2,2,2,0,0,0,0,0,5, X 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, X 3,3,3,4,4,4,0,5,5,3,3,3,3,4,4,4 }; X static const integer rstate[45] = { 5000,3005,3008,4011,3015,3018,1021, X 0,0,5022,3027,3030,4033,3037,3040,1043,0,0,4044,2048,4050,4054, X 5058,4063,4067,3071,1074,4075,1079,4080,4084,4088,4092,4096,4100, X 1104,4105,2109,4111,4115,4119,4123,4127,3131,3134 }; X X /* System generated locals */ X integer ret_val, i__1, i__2; X X /* Local variables */ X logical f; X integer i, j, oa, ra, od, mi, dv, def; X integer tbl; X integer att, res; X integer dweap; X integer pblose; X X ra = objcts_1.oactio[v - 1]; X/* !GET VILLAIN ACTION, */ X dv = objcts_1.odesc2[v - 1]; X/* !DESCRIPTION. */ X ret_val = rmiss; X/* !ASSUME NO RESULT. */ X if (! (hflg)) { X goto L1000; X } X/* !HERO STRIKING BLOW? */ X X/* HERO IS ATTACKER, VILLAIN IS DEFENDER. */ X X pblose = 10; X/* !BAD LK PROB. */ X objcts_1.oflag2[v - 1] |= FITEBT; X if ((advs_1.aflag[h - 1] & aflags_1.astag) == 0) { X goto L100; X } X rspeak_(591); X/* !YES, CANT FIGHT. */ X advs_1.aflag[h - 1] &= ~ aflags_1.astag; X return ret_val; X XL100: X att = fights_(h, 1); X/* !GET HIS STRENGTH. */ X oa = att; X def = vilstr_(v); X/* !GET VILL STRENGTH. */ X od = def; X dweap = 0; X/* !ASSUME NO WEAPON. */ X i__1 = objcts_1.olnt; X for (i = 1; i <= i__1; ++i) { X/* !SEARCH VILLAIN. */ X if (objcts_1.ocan[i - 1] == v && (objcts_1.oflag2[i - 1] & X WEAPBT) != 0) { X dweap = i; X } X/* L200: */ X } X if (v == advs_1.aobj[aindex_1.player - 1]) { X goto L300; X } X/* !KILLING SELF? */ X if (def != 0) { X goto L2000; X } X/* !DEFENDER ALIVE? */ X rspsub_(592, dv); X/* !VILLAIN DEAD. */ X return ret_val; X XL300: X jigsup_(593); X/* !KILLING SELF. */ X return ret_val; X X/* VILLAIN IS ATTACKER, HERO IS DEFENDER. */ X XL1000: X pblose = 50; X/* !BAD LK PROB. */ X advs_1.aflag[h - 1] &= ~ aflags_1.astag; X if ((objcts_1.oflag2[v - 1] & STAGBT) == 0) { X goto L1200; X } X objcts_1.oflag2[v - 1] &= ~ STAGBT; X rspsub_(594, dv); X/* !DESCRIBE. */ X return ret_val; X XL1200: X att = vilstr_(v); X/* !SET UP ATT, DEF. */ X oa = att; X def = fights_(h, 1); X if (def <= 0) { X return ret_val; X } X/* !DONT ALLOW DEAD DEF. */ X od = fights_(h, 0); X dweap = (i__1 = fwim_(0, WEAPBT, 0, 0, h, 1), X abs(i__1)); X/* !FIND A WEAPON. */ X/* BLOW, PAGE 4 */ X X/* PARTIES ARE NOW EQUIPPED. DEF CANNOT BE ZERO. */ X/* ATT MUST BE > 0. */ X XL2000: X if (def > 0) { X goto L2100; X } X/* !DEF ALIVE? */ X res = rkill; X if (hflg) { X rspsub_(595, dv); X } X/* !DEADER. */ X goto L3000; X XL2100: X if ((i__1 = def - 2) < 0) { X goto L2200; X } else if (i__1 == 0) { X goto L2300; X } else { X goto L2400; X } X/* !DEF <2,=2,>2 */ XL2200: X att = min(att,3); X/* !SCALE ATT. */ X tbl = def1r[att - 1]; X/* !CHOOSE TABLE. */ X goto L2500; X XL2300: X att = min(att,4); X/* !SCALE ATT. */ X tbl = def2r[att - 1]; X/* !CHOOSE TABLE. */ X goto L2500; X XL2400: X att -= def; X/* !SCALE ATT. */ X/* Computing MIN */ X i__1 = 2, i__2 = max(-2,att); X att = min(i__1,i__2) + 3; X tbl = def3r[att - 1]; X XL2500: X res = rvectr[tbl + rnd_(10) - 1]; X/* !GET RESULT. */ X if (out == 0) { X goto L2600; X } X/* !WAS HE OUT? */ X if (res == rstag) { X goto L2550; X } X/* !YES, STAG--> HES. */ X res = rsit; X/* !OTHERWISE, SITTING. */ X goto L2600; XL2550: X res = rhes; XL2600: X if (res == rstag && dweap != 0 && prob_(25, pblose)) { X res = rlose; X } X X mi = rstate[(rmk - 1) * 9 + res]; X/* !CHOOSE TABLE ENTRY. */ X if (mi == 0) { X goto L3000; X } X i__1 = mi / 1000; X i = mi % 1000 + rnd_(i__1) + star_1.mbase + 1; X j = dv; X if (! (hflg) && dweap != 0) { X j = objcts_1.odesc2[dweap - 1]; X } X rspsub_(i, j); X/* !PRESENT RESULT. */ X/* BLOW, PAGE 5 */ X X/* NOW APPLY RESULT */ X XL3000: X switch (res + 1) { X case 1: goto L4000; X case 2: goto L3100; X case 3: goto L3200; X case 4: goto L3300; X case 5: goto L3400; X case 6: goto L3500; X case 7: goto L3600; X case 8: goto L4000; X case 9: goto L3200; X } X XL3100: X if (hflg) { X def = -def; X } X/* !UNCONSCIOUS. */ X goto L4000; X XL3200: X def = 0; X/* !KILLED OR SITTING DUCK. */ X goto L4000; X XL3300: X/* Computing MAX */ X i__1 = 0, i__2 = def - 1; X def = max(i__1,i__2); X/* !LIGHT WOUND. */ X goto L4000; X XL3400: X/* Computing MAX */ X i__1 = 0, i__2 = def - 2; X def = max(i__1,i__2); X/* !SERIOUS WOUND. */ X goto L4000; X XL3500: X if (hflg) { X goto L3550; X } X/* !STAGGERED. */ X advs_1.aflag[h - 1] |= aflags_1.astag; X goto L4000; X XL3550: X objcts_1.oflag2[v - 1] |= STAGBT; X goto L4000; X XL3600: X newsta_(dweap, 0, play_1.here, 0, 0); X/* !LOSE WEAPON. */ X dweap = 0; X if (hflg) { X goto L4000; X } X/* !IF HERO, DONE. */ X dweap = (i__1 = fwim_(0, WEAPBT, 0, 0, h, 1), X abs(i__1)); X/* !GET NEW. */ X if (dweap != 0) { X rspsub_(605, objcts_1.odesc2[dweap - 1]); X } X/* BLOW, PAGE 6 */ X XL4000: X ret_val = res; X/* !RETURN RESULT. */ X if (! (hflg)) { X goto L4500; X } X/* !HERO? */ X objcts_1.ocapac[v - 1] = def; X/* !STORE NEW CAPACITY. */ X if (def != 0) { X goto L4100; X } X/* !DEAD? */ X objcts_1.oflag2[v - 1] &= ~ FITEBT; X rspsub_(572, dv); X/* !HE DIES. */ X newsta_(v, 0, 0, 0, 0); X/* !MAKE HIM DISAPPEAR. */ X if (ra == 0) { X return ret_val; X } X/* !IF NX TO DO, EXIT. */ X prsvec_1.prsa = vindex_1.deadxw; X/* !LET HIM KNOW. */ X f = oappli_(ra, 0); X return ret_val; X XL4100: X if (res != rout || ra == 0) { X return ret_val; X } X prsvec_1.prsa = vindex_1.outxw; X/* !LET HIM BE OUT. */ X f = oappli_(ra, 0); X return ret_val; X XL4500: X advs_1.astren[h - 1] = -10000; X/* !ASSUME DEAD. */ X if (def != 0) { X advs_1.astren[h - 1] = def - od; X } X if (def >= od) { X goto L4600; X } X cevent_1.ctick[cindex_1.cevcur - 1] = 30; X cevent_1.cflag[cindex_1.cevcur - 1] = TRUE_; XL4600: X if (fights_(h, 1) > 0) { X return ret_val; X } X advs_1.astren[h - 1] = 1 - fights_(h, 0); X/* !HE'S DEAD. */ X jigsup_(596); X ret_val = -1; X return ret_val; X X} /* blow_ */ X X/* SWORDD- SWORD INTERMOVE DEMON */ X X/* DECLARATIONS */ X Xvoid swordd_() X{ X /* System generated locals */ X integer i__1, i__2; X X /* Local variables */ X integer i, ng; X X if (objcts_1.oadv[oindex_1.sword - 1] != aindex_1.player) { X goto L500; X } X/* !HOLDING SWORD? */ X ng = 2; X/* !ASSUME VILL CLOSE. */ X if (infest_(play_1.here)) { X goto L300; X } X/* !VILL HERE? */ X ng = 1; X i__1 = xsrch_1.xmax; X i__2 = xsrch_1.xmin; X for (i = xsrch_1.xmin; i__2 < 0 ? i >= i__1 : i <= i__1; i += i__2) { X/* !NO, SEARCH ROOMS. */ X if (! findxt_(i, play_1.here)) { X goto L200; X } X/* !ROOM THAT WAY? */ X switch (curxt_1.xtype) { X case 1: goto L50; X case 2: goto L200; X case 3: goto L50; X case 4: goto L50; X } X/* !SEE IF ROOM AT ALL. */ XL50: X if (infest_(curxt_1.xroom1)) { X goto L300; X } X/* !CHECK ROOM. */ XL200: X ; X } X ng = 0; X/* !NO GLOW. */ X XL300: X if (ng == hack_1.swdsta) { X return; X } X/* !ANY STATE CHANGE? */ X i__2 = ng + 495; X rspeak_(i__2); X/* !YES, TELL NEW STATE. */ X hack_1.swdsta = ng; X return; X XL500: X hack_1.swdact = FALSE_; X/* !DROPPED SWORD, */ X return; X/* !DISABLE DEMON. */ X} /* swordd_ */ X X/* INFEST- SUBROUTINE TO TEST FOR INFESTED ROOM */ X X/* DECLARATIONS */ Xstatic logical infest_(r) Xinteger r; X{ X /* System generated locals */ X logical ret_val; X X if (! findex_1.endgmf) { X ret_val = objcts_1.oroom[oindex_1.cyclo - 1] == r || objcts_1.oroom[ X oindex_1.troll - 1] == r || objcts_1.oroom[oindex_1.thief - X 1] == r && hack_1.thfact; X } X else { X ret_val = r == rindex_1.mrg || r == rindex_1.mrge || r == X rindex_1.mrgw || r == rindex_1.inmir && findex_1.mloc == X rindex_1.mrg; X } X return ret_val; X} /* infest_ */ END_OF_FILE if test 12498 -ne `wc -c <'demons.c'`; then echo shar: \"'demons.c'\" unpacked with wrong size! fi # end of 'demons.c' fi if test -f 'dso2.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'dso2.c'\" else echo shar: Extracting \"'dso2.c'\" \(3829 characters\) sed "s/^X//" >'dso2.c' <<'END_OF_FILE' X/* MOVETO- MOVE PLAYER TO NEW ROOM */ X X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/ X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */ X/* WRITTEN BY R. M. SUPNIK */ X X#include <stdio.h> X#include "funcs.h" X#include "vars.h" X Xlogical moveto_(nr, who) Xinteger nr; Xinteger who; X{ X /* System generated locals */ X logical ret_val; X X /* Local variables */ X integer j; X logical lhr; X logical lnr, nlv; X integer bits; X X ret_val = FALSE_; X/* !ASSUME FAILS. */ X lhr = (rooms_1.rflag[play_1.here - 1] & RLAND) != 0; X lnr = (rooms_1.rflag[nr - 1] & RLAND) != 0; X j = advs_1.avehic[who - 1]; X/* !HIS VEHICLE */ X X if (j != 0) { X goto L100; X } X/* !IN VEHICLE? */ X if (lnr) { X goto L500; X } X/* !NO, GOING TO LAND? */ X rspeak_(427); X/* !CAN'T GO WITHOUT VEHICLE. */ X return ret_val; X XL100: X bits = 0; X/* !ASSUME NOWHERE. */ X if (j == oindex_1.rboat) { X bits = RWATER; X } X/* !IN BOAT? */ X if (j == oindex_1.ballo) { X bits = RAIR; X } X/* !IN BALLOON? */ X if (j == oindex_1.bucke) { X bits = RBUCK; X } X/* !IN BUCKET? */ X nlv = (rooms_1.rflag[nr - 1] & bits) == 0; X if (! lnr && nlv || lnr && lhr && nlv && bits != RLAND) { X goto L800; X } X XL500: X ret_val = TRUE_; X/* !MOVE SHOULD SUCCEED. */ X if ((rooms_1.rflag[nr - 1] & RMUNG) == 0) { X goto L600; X } X rspeak_(rrand[nr - 1]); X/* !YES, TELL HOW. */ X return ret_val; X XL600: X if (who != aindex_1.player) { X newsta_(advs_1.aobj[who - 1], 0, nr, 0, 0); X } X if (j != 0) { X newsta_(j, 0, nr, 0, 0); X } X play_1.here = nr; X advs_1.aroom[who - 1] = play_1.here; X scrupd_(rooms_1.rval[nr - 1]); X/* !SCORE ROOM */ X rooms_1.rval[nr - 1] = 0; X return ret_val; X XL800: X rspsub_(428, objcts_1.odesc2[j - 1]); X/* !WRONG VEHICLE. */ X return ret_val; X} /* moveto_ */ X X/* SCORE-- PRINT OUT CURRENT SCORE */ X X/* DECLARATIONS */ X Xvoid score_(flg) Xlogical flg; X{ X /* Initialized data */ X X static const integer rank[10] = { 20,19,18,16,12,8,4,2,1,0 }; X static const integer erank[5] = { 20,15,10,5,0 }; X X /* System generated locals */ X integer i__1; X X /* Local variables */ X integer i, as; X X as = advs_1.ascore[play_1.winner - 1]; X X if (findex_1.endgmf) { X goto L60; X } X/* !ENDGAME? */ X more_output(NULL); X printf("Your score "); X if (flg) X printf("would be"); X else X printf("is"); X printf(" %d [total of %d points], in %d move", as, state_1.mxscor, X state_1.moves); X if (state_1.moves != 1) X printf("s"); X printf(".\n"); X X for (i = 1; i <= 10; ++i) { X if (as * 20 / state_1.mxscor >= rank[i - 1]) { X goto L50; X } X/* L10: */ X } XL50: X i__1 = i + 484; X rspeak_(i__1); X return; X XL60: X more_output(NULL); X printf("Your score in the endgame "); X if (flg) X printf("would be"); X else X printf("is"); X printf(" %d [total of %d points], in %d moves.\n", state_1.egscor, X state_1.egmxsc, state_1.moves); X X for (i = 1; i <= 5; ++i) { X if (state_1.egscor * 20 / state_1.egmxsc >= erank[i - 1]) { X goto L80; X } X/* L70: */ X } XL80: X i__1 = i + 786; X rspeak_(i__1); X} /* score_ */ X X/* SCRUPD- UPDATE WINNER'S SCORE */ X X/* DECLARATIONS */ X Xvoid scrupd_(n) Xinteger n; X{ X if (findex_1.endgmf) { X goto L100; X } X/* !ENDGAME? */ X advs_1.ascore[play_1.winner - 1] += n; X/* !UPDATE SCORE */ X state_1.rwscor += n; X/* !UPDATE RAW SCORE */ X if (advs_1.ascore[play_1.winner - 1] < state_1.mxscor - state_1.deaths * X 10) { X return; X } X cevent_1.cflag[cindex_1.cevegh - 1] = TRUE_; X/* !TURN ON END GAME */ X cevent_1.ctick[cindex_1.cevegh - 1] = 15; X return; X XL100: X state_1.egscor += n; X/* !UPDATE EG SCORE. */ X} /* scrupd_ */ END_OF_FILE if test 3829 -ne `wc -c <'dso2.c'`; then echo shar: \"'dso2.c'\" unpacked with wrong size! fi # end of 'dso2.c' fi if test -f 'dverb2.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'dverb2.c'\" else echo shar: Extracting \"'dverb2.c'\" \(16968 characters\) sed "s/^X//" >'dverb2.c' <<'END_OF_FILE' X/* SAVE- SAVE GAME STATE */ X X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/ X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */ X/* WRITTEN BY R. M. SUPNIK */ X X#include <stdio.h> X#include "funcs.h" X#include "vars.h" X X/* DECLARATIONS */ X Xstatic integer cxappl_ P((integer)); X Xvoid savegm_() X{ X /* Local variables */ X integer i; X FILE *e; X X prsvec_1.prswon = FALSE_; X/* !DISABLE GAME. */ X/* Note: save file format is different for PDP vs. non-PDP versions */ X X if ((e = fopen("dsave.dat", BINWRITE)) == NULL) X goto L100; X X gttime_(&i); X/* !GET TIME. */ X X#define do_uio(i, zbuf, cbytes) \ X (void) fwrite((const char *)(zbuf), (cbytes), (i), e) X X do_uio(1, &vers_1.vmaj, sizeof(integer)); X do_uio(1, &vers_1.vmin, sizeof(integer)); X do_uio(1, &vers_1.vedit, sizeof(integer)); X X do_uio(1, &play_1.winner, sizeof(integer)); X do_uio(1, &play_1.here, sizeof(integer)); X do_uio(1, &hack_1.thfpos, sizeof(integer)); X do_uio(1, &play_1.telflg, sizeof(logical)); X do_uio(1, &hack_1.thfflg, sizeof(logical)); X do_uio(1, &hack_1.thfact, sizeof(logical)); X do_uio(1, &hack_1.swdact, sizeof(logical)); X do_uio(1, &hack_1.swdsta, sizeof(integer)); X do_uio(64, &puzzle_1.cpvec[0], sizeof(integer)); X X do_uio(1, &i, sizeof(integer)); X do_uio(1, &state_1.moves, sizeof(integer)); X do_uio(1, &state_1.deaths, sizeof(integer)); X do_uio(1, &state_1.rwscor, sizeof(integer)); X do_uio(1, &state_1.egscor, sizeof(integer)); X do_uio(1, &state_1.mxload, sizeof(integer)); X do_uio(1, &state_1.ltshft, sizeof(integer)); X do_uio(1, &state_1.bloc, sizeof(integer)); X do_uio(1, &state_1.mungrm, sizeof(integer)); X do_uio(1, &state_1.hs, sizeof(integer)); X do_uio(1, &screen_1.fromdr, sizeof(integer)); X do_uio(1, &screen_1.scolrm, sizeof(integer)); X do_uio(1, &screen_1.scolac, sizeof(integer)); X X do_uio(220, &objcts_1.odesc1[0], sizeof(integer)); X do_uio(220, &objcts_1.odesc2[0], sizeof(integer)); X do_uio(220, &objcts_1.oflag1[0], sizeof(integer)); X do_uio(220, &objcts_1.oflag2[0], sizeof(integer)); X do_uio(220, &objcts_1.ofval[0], sizeof(integer)); X do_uio(220, &objcts_1.otval[0], sizeof(integer)); X do_uio(220, &objcts_1.osize[0], sizeof(integer)); X do_uio(220, &objcts_1.ocapac[0], sizeof(integer)); X do_uio(220, &objcts_1.oroom[0], sizeof(integer)); X do_uio(220, &objcts_1.oadv[0], sizeof(integer)); X do_uio(220, &objcts_1.ocan[0], sizeof(integer)); X X do_uio(200, &rooms_1.rval[0], sizeof(integer)); X do_uio(200, &rooms_1.rflag[0], sizeof(integer)); X X do_uio(4, &advs_1.aroom[0], sizeof(integer)); X do_uio(4, &advs_1.ascore[0], sizeof(integer)); X do_uio(4, &advs_1.avehic[0], sizeof(integer)); X do_uio(4, &advs_1.astren[0], sizeof(integer)); X do_uio(4, &advs_1.aflag[0], sizeof(integer)); X X do_uio(46, &flags[0], sizeof(logical)); X do_uio(22, &switch_[0], sizeof(integer)); X do_uio(4, &vill_1.vprob[0], sizeof(integer)); X do_uio(25, &cevent_1.cflag[0], sizeof(logical)); X do_uio(25, &cevent_1.ctick[0], sizeof(integer)); X X#undef do_uio X X if (fclose(e) == EOF) X goto L100; X X rspeak_(597); X return; X XL100: X rspeak_(598); X/* !CANT DO IT. */ X} /* savegm_ */ X X/* RESTORE- RESTORE GAME STATE */ X X/* DECLARATIONS */ X Xvoid rstrgm_() X{ X /* Local variables */ X integer i, j, k; X FILE *e; X X prsvec_1.prswon = FALSE_; X/* !DISABLE GAME. */ X/* Note: save file format is different for PDP vs. non-PDP versions */ X X if ((e = fopen("dsave.dat", BINREAD)) == NULL) X goto L100; X X#define do_uio(i, zbuf, cbytes) \ X (void)fread((char *)(zbuf), (cbytes), (i), e) X X do_uio(1, &i, sizeof(integer)); X do_uio(1, &j, sizeof(integer)); X do_uio(1, &k, sizeof(integer)); X X if (i != vers_1.vmaj | j != vers_1.vmin) { X goto L200; X } X X do_uio(1, &play_1.winner, sizeof(integer)); X do_uio(1, &play_1.here, sizeof(integer)); X do_uio(1, &hack_1.thfpos, sizeof(integer)); X do_uio(1, &play_1.telflg, sizeof(logical)); X do_uio(1, &hack_1.thfflg, sizeof(logical)); X do_uio(1, &hack_1.thfact, sizeof(logical)); X do_uio(1, &hack_1.swdact, sizeof(logical)); X do_uio(1, &hack_1.swdsta, sizeof(integer)); X do_uio(64, &puzzle_1.cpvec[0], sizeof(integer)); X X do_uio(1, &time_1.pltime, sizeof(integer)); X do_uio(1, &state_1.moves, sizeof(integer)); X do_uio(1, &state_1.deaths, sizeof(integer)); X do_uio(1, &state_1.rwscor, sizeof(integer)); X do_uio(1, &state_1.egscor, sizeof(integer)); X do_uio(1, &state_1.mxload, sizeof(integer)); X do_uio(1, &state_1.ltshft, sizeof(integer)); X do_uio(1, &state_1.bloc, sizeof(integer)); X do_uio(1, &state_1.mungrm, sizeof(integer)); X do_uio(1, &state_1.hs, sizeof(integer)); X do_uio(1, &screen_1.fromdr, sizeof(integer)); X do_uio(1, &screen_1.scolrm, sizeof(integer)); X do_uio(1, &screen_1.scolac, sizeof(integer)); X X do_uio(220, &objcts_1.odesc1[0], sizeof(integer)); X do_uio(220, &objcts_1.odesc2[0], sizeof(integer)); X do_uio(220, &objcts_1.oflag1[0], sizeof(integer)); X do_uio(220, &objcts_1.oflag2[0], sizeof(integer)); X do_uio(220, &objcts_1.ofval[0], sizeof(integer)); X do_uio(220, &objcts_1.otval[0], sizeof(integer)); X do_uio(220, &objcts_1.osize[0], sizeof(integer)); X do_uio(220, &objcts_1.ocapac[0], sizeof(integer)); X do_uio(220, &objcts_1.oroom[0], sizeof(integer)); X do_uio(220, &objcts_1.oadv[0], sizeof(integer)); X do_uio(220, &objcts_1.ocan[0], sizeof(integer)); X X do_uio(200, &rooms_1.rval[0], sizeof(integer)); X do_uio(200, &rooms_1.rflag[0], sizeof(integer)); X X do_uio(4, &advs_1.aroom[0], sizeof(integer)); X do_uio(4, &advs_1.ascore[0], sizeof(integer)); X do_uio(4, &advs_1.avehic[0], sizeof(integer)); X do_uio(4, &advs_1.astren[0], sizeof(integer)); X do_uio(4, &advs_1.aflag[0], sizeof(integer)); X X do_uio(46, &flags[0], sizeof(logical)); X do_uio(22, &switch_[0], sizeof(integer)); X do_uio(4, &vill_1.vprob[0], sizeof(integer)); X do_uio(25, &cevent_1.cflag[0], sizeof(logical)); X do_uio(25, &cevent_1.ctick[0], sizeof(integer)); X X (void)fclose(e); X X rspeak_(599); X return; X XL100: X rspeak_(598); X/* !CANT DO IT. */ X return; X XL200: X rspeak_(600); X/* !OBSOLETE VERSION */ X (void)fclose(e); X} /* rstrgm_ */ X X/* WALK- MOVE IN SPECIFIED DIRECTION */ X X/* DECLARATIONS */ X Xlogical walk_() X{ X /* System generated locals */ X logical ret_val; X X ret_val = TRUE_; X/* !ASSUME WINS. */ X if (play_1.winner != aindex_1.player || lit_(play_1.here) || prob_(25, X 25)) { X goto L500; X } X if (! findxt_(prsvec_1.prso, play_1.here)) { X goto L450; X } X/* !INVALID EXIT? GRUE */ X/* ! */ X switch (curxt_1.xtype) { X case 1: goto L400; X case 2: goto L200; X case 3: goto L100; X case 4: goto L300; X } X/* !DECODE EXIT TYPE. */ X bug_(9, curxt_1.xtype); X XL100: X if (cxappl_(curxt_1.xactio) != 0) { X goto L400; X } X/* !CEXIT... RETURNED ROOM? */ X if (flags[*xflag - 1]) { X goto L400; X } X/* !NO, FLAG ON? */ XL200: X jigsup_(523); X/* !BAD EXIT, GRUE */ X/* ! */ X return ret_val; X XL300: X if (cxappl_(curxt_1.xactio) != 0) { X goto L400; X } X/* !DOOR... RETURNED ROOM? */ X if ((objcts_1.oflag2[curxt_1.xobj - 1] & OPENBT) != 0) { X goto L400; X } X/* !NO, DOOR OPEN? */ X jigsup_(523); X/* !BAD EXIT, GRUE */ X/* ! */ X return ret_val; X XL400: X if (lit_(curxt_1.xroom1)) { X goto L900; X } X/* !VALID ROOM, IS IT LIT? */ XL450: X jigsup_(522); X/* !NO, GRUE */ X/* ! */ X return ret_val; X X/* ROOM IS LIT, OR WINNER IS NOT PLAYER (NO GRUE). */ X XL500: X if (findxt_(prsvec_1.prso, play_1.here)) { X goto L550; X } X/* !EXIT EXIST? */ XL525: X curxt_1.xstrng = 678; X/* !ASSUME WALL. */ X if (prsvec_1.prso == xsrch_1.xup) { X curxt_1.xstrng = 679; X } X/* !IF UP, CANT. */ X if (prsvec_1.prso == xsrch_1.xdown) { X curxt_1.xstrng = 680; X } X/* !IF DOWN, CANT. */ X if ((rooms_1.rflag[play_1.here - 1] & RNWALL) != 0) { X curxt_1.xstrng = 524; X } X rspeak_(curxt_1.xstrng); X prsvec_1.prscon = 1; X/* !STOP CMD STREAM. */ X return ret_val; X XL550: X switch (curxt_1.xtype) { X case 1: goto L900; X case 2: goto L600; X case 3: goto L700; X case 4: goto L800; X } X/* !BRANCH ON EXIT TYPE. */ X bug_(9, curxt_1.xtype); X XL700: X if (cxappl_(curxt_1.xactio) != 0) { X goto L900; X } X/* !CEXIT... RETURNED ROOM? */ X if (flags[*xflag - 1]) { X goto L900; X } X/* !NO, FLAG ON? */ XL600: X if (curxt_1.xstrng == 0) { X goto L525; X } X/* !IF NO REASON, USE STD. */ X rspeak_(curxt_1.xstrng); X/* !DENY EXIT. */ X prsvec_1.prscon = 1; X/* !STOP CMD STREAM. */ X return ret_val; X XL800: X if (cxappl_(curxt_1.xactio) != 0) { X goto L900; X } X/* !DOOR... RETURNED ROOM? */ X if ((objcts_1.oflag2[curxt_1.xobj - 1] & OPENBT) != 0) { X goto L900; X } X/* !NO, DOOR OPEN? */ X if (curxt_1.xstrng == 0) { X curxt_1.xstrng = 525; X } X/* !IF NO REASON, USE STD. */ X rspsub_(curxt_1.xstrng, objcts_1.odesc2[curxt_1.xobj - 1]); X prsvec_1.prscon = 1; X/* !STOP CMD STREAM. */ X return ret_val; X XL900: X ret_val = moveto_(curxt_1.xroom1, play_1.winner); X/* !MOVE TO ROOM. */ X if (ret_val) { X ret_val = rmdesc_(0); X } X/* !DESCRIBE ROOM. */ X return ret_val; X} /* walk_ */ X X/* CXAPPL- CONDITIONAL EXIT PROCESSORS */ X X/* DECLARATIONS */ X Xstatic integer cxappl_(ri) Xinteger ri; X{ X /* System generated locals */ X integer ret_val, i__1; X X /* Local variables */ X integer i, j, k; X integer nxt; X integer ldir; X X ret_val = 0; X/* !NO RETURN. */ X if (ri == 0) { X return ret_val; X } X/* !IF NO ACTION, DONE. */ X switch (ri) { X case 1: goto L1000; X case 2: goto L2000; X case 3: goto L3000; X case 4: goto L4000; X case 5: goto L5000; X case 6: goto L6000; X case 7: goto L7000; X case 8: goto L8000; X case 9: goto L9000; X case 10: goto L10000; X case 11: goto L11000; X case 12: goto L12000; X case 13: goto L13000; X case 14: goto L14000; X } X bug_(5, ri); X X/* C1- COFFIN-CURE */ X XL1000: X findex_1.egyptf = objcts_1.oadv[oindex_1.coffi - 1] != play_1.winner; X/* !T IF NO COFFIN. */ X return ret_val; X X/* C2- CAROUSEL EXIT */ X/* C5- CAROUSEL OUT */ X XL2000: X if (findex_1.caroff) { X return ret_val; X } X/* !IF FLIPPED, NOTHING. */ XL2500: X rspeak_(121); X/* !SPIN THE COMPASS. */ XL5000: X i = xpars_1.xelnt[xpars_1.xcond - 1] * rnd_(8); X/* !CHOOSE RANDOM EXIT. */ X curxt_1.xroom1 = exits_1.travel[rooms_1.rexit[play_1.here - 1] + i - 1] & X xpars_1.xrmask; X ret_val = curxt_1.xroom1; X/* !RETURN EXIT. */ X return ret_val; X X/* C3- CHIMNEY FUNCTION */ X XL3000: X findex_1.litldf = FALSE_; X/* !ASSUME HEAVY LOAD. */ X j = 0; X i__1 = objcts_1.olnt; X for (i = 1; i <= i__1; ++i) { X/* !COUNT OBJECTS. */ X if (objcts_1.oadv[i - 1] == play_1.winner) { X ++j; X } X/* L3100: */ X } X X if (j > 2) { X return ret_val; X } X/* !CARRYING TOO MUCH? */ X curxt_1.xstrng = 446; X/* !ASSUME NO LAMP. */ X if (objcts_1.oadv[oindex_1.lamp - 1] != play_1.winner) { X return ret_val; X } X/* !NO LAMP? */ X findex_1.litldf = TRUE_; X/* !HE CAN DO IT. */ X if ((objcts_1.oflag2[oindex_1.door - 1] & OPENBT) == 0) { X objcts_1.oflag2[oindex_1.door - 1] &= ~ TCHBT; X } X return ret_val; X X/* C4- FROBOZZ FLAG (MAGNET ROOM, FAKE EXIT) */ X/* C6- FROBOZZ FLAG (MAGNET ROOM, REAL EXIT) */ X XL4000: X if (findex_1.caroff) { X goto L2500; X } X/* !IF FLIPPED, GO SPIN. */ X findex_1.frobzf = FALSE_; X/* !OTHERWISE, NOT AN EXIT. */ X return ret_val; X XL6000: X if (findex_1.caroff) { X goto L2500; X } X/* !IF FLIPPED, GO SPIN. */ X findex_1.frobzf = TRUE_; X/* !OTHERWISE, AN EXIT. */ X return ret_val; X X/* C7- FROBOZZ FLAG (BANK ALARM) */ X XL7000: X findex_1.frobzf = objcts_1.oroom[oindex_1.bills - 1] != 0 & X objcts_1.oroom[oindex_1.portr - 1] != 0; X return ret_val; X/* CXAPPL, PAGE 3 */ X X/* C8- FROBOZZ FLAG (MRGO) */ X XL8000: X findex_1.frobzf = FALSE_; X/* !ASSUME CANT MOVE. */ X if (findex_1.mloc != curxt_1.xroom1) { X goto L8100; X } X/* !MIRROR IN WAY? */ X if (prsvec_1.prso == xsrch_1.xnorth || prsvec_1.prso == xsrch_1.xsouth) { X goto L8200; X } X if (findex_1.mdir % 180 != 0) { X goto L8300; X } X/* !MIRROR MUST BE N-S. */ X curxt_1.xroom1 = (curxt_1.xroom1 - rindex_1.mra << 1) + rindex_1.mrae; X/* !CALC EAST ROOM. */ X if (prsvec_1.prso > xsrch_1.xsouth) { X ++curxt_1.xroom1; X } X/* !IF SW/NW, CALC WEST. */ XL8100: X ret_val = curxt_1.xroom1; X return ret_val; X XL8200: X curxt_1.xstrng = 814; X/* !ASSUME STRUC BLOCKS. */ X if (findex_1.mdir % 180 == 0) { X return ret_val; X } X/* !IF MIRROR N-S, DONE. */ XL8300: X ldir = findex_1.mdir; X/* !SEE WHICH MIRROR. */ X if (prsvec_1.prso == xsrch_1.xsouth) { X ldir = 180; X } X curxt_1.xstrng = 815; X/* !MIRROR BLOCKS. */ X if (ldir > 180 && ! findex_1.mr1f || ldir < 180 && ! findex_1.mr2f) { X curxt_1.xstrng = 816; X } X return ret_val; X X/* C9- FROBOZZ FLAG (MIRIN) */ X XL9000: X if (mrhere_(play_1.here) != 1) { X goto L9100; X } X/* !MIRROR 1 HERE? */ X if (findex_1.mr1f) { X curxt_1.xstrng = 805; X } X/* !SEE IF BROKEN. */ X findex_1.frobzf = findex_1.mropnf; X/* !ENTER IF OPEN. */ X return ret_val; X XL9100: X findex_1.frobzf = FALSE_; X/* !NOT HERE, */ X curxt_1.xstrng = 817; X/* !LOSE. */ X return ret_val; X/* CXAPPL, PAGE 4 */ X X/* C10- FROBOZZ FLAG (MIRROR EXIT) */ X XL10000: X findex_1.frobzf = FALSE_; X/* !ASSUME CANT. */ X ldir = (prsvec_1.prso - xsrch_1.xnorth) / xsrch_1.xnorth * 45; X/* !XLATE DIR TO DEGREES. */ X if (! findex_1.mropnf || (findex_1.mdir + 270) % 360 != ldir && X prsvec_1.prso != xsrch_1.xexit) { X goto L10200; X } X curxt_1.xroom1 = (findex_1.mloc - rindex_1.mra << 1) + rindex_1.mrae + 1 X - findex_1.mdir / 180; X/* !ASSUME E-W EXIT. */ X if (findex_1.mdir % 180 == 0) { X goto L10100; X } X/* !IF N-S, OK. */ X curxt_1.xroom1 = findex_1.mloc + 1; X/* !ASSUME N EXIT. */ X if (findex_1.mdir > 180) { X curxt_1.xroom1 = findex_1.mloc - 1; X } X/* !IF SOUTH. */ XL10100: X ret_val = curxt_1.xroom1; X return ret_val; X XL10200: X if (! findex_1.wdopnf || (findex_1.mdir + 180) % 360 != ldir && X prsvec_1.prso != xsrch_1.xexit) { X return ret_val; X } X curxt_1.xroom1 = findex_1.mloc + 1; X/* !ASSUME N. */ X if (findex_1.mdir == 0) { X curxt_1.xroom1 = findex_1.mloc - 1; X } X/* !IF S. */ X rspeak_(818); X/* !CLOSE DOOR. */ X findex_1.wdopnf = FALSE_; X ret_val = curxt_1.xroom1; X return ret_val; X X/* C11- MAYBE DOOR. NORMAL MESSAGE IS THAT DOOR IS CLOSED. */ X/* BUT IF LCELL.NE.4, DOOR ISNT THERE. */ X XL11000: X if (findex_1.lcell != 4) { X curxt_1.xstrng = 678; X } X/* !SET UP MSG. */ X return ret_val; X X/* C12- FROBZF (PUZZLE ROOM MAIN ENTRANCE) */ X XL12000: X findex_1.frobzf = TRUE_; X/* !ALWAYS ENTER. */ X findex_1.cphere = 10; X/* !SET SUBSTATE. */ X return ret_val; X X/* C13- CPOUTF (PUZZLE ROOM SIZE ENTRANCE) */ X XL13000: X findex_1.cphere = 52; X/* !SET SUBSTATE. */ X return ret_val; X/* CXAPPL, PAGE 5 */ X X/* C14- FROBZF (PUZZLE ROOM TRANSITIONS) */ X XL14000: X findex_1.frobzf = FALSE_; X/* !ASSSUME LOSE. */ X if (prsvec_1.prso != xsrch_1.xup) { X goto L14100; X } X/* !UP? */ X if (findex_1.cphere != 10) { X return ret_val; X } X/* !AT EXIT? */ X curxt_1.xstrng = 881; X/* !ASSUME NO LADDER. */ X if (puzzle_1.cpvec[findex_1.cphere] != -2) { X return ret_val; X } X/* !LADDER HERE? */ X rspeak_(882); X/* !YOU WIN. */ X findex_1.frobzf = TRUE_; X/* !LET HIM OUT. */ X return ret_val; X XL14100: X if (findex_1.cphere != 52 || prsvec_1.prso != xsrch_1.xwest || ! X findex_1.cpoutf) { X goto L14200; X } X findex_1.frobzf = TRUE_; X/* !YES, LET HIM OUT. */ X return ret_val; X XL14200: X for (i = 1; i <= 16; i += 2) { X/* !LOCATE EXIT. */ X if (prsvec_1.prso == puzzle_1.cpdr[i - 1]) { X goto L14400; X } X/* L14300: */ X } X return ret_val; X/* !NO SUCH EXIT. */ X XL14400: X j = puzzle_1.cpdr[i]; X/* !GET DIRECTIONAL OFFSET. */ X nxt = findex_1.cphere + j; X/* !GET NEXT STATE. */ X k = 8; X/* !GET ORTHOGONAL DIR. */ X if (j < 0) { X k = -8; X } X if ((abs(j) == 1 || abs(j) == 8 || (puzzle_1.cpvec[findex_1.cphere + k - X 1] == 0 || puzzle_1.cpvec[nxt - k - 1] == 0)) && puzzle_1.cpvec[ X nxt - 1] == 0) { X goto L14500; X } X return ret_val; X XL14500: X cpgoto_(nxt); X/* !MOVE TO STATE. */ X curxt_1.xroom1 = rindex_1.cpuzz; X/* !STAY IN ROOM. */ X ret_val = curxt_1.xroom1; X return ret_val; X X} /* cxappl_ */ END_OF_FILE if test 16968 -ne `wc -c <'dverb2.c'`; then echo shar: \"'dverb2.c'\" unpacked with wrong size! fi # end of 'dverb2.c' fi if test -f 'sverbs.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'sverbs.c'\" else echo shar: Extracting \"'sverbs.c'\" \(17621 characters\) sed "s/^X//" >'sverbs.c' <<'END_OF_FILE' X/* SVERBS- SIMPLE VERBS PROCESSOR */ X/* ALL VERBS IN THIS ROUTINE MUST BE INDEPENDANT */ X/* OF OBJECT ACTIONS */ X X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/ X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */ X/* WRITTEN BY R. M. SUPNIK */ X X#include <stdio.h> X#include "funcs.h" X#include "vars.h" X Xlogical sverbs_(ri) Xinteger ri; X{ X /* Initialized data */ X X const integer mxnop = 39; X const integer mxjoke = 64; X static const integer jokes[25] = { 4,5,3,304,305,306,307,308,309,310,311, X 312,313,5314,5319,324,325,883,884,120,120,0,0,0,0 }; X static const integer answer[14] = { 0,1,2,3,4,4,4,4,5,5,5,6,7,7}; X static const char * const ansstr[14] = X { "TEMPLE", "FOREST", "30003", "FLASK", "RUB", "FONDLE", X "CARRES", "TOUCH", "BONES", "BODY", "SKELE", "RUSTYKNIFE", X "NONE", "NOWHER" }; X X /* System generated locals */ X integer i__1, i__2; X logical ret_val; X X /* Local variables */ X logical f; X const char *z, *z2; X integer i, j; X integer k; X integer l; X char ch[1*6]; X integer cp, wp; X char pp1[1*6], pp2[1*6]; X integer odi2 = 0, odo2 = 0; X X ret_val = TRUE_; X/* !ASSUME WINS. */ X if (prsvec_1.prso != 0) { X odo2 = objcts_1.odesc2[prsvec_1.prso - 1]; X } X/* !SET UP DESCRIPTORS. */ X if (prsvec_1.prsi != 0) { X odi2 = objcts_1.odesc2[prsvec_1.prsi - 1]; X } X X if (ri == 0) { X bug_(7, ri); X } X/* !ZERO IS VERBOTEN. */ X if (ri <= mxnop) { X return ret_val; X } X/* !NOP? */ X if (ri <= mxjoke) { X goto L100; X } X/* !JOKE? */ X switch (ri - mxjoke) { X case 1: goto L65000; X case 2: goto L66000; X case 3: goto L67000; X case 4: goto L68000; X case 5: goto L69000; X case 6: goto L1000; X case 7: goto L2000; X case 8: goto L3000; X case 9: goto L4000; X case 10: goto L5000; X case 11: goto L6000; X case 12: goto L7000; X case 13: goto L8000; X case 14: goto L9000; X case 15: goto L10000; X case 16: goto L11000; X case 17: goto L12000; X case 18: goto L13000; X case 19: goto L14000; X case 20: goto L15000; X case 21: goto L16000; X case 22: goto L17000; X case 23: goto L18000; X case 24: goto L19000; X case 25: goto L20000; X case 26: goto L21000; X case 27: goto L22000; X case 28: goto L23000; X case 29: goto L24000; X case 30: goto L25000; X case 31: goto L26000; X case 32: goto L27000; X } X bug_(7, ri); X X/* ALL VERB PROCESSORS RETURN HERE TO DECLARE FAILURE. */ X X/* L10: */ X ret_val = FALSE_; X/* !LOSE. */ X return ret_val; X X/* JOKE PROCESSOR. */ X/* FIND PROPER ENTRY IN JOKES, USE IT TO SELECT STRING TO PRINT. */ X XL100: X i = jokes[ri - mxnop - 1]; X/* !GET TABLE ENTRY. */ X j = i / 1000; X/* !ISOLATE # STRINGS. */ X if (j != 0) { X i = i % 1000 + rnd_(j); X } X/* !IF RANDOM, CHOOSE. */ X rspeak_(i); X/* !PRINT JOKE. */ X return ret_val; X/* SVERBS, PAGE 2A */ X X/* V65-- ROOM */ X XL65000: X ret_val = rmdesc_(2); X/* !DESCRIBE ROOM ONLY. */ X return ret_val; X X/* V66-- OBJECTS */ X XL66000: X ret_val = rmdesc_(1); X/* !DESCRIBE OBJ ONLY. */ X if (! play_1.telflg) { X rspeak_(138); X } X/* !NO OBJECTS. */ X return ret_val; X X/* V67-- RNAME */ X XL67000: X i__1 = rooms_1.rdesc2[play_1.here - 1]; X rspeak_(i__1); X/* !SHORT ROOM NAME. */ X return ret_val; X X/* V68-- RESERVED */ X XL68000: X return ret_val; X X/* V69-- RESERVED */ X XL69000: X return ret_val; X/* SVERBS, PAGE 3 */ X X/* V70-- BRIEF. SET FLAG. */ X XL1000: X findex_1.brieff = TRUE_; X/* !BRIEF DESCRIPTIONS. */ X findex_1.superf = FALSE_; X rspeak_(326); X return ret_val; X X/* V71-- VERBOSE. CLEAR FLAGS. */ X XL2000: X findex_1.brieff = FALSE_; X/* !LONG DESCRIPTIONS. */ X findex_1.superf = FALSE_; X rspeak_(327); X return ret_val; X X/* V72-- SUPERBRIEF. SET FLAG. */ X XL3000: X findex_1.superf = TRUE_; X rspeak_(328); X return ret_val; X X/* V73-- STAY (USED IN ENDGAME). */ X XL4000: X if (play_1.winner != aindex_1.amastr) { X goto L4100; X } X/* !TELL MASTER, STAY. */ X rspeak_(781); X/* !HE DOES. */ X cevent_1.ctick[cindex_1.cevfol - 1] = 0; X/* !NOT FOLLOWING. */ X return ret_val; X XL4100: X if (play_1.winner == aindex_1.player) { X rspeak_(664); X } X/* !JOKE. */ X return ret_val; X X/* V74-- VERSION. PRINT INFO. */ X XL5000: X more_output(NULL); X printf("V%1d.%1d%c\n", vers_1.vmaj, vers_1.vmin, vers_1.vedit); X play_1.telflg = TRUE_; X return ret_val; X X/* V75-- SWIM. ALWAYS A JOKE. */ X XL6000: X i = 330; X/* !ASSUME WATER. */ X if ((rooms_1.rflag[play_1.here - 1] & RWATER + RFILL) == X 0) { X i = rnd_(3) + 331; X } X rspeak_(i); X return ret_val; X X/* V76-- GERONIMO. IF IN BARREL, FATAL, ELSE JOKE. */ X XL7000: X if (play_1.here == rindex_1.mbarr) { X goto L7100; X } X/* !IN BARREL? */ X rspeak_(334); X/* !NO, JOKE. */ X return ret_val; X XL7100: X jigsup_(335); X/* !OVER FALLS. */ X return ret_val; X X/* V77-- SINBAD ET AL. CHASE CYCLOPS, ELSE JOKE. */ X XL8000: X if (play_1.here == rindex_1.mcycl && qhere_(oindex_1.cyclo, play_1.here) X ) { X goto L8100; X } X rspeak_(336); X/* !NOT HERE, JOKE. */ X return ret_val; X XL8100: X newsta_(oindex_1.cyclo, 337, 0, 0, 0); X/* !CYCLOPS FLEES. */ X findex_1.cyclof = TRUE_; X/* !SET ALL FLAGS. */ X findex_1.magicf = TRUE_; X objcts_1.oflag2[oindex_1.cyclo - 1] &= ~ FITEBT; X return ret_val; X X/* V78-- WELL. OPEN DOOR, ELSE JOKE. */ X XL9000: X if (findex_1.riddlf || play_1.here != rindex_1.riddl) { X goto L9100; X } X/* !IN RIDDLE ROOM? */ X findex_1.riddlf = TRUE_; X/* !YES, SOLVED IT. */ X rspeak_(338); X return ret_val; X XL9100: X rspeak_(339); X/* !WELL, WHAT? */ X return ret_val; X X/* V79-- PRAY. IF IN TEMP2, POOF */ X/* ! */ X XL10000: X if (play_1.here != rindex_1.temp2) { X goto L10050; X } X/* !IN TEMPLE? */ X if (moveto_(rindex_1.fore1, play_1.winner)) { X goto L10100; X } X/* !FORE1 STILL THERE? */ XL10050: X rspeak_(340); X/* !JOKE. */ X return ret_val; X XL10100: X f = rmdesc_(3); X/* !MOVED, DESCRIBE. */ X return ret_val; X X/* V80-- TREASURE. IF IN TEMP1, POOF */ X/* ! */ X XL11000: X if (play_1.here != rindex_1.temp1) { X goto L11050; X } X/* !IN TEMPLE? */ X if (moveto_(rindex_1.treas, play_1.winner)) { X goto L10100; X } X/* !TREASURE ROOM THERE? */ XL11050: X rspeak_(341); X/* !NOTHING HAPPENS. */ X return ret_val; X X/* V81-- TEMPLE. IF IN TREAS, POOF */ X/* ! */ X XL12000: X if (play_1.here != rindex_1.treas) { X goto L12050; X } X/* !IN TREASURE? */ X if (moveto_(rindex_1.temp1, play_1.winner)) { X goto L10100; X } X/* !TEMP1 STILL THERE? */ XL12050: X rspeak_(341); X/* !NOTHING HAPPENS. */ X return ret_val; X X/* V82-- BLAST. USUALLY A JOKE. */ X XL13000: X i = 342; X/* !DONT UNDERSTAND. */ X if (prsvec_1.prso == oindex_1.safe) { X i = 252; X } X/* !JOKE FOR SAFE. */ X rspeak_(i); X return ret_val; X X/* V83-- SCORE. PRINT SCORE. */ X XL14000: X score_(0); X return ret_val; X X/* V84-- QUIT. FINISH OUT THE GAME. */ X XL15000: X score_(1); X/* !TELLL SCORE. */ X if (! yesno_(343, 0, 0)) { X return ret_val; X } X/* !ASK FOR Y/N DECISION. */ X exit_(); X/* !BYE. */ X/* SVERBS, PAGE 4 */ X X/* V85-- FOLLOW (USED IN ENDGAME) */ X XL16000: X if (play_1.winner != aindex_1.amastr) { X return ret_val; X } X/* !TELL MASTER, FOLLOW. */ X rspeak_(782); X cevent_1.ctick[cindex_1.cevfol - 1] = -1; X/* !STARTS FOLLOWING. */ X return ret_val; X X/* V86-- WALK THROUGH */ X XL17000: X if (screen_1.scolrm == 0 || prsvec_1.prso != oindex_1.scol && ( X prsvec_1.prso != oindex_1.wnort || play_1.here != rindex_1.bkbox)) X { X goto L17100; X } X screen_1.scolac = screen_1.scolrm; X/* !WALKED THRU SCOL. */ X prsvec_1.prso = 0; X/* !FAKE OUT FROMDR. */ X cevent_1.ctick[cindex_1.cevscl - 1] = 6; X/* !START ALARM. */ X rspeak_(668); X/* !DISORIENT HIM. */ X f = moveto_(screen_1.scolrm, play_1.winner); X/* !INTO ROOM. */ X f = rmdesc_(3); X/* !DESCRIBE. */ X return ret_val; X XL17100: X if (play_1.here != screen_1.scolac) { X goto L17300; X } X/* !ON OTHER SIDE OF SCOL? */ X for (i = 1; i <= 12; i += 3) { X/* !WALK THRU PROPER WALL? */ X if (screen_1.scolwl[i - 1] == play_1.here && screen_1.scolwl[i] == X prsvec_1.prso) { X goto L17500; X } X/* L17200: */ X } X XL17300: X if ((objcts_1.oflag1[prsvec_1.prso - 1] & TAKEBT) != 0) { X goto L17400; X } X i = 669; X/* !NO, JOKE. */ X if (prsvec_1.prso == oindex_1.scol) { X i = 670; X } X/* !SPECIAL JOKE FOR SCOL. */ X rspsub_(i, odo2); X return ret_val; X XL17400: X i = 671; X/* !JOKE. */ X if (objcts_1.oroom[prsvec_1.prso - 1] != 0) { X i = rnd_(5) + 552; X } X/* !SPECIAL JOKES IF CARRY. */ X rspeak_(i); X return ret_val; X XL17500: X prsvec_1.prso = screen_1.scolwl[i + 1]; X/* !THRU SCOL WALL... */ X for (i = 1; i <= 8; i += 2) { X/* !FIND MATCHING ROOM. */ X if (prsvec_1.prso == screen_1.scoldr[i - 1]) { X screen_1.scolrm = screen_1.scoldr[i]; X } X/* L17600: */ X } X/* !DECLARE NEW SCOLRM. */ X cevent_1.ctick[cindex_1.cevscl - 1] = 0; X/* !CANCEL ALARM. */ X rspeak_(668); X/* !DISORIENT HIM. */ X f = moveto_(rindex_1.bkbox, play_1.winner); X/* !BACK IN BOX ROOM. */ X f = rmdesc_(3); X return ret_val; X X/* V87-- RING. A JOKE. */ X XL18000: X i = 359; X/* !CANT RING. */ X if (prsvec_1.prso == oindex_1.bell) { X i = 360; X } X/* !DING, DONG. */ X rspeak_(i); X/* !JOKE. */ X return ret_val; X X/* V88-- BRUSH. JOKE WITH OBSCURE TRAP. */ X XL19000: X if (prsvec_1.prso == oindex_1.teeth) { X goto L19100; X } X/* !BRUSH TEETH? */ X rspeak_(362); X/* !NO, JOKE. */ X return ret_val; X XL19100: X if (prsvec_1.prsi != 0) { X goto L19200; X } X/* !WITH SOMETHING? */ X rspeak_(363); X/* !NO, JOKE. */ X return ret_val; X XL19200: X if (prsvec_1.prsi == oindex_1.putty && objcts_1.oadv[oindex_1.putty - 1] X == play_1.winner) { X goto L19300; X } X rspsub_(364, odi2); X/* !NO, JOKE. */ X return ret_val; X XL19300: X jigsup_(365); X/* !YES, DEAD */ X/* ! */ X/* ! */ X/* ! */ X/* ! */ X/* ! */ X return ret_val; X/* SVERBS, PAGE 5 */ X X/* V89-- DIG. UNLESS SHOVEL, A JOKE. */ X XL20000: X if (prsvec_1.prso == oindex_1.shove) { X return ret_val; X } X/* !SHOVEL? */ X i = 392; X/* !ASSUME TOOL. */ X if ((objcts_1.oflag1[prsvec_1.prso - 1] & TOOLBT) == 0) { X i = 393; X } X rspsub_(i, odo2); X return ret_val; X X/* V90-- TIME. PRINT OUT DURATION OF GAME. */ X XL21000: X gttime_(&k); X/* !GET PLAY TIME. */ X i = k / 60; X j = k % 60; X X more_output(NULL); X printf("You have been playing Dungeon for "); X if (i >= 1) { X printf("%d hour", i); X if (i >= 2) X printf("s"); X printf(" and "); X } X printf("%d minute", j); X if (j != 1) X printf("s"); X printf(".\n"); X play_1.telflg = TRUE_; X return ret_val; X X X/* V91-- LEAP. USUALLY A JOKE, WITH A CATCH. */ X XL22000: X if (prsvec_1.prso == 0) { X goto L22200; X } X/* !OVER SOMETHING? */ X if (qhere_(prsvec_1.prso, play_1.here)) { X goto L22100; X } X/* !HERE? */ X rspeak_(447); X/* !NO, JOKE. */ X return ret_val; X XL22100: X if ((objcts_1.oflag2[prsvec_1.prso - 1] & VILLBT) == 0) { X goto L22300; X } X rspsub_(448, odo2); X/* !CANT JUMP VILLAIN. */ X return ret_val; X XL22200: X if (! findxt_(xsrch_1.xdown, play_1.here)) { X goto L22300; X } X/* !DOWN EXIT? */ X if (curxt_1.xtype == xpars_1.xno || curxt_1.xtype == xpars_1.xcond && ! X flags[*xflag - 1]) { X goto L22400; X } XL22300: X i__1 = rnd_(5) + 314; X rspeak_(i__1); X/* !WHEEEE */ X/* ! */ X return ret_val; X XL22400: X i__1 = rnd_(4) + 449; X jigsup_(i__1); X/* !FATAL LEAP. */ X return ret_val; X/* SVERBS, PAGE 6 */ X X/* V92-- LOCK. */ X XL23000: X if (prsvec_1.prso == oindex_1.grate && play_1.here == rindex_1.mgrat) { X goto L23200; X } XL23100: X rspeak_(464); X/* !NOT LOCK GRATE. */ X return ret_val; X XL23200: X findex_1.grunlf = FALSE_; X/* !GRATE NOW LOCKED. */ X rspeak_(214); X exits_1.travel[rooms_1.rexit[play_1.here - 1]] = 214; X/* !CHANGE EXIT STATUS. */ X return ret_val; X X/* V93-- UNLOCK */ X XL24000: X if (prsvec_1.prso != oindex_1.grate || play_1.here != rindex_1.mgrat) { X goto L23100; X } X if (prsvec_1.prsi == oindex_1.keys) { X goto L24200; X } X/* !GOT KEYS? */ X rspsub_(465, odi2); X/* !NO, JOKE. */ X return ret_val; X XL24200: X findex_1.grunlf = TRUE_; X/* !UNLOCK GRATE. */ X rspeak_(217); X exits_1.travel[rooms_1.rexit[play_1.here - 1]] = 217; X/* !CHANGE EXIT STATUS. */ X return ret_val; X X/* V94-- DIAGNOSE. */ X XL25000: X i = fights_(play_1.winner, 0); X/* !GET FIGHTS STRENGTH. */ X j = advs_1.astren[play_1.winner - 1]; X/* !GET HEALTH. */ X/* Computing MIN */ X i__1 = i + j; X k = min(i__1,4); X/* !GET STATE. */ X if (! cevent_1.cflag[cindex_1.cevcur - 1]) { X j = 0; X } X/* !IF NO WOUNDS. */ X/* Computing MIN */ X i__1 = 4, i__2 = abs(j); X l = min(i__1,i__2); X/* !SCALE. */ X i__1 = l + 473; X rspeak_(i__1); X/* !DESCRIBE HEALTH. */ X i = (-j - 1) * 30 + cevent_1.ctick[cindex_1.cevcur - 1]; X/* !COMPUTE WAIT. */ X X if (j != 0) { X more_output(NULL); X printf("You will be cured after %d moves.\n", i); X } X X i__1 = k + 478; X rspeak_(i__1); X/* !HOW MUCH MORE? */ X if (state_1.deaths != 0) { X i__1 = state_1.deaths + 482; X rspeak_(i__1); X } X/* !HOW MANY DEATHS? */ X return ret_val; X/* SVERBS, PAGE 7 */ X X/* V95-- INCANT */ X XL26000: X for (i = 1; i <= 6; ++i) { X/* !SET UP PARSE. */ X pp1[i - 1] = ' '; X pp2[i - 1] = ' '; X/* L26100: */ X } X wp = 1; X/* !WORD POINTER. */ X cp = 1; X/* !CHAR POINTER. */ X if (prsvec_1.prscon <= 1) { X goto L26300; X } X for (z = input_1.inbuf + prsvec_1.prscon - 1; *z != '\0'; ++z) { X/* !PARSE INPUT */ X if (*z == ',') X goto L26300; X/* !END OF PHRASE? */ X if (*z != ' ') X goto L26150; X/* !SPACE? */ X if (cp != 1) { X ++wp; X } X cp = 1; X goto L26200; XL26150: X if (wp == 1) { X pp1[cp - 1] = *z; X } X/* !STUFF INTO HOLDER. */ X if (wp == 2) { X pp2[cp - 1] = *z; X } X/* Computing MIN */ X i__2 = cp + 1; X cp = min(i__2,6); XL26200: X ; X } X XL26300: X prsvec_1.prscon = 1; X/* !KILL REST OF LINE. */ X if (pp1[0] != ' ') { X goto L26400; X } X/* !ANY INPUT? */ X rspeak_(856); X/* !NO, HO HUM. */ X return ret_val; X XL26400: X encryp_(pp1, ch); X/* !COMPUTE RESPONSE. */ X if (pp2[0] != ' ') { X goto L26600; X } X/* !TWO PHRASES? */ X X if (findex_1.spellf) { X goto L26550; X } X/* !HE'S TRYING TO LEARN. */ X if ((rooms_1.rflag[rindex_1.tstrs - 1] & RSEEN) == 0) { X goto L26575; X } X findex_1.spellf = TRUE_; X/* !TELL HIM. */ X play_1.telflg = TRUE_; X more_output(NULL); X printf("A hollow voice replies: \"%.6s %.6s\".\n", pp1, ch); X X return ret_val; X XL26550: X rspeak_(857); X/* !HE'S GOT ONE ALREADY. */ X return ret_val; X XL26575: X rspeak_(858); X/* !HE'S NOT IN ENDGAME. */ X return ret_val; X XL26600: X if ((rooms_1.rflag[rindex_1.tstrs - 1] & RSEEN) != 0) { X goto L26800; X } X for (i = 1; i <= 6; ++i) { X if (pp2[i - 1] != ch[i - 1]) { X goto L26575; X } X/* !WRONG. */ X/* L26700: */ X } X findex_1.spellf = TRUE_; X/* !IT WORKS. */ X rspeak_(859); X cevent_1.ctick[cindex_1.cevste - 1] = 1; X/* !FORCE START. */ X return ret_val; X XL26800: X rspeak_(855); X/* !TOO LATE. */ X return ret_val; X/* SVERBS, PAGE 8 */ X X/* V96-- ANSWER */ X XL27000: X if (prsvec_1.prscon > 1 && play_1.here == rindex_1.fdoor && X findex_1.inqstf) { X goto L27100; X } X rspeak_(799); X/* !NO ONE LISTENS. */ X prsvec_1.prscon = 1; X return ret_val; X XL27100: X for (j = 1; j <= 14; j ++) { X/* !CHECK ANSWERS. */ X if (findex_1.quesno != answer[j - 1]) X goto L27300; X/* !ONLY CHECK PROPER ANS. */ X z = ansstr[j - 1]; X z2 = input_1.inbuf + prsvec_1.prscon - 1; X while (*z != '\0') { X while (*z2 == ' ') X z2++; X/* !STRIP INPUT BLANKS. */ X if (*z++ != *z2++) X goto L27300; X } X goto L27500; X/* !RIGHT ANSWER. */ XL27300: X ; X } X X prsvec_1.prscon = 1; X/* !KILL REST OF LINE. */ X ++findex_1.nqatt; X/* !WRONG, CRETIN. */ X if (findex_1.nqatt >= 5) { X goto L27400; X } X/* !TOO MANY WRONG? */ X i__1 = findex_1.nqatt + 800; X rspeak_(i__1); X/* !NO, TRY AGAIN. */ X return ret_val; X XL27400: X rspeak_(826); X/* !ALL OVER. */ X cevent_1.cflag[cindex_1.cevinq - 1] = FALSE_; X/* !LOSE. */ X return ret_val; X XL27500: X prsvec_1.prscon = 1; X/* !KILL REST OF LINE. */ X ++findex_1.corrct; X/* !GOT IT RIGHT. */ X rspeak_(800); X/* !HOORAY. */ X if (findex_1.corrct >= 3) { X goto L27600; X } X/* !WON TOTALLY? */ X cevent_1.ctick[cindex_1.cevinq - 1] = 2; X/* !NO, START AGAIN. */ X findex_1.quesno = (findex_1.quesno + 3) % 8; X findex_1.nqatt = 0; X rspeak_(769); X/* !ASK NEXT QUESTION. */ X i__1 = findex_1.quesno + 770; X rspeak_(i__1); X return ret_val; X XL27600: X rspeak_(827); X/* !QUIZ OVER, */ X cevent_1.cflag[cindex_1.cevinq - 1] = FALSE_; X objcts_1.oflag2[oindex_1.qdoor - 1] |= OPENBT; X return ret_val; X X} /* sverbs_ */ END_OF_FILE if test 17621 -ne `wc -c <'sverbs.c'`; then echo shar: \"'sverbs.c'\" unpacked with wrong size! fi # end of 'sverbs.c' fi echo shar: End of archive 9 \(of 12\). cp /dev/null ark9isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 12 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0