OpenCores
URL https://opencores.org/ocsvn/ion/ion/trunk

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [adventure/] [main.c] - Blame information for rev 177

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 90 ja_rd
#include "misc.h"
2
#ifdef __MSDOS__
3
#include "alloc.h"
4
#endif
5
 
6
#include "adv_baremetal.h"
7
 
8
#define TRUE  (0==0)
9
#define FALSE (0!=0)
10
long ABB[186], ATAB[331], ATLOC[186], BLKLIN = TRUE, DFLAG,
11
                DLOC[7], FIXED[101], HOLDNG,
12
                KTAB[331], *LINES, LINK[201], LNLENG, LNPOSN,
13
                PARMS[26], PLACE[101], PTEXT[101], RTEXT[278],
14
                SETUP = 0, TABSIZ = 330;
15
char INLINE[101], MAP1[129], MAP2[129];
16
 
17
long ABBNUM, ACTSPK[36], AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
18
                 BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
19
                CLAM, CLOCK1, CLOCK2, CLOSED, CLOSNG, CLSHNT, CLSMAX = 12, CLSSES,
20
                COINS, COND[186], CONDS, CTEXT[13], CVAL[13], DALTLC, DETAIL,
21
                 DKILL, DOOR, DPRSSN, DRAGON, DSEEN[7], DTOTAL, DWARF, EGGS,
22
                EMRALD, ENTER, ENTRNC, FIND, FISSUR, FIXD[101], FOOBAR, FOOD,
23
                GRATE, HINT, HINTED[21], HINTLC[21], HINTS[21][5], HNTMAX,
24
                HNTSIZ = 20, I, INVENT, IGO, IWEST, J, JADE, K, K2, KEY[186], KEYS, KK,
25
                KNFLOC, KNIFE, KQ, L, LAMP, LIMIT, LINSIZ = 12500, LINUSE, LL,
26
                LMWARN, LOC, LOCK, LOCSIZ = 185, LOCSND[186], LOOK, LTEXT[186],
27
                MAGZIN, MAXDIE, MAXTRS, MESH = 123456789,
28
                MESSAG, MIRROR, MXSCOR,
29
                NEWLOC, NOVICE, NUGGET, NUL, NUMDIE, OBJ, OBJSND[101],
30
                OBJTXT[101], ODLOC[7], OGRE, OIL, OLDLC2, OLDLOC, OLDOBJ, OYSTER,
31
                PANIC, PEARL, PILLOW, PLAC[101], PLANT, PLANT2, PROP[101], PYRAM,
32
                RESER, ROD, ROD2, RTXSIZ = 277, RUBY, RUG, SAPPH, SAVED, SAY,
33
                SCORE, SECT, SIGN, SNAKE, SPK, STEPS, STEXT[186], STICK,
34
                STREAM, TABNDX, TALLY, THRESH, THROW, TK[21], TRAVEL[886], TRIDNT,
35
                TRNDEX, TRNLUZ, TRNSIZ = 5, TRNVAL[6], TRNVLS, TROLL, TROLL2, TRVS,
36
                 TRVSIZ = 885, TTEXT[6], TURNS, URN, V1, V2, VASE, VEND, VERB,
37
                VOLCAN, VRBSIZ = 35, VRSION = 25, WATER, WD1, WD1X, WD2, WD2X,
38
                WZDARK = FALSE, ZZWORD;
39
 
40
extern initialise();
41
extern void score(long);
42
extern action(long);
43
 
44
/*
45
 * MAIN PROGRAM
46
 */
47
 
48
 
