1: #
   2: /*      Re-coding of advent in C: subroutines from main                 */
   3: 
   4: static char sccsid[] = "	subr.c	4.1	82/05/11	";
   5: 
   6: # include "hdr.h"
   7: 
   8: /*              Statement functions     */
   9: toting(objj)
  10: int objj;
  11: {       if (place[objj] == -1) return(TRUE);
  12:     else return(FALSE);
  13: }
  14: 
  15: here(objj)
  16: int objj;
  17: {       if (place[objj]==loc || toting(objj)) return(TRUE);
  18:     else return(FALSE);
  19: }
  20: 
  21: at(objj)
  22: int objj;
  23: {       if (place[objj]==loc || fixed[objj]==loc) return(TRUE);
  24:     else return (FALSE);
  25: }
  26: 
  27: liq2(pbotl)
  28: int pbotl;
  29: {       return((1-pbotl)*water+(pbotl/2)*(water+oil));
  30: }
  31: 
  32: liq(foo)
  33: {       register int i;
  34:     i=prop[bottle];
  35:     if (i>-1-i) return(liq2(i));
  36:     else return(liq2(-1-i));
  37: }
  38: 
  39: liqloc(locc)     /* may want to clean this one up a bit */
  40: int locc;
  41: {       register int i,j,l;
  42:     i=cond[locc]/2;
  43:     j=((i*2)%8)-5;
  44:     l=cond[locc]/4;
  45:     l=l%2;
  46:     return(liq2(j*l+1));
  47: }
  48: 
  49: bitset(l,n)
  50: int l,n;
  51: {       if (cond[l] & setbit[n]) return(TRUE);
  52:     return(FALSE);
  53: }
  54: 
  55: forced(locc)
  56: int locc;
  57: {       if (cond[locc]==2) return(TRUE);
  58:     return(FALSE);
  59: }
  60: 
  61: dark(foo)
  62: {       if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp)))
  63:         return(TRUE);
  64:     return(FALSE);
  65: }
  66: 
  67: pct(n)
  68: int n;
  69: {       if (ran(100)<n) return(TRUE);
  70:     return(FALSE);
  71: }
  72: 
  73: 
  74: fdwarf()        /* 71 */
  75: {   register int i,j;
  76:     register struct travlist *kk;
  77: 
  78:     if (newloc!=loc&&!forced(loc)&&!bitset(loc,3))
  79:     {   for (i=1; i<=5; i++)
  80:         {   if (odloc[i]!=newloc||!dseen[i]) continue;
  81:             newloc=loc;
  82:             rspeak(2);
  83:             break;
  84:         }
  85:     }
  86:     loc=newloc;         /* 74 */
  87:     if (loc==0||forced(loc)||bitset(newloc,3)) return(2000);
  88:     if (dflag==0)
  89:     {   if (loc>=15) dflag=1;
  90:         return(2000);
  91:     }
  92:     if (dflag==1)       /* 6000 */
  93:     {   if (loc<15||pct(95)) return(2000);
  94:         dflag=2;
  95:         for (i=1; i<=2; i++)
  96:         {   j=1+ran(5);
  97:             if (pct(50)&&saved== -1) dloc[j]=0; /* 6001 */
  98:         }
  99:         for (i=1; i<=5; i++)
 100:         {   if (dloc[i]==loc) dloc[i]=daltlc;
 101:             odloc[i]=dloc[i];       /* 6002 */
 102:         }
 103:         rspeak(3);
 104:         drop(axe,loc);
 105:         return(2000);
 106:     }
 107:     dtotal=attack=stick=0;          /* 6010 */
 108:     for (i=1; i<=6; i++)                    /* loop to 6030 */
 109:     {   if (dloc[i]==0) continue;
 110:         j=1;
 111:         for (kk=travel[dloc[i]]; kk!=0; kk=kk->next)
 112:         {   newloc=kk->tloc;
 113:             if (newloc>300||newloc<15||newloc==odloc[i]
 114:                 ||(j>1&&newloc==tk[j-1])||j>=20
 115:                 ||newloc==dloc[i]||forced(newloc)
 116:                 ||(i==6&&bitset(newloc,3))
 117:                 ||kk->conditions==100) continue;
 118:             tk[j++]=newloc;
 119:         }
 120:         tk[j]=odloc[i];                 /* 6016 */
 121:         if (j>=2) j--;
 122:         j=1+ran(j);
 123:         odloc[i]=dloc[i];
 124:         dloc[i]=tk[j];
 125:         dseen[i]=(dseen[i]&&loc>=15)||(dloc[i]==loc||odloc[i]==loc);
 126:         if (!dseen[i]) continue;        /* i.e. goto 6030 */
 127:         dloc[i]=loc;
 128:         if (i==6)                       /* pirate's spotted him */
 129:         {       if (loc==chloc||prop[chest]>=0) continue;
 130:             k=0;
 131:             for (j=50; j<=maxtrs; j++)      /* loop to 6020 */
 132:             {       if (j==pyram&&(loc==plac[pyram]
 133:                      || loc==plac[emrald])) goto l6020;
 134:                 if (toting(j)) goto l6022;
 135:             l6020:  if (here(j)) k=1;
 136:             }                               /* 6020 */
 137:             if (tally==tally2+1 && k==0 && place[chest]==0
 138:                 &&here(lamp) && prop[lamp]==1) goto l6025;
 139:             if (odloc[6]!=dloc[6]&&pct(20))
 140:                 rspeak(127);
 141:             continue;       /* to 6030 */
 142:         l6022:  rspeak(128);
 143:             if (place[messag]==0) move(chest,chloc);
 144:             move(messag,chloc2);
 145:             for (j=50; j<=maxtrs; j++)      /* loop to 6023 */
 146:             {       if (j==pyram && (loc==plac[pyram]
 147:                     || loc==plac[emrald])) continue;
 148:                 if (at(j)&&fixed[j]==0) carry(j,loc);
 149:                 if (toting(j)) drop(j,chloc);
 150:             }
 151:         l6024:  dloc[6]=odloc[6]=chloc;
 152:             dseen[6]=FALSE;
 153:             continue;
 154:         l6025:  rspeak(186);
 155:             move(chest,chloc);
 156:             move(messag,chloc2);
 157:             goto l6024;
 158:         }
 159:         dtotal++;                       /* 6027 */
 160:         if (odloc[i]!=dloc[i]) continue;
 161:         attack++;
 162:         if (knfloc>=0) knfloc=loc;
 163:         if (ran(1000)<95*(dflag-2)) stick++;
 164:     }                                       /* 6030 */
 165:     if (dtotal==0) return(2000);
 166:     if (dtotal!=1)
 167:     {       printf("There are %d threatening little dwarves ",dtotal);
 168:         printf("in the room with you.\n");
 169:     }
 170:     else rspeak(4);
 171:     if (attack==0) return(2000);
 172:     if (dflag==2) dflag=3;
 173:     if (saved!= -1) dflag=20;
 174:     if (attack!=1)
 175:     {       printf("%d of them throw knives at you!\n",attack);
 176:         k=6;
 177:     l82:    if (stick<=1)                   /* 82 */
 178:         {       rspeak(k+stick);
 179:             if (stick==0) return(2000);
 180:         }
 181:         else
 182:             printf("%d of them get you!\n",stick);  /* 83 */
 183:         oldlc2=loc;
 184:         return(99);
 185:     }
 186:     rspeak(5);
 187:     k=52;
 188:     goto l82;
 189: }
 190: 
 191: 
 192: march()                                        /* label 8              */
 193: {       register int ll1,ll2;
 194: 
 195:     if ((tkk=travel[newloc=loc])==0) bug(26);
 196:     if (k==null) return(2);
 197:     if (k==cave)                            /* 40                   */
 198:     {       if (loc<8) rspeak(57);
 199:         if (loc>=8) rspeak(58);
 200:         return(2);
 201:     }
 202:     if (k==look)                            /* 30                   */
 203:     {       if (detail++<3) rspeak(15);
 204:         wzdark=FALSE;
 205:         abb[loc]=0;
 206:         return(2);
 207:     }
 208:     if (k==back)                            /* 20                   */
 209:     {       switch(mback())
 210:         {       case 2: return(2);
 211:             case 9: goto l9;
 212:             default: bug(100);
 213:         }
 214:     }
 215:     oldlc2=oldloc;
 216:     oldloc=loc;
 217: l9:
 218:     for (; tkk!=0; tkk=tkk->next)
 219:         if (tkk->tverb==1 || tkk->tverb==k) break;
 220:     if (tkk==0)
 221:     {       badmove();
 222:         return(2);
 223:     }
 224: l11:    ll1=tkk->conditions;                    /* 11                   */
 225:     ll2=tkk->tloc;
 226:     newloc=ll1;                             /* newloc=conditions    */
 227:     k=newloc%100;                           /* k used for prob      */
 228:     if (newloc<=300)
 229:     {       if (newloc<=100)                /* 13                   */
 230:         {       if (newloc!=0&&!pct(newloc)) goto l12;  /* 14   */
 231:         l16:    newloc=ll2;             /* newloc=location      */
 232:             if (newloc<=300) return(2);
 233:             if (newloc<=500)
 234:                 switch(specials())/* to 30000           */
 235:                 {   case 2: return(2);
 236:                     case 12: goto l12;
 237:                     case 99: return(99);
 238:                     default: bug(101);
 239:                 }
 240:             rspeak(newloc-500);
 241:             newloc=loc;
 242:             return(2);
 243:         }
 244:         if (toting(k)||(newloc>200&&at(k))) goto l16;
 245:         goto l12;
 246:     }
 247:     if (prop[k]!=(newloc/100)-3) goto l16;  /* newloc still conditions*/
 248: l12:    /* alternative to probability move      */
 249:     for (; tkk!=0; tkk=tkk->next)
 250:         if (tkk->tloc!=ll2 || tkk->conditions!=ll1) break;
 251:     if (tkk==0) bug(25);
 252:     goto l11;
 253: }
 254: 
 255: 
 256: 
 257: mback()                                         /* 20                   */
 258: {       register struct travlist *tk2,*j;
 259:     register int ll;
 260:     if (forced(k=oldloc)) k=oldlc2;         /* k=location           */
 261:     oldlc2=oldloc;
 262:     oldloc=loc;
 263:     tk2=0;
 264:     if (k==loc)
 265:     {       rspeak(91);
 266:         return(2);
 267:     }
 268:     for (; tkk!=0; tkk=tkk->next)           /* 21                   */
 269:     {       ll=tkk->tloc;
 270:         if (ll==k)
 271:         {       k=tkk->tverb;           /* k back to verb       */
 272:             tkk=travel[loc];
 273:             return(9);
 274:         }
 275:         if (ll<=300)
 276:         {       j=travel[loc];
 277:             if (forced(ll) && k==j->tloc) tk2=tkk;
 278:         }
 279:     }
 280:     tkk=tk2;                                /* 23                   */
 281:     if (tkk!=0)
 282:     {       k=tkk->tverb;
 283:         tkk=travel[loc];
 284:         return(9);
 285:     }
 286:     rspeak(140);
 287:     return(2);
 288: }
 289: 
 290: 
 291: specials()                                      /* 30000                */
 292: {       switch(newloc -= 300)
 293:     {   case 1:                             /* 30100                */
 294:         newloc = 99+100-loc;
 295:         if (holdng==0||(holdng==1&&toting(emrald))) return(2);
 296:         newloc=loc;
 297:         rspeak(117);
 298:         return(2);
 299:         case 2:                             /* 30200                */
 300:         drop(emrald,loc);
 301:         return(12);
 302:         case 3:                             /* to 30300             */
 303:         return(trbridge());
 304:         default: bug(29);
 305:     }
 306: }
 307: 
 308: 
 309: trbridge()                                      /* 30300                */
 310: {       if (prop[troll]==1)
 311:     {       pspeak(troll,1);
 312:         prop[troll]=0;
 313:         move(troll2,0);
 314:         move(troll2+100,0);
 315:         move(troll,plac[troll]);
 316:         move(troll+100,fixd[troll]);
 317:         juggle(chasm);
 318:         newloc=loc;
 319:         return(2);
 320:     }
 321:     newloc=plac[troll]+fixd[troll]-loc;     /* 30310                */
 322:     if (prop[troll]==0) prop[troll]=1;
 323:     if (!toting(bear)) return(2);
 324:     rspeak(162);
 325:     prop[chasm]=1;
 326:     prop[troll]=2;
 327:     drop(bear,newloc);
 328:     fixed[bear] = -1;
 329:     prop[bear]=3;
 330:     if (prop[spices]<0) tally2++;
 331:     oldlc2=newloc;
 332:     return(99);
 333: }
 334: 
 335: 
 336: badmove()                                       /* 20                   */
 337: {       spk=12;
 338:     if (k>=43 && k<=50) spk=9;
 339:     if (k==29||k==30) spk=9;
 340:     if (k==7||k==36||k==37) spk=10;
 341:     if (k==11||k==19) spk=11;
 342:     if (verb==find||verb==invent) spk=59;
 343:     if (k==62||k==65) spk=42;
 344:     if (k==17) spk=80;
 345:     rspeak(spk);
 346:     return(2);
 347: }
 348: 
 349: bug(n)
 350: int n;
 351: {       printf("Please tell jim@rand-unix that fatal bug %d happened.\n",n);
 352:     exit(0);
 353: }
 354: 
 355: 
 356: checkhints()                                    /* 2600 &c              */
 357: {       register int hint;
 358:     for (hint=4; hint<=hntmax; hint++)
 359:     {       if (hinted[hint]) continue;
 360:         if (!bitset(loc,hint)) hintlc[hint]= -1;
 361:         hintlc[hint]++;
 362:         if (hintlc[hint]<hints[hint][1]) continue;
 363:         switch(hint)
 364:         {   case 4:     /* 40400 */
 365:             if (prop[grate]==0&&!here(keys)) goto l40010;
 366:             goto l40020;
 367:             case 5:     /* 40500 */
 368:             if (here(bird)&&toting(rod)&&obj==bird) goto l40010;
 369:             continue;      /* i.e. goto l40030 */
 370:             case 6:     /* 40600 */
 371:             if (here(snake)&&!here(bird)) goto l40010;
 372:             goto l40020;
 373:             case 7:     /* 40700 */
 374:             if (atloc[loc]==0&&atloc[oldloc]==0
 375:                 && atloc[oldlc2]==0&&holdng>1) goto l40010;
 376:             goto l40020;
 377:             case 8:     /* 40800 */
 378:             if (prop[emrald]!= -1&&prop[pyram]== -1) goto l40010;
 379:             goto l40020;
 380:             case 9:
 381:             goto l40010;    /* 40900 */
 382:             default: bug(27);
 383:         }
 384:     l40010: hintlc[hint]=0;
 385:         if (!yes(hints[hint][3],0,54)) continue;
 386:         printf("I am prepared to give you a hint, but it will ");
 387:         printf("cost you %d points.\n",hints[hint][2]);
 388:         hinted[hint]=yes(175,hints[hint][4],54);
 389:     l40020: hintlc[hint]=0;
 390:     }
 391: }
 392: 
 393: 
 394: trsay()                                         /* 9030                 */
 395: {       register int i;
 396:     if (*wd2!=0) copystr(wd2,wd1);
 397:     i=vocab(wd1,-1);
 398:     if (i==62||i==65||i==71||i==2025)
 399:     {       *wd2=0;
 400:         obj=0;
 401:         return(2630);
 402:     }
 403:     printf("\nOkay, \"%s\".\n",wd2);
 404:     return(2012);
 405: }
 406: 
 407: 
 408: trtake()                                        /* 9010                 */
 409: {       register int i;
 410:     if (toting(obj)) return(2011);  /* 9010 */
 411:     spk=25;
 412:     if (obj==plant&&prop[plant]<=0) spk=115;
 413:     if (obj==bear&&prop[bear]==1) spk=169;
 414:     if (obj==chain&&prop[bear]!=0) spk=170;
 415:     if (fixed[obj]!=0) return(2011);
 416:     if (obj==water||obj==oil)
 417:     {       if (here(bottle)&&liq(0)==obj)
 418:         {       obj=bottle;
 419:             goto l9017;
 420:         }
 421:         obj=bottle;
 422:         if (toting(bottle)&&prop[bottle]==1)
 423:             return(9220);
 424:         if (prop[bottle]!=1) spk=105;
 425:         if (!toting(bottle)) spk=104;
 426:         return(2011);
 427:     }
 428: l9017:  if (holdng>=7)
 429:     {       rspeak(92);
 430:         return(2012);
 431:     }
 432:     if (obj==bird)
 433:     {       if (prop[bird]!=0) goto l9014;
 434:         if (toting(rod))
 435:         {       rspeak(26);
 436:             return(2012);
 437:         }
 438:         if (!toting(cage))      /* 9013 */
 439:         {       rspeak(27);
 440:             return(2012);
 441:         }
 442:         prop[bird]=1;           /* 9015 */
 443:     }
 444: l9014:  if ((obj==bird||obj==cage)&&prop[bird]!=0)
 445:         carry(bird+cage-obj,loc);
 446:     carry(obj,loc);
 447:     k=liq(0);
 448:     if (obj==bottle && k!=0) place[k] = -1;
 449:     return(2009);
 450: }
 451: 
 452: 
 453: dropper()                                       /* 9021                 */
 454: {       k=liq(0);
 455:     if (k==obj) obj=bottle;
 456:     if (obj==bottle&&k!=0) place[k]=0;
 457:     if (obj==cage&&prop[bird]!=0) drop(bird,loc);
 458:     if (obj==bird) prop[bird]=0;
 459:     drop(obj,loc);
 460:     return(2012);
 461: }
 462: 
 463: trdrop()                                        /* 9020                 */
 464: {
 465:     if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
 466:     if (!toting(obj)) return(2011);
 467:     if (obj==bird&&here(snake))
 468:     {       rspeak(30);
 469:         if (closed) return(19000);
 470:         dstroy(snake);
 471:         prop[snake]=1;
 472:         return(dropper());
 473:     }
 474:     if (obj==coins&&here(vend))             /* 9024                 */
 475:     {       dstroy(coins);
 476:         drop(batter,loc);
 477:         pspeak(batter,0);
 478:         return(2012);
 479:     }
 480:     if (obj==bird&&at(dragon)&&prop[dragon]==0)     /* 9025         */
 481:     {       rspeak(154);
 482:         dstroy(bird);
 483:         prop[bird]=0;
 484:         if (place[snake]==plac[snake]) tally2--;
 485:         return(2012);
 486:     }
 487:     if (obj==bear&&at(troll))               /* 9026                 */
 488:     {       rspeak(163);
 489:         move(troll,0);
 490:         move(troll+100,0);
 491:         move(troll2,plac[troll]);
 492:         move(troll2+100,fixd[troll]);
 493:         juggle(chasm);
 494:         prop[troll]=2;
 495:         return(dropper());
 496:     }
 497:     if (obj!=vase||loc==plac[pillow])       /* 9027                 */
 498:     {       rspeak(54);
 499:         return(dropper());
 500:     }
 501:     prop[vase]=2;                           /* 9028                 */
 502:     if (at(pillow)) prop[vase]=0;
 503:     pspeak(vase,prop[vase]+1);
 504:     if (prop[vase]!=0) fixed[vase] = -1;
 505:     return(dropper());
 506: }
 507: 
 508: 
 509: tropen()                                        /* 9040                 */
 510: {       if (obj==clam||obj==oyster)
 511:     {       k=0;                            /* 9046                 */
 512:         if (obj==oyster) k=1;
 513:         spk=124+k;
 514:         if (toting(obj)) spk=120+k;
 515:         if (!toting(tridnt)) spk=122+k;
 516:         if (verb==lock) spk=61;
 517:         if (spk!=124) return(2011);
 518:         dstroy(clam);
 519:         drop(oyster,loc);
 520:         drop(pearl,105);
 521:         return(2011);
 522:     }
 523:     if (obj==door) spk=111;
 524:     if (obj==door&&prop[door]==1) spk=54;
 525:     if (obj==cage) spk=32;
 526:     if (obj==keys) spk=55;
 527:     if (obj==grate||obj==chain) spk=31;
 528:     if (spk!=31||!here(keys)) return(2011);
 529:     if (obj==chain)
 530:     {       if (verb==lock)
 531:         {       spk=172;                /* 9049: lock           */
 532:             if (prop[chain]!=0) spk=34;
 533:             if (loc!=plac[chain]) spk=173;
 534:             if (spk!=172) return(2011);
 535:             prop[chain]=2;
 536:             if (toting(chain)) drop(chain,loc);
 537:             fixed[chain]= -1;
 538:             return(2011);
 539:         }
 540:         spk=171;
 541:         if (prop[bear]==0) spk=41;
 542:         if (prop[chain]==0) spk=37;
 543:         if (spk!=171) return(2011);
 544:         prop[chain]=0;
 545:         fixed[chain]=0;
 546:         if (prop[bear]!=3) prop[bear]=2;
 547:         fixed[bear]=2-prop[bear];
 548:         return(2011);
 549:     }
 550:     if (closng)
 551:     {       k=130;
 552:         if (!panic) clock2=15;
 553:         panic=TRUE;
 554:         return(2010);
 555:     }
 556:     k=34+prop[grate];                       /* 9043                 */
 557:     prop[grate]=1;
 558:     if (verb==lock) prop[grate]=0;
 559:     k=k+2*prop[grate];
 560:     return(2010);
 561: }
 562: 
 563: 
 564: trkill()                                /* 9120                         */
 565: {       register int i;
 566:     for (i=1; i<=5; i++)
 567:         if (dloc[i]==loc&&dflag>=2) break;
 568:     if (i==6) i=0;
 569:     if (obj==0)                     /* 9122                         */
 570:     {       if (i!=0) obj=dwarf;
 571:         if (here(snake)) obj=obj*100+snake;
 572:         if (at(dragon)&&prop[dragon]==0) obj=obj*100+dragon;
 573:         if (at(troll)) obj=obj*100+troll;
 574:         if (here(bear)&&prop[bear]==0) obj=obj*100+bear;
 575:         if (obj>100) return(8000);
 576:         if (obj==0)
 577:         {       if (here(bird)&&verb!=throw) obj=bird;
 578:             if (here(clam)||here(oyster)) obj=100*obj+clam;
 579:             if (obj>100) return(8000);
 580:         }
 581:     }
 582:     if (obj==bird)                  /* 9124                         */
 583:     {       spk=137;
 584:         if (closed) return(2011);
 585:         dstroy(bird);
 586:         prop[bird]=0;
 587:         if (place[snake]==plac[snake]) tally2++;
 588:         spk=45;
 589:     }
 590:     if (obj==0) spk=44;             /* 9125                         */
 591:     if (obj==clam||obj==oyster) spk=150;
 592:     if (obj==snake) spk=46;
 593:     if (obj==dwarf) spk=49;
 594:     if (obj==dwarf&&closed) return(19000);
 595:     if (obj==dragon) spk=147;
 596:     if (obj==troll) spk=157;
 597:     if (obj==bear) spk=165+(prop[bear]+1)/2;
 598:     if (obj!=dragon||prop[dragon]!=0) return(2011);
 599:     rspeak(49);
 600:     verb=0;
 601:     obj=0;
 602:     getin(&wd1,&wd2);
 603:     if (!weq(wd1,"y")&&!weq(wd1,"yes")) return(2608);
 604:     pspeak(dragon,1);
 605:     prop[dragon]=2;
 606:     prop[rug]=0;
 607:     k=(plac[dragon]+fixd[dragon])/2;
 608:     move(dragon+100,-1);
 609:     move(rug+100,0);
 610:     move(dragon,k);
 611:     move(rug,k);
 612:     for (obj=1; obj<=100; obj++)
 613:         if (place[obj]==plac[dragon]||place[obj]==fixd[dragon])
 614:             move(obj,k);
 615:     loc=k;
 616:     k=null;
 617:     return(8);
 618: }
 619: 
 620: 
 621: trtoss()                                /* 9170: throw                  */
 622: {       register int i;
 623:     if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
 624:     if (!toting(obj)) return(2011);
 625:     if (obj>=50&&obj<=maxtrs&&at(troll))
 626:     {       spk=159;                        /* 9178                 */
 627:         drop(obj,0);
 628:         move(troll,0);
 629:         move(troll+100,0);
 630:         drop(troll2,plac[troll]);
 631:         drop(troll2+100,fixd[troll]);
 632:         juggle(chasm);
 633:         return(2011);
 634:     }
 635:     if (obj==food&&here(bear))
 636:     {       obj=bear;                       /* 9177                 */
 637:         return(9210);
 638:     }
 639:     if (obj!=axe) return(9020);
 640:     for (i=1; i<=5; i++)
 641:     {       if (dloc[i]==loc)
 642:         {       spk=48;                 /* 9172                 */
 643:             if (ran(3)==0||saved!= -1)
 644:         l9175:  {       rspeak(spk);
 645:                 drop(axe,loc);
 646:                 k=null;
 647:                 return(8);
 648:             }
 649:             dseen[i]=FALSE;
 650:             dloc[i]=0;
 651:             spk=47;
 652:             dkill++;
 653:             if (dkill==1) spk=149;
 654:             goto l9175;
 655:         }
 656:     }
 657:     spk=152;
 658:     if (at(dragon)&&prop[dragon]==0)
 659:         goto l9175;
 660:     spk=158;
 661:     if (at(troll)) goto l9175;
 662:     if (here(bear)&&prop[bear]==0)
 663:     {       spk=164;
 664:         drop(axe,loc);
 665:         fixed[axe]= -1;
 666:         prop[axe]=1;
 667:         juggle(bear);
 668:         return(2011);
 669:     }
 670:     obj=0;
 671:     return(9120);
 672: }
 673: 
 674: 
 675: trfeed()                                        /* 9210                 */
 676: {       if (obj==bird)
 677:     {       spk=100;
 678:         return(2011);
 679:     }
 680:     if (obj==snake||obj==dragon||obj==troll)
 681:     {       spk=102;
 682:         if (obj==dragon&&prop[dragon]!=0) spk=110;
 683:         if (obj==troll) spk=182;
 684:         if (obj!=snake||closed||!here(bird)) return(2011);
 685:         spk=101;
 686:         dstroy(bird);
 687:         prop[bird]=0;
 688:         tally2++;
 689:         return(2011);
 690:     }
 691:     if (obj==dwarf)
 692:     {       if (!here(food)) return(2011);
 693:         spk=103;
 694:         dflag++;
 695:         return(2011);
 696:     }
 697:     if (obj==bear)
 698:     {       if (prop[bear]==0) spk=102;
 699:         if (prop[bear]==3) spk=110;
 700:         if (!here(food)) return(2011);
 701:         dstroy(food);
 702:         prop[bear]=1;
 703:         fixed[axe]=0;
 704:         prop[axe]=0;
 705:         spk=168;
 706:         return(2011);
 707:     }
 708:     spk=14;
 709:     return(2011);
 710: }
 711: 
 712: 
 713: trfill()                                        /* 9220 */
 714: {       if (obj==vase)
 715:     {       spk=29;
 716:         if (liqloc(loc)==0) spk=144;
 717:         if (liqloc(loc)==0||!toting(vase)) return(2011);
 718:         rspeak(145);
 719:         prop[vase]=2;
 720:         fixed[vase]= -1;
 721:         return(9020);           /* advent/10 goes to 9024 */
 722:     }
 723:     if (obj!=0&&obj!=bottle) return(2011);
 724:     if (obj==0&&!here(bottle)) return(8000);
 725:     spk=107;
 726:     if (liqloc(loc)==0) spk=106;
 727:     if (liq(0)!=0) spk=105;
 728:     if (spk!=107) return(2011);
 729:     prop[bottle]=((cond[loc]%4)/2)*2;
 730:     k=liq(0);
 731:     if (toting(bottle)) place[k]= -1;
 732:     if (k==oil) spk=108;
 733:     return(2011);
 734: }
 735: 
 736: 
 737: closing()                               /* 10000 */
 738: {       register int i;
 739:     prop[grate]=prop[fissur]=0;
 740:     for (i=1; i<=6; i++)
 741:     {       dseen[i]=FALSE;
 742:         dloc[i]=0;
 743:     }
 744:     move(troll,0);
 745:     move(troll+100,0);
 746:     move(troll2,plac[troll]);
 747:     move(troll2+100,fixd[troll]);
 748:     juggle(chasm);
 749:     if(prop[bear]!=3) dstroy(bear);
 750:     prop[chain]=0;
 751:     fixed[chain]=0;
 752:     prop[axe]=0;
 753:     fixed[axe]=0;
 754:     rspeak(129);
 755:     clock1 = -1;
 756:     closng=TRUE;
 757:     return(19999);
 758: }
 759: 
 760: 
 761: caveclose()                             /* 11000 */
 762: {       register int i;
 763:     prop[bottle]=put(bottle,115,1);
 764:     prop[plant]=put(plant,115,0);
 765:     prop[oyster]=put(oyster,115,0);
 766:     prop[lamp]=put(lamp,115,0);
 767:     prop[rod]=put(rod,115,0);
 768:     prop[dwarf]=put(dwarf,115,0);
 769:     loc=115;
 770:     oldloc=115;
 771:     newloc=115;
 772: 
 773:     put(grate,116,0);
 774:     prop[snake]=put(snake,116,1);
 775:     prop[bird]=put(bird,116,1);
 776:     prop[cage]=put(cage,116,0);
 777:     prop[rod2]=put(rod2,116,0);
 778:     prop[pillow]=put(pillow,116,0);
 779: 
 780:     prop[mirror]=put(mirror,115,0);
 781:     fixed[mirror]=116;
 782: 
 783:     for (i=1; i<=100; i++)
 784:         if (toting(i)) dstroy(i);
 785:     rspeak(132);
 786:     closed=TRUE;
 787:     return(2);
 788: }

