billr@saab.CNA.TEK.COM (Bill Randle) (12/19/90)
Submitted-by: routley@tle.ENET.DEC.COM (Kevin Routley) Posting-number: Volume 11, Issue 92 Archive-name: larn/Part09 Environment: Unix, VMS, MS-DOS, termcap #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 9 (of 11)." # Contents: action.c larn_hlp.uue moreobj.c regen.c tgetent.c # Wrapped by billr@saab on Tue Dec 18 10:14:22 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'action.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'action.c'\" else echo shar: Extracting \"'action.c'\" \(13238 characters\) sed "s/^X//" >'action.c' <<'END_OF_FILE' X/* X action.c X X Routines to perform the actual actions associated with various X player entered commands. X X act_remove_gems remove gems from a throne X act_sit_throne sit on a throne X act_kick_stairs kick the stairs X act_up_stairs go up stairs X act_down_stairs go down stairs X act_drink_fountain drink from a fountain X act_wash_fountain wash at a fountain X act_up_shaft up volcanic shaft X act_down_shaft down volcanic shaft X volshaft_climbed place player near volcanic shaft X act_desecrate_altar desecrate an altar X act_donation_pray pray, donating money X act_just_pray pray, not donating money X act_prayer_heard prayer was heard X act_ignore_altar ignore an altar X act_open_chest open a chest X act_open_door open a door X*/ X X#include "header.h" X X/* X act_remove_gems X X Remove gems from a throne. X X arg is zero if there is a gnome king associated with the throne X X Assumes that cursors() has been called previously, and that a check X has been made that the throne actually has gems. X*/ Xact_remove_gems( arg ) Xint arg ; X { X int i, k ; X X k=rnd(101); X if (k<25) X { X for (i=0; i<rnd(4); i++) X creategem(); /* gems pop off the throne */ X item[playerx][playery]=ODEADTHRONE; X know[playerx][playery]=0; X } X else if (k<40 && arg==0) X { X createmonster(GNOMEKING); X item[playerx][playery]=OTHRONE2; X know[playerx][playery]=0; X } X else X lprcat("\nNothing happens"); X X return ; X } X X/* X act_sit_throne X X Sit on a throne. X X arg is zero if there is a gnome king associated with the throne X X Assumes that cursors() has been called previously. X*/ Xact_sit_throne( arg ) Xint arg ; X { X int k ; X X k=rnd(101); X if (k<30 && arg==0) X { X createmonster(GNOMEKING); X item[playerx][playery]=OTHRONE2; X know[playerx][playery]=0; X } X else if (k<35) X { X lprcat("\nZaaaappp! You've been teleported!\n"); X beep(); X oteleport(0); X } X else X lprcat("\nNothing happens"); X X return ; X } X X/* X assumes that cursors() has been called, and that a check has been made X that the player is actually standing at a set of stairs. X*/ Xact_kick_stairs() X { X int k ; X X if (rnd(2) == 1) X lprcat("\nI hope you feel better. Showing anger rids you of frustration."); X else X { X k = rnd((level + 1) << 1) ; X lprintf("\nYou hurt your foot dumb dumb! You suffer %d hit points", (long)k ); X lastnum = 276 ; X losehp(k) ; X bottomline(); X } X return ; X} X X/* X assumes that cursors() has been called and that a check has been made that X the user is actually standing at a set of up stairs. X*/ Xact_up_stairs() X { X if (level >= 2 && level != 11) X { X newcavelevel( level - 1 ) ; X draws( 0, MAXX, 0, MAXY ); X bot_linex() ; X } X else X lprcat("\nThe stairs lead to a dead end!") ; X return ; X } X X/* X assumes that cursors() has been called and that a check has been made that X the user is actually standing at a set of down stairs. X*/ Xact_down_stairs() X { X if (level != 0 && level != 10 && level != 13) X { X newcavelevel( level + 1 ) ; X draws( 0, MAXX, 0, MAXY ); X bot_linex() ; X } X else X lprcat("\nThe stairs lead to a dead end!") ; X return ; X } X X/* X Code to perform the action of drinking at a fountian. Assumes that X cursors() has already been called, and that a check has been made that X the player is actually standing at a live fountain. X*/ Xact_drink_fountain() X { X int x ; X X if (rnd(1501)<2) X { X lprcat("\nOops! You seem to have caught the dreadful sleep!"); X beep(); X lflush(); X sleep(3); X died(280); X return; X } X X x = rnd(100); X if (x<7) X { X c[HALFDAM] += 200 + rnd(200); X lprcat("\nYou feel a sickness coming on"); X } X X else if (x < 13) X quaffpotion(23, FALSE ); /* see invisible,but don't know the potion */ X X else if (x < 45) X lprcat("\nnothing seems to have happened"); X X else if (rnd(3) != 2) X fntchange(1); /* change char levels upward */ X X else X fntchange(-1); /* change char levels downward */ X X if (rnd(12)<3) X { X lprcat("\nThe fountains bubbling slowly quiets"); X item[playerx][playery]=ODEADFOUNTAIN; /* dead fountain */ X know[playerx][playery]=0; X } X return; X } X X/* X Code to perform the action of washing at a fountain. Assumes that X cursors() has already been called and that a check has been made that X the player is actually standing at a live fountain. X*/ Xact_wash_fountain() X { X int x ; X X if (rnd(100) < 11) X { X x=rnd((level<<2)+2); X lprintf("\nOh no! The water was foul! You suffer %d hit points!",(long)x); X lastnum=273; X losehp(x); X bottomline(); X cursors(); X } X X else if (rnd(100) < 29) X lprcat("\nYou got the dirt off!"); X X else if (rnd(100) < 31) X lprcat("\nThis water seems to be hard water! The dirt didn't come off!"); X X else if (rnd(100) < 34) X createmonster(WATERLORD); /* make water lord */ X X else X lprcat("\nnothing seems to have happened"); X X return; X } X X/* X Perform the act of climbing down the volcanic shaft. Assumes X cursors() has been called and that a check has been made that X are actually at a down shaft. X*/ Xact_down_shaft() X { X if (level!=0) X { X lprcat("\nThe shaft only extends 5 feet downward!"); X return; X } X X if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) X { X lprcat("\nYou slip and fall down the shaft"); X beep(); X lastnum=275; X losehp(30+rnd(20)); X bottomhp(); X } X else if (prompt_mode) X lprcat("climb down"); X X nap(3000); X newcavelevel(MAXLEVEL); X volshaft_climbed( OVOLUP ); X return; X } X X/* X Perform the action of climbing up the volcanic shaft. Assumes X cursors() has been called and that a check has been made that X are actually at an up shaft. X X*/ Xact_up_shaft() X { X if (level!=11) X { X lprcat("\nThe shaft only extends 8 feet upwards before you find a blockage!"); X return; X } X X if (packweight() > 45+5*(c[STRENGTH]+c[STREXTRA])) X { X lprcat("\nYou slip and fall down the shaft"); X beep(); X lastnum=275; X losehp(15+rnd(20)); X bottomhp(); X return; X } X X if (prompt_mode) X lprcat("climb up"); X lflush(); X nap(3000); X newcavelevel(0); X volshaft_climbed( OVOLDOWN ); X return; X } X X/* X Perform the action of placing the player near the volcanic shaft X after it has been climbed. X X Takes one parameter: the volcanic shaft object to be found. If have X climbed up, search for OVOLDOWN, otherwise search for OVOLUP. X*/ Xstatic volshaft_climbed(object) Xint object; X { X int i,j ; X X /* place player near the volcanic shaft */ X for (i=0; i<MAXY; i++) X for (j=0; j<MAXX; j++) X if (item[j][i] == object) X { X playerx=j; X playery=i; X positionplayer(); X i=MAXY; X break; X } X draws(0,MAXX,0,MAXY); X bot_linex(); X return ; X } X X/* X Perform the actions associated with Altar desecration. X*/ Xact_desecrate_altar() X { X if (rnd(100)<60) X { X createmonster(makemonst(level+2)+8); X c[AGGRAVATE] += 2500; X } X else if (rnd(101)<30) X { X lprcat("\nThe altar crumbles into a pile of dust before your eyes"); X forget(); /* remember to destroy the altar */ X } X else X lprcat("\nnothing happens"); X return ; X } X X/* X Perform the actions associated with praying at an altar and giving a X donation. X*/ Xact_donation_pray() X { X unsigned long k,temp ; X X lprcat("\n\n"); X cursor(1,24); X cltoeoln(); X cursor(1,23); X cltoeoln(); X lprcat("how much do you donate? "); X k = readnum((long)c[GOLD]); X X/* VMS has a problem with echo mode input (used in readnum()) such that the X next carriage return will shift the screen up one line. To get around X this, if we are VMS, don't print the next carriage return. Otherwise, X print the carriage return needed by all following messages. X*/ X#ifndef VMS X#ifndef ultrix X lprcat("\n"); X#endif X#endif X X /* make giving zero gold equivalent to 'just pray'ing. Allows player to X 'just pray' in command mode, without having to add yet another command. X */ X if (k == 0) X { X act_just_pray(); X return; X } X X if (c[GOLD]<k) X { X lprcat("You don't have that much!"); X return; X } X temp = c[GOLD] / 10 ; X c[GOLD] -= k; X /* if player gave less than 10% of _original_ gold, make a monster X */ X if (k < temp || k<rnd(50)) X { X createmonster(makemonst(level+1)); X c[AGGRAVATE] += 200; X } X else if (rnd(101) > 50) X { X act_prayer_heard(); X return; X } X else if (rnd(43) == 5) X { X if (c[WEAR]) X lprcat("You feel your armor vibrate for a moment"); X enchantarmor(); X return; X } X else if (rnd(43) == 8) X { X if (c[WIELD]) X lprcat("You feel your weapon vibrate for a moment"); X enchweapon(); X return; X } X else X lprcat("Thank You."); X bottomline(); X return ; X } X X/* X Performs the actions associated with 'just praying' at the altar. Called X when the user responds 'just pray' when in prompt mode, or enters 0 to X the money prompt when praying. X X Assumes cursors(), and that any leading \n have been printed (to get X around VMS echo mode problem. X*/ Xact_just_pray() X { X if (rnd(100)<75) X lprcat("nothing happens"); X else if (rnd(43) == 10) X { X if (c[WEAR]) X lprcat("You feel your armor vibrate for a moment"); X enchantarmor(); X return; X } X else if (rnd(43) == 10) X { X if (c[WIELD]) X lprcat("You feel your weapon vibrate for a moment"); X enchweapon(); X return; X } X else X createmonster(makemonst(level+1)); X return; X } X X/* X function to cast a +3 protection on the player X */ Xstatic act_prayer_heard() X { X lprcat("You have been heard!"); X if (c[ALTPRO]==0) X c[MOREDEFENSES]+=3; X c[ALTPRO] += 500; /* protection field */ X bottomline(); X } X X/* X Performs the act of ignoring an altar. X X Assumptions: cursors() has been called. X*/ Xact_ignore_altar() X { X if (rnd(100)<30) X { X createmonster(makemonst(level+1)); X c[AGGRAVATE] += rnd(450); X } X else X lprcat("\nNothing happens"); X return; X } X X/* X Performs the act of opening a chest. X X Parameters: x,y location of the chest to open. X Assumptions: cursors() has been called previously X*/ Xact_open_chest(x,y) Xint x,y ; X { X int i,k; X X k=rnd(101); X if (k<40) X { X lprcat("\nThe chest explodes as you open it"); beep(); X i = rnd(10); lastnum=281; /* in case he dies */ X lprintf("\nYou suffer %d hit points damage!",(long)i); X checkloss(i); X switch(rnd(10)) /* see if he gets a curse */ X { X case 1: c[ITCHING]+= rnd(1000)+100; X lprcat("\nYou feel an irritation spread over your skin!"); X beep(); X break; X X case 2: c[CLUMSINESS]+= rnd(1600)+200; X lprcat("\nYou begin to lose hand to eye coordination!"); X beep(); X break; X X case 3: c[HALFDAM]+= rnd(1600)+200; X beep(); X lprcat("\nA sickness engulfs you!"); break; X }; X item[x][y]=know[x][y]=0; /* destroy the chest */ X if (rnd(100)<69) creategem(); /* gems from the chest */ X dropgold(rnd(110*iarg[playerx][playery]+200)); X for (i=0; i<rnd(4); i++) something(iarg[playerx][playery]+2); X } X else X lprcat("\nNothing happens"); X return; X } X X/* X Perform the actions common to command and prompt mode when opening a X door. Assumes cursors(). X X Parameters: the X,Y location of the door to open. X Return value: TRUE if successful in opening the door, false if not. X*/ Xact_open_door( x, y ) Xint x ; Xint y ; X { X if (rnd(11)<7) X { X switch(iarg[x][y]) X { X case 6: c[AGGRAVATE] += rnd(400); break; X X case 7: lprcat("\nYou are jolted by an electric shock "); X lastnum=274; losehp(rnd(20)); bottomline(); break; X X case 8: loselevel(); break; X X case 9: lprcat("\nYou suddenly feel weaker "); X if (c[STRENGTH]>3) c[STRENGTH]--; X bottomline(); break; X X default: break; X } X return( 0 ); X } X else X { X know[x][y]=0; X item[x][y]=OOPENDOOR; X return( 1 ); X } X } END_OF_FILE if test 13238 -ne `wc -c <'action.c'`; then echo shar: \"'action.c'\" unpacked with wrong size! fi # end of 'action.c' fi if test -f 'larn_hlp.uue' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'larn_hlp.uue'\" else echo shar: Extracting \"'larn_hlp.uue'\" \(11215 characters\) sed "s/^X//" >'larn_hlp.uue' <<'END_OF_FILE' Xbegin 644 larn.hlp XM-R`@("!796QC;VUE('1O('1H92!G86UE(&]F($QA<FXN("!!="!T:&ES(&UO XM;65N="P@>6]U(&9A8V4@82!G<F5A="!P<F]B;&5M+@I9;W5R(&1A=6=H=&5R XM(&AA<R!C;VYT<F%C=&5D(&$@<W1R86YG92!D:7-E87-E+"!A;F0@;F]N92!O XM9B!Y;W5R(&AO;64@<F5M961I97,*<V5E;2!T;R!H879E(&%N>2!E9F9E8W0N XM("!9;W4@<V5N<V4@=&AA="!S:&4@:7,@:6X@;6]R=&%L(&1A;F=E<BP@86YD XM('EO=2!M=7-T"G1R>2!T;R!S879E(&AE<BX@(%1I;64@86=O('EO=2!H96%R XM9"!O9B!A(&QA;F0@;V8@9W)E870@9&%N9V5R(&%N9"!O<'!O<G1U;FET>2X* XM4&5R:&%P<R!H97)E(&ES('1H92!S;VQU=&EO;B!Y;W4@;F5E9"X*"B`@("!) XM="!H87,@8F5E;B!S86ED('1H870@=&AE<F4@;VYC92!W87,@82!G<F5A="!M XM86=I8VEA;B!W:&\@8V%L;&5D(&AI;7-E;&8*4&]L:6YN96%U<RX@($UA;GD@ XM>65A<G,@86=O+"!A9G1E<B!H879I;F<@;6%N>2!M:7)A8W5L;W5S('-U8V-E XM<W-E<RP@4&]L:6YN96%U<PIR971I<F5D('1O('1H92!C879E<FYS(&]F($QA XM<FXL('=H97)E(&AE(&1E=F]T960@;6]S="!O9B!H:7,@=&EM92!T;R!T:&4* XM8W)E871I;VX@;V8@;6%G:6,N("`@4G5M;W)S(&AA=F4@:70@=&AA="!O;F4@ XM9&%Y(%!O;&EN;F5A=7,@<V5T(&]U="!T;R!D:7-P96P*86X@871T86-K:6YG XM(&%R;7D@:6X@82!F;W)E<W0@<V]M92!D:7-T86YC92!T;R!T:&4@;F]R=&@N XM("!)="!I<R!B96QI979E9"!T:&%T"FAE<F4@:&4@;65T(&AI<R!D96UI<V4N XM"@H@("`@5&AE(&-A=F5R;G,@;V8@3&%R;BP@:70@:7,@=&AO=6=H="P@;75S XM="!B92!M86=N:69I8V5N="!I;B!D97-I9VXL"F%N9"!C;VYT86EN(&UU8V@@ XM;6%G:6,@86YD('1R96%S=7)E+B`@3VYE(&]P=&EO;B!Y;W4@:&%V92!I<R!T XM;R!U;F1E<G1A:V4@80IJ;W5R;F5Y(&EN=&\@=&AE<V4@8V%V97)N<RX*"@H@ XM("`@1V]O9"!,=6-K(2`@66]U)W)E(&=O:6YG('1O(&YE960@:70A"@H*"@H@ XM("`@("`@("`@("`@("`@&ULT;4AE;'`@1FEL92!F;W(@5&AE($-A=F5R;G,@ XM;V8@3&%R;BP@4')O;7!T($UO9&4;6VT*"F(@(&UO=F4@<V]U=&AW97-T("`@ XM("`@("`@($(@(')U;B!S;W5T:'=E<W0@("`@("`@("`@("!3("!S879E('1H XM92!G86UE"F@@(&UO=F4@;&5F="`@("`@("`@("`@("`@($@@(')U;B!L969T XM("`@("`@("`@("`@("`@("`N("!S=&%Y(&AE<F4*:B`@;6]V92!D;W=N("`@ XM("`@("`@("`@("`@2B`@<G5N(&1O=VX@("`@("`@("`@("`@("`@(%X@(&ED XM96YT:69Y(&$@=')A<`IK("!M;W9E('5P("`@("`@("`@("`@("`@("!+("!R XM=6X@=7`@("`@("`@("`@("`@("`@("`@5"`@=&%K92!O9F8@87)M;W(*;"`@ XM;6]V92!R:6=H="`@("`@("`@("`@("`@3"`@<G5N(')I9VAT"FX@(&UO=F4@ XM<V]U=&AE87-T("`@("`@("`@($X@(')U;B!S;W5T:&5A<W0*=2`@;6]V92!N XM;W)T:&5A<W0@("`@("`@("`@52`@<G5N(&YO<G1H96%S=`IY("!M;W9E(&YO XM<G1H=V5S="`@("`@("`@("!9("!R=6X@;F]R=&AW97-T("`@("`@("`@("`@ XM7DP@<F5D<F%W('1H92!S8W)E96X*8R`@8V%S="!A('-P96QL("`@("`@("`@ XM("`@6B`@=&5L97!O<G0@>6]U<G-E;&8*9"`@9')O<"!A;B!I=&5M("`@("`@ XM("`@("`@92`@96%T('-O;65T:&EN9PIG("!G970@<')E<V5N="!P86-K('=E XM:6=H="!0("!G:79E('1A>"!S=&%T=7,*:2`@:6YV96YT;W)Y('EO=7(@<&]C XM:V5T<R`@22`@;&ES="!A;&P@:71E;7,@9F]U;F0@("`@(#\@('1H:7,@:&5L XM<"!S8W)E96X*<2`@<75A9F8@82!P;W1I;VX@("`@("`@("`@42`@<75I="!T XM:&4@9V%M90IR("!R96%D(&$@<V-R;VQL("`@("`@("`@("!V("!P<FEN="!P XM<F]G<F%M('9E<G-I;VX*=R`@=V5I;&0@82!W96%P;VX@("`@("`@("`@5R`@ XM=V5A<B!A<FUO<B`@("`@("`@("`@("`@(%Y,(')E9')A=R!T:&4@<V-R965N XM"@H*"@H*"B`@("`@("`@("`@("`@("`;6S1M2&5L<"!&:6QE(&9O<B!4:&4@ XM0V%V97)N<R!O9B!,87)N+"!#;VUM86YD($UO9&4;6VT*"F(@(&UO=F4@<V]U XM=&AW97-T("`@("`@("`@($(@(')U;B!S;W5T:'=E<W0@("`@("`@("`@("!! XM("!D97-E8W)A=&4@86X@86QT87(*8R`@8V%S="!A('-P96QL("`@("`@("`@ XM("`@0R`@8VQO<V4@82!D;V]R("`@("`@("`@("`@(%H@('1E;&5P;W)T('EO XM=7)S96QF"F0@(&1R;W`@86X@:71E;2`@("`@("`@("`@($0@(&1R:6YK(&%T XM(&$@9F]U;G1A:6X@("`@("`\("!G;R!U<"!S=&%I<G,@;W(*92`@96%T('-O XM;65T:&EN9R`@("`@("`@("`@12`@96YT97(@82!S=&]R92P@9'5N9V5O;B`@ XM("`@('9O;&-A;FEC('-H869T"F<@(&=E="!P<F5S96YT('!A8VL@=V5I9VAT XM($<@(&=I=F4@=&AE('-T86ER<R!A(&MI8VL@("`^("!G;R!D;W=N('-T86ER XM<R!O<@IH("!M;W9E(&QE9G0@("`@("`@("`@("`@("!(("!R=6X@;&5F="`@ XM("`@("`@("`@("`@("`@("`@=F]L8V%N:6,@<VAA9G0*:2`@:6YV96YT;W)Y XM('EO=7(@<&]C:V5T<R`@22`@;&ES="!A;&P@:71E;7,@9F]U;F0@("`@(#\@ XM('1H:7,@:&5L<"!S8W)E96X*:B`@;6]V92!D;W=N("`@("`@("`@("`@("`@ XM2B`@<G5N(&1O=VX@("`@("`@("`@("`@("`@(%X@(&ED96YT:69Y(&$@=')A XM<`IK("!M;W9E('5P("`@("`@("`@("`@("`@("!+("!R=6X@=7`@("`@("`@ XM("`@("`@("`@("`@+"`@<&EC:R!U<"!I=&5M"FP@(&UO=F4@<FEG:'0@("`@ XM("`@("`@("`@($P@(')U;B!R:6=H="`@("`@("`@("`@("`@("`Z("!L;V]K XM(&%T(&]B:F5C=`IN("!M;W9E('-O=71H96%S="`@("`@("`@("!.("!R=6X@ XM<V]U=&AE87-T"B`@("`@("`@("`@("`@("`@("`@("`@("`@($\@(&]P96X@ XM82!D;V]R(&]R(&-H97-T("`@("`N("!S=&%Y(&AE<F4*<"`@<')A>2!A="!A XM;B!A;'1A<B`@("`@("`@4"`@9VEV92!T87@@<W1A='5S"G$@('%U869F(&$@ XM<&]T:6]N("`@("`@("`@(%$@('%U:70@=&AE(&=A;64*<B`@<F5A9"!A('-C XM<F]L;"`@("`@("`@("`@4B`@<F5M;W9E(&=E;7,@9G)O;2!T:')O;F4*<R`@ XM<VET(&]N(&$@=&AR;VYE("`@("`@("`@4R`@<V%V92!T:&4@9V%M90IT("!T XM:61Y('5P(&%T(&$@9F]U;G1A:6X@("!4("!T86ME(&]F9B!A<FUO<@IU("!M XM;W9E(&YO<G1H96%S="`@("`@("`@("!5("!R=6X@;F]R=&AE87-T"G8@('!R XM:6YT('!R;V=R86T@=F5R<VEO;@IW("!W96EL9"!A('=E87!O;B`@("`@("`@ XM("!7("!W96%R(&%R;6]R"GD@(&UO=F4@;F]R=&AW97-T("`@("`@("`@(%D@ XM(')U;B!N;W)T:'=E<W0@("`@("`@("`@("!>3"!R961R87<@=&AE('-C<F5E XM;@H@("`@("`@("`@("`@("`@&ULW;5-P96-I86P@3F]T97,;6VT*"E=H96X@ XM&ULW;61R;W!P:6YG(&=O;&0;6VTL(&EF('EO=2!T>7!E("<J)R!A<R!Y;W5R XM(&%M;W5N="P@86QL('EO=7(@9V]L9"!G971S(&1R;W!P960N"DEN(&=E;F5R XM86PL('1Y<&EN9R!I;B`G*B<@;65A;G,@86QL(&]F('=H870@>6]U<B!I;G1E XM<F5S=&5D(&EN+B`@5&AI<R!I<R!T<G5E"G=H96X@=FES:71I;F<@=&AE(&)A XM;FLL(&]R('=H96X@8V]N=')I8G5T:6YG(&%T(&%L=&%R<RX*"DQA<FX@;F5E XM9',@=&AE($%.4TDN4UE3("AO<B!P<F5F97)A8FQY+"!T:&4@3D%.4TDN4UE3 XM*2!D979I8V4@9')I=F5R(&EN<W1A;&QE9`II;B!Y;W5R($-/3D9)1RY365,@ XM9FEL92X@(%1H92!S=7!P;&EE9"`B=&5R;6-A<"(@9FEL92!D97-C<FEB97,@ XM=&AE(&5S8V%P90IS97%U96YC97,@=&\@8VAA;F=E('9I9&5O(&UO9&5S("AS XM964@8V@@,3,@;V8@=&AE($1/4R`R+C`@;6%N=6%L*2X@(%-E92!T:&4*(E1% XM4DU#05`B('-E8W1I;VX@:6X@3$%23BY$3T,@9F]R(&9U<G1H97(@9&5T86EL XM<RX*"E=H96X@:6X@=&AE('-T;W)E+"!T<F%D:6YG('!O<W0L('-C:&]O;"P@ XM;W(@:&]M92P@86X@&ULW;3QE<V-A<&4^&UMM('=I;&P@9V5T('EO=2!O=70N XM"@I7:&5N(&-A<W1I;F<@82!S<&5L;"P@:68@>6]U(&YE960@82!L:7-T(&]F XM('-P96QL<R!Y;W4@8V%N(&-A<W0L('1Y<&4@)QM;-VU$&UMM)R!A<PIT:&4@ XM9FER<W0@;&5T=&5R(&]F('EO=7(@<W!E;&PN("!4:&4@879A:6QA8FQE(&QI XM<W0@;V8@<W!E;&QS('=I;&P@8F4@<VAO=VXL"F%F=&5R('=H:6-H('EO=2!M XM87D@96YT97(@=&AE('-P96QL(&-O9&4N("!4:&ES(&]N;'D@=V]R:W,@;VX@ XM=&AE(#%S="!L971T97(*;V8@=&AE('-P96QL('EO=2!A<F4@8V%S=&EN9RX* XM"E1H92!!=71H;W(@;V8@3&%R;B!I<R!.;V%H($UO<F=A;B`H,3DX,BTS*2P@ XM0V]P>6EN9R!F;W(@4')O9FET(&ES(%!R;VAI8FET960*0V]P>7)I9VAT(#$Y XM.#8@8GD@3F]A:"!-;W)G86XL($%L;"!2:6=H=',@4F5S97)V960N"@H*"B`@ XM("`@("`@("`@("`@("`@("`@("`@(!M;-VU,87)N($-O;6UA;F0@3&EN92!/ XM<'1I;VYS&UMM"@IL87)N("LK("`@("`@("`@("`@("`@("!R97-T;W)E(&-H XM96-K<&]I;G1E9"!G86UE"FQA<FX@+7,@("`@("`@("`@("`@("`@(&QI<W0@ XM=&AE('-C;W)E8F]A<F0*;&%R;B`M:2`@("`@("`@("`@("`@("`@;&ES="!S XM8V]R97,@=VET:"!I;G9E;G1O<FEE<PIL87)N("UN("`@("`@("`@("`@("`@ XM("!S=7!P<F5S<R!W96QC;VUE(&UE<W-A9V4@=VAE;B!B96=I;FYI;F<@82!G XM86UE"FQA<FX@+6@@("`@("`@("`@("`@("`@('!R:6YT(&]U="!A;&P@=&AE XM(&-O;6UA;F0@;&EN92!O<'1I;VYS"FQA<FX@+3QN=6UB97(^("`@("`@("`@ XM('-P96-I9GD@9&EF9FEC=6QT>2!O9B!T:&4@9V%M92`H;6%Y(&)E('5S960@ XM=VET:"`M;BD*;&%R;B`M;SQO<'1S9FEL93X@("`@("`@<W!E8VEF>2!T:&4@ XM;W!T:6]N(&9I;&4@=&\@8F4@=7-E9`IL87)N("UC("`@("`@("`@("`@("`@ XM("!C<F5A=&4@;F5W('-C;W)E8F]A<F1S("TM('!R;VUP=',@9F]R(&$@<&%S XM<W=O<F0*;&%R;B`M;"`@("`@("`@("`@("`@("`@<')I;G0@;W5T('1H92!L XM87)N(&QO9R!F:6QE(`IL87)N("UP("`@("`@("`@("`@("`@("!P;&%Y(&EN XM('!R;VUP="!M;V1E"@H*"@H*"@H*"@H*("`@("`@("`@("`@&ULW;4)A8VMG XM<F]U;F0@26YF;W)M871I;VX@9F]R($QA<FX;6VT*"B`@("!796QC;VUE('1O XM('1H92!G86UE(&]F($QA<FXN("!!="!T:&ES(&UO;65N="P@>6]U(&9A8V4@ XM82!G<F5A="!P<F]B;&5M+@I9;W5R(&1A=6=H=&5R(&AA<R!C;VYT<F%C=&5D XM(&$@<W1R86YG92!D:7-E87-E+"!A;F0@;F]N92!O9B!Y;W5R(&AO;64@<F5M XM961I97,*<V5E;2!T;R!H879E(&%N>2!E9F9E8W0N("!9;W4@<V5N<V4@=&AA XM="!S:&4@:7,@:6X@;6]R=&%L(&1A;F=E<BP@86YD('EO=2!M=7-T"G1R>2!T XM;R!S879E(&AE<BX@(%1I;64@86=O('EO=2!H96%R9"!O9B!A(&QA;F0@;V8@ XM9W)E870@9&%N9V5R(&%N9"!O<'!O<G1U;FET>2X*4&5R:&%P<R!H97)E(&ES XM('1H92!S;VQU=&EO;B!Y;W4@;F5E9"X*"B`@("!)="!H87,@8F5E;B!S86ED XM('1H870@=&AE<F4@;VYC92!W87,@82!G<F5A="!M86=I8VEA;B!W:&\@8V%L XM;&5D(&AI;7-E;&8*4&]L:6YN96%U<RX@($UA;GD@>65A<G,@86=O+"!A9G1E XM<B!H879I;F<@;6%N>2!M:7)A8W5L;W5S('-U8V-E<W-E<RP@4&]L:6YN96%U XM<PIR971I<F5D('1O('1H92!C879E<FYS(&]F($QA<FXL('=H97)E(&AE(&1E XM=F]T960@;6]S="!O9B!H:7,@=&EM92!T;R!T:&4*8W)E871I;VX@;V8@;6%G XM:6,N("`@4G5M;W)S(&AA=F4@:70@=&AA="!O;F4@9&%Y(%!O;&EN;F5A=7,@ XM<V5T(&]U="!T;R!D:7-P96P*86X@871T86-K:6YG(&%R;7D@:6X@82!F;W)E XM<W0@<V]M92!D:7-T86YC92!T;R!T:&4@;F]R=&@N("!)="!I<R!B96QI979E XM9"!T:&%T"FAE<F4@:&4@;65T(&AI<R!D96UI<V4N"@H@("`@5&AE(&-A=F5R XM;G,@;V8@3&%R;BP@:70@:7,@=&AO=6=H="P@;75S="!B92!M86=N:69I8V5N XM="!I;B!D97-I9VXL"F%N9"!C;VYT86EN(&UU8V@@;6%G:6,@86YD('1R96%S XM=7)E+B`@3VYE(&]P=&EO;B!Y;W4@:&%V92!I<R!T;R!U;F1E<G1A:V4@80IJ XM;W5R;F5Y(&EN=&\@=&AE<V4@8V%V97)N<RX*"B`@("!';V]D($QU8VLA("!9 XM;W4G<F4@9V]I;F<@=&\@;F5E9"!I="$*"@H*("`@("`@("`@("`@&ULW;4AO XM=R!T;R!U<V4@=&AE(&QA<FXN;W!T(&]P=&EO;B!F:6QE&UMM"@I4:&4@9FEL XM92`B;&%R;BYO<'0B+"!I9B!U<V5D+"!S:&]U;&0@8F4@:6X@82!D:7)E8W1O XM<GD@86QO;F<@>6]U<B!0051(+@I!('-E<75E;F-E(&]F('=O<F1S('1E<FUI XM;F%T960@8GD@=VAI=&5S<&%C92!I<R!U<V5D('1O('-P96-I9GD@;W!T:6]N XM<RX*"B`@("!7;W)D("`@("`@("`@("`@("`@("`@("`@365A;FEN9PH@("`@ XM8W5R<V]R.B`@(&QO=W-C86X@:&EG:'-C86X@(&-H86YG92!T:&4@<VAA<&4@ XM;V8@=&AE(&-U<G-O<@H@("`@1$5#4F%I;F)O=R`@("`@("`@("!T96QL($Q! XM4DX@>6]U(&AA=F4@=&AA="!C;VUP=71E<@H@("`@96YA8FQE+6-H96-K<&]I XM;G1I;F<@("`@='5R;B!O;B!P97)I;V1I8R!C:&5C:W!O:6YT:6YG"B`@("!G XM<F%P:&EC<SH@=V%L;&,@9FQO;W)C("!S96QE8W0@9W)A<&AI8W,@;6%Z92!C XM:&%R86-T97)S"B`@("!K97EP860@("`@("`@("`@96YA8FQE('1H92!N=6UE XM<FEC(&ME>7!A9"!F;W(@;6]V:6YG"B`@("!L87)N9&ER.B`@9&ER96-T;W)Y XM("`@("!T:&4@9&ER96-T;W)Y('1O('5S92!F;W(@;&%R;B!F:6QE<PH@("`@ XM;6]N<W1E<CH@(")M;VYS="!N86UE(B`@8VAO;W-E(&$@;F%M92!F;W(@82!M XM;VYS=&5R"B`@("!N86UE.B`@("`@(GEO=7(@;F%M92(@("!C:&]O<V4@>6]U XM<B!P;&%Y:6YG(&YA;64*("`@(&YO+6)E97`@("`@("`@("!D:7-A8FQE(&)E XM97!I;F<@;V8@=&AE('1E<FUI;F%L"B`@("!N;RUI;G1R;V1U8W1I;VX@("`@ XM(&1O(&YO="!D:7-P;&%Y(&EN=')O(&UE<W-A9V4*("`@('-A=F5F:6QE.B!S XM879E+69I;&4M;F%M92`@("!D969I;F4@=VAA="!T:&4@<V%V96=A;64@9FEL XM96YA;64@=VEL;"!B90H@("`@<W=A<&9I;&4Z('-W87`M9FEL92UN86UE("`@ XM(&1E9FEN92!T:&4@;F%M92!O9B!T:&4@<W=A<&9I;&4*"EEO=7(@;F%M92!A XM;F0@;6]N<W1E<B!N86UE<R!M=7-T(&)E(&5N8VQO<V5D(&EN(&1O=6)L92!Q XM=6]T871I;VX@;6%R:W,@86YD(&UA>0IB92!U<"!T;R`S-"!C:&%R86-T97)S XM(&QO;F<N("!,;VYG97(@;F%M97,@87)E('1R=6YC871E9"X@($%N>71H:6YG XM(&5N8VQO<V5D(&EN"G%U;W1A=&EO;B!M87)K<R!I<R!C;VYS:61E<F5D(&]N XM92!W;W)D+"!A;F0@;75S="!B92!S97!A<F%T960@9G)O;2!O=&AE<B!W;W)D XM<PIB>2!W:&ET97-P86-E+@H@("`@("`@("`@(!M;-VU%>'!L86YA=&EO;B!O XM9B!T:&4@3&%R;B!S8V]R96)O87)D(&9A8VEL:71Y&UMM"@H@("`@3&%R;B!S XM=7!P;W)T<R!45T\@<V-O<F5B;V%R9',L(&]N92!F;W(@=VEN;F5R<RP@86YD XM(&]N92!F;W(@9&5C96%S960*8VAA<F%C=&5R<RX@($5A8V@@<&QA>65R("AB XM>2!U<V5R:60@;W(@<&QA>65R:60L('-E92!524130T]212!I;B!-86ME9FEL XM92D*:7,@86QL;W=E9"!O;F4@<VQO="!O;B!E86-H('-C;W)E8F]A<F0L(&EF XM('1H92!S8V]R92!I<R!I;B!T:&4@=&]P('1E;B!F;W(*=&AA="!S8V]R96)O XM87)D+B`@5&AI<R!D97-I9VX@:&5L<',@:6YS=7)E('1H870@9G)E<75E;G0@ XM<&QA>65R<R!O9B!,87)N"F1O(&YO="!H;V<@=&AE('-C;W)E8F]A<F0L(&%N XM9"!G:79E<R!M;W)E('!L87EE<G,@82!C:&%N8V4@9F]R(&=L;W)Y+B`@3&5V XM96P*;V8@9&EF9FEC=6QT>2!I<R!A;'-O(&YO=&5D(&]N('1H92!S8V]R96)O XM87)D<RP@86YD('1H:7,@=&%K97,@<')E8V5D96YC90IO=F5R('-C;W)E(&9O XM<B!D971E<FUI;FEN9R!W:&%T(&5N=')Y(&ES(&]N('1H92!S8V]R96)O87)D XM+B`@1F]R(&5X86UP;&4Z"FEF(")987(L('1H92!"=6<@4VQA>65R(B!H87,@ XM82!S8V]R92!O9B`Q,C@P,#,@;VX@=&AE('-C;W)E8F]A<F0@870@9&EF9B`P XM+`IT:&5N(&$@9V%M92!A="!D:69F(#$@86YD(&$@<V-O<F4@;V8@-#$Q,B!W XM;W5L9"!R97!L86-E('1H92!P<F5V:6]U<PIE;G1R>2!O;B!T:&4@<V-O<F5B XM;V%R9"X@($YO=&4@=&AA="!W:&5N(&$@<&QA>65R(&1I97,L('1H92!I;G9E XM;G1O<GD@:7,*<W1O<F5D(&EN('1H92!S8V]R96)O87)D('-O('1H870@979E XM<GEO;F4@8V%N('-E92!W:&%T(&ET96US('1H92!P;&%Y97(@:&%D"F%T('1H X592!T:6UE(&]F(&1E871H+@H*"@H* X` Xend END_OF_FILE if test 11215 -ne `wc -c <'larn_hlp.uue'`; then echo shar: \"'larn_hlp.uue'\" unpacked with wrong size! fi # end of 'larn_hlp.uue' fi if test -f 'moreobj.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'moreobj.c'\" else echo shar: Extracting \"'moreobj.c'\" \(12276 characters\) sed "s/^X//" >'moreobj.c' <<'END_OF_FILE' X/* moreobj.c Larn is copyrighted 1986 by Noah Morgan. X X Routines in this file: X X oaltar() X othrone() X odeadthrone() X ochest() X ofountain() X fntchange() X fch() X drink_fountain() X wash_fountain() X enter() X remove_gems() X sit_on_throne() X kick_stairs() X up_stairs() X down_stairs() X open_something() X close_something() X desecrate_altar() X pray_at_altar() X*/ X#include "header.h" X X/* X subroutine to process an altar object X*/ Xoaltar() X { X unsigned long k; X X lprcat("\nDo you (p) pray (d) desecrate"); iopts(); X while (1) switch(ttgetch()) X { X case 'p': X lprcat(" pray\nDo you (m) give money or (j) just pray? "); X while (1) switch(ttgetch()) X { X case 'j': X lprcat("\n"); X act_just_pray(); X return; X X case 'm': X act_donation_pray(); X return; X X case '\33': X return; X }; X X case 'd': X lprcat(" desecrate"); X act_desecrate_altar(); X return; X X case 'i': X case '\33': X ignore(); X act_ignore_altar(); X return; X }; X } X X/* X subroutine to process a throne object X*/ Xothrone(arg) X int arg; X { X X lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts(); X while (1) X { X while (1) switch(ttgetch()) X { X case 'p': X lprcat(" pry off"); X act_remove_gems( arg ); X return; X X case 's': X lprcat(" sit down"); X act_sit_throne( arg ); X return; X X case 'i': X case '\33': ignore(); return; X }; X } X } X Xodeadthrone() X { X X lprcat("\nDo you (s) sit down"); iopts(); X while (1) X { X while (1) switch(ttgetch()) X { X case 's': X lprcat(" sit down"); X act_sit_throne(1); X return; X X case 'i': X case '\33': ignore(); return; X }; X } X } X X/* X subroutine to process a chest object X*/ Xochest() X { X lprcat("\nDo you (t) take it, (o) try to open it"); iopts(); X while (1) X { X switch(ttgetch()) X { X case 'o': X lprcat(" open it"); X act_open_chest( playerx, playery ); X return; X X case 't': X lprcat(" take"); X if (take(OCHEST,iarg[playerx][playery])==0) X item[playerx][playery]=know[playerx][playery]=0; X return; X X case 'i': X case '\33': ignore(); return; X }; X } X } X X/* X process a fountain object X*/ Xofountain() X { X cursors(); X lprcat("\nDo you (d) drink, (w) wash yourself"); iopts(); X while (1) switch(ttgetch()) X { X case 'd': X act_drink_fountain(); X return; X X case '\33': X case 'i': X ignore(); X return; X X case 'w': X act_wash_fountain(); X return; X } X } X X/* X a subroutine to raise or lower character levels X if x > 0 they are raised if x < 0 they are lowered X*/ Xfntchange(how) X int how; X { X register long j; X lprc('\n'); X switch(rnd(9)) X { X case 1: X lprcat("Your strength"); X fch(how,&c[STRENGTH]); break; X case 2: X lprcat("Your intelligence"); X fch(how,&c[INTELLIGENCE]); break; X case 3: X lprcat("Your wisdom"); X fch(how,&c[WISDOM]); break; X case 4: X lprcat("Your constitution"); X fch(how,&c[CONSTITUTION]); break; X case 5: X lprcat("Your dexterity"); X fch(how,&c[DEXTERITY]); break; X case 6: X lprcat("Your charm"); X fch(how,&c[CHARISMA]); break; X case 7: X j=rnd(level+1); X if (how < 0) X { X lprintf("You lose %d hit point",(long)j); X if (j>1) lprcat("s!"); else lprc('!'); X losemhp((int)j); X } X else X { lprintf("You gain %d hit point",(long)j); if (j>1) lprcat("s!"); else lprc('!'); raisemhp((int)j); } X bottomline(); break; X X case 8: j=rnd(level+1); X if (how > 0) X { X lprintf("You just gained %d spell",(long)j); raisemspells((int)j); X if (j>1) lprcat("s!"); else lprc('!'); X } X else X { X lprintf("You just lost %d spell",(long)j); losemspells((int)j); X if (j>1) lprcat("s!"); else lprc('!'); X } X bottomline(); break; X X case 9: j = 5*rnd((level+1)*(level+1)); X if (how < 0) X { X lprintf("You just lost %d experience point",(long)j); X if (j>1) lprcat("s!"); else lprc('!'); loseexperience((long)j); X } X else X { X lprintf("You just gained %d experience point",(long)j); X if (j>1) lprcat("s!"); else lprc('!'); raiseexperience((long)j); X } X break; X } X cursors(); X } X X/* X subroutine to process an up/down of a character attribute for ofountain X*/ Xstatic fch(how,x) X int how; X long *x; X { X if (how < 0) { lprcat(" went down by one!"); --(*x); } X else { lprcat(" went up by one!"); (*x)++; } X bottomline(); X } X X/* X For command mode. Perform drinking at a fountain. X*/ Xdrink_fountain() X { X cursors() ; X if (item[playerx][playery] == ODEADFOUNTAIN) X lprcat("\nThere is no water to drink!") ; X X else if (item[playerx][playery] != OFOUNTAIN) X lprcat("\nI see no fountain to drink from here!") ; X X else X act_drink_fountain(); X return; X } X X/* X For command mode. Perform washing (tidying up) at a fountain. X*/ Xwash_fountain() X { X cursors() ; X if (item[playerx][playery] == ODEADFOUNTAIN) X lprcat("\nThere is no water to wash in!") ; X X else if (item[playerx][playery] != OFOUNTAIN) X lprcat("\nI see no fountain to wash at here!") ; X X else X act_wash_fountain(); X return; X } X X/* X For command mode. Perform entering a building. X*/ Xenter() X { X cursors() ; X switch ( item[playerx][playery] ) X { X case OSCHOOL: X oschool(); X break ; X X case OBANK: X obank() ; X break ; X X case OBANK2: X obank2() ; X break ; X X case ODNDSTORE: X dndstore() ; X break ; X X case OENTRANCE: X newcavelevel( 1 ); X playerx = 33 ; X playery = MAXY - 2 ; X item[33][MAXY - 1] = know[33][MAXY - 1] = mitem[33][MAXY - 1] = 0 ; X draws( 0, MAXX, 0, MAXY ); X showcell(playerx, playery); /* to show around player */ X bot_linex() ; X break ; X X case OTRADEPOST: X otradepost(); X break; X X case OLRS: X olrs(); X break; X X case OHOME: X ohome(); X break; X X default : X lprcat("\nThere is no place to enter here!\n"); X break; X } X } X X/* X For command mode. Perform removal of gems from a jeweled throne. X*/ Xremove_gems ( ) X { X X cursors(); X if (item[playerx][playery] == ODEADTHRONE) X lprcat("\nThere are no gems to remove!"); X X else if (item[playerx][playery] == OTHRONE) X act_remove_gems(0); X X else if (item[playerx][playery] == OTHRONE2) X act_remove_gems(1); X X else X lprcat("\nI see no throne here to remove gems from!"); X return; X } X X/* X For command mode. Perform sitting on a throne. X*/ Xsit_on_throne( ) X { X X cursors(); X if (item[playerx][playery] == OTHRONE) X act_sit_throne(0); X X else if ((item[playerx][playery] == OTHRONE2) || X (item[playerx][playery] == ODEADTHRONE)) X act_sit_throne(1); X X else X lprcat("\nI see no throne to sit on here!"); X X return; X } X X/* X For command mode. Checks that the player is actually standing at a set X of stairs before letting him kick them. X*/ Xkick_stairs() X { X cursors(); X if (item[playerx][playery] != OSTAIRSUP && X item[playerx][playery] != OSTAIRSDOWN) X lprcat("\nI see no stairs to kick here!"); X X else X act_kick_stairs(); X } X X/* X For command mode. Checks that player is actually standing at a set up X up stairs or volcanic shaft. X*/ Xup_stairs() X { X cursors(); X if (item[playerx][playery] == OSTAIRSDOWN) X lprcat("\nThe stairs don't go up!"); X X else if (item[playerx][playery] == OVOLUP) X act_up_shaft(); X X else if (item[playerx][playery] != OSTAIRSUP) X lprcat("\nI see no way to go up here!"); X X else X act_up_stairs(); X } X X/* X For command mode. Checks that player is actually standing at a set of X down stairs or volcanic shaft. X*/ Xdown_stairs() X { X cursors(); X if (item[playerx][playery] == OSTAIRSUP) X lprcat("\nThe stairs don't go down!"); X X else if (item[playerx][playery] == OVOLDOWN) X act_down_shaft(); X X else if (item[playerx][playery] != OSTAIRSDOWN) X lprcat("\nI see no way to go down here!"); X X else X act_down_stairs(); X } X X/* X For command mode. Perform opening an object (door, chest). X*/ Xopen_something( ) X { X int x,y; /* direction to open */ X char tempc; /* result of prompting to open a chest */ X X cursors(); X /* check for confusion. X */ X if (c[CONFUSE]) X { X lprcat("You're too confused!"); X beep(); X return; X } X X /* check for player standing on a chest. If he is, prompt for and X let him open it. If player ESCs from prompt, quit the Open X command. X */ X if (item[playerx][playery] == OCHEST) X { X lprcat("There is a chest here. Open it?"); X if ((tempc = getyn()) == 'y') X { X act_open_chest( playerx, playery ); X return; X } X else if (tempc != 'n' ) X return; X } X X /* get direction of object to open. test 'openability' of object X indicated, call common command/prompt mode routines to actually open. X */ X dirsub( &x, &y ); X switch( item[x][y] ) X { X case OOPENDOOR: X lprcat("The door is already open!"); X beep(); X break; X X case OCHEST: X act_open_chest( x, y ); X break; X X case OCLOSEDDOOR: X act_open_door( x, y ); X break; X X default: X lprcat("You can't open that!"); X beep(); X break; X } X } X X/* X For command mode. Perform the action of closing something (door). X*/ Xclose_something() X { X int x,y; X X cursors(); X /* check for confusion. X */ X if (c[CONFUSE]) X { X lprcat("You're too confused!"); X beep(); X return; X } X X /* get direction of object to close. test 'closeability' of object X indicated. X */ X dirsub( &x, &y ); X switch( item[x][y] ) X { X case OCLOSEDDOOR: X lprcat("The door is already closed!"); X beep(); X break; X X case OOPENDOOR: X if (mitem[x][y]) X { X lprcat("Theres a monster in the way!"); X return; X } X item[x][y] = OCLOSEDDOOR; X know[x][y] = 0 ; X iarg[x][y] = 0 ; X break; X X default: X lprcat("You can't close that!"); X beep(); X break; X } X } X X/* X For command mode. Perform the act of descecrating an altar. X*/ Xdesecrate_altar() X { X cursors(); X if (item[playerx][playery] == OALTAR) X act_desecrate_altar(); X else X lprcat("\nI see no altar to desecrate here!"); X } X X/* X For command mode. Perform the act of praying at an altar. X*/ Xpray_at_altar() X { X extern char prayed ; X X cursors(); X if (item[playerx][playery] != OALTAR) X lprcat("\nI see no altar to pray at here!"); X else X act_donation_pray(); X prayed = 1 ; X } END_OF_FILE if test 12276 -ne `wc -c <'moreobj.c'`; then echo shar: \"'moreobj.c'\" unpacked with wrong size! fi # end of 'moreobj.c' fi if test -f 'regen.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'regen.c'\" else echo shar: Extracting \"'regen.c'\" \(3513 characters\) sed "s/^X//" >'regen.c' <<'END_OF_FILE' X/* regen.c Larn is copyrighted 1986 by Noah Morgan. */ X#include "header.h" X/* X ******* X REGEN() X ******* X regen() X X subroutine to regenerate player hp and spells X */ Xregen() X { X register int i,flag; X register long *d; X d = c; X#ifdef EXTRA X d[MOVESMADE]++; X#endif X if (d[TIMESTOP]) { if(--d[TIMESTOP]<=0) bottomline(); return; } /* for stop time spell */ X flag=0; X X if (d[STRENGTH]<3) { d[STRENGTH]=3; flag=1; } X if ((d[HASTESELF]==0) || ((d[HASTESELF] & 1) == 0)) X gtime++; X X if (d[HP] != d[HPMAX]) X if (d[REGENCOUNTER]-- <= 0) /* regenerate hit points */ X { X d[REGENCOUNTER] = 22 + (d[HARDGAME]<<1) - d[LEVEL]; X if ((d[HP] += d[REGEN]) > d[HPMAX]) d[HP] = d[HPMAX]; X bottomhp(); X } X X if (d[SPELLS] < d[SPELLMAX]) /* regenerate spells */ X if (d[ECOUNTER]-- <= 0) X { X d[ECOUNTER] = 100+4*(d[HARDGAME]-d[LEVEL]-d[ENERGY]); X d[SPELLS]++; bottomspell(); X } X X if (d[HERO]) if (--d[HERO]<=0) { for (i=0; i<6; i++) d[i] -= 10; flag=1; } X if (d[ALTPRO]) if (--d[ALTPRO]<=0) { d[MOREDEFENSES]-=3; flag=1; } X if (d[PROTECTIONTIME]) if (--d[PROTECTIONTIME]<=0) { d[MOREDEFENSES]-=2; flag=1; } X if (d[DEXCOUNT]) if (--d[DEXCOUNT]<=0) { d[DEXTERITY]-=3; flag=1; } X if (d[STRCOUNT]) if (--d[STRCOUNT]<=0) { d[STREXTRA]-=3; flag=1; } X if (d[BLINDCOUNT]) if (--d[BLINDCOUNT]<=0) { cursors(); lprcat("\nThe blindness lifts "); beep(); } X if (d[CONFUSE]) if (--d[CONFUSE]<=0) { cursors(); lprcat("\nYou regain your senses"); beep(); } X if (d[GIANTSTR]) if (--d[GIANTSTR]<=0) { d[STREXTRA] -= 20; flag=1; } X if (d[CHARMCOUNT]) if ((--d[CHARMCOUNT]) <= 0) flag=1; X if (d[INVISIBILITY]) if ((--d[INVISIBILITY]) <= 0) flag=1; X if (d[CANCELLATION]) if ((--d[CANCELLATION]) <= 0) flag=1; X if (d[WTW]) if ((--d[WTW]) <= 0) flag=1; X if (d[HASTESELF]) if ((--d[HASTESELF]) <= 0) flag=1; X if (d[AGGRAVATE]) --d[AGGRAVATE]; X if (d[SCAREMONST]) if ((--d[SCAREMONST]) <= 0) flag=1; X if (d[STEALTH]) if ((--d[STEALTH]) <= 0) flag=1; X if (d[AWARENESS]) --d[AWARENESS]; X if (d[HOLDMONST]) if ((--d[HOLDMONST]) <= 0) flag=1; X if (d[HASTEMONST]) --d[HASTEMONST]; X if (d[FIRERESISTANCE]) if ((--d[FIRERESISTANCE]) <= 0) flag=1; X if (d[GLOBE]) if (--d[GLOBE]<=0) { d[MOREDEFENSES]-=10; flag=1; } X if (d[SPIRITPRO]) if (--d[SPIRITPRO] <= 0) flag=1; X if (d[UNDEADPRO]) if (--d[UNDEADPRO] <= 0) flag=1; X if (d[HALFDAM]) if (--d[HALFDAM]<=0) { cursors(); lprcat("\nYou now feel better "); beep(); } X if (d[SEEINVISIBLE]) X if (--d[SEEINVISIBLE]<=0) X# ifdef DGK X { monstnamelist[INVISIBLESTALKER] = floorc; X if (!d[BLINDCOUNT]) { X cursors(); X lprcat("\nYou feel your vision return to normal"); X beep(); X } X } X# else X { monstnamelist[INVISIBLESTALKER] = ' '; X cursors(); lprcat("\nYou feel your vision return to normal"); beep(); } X# endif X if (d[ITCHING]) X { X if (d[ITCHING]>1) X if ((d[WEAR]!= -1) || (d[SHIELD]!= -1)) X if (rnd(100)<50) X { X d[WEAR]=d[SHIELD]= -1; cursors(); X lprcat("\nThe hysteria of itching forces you to remove your armor!"); X beep(); recalc(); bottomline(); X } X if (--d[ITCHING]<=0) { cursors(); lprcat("\nYou now feel the irritation subside!"); beep(); } X } X if (d[CLUMSINESS]) X { X if (d[WIELD] != -1) X if (d[CLUMSINESS]>1) X if (item[playerx][playery]==0) /* only if nothing there */ X if (rnd(100)<33) /* drop your weapon due to clumsiness */ X drop_object((int)d[WIELD]); X if (--d[CLUMSINESS]<=0) { cursors(); lprcat("\nYou now feel less awkward!"); beep(); } X } X if (flag) bottomline(); X } X END_OF_FILE if test 3513 -ne `wc -c <'regen.c'`; then echo shar: \"'regen.c'\" unpacked with wrong size! fi # end of 'regen.c' fi if test -f 'tgetent.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'tgetent.c'\" else echo shar: Extracting \"'tgetent.c'\" \(9420 characters\) sed "s/^X//" >'tgetent.c' <<'END_OF_FILE' X/************************************************************************ X * * X * Copyright (c) 1982, Fred Fish * X * All Rights Reserved * X * * X * This software and/or documentation is released for public * X * distribution for personal, non-commercial use only. * X * Limited rights to use, modify, and redistribute are hereby * X * granted for non-commercial purposes, provided that all * X * copyright notices remain intact and all changes are clearly * X * documented. The author makes no warranty of any kind with * X * respect to this product and explicitly disclaims any implied * X * warranties of merchantability or fitness for any particular * X * purpose. * X * * X ************************************************************************ X */ X X/* X * LIBRARY FUNCTION X * X * tgetent load buffer with entry for specified terminal X * X * KEY WORDS X * X * termcap functions X * utility routines X * X * SYNOPSIS X * X * int tgetent(bp,name) X * char *bp; X * char *name; X * X * DESCRIPTION X * X * Extracts the entry for terminal <name> from the termcap file X * and places it in the character buffer <bp>. It is currently X * assumed that bp is at least 1024 characters. If the entry in X * the termcap file is larger than 1023 characters the excess X * characters will be discarded and appropriate status will X * be returned. X * X * Also note that since bp is used by other termcap X * routines, the storage associated with the termcap entry X * cannot be freed until all termcap calls are completed. X * X * Tgetent can be directed to look in a file other than X * the default (/etc/termcap) by defining an environment X * variable called TERMCAP to be the pathname of the desired X * termcap file. This is useful for debugging new entries. X#ifndef VMS X * NOTE: the pathname MUST begin with a '/' character. X * X * Also, if the string assigned to TERMCAP does not begin with X * a '/' and if the environment variable TERM matches <name> then X * the string assigned to TERMCAP is copied to buffer <bp> X * instead of reading a termcap file. X#endif X * X * If the termcap entry contains a "tc" string then the termcap X * entry named in the string is appended to the buffer (minus the X * names). X * X * RETURNS X * X * -1 if the termcap file cannot be opened X * 0 if no entry in termcap file matches <name> X * 1 if extraction is successful with no errors X * 2 if extraction is successful but entry truncated X * X * SEE ALSO X * X * tgetnum extract numeric type capability X * tgetflag test boolean type capability X * tgetstr get string value of capability X * X * AUTHOR X * X * Fred Fish X * X */ X X#include <stdio.h> X X#define TRUE 1 X#define FALSE 0 X#define BUFSIZE 1024 /* Assumed size of external buffer */ X X#define NO_FILE -1 /* Returned if can't open file */ X#define NO_ENTRY 0 /* Returned if can't find entry */ X#define SUCCESS 1 /* Returned if entry found ok */ X#define TRUNCATED 2 /* Returned if entry found but trunc */ X X#ifdef DGK_MSDOS XFILE *fopenp(); X#endif X X#define DEFAULT_ROOT "termcap" /* name without path component */ X#ifdef VMS X#define DEFAULT_FILE "sys$library:termcap" X#else X#define DEFAULT_FILE "/etc/termcap" /* default termcap filename */ X#endif VMS X Xchar *_tcpbuf; /* Place to remember buffer pointer */ X X/* X * PSEUDO CODE X * X * Begin tgetent X * Erase any previous buffer contents. X * Remember the buffer pointer. X * If termcap file is not found then X * If buffer was filled anyway then X * Return SUCCESS. X * Else X * Return NO_FILE. X * End if X * Else X * While records left to process X * If this is entry is what we want then X * Close the termcap file. X * If entry was truncated then X * Return TRUNCATED status X * Else X * Return SUCCESS status. X * End if X * End if X * End while X * Return NO_ENTRY status. X * End if X * End tgetent X * X */ X Xint tgetent(bp,name) Xchar *bp; /* Pointer to buffer (1024 char min) */ Xchar *name; /* Pointer to terminal entry to find */ X{ X FILE *fp, *find_file(); X char *nbp, tc[80]; X X *bp = (char)NULL; X _tcpbuf = bp; X if ((fp = find_file(bp)) == NULL) { X if (*bp != NULL) { X return(SUCCESS); X } else { X return(NO_FILE); X } X } else { X while (fgetlr(bp,BUFSIZE,fp)) { X if (gotcha(bp,name)) { X fclose(fp); X nbp = &bp[strlen(bp)-1]; X if (*nbp != '\n') { X return(TRUNCATED); X } else { X /* check for a recursive call (i.e. :tc=vt100:) X * added 18-dec-86 RDE (single recursion...) X */ X char *area; X area = &tc[0]; X if (tgetstr("tc", &area) == NULL) X return(SUCCESS); X else { X fp = find_file(0); /* know it works and is file */ X while (fgetlr(nbp, BUFSIZE-(nbp-bp), fp)) { X if (gotcha(nbp,tc)) { X char *cp1, *cp2; /* scrunch out names */ X fclose(fp); X cp1 = nbp; X while (*cp1++ != ':') /* search for first */ X ; X cp2 = nbp; X while (*cp2++ = *cp1++) /* move the chars. */ X ; X if (bp[strlen(bp)-1] != '\n') { X return(TRUNCATED); X } else { X return(SUCCESS); X } X } X } X return (NO_ENTRY); X } X } X } X } X return(NO_ENTRY); X } X} X X/* X * INTERNAL FUNCTION X * X * find_file find the termcap file and open it if possible X * X * KEY WORDS X * X * internal functions X * find_file X * X * SYNOPSIS X * X * static FILE *find_file(bp) X * char *bp; X * X * DESCRIPTION X * X * Attempts to locate and open the termcap file. Also handles X * using the environment TERMCAP string as the actual buffer X * (that's why bp has to be an input parameter). X * X#ifdef VMS X * If TERMCAP is defined as a valid filespec then it will be X * opened. If this fails then the default termcap file will X * be used. X#else X * If TERMCAP is defined an begins with a '/' character then X * it is taken to be the pathname of the termcap file and X * an attempt is made to open it. If this fails then X * the default termcap file is used instead. X * X * If TERMCAP is defined but does not begin with a '/' then X * it is assumed to be the actual buffer contents provided X * that <name> matches the environment variable TERM. X#endif X * X * BUGS X * X * There is currently no way to be sure which termcap X * file was opened since the default will always be X * tried. X * X */ X X/* X * PSEUDO CODE X * X * Begin find_file X * If there is a TERMCAP environment string then X * If the string is not null then X * If the string is a pathname then X * If that file is opened successfully then X * Return its pointer. X * End if X * Else X * If there is a TERM environment string then X * If TERM matches <name> then X * Copy TERMCAP string to buffer. X * Return NULL for no file. X * End if X * End if X * End if X * End if X * End if X * Open default termcap file and return results. X * End find_file X * X */ X Xstatic FILE *find_file(bp) Xchar *bp; X{ X FILE *fp, *fopen(); X char *cp, *ncp, *getenv(); X X if ((cp = getenv("TERMCAP")) != NULL) { X if (*cp != NULL) { X#ifdef VMS X if ((fp = fopen(cp, "r")) != NULL) X return(fp); X#else X if (*cp == '/' || *cp == '\\') { X if ((fp = fopen(cp,"r")) != NULL) { X return(fp); X } X } else { X if ((ncp = getenv("TERM")) != NULL) { X if (strcmp(cp,ncp) == 0) { X strcpy(bp,cp); X return((FILE *)NULL); X } X } X } X#endif X } X } X /* X * Try current directory, then /etc/termcap X */ X if (fp = fopen(DEFAULT_ROOT, "r")) X return fp; X else X#ifdef DGK_MSDOS X if (fp = fopen(DEFAULT_FILE, "r") ) X return fp; X else /* try along the PATH */ X return( fopenp(DEFAULT_ROOT, "r", NULL)); X#else X return (fopen(DEFAULT_FILE, "r")); X#endif X} X X X/* X * INTERNAL FUNCTION X * X * gotcha test to see if entry is for specified terminal X * X * SYNOPSIS X * X * gotcha(bp,name) X * char *bp; X * char *name; X * X * DESCRIPTION X * X * Tests to see if the entry in buffer bp matches the terminal X * specified by name. Returns TRUE if match is detected, FALSE X * otherwise. X * X */ X X/* X * PSEUDO CODE X * X * Begin gotcha X * If buffer character is comment character then X * Return FALSE since remainder is comment X * Else X * Initialize name scan pointer. X * Compare name and buffer until end or mismatch. X * If valid terminators for both name and buffer strings X * Return TRUE since a match was found. X * Else X * Find next non-name character in buffer. X * If not an alternate name separater character X * Return FALSE since no more names to check. X * Else X * Test next name and return results. X * End if X * End if X * End if X * End gotcha X * X */ X Xgotcha(bp,name) Xchar *bp; Xchar *name; X{ X char *np; X X if (*bp == '#') { X return(FALSE); X } else { X np = name; X while (*np == *bp && *np != NULL) {np++; bp++;} X if (*np == NULL && (*bp == NULL || *bp == '|' || *bp == ':')) { X return(TRUE); X } else { X while (*bp != NULL && *bp != ':' && *bp != '|') {bp++;} X if (*bp != '|') { X return(FALSE); X } else { X return(gotcha(++bp,name)); X } X } X } X} X X#ifdef MSDOS X/* X * index(buffer, char) X * Find character in buffer. Return the pointer X * to it. Shouldn't be necessary to write this X * myself but VMS didn't. Oh Well... X * Used by lots of files in the termcap library. X * Rich Ellison, 16-DEC-1986 X */ Xchar X*index(buf, ch) Xchar *buf; Xchar ch; X{ X register int c; X while ((c= *buf++) != '\0') X if (c == ch) X return (buf-1); X return (NULL); X} X#endif END_OF_FILE if test 9420 -ne `wc -c <'tgetent.c'`; then echo shar: \"'tgetent.c'\" unpacked with wrong size! fi # end of 'tgetent.c' fi echo shar: End of archive 9 \(of 11\). cp /dev/null ark9isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 11 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0