X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/e30950ccc7c7c31c69f1d31c16b0212bbf168ceb..ad0312c45756a5ad1ce7ebda2a0b1b17b71353e8:/larn/object.c diff --git a/larn/object.c b/larn/object.c index a5564723..1c7e607d 100644 --- a/larn/object.c +++ b/larn/object.c @@ -1,18 +1,31 @@ -/* $NetBSD: object.c,v 1.12 2008/01/28 05:38:54 dholland Exp $ */ +/* $NetBSD: object.c,v 1.15 2009/08/12 08:04:05 dholland Exp $ */ /* object.c Larn is copyrighted 1986 by Noah Morgan. */ #include #ifndef lint -__RCSID("$NetBSD: object.c,v 1.12 2008/01/28 05:38:54 dholland Exp $"); +__RCSID("$NetBSD: object.c,v 1.15 2009/08/12 08:04:05 dholland Exp $"); #endif /* not lint */ #include "header.h" #include "extern.h" +static void finditem(int); +static void ostairs(int); +static void opotion(int); +static void oscroll(int); +static void oorb(void); +static void opit(void); +static void obottomless(void); +static void oelevator(int); +static void ostatue(void); +static void omirror(void); +static void obook(void); +static void ocookie(void); +static void ogold(int); +static void ohome(void); + /* - *************** - LOOK_FOR_OBJECT - *************** + lookforobject subroutine to look for an object and give the player his options if an object was found. @@ -22,7 +35,7 @@ lookforobject() { int i, j; if (c[TIMESTOP]) - return; /* can't find objects is time is stopped */ + return; /* can't find objects if time is stopped */ i = item[playerx][playery]; if (i == 0) return; @@ -149,7 +162,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') { oschool(); /* the college of larn */ } else @@ -174,7 +187,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); j = 0; while ((j != 'g') && (j != 'i') && (j != '\33')) - j = lgetchar(); + j = ttgetch(); if (j == 'g') { if (i == OBANK) obank(); @@ -197,7 +210,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') dndstore(); /* the dnd adventurers store */ else @@ -220,7 +233,7 @@ lookforobject() iopts(); i = 0; while ((i != 'c') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); break; @@ -239,7 +252,7 @@ lookforobject() iopts(); i = 0; while ((i != 'o') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); playerx = lastpx; @@ -290,7 +303,7 @@ lookforobject() iopts(); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') { newcavelevel(1); playerx = 33; @@ -310,7 +323,7 @@ lookforobject() iopts(); i = 0; while ((i != 'c') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); break; @@ -350,7 +363,7 @@ lookforobject() iopts(); i = 0; while ((i != 'c') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); break; @@ -446,7 +459,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') otradepost(); else @@ -460,7 +473,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') ohome(); else @@ -481,7 +494,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') olrs(); /* the larn revenue service */ else @@ -497,7 +510,7 @@ lookforobject() /* function to say what object we found and ask if player wants to take it */ -void +static void finditem(int theitem) { int tmp, i; @@ -524,7 +537,7 @@ finditem(int theitem) iopts(); i = 0; while (i != 't' && i != 'i' && i != '\33') - i = lgetchar(); + i = ttgetch(); if (i == 't') { lprcat("take"); if (take(theitem, tmp) == 0) @@ -537,14 +550,10 @@ finditem(int theitem) /* - ******* - OSTAIRS - ******* - subroutine to process the stair cases if dir > 0 the up else down */ -void +static void ostairs(dir) int dir; { @@ -557,7 +566,7 @@ ostairs(dir) lprcat("or (f) kick stairs? "); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 's': case 'i': @@ -608,10 +617,6 @@ ostairs(dir) /* - ********* - OTELEPORTER - ********* - subroutine to handle a teleport trap +/- 1 level maximum */ void @@ -649,20 +654,16 @@ oteleport(err) /* - ******* - OPOTION - ******* - function to process a potion */ -void +static void opotion(pot) int pot; { lprcat("\nDo you (d) drink it, (t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -862,13 +863,9 @@ quaffpotion(pot) /* - ******* - OSCROLL - ******* - function to process a magic scroll */ -void +static void oscroll(typ) int typ; { @@ -878,7 +875,7 @@ oscroll(typ) lprcat("(t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -918,7 +915,7 @@ static u_char exten[] = { CANCELLATION, HASTESELF, GLOBE, SCAREMONST, HOLDMONST, TIMESTOP }; -u_char time_change[] = { +static u_char time_change[] = { HASTESELF, HERO, ALTPRO, PROTECTIONTIME, DEXCOUNT, STRCOUNT, GIANTSTR, CHARMCOUNT, INVISIBILITY, CANCELLATION, HASTESELF, AGGRAVATE, SCAREMONST, STEALTH, AWARENESS, HOLDMONST, @@ -1100,12 +1097,12 @@ read_scroll(typ) -void +static void oorb() { } -void +static void opit() { int i; @@ -1134,7 +1131,7 @@ opit() } } -void +static void obottomless() { lprcat("\nYou fell into a bottomless pit!"); @@ -1142,7 +1139,8 @@ obottomless() nap(3000); died(262); } -void + +static void oelevator(dir) int dir; { @@ -1153,17 +1151,17 @@ oelevator(dir) #endif /* lint */ } -void +static void ostatue() { } -void +static void omirror() { } -void +static void obook() { lprcat("\nDo you "); @@ -1172,7 +1170,7 @@ obook() lprcat("(t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -1215,7 +1213,7 @@ readbook(lev) } } -void +static void ocookie(void) { const char *p; @@ -1223,7 +1221,7 @@ ocookie(void) lprcat("\nDo you (e) eat it, (t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -1253,7 +1251,7 @@ ocookie(void) * routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth * 100* the argument */ -void +static void ogold(arg) int arg; { @@ -1271,7 +1269,7 @@ ogold(arg) item[playerx][playery] = know[playerx][playery] = 0; /* destroy gold */ } -void +static void ohome() { int i; @@ -1323,9 +1321,9 @@ ohome() lprcat(" to continue, "); standout("escape"); lprcat(" to leave ----- "); - i = lgetchar(); + i = ttgetch(); while (i != '\33' && i != '\n') - i = lgetchar(); + i = ttgetch(); if (i == '\33') { drawscreen(); nosignal = 0; /* enable signals */