Defined functions

at defined in line 21; used 20 times
badmove defined in line 336; used 1 times
bitset defined in line 49; used 4 times
bug defined in line 349; used 20 times
caveclose defined in line 761; used 1 times
checkhints defined in line 356; used 1 times
closing defined in line 737; used 1 times
dark defined in line 61; used 6 times
dropper defined in line 453; used 4 times
fdwarf defined in line 74; used 1 times
forced defined in line 55; used 7 times
here defined in line 15; used 42 times
liq defined in line 32; used 10 times
liq2 defined in line 27; used 3 times
liqloc defined in line 39; used 7 times
march defined in line 192; used 1 times
mback defined in line 257; used 1 times
pct defined in line 67; used 8 times
specials defined in line 291; used 1 times
toting defined in line 9; used 43 times
trbridge defined in line 309; used 1 times
trdrop defined in line 463; used 1 times
trfeed defined in line 675; used 1 times
trfill defined in line 713; used 1 times
trkill defined in line 564; used 1 times
tropen defined in line 509; used 1 times
trsay defined in line 394; used 1 times
trtake defined in line 408; used 1 times
trtoss defined in line 621; used 1 times

Defined variables

sccsid defined in line 4; never used
Last modified: 1982-06-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 4462
Valid CSS Valid XHTML 1.0 Strict