49
main() {
50
 
51
/* Initialize file data structures */
52
startup();
53
 
54
 
55
/*  ADVENTURE (REV 2: 20 TREASURES) */
56
 
57
/*  HISTORY: ORIGINAL IDEA & 5-TREASURE VERSION (ADVENTURES) BY WILLIE CROWTHER
58
 *           15-TREASURE VERSION (ADVENTURE) BY DON WOODS, APRIL-JUNE 1977
59
 *           20-TREASURE VERSION (REV 2) BY DON WOODS, AUGUST 1978
60
 *              ERRATA FIXED: 78/12/25 */
61
 
62
 
63
/* LOGICAL VARIABLES:
64
 *
65
 *  CLOSED SAYS WHETHER WE'RE ALL THE WAY CLOSED
66
 *  CLOSNG SAYS WHETHER IT'S CLOSING TIME YET
67
 *  CLSHNT SAYS WHETHER HE'S READ THE CLUE IN THE ENDGAME
68
 *  LMWARN SAYS WHETHER HE'S BEEN WARNED ABOUT LAMP GOING DIM
69
 *  NOVICE SAYS WHETHER HE ASKED FOR INSTRUCTIONS AT START-UP
70
 *  PANIC SAYS WHETHER HE'S FOUND OUT HE'S TRAPPED IN THE CAVE
71
 *  WZDARK SAYS WHETHER THE LOC HE'S LEAVING WAS DARK */
72
 
73
#include "funcs.h"
74
 
75
/*  READ THE DATABASE IF WE HAVE NOT YET DONE SO */
76
 
77
        LINES = (long *)alloc_mem(LINSIZ+1,sizeof(long));
78
        if(!LINES){
79
                puts("Not enough memory!\n");
80
                exit(FALSE);
81
        }
82
 
83
        MAP2[1] = 0;
84
        if(!SETUP)initialise();
85
        if(SETUP > 0) goto L1;
86
 
87
/*  UNLIKE EARLIER VERSIONS, ADVENTURE IS NO LONGER RESTARTABLE.  (THIS
88
 *  LETS US GET AWAY WITH MODIFYING THINGS SUCH AS OBJSND(BIRD) WITHOUT
89
 *  HAVING TO BE ABLE TO UNDO THE CHANGES LATER.)  IF A "USED" COPY IS
90
 *  RERUN, WE COME HERE AND TELL THE PLAYER TO RUN A FRESH COPY. */
91
 
92
        RSPEAK(201);
93
        exit(FALSE);
94
 
95
 
96
 
97
/*  START-UP, DWARF STUFF */
98
 
99
L1:     SETUP= -1;
100
        I=RAN(-1);
101
        ZZWORD=RNDVOC(3,0)+MESH*2;
102
        NOVICE=YES(65,1,0);
103
        NEWLOC=1;
104
        LOC=1;
105
        LIMIT=330;
106
        if(NOVICE)LIMIT=1000;
107
 
108
/*  CAN'T LEAVE CAVE ONCE IT'S CLOSING (EXCEPT BY MAIN OFFICE). */
109
 
110
L2:     if(!OUTSID(NEWLOC) || NEWLOC == 0 || !CLOSNG) goto L71;
111
        RSPEAK(130);
112
        NEWLOC=LOC;
113
        if(!PANIC)CLOCK2=15;
114
        PANIC=TRUE;
115
 
116
/*  SEE IF A DWARF HAS SEEN HIM AND HAS COME FROM WHERE HE WANTS TO GO.  IF SO,
117
 *  THE DWARF'S BLOCKING HIS WAY.  IF COMING FROM PLACE FORBIDDEN TO PIRATE
118
 *  (DWARVES ROOTED IN PLACE) LET HIM GET OUT (AND ATTACKED). */
119
 
120
L71:    if(NEWLOC == LOC || FORCED(LOC) || CNDBIT(LOC,3)) goto L74;
121
        /* 73 */ for (I=1; I<=5; I++) {
122
        if(ODLOC[I] != NEWLOC || !DSEEN[I]) goto L73;
123
        NEWLOC=LOC;
124
        RSPEAK(2);
125
         goto L74;
126
L73:    /*etc*/ ;
127
        } /* end loop */
128
L74:    LOC=NEWLOC;
129
 
130
/*  DWARF STUFF.  SEE EARLIER COMMENTS FOR DESCRIPTION OF VARIABLES.  REMEMBER
131
 *  SIXTH DWARF IS PIRATE AND IS THUS VERY DIFFERENT EXCEPT FOR MOTION RULES. */
132
 
133
/*  FIRST OFF, DON'T LET THE DWARVES FOLLOW HIM INTO A PIT OR A WALL.  ACTIVATE
134
 *  THE WHOLE MESS THE FIRST TIME HE GETS AS FAR AS THE HALL OF MISTS (LOC 15).
135
 *  IF NEWLOC IS FORBIDDEN TO PIRATE (IN PARTICULAR, IF IT'S BEYOND THE TROLL
136
 *  BRIDGE), BYPASS DWARF STUFF.  THAT WAY PIRATE CAN'T STEAL RETURN TOLL, AND
137
 *  DWARVES CAN'T MEET THE BEAR.  ALSO MEANS DWARVES WON'T FOLLOW HIM INTO DEAD
138
 *  END IN MAZE, BUT C'EST LA VIE.  THEY'LL WAIT FOR HIM OUTSIDE THE DEAD END. */
139
 
140
        if(LOC == 0 || FORCED(LOC) || CNDBIT(NEWLOC,3)) goto L2000;
141
        if(DFLAG != 0) goto L6000;
142
        if(INDEEP(LOC))DFLAG=1;
143
         goto L2000;
144
 
145
/*  WHEN WE ENCOUNTER THE FIRST DWARF, WE KILL 0, 1, OR 2 OF THE 5 DWARVES.  IF
146
 *  ANY OF THE SURVIVORS IS AT LOC, REPLACE HIM WITH THE ALTERNATE. */
147
 
148
L6000:  if(DFLAG != 1) goto L6010;
149
        if(!INDEEP(LOC) || (PCT(95) && (!CNDBIT(LOC,4) || PCT(85)))) goto L2000;
150
        DFLAG=2;
151
        /* 6001 */ for (I=1; I<=2; I++) {
152
        J=1+RAN(5);
153
L6001:  if(PCT(50))DLOC[J]=0;
154
        } /* end loop */
155
        /* 6002 */ for (I=1; I<=5; I++) {
156
        if(DLOC[I] == LOC)DLOC[I]=DALTLC;
157
L6002:  ODLOC[I]=DLOC[I];
158
        } /* end loop */
159
        RSPEAK(3);
160
        DROP(AXE,LOC);
161
         goto L2000;
162
 
163
/*  THINGS ARE IN FULL SWING.  MOVE EACH DWARF AT RANDOM, EXCEPT IF HE'S SEEN US
164
 *  HE STICKS WITH US.  DWARVES STAY DEEP INSIDE.  IF WANDERING AT RANDOM,
165
 *  THEY DON'T BACK UP UNLESS THERE'S NO ALTERNATIVE.  IF THEY DON'T HAVE TO
166
 *  MOVE, THEY ATTACK.  AND, OF COURSE, DEAD DWARVES DON'T DO MUCH OF ANYTHING. */
167
 
168
L6010:  DTOTAL=0;
169
        ATTACK=0;
170
        STICK=0;
171
        /* 6030 */ for (I=1; I<=6; I++) {
172
        if(DLOC[I] == 0) goto L6030;
173
/*  FILL TK ARRAY WITH ALL THE PLACES THIS DWARF MIGHT GO. */
174
        J=1;
175
        KK=DLOC[I];
176
        KK=KEY[KK];
177
        if(KK == 0) goto L6016;
178
L6012:  NEWLOC=MOD(IABS(TRAVEL[KK])/1000,1000);
179
        {long x = J-1;
180
        if(NEWLOC > 300 || !INDEEP(NEWLOC) || NEWLOC == ODLOC[I] || (J > 1 &&
181
                NEWLOC == TK[x]) || J >= 20 || NEWLOC == DLOC[I] ||
182
                FORCED(NEWLOC) || (I == 6 && CNDBIT(NEWLOC,3)) ||
183
                IABS(TRAVEL[KK])/1000000 == 100) goto L6014;}
184
        TK[J]=NEWLOC;
185
        J=J+1;
186
L6014:  KK=KK+1;
187
        {long x = KK-1; if(TRAVEL[x] >= 0) goto L6012;}
188
L6016:  TK[J]=ODLOC[I];
189
        if(J >= 2)J=J-1;
190
        J=1+RAN(J);
191
        ODLOC[I]=DLOC[I];
192
        DLOC[I]=TK[J];
193
        DSEEN[I]=(DSEEN[I] && INDEEP(LOC)) || (DLOC[I] == LOC || ODLOC[I] == LOC);
194
        if(!DSEEN[I]) goto L6030;
195
        DLOC[I]=LOC;
196
        if(I != 6) goto L6027;
197
 
198
/*  THE PIRATE'S SPOTTED HIM.  HE LEAVES HIM ALONE ONCE WE'VE FOUND CHEST.  K
199
 *  COUNTS IF A TREASURE IS HERE.  IF NOT, AND TALLY=1 FOR AN UNSEEN CHEST, LET
200
 *  THE PIRATE BE SPOTTED.  NOTE THAT PLACE(CHEST)=0 MIGHT MEAN THAT HE'S
201
 *  THROWN IT TO THE TROLL, BUT IN THAT CASE HE'S SEEN THE CHEST (PROP=0). */
202
 
203
        if(LOC == CHLOC || PROP[CHEST] >= 0) goto L6030;
204
        K=0;
205
        /* 6020 */ for (J=50; J<=MAXTRS; J++) {
206
/*  PIRATE WON'T TAKE PYRAMID FROM PLOVER ROOM OR DARK ROOM (TOO EASY!). */
207
        if(J == PYRAM && (LOC == PLAC[PYRAM] || LOC == PLAC[EMRALD])) goto L6020;
208
        if(TOTING(J)) goto L6021;
209
L6020:  if(HERE(J))K=1;
210
        } /* end loop */
211
        if(TALLY == 1 && K == 0 && PLACE[CHEST] == 0 && HERE(LAMP) && PROP[LAMP]
212
                == 1) goto L6025;
213
        if(ODLOC[6] != DLOC[6] && PCT(20))RSPEAK(127);
214
         goto L6030;
215
 
216
L6021:  if(PLACE[CHEST] != 0) goto L6022;
217
/*  INSTALL CHEST ONLY ONCE, TO INSURE IT IS THE LAST TREASURE IN THE LIST. */
218
        MOVE(CHEST,CHLOC);
219
        MOVE(MESSAG,CHLOC2);
220
L6022:  RSPEAK(128);
221
        /* 6023 */ for (J=50; J<=MAXTRS; J++) {
222
        if(J == PYRAM && (LOC == PLAC[PYRAM] || LOC == PLAC[EMRALD])) goto L6023;
223
        if(AT(J) && FIXED[J] == 0)CARRY(J,LOC);
224
        if(TOTING(J))DROP(J,CHLOC);
225
L6023:  /*etc*/ ;
226
        } /* end loop */
227
L6024:  DLOC[6]=CHLOC;
228
        ODLOC[6]=CHLOC;
229
        DSEEN[6]=FALSE;
230
         goto L6030;
231
 
232
L6025:  RSPEAK(186);
233
        MOVE(CHEST,CHLOC);
234
        MOVE(MESSAG,CHLOC2);
235
         goto L6024;
236
 
237
/*  THIS THREATENING LITTLE DWARF IS IN THE ROOM WITH HIM! */
238
 
239
L6027:  DTOTAL=DTOTAL+1;
240
        if(ODLOC[I] != DLOC[I]) goto L6030;
241
        ATTACK=ATTACK+1;
242
        if(KNFLOC >= 0)KNFLOC=LOC;
243
        if(RAN(1000) < 95*(DFLAG-2))STICK=STICK+1;
244
L6030:  /*etc*/ ;
245
        } /* end loop */
246
 
247
/*  NOW WE KNOW WHAT'S HAPPENING.  LET'S TELL THE POOR SUCKER ABOUT IT.
248
 *  NOTE THAT VARIOUS OF THE "KNIFE" MESSAGES MUST HAVE SPECIFIC RELATIVE
249
 *  POSITIONS IN THE RSPEAK DATABASE. */
250
 
251
        if(DTOTAL == 0) goto L2000;
252
        SETPRM(1,DTOTAL,0);
253
        RSPEAK(4+1/DTOTAL);
254
        if(ATTACK == 0) goto L2000;
255
        if(DFLAG == 2)DFLAG=3;
256
        SETPRM(1,ATTACK,0);
257
        K=6;
258
        if(ATTACK > 1)K=250;
259
        RSPEAK(K);
260
        SETPRM(1,STICK,0);
261
        RSPEAK(K+1+2/(1+STICK));
262
        if(STICK == 0) goto L2000;
263
        OLDLC2=LOC;
264
         goto L99;
265
 
266
 
267
 
268
 
269
 
270
 
271
/*  DESCRIBE THE CURRENT LOCATION AND (MAYBE) GET NEXT COMMAND. */
272
 
273
/*  PRINT TEXT FOR CURRENT LOC. */
274
 
275
L2000:  if(LOC == 0) goto L99;
276
        KK=STEXT[LOC];
277
        if(MOD(ABB[LOC],ABBNUM) == 0 || KK == 0)KK=LTEXT[LOC];
278
        if(FORCED(LOC) || !DARK(0)) goto L2001;
279
        if(WZDARK && PCT(35)) goto L90;
280
        KK=RTEXT[16];
281
L2001:  if(TOTING(BEAR))RSPEAK(141);
282
        SPEAK(KK);
283
        K=1;
284
        if(FORCED(LOC)) goto L8;
285
        if(LOC == 33 && PCT(25) && !CLOSNG)RSPEAK(7);
286
 
287
/*  PRINT OUT DESCRIPTIONS OF OBJECTS AT THIS LOCATION.  IF NOT CLOSING AND
288
 *  PROPERTY VALUE IS NEGATIVE, TALLY OFF ANOTHER TREASURE.  RUG IS SPECIAL
289
 *  CASE; ONCE SEEN, ITS PROP IS 1 (DRAGON ON IT) TILL DRAGON IS KILLED.
290
 *  SIMILARLY FOR CHAIN; PROP IS INITIALLY 1 (LOCKED TO BEAR).  THESE HACKS
291
 *  ARE BECAUSE PROP=0 IS NEEDED TO GET FULL SCORE. */
292
 
293
        if(DARK(0)) goto L2012;
294
        ABB[LOC]=ABB[LOC]+1;
295
        I=ATLOC[LOC];
296
L2004:  if(I == 0) goto L2012;
297
        OBJ=I;
298
        if(OBJ > 100)OBJ=OBJ-100;
299
        if(OBJ == STEPS && TOTING(NUGGET)) goto L2008;
300
        if(PROP[OBJ] >= 0) goto L2006;
301
        if(CLOSED) goto L2008;
302
        PROP[OBJ]=0;
303
        if(OBJ == RUG || OBJ == CHAIN)PROP[OBJ]=1;
304
        TALLY=TALLY-1;
305
/*  NOTE: THERE USED TO BE A TEST HERE TO SEE WHETHER THE PLAYER HAD BLOWN IT
306
 *  SO BADLY THAT HE COULD NEVER EVER SEE THE REMAINING TREASURES, AND IF SO
307
 *  THE LAMP WAS ZAPPED TO 35 TURNS.  BUT THE TESTS WERE TOO SIMPLE-MINDED;
308
 *  THINGS LIKE KILLING THE BIRD BEFORE THE SNAKE WAS GONE (CAN NEVER SEE
309
 *  JEWELRY), AND DOING IT "RIGHT" WAS HOPELESS.  E.G., COULD CROSS TROLL
310
 *  BRIDGE SEVERAL TIMES, USING UP ALL AVAILABLE TREASURES, BREAKING VASE,
311
 *  USING COINS TO BUY BATTERIES, ETC., AND EVENTUALLY NEVER BE ABLE TO GET
312
 *  ACROSS AGAIN.  IF BOTTLE WERE LEFT ON FAR SIDE, COULD THEN NEVER GET EGGS
313
 *  OR TRIDENT, AND THE EFFECTS PROPAGATE.  SO THE WHOLE THING WAS FLUSHED.
314
 *  ANYONE WHO MAKES SUCH A GROSS BLUNDER ISN'T LIKELY TO FIND EVERYTHING
315
 *  ELSE ANYWAY (SO GOES THE RATIONALISATION). */
316
L2006:  KK=PROP[OBJ];
317
        if(OBJ == STEPS && LOC == FIXED[STEPS])KK=1;
318
        PSPEAK(OBJ,KK);
319
L2008:  I=LINK[I];
320
         goto L2004;
321
 
322
L2009:  K=54;
323
L2010:  SPK=K;
324
L2011:  RSPEAK(SPK);
325
 
326
L2012:  VERB=0;
327
        OLDOBJ=OBJ;
328
        OBJ=0;
329
 
330
/*  CHECK IF THIS LOC IS ELIGIBLE FOR ANY HINTS.  IF BEEN HERE LONG ENOUGH,
331
 *  BRANCH TO HELP SECTION (ON LATER PAGE).  HINTS ALL COME BACK HERE EVENTUALLY
332
 *  TO FINISH THE LOOP.  IGNORE "HINTS" < 4 (SPECIAL STUFF, SEE DATABASE NOTES).
333
                */
334
 
335
L2600:  if(COND[LOC] < CONDS) goto L2603;
336
        /* 2602 */ for (HINT=1; HINT<=HNTMAX; HINT++) {
337
        if(HINTED[HINT]) goto L2602;
338
        if(!CNDBIT(LOC,HINT+10))HINTLC[HINT]= -1;
339
        HINTLC[HINT]=HINTLC[HINT]+1;
340
        if(HINTLC[HINT] >= HINTS[HINT][1]) goto L40000;
341
L2602:  /*etc*/ ;
342
        } /* end loop */
343
 
344
/*  KICK THE RANDOM NUMBER GENERATOR JUST TO ADD VARIETY TO THE CHASE.  ALSO,
345
 *  IF CLOSING TIME, CHECK FOR ANY OBJECTS BEING TOTED WITH PROP < 0 AND SET
346
 *  THE PROP TO -1-PROP.  THIS WAY OBJECTS WON'T BE DESCRIBED UNTIL THEY'VE
347
 *  BEEN PICKED UP AND PUT DOWN SEPARATE FROM THEIR RESPECTIVE PILES.  DON'T
348
 *  TICK CLOCK1 UNLESS WELL INTO CAVE (AND NOT AT Y2). */
349
 
350
L2603:  if(!CLOSED) goto L2605;
351
        if(PROP[OYSTER] < 0 && TOTING(OYSTER))PSPEAK(OYSTER,1);
352
        /* 2604 */ for (I=1; I<=100; I++) {
353
L2604:  if(TOTING(I) && PROP[I] < 0)PROP[I]= -1-PROP[I];
354
        } /* end loop */
355
L2605:  WZDARK=DARK(0);
356
        if(KNFLOC > 0 && KNFLOC != LOC)KNFLOC=0;
357
        I=RAN(1);
358
        GETIN(WD1,WD1X,WD2,WD2X);
359
 
360
/*  EVERY INPUT, CHECK "FOOBAR" FLAG.  IF ZERO, NOTHING'S GOING ON.  IF POS,
361
 *  MAKE NEG.  IF NEG, HE SKIPPED A WORD, SO MAKE IT ZERO. */
362
 
363
L2607:  FOOBAR=(FOOBAR>0 ? -FOOBAR : 0);
364
        TURNS=TURNS+1;
365
        if(TURNS != THRESH) goto L2608;
366
        SPEAK(TTEXT[TRNDEX]);
367
        TRNLUZ=TRNLUZ+TRNVAL[TRNDEX]/100000;
368
        TRNDEX=TRNDEX+1;
369
        THRESH= -1;
370
        if(TRNDEX <= TRNVLS)THRESH=MOD(TRNVAL[TRNDEX],100000)+1;
371
L2608:  if(VERB == SAY && WD2 > 0)VERB=0;
372
        if(VERB == SAY) goto L4090;
373
        if(TALLY == 0 && INDEEP(LOC) && LOC != 33)CLOCK1=CLOCK1-1;
374
        if(CLOCK1 == 0) goto L10000;
375
        if(CLOCK1 < 0)CLOCK2=CLOCK2-1;
376
        if(CLOCK2 == 0) goto L11000;
377
        if(PROP[LAMP] == 1)LIMIT=LIMIT-1;
378
        if(LIMIT <= 30 && HERE(BATTER) && PROP[BATTER] == 0 && HERE(LAMP)) goto
379
                L12000;
380
        if(LIMIT == 0) goto L12400;
381
        if(LIMIT <= 30) goto L12200;
382
L19999: K=43;
383
        if(LIQLOC(LOC) == WATER)K=70;
384
        V1=VOCAB(WD1,-1);
385
        V2=VOCAB(WD2,-1);
386
        if(V1 == ENTER && (V2 == STREAM || V2 == 1000+WATER)) goto L2010;
387
        if(V1 == ENTER && WD2 > 0) goto L2800;
388
        if((V1 != 1000+WATER && V1 != 1000+OIL) || (V2 != 1000+PLANT && V2 !=
389
                1000+DOOR)) goto L2610;
390
        {long x = V2-1000; if(AT(x))WD2=MAKEWD(16152118);}
391
L2610:  if(V1 == 1000+CAGE && V2 == 1000+BIRD && HERE(CAGE) &&
392
                HERE(BIRD))WD1=MAKEWD(301200308);
393
L2620:  if(WD1 != MAKEWD(23051920)) goto L2625;
394
        IWEST=IWEST+1;
395
        if(IWEST == 10)RSPEAK(17);
396
L2625:  if(WD1 != MAKEWD( 715) || WD2 == 0) goto L2630;
397
        IGO=IGO+1;
398
        if(IGO == 10)RSPEAK(276);
399
L2630:  I=VOCAB(WD1,-1);
400
        if(I == -1) goto L3000;
401
        K=MOD(I,1000);
402
        KQ=I/1000+1;
403
         switch (KQ-1) { case 0: goto L8; case 1: goto L5000; case 2: goto L4000;
404
                case 3: goto L2010; }
405
        BUG(22);
406
 
407
/*  GET SECOND WORD FOR ANALYSIS. */
408
 
409
L2800:  WD1=WD2;
410
        WD1X=WD2X;
411
        WD2=0;
412
         goto L2620;
413
 
414
/*  GEE, I DON'T UNDERSTAND. */
415
 
416
L3000:  SETPRM(1,WD1,WD1X);
417
        RSPEAK(254);
418
         goto L2600;
419
 
420
/* VERB AND OBJECT ANALYSIS MOVED TO SEPARATE MODULE. */
421
 
422
L4000:  I=4000; goto Laction;
423
L4090:  I=4090; goto Laction;
424
L5000:  I=5000;
425
Laction:
426
        switch (action(I)) {
427
           case 2: goto L2;
428
           case 8: goto L8;
429
           case 2000: goto L2000;
430
           case 2009: goto L2009;
431
           case 2010: goto L2010;
432
           case 2011: goto L2011;
433
           case 2012: goto L2012;
434
           case 2600: goto L2600;
435
           case 2607: goto L2607;
436
           case 2630: goto L2630;
437
           case 2800: goto L2800;
438
           case 8000: goto L8000;
439
           case 18999: goto L18999;
440
           case 19000: goto L19000;
441
           }
442
        BUG(99);
443
 
444
/*  RANDOM INTRANSITIVE VERBS COME HERE.  CLEAR OBJ JUST IN CASE (SEE "ATTACK").
445
                */
446
 
447
L8000:  SETPRM(1,WD1,WD1X);
448
        RSPEAK(257);
449
        OBJ=0;
450
        goto L2600;
451
 
452
/*  FIGURE OUT THE NEW LOCATION
453
 *
454
 *  GIVEN THE CURRENT LOCATION IN "LOC", AND A MOTION VERB NUMBER IN "K", PUT
455
 *  THE NEW LOCATION IN "NEWLOC".  THE CURRENT LOC IS SAVED IN "OLDLOC" IN CASE
456
 *  HE WANTS TO RETREAT.  THE CURRENT OLDLOC IS SAVED IN OLDLC2, IN CASE HE
457
 *  DIES.  (IF HE DOES, NEWLOC WILL BE LIMBO, AND OLDLOC WILL BE WHAT KILLED
458
 *  HIM, SO WE NEED OLDLC2, WHICH IS THE LAST PLACE HE WAS SAFE.) */
459
 
460
L8:     KK=KEY[LOC];
461
        NEWLOC=LOC;
462
        if(KK == 0)BUG(26);
463
        if(K == NUL) goto L2;
464
        if(K == BACK) goto L20;
465
        if(K == LOOK) goto L30;
466
        if(K == CAVE) goto L40;
467
        OLDLC2=OLDLOC;
468
        OLDLOC=LOC;
469
 
470
L9:     LL=IABS(TRAVEL[KK]);
471
        if(MOD(LL,1000) == 1 || MOD(LL,1000) == K) goto L10;
472
        if(TRAVEL[KK] < 0) goto L50;
473
        KK=KK+1;
474
         goto L9;
475
 
476
L10:    LL=LL/1000;
477
L11:    NEWLOC=LL/1000;
478
        K=MOD(NEWLOC,100);
479
        if(NEWLOC <= 300) goto L13;
480
        if(PROP[K] != NEWLOC/100-3) goto L16;
481
L12:    if(TRAVEL[KK] < 0)BUG(25);
482
        KK=KK+1;
483
        NEWLOC=IABS(TRAVEL[KK])/1000;
484
        if(NEWLOC == LL) goto L12;
485
        LL=NEWLOC;
486
         goto L11;
487
 
488
L13:    if(NEWLOC <= 100) goto L14;
489
        if(TOTING(K) || (NEWLOC > 200 && AT(K))) goto L16;
490
         goto L12;
491
 
492
L14:    if(NEWLOC != 0 && !PCT(NEWLOC)) goto L12;
493
L16:    NEWLOC=MOD(LL,1000);
494
        if(NEWLOC <= 300) goto L2;
495
        if(NEWLOC <= 500) goto L30000;
496
        RSPEAK(NEWLOC-500);
497
        NEWLOC=LOC;
498
         goto L2;
499
 
500
/*  SPECIAL MOTIONS COME HERE.  LABELLING CONVENTION: STATEMENT NUMBERS NNNXX
501
 *  (XX=00-99) ARE USED FOR SPECIAL CASE NUMBER NNN (NNN=301-500). */
502
 
503
L30000: NEWLOC=NEWLOC-300;
504
         switch (NEWLOC) { case 1: goto L30100; case 2: goto L30200; case 3: goto
505
                L30300; }
506
        BUG(20);
507
 
508
/*  TRAVEL 301.  PLOVER-ALCOVE PASSAGE.  CAN CARRY ONLY EMERALD.  NOTE: TRAVEL
509
 *  TABLE MUST INCLUDE "USELESS" ENTRIES GOING THROUGH PASSAGE, WHICH CAN NEVER
510
 *  BE USED FOR ACTUAL MOTION, BUT CAN BE SPOTTED BY "GO BACK". */
511
 
512
L30100: NEWLOC=99+100-LOC;
513
        if(HOLDNG == 0 || (HOLDNG == 1 && TOTING(EMRALD))) goto L2;
514
        NEWLOC=LOC;
515
        RSPEAK(117);
516
         goto L2;
517
 
518
/*  TRAVEL 302.  PLOVER TRANSPORT.  DROP THE EMERALD (ONLY USE SPECIAL TRAVEL IF
519
 *  TOTING IT), SO HE'S FORCED TO USE THE PLOVER-PASSAGE TO GET IT OUT.  HAVING
520
 *  DROPPED IT, GO BACK AND PRETEND HE WASN'T CARRYING IT AFTER ALL. */
521
 
522
L30200: DROP(EMRALD,LOC);
523
         goto L12;
524
 
525
/*  TRAVEL 303.  TROLL BRIDGE.  MUST BE DONE ONLY AS SPECIAL MOTION SO THAT
526
 *  DWARVES WON'T WANDER ACROSS AND ENCOUNTER THE BEAR.  (THEY WON'T FOLLOW THE
527
 *  PLAYER THERE BECAUSE THAT REGION IS FORBIDDEN TO THE PIRATE.)  IF
528
 *  PROP(TROLL)=1, HE'S CROSSED SINCE PAYING, SO STEP OUT AND BLOCK HIM.
529
 *  (STANDARD TRAVEL ENTRIES CHECK FOR PROP(TROLL)=0.)  SPECIAL STUFF FOR BEAR. */
530
 
531
L30300: if(PROP[TROLL] != 1) goto L30310;
532
        PSPEAK(TROLL,1);
533
        PROP[TROLL]=0;
534
        MOVE(TROLL2,0);
535
        MOVE(TROLL2+100,0);
536
        MOVE(TROLL,PLAC[TROLL]);
537
        MOVE(TROLL+100,FIXD[TROLL]);
538
        JUGGLE(CHASM);
539
        NEWLOC=LOC;
540
         goto L2;
541
 
542
L30310: NEWLOC=PLAC[TROLL]+FIXD[TROLL]-LOC;
543
        if(PROP[TROLL] == 0)PROP[TROLL]=1;
544
        if(!TOTING(BEAR)) goto L2;
545
        RSPEAK(162);
546
        PROP[CHASM]=1;
547
        PROP[TROLL]=2;
548
        DROP(BEAR,NEWLOC);
549
        FIXED[BEAR]= -1;
550
        PROP[BEAR]=3;
551
        OLDLC2=NEWLOC;
552
         goto L99;
553
 
554
/*  END OF SPECIALS. */
555
 
556
/*  HANDLE "GO BACK".  LOOK FOR VERB WHICH GOES FROM LOC TO OLDLOC, OR TO OLDLC2
557
 *  IF OLDLOC HAS FORCED-MOTION.  K2 SAVES ENTRY -> FORCED LOC -> PREVIOUS LOC. */
558
 
559
L20:    K=OLDLOC;
560
        if(FORCED(K))K=OLDLC2;
561
        OLDLC2=OLDLOC;
562
        OLDLOC=LOC;
563
        K2=0;
564
        if(K == LOC)K2=91;
565
        if(CNDBIT(LOC,4))K2=274;
566
        if(K2 == 0) goto L21;
567
        RSPEAK(K2);
568
         goto L2;
569
 
570
L21:    LL=MOD((IABS(TRAVEL[KK])/1000),1000);
571
        if(LL == K) goto L25;
572
        if(LL > 300) goto L22;
573
        J=KEY[LL];
574
        if(FORCED(LL) && MOD((IABS(TRAVEL[J])/1000),1000) == K)K2=KK;
575
L22:    if(TRAVEL[KK] < 0) goto L23;
576
        KK=KK+1;
577
         goto L21;
578
 
579
L23:    KK=K2;
580
        if(KK != 0) goto L25;
581
        RSPEAK(140);
582
         goto L2;
583
 
584
L25:    K=MOD(IABS(TRAVEL[KK]),1000);
585
        KK=KEY[LOC];
586
         goto L9;
587
 
588
/*  LOOK.  CAN'T GIVE MORE DETAIL.  PRETEND IT WASN'T DARK (THOUGH IT MAY "NOW"
589
 *  BE DARK) SO HE WON'T FALL INTO A PIT WHILE STARING INTO THE GLOOM. */
590
 
591
L30:    if(DETAIL < 3)RSPEAK(15);
592
        DETAIL=DETAIL+1;
593
        WZDARK=FALSE;
594
        ABB[LOC]=0;
595
         goto L2;
596
 
597
/*  CAVE.  DIFFERENT MESSAGES DEPENDING ON WHETHER ABOVE GROUND. */
598
 
599
L40:    K=58;
600
        if(OUTSID(LOC) && LOC != 8)K=57;
601
        RSPEAK(K);
602
         goto L2;
603
 
604
/*  NON-APPLICABLE MOTION.  VARIOUS MESSAGES DEPENDING ON WORD GIVEN. */
605
 
606
L50:    SPK=12;
607
        if(K >= 43 && K <= 50)SPK=52;
608
        if(K == 29 || K == 30)SPK=52;
609
        if(K == 7 || K == 36 || K == 37)SPK=10;
610
        if(K == 11 || K == 19)SPK=11;
611
        if(VERB == FIND || VERB == INVENT)SPK=59;
612
        if(K == 62 || K == 65)SPK=42;
613
        if(K == 17)SPK=80;
614
        RSPEAK(SPK);
615
         goto L2;
616
 
617
 
618
 
619
 
620
 
621
/*  "YOU'RE DEAD, JIM."
622
 *
623
 *  IF THE CURRENT LOC IS ZERO, IT MEANS THE CLOWN GOT HIMSELF KILLED.  WE'LL
624
 *  ALLOW THIS MAXDIE TIMES.  MAXDIE IS AUTOMATICALLY SET BASED ON THE NUMBER OF
625
 *  SNIDE MESSAGES AVAILABLE.  EACH DEATH RESULTS IN A MESSAGE (81, 83, ETC.)
626
 *  WHICH OFFERS REINCARNATION; IF ACCEPTED, THIS RESULTS IN MESSAGE 82, 84,
627
 *  ETC.  THE LAST TIME, IF HE WANTS ANOTHER CHANCE, HE GETS A SNIDE REMARK AS
628
 *  WE EXIT.  WHEN REINCARNATED, ALL OBJECTS BEING CARRIED GET DROPPED AT OLDLC2
629
 *  (PRESUMABLY THE LAST PLACE PRIOR TO BEING KILLED) WITHOUT CHANGE OF PROPS.
630
 *  THE LOOP RUNS BACKWARDS TO ASSURE THAT THE BIRD IS DROPPED BEFORE THE CAGE.
631
 *  (THIS KLUGE COULD BE CHANGED ONCE WE'RE SURE ALL REFERENCES TO BIRD AND CAGE
632
 *  ARE DONE BY KEYWORDS.)  THE LAMP IS A SPECIAL CASE (IT WOULDN'T DO TO LEAVE
633
 *  IT IN THE CAVE).  IT IS TURNED OFF AND LEFT OUTSIDE THE BUILDING (ONLY IF HE
634
 *  WAS CARRYING IT, OF COURSE).  HE HIMSELF IS LEFT INSIDE THE BUILDING (AND
635
 *  HEAVEN HELP HIM IF HE TRIES TO XYZZY BACK INTO THE CAVE WITHOUT THE LAMP!).
636
 *  OLDLOC IS ZAPPED SO HE CAN'T JUST "RETREAT". */
637
 
638
/*  THE EASIEST WAY TO GET KILLED IS TO FALL INTO A PIT IN PITCH DARKNESS. */
639
 
640
L90:    RSPEAK(23);
641
        OLDLC2=LOC;
642
 
643
/*  OKAY, HE'S DEAD.  LET'S GET ON WITH IT. */
644
 
645
L99:    if(CLOSNG) goto L95;
646
        NUMDIE=NUMDIE+1;
647
        if(!YES(79+NUMDIE*2,80+NUMDIE*2,54)) score(0);
648
        if(NUMDIE == MAXDIE) score(0);
649
        PLACE[WATER]=0;
650
        PLACE[OIL]=0;
651
        if(TOTING(LAMP))PROP[LAMP]=0;
652
        /* 98 */ for (J=1; J<=100; J++) {
653
        I=101-J;
654
        if(!TOTING(I)) goto L98;
655
        K=OLDLC2;
656
        if(I == LAMP)K=1;
657
        DROP(I,K);
658
L98:    /*etc*/ ;
659
        } /* end loop */
660
        LOC=3;
661
        OLDLOC=LOC;
662
         goto L2000;
663
 
664
/*  HE DIED DURING CLOSING TIME.  NO RESURRECTION.  TALLY UP A DEATH AND EXIT. */
665
 
666
L95:    RSPEAK(131);
667
        NUMDIE=NUMDIE+1;
668
         score(0);
669
 
670
 
671
 
672
 
673
/*  HINTS */
674
 
675
/*  COME HERE IF HE'S BEEN LONG ENOUGH AT REQUIRED LOC(S) FOR SOME UNUSED HINT.
676
 *  HINT NUMBER IS IN VARIABLE "HINT".  BRANCH TO QUICK TEST FOR ADDITIONAL
677
 *  CONDITIONS, THEN COME BACK TO DO NEAT STUFF.  GOTO 40010 IF CONDITIONS ARE
678
 *  MET AND WE WANT TO OFFER THE HINT.  GOTO 40020 TO CLEAR HINTLC BACK TO ZERO,
679
 *  40030 TO TAKE NO ACTION YET. */
680
 
681
L40000:    switch (HINT-1) { case 0: goto L40100; case 1: goto L40200; case 2: goto
682
                L40300; case 3: goto L40400; case 4: goto L40500; case 5: goto
683
                L40600; case 6: goto L40700; case 7: goto L40800; case 8: goto
684
                L40900; case 9: goto L41000; }
685
/*              CAVE  BIRD  SNAKE MAZE  DARK  WITT  URN   WOODS OGRE
686
 *              JADE */
687
        BUG(27);
688
 
689
L40010: HINTLC[HINT]=0;
690
        if(!YES(HINTS[HINT][3],0,54)) goto L2602;
691
        SETPRM(1,HINTS[HINT][2],HINTS[HINT][2]);
692
        RSPEAK(261);
693
        HINTED[HINT]=YES(175,HINTS[HINT][4],54);
694
        if(HINTED[HINT] && LIMIT > 30)LIMIT=LIMIT+30*HINTS[HINT][2];
695
L40020: HINTLC[HINT]=0;
696
L40030:  goto L2602;
697
 
698
/*  NOW FOR THE QUICK TESTS.  SEE DATABASE DESCRIPTION FOR ONE-LINE NOTES. */
699
 
700
L40100: if(PROP[GRATE] == 0 && !HERE(KEYS)) goto L40010;
701
         goto L40020;
702
 
703
L40200: if(PLACE[BIRD] == LOC && TOTING(ROD) && OLDOBJ == BIRD) goto L40010;
704
         goto L40030;
705
 
706
L40300: if(HERE(SNAKE) && !HERE(BIRD)) goto L40010;
707
         goto L40020;
708
 
709
L40400: if(ATLOC[LOC] == 0 && ATLOC[OLDLOC] == 0 && ATLOC[OLDLC2] == 0 && HOLDNG >
710
                1) goto L40010;
711
         goto L40020;
712
 
713
L40500: if(PROP[EMRALD] != -1 && PROP[PYRAM] == -1) goto L40010;
714
         goto L40020;
715
 
716
L40600:  goto L40010;
717
 
718
L40700: if(DFLAG == 0) goto L40010;
719
         goto L40020;
720
 
721
L40800: if(ATLOC[LOC] == 0 && ATLOC[OLDLOC] == 0 && ATLOC[OLDLC2] == 0) goto
722
                L40010;
723
         goto L40030;
724
 
725
L40900: I=ATDWRF(LOC);
726
        if(I < 0) goto L40020;
727
        if(HERE(OGRE) && I == 0) goto L40010;
728
         goto L40030;
729
 
730
L41000: if(TALLY == 1 && PROP[JADE] < 0) goto L40010;
731
         goto L40020;
732
 
733
 
734
 
735
 
736
 
737
/*  CAVE CLOSING AND SCORING */
738
 
739
 
740
/*  THESE SECTIONS HANDLE THE CLOSING OF THE CAVE.  THE CAVE CLOSES "CLOCK1"
741
 *  TURNS AFTER THE LAST TREASURE HAS BEEN LOCATED (INCLUDING THE PIRATE'S
742
 *  CHEST, WHICH MAY OF COURSE NEVER SHOW UP).  NOTE THAT THE TREASURES NEED NOT
743
 *  HAVE BEEN TAKEN YET, JUST LOCATED.  HENCE CLOCK1 MUST BE LARGE ENOUGH TO GET
744
 *  OUT OF THE CAVE (IT ONLY TICKS WHILE INSIDE THE CAVE).  WHEN IT HITS ZERO,
745
 *  WE BRANCH TO 10000 TO START CLOSING THE CAVE, AND THEN SIT BACK AND WAIT FOR
746
 *  HIM TO TRY TO GET OUT.  IF HE DOESN'T WITHIN CLOCK2 TURNS, WE CLOSE THE
747
 *  CAVE; IF HE DOES TRY, WE ASSUME HE PANICS, AND GIVE HIM A FEW ADDITIONAL
748
 *  TURNS TO GET FRANTIC BEFORE WE CLOSE.  WHEN CLOCK2 HITS ZERO, WE BRANCH TO
749
 *  11000 TO TRANSPORT HIM INTO THE FINAL PUZZLE.  NOTE THAT THE PUZZLE DEPENDS
750
 *  UPON ALL SORTS OF RANDOM THINGS.  FOR INSTANCE, THERE MUST BE NO WATER OR
751
 *  OIL, SINCE THERE ARE BEANSTALKS WHICH WE DON'T WANT TO BE ABLE TO WATER,
752
 *  SINCE THE CODE CAN'T HANDLE IT.  ALSO, WE CAN HAVE NO KEYS, SINCE THERE IS A
753
 *  GRATE (HAVING MOVED THE FIXED OBJECT!) THERE SEPARATING HIM FROM ALL THE
754
 *  TREASURES.  MOST OF THESE PROBLEMS ARISE FROM THE USE OF NEGATIVE PROP
755
 *  NUMBERS TO SUPPRESS THE OBJECT DESCRIPTIONS UNTIL HE'S ACTUALLY MOVED THE
756
 *  OBJECTS. */
757
 
758
/*  WHEN THE FIRST WARNING COMES, WE LOCK THE GRATE, DESTROY THE BRIDGE, KILL
759
 *  ALL THE DWARVES (AND THE PIRATE), REMOVE THE TROLL AND BEAR (UNLESS DEAD),
760
 *  AND SET "CLOSNG" TO TRUE.  LEAVE THE DRAGON; TOO MUCH TROUBLE TO MOVE IT.
761
 *  FROM NOW UNTIL CLOCK2 RUNS OUT, HE CANNOT UNLOCK THE GRATE, MOVE TO ANY
762
 *  LOCATION OUTSIDE THE CAVE, OR CREATE THE BRIDGE.  NOR CAN HE BE
763
 *  RESURRECTED IF HE DIES.  NOTE THAT THE SNAKE IS ALREADY GONE, SINCE HE GOT
764
 *  TO THE TREASURE ACCESSIBLE ONLY VIA THE HALL OF THE MT. KING.  ALSO, HE'S
765
 *  BEEN IN GIANT ROOM (TO GET EGGS), SO WE CAN REFER TO IT.  ALSO ALSO, HE'S
766
 *  GOTTEN THE PEARL, SO WE KNOW THE BIVALVE IS AN OYSTER.  *AND*, THE DWARVES
767
 *  MUST HAVE BEEN ACTIVATED, SINCE WE'VE FOUND CHEST. */
768
 
769
L10000: PROP[GRATE]=0;
770
        PROP[FISSUR]=0;
771
        /* 10010 */ for (I=1; I<=6; I++) {
772
        DSEEN[I]=FALSE;
773
L10010: DLOC[I]=0;
774
        } /* end loop */
775
        MOVE(TROLL,0);
776
        MOVE(TROLL+100,0);
777
        MOVE(TROLL2,PLAC[TROLL]);
778
        MOVE(TROLL2+100,FIXD[TROLL]);
779
        JUGGLE(CHASM);
780
        if(PROP[BEAR] != 3)DSTROY(BEAR);
781
        PROP[CHAIN]=0;
782
        FIXED[CHAIN]=0;
783
        PROP[AXE]=0;
784
        FIXED[AXE]=0;
785
        RSPEAK(129);
786
        CLOCK1= -1;
787
        CLOSNG=TRUE;
788
         goto L19999;
789
 
790
/*  ONCE HE'S PANICKED, AND CLOCK2 HAS RUN OUT, WE COME HERE TO SET UP THE
791
 *  STORAGE ROOM.  THE ROOM HAS TWO LOCS, HARDWIRED AS 115 (NE) AND 116 (SW).
792
 *  AT THE NE END, WE PLACE EMPTY BOTTLES, A NURSERY OF PLANTS, A BED OF
793
 *  OYSTERS, A PILE OF LAMPS, RODS WITH STARS, SLEEPING DWARVES, AND HIM.  AT
794
 *  THE SW END WE PLACE GRATE OVER TREASURES, SNAKE PIT, COVEY OF CAGED BIRDS,
795
 *  MORE RODS, AND PILLOWS.  A MIRROR STRETCHES ACROSS ONE WALL.  MANY OF THE
796
 *  OBJECTS COME FROM KNOWN LOCATIONS AND/OR STATES (E.G. THE SNAKE IS KNOWN TO
797
 *  HAVE BEEN DESTROYED AND NEEDN'T BE CARRIED AWAY FROM ITS OLD "PLACE"),
798
 *  MAKING THE VARIOUS OBJECTS BE HANDLED DIFFERENTLY.  WE ALSO DROP ALL OTHER
799
 *  OBJECTS HE MIGHT BE CARRYING (LEST HE HAVE SOME WHICH COULD CAUSE TROUBLE,
800
 *  SUCH AS THE KEYS).  WE DESCRIBE THE FLASH OF LIGHT AND TRUNDLE BACK. */
801
 
802
L11000: PROP[BOTTLE]=PUT(BOTTLE,115,1);
803
        PROP[PLANT]=PUT(PLANT,115,0);
804
        PROP[OYSTER]=PUT(OYSTER,115,0);
805
        OBJTXT[OYSTER]=3;
806
        PROP[LAMP]=PUT(LAMP,115,0);
807
        PROP[ROD]=PUT(ROD,115,0);
808
        PROP[DWARF]=PUT(DWARF,115,0);
809
        LOC=115;
810
        OLDLOC=115;
811
        NEWLOC=115;
812
 
813
/*  LEAVE THE GRATE WITH NORMAL (NON-NEGATIVE) PROPERTY.  REUSE SIGN. */
814
 
815
        I=PUT(GRATE,116,0);
816
        I=PUT(SIGN,116,0);
817
        OBJTXT[SIGN]=OBJTXT[SIGN]+1;
818
        PROP[SNAKE]=PUT(SNAKE,116,1);
819
        PROP[BIRD]=PUT(BIRD,116,1);
820
        PROP[CAGE]=PUT(CAGE,116,0);
821
        PROP[ROD2]=PUT(ROD2,116,0);
822
        PROP[PILLOW]=PUT(PILLOW,116,0);
823
 
824
        PROP[MIRROR]=PUT(MIRROR,115,0);
825
        FIXED[MIRROR]=116;
826
 
827
        /* 11010 */ for (I=1; I<=100; I++) {
828
L11010: if(TOTING(I))DSTROY(I);
829
        } /* end loop */
830
 
831
        RSPEAK(132);
832
        CLOSED=TRUE;
833
         goto L2;
834
 
835
/*  ANOTHER WAY WE CAN FORCE AN END TO THINGS IS BY HAVING THE LAMP GIVE OUT.
836
 *  WHEN IT GETS CLOSE, WE COME HERE TO WARN HIM.  WE GO TO 12000 IF THE LAMP
837
 *  AND FRESH BATTERIES ARE HERE, IN WHICH CASE WE REPLACE THE BATTERIES AND
838
 *  CONTINUE.  12200 IS FOR OTHER CASES OF LAMP DYING.  12400 IS WHEN IT GOES
839
 *  OUT.  EVEN THEN, HE CAN EXPLORE OUTSIDE FOR A WHILE IF DESIRED. */
840
 
841
L12000: RSPEAK(188);
842
        PROP[BATTER]=1;
843
        if(TOTING(BATTER))DROP(BATTER,LOC);
844
        LIMIT=LIMIT+2500;
845
        LMWARN=FALSE;
846
         goto L19999;
847
 
848
L12200: if(LMWARN || !HERE(LAMP)) goto L19999;
849
        LMWARN=TRUE;
850
        SPK=187;
851
        if(PLACE[BATTER] == 0)SPK=183;
852
        if(PROP[BATTER] == 1)SPK=189;
853
        RSPEAK(SPK);
854
         goto L19999;
855
 
856
L12400: LIMIT= -1;
857
        PROP[LAMP]=0;
858
        if(HERE(LAMP))RSPEAK(184);
859
         goto L19999;
860
 
861
/*  OH DEAR, HE'S DISTURBED THE DWARVES. */
862
 
863
L18999: RSPEAK(SPK);
864
L19000: RSPEAK(136);
865
        score(0);
866
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.