This commit is contained in:
lukem 1997-10-10 11:39:08 +00:00
parent 6ecab62b97
commit b6068ea04b
24 changed files with 942 additions and 772 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: battlestar.6,v 1.4 1995/03/21 15:06:42 cgd Exp $
.\" $NetBSD: battlestar.6,v 1.5 1997/10/10 11:39:08 lukem Exp $
.\"
.\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved.
@ -40,10 +40,10 @@
.Nm battlestar
.Nd a tropical adventure game
.Sh SYNOPSIS
.Nm battlestar
.Nm
.Op Fl r Em Pq recover a saved game
.Sh DESCRIPTION
.Nm Battlestar
.Nm
is an adventure game in the classic style. However, It's slightly less
of a
puzzle and more a game of exploration. There are a few magical words

View File

@ -1,4 +1,4 @@
/* $NetBSD: battlestar.c,v 1.4 1997/01/07 11:56:32 tls Exp $ */
/* $NetBSD: battlestar.c,v 1.5 1997/10/10 11:39:12 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1983, 1993\n\
The Regents of the University of California. All rights reserved.\n";
__COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: battlestar.c,v 1.4 1997/01/07 11:56:32 tls Exp $";
__RCSID("$NetBSD: battlestar.c,v 1.5 1997/10/10 11:39:12 lukem Exp $");
#endif
#endif /* not lint */
@ -56,9 +56,12 @@ static char rcsid[] = "$NetBSD: battlestar.c,v 1.4 1997/01/07 11:56:32 tls Exp $
#include "extern.h"
int main __P((int, char *[]));
int
main(argc,argv)
int argc;
char **argv;
int argc;
char **argv;
{
char mainbuf[LINELENGTH];
char *next;
@ -92,6 +95,6 @@ run:
case 0:
goto start;
default:
exit();
exit(0);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: com1.c,v 1.4 1997/01/07 11:56:34 tls Exp $ */
/* $NetBSD: com1.c,v 1.5 1997/10/10 11:39:16 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,25 +33,29 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com1.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: com1.c,v 1.4 1997/01/07 11:56:34 tls Exp $";
__RCSID("$NetBSD: com1.c,v 1.5 1997/10/10 11:39:16 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
move(thataway, token)
int thataway, token;
int thataway, token;
{
wordnumber++;
if ((!notes[CANTMOVE] && !notes[LAUNCHED]) || testbit(location[position].objects, LAND) || fuel > 0 && notes[LAUNCHED])
if ((!notes[CANTMOVE] && !notes[LAUNCHED]) ||
testbit(location[position].objects, LAND) ||
(fuel > 0 && notes[LAUNCHED]))
if (thataway) {
position = thataway;
newway(token);
time++;
ourtime++;
}
else {
puts("You can't go this way.");
@ -66,11 +70,12 @@ int thataway, token;
return(1);
}
void
convert(tothis) /* Converts day to night and vice versa. */
int tothis; /* Day objects are permanent. Night objects are added*/
int tothis; /* Day objects are permanent. Night objects are added*/
{ /* at dusk, and subtracted at dawn. */
register struct objs *p;
register i, j;
struct objs *p;
int i, j;
if (tothis == TONIGHT) {
for (i = 1; i <= NUMOFROOMS; i++)
@ -89,29 +94,30 @@ int tothis; /* Day objects are permanent. Night objects are added*/
}
}
void
news()
{
register int n;
int n;
int hurt;
if (time > 30 && position < 32){
if (ourtime > 30 && position < 32){
puts("An explosion of shuddering magnitude splinters bulkheads and");
puts("ruptures the battlestar's hull. You are sucked out into the");
puts("frozen void of space and killed.");
die();
}
if (time > 20 && position < 32)
if (ourtime > 20 && position < 32)
puts("Explosions rock the battlestar.");
if (time > snooze){
if (ourtime > snooze){
puts("You drop from exhaustion...");
zzz();
}
if (time > snooze - 5)
if (ourtime > snooze - 5)
puts("You're getting tired.");
if (time > (rythmn + CYCLE)) {
if (ourtime > (rythmn + CYCLE)) {
if (location == nightfile) {
convert(TODAY);
if (OUTSIDE && time - rythmn - CYCLE < 10) {
if (OUTSIDE && ourtime - rythmn - CYCLE < 10) {
puts("Dew lit sunbeams stretch out from a watery sunrise and herald the dawn.");
puts("You awake from a misty dream-world into stark reality.");
puts("It is day.");
@ -119,14 +125,14 @@ news()
} else {
convert(TONIGHT);
clearbit(location[POOLS].objects, BATHGOD);
if (OUTSIDE && time - rythmn - CYCLE < 10) {
if (OUTSIDE && ourtime - rythmn - CYCLE < 10) {
puts("The dying sun sinks into the ocean, leaving a blood stained sunset.");
puts("The sky slowly fades from orange to violet to black. A few stars");
puts("flicker on, and it is night.");
puts("The world seems completly different at night.");
}
}
rythmn = time - time % CYCLE;
rythmn = ourtime - ourtime % CYCLE;
}
if (!wiz && !tempwiz)
if ((testbit(inven,TALISMAN) || testbit(wear,TALISMAN)) && (testbit(inven,MEDALION) || testbit(wear,MEDALION)) && (testbit(inven,AMULET) || testbit(wear,AMULET))){
@ -163,16 +169,16 @@ news()
}
if (testbit(location[position].objects, GIRL))
meetgirl = 1;
if (meetgirl && CYCLE * 1.5 - time < 10){
if (meetgirl && CYCLE * 1.5 - ourtime < 10){
setbit(location[GARDEN].objects,GIRLTALK);
setbit(location[GARDEN].objects,LAMPON);
setbit(location[GARDEN].objects,ROPE);
}
if (position == DOCK && (beenthere[position] || time > CYCLE)){
if (position == DOCK && (beenthere[position] || ourtime > CYCLE)){
clearbit(location[DOCK].objects, GIRL);
clearbit(location[DOCK].objects,MAN);
}
if (meetgirl && time - CYCLE * 1.5 > 10){
if (meetgirl && ourtime - CYCLE * 1.5 > 10){
clearbit(location[GARDEN].objects,GIRLTALK);
clearbit(location[GARDEN].objects,LAMPON);
clearbit(location[GARDEN].objects,ROPE);
@ -180,7 +186,8 @@ news()
}
if (testbit(location[position].objects,CYLON)){
puts("Oh my God, you're being shot at by an alien spacecraft!");
printf("The targeting computer says we have %d seconds to attack!\n",clock);
printf("The targeting computer says we have %d seconds to attack!\n",
ourclock);
fflush(stdout);
sleep(1);
if (!visual()){
@ -223,12 +230,14 @@ news()
notes[CANTMOVE] = 0;
}
void
crash()
{
int hurt1,hurt2;
fuel--;
if (!location[position].flyhere || (testbit(location[position].objects,LAND) && fuel <= 0)){
if (!location[position].flyhere ||
(testbit(location[position].objects,LAND) && fuel <= 0)){
if (!location[position].flyhere)
puts("You're flying too low. We're going to crash!");
else{
@ -242,7 +251,7 @@ crash()
}
notes[LAUNCHED] = 0;
setbit(location[position].objects,CRASH);
time += rnd(CYCLE/4);
ourtime += rnd(CYCLE/4);
puts("The viper explodes into the ground and you lose consciousness...");
zzz();
hurt1 = rnd(NUMOFINJURIES - 2) + 2;
@ -251,6 +260,7 @@ crash()
injuries[hurt2] = 1;
injuries[0] = 1; /* abrasions */
injuries[1] = 1; /* lacerations */
printf("I'm afraid you have suffered %s and %s.\n",ouch[hurt1],ouch[hurt2]);
printf("I'm afraid you have suffered %s and %s.\n",
ouch[hurt1], ouch[hurt2]);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: com2.c,v 1.4 1997/01/07 11:56:35 tls Exp $ */
/* $NetBSD: com2.c,v 1.5 1997/10/10 11:39:19 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,19 +33,21 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: com2.c,v 1.4 1997/01/07 11:56:35 tls Exp $";
__RCSID("$NetBSD: com2.c,v 1.5 1997/10/10 11:39:19 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
wearit() /* synonyms = {sheathe, sheath} */
{
register int n;
int n;
int firstnumber, value;
firstnumber = wordnumber;
@ -87,14 +89,19 @@ wearit() /* synonyms = {sheathe, sheath} */
setbit(wear,value);
carrying -= objwt[value];
encumber -= objcumber[value];
time++;
printf("You are now wearing %s %s.\n",(objsht[value][n-1] == 's' ? "the" : "a"), objsht[value]);
ourtime++;
printf("You are now wearing %s %s.\n",
(objsht[value][n-1] == 's' ? "the"
: "a"), objsht[value]);
}
else if (testbit(wear,value))
printf("You are already wearing the %s.\n", objsht[value]);
printf("You are already wearing the %s.\n",
objsht[value]);
else
printf("You aren't holding the %s.\n", objsht[value]);
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
printf("You aren't holding the %s.\n",
objsht[value]);
if (wordnumber < wordcount - 1 &&
wordvalue[++wordnumber] == AND)
wordnumber++;
else
return(firstnumber);
@ -104,6 +111,7 @@ wearit() /* synonyms = {sheathe, sheath} */
return(firstnumber);
}
int
put() /* synonyms = {buckle, strap, tie} */
{
if (wordvalue[wordnumber + 1] == ON){
@ -119,15 +127,18 @@ put() /* synonyms = {buckle, strap, tie} */
}
int
draw() /* synonyms = {pull, carry} */
{
return(take(wear));
}
int
use()
{
while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
if (wordvalue[wordnumber] == AMULET && testbit(inven,AMULET) && position != FINAL){
if (wordvalue[wordnumber] == AMULET && testbit(inven,AMULET) &&
position != FINAL){
puts("The amulet begins to glow.");
if (testbit(inven,MEDALION)){
puts("The medallion comes to life too.");
@ -135,7 +146,7 @@ use()
location[position].down = 160;
whichway(location[position]);
puts("The waves subside and it is possible to descend to the sea cave now.");
time++;
ourtime++;
return(-1);
}
}
@ -145,7 +156,7 @@ use()
position = 224;
else
position = 229;
time++;
ourtime++;
return(0);
}
else if (position == FINAL)
@ -161,9 +172,10 @@ use()
return(-1);
}
void
murder()
{
register int n;
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++);
if (n == NUMOFOBJECTS)
@ -222,16 +234,18 @@ murder()
if (wordtype[wordnumber] != NOUNS)
puts("Kill what?");
else
printf("You can't kill the %s!\n",objsht[wordvalue[wordnumber]]);
printf("You can't kill the %s!\n",
objsht[wordvalue[wordnumber]]);
}
}
}
void
ravage()
{
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
time++;
ourtime++;
switch(wordvalue[wordnumber]){
case NORMGOD:
puts("You attack the goddess, and she screams as you beat her. She falls down");
@ -276,9 +290,10 @@ ravage()
puts("Who?");
}
int
follow()
{
if (followfight == time){
if (followfight == ourtime){
puts("The Dark Lord leaps away and runs down secret tunnels and corridoors.");
puts("You chase him through the darkness and splash in pools of water.");
puts("You have cornered him. His laser sword extends as he steps forward.");
@ -288,7 +303,7 @@ follow()
setbit(location[position].objects,AMULET);
return(0);
}
else if (followgod == time){
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: com3.c,v 1.4 1997/01/07 11:56:35 tls Exp $ */
/* $NetBSD: com3.c,v 1.5 1997/10/10 11:39:22 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,21 +33,23 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: com3.c,v 1.4 1997/01/07 11:56:35 tls Exp $";
__RCSID("$NetBSD: com3.c,v 1.5 1997/10/10 11:39:22 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
dig()
{
if (testbit(inven,SHOVEL)){
puts("OK");
time++;
ourtime++;
switch(position){
case 144: /* copse near beach */
if (!notes[DUG]){
@ -67,9 +69,10 @@ dig()
puts("You don't have a shovel.");
}
int
jump()
{
register int n;
int n;
switch(position){
default:
@ -106,6 +109,7 @@ jump()
return(0);
}
void
bury()
{
int value;
@ -169,9 +173,10 @@ bury()
puts("You aren't holding a shovel.");
}
void
drink()
{
register int n;
int n;
if (testbit(inven,POTION)){
puts("The cool liquid runs down your throat but turns to fire and you choke.");
@ -182,18 +187,20 @@ drink()
CUMBER = MAXCUMBER;
for (n=0; n < NUMOFINJURIES; n++)
injuries[n] = 0;
time++;
ourtime++;
zzz();
}
else
puts("I'm not thirsty.");
}
int
shoot()
{
int firstnumber, value;
register int n;
int n;
firstnumber = 0;
if (!testbit(inven,LASER))
puts("You aren't holding a blaster.");
else {
@ -205,7 +212,7 @@ shoot()
for (n=0; objsht[value][n]; n++);
if (testbit(location[position].objects,value)){
clearbit(location[position].objects,value);
time++;
ourtime++;
printf("The %s explode%s\n",objsht[value],(objsht[value][n-1]=='s' ? (objsht[value][n-2]=='s' ? "s." : ".") : "s."));
if (value == BOMB)
die();
@ -220,7 +227,7 @@ shoot()
/* special cases with their own return()'s */
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS){
time++;
ourtime++;
switch(wordvalue[wordnumber]){
case DOOR:

View File

@ -1,4 +1,4 @@
/* $NetBSD: com4.c,v 1.4 1997/01/07 11:56:36 tls Exp $ */
/* $NetBSD: com4.c,v 1.5 1997/10/10 11:39:25 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,21 +33,23 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: com4.c,v 1.4 1997/01/07 11:56:36 tls Exp $";
__RCSID("$NetBSD: com4.c,v 1.5 1997/10/10 11:39:25 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
take(from)
unsigned int from[];
unsigned int from[];
{
int firstnumber, heavy, bulky, value;
register int n;
int n;
firstnumber = wordnumber;
if (wordnumber < wordcount && wordvalue[wordnumber+1] == OFF){
@ -67,7 +69,7 @@ unsigned int from[];
setbit(inven,value);
carrying += objwt[value];
encumber += objcumber[value];
time++;
ourtime++;
if (testbit(from,value))
printf("Taken.\n");
else
@ -171,7 +173,7 @@ unsigned int from[];
puts("ties it at the waist. Around her neck hangs a golden amulet.");
puts("She bids you to follow her.");
pleasure++;
followgod = time;
followgod = ourtime;
clearbit(location[position].objects,BATHGOD);
} else if (!testbit(location[position].objects,BATHGOD))
puts("You're in no position to take her.");
@ -187,6 +189,7 @@ unsigned int from[];
return(firstnumber);
}
int
throw(name)
char *name;
{
@ -267,8 +270,9 @@ throw(name)
return(first);
}
int
drop(name)
char *name;
char *name;
{
int firstnumber, value;
@ -291,7 +295,7 @@ char *name;
setbit(location[position].objects,value);
else
tempwiz = 0;
time++;
ourtime++;
if (*name == 'K')
puts("Drop kicked.");
else
@ -318,18 +322,21 @@ char *name;
return(-1);
}
int
takeoff()
{
wordnumber = take(wear);
return(drop("Dropped"));
}
int
puton()
{
wordnumber = take(location[position].objects);
return(wearit());
}
int
eat()
{
int firstnumber, value;
@ -360,16 +367,18 @@ eat()
case MANGO:
printf("%s:\n",objsht[value]);
if (testbit(inven,value) && time > ate - CYCLE && testbit(inven,KNIFE)){
if (testbit(inven,value) &&
ourtime > ate - CYCLE &&
testbit(inven,KNIFE)){
clearbit(inven,value);
carrying -= objwt[value];
encumber -= objcumber[value];
ate = max(time,ate) + CYCLE/3;
ate = max(ourtime,ate) + CYCLE/3;
snooze += CYCLE/10;
time++;
ourtime++;
puts("Eaten. You can explore a little longer now.");
}
else if (time < ate - CYCLE)
else if (ourtime < ate - CYCLE)
puts("You're stuffed.");
else if (!testbit(inven,KNIFE))
puts("You need a knife.");

View File

@ -1,4 +1,4 @@
/* $NetBSD: com5.c,v 1.4 1997/01/07 11:56:37 tls Exp $ */
/* $NetBSD: com5.c,v 1.5 1997/10/10 11:39:30 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,20 +33,23 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: com5.c,v 1.4 1997/01/07 11:56:37 tls Exp $";
__RCSID("$NetBSD: com5.c,v 1.5 1997/10/10 11:39:30 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
kiss()
{
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])){
pleasure++;
printf("Kissed.\n");
switch (wordvalue[wordnumber]){
@ -82,9 +85,10 @@ kiss()
else puts("I'd prefer not to.");
}
void
love()
{
register int n;
int n;
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
@ -106,7 +110,7 @@ love()
if (!loved)
setbit(location[position].objects,MEDALION);
loved = 1;
time += 10;
ourtime += 10;
zzz();
}
else {
@ -118,29 +122,30 @@ love()
power++;
pleasure += 5;
printf("Girl:\n");
time += 10;
ourtime += 10;
zzz();
}
printf("Loved.\n");
}
else puts("I't doesn't seem to work.");
else puts("It doesn't seem to work.");
}
int
zzz()
{
int oldtime;
register int n;
int n;
oldtime = time;
if ((snooze - time) < (0.75 * CYCLE)){
time += 0.75 * CYCLE - (snooze - time);
oldtime = ourtime;
if ((snooze - ourtime) < (0.75 * CYCLE)){
ourtime += 0.75 * CYCLE - (snooze - ourtime);
printf("<zzz>");
for (n = 0; n < time - oldtime; n++)
for (n = 0; n < ourtime - oldtime; n++)
printf(".");
printf("\n");
snooze += 3 * (time - oldtime);
snooze += 3 * (ourtime - oldtime);
if (notes[LAUNCHED]){
fuel -= (time - oldtime);
fuel -= (ourtime - oldtime);
if (location[position].down){
position = location[position].down;
crash();
@ -181,10 +186,11 @@ zzz()
return(1);
}
void
chime()
{
if ((time / CYCLE + 1) % 2 && OUTSIDE)
switch((time % CYCLE)/(CYCLE / 7)){
if ((ourtime / CYCLE + 1) % 2 && OUTSIDE)
switch((ourtime % CYCLE)/(CYCLE / 7)){
case 0:
puts("It is just after sunrise.");
break;
@ -208,7 +214,7 @@ chime()
break;
}
else if (OUTSIDE)
switch((time % CYCLE)/(CYCLE / 7)){
switch((ourtime % CYCLE)/(CYCLE / 7)){
case 0:
puts("It is just after sunset.");
break;
@ -235,10 +241,12 @@ chime()
puts("I can't tell the time in here.");
}
int
give()
{
int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
last1 = last2 = 0;
firstnumber = wordnumber;
while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount);
if (wordnumber <= wordcount){
@ -265,7 +273,7 @@ give()
}
if (result != -1 && (testbit(location[position].objects,obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)){
clearbit(location[position].objects,obj);
time++;
ourtime++;
ego++;
switch(person){
case NATIVE:
@ -294,7 +302,7 @@ give()
puts("after having been out drinking with the girls, she kicks the throne particulary");
puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
clearbit(location[position].objects,MEDALION);
wintime = time;
wintime = ourtime;
}
}
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: com6.c,v 1.6 1997/01/07 11:56:38 tls Exp $ */
/* $NetBSD: com6.c,v 1.7 1997/10/10 11:39:32 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,17 +33,19 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: com6.c,v 1.6 1997/01/07 11:56:38 tls Exp $";
__RCSID("$NetBSD: com6.c,v 1.7 1997/10/10 11:39:32 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
#include "pathnames.h"
int
launch()
{
if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){
@ -51,7 +53,7 @@ launch()
clearbit(location[position].objects,VIPER);
position = location[position].up;
notes[LAUNCHED] = 1;
time++;
ourtime++;
fuel -= 4;
puts("You climb into the viper and prepare for launch.");
puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
@ -65,14 +67,16 @@ launch()
return(0);
}
int
land()
{
if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){
if (notes[LAUNCHED] && testbit(location[position].objects,LAND) &&
location[position].down){
notes[LAUNCHED] = 0;
position = location[position].down;
setbit(location[position].objects,VIPER);
fuel -= 2;
time++;
ourtime++;
puts("You are down.");
return(1);
}
@ -81,6 +85,7 @@ land()
return(0);
}
void
die() /* endgame */
{
printf("bye.\nYour rating was %s.\n", rate());
@ -88,6 +93,14 @@ die() /* endgame */
exit(0);
}
void
diesig(dummy)
int dummy;
{
die();
}
void
live()
{
puts("\nYou win!");
@ -95,20 +108,13 @@ live()
exit(0);
}
/*
* sigh -- this program thinks "time" is an int. It's easier to not load
* <time.h> than try and fix it.
*/
#define _KERNEL
#include <sys/time.h>
#undef _KERNEL
void
post(ch)
char ch;
char ch;
{
FILE *fp;
struct timeval tv;
char *date, *ctime();
char *date;
sigset_t sigset, osigset;
sigemptyset(&sigset);
@ -117,7 +123,7 @@ char ch;
gettimeofday(&tv, (struct timezone *)0); /* can't call time */
date = ctime(&tv.tv_sec);
date[24] = '\0';
if (fp = fopen(_PATH_SCORE,"a")) {
if ((fp = fopen(_PATH_SCORE,"a")) != NULL) {
fprintf(fp, "%s %8s %c%20s", date, uname, ch, rate());
if (wiz)
fprintf(fp, " wizard\n");
@ -167,6 +173,7 @@ rate()
}
}
int
drive()
{
if (testbit(location[position].objects,CAR)){
@ -175,7 +182,7 @@ drive()
clearbit(location[position].objects,CAR);
setbit(location[position].objects,CRASH);
injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
time += 15;
ourtime += 15;
zzz();
return(0);
}
@ -184,6 +191,7 @@ drive()
return(-1);
}
int
ride()
{
if (testbit(location[position].objects,HORSE)){
@ -206,11 +214,12 @@ ride()
return(-1);
}
void
light() /* synonyms = {strike, smoke} */
{ /* for matches, cigars */
if (testbit(inven,MATCHES) && matchcount){
puts("Your match splutters to life.");
time++;
ourtime++;
matchlight = 1;
matchcount--;
if (position == 217){

View File

@ -1,4 +1,4 @@
/* $NetBSD: com7.c,v 1.4 1997/01/07 11:56:39 tls Exp $ */
/* $NetBSD: com7.c,v 1.5 1997/10/10 11:39:35 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,18 +33,20 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com7.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: com7.c,v 1.4 1997/01/07 11:56:39 tls Exp $";
__RCSID("$NetBSD: com7.c,v 1.5 1997/10/10 11:39:35 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
fight(enemy,strength)
int enemy,strength;
int
fight(enemy, strength)
int enemy,strength;
{
int lifeline = 0;
int hurt;
@ -53,16 +55,17 @@ int enemy,strength;
int i;
int exhaustion;
exhaustion = 0;
fighton:
time++;
ourtime++;
snooze -= 5;
if (snooze > time)
exhaustion = CYCLE/(snooze - time);
if (snooze > ourtime)
exhaustion = CYCLE/(snooze - ourtime);
else {
puts("You collapse exhausted, and he pulverizes your skull.");
die();
}
if (snooze - time < 20)
if (snooze - ourtime < 20)
puts("You look tired! I hope you're able to fight.");
next = getcom(auxbuf, LINELENGTH, "<fight!>-: ", 0);
for (i=0; next && i < 10; i++)
@ -192,7 +195,7 @@ fighton:
puts("he flees down the dark caverns.");
clearbit(location[position].objects,DARK);
injuries[SKULL] = 1;
followfight = time;
followfight = ourtime;
return (0);
}
else{
@ -237,7 +240,7 @@ fighton:
case DROP:
case DRAW:
cypher();
time--;
ourtime--;
break;
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: cypher.c,v 1.4 1997/01/07 11:56:39 tls Exp $ */
/* $NetBSD: cypher.c,v 1.5 1997/10/10 11:39:38 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,19 +33,21 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: cypher.c,v 1.4 1997/01/07 11:56:39 tls Exp $";
__RCSID("$NetBSD: cypher.c,v 1.5 1997/10/10 11:39:38 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
cypher()
{
register int n;
int n;
int junk;
int lflag = -1;
char buffer[10];
@ -147,7 +149,7 @@ cypher()
if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
for (n=0; n < NUMOFOBJECTS; n++)
if (testbit(inven,n) ||
testbit(location[position].objects, n) && *objsht[n]){
(testbit(location[position].objects, n) && *objsht[n])){
wordvalue[wordnumber+1] = n;
wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
}
@ -270,7 +272,9 @@ cypher()
break;
case LOOK:
if (!notes[CANTSEE] || testbit(inven,LAMPON) || testbit(location[position].objects,LAMPON) || matchlight){
if (!notes[CANTSEE] || testbit(inven,LAMPON) ||
testbit(location[position].objects,LAMPON)
|| matchlight) {
beenthere[position] = 2;
writedes();
printobjs();
@ -289,10 +293,10 @@ cypher()
fgets(buffer,10,stdin);
if (*buffer != '\n')
sscanf(buffer,"%d", &position);
printf("Time (was %d) = ",time);
printf("Time (was %d) = ", ourtime);
fgets(buffer,10,stdin);
if (*buffer != '\n')
sscanf(buffer,"%d", &time);
sscanf(buffer,"%d", &ourtime);
printf("Fuel (was %d) = ",fuel);
fgets(buffer,10,stdin);
if (*buffer != '\n')
@ -309,10 +313,10 @@ cypher()
fgets(buffer,10,stdin);
if (*buffer != '\n')
sscanf(buffer,"%d",&WEIGHT);
printf("Clock (was %d) = ",clock);
printf("Clock (was %d) = ", ourclock);
fgets(buffer,10,stdin);
if (*buffer != '\n')
sscanf(buffer,"%d",&clock);
sscanf(buffer,"%d", &ourclock);
printf("Wizard (was %d, %d) = ",wiz, tempwiz);
fgets(buffer,10,stdin);
if (*buffer != '\n'){
@ -330,7 +334,7 @@ cypher()
case SCORE:
printf("\tPLEASURE\tPOWER\t\tEGO\n");
printf("\t%3d\t\t%3d\t\t%3d\n\n",pleasure,power,ego);
printf("This gives you the rating of %s in %d turns.\n",rate(),time);
printf("This gives you the rating of %s in %d turns.\n",rate(),ourtime);
printf("You have visited %d out of %d rooms this run (%d%%).\n",card(beenthere,NUMOFROOMS),NUMOFROOMS,card(beenthere,NUMOFROOMS)*100/NUMOFROOMS);
break;

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: dayobjs.c,v 1.4 1997/01/07 11:56:41 tls Exp $ */
/* $NetBSD: dayobjs.c,v 1.5 1997/10/10 11:39:45 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dayobjs.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: dayobjs.c,v 1.4 1997/01/07 11:56:41 tls Exp $";
__RCSID("$NetBSD: dayobjs.c,v 1.5 1997/10/10 11:39:45 lukem Exp $");
#endif
#endif /* not lint */
@ -140,5 +141,5 @@ struct objs dayobjs[] = {
{ 130, BRACELET },
{ 93, GIRL },
{ 268, LAMPON },
0
{ 0 }
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.4 1997/01/07 12:41:18 tls Exp $ */
/* $NetBSD: extern.h,v 1.5 1997/10/10 11:39:47 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -35,9 +35,13 @@
* @(#)externs.h 8.1 (Berkeley) 5/31/93
*/
#include <ctype.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define BITS (8 * sizeof (int))
@ -247,15 +251,12 @@ int wordvalue[NWORD];
int wordtype[NWORD];
int wordcount, wordnumber;
char *truedirec(), *rate();
char *getcom(), *getword();
/* state of the game */
int time;
int ourtime;
int position;
int direction;
int left, right, ahead, back;
int clock, fuel, torps;
int ourclock, fuel, torps;
int carrying, encumber;
int rythmn;
int followfight;
@ -298,3 +299,71 @@ struct objs {
};
struct objs dayobjs[];
struct objs nightobjs[];
void blast __P((void));
void bury __P((void));
int card __P((char *, int));
int checkout __P((char *));
void chime __P((void));
void convert __P((int));
void crash __P((void));
int cypher __P((void));
void die __P((void));
void diesig __P((int));
void dig __P((void));
int draw __P((void));
void drink __P((void));
int drive __P((void));
int drop __P((char *));
int eat __P((void));
void endfly __P((void));
int fight __P((int, int));
int follow __P((void));
void getutmp __P((char *));
int give __P((void));
int hash __P((char *));
void initialize __P((char));
void install __P((struct wlist *));
int jump __P((void));
void kiss __P((void));
int land __P((void));
int launch __P((void));
void light __P((void));
void live __P((void));
void love __P((void));
int move __P((int, int));
void moveenemy __P((int));
void murder __P((void));
void news __P((void));
void newway __P((int));
void notarget __P((void));
void parse __P((void));
void post __P((char));
void printobjs __P((void));
int put __P((void));
int puton __P((void));
void ravage __P((void));
void restore __P((void));
int ride __P((void));
void save __P((void));
void screen __P((void));
int shoot __P((void));
void succumb __P((int));
int take __P((unsigned int []));
int takeoff __P((void));
void target __P((void));
int throw __P((char *));
int ucard __P((unsigned int *));
int use __P((void));
int visual __P((void));
int wearit __P((void));
void whichway __P((struct room));
int wizard __P((char *));
void wordinit __P((void));
void writedes __P((void));
int zzz __P((void));
char *getcom __P((char *, int, char *, char *));
char *getword __P((char *, char *, int));
char *rate __P((void));
char *truedirec __P((int, char));
struct wlist *lookup __P((char *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: fly.c,v 1.4 1997/01/07 11:56:44 tls Exp $ */
/* $NetBSD: fly.c,v 1.5 1997/10/10 11:39:50 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)fly.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: fly.c,v 1.4 1997/01/07 11:56:44 tls Exp $";
__RCSID("$NetBSD: fly.c,v 1.5 1997/10/10 11:39:50 lukem Exp $");
#endif
#endif /* not lint */
@ -52,12 +53,13 @@ static char rcsid[] = "$NetBSD: fly.c,v 1.4 1997/01/07 11:56:44 tls Exp $";
int row, column;
int dr = 0, dc = 0;
char destroyed;
int clock = 120; /* time for all the flights in the game */
int ourclock = 120; /* time for all the flights in the game */
char cross = 0;
sig_t oldsig;
void
succumb()
succumb(dummy)
int dummy;
{
if (oldsig == SIG_DFL) {
endfly();
@ -69,10 +71,9 @@ succumb()
}
}
int
visual()
{
void moveenemy();
destroyed = 0;
if(initscr() == ERR){
puts("Whoops! No more memory...");
@ -84,7 +85,7 @@ visual()
screen();
row = rnd(LINES-3) + 1;
column = rnd(COLS-2) + 1;
moveenemy();
moveenemy(0);
for (;;) {
switch(getchar()){
@ -172,16 +173,17 @@ visual()
endfly();
return(1);
}
if (clock <= 0){
if (ourclock <= 0){
endfly();
die();
}
}
}
void
screen()
{
register int r,c,n;
int r,c,n;
int i;
clear();
@ -195,9 +197,10 @@ screen()
refresh();
}
void
target()
{
register int n;
int n;
move(MIDR,MIDC-10);
addstr("------- + -------");
@ -207,9 +210,10 @@ target()
}
}
void
notarget()
{
register int n;
int n;
move(MIDR,MIDC-10);
addstr(" ");
@ -219,9 +223,10 @@ notarget()
}
}
void
blast()
{
register int n;
int n;
alarm(0);
move(LINES-1, 24);
@ -241,7 +246,8 @@ blast()
}
void
moveenemy()
moveenemy(dummy)
int dummy;
{
double d;
int oldr, oldc;
@ -262,7 +268,7 @@ moveenemy()
row += (rnd(9) - 4) % (4 - abs(row - MIDR));
column += (rnd(9) - 4) % (4 - abs(column - MIDC));
}
clock--;
ourclock--;
mvaddstr(oldr, oldc - 1, " ");
if (cross)
target();
@ -272,12 +278,13 @@ moveenemy()
move(LINES-1, 42);
printw("%3d", fuel);
move(LINES-1, 57);
printw("%3d", clock);
printw("%3d", ourclock);
refresh();
signal(SIGALRM, moveenemy);
alarm(1);
}
void
endfly()
{
alarm(0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: getcom.c,v 1.3 1995/03/21 15:07:30 cgd Exp $ */
/* $NetBSD: getcom.c,v 1.4 1997/10/10 11:39:53 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,16 +33,16 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93";
#else
static char rcsid[] = "$NetBSD: getcom.c,v 1.3 1995/03/21 15:07:30 cgd Exp $";
__RCSID("$NetBSD: getcom.c,v 1.4 1997/10/10 11:39:53 lukem Exp $");
#endif
#endif /* not lint */
#include <stdio.h>
#include <ctype.h>
#include "extern.h"
char *
getcom(buf, size, prompt, error)
@ -73,8 +73,8 @@ getcom(buf, size, prompt, error)
*/
char *
getword(buf1, buf2, flag)
register char *buf1, *buf2;
register flag;
char *buf1, *buf2;
int flag;
{
while (isspace(*buf1))
buf1++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: globals.c,v 1.4 1997/01/07 11:56:44 tls Exp $ */
/* $NetBSD: globals.c,v 1.5 1997/10/10 11:39:56 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: globals.c,v 1.4 1997/01/07 11:56:44 tls Exp $";
__RCSID("$NetBSD: globals.c,v 1.5 1997/10/10 11:39:56 lukem Exp $");
#endif
#endif /* not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: init.c,v 1.5 1997/01/07 11:56:45 tls Exp $ */
/* $NetBSD: init.c,v 1.6 1997/10/10 11:40:01 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,23 +33,22 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95";
#else
static char rcsid[] = "$NetBSD: init.c,v 1.5 1997/01/07 11:56:45 tls Exp $";
__RCSID("$NetBSD: init.c,v 1.6 1997/10/10 11:40:01 lukem Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
#include "extern.h"
#include <pwd.h>
void
initialize(startup)
char startup;
{
register struct objs *p;
void die();
struct objs *p;
puts("Version 4.2, fall 1984.");
puts("First Adventure game written by His Lordship, the honorable");
@ -60,7 +59,7 @@ initialize(startup)
wordinit();
if (startup) {
direction = NORTH;
time = 0;
ourtime = 0;
snooze = CYCLE * 1.5;
position = 22;
setbit(wear, PAJAMAS);
@ -71,9 +70,10 @@ initialize(startup)
} else
restore();
wiz = wizard(uname);
signal(SIGINT, die);
signal(SIGINT, diesig);
}
void
getutmp(uname)
char *uname;
{
@ -101,20 +101,22 @@ char *badguys[] = {
0
};
int
wizard(uname)
char *uname;
{
char flag;
int flag;
if (flag = checkout(uname))
if ((flag = checkout(uname)) != 0)
printf("You are the Great wizard %s.\n", uname);
return flag;
}
int
checkout(uname)
register char *uname;
char *uname;
{
register char **ptr;
char **ptr;
for (ptr = list; *ptr; ptr++)
if (strcmp(*ptr, uname) == 0)
@ -125,7 +127,7 @@ checkout(uname)
uname);
CUMBER = 3;
WEIGHT = 9; /* that'll get him! */
clock = 10;
ourclock = 10;
setbit(location[7].objects, WOODSMAN); /* viper room */
setbit(location[20].objects, WOODSMAN); /* laser " */
setbit(location[13].objects, DARK); /* amulet " */

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.4 1997/01/07 11:56:46 tls Exp $ */
/* $NetBSD: misc.c,v 1.5 1997/10/10 11:40:04 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,22 +33,24 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: misc.c,v 1.4 1997/01/07 11:56:46 tls Exp $";
__RCSID("$NetBSD: misc.c,v 1.5 1997/10/10 11:40:04 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
card(array, size) /* for beenthere, injuries */
register char *array;
char *array;
int size;
{
register char *end = array + size;
register int i = 0;
char *end = array + size;
int i = 0;
while (array < end)
if (*array++)
@ -56,10 +58,11 @@ card(array, size) /* for beenthere, injuries */
return (i);
}
int
ucard(array)
register unsigned *array;
unsigned int *array;
{
register int j = 0, n;
int j = 0, n;
for (n = 0; n < NUMOFOBJECTS; n++)
if (testbit(array, n))

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: nightobjs.c,v 1.4 1997/01/07 11:56:48 tls Exp $ */
/* $NetBSD: nightobjs.c,v 1.5 1997/10/10 11:40:11 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)nightobjs.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: nightobjs.c,v 1.4 1997/01/07 11:56:48 tls Exp $";
__RCSID("$NetBSD: nightobjs.c,v 1.5 1997/10/10 11:40:11 lukem Exp $");
#endif
#endif /* not lint */
@ -102,5 +103,5 @@ struct objs nightobjs[] = {
{ 249, FOOT },
{ 250, FOOT },
{ 93, PAPAYAS },
0
{ 0 }
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.4 1997/01/07 11:56:49 tls Exp $ */
/* $NetBSD: parse.c,v 1.5 1997/10/10 11:40:13 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,28 +33,31 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: parse.c,v 1.4 1997/01/07 11:56:49 tls Exp $";
__RCSID("$NetBSD: parse.c,v 1.5 1997/10/10 11:40:13 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
wordinit()
{
register struct wlist *w;
struct wlist *w;
for (w = wlist; w->string; w++)
install(w);
}
int
hash(s)
register char *s;
char *s;
{
register hashval = 0;
int hashval = 0;
while (*s) {
hashval += *s++;
@ -68,7 +71,7 @@ struct wlist *
lookup(s)
char *s;
{
register struct wlist *wp;
struct wlist *wp;
for (wp = hashtab[hash(s)]; wp != NULL; wp = wp->next)
if (*s == *wp->string && strcmp(s, wp->string) == 0)
@ -76,8 +79,9 @@ lookup(s)
return NULL;
}
void
install(wp)
register struct wlist *wp;
struct wlist *wp;
{
int hashval;
@ -89,10 +93,11 @@ install(wp)
printf("Multiply defined %s.\n", wp->string);
}
void
parse()
{
register struct wlist *wp;
register n;
struct wlist *wp;
int n;
wordnumber = 0; /* for cypher */
for (n = 0; n <= wordcount; n++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: room.c,v 1.4 1997/01/07 11:56:49 tls Exp $ */
/* $NetBSD: room.c,v 1.5 1997/10/10 11:40:16 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,26 +33,28 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)room.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: room.c,v 1.4 1997/01/07 11:56:49 tls Exp $";
__RCSID("$NetBSD: room.c,v 1.5 1997/10/10 11:40:16 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
writedes()
{
int compass;
register char *p;
register c;
char *p;
int c;
printf("\n\t%s\n", location[position].name);
if (beenthere[position] < 3) {
compass = NORTH;
for (p = location[position].desc; c = *p++;)
for (p = location[position].desc; (c = *p++) != 0;)
if (c != '-' && c != '*' && c != '+')
putchar(c);
else {
@ -63,10 +65,11 @@ writedes()
}
}
void
printobjs()
{
register unsigned int *p = location[position].objects;
register n;
unsigned int *p = location[position].objects;
int n;
printf("\n");
for (n = 0; n < NUMOFOBJECTS; n++)
@ -74,8 +77,9 @@ printobjs()
puts(objdes[n]);
}
void
whichway(here)
struct room here;
struct room here;
{
switch(direction) {
@ -112,8 +116,8 @@ struct room here;
char *
truedirec(way, option)
int way;
char option;
int way;
char option;
{
switch(way) {
@ -122,7 +126,8 @@ char option;
case NORTH:
return("ahead");
case SOUTH:
return(option == '+' ? "behind you" : "back");
return(option == '+' ? "behind you" :
"back");
case EAST:
return("left");
case WEST:
@ -132,7 +137,8 @@ char option;
case SOUTH:
switch(direction) {
case NORTH:
return(option == '+' ? "behind you" : "back");
return(option == '+' ? "behind you" :
"back");
case SOUTH:
return("ahead");
case EAST:
@ -150,7 +156,8 @@ char option;
case EAST:
return("ahead");
case WEST:
return(option == '+' ? "behind you" : "back");
return(option == '+' ? "behind you" :
"back");
}
case WEST:
@ -160,7 +167,8 @@ char option;
case SOUTH:
return("right");
case EAST:
return(option == '+' ? "behind you" : "back");
return(option == '+' ? "behind you" :
"back");
case WEST:
return("ahead");
}
@ -171,8 +179,9 @@ char option;
}
}
void
newway(thisway)
int thisway;
int thisway;
{
switch(direction){

View File

@ -1,4 +1,4 @@
/* $NetBSD: save.c,v 1.4 1997/01/07 11:56:50 tls Exp $ */
/* $NetBSD: save.c,v 1.5 1997/10/10 11:40:19 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,24 +33,25 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)save.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: save.c,v 1.4 1997/01/07 11:56:50 tls Exp $";
__RCSID("$NetBSD: save.c,v 1.5 1997/10/10 11:40:19 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
restore()
{
char *getenv();
char *home;
char home1[100];
register int n;
int n;
int tmp;
register FILE *fp;
FILE *fp;
home = getenv("HOME");
strcpy(home1, home);
@ -96,12 +97,12 @@ restore()
fread(&ego, sizeof ego, 1, fp);
}
void
save()
{
char *getenv();
char *home;
char home1[100];
register int n;
int n;
int tmp;
FILE *fp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: words.c,v 1.4 1997/01/07 11:56:51 tls Exp $ */
/* $NetBSD: words.c,v 1.5 1997/10/10 11:40:22 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)words.c 8.2 (Berkeley) 4/28/95";
#else
static char rcsid[] = "$NetBSD: words.c,v 1.4 1997/01/07 11:56:51 tls Exp $";
__RCSID("$NetBSD: words.c,v 1.5 1997/10/10 11:40:22 lukem Exp $");
#endif
#endif /* not lint */
@ -208,5 +209,5 @@ struct wlist wlist[] = {
{ "move", 0, ADJS },
{ "make", 0, ADJS },
{ "to", 0, ADJS },
0
{ 0 }
};