Home | History | Annotate | Line # | Download | only in larn
object.c revision 1.2
      1  1.1      cgd /*	object.c		Larn is copyrighted 1986 by Noah Morgan. */
      2  1.1      cgd #include "header.h"
      3  1.1      cgd 
      4  1.1      cgd /*
      5  1.1      cgd 	***************
      6  1.1      cgd 	LOOK_FOR_OBJECT
      7  1.1      cgd 	***************
      8  1.1      cgd 
      9  1.1      cgd 	subroutine to look for an object and give the player his options
     10  1.1      cgd 	if an object was found.
     11  1.1      cgd  */
     12  1.1      cgd lookforobject()
     13  1.1      cgd {
     14  1.1      cgd register int i,j;
     15  1.1      cgd if (c[TIMESTOP])  return;	/* can't find objects is time is stopped	*/
     16  1.1      cgd i=item[playerx][playery];	if (i==0) return;
     17  1.1      cgd showcell(playerx,playery);  cursors();  yrepcount=0;
     18  1.1      cgd switch(i)
     19  1.1      cgd 	{
     20  1.1      cgd 	case OGOLDPILE:	case OMAXGOLD:
     21  1.1      cgd 	case OKGOLD:	case ODGOLD:	lprcat("\n\nYou have found some gold!");	ogold(i);	break;
     22  1.1      cgd 
     23  1.1      cgd 	case OPOTION:	lprcat("\n\nYou have found a magic potion");
     24  1.1      cgd 				i = iarg[playerx][playery];
     25  1.1      cgd 				if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]);  opotion(i);  break;
     26  1.1      cgd 
     27  1.1      cgd 	case OSCROLL:	lprcat("\n\nYou have found a magic scroll");
     28  1.1      cgd 				i = iarg[playerx][playery];
     29  1.1      cgd 				if (scrollname[i][0])	lprintf(" of %s",&scrollname[i][1]);
     30  1.1      cgd 				oscroll(i);  break;
     31  1.1      cgd 
     32  1.1      cgd 	case OALTAR:	if (nearbymonst()) return;
     33  1.1      cgd 					lprcat("\n\nThere is a Holy Altar here!"); oaltar(); break;
     34  1.1      cgd 
     35  1.1      cgd 	case OBOOK:	lprcat("\n\nYou have found a book."); obook(); break;
     36  1.1      cgd 
     37  1.1      cgd 	case OCOOKIE:	lprcat("\n\nYou have found a fortune cookie."); ocookie(); break;
     38  1.1      cgd 
     39  1.1      cgd 	case OTHRONE:	if (nearbymonst()) return;
     40  1.1      cgd 					lprintf("\n\nThere is %s here!",objectname[i]); othrone(0); break;
     41  1.1      cgd 
     42  1.1      cgd 	case OTHRONE2:	if (nearbymonst()) return;
     43  1.1      cgd 					lprintf("\n\nThere is %s here!",objectname[i]); othrone(1); break;
     44  1.1      cgd 
     45  1.1      cgd 	case ODEADTHRONE: lprintf("\n\nThere is %s here!",objectname[i]); odeadthrone(); break;
     46  1.1      cgd 
     47  1.1      cgd 	case OORB:		lprcat("\n\nYou have found the Orb!!!!!"); oorb(); break;
     48  1.1      cgd 
     49  1.1      cgd 	case OPIT:		lprcat("\n\nYou're standing at the top of a pit."); opit(); break;
     50  1.1      cgd 
     51  1.1      cgd 	case OSTAIRSUP:		lprcat("\n\nThere is a circular staircase here"); ostairs(1);  /* up */ break;
     52  1.1      cgd 
     53  1.1      cgd 	case OELEVATORUP:	lprcat("\n\nYou feel heavy for a moment, but the feeling disappears");
     54  1.1      cgd 				oelevator(1);  /*  up  */  break;
     55  1.1      cgd 
     56  1.1      cgd 	case OFOUNTAIN:	if (nearbymonst()) return;
     57  1.1      cgd 					lprcat("\n\nThere is a fountain here"); ofountain(); break;
     58  1.1      cgd 
     59  1.1      cgd 	case OSTATUE:	if (nearbymonst()) return;
     60  1.1      cgd 					lprcat("\n\nYou are standing in front of a statue"); ostatue(); break;
     61  1.1      cgd 
     62  1.1      cgd 	case OCHEST:	lprcat("\n\nThere is a chest here");  ochest();  break;
     63  1.1      cgd 
     64  1.1      cgd 	case OIVTELETRAP:	if (rnd(11)<6) return;
     65  1.1      cgd 						item[playerx][playery] = OTELEPORTER;
     66  1.1      cgd 						know[playerx][playery] = 1;
     67  1.1      cgd 
     68  1.1      cgd 	case OTELEPORTER:	lprcat("\nZaaaappp!  You've been teleported!\n");
     69  1.1      cgd 						beep(); nap(3000); oteleport(0);
     70  1.1      cgd 						break;
     71  1.1      cgd 
     72  1.1      cgd 	case OSCHOOL:	if (nearbymonst()) return;
     73  1.1      cgd 				lprcat("\n\nYou have found the College of Larn.");
     74  1.1      cgd 				lprcat("\nDo you (g) go inside, or (i) stay here? ");
     75  1.1      cgd 				i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
     76  1.1      cgd 				if (i == 'g') { oschool();  /*	the college of larn	*/ }
     77  1.1      cgd 				else	lprcat(" stay here");
     78  1.1      cgd 				break;
     79  1.1      cgd 
     80  1.1      cgd 	case OMIRROR:	if (nearbymonst()) return;
     81  1.1      cgd 					lprcat("\n\nThere is a mirror here");	omirror();	break;
     82  1.1      cgd 
     83  1.1      cgd 	case OBANK2:
     84  1.1      cgd 	case OBANK:	if (nearbymonst()) return;
     85  1.1      cgd 				if (i==OBANK) lprcat("\n\nYou have found the bank of Larn.");
     86  1.1      cgd 				else lprcat("\n\nYou have found a branch office of the bank of Larn.");
     87  1.1      cgd 				lprcat("\nDo you (g) go inside, or (i) stay here? ");
     88  1.1      cgd 				j=0; while ((j!='g') && (j!='i') && (j!='\33')) j=getchar();
     89  1.1      cgd 				if (j == 'g') {  if (i==OBANK) obank(); else obank2(); /*  the bank of larn  */  }
     90  1.1      cgd 				else   lprcat(" stay here");
     91  1.1      cgd 				break;
     92  1.1      cgd 
     93  1.1      cgd 	case ODEADFOUNTAIN:	if (nearbymonst()) return;
     94  1.1      cgd 						lprcat("\n\nThere is a dead fountain here"); break;
     95  1.1      cgd 
     96  1.1      cgd 	case ODNDSTORE:	if (nearbymonst()) return;
     97  1.1      cgd 					lprcat("\n\nThere is a DND store here.");
     98  1.1      cgd 					lprcat("\nDo you (g) go inside, or (i) stay here? ");
     99  1.1      cgd 					i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
    100  1.1      cgd 					if (i == 'g')
    101  1.1      cgd 						dndstore();  /*  the dnd adventurers store  */
    102  1.1      cgd 					else  lprcat(" stay here");
    103  1.1      cgd 					break;
    104  1.1      cgd 
    105  1.1      cgd 	case OSTAIRSDOWN:	lprcat("\n\nThere is a circular staircase here"); ostairs(-1); /* down */ break;
    106  1.1      cgd 
    107  1.1      cgd 	case OELEVATORDOWN:	lprcat("\n\nYou feel light for a moment, but the feeling disappears");
    108  1.1      cgd 				oelevator(-1);	/*	down	*/
    109  1.1      cgd 				break;
    110  1.1      cgd 
    111  1.1      cgd 	case OOPENDOOR:		lprintf("\n\nYou have found %s",objectname[i]);
    112  1.1      cgd 						lprcat("\nDo you (c) close it"); iopts();
    113  1.1      cgd 						i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
    114  1.1      cgd 						if ((i=='\33') || (i=='i')) { ignore();  break; }
    115  1.1      cgd 						lprcat("close");  forget();
    116  1.1      cgd 						item[playerx][playery]=OCLOSEDDOOR;
    117  1.1      cgd 						iarg[playerx][playery]=0;
    118  1.1      cgd 						playerx = lastpx;  playery = lastpy;
    119  1.1      cgd 						break;
    120  1.1      cgd 
    121  1.1      cgd 	case OCLOSEDDOOR:	lprintf("\n\nYou have found %s",objectname[i]);
    122  1.1      cgd 						lprcat("\nDo you (o) try to open it"); iopts();
    123  1.1      cgd 						i=0; while ((i!='o') && (i!='i') && (i!='\33')) i=getchar();
    124  1.1      cgd 						if ((i=='\33') || (i=='i'))
    125  1.1      cgd 							{ ignore();  playerx = lastpx;
    126  1.1      cgd 							playery = lastpy; break; }
    127  1.1      cgd 						else
    128  1.1      cgd 						{
    129  1.1      cgd 						lprcat("open");
    130  1.1      cgd 						if (rnd(11)<7)
    131  1.1      cgd 						  {
    132  1.1      cgd 						  switch(iarg[playerx][playery])
    133  1.1      cgd 							{
    134  1.1      cgd 							case 6: c[AGGRAVATE] += rnd(400);	break;
    135  1.1      cgd 
    136  1.1      cgd 							case 7:	lprcat("\nYou are jolted by an electric shock ");
    137  1.1      cgd 									lastnum=274; losehp(rnd(20));  bottomline();  break;
    138  1.1      cgd 
    139  1.1      cgd 							case 8:	loselevel();  break;
    140  1.1      cgd 
    141  1.1      cgd 							case 9:	lprcat("\nYou suddenly feel weaker ");
    142  1.1      cgd 									if (c[STRENGTH]>3) c[STRENGTH]--;
    143  1.1      cgd 									bottomline();  break;
    144  1.1      cgd 
    145  1.1      cgd 							default:	break;
    146  1.1      cgd 							}
    147  1.1      cgd 						  playerx = lastpx;  playery = lastpy;
    148  1.1      cgd 						  }
    149  1.1      cgd 						else
    150  1.1      cgd 						  {
    151  1.1      cgd 						  forget();  item[playerx][playery]=OOPENDOOR;
    152  1.1      cgd 						  }
    153  1.1      cgd 						}
    154  1.1      cgd 						break;
    155  1.1      cgd 
    156  1.1      cgd 	case OENTRANCE:	lprcat("\nYou have found "); lprcat(objectname[OENTRANCE]);
    157  1.1      cgd 					lprcat("\nDo you (g) go inside"); iopts();
    158  1.1      cgd 					i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
    159  1.1      cgd 					if (i == 'g')
    160  1.1      cgd 						{
    161  1.1      cgd 						newcavelevel(1); playerx=33; playery=MAXY-2;
    162  1.1      cgd 						item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1]=0;
    163  1.1      cgd 						draws(0,MAXX,0,MAXY); bot_linex(); return;
    164  1.1      cgd 						}
    165  1.1      cgd 					else   ignore();
    166  1.1      cgd 					break;
    167  1.1      cgd 
    168  1.1      cgd 	case OVOLDOWN:	lprcat("\nYou have found "); lprcat(objectname[OVOLDOWN]);
    169  1.1      cgd 						lprcat("\nDo you (c) climb down"); iopts();
    170  1.1      cgd 						i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
    171  1.1      cgd 						if ((i=='\33') || (i=='i')) { ignore();  break; }
    172  1.1      cgd 					if (level!=0) { lprcat("\nThe shaft only extends 5 feet downward!"); return; }
    173  1.1      cgd 					if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep();
    174  1.1      cgd 											  lastnum=275;  losehp(30+rnd(20)); bottomhp(); }
    175  1.1      cgd 
    176  1.1      cgd 					else lprcat("climb down");  nap(3000);  newcavelevel(MAXLEVEL);
    177  1.1      cgd 					for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++) /* put player near volcano shaft */
    178  1.1      cgd 						if (item[j][i]==OVOLUP) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); }
    179  1.1      cgd 					draws(0,MAXX,0,MAXY); bot_linex(); return;
    180  1.1      cgd 
    181  1.1      cgd 	case OVOLUP:	lprcat("\nYou have found "); lprcat(objectname[OVOLUP]);
    182  1.1      cgd 						lprcat("\nDo you (c) climb up"); iopts();
    183  1.1      cgd 						i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
    184  1.1      cgd 						if ((i=='\33') || (i=='i')) { ignore();  break; }
    185  1.1      cgd 					if (level!=11) { lprcat("\nThe shaft only extends 8 feet upwards before you find a blockage!"); return; }
    186  1.1      cgd 					if (packweight() > 45+5*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep();
    187  1.1      cgd 											  lastnum=275; losehp(15+rnd(20)); bottomhp(); return; }
    188  1.1      cgd 					lprcat("climb up"); lflush(); nap(3000); newcavelevel(0);
    189  1.1      cgd 					for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++) /* put player near volcano shaft */
    190  1.1      cgd 						if (item[j][i]==OVOLDOWN) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); }
    191  1.1      cgd 					draws(0,MAXX,0,MAXY); bot_linex(); return;
    192  1.1      cgd 
    193  1.1      cgd 	case OTRAPARROWIV:	if (rnd(17)<13) return;	/* for an arrow trap */
    194  1.1      cgd 						item[playerx][playery] = OTRAPARROW;
    195  1.1      cgd 						know[playerx][playery] = 0;
    196  1.1      cgd 
    197  1.1      cgd 	case OTRAPARROW:	lprcat("\nYou are hit by an arrow"); beep();	/* for an arrow trap */
    198  1.1      cgd 						lastnum=259;	losehp(rnd(10)+level);
    199  1.1      cgd 						bottomhp();	return;
    200  1.1      cgd 
    201  1.1      cgd 	case OIVDARTRAP:	if (rnd(17)<13) return;		/* for a dart trap */
    202  1.1      cgd 						item[playerx][playery] = ODARTRAP;
    203  1.1      cgd 						know[playerx][playery] = 0;
    204  1.1      cgd 
    205  1.1      cgd 	case ODARTRAP:		lprcat("\nYou are hit by a dart"); beep();	/* for a dart trap */
    206  1.1      cgd 						lastnum=260;	losehp(rnd(5));
    207  1.1      cgd 						if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3;
    208  1.1      cgd 						bottomline();	return;
    209  1.1      cgd 
    210  1.1      cgd 	case OIVTRAPDOOR:	if (rnd(17)<13) return;		/* for a trap door */
    211  1.1      cgd 						item[playerx][playery] = OTRAPDOOR;
    212  1.1      cgd 						know[playerx][playery] = 1;
    213  1.1      cgd 
    214  1.1      cgd 	case OTRAPDOOR:		lastnum = 272; /* a trap door */
    215  1.1      cgd 						if ((level==MAXLEVEL-1) || (level==MAXLEVEL+MAXVLEVEL-1))
    216  1.1      cgd 							{ lprcat("\nYou fell through a bottomless trap door!"); beep();  nap(3000);  died(271); }
    217  1.1      cgd 						lprcat("\nYou fall through a trap door!"); beep();	/* for a trap door */
    218  1.1      cgd 						losehp(rnd(5+level));
    219  1.1      cgd 						nap(2000);  newcavelevel(level+1);  draws(0,MAXX,0,MAXY); bot_linex();
    220  1.1      cgd 						return;
    221  1.1      cgd 
    222  1.1      cgd 
    223  1.1      cgd 	case OTRADEPOST:	if (nearbymonst()) return;
    224  1.1      cgd 				lprcat("\nYou have found the Larn trading Post.");
    225  1.1      cgd 				lprcat("\nDo you (g) go inside, or (i) stay here? ");
    226  1.1      cgd 				i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
    227  1.1      cgd 				if (i == 'g')  otradepost();  else  lprcat("stay here");
    228  1.1      cgd 				return;
    229  1.1      cgd 
    230  1.1      cgd 	case OHOME:	if (nearbymonst()) return;
    231  1.1      cgd 				lprcat("\nYou have found your way home.");
    232  1.1      cgd 				lprcat("\nDo you (g) go inside, or (i) stay here? ");
    233  1.1      cgd 				i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
    234  1.1      cgd 				if (i == 'g')  ohome();  else  lprcat("stay here");
    235  1.1      cgd 				return;
    236  1.1      cgd 
    237  1.1      cgd 	case OWALL:	break;
    238  1.1      cgd 
    239  1.1      cgd 	case OANNIHILATION:	died(283); return; 	/* annihilated by sphere of annihilation */
    240  1.1      cgd 
    241  1.1      cgd 	case OLRS:	if (nearbymonst()) return;
    242  1.1      cgd 				lprcat("\n\nThere is an LRS office here.");
    243  1.1      cgd 				lprcat("\nDo you (g) go inside, or (i) stay here? ");
    244  1.1      cgd 				i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
    245  1.1      cgd 				if (i == 'g')
    246  1.1      cgd 					olrs();  /*  the larn revenue service */
    247  1.1      cgd 				else  lprcat(" stay here");
    248  1.1      cgd 				break;
    249  1.1      cgd 
    250  1.1      cgd 	default:	finditem(i); break;
    251  1.1      cgd 	};
    252  1.1      cgd }
    253  1.1      cgd 
    254  1.1      cgd /*
    255  1.1      cgd 	function to say what object we found and ask if player wants to take it
    256  1.1      cgd  */
    257  1.1      cgd finditem(itm)
    258  1.1      cgd 	int itm;
    259  1.1      cgd 	{
    260  1.1      cgd 	int tmp,i;
    261  1.1      cgd 	lprintf("\n\nYou have found %s ",objectname[itm]);
    262  1.1      cgd 	tmp=iarg[playerx][playery];
    263  1.1      cgd 	switch(itm)
    264  1.1      cgd 		{
    265  1.1      cgd 		case ODIAMOND:		case ORUBY:			case OEMERALD:
    266  1.1      cgd 		case OSAPPHIRE:		case OSPIRITSCARAB:	case OORBOFDRAGON:
    267  1.1      cgd 		case OCUBEofUNDEAD:	case ONOTHEFT:	break;
    268  1.1      cgd 
    269  1.1      cgd 		default:
    270  1.1      cgd 		if (tmp>0) lprintf("+ %d",(long)tmp); else if (tmp<0) lprintf(" %d",(long)tmp);
    271  1.1      cgd 		}
    272  1.1      cgd 	lprcat("\nDo you want to (t) take it"); iopts();
    273  1.1      cgd 	i=0; while (i!='t' && i!='i' && i!='\33') i=getchar();
    274  1.1      cgd 	if (i == 't')
    275  1.1      cgd 		{	lprcat("take");  if (take(itm,tmp)==0)  forget();	return;	}
    276  1.1      cgd 	ignore();
    277  1.1      cgd 	}
    278  1.1      cgd 
    279  1.1      cgd 
    280  1.1      cgd /*
    282  1.1      cgd 	*******
    283  1.1      cgd 	OSTAIRS
    284  1.1      cgd 	*******
    285  1.1      cgd 
    286  1.1      cgd 	subroutine to process the stair cases
    287  1.1      cgd 	if dir > 0 the up else down
    288  1.1      cgd  */
    289  1.1      cgd ostairs(dir)
    290  1.1      cgd 	int dir;
    291  1.1      cgd 	{
    292  1.1      cgd 	register int k;
    293  1.1      cgd 	lprcat("\nDo you (s) stay here  ");
    294  1.1      cgd 	if (dir > 0)	lprcat("(u) go up  ");	else	lprcat("(d) go down  ");
    295  1.1      cgd 	lprcat("or (f) kick stairs? ");
    296  1.1      cgd 
    297  1.1      cgd 	while (1) switch(getchar())
    298  1.1      cgd 		{
    299  1.1      cgd 		case '\33':
    300  1.1      cgd 		case 's':	case 'i':	lprcat("stay here");	return;
    301  1.1      cgd 
    302  1.1      cgd 		case 'f':	lprcat("kick stairs");
    303  1.1      cgd 					if (rnd(2) == 1)
    304  1.1      cgd 						lprcat("\nI hope you feel better.  Showing anger rids you of frustration.");
    305  1.1      cgd 					else
    306  1.1      cgd 						{
    307  1.1      cgd 						k=rnd((level+1)<<1);
    308  1.1      cgd 						lprintf("\nYou hurt your foot dumb dumb!  You suffer %d hit points",(long)k);
    309  1.1      cgd 						lastnum=276;  losehp(k);  bottomline();
    310  1.1      cgd 						}
    311  1.1      cgd 					return;
    312  1.1      cgd 
    313  1.1      cgd 		case 'u':	lprcat("go up");
    314  1.1      cgd 					if (dir < 0)	lprcat("\nThe stairs don't go up!");
    315  1.1      cgd 					else
    316  1.1      cgd 					  if (level>=2 && level!=11)
    317  1.1      cgd 						{
    318  1.1      cgd 						k = level;  newcavelevel(level-1);
    319  1.1      cgd 						draws(0,MAXX,0,MAXY); bot_linex();
    320  1.1      cgd 						}
    321  1.1      cgd 					  else lprcat("\nThe stairs lead to a dead end!");
    322  1.1      cgd 					return;
    323  1.1      cgd 
    324  1.1      cgd 		case 'd':	lprcat("go down");
    325  1.1      cgd 					if (dir > 0)	lprcat("\nThe stairs don't go down!");
    326  1.1      cgd 					else
    327  1.1      cgd 					  if (level!=0 && level!=10 && level!=13)
    328  1.1      cgd 						{
    329  1.1      cgd 						k = level;  newcavelevel(level+1);
    330  1.1      cgd 						draws(0,MAXX,0,MAXY); bot_linex();
    331  1.1      cgd 						}
    332  1.1      cgd 					  else lprcat("\nThe stairs lead to a dead end!");
    333  1.1      cgd 					return;
    334  1.1      cgd 		};
    335  1.1      cgd 	}
    336  1.1      cgd 
    337  1.1      cgd 
    338  1.1      cgd /*
    340  1.1      cgd 	*********
    341  1.1      cgd 	OTELEPORTER
    342  1.1      cgd 	*********
    343  1.1      cgd 
    344  1.1      cgd 	subroutine to handle a teleport trap +/- 1 level maximum
    345  1.1      cgd  */
    346  1.1      cgd oteleport(err)
    347  1.1      cgd 	int err;
    348  1.1      cgd 	{
    349  1.1      cgd 	register int tmp;
    350  1.1      cgd 	if (err) if (rnd(151)<3)  died(264);  /*	stuck in a rock */
    351  1.1      cgd 	c[TELEFLAG]=1;	/*	show ?? on bottomline if been teleported	*/
    352  1.1      cgd 	if (level==0) tmp=0;
    353  1.1      cgd 	else if (level < MAXLEVEL)
    354  1.1      cgd 		{ tmp=rnd(5)+level-3; if (tmp>=MAXLEVEL) tmp=MAXLEVEL-1;
    355  1.1      cgd 			if (tmp<1) tmp=1; }
    356  1.1      cgd 	else
    357  1.1      cgd 		{ tmp=rnd(3)+level-2; if (tmp>=MAXLEVEL+MAXVLEVEL) tmp=MAXLEVEL+MAXVLEVEL-1;
    358  1.1      cgd 			if (tmp<MAXLEVEL) tmp=MAXLEVEL; }
    359  1.1      cgd 	playerx = rnd(MAXX-2);	playery = rnd(MAXY-2);
    360  1.1      cgd 	if (level != tmp)	newcavelevel(tmp);  positionplayer();
    361  1.1      cgd 	draws(0,MAXX,0,MAXY); bot_linex();
    362  1.1      cgd 	}
    363  1.1      cgd 
    364  1.1      cgd /*
    366  1.1      cgd 	*******
    367  1.1      cgd 	OPOTION
    368  1.1      cgd 	*******
    369  1.1      cgd 
    370  1.1      cgd 	function to process a potion
    371  1.1      cgd  */
    372  1.1      cgd opotion(pot)
    373  1.1      cgd 	int pot;
    374  1.1      cgd 	{
    375  1.1      cgd 	lprcat("\nDo you (d) drink it, (t) take it"); iopts();
    376  1.1      cgd 	while (1) switch(getchar())
    377  1.1      cgd 		{
    378  1.1      cgd 		case '\33':
    379  1.1      cgd 		case 'i':	ignore();  return;
    380  1.1      cgd 
    381  1.1      cgd 		case 'd':	lprcat("drink\n");	forget();	/*	destroy potion	*/
    382  1.1      cgd 					quaffpotion(pot);		return;
    383  1.1      cgd 
    384  1.1      cgd 		case 't':	lprcat("take\n");	if (take(OPOTION,pot)==0)  forget();
    385  1.1      cgd 					return;
    386  1.1      cgd 		};
    387  1.1      cgd 	}
    388  1.1      cgd 
    389  1.1      cgd /*
    390  1.1      cgd 	function to drink a potion
    391  1.1      cgd  */
    392  1.1      cgd quaffpotion(pot)
    393  1.1      cgd 	int pot;
    394  1.2  mycroft 	{
    395  1.1      cgd 	register int i,j,k;
    396  1.1      cgd 	if (pot<0 || pot>=MAXPOTION) return; /* check for within bounds */
    397  1.1      cgd 	potionname[pot] = potionhide[pot];
    398  1.1      cgd 	switch(pot)
    399  1.1      cgd 		{
    400  1.1      cgd 		case 9: lprcat("\nYou feel greedy . . .");   nap(2000);
    401  1.1      cgd 				for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
    402  1.1      cgd 				  if ((item[j][i]==OGOLDPILE) || (item[j][i]==OMAXGOLD))
    403  1.1      cgd 					{
    404  1.1      cgd 					know[j][i]=1; show1cell(j,i);
    405  1.1      cgd 					}
    406  1.1      cgd 				showplayer();  return;
    407  1.1      cgd 
    408  1.1      cgd 		case 19: lprcat("\nYou feel greedy . . .");   nap(2000);
    409  1.1      cgd 				for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
    410  1.1      cgd 					{
    411  1.1      cgd 					k=item[j][i];
    412  1.1      cgd 					if ((k==ODIAMOND) || (k==ORUBY) || (k==OEMERALD) || (k==OMAXGOLD)
    413  1.1      cgd 						 || (k==OSAPPHIRE) || (k==OLARNEYE) || (k==OGOLDPILE))
    414  1.1      cgd 						 {
    415  1.1      cgd 						 know[j][i]=1; show1cell(j,i);
    416  1.1      cgd 						 }
    417  1.1      cgd 					}
    418  1.1      cgd 				showplayer();  return;
    419  1.1      cgd 
    420  1.1      cgd 		case 20: c[HP] = c[HPMAX]; break;	/* instant healing */
    421  1.1      cgd 
    422  1.1      cgd 		case 1:	lprcat("\nYou feel better");
    423  1.1      cgd 				if (c[HP] == c[HPMAX])  raisemhp(1);
    424  1.1      cgd 				else if ((c[HP] += rnd(20)+20+c[LEVEL]) > c[HPMAX]) c[HP]=c[HPMAX];  break;
    425  1.1      cgd 
    426  1.1      cgd 		case 2:	lprcat("\nSuddenly, you feel much more skillful!");
    427  1.1      cgd 				raiselevel();  raisemhp(1); return;
    428  1.1      cgd 
    429  1.1      cgd 		case 3:	lprcat("\nYou feel strange for a moment");
    430  1.1      cgd 				c[rund(6)]++;  break;
    431  1.1      cgd 
    432  1.1      cgd 		case 4:	lprcat("\nYou feel more self confident!");
    433  1.1      cgd 				c[WISDOM] += rnd(2);  break;
    434  1.1      cgd 
    435  1.1      cgd 		case 5:	lprcat("\nWow!  You feel great!");
    436  1.1      cgd 				if (c[STRENGTH]<12) c[STRENGTH]=12; else c[STRENGTH]++;  break;
    437  1.1      cgd 
    438  1.1      cgd 		case 6:	lprcat("\nYour charm went up by one!");  c[CHARISMA]++;  break;
    439  1.1      cgd 
    440  1.1      cgd 		case 8:	lprcat("\nYour intelligence went up by one!");
    441  1.1      cgd 				c[INTELLIGENCE]++;  break;
    442  1.1      cgd 
    443  1.1      cgd 		case 10: for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
    444  1.1      cgd 				   if (mitem[j][i])
    445  1.1      cgd 					{
    446  1.1      cgd 					know[j][i]=1; show1cell(j,i);
    447  1.1      cgd 					}
    448  1.1      cgd 				 /*	monster detection	*/  return;
    449  1.1      cgd 
    450  1.1      cgd 		case 12: lprcat("\nThis potion has no taste to it");  return;
    451  1.1      cgd 
    452  1.1      cgd 		case 15: lprcat("\nWOW!!!  You feel Super-fantastic!!!");
    453  1.1      cgd 				 if (c[HERO]==0) for (i=0; i<6; i++) c[i] += 11;
    454  1.1      cgd 					c[HERO] += 250;  break;
    455  1.1      cgd 
    456  1.1      cgd 		case 16: lprcat("\nYou have a greater intestinal constitude!");
    457  1.1      cgd 				 c[CONSTITUTION]++;  break;
    458  1.1      cgd 
    459  1.1      cgd 		case 17: lprcat("\nYou now have incredibly bulging muscles!!!");
    460  1.1      cgd 				 if (c[GIANTSTR]==0) c[STREXTRA] += 21;
    461  1.1      cgd 				 c[GIANTSTR] += 700;  break;
    462  1.1      cgd 
    463  1.1      cgd 		case 18: lprcat("\nYou feel a chill run up your spine!");
    464  1.1      cgd 				 c[FIRERESISTANCE] += 1000;  break;
    465  1.1      cgd 
    466  1.1      cgd 		case 0:	lprcat("\nYou fall asleep. . .");
    467  1.1      cgd 				i=rnd(11)-(c[CONSTITUTION]>>2)+2;  while(--i>0) { parse2();  nap(1000); }
    468  1.1      cgd 				cursors();  lprcat("\nYou woke up!");  return;
    469  1.1      cgd 
    470  1.1      cgd 		case 7:	lprcat("\nYou become dizzy!");
    471  1.1      cgd 				if (--c[STRENGTH] < 3) c[STRENGTH]=3;  break;
    472  1.1      cgd 
    473  1.1      cgd 		case 11: lprcat("\nYou stagger for a moment . .");
    474  1.1      cgd 				 for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
    475  1.1      cgd 					know[j][i]=0;
    476  1.1      cgd 				 nap(2000);	draws(0,MAXX,0,MAXY); /* potion of forgetfulness */  return;
    477  1.1      cgd 
    478  1.1      cgd 		case 13: lprcat("\nYou can't see anything!");  /* blindness */
    479  1.1      cgd 				 c[BLINDCOUNT]+=500;  return;
    480  1.1      cgd 
    481  1.1      cgd 		case 14: lprcat("\nYou feel confused"); c[CONFUSE]+= 20+rnd(9); return;
    482  1.1      cgd 
    483  1.1      cgd 		case 21: lprcat("\nYou don't seem to be affected");  return; /* cure dianthroritis */
    484  1.1      cgd 
    485  1.1      cgd 		case 22: lprcat("\nYou feel a sickness engulf you"); /* poison */
    486  1.1      cgd 				 c[HALFDAM] += 200 + rnd(200);  return;
    487  1.1      cgd 
    488  1.1      cgd 		case 23: lprcat("\nYou feel your vision sharpen");	/* see invisible */
    489  1.1      cgd 				 c[SEEINVISIBLE] += rnd(1000)+400;
    490  1.1      cgd 				 monstnamelist[INVISIBLESTALKER] = 'I';  return;
    491  1.1      cgd 		};
    492  1.1      cgd 	bottomline();		/*	show new stats		*/  return;
    493  1.1      cgd 	}
    494  1.1      cgd 
    495  1.1      cgd /*
    497  1.1      cgd 	*******
    498  1.1      cgd 	OSCROLL
    499  1.1      cgd 	*******
    500  1.1      cgd 
    501  1.1      cgd 	function to process a magic scroll
    502  1.1      cgd  */
    503  1.1      cgd oscroll(typ)
    504  1.1      cgd 	int typ;
    505  1.1      cgd 	{
    506  1.1      cgd 	lprcat("\nDo you ");
    507  1.1      cgd 	if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts();
    508  1.1      cgd 	while (1) switch(getchar())
    509  1.1      cgd 		{
    510  1.1      cgd 		case '\33':
    511  1.1      cgd 		case 'i':	ignore();  return;
    512  1.1      cgd 
    513  1.1      cgd 		case 'r':	if (c[BLINDCOUNT]) break;
    514  1.1      cgd 					lprcat("read"); forget();
    515  1.1      cgd 					if (typ==2 || typ==15)  { show1cell(playerx,playery); cursors(); }
    516  1.1      cgd 					/*	destroy it	*/	read_scroll(typ);  return;
    517  1.1      cgd 
    518  1.1      cgd 		case 't':	lprcat("take"); if (take(OSCROLL,typ)==0)	forget();	/*	destroy it	*/
    519  1.1      cgd 					return;
    520  1.1      cgd 		};
    521  1.1      cgd 	}
    522  1.1      cgd 
    523  1.1      cgd /*
    524  1.1      cgd 	data for the function to read a scroll
    525  1.1      cgd  */
    526  1.1      cgd static int xh,yh,yl,xl;
    527  1.1      cgd static char curse[] = { BLINDCOUNT, CONFUSE, AGGRAVATE, HASTEMONST, ITCHING,
    528  1.1      cgd 	LAUGHING, DRAINSTRENGTH, CLUMSINESS, INFEEBLEMENT, HALFDAM };
    529  1.1      cgd static char exten[] = { PROTECTIONTIME, DEXCOUNT, STRCOUNT, CHARMCOUNT,
    530  1.1      cgd 	INVISIBILITY, CANCELLATION, HASTESELF, GLOBE, SCAREMONST, HOLDMONST, TIMESTOP };
    531  1.1      cgd char time_change[] = { HASTESELF,HERO,ALTPRO,PROTECTIONTIME,DEXCOUNT,
    532  1.1      cgd 	STRCOUNT,GIANTSTR,CHARMCOUNT,INVISIBILITY,CANCELLATION,
    533  1.1      cgd 	HASTESELF,AGGRAVATE,SCAREMONST,STEALTH,AWARENESS,HOLDMONST,HASTEMONST,
    534  1.1      cgd 	FIRERESISTANCE,GLOBE,SPIRITPRO,UNDEADPRO,HALFDAM,SEEINVISIBLE,
    535  1.1      cgd 	ITCHING,CLUMSINESS, WTW };
    536  1.1      cgd /*
    537  1.1      cgd  *	function to adjust time when time warping and taking courses in school
    538  1.1      cgd  */
    539  1.1      cgd adjtime(tim)
    540  1.1      cgd 	register long tim;
    541  1.1      cgd 	{
    542  1.1      cgd 	register int j;
    543  1.1      cgd 	for (j=0; j<26; j++)	/* adjust time related parameters */
    544  1.1      cgd 		if (c[time_change[j]])
    545  1.1      cgd 			if ((c[time_change[j]] -= tim) < 1) c[time_change[j]]=1;
    546  1.1      cgd 	regen();
    547  1.1      cgd 	}
    548  1.1      cgd 
    549  1.1      cgd /*
    550  1.1      cgd 	function to read a scroll
    551  1.1      cgd  */
    552  1.1      cgd read_scroll(typ)
    553  1.2  mycroft 	int typ;
    554  1.1      cgd 	{
    555  1.1      cgd 	register int i,j;
    556  1.1      cgd 	if (typ<0 || typ>=MAXSCROLL) return;  /* be sure we are within bounds */
    557  1.1      cgd 	scrollname[typ] = scrollhide[typ];
    558  1.1      cgd 	switch(typ)
    559  1.1      cgd 	  {
    560  1.1      cgd 	  case 0:	lprcat("\nYour armor glows for a moment");  enchantarmor(); return;
    561  1.1      cgd 
    562  1.1      cgd 	  case 1:	lprcat("\nYour weapon glows for a moment"); enchweapon(); return;  /* enchant weapon */
    563  1.1      cgd 
    564  1.1      cgd 	  case 2:	lprcat("\nYou have been granted enlightenment!");
    565  1.1      cgd 				yh = min(playery+7,MAXY);	xh = min(playerx+25,MAXX);
    566  1.1      cgd 				yl = max(playery-7,0);		xl = max(playerx-25,0);
    567  1.1      cgd 				for (i=yl; i<yh; i++) for (j=xl; j<xh; j++)  know[j][i]=1;
    568  1.1      cgd 				nap(2000);	draws(xl,xh,yl,yh);	return;
    569  1.1      cgd 
    570  1.1      cgd 	  case 3:	lprcat("\nThis scroll seems to be blank");	return;
    571  1.1      cgd 
    572  1.1      cgd 	  case 4:	createmonster(makemonst(level+1));  return;  /*  this one creates a monster  */
    573  1.1      cgd 
    574  1.1      cgd 	  case 5:	something(level);	/*	create artifact		*/  return;
    575  1.1      cgd 
    576  1.1      cgd 	  case 6:	c[AGGRAVATE]+=800; return; /* aggravate monsters */
    577  1.1      cgd 
    578  1.1      cgd 	  case 7:	gtime += (i = rnd(1000) - 850); /* time warp */
    579  1.1      cgd 				if (i>=0) lprintf("\nYou went forward in time by %d mobuls",(long)((i+99)/100));
    580  1.1      cgd 				else lprintf("\nYou went backward in time by %d mobuls",(long)(-(i+99)/100));
    581  1.1      cgd 				adjtime((long)i);	/* adjust time for time warping */
    582  1.1      cgd 				return;
    583  1.1      cgd 
    584  1.1      cgd 	  case 8:	oteleport(0);	  return;	/*	teleportation */
    585  1.1      cgd 
    586  1.1      cgd 	  case 9:	c[AWARENESS] += 1800;  return;	/* expanded awareness	*/
    587  1.1      cgd 
    588  1.1      cgd 	  case 10:	c[HASTEMONST] += rnd(55)+12; return;	/* haste monster */
    589  1.1      cgd 
    590  1.1      cgd 	  case 11:	for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
    591  1.1      cgd 					if (mitem[j][i])
    592  1.1      cgd 						hitp[j][i] = monster[mitem[j][i]].hitpoints;
    593  1.1      cgd 				return;	/* monster healing */
    594  1.1      cgd 	  case 12:	c[SPIRITPRO] += 300 + rnd(200); bottomline(); return; /* spirit protection */
    595  1.1      cgd 
    596  1.1      cgd 	  case 13:	c[UNDEADPRO] += 300 + rnd(200); bottomline(); return; /* undead protection */
    597  1.1      cgd 
    598  1.1      cgd 	  case 14:	c[STEALTH] += 250 + rnd(250);  bottomline(); return; /* stealth */
    599  1.1      cgd 
    600  1.1      cgd 	  case 15:	lprcat("\nYou have been granted enlightenment!"); /* magic mapping */
    601  1.1      cgd 				for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)  know[j][i]=1;
    602  1.1      cgd 				nap(2000);	draws(0,MAXX,0,MAXY);	return;
    603  1.1      cgd 
    604  1.1      cgd 	  case 16:	c[HOLDMONST] += 30; bottomline(); return; /* hold monster */
    605  1.1      cgd 
    606  1.1      cgd 	  case 17:	for (i=0; i<26; i++)	/* gem perfection */
    607  1.1      cgd 					switch(iven[i])
    608  1.1      cgd 						{
    609  1.1      cgd 						case ODIAMOND:	case ORUBY:
    610  1.1      cgd 						case OEMERALD:	case OSAPPHIRE:
    611  1.1      cgd 							j = ivenarg[i];  j &= 255;  j <<= 1;
    612  1.1      cgd 							if (j  > 255) j=255; /* double value */
    613  1.1      cgd 							ivenarg[i] = j;	break;
    614  1.1      cgd 						}
    615  1.1      cgd 				break;
    616  1.1      cgd 
    617  1.1      cgd 	  case 18:	for (i=0; i<11; i++)	c[exten[i]] <<= 1; /* spell extension */
    618  1.2  mycroft 				break;
    619  1.2  mycroft 
    620  1.1      cgd 	  case 19:	for (i=0; i<26; i++)	/* identify */
    621  1.1      cgd 					{
    622  1.1      cgd 					if (iven[i]==OPOTION)  potionname[ivenarg[i]] = potionhide[ivenarg[i]];
    623  1.1      cgd 					if (iven[i]==OSCROLL)  scrollname[ivenarg[i]] = scrollhide[ivenarg[i]];
    624  1.1      cgd 					}
    625  1.1      cgd 				break;
    626  1.1      cgd 
    627  1.1      cgd 	  case 20:	for (i=0; i<10; i++)	/* remove curse */
    628  1.1      cgd 					if (c[curse[i]]) c[curse[i]] = 1;
    629  1.1      cgd 				break;
    630  1.1      cgd 
    631  1.1      cgd 	  case 21:	annihilate();	break;	/* scroll of annihilation */
    632  1.1      cgd 
    633  1.1      cgd 	  case 22:	godirect(22,150,"The ray hits the %s",0,' ');	/* pulverization */
    634  1.1      cgd 				break;
    635  1.1      cgd 	  case 23:  c[LIFEPROT]++;  break; /* life protection */
    636  1.1      cgd 	  };
    637  1.1      cgd 	}
    638  1.1      cgd 
    639  1.1      cgd 
    640  1.1      cgd oorb()
    642  1.1      cgd 	{
    643  1.1      cgd 	}
    644  1.1      cgd 
    645  1.1      cgd opit()
    646  1.1      cgd 	{
    647  1.1      cgd 	register int i;
    648  1.1      cgd 	if (rnd(101)<81)
    649  1.1      cgd 	  if (rnd(70) > 9*c[DEXTERITY]-packweight() || rnd(101)<5)
    650  1.1      cgd 		if (level==MAXLEVEL-1) obottomless(); else
    651  1.1      cgd 		if (level==MAXLEVEL+MAXVLEVEL-1) obottomless(); else
    652  1.1      cgd 			{
    653  1.1      cgd 			if (rnd(101)<20)
    654  1.1      cgd 				{
    655  1.1      cgd 				i=0; lprcat("\nYou fell into a pit!  Your fall is cushioned by an unknown force\n");
    656  1.1      cgd 				}
    657  1.1      cgd 			else
    658  1.1      cgd 				{
    659  1.1      cgd 				i = rnd(level*3+3);
    660  1.1      cgd 				lprintf("\nYou fell into a pit!  You suffer %d hit points damage",(long)i);
    661  1.1      cgd 				lastnum=261; 	/*	if he dies scoreboard will say so */
    662  1.1      cgd 				}
    663  1.1      cgd 			losehp(i); nap(2000);  newcavelevel(level+1);  draws(0,MAXX,0,MAXY);
    664  1.1      cgd 			}
    665  1.1      cgd 	}
    666  1.1      cgd 
    667  1.1      cgd obottomless()
    668  1.1      cgd 	{
    669  1.1      cgd 	lprcat("\nYou fell into a bottomless pit!");  beep(); nap(3000);  died(262);
    670  1.1      cgd 	}
    671  1.1      cgd oelevator(dir)
    672  1.1      cgd 	int dir;
    673  1.1      cgd 	{
    674  1.1      cgd #ifdef lint
    675  1.1      cgd 	int x;
    676  1.1      cgd 	x=dir;
    677  1.1      cgd 	dir=x;
    678  1.1      cgd #endif lint
    679  1.1      cgd 	}
    680  1.1      cgd 
    681  1.1      cgd ostatue()
    682  1.1      cgd 	{
    683  1.1      cgd 	}
    684  1.1      cgd 
    685  1.1      cgd omirror()
    686  1.1      cgd 	{
    687  1.1      cgd 	}
    688  1.1      cgd 
    689  1.1      cgd obook()
    690  1.1      cgd 	{
    691  1.1      cgd 	lprcat("\nDo you ");
    692  1.1      cgd 	if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts();
    693  1.1      cgd 	while (1) switch(getchar())
    694  1.1      cgd 		{
    695  1.1      cgd 		case '\33':
    696  1.1      cgd 		case 'i':	ignore();	return;
    697  1.1      cgd 
    698  1.1      cgd 		case 'r':	if (c[BLINDCOUNT]) break;
    699  1.1      cgd 					lprcat("read");
    700  1.1      cgd 					/* no more book	*/	readbook(iarg[playerx][playery]);  forget(); return;
    701  1.1      cgd 
    702  1.1      cgd 		case 't':	lprcat("take");  if (take(OBOOK,iarg[playerx][playery])==0)  forget();	/* no more book	*/
    703  1.1      cgd 					return;
    704  1.1      cgd 		};
    705  1.1      cgd 	}
    706  1.1      cgd 
    707  1.1      cgd /*
    708  1.1      cgd 	function to read a book
    709  1.1      cgd  */
    710  1.1      cgd readbook(lev)
    711  1.1      cgd 	register int lev;
    712  1.1      cgd 	{
    713  1.1      cgd 	register int i,tmp;
    714  1.1      cgd 	if (lev<=3) i = rund((tmp=splev[lev])?tmp:1); else
    715  1.1      cgd 		i = rnd((tmp=splev[lev]-9)?tmp:1) + 9;
    716  1.1      cgd 	spelknow[i]=1;
    717  1.1      cgd 	lprintf("\nSpell \"%s\":  %s\n%s",spelcode[i],spelname[i],speldescript[i]);
    718  1.1      cgd 	if (rnd(10)==4)
    719  1.1      cgd 	 { lprcat("\nYour int went up by one!"); c[INTELLIGENCE]++; bottomline(); }
    720  1.1      cgd 	}
    721  1.1      cgd 
    722  1.1      cgd ocookie()
    723  1.1      cgd 	{
    724  1.1      cgd 	char *p;
    725  1.1      cgd 	lprcat("\nDo you (e) eat it, (t) take it"); iopts();
    726  1.1      cgd 	while (1) switch(getchar())
    727  1.1      cgd 		{
    728  1.1      cgd 		case '\33':
    729  1.1      cgd 		case 'i':	ignore();	return;
    730  1.1      cgd 
    731  1.1      cgd 		case 'e':	lprcat("eat\nThe cookie tasted good.");
    732  1.1      cgd 					forget(); /* no more cookie	*/
    733  1.1      cgd 					if (c[BLINDCOUNT]) return;
    734  1.1      cgd 					if (!(p=fortune(fortfile))) return;
    735  1.1      cgd 					lprcat("  A message inside the cookie reads:\n"); lprcat(p);
    736  1.1      cgd 					return;
    737  1.1      cgd 
    738  1.1      cgd 		case 't':	lprcat("take");  if (take(OCOOKIE,0)==0) forget();	/* no more book	*/
    739  1.1      cgd 					return;
    740  1.1      cgd 		};
    741  1.1      cgd 	}
    742  1.1      cgd 
    743  1.1      cgd 
    744  1.1      cgd /* routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth 100* the argument */
    745  1.1      cgd ogold(arg)
    746  1.1      cgd 	int arg;
    747  1.1      cgd 	{
    748  1.1      cgd 	register long i;
    749  1.1      cgd 	i = iarg[playerx][playery];
    750  1.1      cgd 	if (arg==OMAXGOLD) i *= 100;
    751  1.1      cgd 		else if (arg==OKGOLD) i *= 1000;
    752  1.1      cgd 			else if (arg==ODGOLD) i *= 10;
    753  1.1      cgd 	lprintf("\nIt is worth %d!",(long)i);	c[GOLD] += i;  bottomgold();
    754  1.1      cgd 	item[playerx][playery] = know[playerx][playery] = 0; /*	destroy gold	*/
    755  1.1      cgd 	}
    756  1.1      cgd 
    757  1.1      cgd ohome()
    758  1.1      cgd 	{
    759  1.1      cgd 	register int i;
    760  1.1      cgd 	nosignal = 1;	/* disable signals */
    761  1.1      cgd 	for (i=0; i<26; i++) if (iven[i]==OPOTION) if (ivenarg[i]==21)
    762  1.1      cgd 		{
    763  1.1      cgd 		iven[i]=0;	/* remove the potion of cure dianthroritis from inventory */
    764  1.1      cgd 		clear(); lprcat("Congratulations.  You found a potion of cure dianthroritis.\n");
    765  1.1      cgd 		lprcat("\nFrankly, No one thought you could do it.  Boy!  Did you surprise them!\n");
    766  1.1      cgd 		if (gtime>TIMELIMIT)
    767  1.1      cgd 			{
    768  1.1      cgd 			lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n");
    769  1.1      cgd 			lprcat("You didn't make it in time.  In your agony, you kill the doctor,\nyour wife, and yourself!  Too bad!\n");
    770  1.1      cgd 			nap(5000); died(269);
    771  1.1      cgd 			}
    772  1.1      cgd 		else
    773  1.1      cgd 			{
    774  1.1      cgd 			lprcat("\nThe doctor is now administering the potion, and in a few moments\n");
    775  1.1      cgd 			lprcat("Your daughter should be well on her way to recovery.\n");
    776  1.1      cgd 			nap(6000);
    777  1.1      cgd 			lprcat("\nThe potion is"); nap(3000); lprcat(" working!  The doctor thinks that\n");
    778  1.1      cgd 			lprcat("your daughter will recover in a few days.  Congratulations!\n");
    779  1.1      cgd 			beep(); nap(5000); died(263);
    780  1.1      cgd 			}
    781  1.1      cgd 		}
    782  1.1      cgd 
    783  1.1      cgd 	while (1)
    784  1.1      cgd 		{
    785  1.1      cgd 		clear(); lprintf("Welcome home %s.  Latest word from the doctor is not good.\n",logname);
    786  1.1      cgd 
    787  1.1      cgd 		if (gtime>TIMELIMIT)
    788  1.1      cgd 			{
    789  1.1      cgd 			lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n");
    790  1.1      cgd 			lprcat("You didn't make it in time.  In your agony, you kill the doctor,\nyour wife, and yourself!  Too bad!\n");
    791  1.1      cgd 			nap(5000); died(269);
    792  1.1      cgd 			}
    793  1.1      cgd 
    794  1.1      cgd 		lprcat("\nThe diagnosis is confirmed as dianthroritis.  He guesses that\n");
    795  1.1      cgd 		lprintf("your daughter has only %d mobuls left in this world.  It's up to you,\n",(long)((TIMELIMIT-gtime+99)/100));
    796  1.1      cgd 		lprintf("%s, to find the only hope for your daughter, the very rare\n",logname);
    797  1.1      cgd 		lprcat("potion of cure dianthroritis.  It is rumored that only deep in the\n");
    798  1.1      cgd 		lprcat("depths of the caves can this potion be found.\n\n\n");
    799  1.1      cgd 		lprcat("\n     ----- press "); standout("return");
    800  1.1      cgd 		lprcat(" to continue, "); standout("escape");
    801  1.1      cgd 		lprcat(" to leave ----- ");
    802  1.1      cgd 		i=getchar();  while (i!='\33' && i!='\n') i=getchar();
    803  1.1      cgd 		if (i=='\33') { drawscreen(); nosignal = 0; /* enable signals */ return; }
    804  1.1      cgd 		}
    805  1.1      cgd 	}
    806  1.1      cgd 
    807  1.1      cgd /*	routine to save program space	*/
    808               iopts()
    809               	{	lprcat(", or (i) ignore it? ");	}
    810               ignore()
    811               	{	lprcat("ignore\n");	}
    812               
    813