diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-09-25 20:30:47 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-09-25 20:30:47 +0000 |
commit | 707fbeced379c66976d1a780f9d53537d5a553e0 (patch) | |
tree | 877cb9d7ad6143f6564fcf73d9296baffe528cf7 /games/battlestar/com2.c | |
parent | c32c077e88142dbeafe3f3158a6100cfb0fb8a36 (diff) |
Merge 4.4BSD-Lite2 and NetBSD, including improved save file handling of
jsm28@cam.ac.uk. Rename setbit() family of macros so as not to conflict
with <sys/param.h>.
Diffstat (limited to 'games/battlestar/com2.c')
-rw-r--r-- | games/battlestar/com2.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/games/battlestar/com2.c b/games/battlestar/com2.c index 3f55fbc9a63..19d91083257 100644 --- a/games/battlestar/com2.c +++ b/games/battlestar/com2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com2.c,v 1.6 1998/09/13 01:30:30 pjanzen Exp $ */ +/* $OpenBSD: com2.c,v 1.7 1999/09/25 20:30:45 pjanzen Exp $ */ /* $NetBSD: com2.c,v 1.3 1995/03/21 15:06:55 cgd Exp $ */ /* @@ -36,9 +36,9 @@ #ifndef lint #if 0 -static char sccsid[] = "@(#)com2.c 8.1 (Berkeley) 5/31/93"; +static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: com2.c,v 1.6 1998/09/13 01:30:30 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: com2.c,v 1.7 1999/09/25 20:30:45 pjanzen Exp $"; #endif #endif /* not lint */ @@ -84,9 +84,9 @@ wearit() case BRACELET: case GRENADE: - if (testbit(inven, value)) { - clearbit(inven, value); - setbit(wear, value); + if (TestBit(inven, value)) { + ClearBit(inven, value); + SetBit(wear, value); carrying -= objwt[value]; encumber -= objcumber[value]; ourtime++; @@ -94,7 +94,7 @@ wearit() (objsht[value][n - 1] == 's' ? "the" : "a"), objsht[value]); } else - if (testbit(wear, value)) + if (TestBit(wear, value)) printf("You are already wearing the %s.\n", objsht[value]); else @@ -137,10 +137,10 @@ int use() { while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount); - if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) && + if (wordvalue[wordnumber] == AMULET && TestBit(inven, AMULET) && position != FINAL) { puts("The amulet begins to glow."); - if (testbit(inven, MEDALION)) { + if (TestBit(inven, MEDALION)) { puts("The medallion comes to life too."); if (position == 114) { location[position].down = 160; @@ -162,7 +162,7 @@ use() } else if (position == FINAL) puts("The amulet won't work in here."); - else if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS)) + else if (wordvalue[wordnumber] == COMPASS && TestBit(inven, COMPASS)) printf("Your compass points %s.\n", truedirec(NORTH,'-')); else if (wordvalue[wordnumber] == COMPASS) puts("You aren't holding the compass."); @@ -178,7 +178,7 @@ murder() { int n; - for (n = 0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && testbit(inven, n)) && n < NUMOFOBJECTS; n++); + for (n = 0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && TestBit(inven, n)) && n < NUMOFOBJECTS; n++); if (n == NUMOFOBJECTS) puts("You don't have suitable weapons to kill."); else { @@ -187,17 +187,17 @@ murder() switch (wordvalue[wordnumber]) { case NORMGOD: - if (testbit(location[position].objects, BATHGOD)) { + if (TestBit(location[position].objects, BATHGOD)) { puts("The goddess's head slices off. Her corpse floats in the water."); - clearbit(location[position].objects, BATHGOD); - setbit(location[position].objects, DEADGOD); + ClearBit(location[position].objects, BATHGOD); + SetBit(location[position].objects, DEADGOD); power += 5; notes[JINXED]++; } else - if (testbit(location[position].objects, NORMGOD)) { + if (TestBit(location[position].objects, NORMGOD)) { puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood."); - clearbit(location[position].objects, NORMGOD); - setbit(location[position].objects, DEADGOD); + ClearBit(location[position].objects, NORMGOD); + SetBit(location[position].objects, DEADGOD); power += 5; notes[JINXED]++; if (wintime) @@ -206,27 +206,27 @@ murder() puts("I dont see her anywhere."); break; case TIMER: - if (testbit(location[position].objects, TIMER)) { + if (TestBit(location[position].objects, TIMER)) { puts("The old man offers no resistance."); - clearbit(location[position].objects, TIMER); - setbit(location[position].objects, DEADTIME); + ClearBit(location[position].objects, TIMER); + SetBit(location[position].objects, DEADTIME); power++; notes[JINXED]++; } else puts("Who?"); break; case NATIVE: - if (testbit(location[position].objects, NATIVE)) { + if (TestBit(location[position].objects, NATIVE)) { puts("The girl screams as you cut her body to shreds. She is dead."); - clearbit(location[position].objects, NATIVE); - setbit(location[position].objects, DEADNATIVE); + ClearBit(location[position].objects, NATIVE); + SetBit(location[position].objects, DEADNATIVE); power += 5; notes[JINXED]++; } else puts("What girl?"); break; case MAN: - if (testbit(location[position].objects, MAN)) { + if (TestBit(location[position].objects, MAN)) { puts("You strike him to the ground, and he coughs up blood."); puts("Your fantasy is over."); die(0); @@ -249,7 +249,7 @@ void ravage() { while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount); - if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects, wordvalue[wordnumber])) { + if (wordtype[wordnumber] == NOUNS && TestBit(location[position].objects, wordvalue[wordnumber])) { ourtime++; switch (wordvalue[wordnumber]) { case NORMGOD: @@ -273,18 +273,18 @@ ravage() murder(); if (rnd(100) < 50) { puts("Her screams have attracted attention. I think we are surrounded."); - setbit(location[ahead].objects, WOODSMAN); - setbit(location[ahead].objects, DEADWOOD); - setbit(location[ahead].objects, MALLET); - setbit(location[back].objects, WOODSMAN); - setbit(location[back].objects, DEADWOOD); - setbit(location[back].objects, MALLET); - setbit(location[left].objects, WOODSMAN); - setbit(location[left].objects, DEADWOOD); - setbit(location[left].objects, MALLET); - setbit(location[right].objects, WOODSMAN); - setbit(location[right].objects, DEADWOOD); - setbit(location[right].objects, MALLET); + SetBit(location[ahead].objects, WOODSMAN); + SetBit(location[ahead].objects, DEADWOOD); + SetBit(location[ahead].objects, MALLET); + SetBit(location[back].objects, WOODSMAN); + SetBit(location[back].objects, DEADWOOD); + SetBit(location[back].objects, MALLET); + SetBit(location[left].objects, WOODSMAN); + SetBit(location[left].objects, DEADWOOD); + SetBit(location[left].objects, MALLET); + SetBit(location[right].objects, WOODSMAN); + SetBit(location[right].objects, DEADWOOD); + SetBit(location[right].objects, MALLET); } break; default: @@ -303,15 +303,15 @@ follow() puts("You have cornered him. His laser sword extends as he steps forward."); position = FINAL; fight(DARK, 75); - setbit(location[position].objects, TALISMAN); - setbit(location[position].objects, AMULET); + SetBit(location[position].objects, TALISMAN); + SetBit(location[position].objects, AMULET); return (0); } else if (followgod == ourtime) { puts("The goddess leads you down a steamy tunnel and into a high, wide chamber."); puts("She sits down on a throne."); position = 268; - setbit(location[position].objects, NORMGOD); + SetBit(location[position].objects, NORMGOD); notes[CANTSEE] = 1; return (0); } else |