summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>2000-09-17 23:03:43 +0000
committerjsm <jsm@NetBSD.org>2000-09-17 23:03:43 +0000
commite828812cad1edfdd4b4f01f93330a6421cd816ab (patch)
tree068273b7573052a26c55c3b1e4cdc0ae75dc4392
parentac0e105a1cb81cab2f045dedc161f0b856985e6b (diff)
downloadbsdgames-darwin-e828812cad1edfdd4b4f01f93330a6421cd816ab.tar.gz
bsdgames-darwin-e828812cad1edfdd4b4f01f93330a6421cd816ab.tar.zst
bsdgames-darwin-e828812cad1edfdd4b4f01f93330a6421cd816ab.zip
Patches from OpenBSD: add verbs "open"/"unlock" (essentially a no-op),
and "verbose"/"brief" (in verbose mode, always show long room descriptions), and synonyms "papaya" for "papayas" and "coconut" for "coconuts".
-rw-r--r--battlestar/com6.c38
-rw-r--r--battlestar/cypher.c31
-rw-r--r--battlestar/extern.h7
-rw-r--r--battlestar/globals.c5
-rw-r--r--battlestar/room.c6
-rw-r--r--battlestar/words.c10
6 files changed, 85 insertions, 12 deletions
diff --git a/battlestar/com6.c b/battlestar/com6.c
index 5bd9ebdc..6e7e6d94 100644
--- a/battlestar/com6.c
+++ b/battlestar/com6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com6.c,v 1.16 2000/09/10 10:51:17 jsm Exp $ */
+/* $NetBSD: com6.c,v 1.17 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com6.c,v 1.16 2000/09/10 10:51:17 jsm Exp $");
+__RCSID("$NetBSD: com6.c,v 1.17 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@@ -248,3 +248,37 @@ light()
} else
puts("You're out of matches.");
}
+
+void
+dooropen()
+{ /* synonyms = {open, unlock} */
+ while(wordtype[++wordnumber] == ADJS)
+ ;
+ if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS
+ && wordvalue[wordnumber] == DOOR) {
+ switch(position) {
+ case 189:
+ case 231:
+ if (location[189].north == 231)
+ puts("The door is already open.");
+ else
+ puts("The door does not budge.");
+ break;
+ case 30:
+ if (location[30].west == 25)
+ puts("The door is gone.");
+ else
+ puts("The door is locked tight.");
+ break;
+ case 31:
+ puts("That's one immovable door.");
+ break;
+ case 20:
+ puts("The door is already ajar.");
+ break;
+ default:
+ puts("What door?");
+ }
+ } else
+ puts("That doesn't open.");
+}
diff --git a/battlestar/cypher.c b/battlestar/cypher.c
index 51330f18..ea39fd39 100644
--- a/battlestar/cypher.c
+++ b/battlestar/cypher.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cypher.c,v 1.13 2000/09/10 10:51:17 jsm Exp $ */
+/* $NetBSD: cypher.c,v 1.14 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: cypher.c,v 1.13 2000/09/10 10:51:17 jsm Exp $");
+__RCSID("$NetBSD: cypher.c,v 1.14 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@@ -293,6 +293,23 @@ cypher()
lflag = use();
break;
+ case OPEN:
+ if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ int things;
+ things = 0;
+ for (n = 0; n < NUMOFOBJECTS; n++)
+ if (testbit(inven, n)) {
+ things++;
+ wordvalue[wordnumber + 1] = n;
+ dooropen();
+ }
+ wordnumber += 2;
+ if (!things)
+ puts("Nothing to open!");
+ } else
+ dooropen();
+ break;
+
case LOOK:
if (!notes[CANTSEE] || testbit(inven, LAMPON) ||
testbit(location[position].objects, LAMPON)
@@ -387,6 +404,16 @@ cypher()
free(rfilename);
break;
+ case VERBOSE:
+ verbose = 1;
+ printf("[Maximum verbosity]\n");
+ break;
+
+ case BRIEF:
+ verbose = 0;
+ printf("[Standard verbosity]\n");
+ break;
+
case FOLLOW:
lflag = follow();
break;
diff --git a/battlestar/extern.h b/battlestar/extern.h
index 055466bd..efd6366c 100644
--- a/battlestar/extern.h
+++ b/battlestar/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.19 2000/09/09 09:37:58 jsm Exp $ */
+/* $NetBSD: extern.h,v 1.20 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -187,6 +187,9 @@
#define BURY 1050
#define JUMP 1051
#define KICK 1052
+#define OPEN 1053
+#define VERBOSE 1054
+#define BRIEF 1055
/* injuries */
#define ARM 6 /* broken arm */
@@ -284,6 +287,7 @@ extern unsigned int inven[NUMOFWORDS];
extern unsigned int wear[NUMOFWORDS];
extern char beenthere[NUMOFROOMS + 1];
extern char injuries[NUMOFINJURIES];
+extern int verbose;
extern const char *username;
@@ -317,6 +321,7 @@ int cypher __P((void));
void die __P((void)) __attribute__((__noreturn__));
void diesig __P((int)) __attribute__((__noreturn__));
void dig __P((void));
+void dooropen __P((void));
int draw __P((void));
void drink __P((void));
int drive __P((void));
diff --git a/battlestar/globals.c b/battlestar/globals.c
index 17d9428d..d285e527 100644
--- a/battlestar/globals.c
+++ b/battlestar/globals.c
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.c,v 1.11 2000/09/09 09:37:58 jsm Exp $ */
+/* $NetBSD: globals.c,v 1.12 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: globals.c,v 1.11 2000/09/09 09:37:58 jsm Exp $");
+__RCSID("$NetBSD: globals.c,v 1.12 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@@ -256,6 +256,7 @@ unsigned int inven[NUMOFWORDS];
unsigned int wear[NUMOFWORDS];
char beenthere[NUMOFROOMS + 1];
char injuries[NUMOFINJURIES];
+int verbose = 0;
const char *username;
diff --git a/battlestar/room.c b/battlestar/room.c
index 8dd8bec3..3cdc0e15 100644
--- a/battlestar/room.c
+++ b/battlestar/room.c
@@ -1,4 +1,4 @@
-/* $NetBSD: room.c,v 1.9 2000/09/10 10:52:56 jsm Exp $ */
+/* $NetBSD: room.c,v 1.10 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)room.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: room.c,v 1.9 2000/09/10 10:52:56 jsm Exp $");
+__RCSID("$NetBSD: room.c,v 1.10 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@@ -52,7 +52,7 @@ writedes()
int c;
printf("\n\t%s\n", location[position].name);
- if (beenthere[position] < ROOMDESC) {
+ if (beenthere[position] < ROOMDESC || verbose) {
compass = NORTH;
for (p = location[position].desc; (c = *p++) != 0;)
if (c != '-' && c != '*' && c != '+') {
diff --git a/battlestar/words.c b/battlestar/words.c
index 429a0024..b1386938 100644
--- a/battlestar/words.c
+++ b/battlestar/words.c
@@ -1,4 +1,4 @@
-/* $NetBSD: words.c,v 1.7 2000/09/09 18:03:58 jsm Exp $ */
+/* $NetBSD: words.c,v 1.8 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)words.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: words.c,v 1.7 2000/09/09 18:03:58 jsm Exp $");
+__RCSID("$NetBSD: words.c,v 1.8 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@@ -91,9 +91,11 @@ struct wlist wlist[] = {
{ "match", MATCHES, OBJECT, NULL },
{ "book", MATCHES, OBJECT, NULL },
{ "man", MAN, NOUNS, NULL },
+ { "papaya", PAPAYAS, OBJECT, NULL },
{ "papayas", PAPAYAS, OBJECT, NULL },
{ "pineapple", PINEAPPLE, OBJECT, NULL },
{ "kiwi", KIWI, OBJECT, NULL },
+ { "coconut", COCONUTS, OBJECT, NULL },
{ "coconuts", COCONUTS, OBJECT, NULL },
{ "mango", MANGO, OBJECT, NULL },
{ "ring", RING, OBJECT, NULL },
@@ -173,6 +175,8 @@ struct wlist wlist[] = {
{ "hack", SMITE, VERB, NULL },
{ "shoot", SHOOT, VERB, NULL },
{ "blast", SHOOT, VERB, NULL },
+ { "open", OPEN, VERB, NULL },
+ { "unlock", OPEN, VERB, NULL },
{ "on", ON, PREPS, NULL },
{ "off", OFF, PREPS, NULL },
{ "time", TIME, VERB, NULL },
@@ -182,6 +186,8 @@ struct wlist wlist[] = {
{ "swim", SWIM, VERB, NULL },
{ "drink", DRINK, VERB, NULL },
{ "door", DOOR, NOUNS, NULL },
+ { "verbose", VERBOSE, VERB, NULL },
+ { "brief", BRIEF, VERB, NULL },
{ "save", SAVE, VERB, NULL },
{ "ride", RIDE, VERB, NULL },
{ "mount", RIDE, VERB, NULL },