-+-+-+-+-+-+-+-+ START OF PART 23 -+-+-+-+-+-+-+-+ X /* show stuff around the player X */ X if (viewflag==0) X showcell(playerx,playery); X else X viewflag=0; X X if (hit3flag) X lflushall(); X hitflag=hit3flag=0; X bot_linex(); /* update bottom line */ X X /* get commands and make moves X */ X nomove=1; X while (nomove) X `7B X if (hit3flag) X lflushall(); X nomove=0; X parse(); X `7D X regen(); /* regenerate hp and spells */ X if (c`5BTIMESTOP`5D==0) X if (--rmst <= 0) X `7B X rmst = 120-(level<<2); X fillmonst(makemonst(level)); X `7D X `7D X `7D X X/* X subroutine to randomly create monsters if needed X */ Xstatic randmonst() X `7B X if (c`5BTIMESTOP`5D) return; /* don't make monsters if time is stopp Ved */ X if (--rmst <= 0) X `7B X rmst = 120 - (level<<2); fillmonst(makemonst(level)); X `7D X `7D X X`0C X/* X parse() X X get and execute a command X */ Xstatic parse() X `7B X register int i,j,k,flag; X extern showeat(),showquaff(),showread(); X X while (1) X `7B X k = yylex(); X switch(k) /* get the token from the input and switch on it */ X `7B X case '1': moveplayer(8); return; /* sw */ X case '2': moveplayer(1); return; /* s */ X case '3': moveplayer(7); return; /* se */ X case '4': moveplayer(4); return; /* w */ X case '5': if (yrepcount) viewflag=1; return; X case '6': moveplayer(2); return; /* e */ X case '7': moveplayer(6); return; /* nw */ X case '8': moveplayer(3); return; /* n */ X case '9': moveplayer(5); return; /* ne */ X case 'h': moveplayer(4); return; /* west */ X case 'H': run(4); return; /* west */ X case 'l': moveplayer(2); return; /* east */ X case 'L': run(2); return; /* east */ X case 'j': moveplayer(1); return; /* south */ X case 'J': run(1); return; /* south */ X case 'k': moveplayer(3); return; /* north */ X case 'K': run(3); return; /* north */ X case 'u': moveplayer(5); return; /* northeast */ X case 'U': run(5); return; /* northeast */ X case 'y': moveplayer(6); return; /* northwest */ X case 'Y': run(6); return; /* northwest */ X case 'n': moveplayer(7); return; /* southeast */ X case 'N': run(7); return; /* southeast */ X case 'b': moveplayer(8); return; /* southwest */ X case 'B': run(8); return; /* southwest */ X X case '.': /* stay here */ X if (yrepcount)`20 X viewflag=1; X return; X X case 'c': X yrepcount=0; X cast(); X return; /* cast a spell */ X X case 'd': X yrepcount=0; X if (c`5BTIMESTOP`5D==0) X dropobj(); X return; /* to drop an object */ X X case 'e': X yrepcount=0; X if (c`5BTIMESTOP`5D==0) X if (!floor_consume( OCOOKIE, "eat" )) X consume( OCOOKIE, "eat", showeat ); X return; /* to eat a fortune cookie */ X X case 'g': `20 X yrepcount = 0 ; X cursors(); X lprintf("\nThe stuff you are carrying presently weighs %d po Vunds",(long)packweight()); X break ; X X case 'i': /* inventory */ X yrepcount=0; X nomove=1; X showstr(FALSE); X return; X X case 'p': /* pray at an altar */ X yrepcount = 0; X if (!prompt_mode) X pray_at_altar(); X else X nomove = 1; X return; X X case 'q': /* quaff a potion */ X yrepcount=0; X if (c`5BTIMESTOP`5D==0) X if (!floor_consume( OPOTION, "quaff")) X consume( OPOTION, "quaff", showquaff ); X return; X X case 'r': X yrepcount=0; X if (c`5BBLINDCOUNT`5D) X `7B X cursors(); X lprcat("\nYou can't read anything when you're blind!"); X `7D X else if (c`5BTIMESTOP`5D==0) X if (!floor_consume( OSCROLL, "read" )) X if (!floor_consume( OBOOK, "read" )) X consume( OSCROLL, "read", showread ); X return; /* to read a scroll */ X X case 's': X yrepcount = 0 ; X if (!prompt_mode) X sit_on_throne(); X else X nomove = 1; X return ; X X case 't': /* Tidy up at fountain */ X yrepcount = 0 ; X if (!prompt_mode) X wash_fountain() ; X else X nomove = 1; X return ; X X case 'v': X yrepcount=0; X nomove = 1; X cursors(); X lprintf("\nCaverns of Larn, Version %d.%d.%d, Diff=%d",(long V)VERSION,(long)SUBVERSION,(long)PATCHLEVEL,(long)c`5BHARDGAME`5D); X if (wizard) X lprcat(" Wizard"); X if (cheat)`20 X lprcat(" Cheater"); X lprcat("\nThis version of Larn by Kevin Routley"); X return; X X case 'w': /* wield a weapon */ X yrepcount=0; X wield(); X return; X X case 'A': X yrepcount = 0; X if (!prompt_mode) X desecrate_altar(); X else X nomove = 1; X return; X X case 'C': /* Close something */ X yrepcount = 0 ; X if (!prompt_mode) X close_something(); X else X nomove = 1; X return; X X case 'D': /* Drink at fountain */ X yrepcount = 0 ; X if (!prompt_mode) X drink_fountain() ; X else X nomove = 1; X return ; X X case 'E': /* Enter a building */ X yrepcount = 0 ; X if (!prompt_mode) X enter() ; X else X nomove = 1; X break ; X X case 'I': /* list spells and scrolls */ X yrepcount=0; X seemagic(0); X nomove=1; X return; X X case 'O': /* Open something */ X yrepcount = 0 ; X if (!prompt_mode) X open_something(); X else X nomove = 1; X return; X X case 'P': X cursors(); X yrepcount = 0; X nomove = 1; X if (outstanding_taxes>0) X lprintf("\nYou presently owe %d gp in taxes.",(long)outs Vtanding_taxes); X else X lprcat("\nYou do not owe any taxes."); X return; X X case 'Q': /* quit */ X yrepcount=0; X quit(); X nomove=1; X return; X X case 'R' : /* remove gems from a throne */ X yrepcount = 0 ; X if (!prompt_mode) X remove_gems( ); X else X nomove = 1; X return ; X X# ifdef MSDOS X case 'S': X /* Set up error recovery X */ X if (setjmp(save_jbuf) != 0) `7B X X /* can't use lwclose! X */ X if (lfd > 2) X close(lfd); X lcreat(NULL); X setscroll(); X cursors(); X lprcat("\nSave failed !\n"); X if (errno == ENOSPC) X lprcat("Disk is full !\n"); X beep(); X (void) unlink(savefilename); X save_mode = 0; X yrepcount = 0; X nomove = 1; X break; X `7D X X /* And do the save. X */ X cursors(); X lprintf("\nSaving to `60%s' . . . ", savefilename); X lflush(); X save_mode = 1; X savegame(savefilename); X clear(); X lflush(); X wizard=1; X died(-257); /* doesn't return */ X break; X# else X case 'S': clear(); lprcat("Saving . . ."); lflush(); `20 X savegame(savefilename); wizard=1; died(-257); /* V save the game - doesn't return */ X# endif MSDOS X X case 'T': yrepcount=0; cursors(); if (c`5BSHIELD`5D != -1) V `7B c`5BSHIELD`5D = -1; lprcat("\nYour shield is off"); bottomline(); `7D e Vlse X if (c`5BWEAR`5D != -1) `7B c`5BWEAR` V5D = -1; lprcat("\nYour armor is off"); bottomline(); `7D X else lprcat("\nYou aren't wearing anything"); X return; X X case 'W': X yrepcount=0; X wear(); X return; /* wear armor */ X X case 'Z': X yrepcount=0; X if (c`5BLEVEL`5D>9)`20 X `7B`20 X oteleport(1); X return;`20 X `7D X cursors();`20 X lprcat("\nAs yet, you don't have enough experience to use te Vleportation"); X return; /* teleport yourself */ X X case ' ': yrepcount=0; nomove=1; return; X X# ifdef MSDOS X case 'D'-64: X yrepcount = 0; X nomove = 1; X levelinfo(); X return; X# endif X X case 'L'-64: yrepcount=0; drawscreen(); nomove=1; return; V /* look */ X X#if WIZID X#ifdef EXTRA X case 'A'-64: yrepcount=0; nomove=1; if (wizard) `7B diag() V; return; `7D /* create diagnostic file */ X return; X#endif X#endif X case '<': /* Go up stairs or vol shaft */ X yrepcount = 0 ; X if (!prompt_mode) X up_stairs(); X else X nomove = 1; X return ; X X case '>': /* Go down stairs or vol shaft*/ X yrepcount = 0 ; X if (!prompt_mode) X down_stairs(); X else X nomove = 1; X return ; X X case '?': /* give the help screen */ X yrepcount=0; X help(); X nomove=1; X return;`20 X X case ',': /* pick up an item */ X yrepcount = 0 ; X if (!prompt_mode) X /* pickup, don't identify or prompt for action */ X lookforobject( FALSE, TRUE, FALSE ); X else X nomove = 1; X return; X X case ':': /* look at object */ X yrepcount = 0 ; X if (!prompt_mode) X /* identify, don't pick up or prompt for action */ X lookforobject( TRUE, FALSE, FALSE ); X nomove = 1; /* assumes look takes no time */ X return; X X case '@': /* toggle auto-pickup */ X yrepcount = 0 ; X nomove = 1; X cursors(); X lprcat("\nAuto pickup: "); X auto_pickup = !auto_pickup; X if (auto_pickup) X lprcat("On."); X else X lprcat("Off."); X return; X X case '/': /* identify object/monster */ X specify_object(); X nomove = 1 ; X yrepcount = 0 ; X return; X X case '`5E': /* identify traps */ X flag = yrepcount = 0; X cursors(); X lprc('\n'); X for (j=playery-1; j= MAXY) X break; X for (i=playerx-1; i= MAXX)`20 X break; X switch(item`5Bi`5D`5Bj`5D) X `7B X case OTRAPDOOR: case ODARTRAP: X case OTRAPARROW: case OTELEPORTER: X case OPIT: X lprcat("\nIts "); X lprcat(objectname`5Bitem`5Bi`5D`5Bj`5D`5D); X flag++; X `7D; X `7D +-+-+-+-+-+-+-+- END OF PART 23 +-+-+-+-+-+-+-+-