mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-02 12:20:51 +00:00
Conform to BDECFLAGS
This commit is contained in:
parent
abbfaeb87b
commit
e3dfcf49c2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66799
@ -54,6 +54,7 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
int
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
@ -97,4 +98,5 @@ char **argv;
|
||||
default:
|
||||
exit(1); /* Shouldn't happen */
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
@ -41,11 +41,16 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
move(thataway, token)
|
||||
void convert __P((int));
|
||||
|
||||
int
|
||||
battlestar_move(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);
|
||||
@ -64,6 +69,7 @@ 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*/
|
||||
{ /* at dusk, and subtracted at dawn. */
|
||||
@ -87,6 +93,7 @@ int tothis; /* Day objects are permanent. Night objects are added*/
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
news()
|
||||
{
|
||||
int n;
|
||||
@ -96,7 +103,7 @@ news()
|
||||
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();
|
||||
die(0);
|
||||
}
|
||||
if (gtime > 20 && position < 32)
|
||||
puts("Explosions rock the battlestar.");
|
||||
@ -193,7 +200,7 @@ news()
|
||||
}
|
||||
if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]){
|
||||
puts("I'm afraid you have suffered fatal injuries.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
for (n=0; n < NUMOFINJURIES; n++)
|
||||
if (injuries[n] == 1){
|
||||
@ -221,6 +228,7 @@ news()
|
||||
notes[CANTMOVE] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
crash()
|
||||
{
|
||||
int hurt1,hurt2;
|
||||
@ -234,7 +242,7 @@ crash()
|
||||
if (!location[position].down){
|
||||
puts("Your viper strikes the ground and explodes into firey fragments.");
|
||||
puts("Thick black smoke billows up from the wreckage.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
position = location[position].down;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
int
|
||||
wearit() /* synonyms = {sheathe, sheath} */
|
||||
{
|
||||
int n;
|
||||
@ -102,6 +103,7 @@ wearit() /* synonyms = {sheathe, sheath} */
|
||||
return(firstnumber);
|
||||
}
|
||||
|
||||
int
|
||||
put() /* synonyms = {buckle, strap, tie} */
|
||||
{
|
||||
if (wordvalue[wordnumber + 1] == ON){
|
||||
@ -117,11 +119,13 @@ put() /* synonyms = {buckle, strap, tie} */
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
draw() /* synonyms = {pull, carry} */
|
||||
{
|
||||
return(take(wear));
|
||||
}
|
||||
|
||||
int
|
||||
use()
|
||||
{
|
||||
while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
|
||||
@ -160,6 +164,7 @@ use()
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void
|
||||
murder()
|
||||
{
|
||||
int n;
|
||||
@ -211,7 +216,7 @@ murder()
|
||||
if (testbit(location[position].objects,MAN)){
|
||||
puts("You strike him to the ground, and he coughs up blood.");
|
||||
puts("Your fantasy is over.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
case -1:
|
||||
puts("Kill what?");
|
||||
@ -226,6 +231,7 @@ murder()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ravage()
|
||||
{
|
||||
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
|
||||
@ -241,7 +247,7 @@ ravage()
|
||||
wordnumber--;
|
||||
godready = -30000;
|
||||
murder();
|
||||
win = -30000;
|
||||
bs_win = -30000;
|
||||
break;
|
||||
case NATIVE:
|
||||
puts("The girl tries to run, but you catch her and throw her down. Her face is");
|
||||
@ -275,6 +281,7 @@ ravage()
|
||||
puts("Who?");
|
||||
}
|
||||
|
||||
int
|
||||
follow()
|
||||
{
|
||||
if (followfight == gtime){
|
||||
|
@ -41,6 +41,7 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
void
|
||||
dig()
|
||||
{
|
||||
if (testbit(inven,SHOVEL)){
|
||||
@ -65,6 +66,7 @@ dig()
|
||||
puts("You don't have a shovel.");
|
||||
}
|
||||
|
||||
int
|
||||
jump()
|
||||
{
|
||||
int n;
|
||||
@ -104,6 +106,7 @@ jump()
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
bury()
|
||||
{
|
||||
int value;
|
||||
@ -167,6 +170,7 @@ bury()
|
||||
puts("You aren't holding a shovel.");
|
||||
}
|
||||
|
||||
void
|
||||
drink()
|
||||
{
|
||||
int n;
|
||||
@ -187,6 +191,7 @@ drink()
|
||||
puts("I'm not thirsty.");
|
||||
}
|
||||
|
||||
int
|
||||
shoot()
|
||||
{
|
||||
int firstnumber, value;
|
||||
@ -206,7 +211,7 @@ shoot()
|
||||
gtime++;
|
||||
printf("The %s explode%s\n",objsht[value],(objsht[value][n-1]=='s' ? (objsht[value][n-2]=='s' ? "s." : ".") : "s."));
|
||||
if (value == BOMB)
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
else
|
||||
printf("I dont see any %s around here.\n", objsht[value]);
|
||||
@ -241,7 +246,7 @@ shoot()
|
||||
case 20:
|
||||
puts("The blast hits the door and it explodes into flame. The magnesium burns");
|
||||
puts("so rapidly that we have no chance to escape.");
|
||||
die();
|
||||
die(0);
|
||||
default:
|
||||
puts("Nothing happens.");
|
||||
}
|
||||
@ -288,7 +293,7 @@ shoot()
|
||||
if (testbit(location[position].objects,MAN)){
|
||||
puts("The man falls to the ground with blood pouring all over his white suit.");
|
||||
puts("Your fantasy is over.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
else puts("What man?");
|
||||
break;
|
||||
|
@ -42,6 +42,7 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include "externs.h"
|
||||
|
||||
int
|
||||
take(from)
|
||||
unsigned int from[];
|
||||
{
|
||||
@ -73,7 +74,7 @@ unsigned int from[];
|
||||
printf("Zap! Taken from thin air.\n");
|
||||
clearbit(from,value);
|
||||
if (value == MEDALION)
|
||||
win--;
|
||||
bs_win--;
|
||||
}
|
||||
else if (testbit(inven,value))
|
||||
printf("You're already holding%s%s.\n", (objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
|
||||
@ -186,6 +187,7 @@ unsigned int from[];
|
||||
return(firstnumber);
|
||||
}
|
||||
|
||||
int
|
||||
throw(name)
|
||||
const char *name;
|
||||
{
|
||||
@ -254,7 +256,7 @@ throw(name)
|
||||
}
|
||||
else if (value == GRENADE && testbit(location[position].objects,value)){
|
||||
puts("You are blown into shreds when your grenade explodes.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
|
||||
wordnumber++;
|
||||
@ -266,6 +268,7 @@ throw(name)
|
||||
return(first);
|
||||
}
|
||||
|
||||
int
|
||||
drop(name)
|
||||
const char *name;
|
||||
{
|
||||
@ -284,7 +287,7 @@ const char *name;
|
||||
encumber -= objcumber[value];
|
||||
if (value == BOMB){
|
||||
puts("The bomb explodes. A blinding white light and immense concussion obliterate us.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
if (value != AMULET && value != MEDALION && value != TALISMAN)
|
||||
setbit(location[position].objects,value);
|
||||
@ -317,18 +320,21 @@ const 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;
|
||||
|
@ -41,6 +41,7 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
void
|
||||
kiss()
|
||||
{
|
||||
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
|
||||
@ -80,6 +81,7 @@ kiss()
|
||||
else puts("I'd prefer not to.");
|
||||
}
|
||||
|
||||
void
|
||||
love()
|
||||
{
|
||||
int n;
|
||||
@ -125,6 +127,7 @@ love()
|
||||
else puts("I't doesn't seem to work.");
|
||||
}
|
||||
|
||||
int
|
||||
zzz()
|
||||
{
|
||||
int oldtime;
|
||||
@ -180,6 +183,7 @@ zzz()
|
||||
return(1);
|
||||
}
|
||||
|
||||
void
|
||||
chime()
|
||||
{
|
||||
if ((gtime / CYCLE + 1) % 2 && OUTSIDE)
|
||||
@ -234,9 +238,11 @@ chime()
|
||||
puts("I can't tell the time in here.");
|
||||
}
|
||||
|
||||
int
|
||||
give()
|
||||
{
|
||||
int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
|
||||
int obj = -1, result = -1, person = 0, firstnumber;
|
||||
int last1 = 0, last2 = 0;
|
||||
|
||||
firstnumber = wordnumber;
|
||||
while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount);
|
||||
@ -293,10 +299,10 @@ give()
|
||||
godready += 3;
|
||||
}
|
||||
if (obj == AMULET || obj == MEDALION || obj == TALISMAN){
|
||||
win++;
|
||||
bs_win++;
|
||||
ego += 5;
|
||||
power -= 5;
|
||||
if (win >= 3){
|
||||
if (bs_win >= 3){
|
||||
puts("The powers of the earth are now legitimate. You have destroyed the Darkness");
|
||||
puts("and restored the goddess to her thrown. The entire island celebrates with");
|
||||
puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you");
|
||||
|
@ -39,9 +39,13 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <signal.h>
|
||||
#include "externs.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
static void post __P((unsigned int ch));
|
||||
|
||||
int
|
||||
launch()
|
||||
{
|
||||
if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){
|
||||
@ -63,6 +67,7 @@ launch()
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
land()
|
||||
{
|
||||
if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){
|
||||
@ -79,13 +84,17 @@ land()
|
||||
return(0);
|
||||
}
|
||||
|
||||
die() /* endgame */
|
||||
void
|
||||
die(sig) /* endgame */
|
||||
int sig;
|
||||
{
|
||||
sig = 0;
|
||||
printf("bye.\nYour rating was %s.\n", rate());
|
||||
post(' ');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
live()
|
||||
{
|
||||
puts("\nYou win!");
|
||||
@ -97,14 +106,16 @@ live()
|
||||
|
||||
static FILE *score_fp;
|
||||
|
||||
void
|
||||
open_score_file()
|
||||
{
|
||||
if ((score_fp = fopen(_PATH_SCORE,"a")) == NULL)
|
||||
perror(_PATH_SCORE);
|
||||
}
|
||||
|
||||
static void
|
||||
post(ch)
|
||||
char ch;
|
||||
unsigned int ch;
|
||||
{
|
||||
struct timeval tv;
|
||||
char *date;
|
||||
@ -169,6 +180,7 @@ rate()
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
drive()
|
||||
{
|
||||
if (testbit(location[position].objects,CAR)){
|
||||
@ -186,6 +198,7 @@ drive()
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
ride()
|
||||
{
|
||||
if (testbit(location[position].objects,HORSE)){
|
||||
@ -208,6 +221,7 @@ ride()
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void
|
||||
light() /* synonyms = {strike, smoke} */
|
||||
{ /* for matches, cigars */
|
||||
if (testbit(inven,MATCHES) && matchcount){
|
||||
@ -217,7 +231,7 @@ light() /* synonyms = {strike, smoke} */
|
||||
matchcount--;
|
||||
if (position == 217){
|
||||
puts("The whole bungalow explodes with an intense blast.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
}
|
||||
else puts("You're out of matches.");
|
||||
|
@ -41,6 +41,7 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
int
|
||||
fight(enemy,strength)
|
||||
int enemy,strength;
|
||||
{
|
||||
@ -49,7 +50,7 @@ int enemy,strength;
|
||||
char auxbuf[LINELENGTH];
|
||||
char *next;
|
||||
int i;
|
||||
int exhaustion;
|
||||
int exhaustion = 0;
|
||||
|
||||
fighton:
|
||||
gtime++;
|
||||
@ -58,7 +59,7 @@ int enemy,strength;
|
||||
exhaustion = CYCLE/(snooze - gtime);
|
||||
else {
|
||||
puts("You collapse exhausted, and he pulverizes your skull.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
if (snooze - gtime < 20)
|
||||
puts("You look tired! I hope you're able to fight.");
|
||||
@ -178,7 +179,7 @@ int enemy,strength;
|
||||
puts("his power grows and the walls of\nthe earth tremble.");
|
||||
puts("When he touches the medallion, your chest explodes and the foundations of the\nearth collapse.");
|
||||
puts("The planet is consumed by darkness.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
if (testbit(inven,AMULET)){
|
||||
clearbit(inven,AMULET);
|
||||
@ -195,22 +196,23 @@ int enemy,strength;
|
||||
}
|
||||
else{
|
||||
puts("I'm afraid you have been killed.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
}
|
||||
else{
|
||||
puts("You escape stunned and disoriented from the fight.");
|
||||
puts("A victorious bellow echoes from the battlescene.");
|
||||
if (back && position != back)
|
||||
move(back,BACK);
|
||||
battlestar_move(back,BACK);
|
||||
else if (ahead &&position != ahead)
|
||||
move(ahead,AHEAD);
|
||||
battlestar_move(ahead,AHEAD);
|
||||
else if (left && position != left)
|
||||
move(left,LEFT);
|
||||
battlestar_move(left,LEFT);
|
||||
else if (right && position != right)
|
||||
move(right,RIGHT);
|
||||
battlestar_move(right,RIGHT);
|
||||
else
|
||||
move(location[position].down,AHEAD);
|
||||
battlestar_move(location[position].down,
|
||||
AHEAD);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -266,7 +268,7 @@ int enemy,strength;
|
||||
puts("You emerge unscathed.");
|
||||
if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]){
|
||||
puts("I'm afraid you have suffered fatal injuries.");
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
goto fighton;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
int
|
||||
cypher()
|
||||
{
|
||||
int n;
|
||||
@ -57,7 +58,7 @@ cypher()
|
||||
if (location[position].access || wiz || tempwiz) {
|
||||
if (!location[position].access)
|
||||
puts("Zap! A gust of wind lifts you up.");
|
||||
if (!move(location[position].up, AHEAD))
|
||||
if (!battlestar_move(location[position].up, AHEAD))
|
||||
return(-1);
|
||||
} else {
|
||||
puts("There is no way up");
|
||||
@ -67,31 +68,32 @@ cypher()
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
if (!move(location[position].down, AHEAD))
|
||||
if (!battlestar_move(location[position].down,
|
||||
AHEAD))
|
||||
return(-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case LEFT:
|
||||
if (!move(left, LEFT))
|
||||
if (!battlestar_move(left, LEFT))
|
||||
return(-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case RIGHT:
|
||||
if (!move(right, RIGHT))
|
||||
if (!battlestar_move(right, RIGHT))
|
||||
return(-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case AHEAD:
|
||||
if (!move(ahead, AHEAD))
|
||||
if (!battlestar_move(ahead, AHEAD))
|
||||
return(-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case BACK:
|
||||
if (!move(back, BACK))
|
||||
if (!battlestar_move(back, BACK))
|
||||
return(-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
@ -144,8 +146,8 @@ cypher()
|
||||
case THROW:
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
|
||||
for (n=0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(inven,n) ||
|
||||
testbit(location[position].objects, n) && objsht[n]){
|
||||
if ((testbit(inven,n) ||
|
||||
testbit(location[position].objects, n)) && objsht[n]){
|
||||
wordvalue[wordnumber+1] = n;
|
||||
wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
|
||||
}
|
||||
@ -417,7 +419,7 @@ cypher()
|
||||
break;
|
||||
|
||||
case QUIT:
|
||||
die();
|
||||
die(0);
|
||||
|
||||
default:
|
||||
puts("How's that?");
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -138,5 +138,5 @@ const struct objs dayobjs[] = {
|
||||
{ 130, BRACELET },
|
||||
{ 93, GIRL },
|
||||
{ 268, LAMPON },
|
||||
0
|
||||
{ 0 , 0 }
|
||||
};
|
||||
|
@ -31,13 +31,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)externs.h 8.1 (Berkeley) 5/31/93
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define BITS (8)
|
||||
|
||||
@ -229,18 +233,18 @@ struct room {
|
||||
#define down link[6]
|
||||
#define flyhere link[7]
|
||||
const char *desc;
|
||||
int objects[NUMOFWORDS];
|
||||
unsigned int objects[NUMOFWORDS];
|
||||
};
|
||||
extern struct room dayfile[];
|
||||
extern struct room nightfile[];
|
||||
struct room *location;
|
||||
|
||||
/* object characteristics */
|
||||
const char *const objdes[NUMOFOBJECTS];
|
||||
const char *const objsht[NUMOFOBJECTS];
|
||||
const char *const ouch[NUMOFINJURIES];
|
||||
const int objwt[NUMOFOBJECTS];
|
||||
const int objcumber[NUMOFOBJECTS];
|
||||
extern const char *const objdes[NUMOFOBJECTS];
|
||||
extern const char *const objsht[NUMOFOBJECTS];
|
||||
extern const char *const ouch[NUMOFINJURIES];
|
||||
extern const int objwt[NUMOFOBJECTS];
|
||||
extern const int objcumber[NUMOFOBJECTS];
|
||||
|
||||
/* current input line */
|
||||
#define NWORD 20 /* words per line */
|
||||
@ -249,35 +253,88 @@ int wordvalue[NWORD];
|
||||
int wordtype[NWORD];
|
||||
int wordcount, wordnumber;
|
||||
|
||||
const char *truedirec(), *rate();
|
||||
char *getcom(), *getword();
|
||||
|
||||
int battlestar_move __P((int, int));
|
||||
void bury __P((void));
|
||||
int card __P((const char *, int));
|
||||
void chime __P((void));
|
||||
void crash __P((void));
|
||||
int cypher __P((void));
|
||||
void die __P((int));
|
||||
void dig __P((void));
|
||||
int draw __P((void));
|
||||
void drink __P((void));
|
||||
int drive __P((void));
|
||||
int drop __P((const char *name));
|
||||
int eat __P((void));
|
||||
int fight __P((int, int));
|
||||
int follow __P((void));
|
||||
char *getcom __P((char *, int, const char *, const char *));
|
||||
char *getword __P((char *, char *, int));
|
||||
int give __P((void));
|
||||
void initialize __P((int));
|
||||
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));
|
||||
void murder __P((void));
|
||||
void news __P((void));
|
||||
void newway __P((int));
|
||||
void open_score_file __P((void));
|
||||
void parse __P((void));
|
||||
void printobjs __P((void));
|
||||
int put __P((void));
|
||||
int puton __P((void));
|
||||
void ravage __P((void));
|
||||
const char *rate __P((void));
|
||||
void restore __P((void));
|
||||
int ride __P((void));
|
||||
void save __P((void));
|
||||
int shoot __P((void));
|
||||
int take __P((unsigned int from[]));
|
||||
int takeoff(void);
|
||||
int throw __P((const char *name));
|
||||
const char *truedirec __P((int, unsigned int));
|
||||
int ucard __P((const unsigned int *));
|
||||
int use __P((void));
|
||||
int visual __P((void));
|
||||
int wearit __P((void));
|
||||
void whichway __P((struct room));
|
||||
void wordinit __P((void));
|
||||
void writedes __P((void));
|
||||
int zzz __P((void));
|
||||
|
||||
/* state of the game */
|
||||
extern int gclock;
|
||||
int gtime;
|
||||
int position;
|
||||
int direction;
|
||||
int left, right, ahead, back;
|
||||
int gclock, fuel, torps;
|
||||
int fuel, torps;
|
||||
int carrying, encumber;
|
||||
int rythmn;
|
||||
int followfight;
|
||||
extern int followfight;
|
||||
int ate;
|
||||
int snooze;
|
||||
int meetgirl;
|
||||
int followgod;
|
||||
extern int followgod;
|
||||
int godready;
|
||||
int win;
|
||||
extern int bs_win;
|
||||
int wintime;
|
||||
int wiz;
|
||||
int tempwiz;
|
||||
int matchlight, matchcount;
|
||||
int matchlight;
|
||||
extern int matchcount;
|
||||
int loved;
|
||||
int pleasure, power, ego;
|
||||
int WEIGHT;
|
||||
int CUMBER;
|
||||
extern int WEIGHT;
|
||||
extern int CUMBER;
|
||||
int notes[NUMOFNOTES];
|
||||
int inven[NUMOFWORDS];
|
||||
int wear[NUMOFWORDS];
|
||||
unsigned int inven[NUMOFWORDS];
|
||||
u_int wear[NUMOFWORDS];
|
||||
char beenthere[NUMOFROOMS+1];
|
||||
char injuries[NUMOFINJURIES];
|
||||
|
||||
@ -301,4 +358,4 @@ struct objs {
|
||||
extern const struct objs dayobjs[];
|
||||
extern const struct objs nightobjs[];
|
||||
|
||||
gid_t egid;
|
||||
extern gid_t egid;
|
||||
|
@ -55,9 +55,20 @@ int gclock = 120; /* gtime for all the flights in the game */
|
||||
char cross = 0;
|
||||
sig_t oldsig;
|
||||
|
||||
static void blast __P((void));
|
||||
static void endfly __P((void));
|
||||
static void moveenemy __P((int));
|
||||
static void notarget __P((void));
|
||||
static void succumb __P((int));
|
||||
static void screen __P((void));
|
||||
static void target __P((void));
|
||||
|
||||
void
|
||||
succumb()
|
||||
succumb(sig)
|
||||
int sig;
|
||||
{
|
||||
|
||||
sig = 0;
|
||||
if (oldsig == SIG_DFL) {
|
||||
endfly();
|
||||
exit(1);
|
||||
@ -68,12 +79,12 @@ succumb()
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
visual()
|
||||
{
|
||||
void moveenemy();
|
||||
|
||||
destroyed = 0;
|
||||
if(initscr() == ERR){
|
||||
if(initscr() == NULL){
|
||||
puts("Whoops! No more memory...");
|
||||
return(0);
|
||||
}
|
||||
@ -83,7 +94,7 @@ visual()
|
||||
screen();
|
||||
row = rnd(LINES-3) + 1;
|
||||
column = rnd(COLS-2) + 1;
|
||||
moveenemy();
|
||||
moveenemy(0);
|
||||
for (;;) {
|
||||
switch(getchar()){
|
||||
|
||||
@ -173,11 +184,14 @@ visual()
|
||||
}
|
||||
if (gclock <= 0){
|
||||
endfly();
|
||||
die();
|
||||
die(0);
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return(1);
|
||||
}
|
||||
|
||||
void
|
||||
screen()
|
||||
{
|
||||
int r,c,n;
|
||||
@ -194,6 +208,7 @@ screen()
|
||||
refresh();
|
||||
}
|
||||
|
||||
void
|
||||
target()
|
||||
{
|
||||
int n;
|
||||
@ -206,6 +221,7 @@ target()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
notarget()
|
||||
{
|
||||
int n;
|
||||
@ -218,13 +234,14 @@ notarget()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
blast()
|
||||
{
|
||||
int n;
|
||||
|
||||
alarm(0);
|
||||
move(LINES-1, 24);
|
||||
printw("%3d", torps);
|
||||
printw((char *)(uintptr_t)(const void *)"%3d", torps);
|
||||
for(n = LINES-1-2; n >= MIDR + 1; n--){
|
||||
mvaddch(n, MIDC+MIDR-n, '/');
|
||||
mvaddch(n, MIDC-MIDR+n, '\\');
|
||||
@ -240,11 +257,12 @@ blast()
|
||||
}
|
||||
|
||||
void
|
||||
moveenemy()
|
||||
moveenemy(int sig)
|
||||
{
|
||||
double d;
|
||||
int oldr, oldc;
|
||||
|
||||
sig = 0;
|
||||
oldr = row;
|
||||
oldc = column;
|
||||
if (fuel > 0){
|
||||
@ -267,16 +285,17 @@ moveenemy()
|
||||
target();
|
||||
mvaddstr(row, column - 1, "/-\\");
|
||||
move(LINES-1, 24);
|
||||
printw("%3d", torps);
|
||||
printw((char *)(uintptr_t)(const void *)"%3d", torps);
|
||||
move(LINES-1, 42);
|
||||
printw("%3d", fuel);
|
||||
printw((char *)(uintptr_t)(const void *)"%3d", fuel);
|
||||
move(LINES-1, 57);
|
||||
printw("%3d", gclock);
|
||||
printw((char *)(uintptr_t)(const void *)"%3d", gclock);
|
||||
refresh();
|
||||
signal(SIGALRM, moveenemy);
|
||||
alarm(1);
|
||||
}
|
||||
|
||||
void
|
||||
endfly()
|
||||
{
|
||||
alarm(0);
|
||||
|
@ -39,8 +39,8 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "externs.h"
|
||||
|
||||
char *
|
||||
getcom(buf, size, prompt, error)
|
||||
|
@ -217,7 +217,7 @@ const int objcumber[NUMOFOBJECTS] = {
|
||||
10, 8, 8, 10, 10, 3, 1, 2
|
||||
};
|
||||
|
||||
int win = 1;
|
||||
int bs_win = 1;
|
||||
int matchcount = 20;
|
||||
int followgod = -1;
|
||||
int followfight = -1;
|
||||
|
@ -40,15 +40,19 @@ static const char rcsid[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "externs.h"
|
||||
#include <pwd.h>
|
||||
#include <string.h>
|
||||
#include "externs.h"
|
||||
|
||||
static int checkout __P((const char *));
|
||||
static void getutmp __P((char *));
|
||||
static int wizard __P((const char *));
|
||||
|
||||
void
|
||||
initialize(startup)
|
||||
char startup;
|
||||
int startup;
|
||||
{
|
||||
const struct objs *p;
|
||||
void die();
|
||||
|
||||
puts("Version 4.2, fall 1984.");
|
||||
puts("First Adventure game written by His Lordship, the honorable");
|
||||
@ -74,13 +78,14 @@ initialize(startup)
|
||||
signal(SIGINT, die);
|
||||
}
|
||||
|
||||
getutmp(uname)
|
||||
char *uname;
|
||||
void
|
||||
getutmp(battlestar_uname)
|
||||
char *battlestar_uname;
|
||||
{
|
||||
struct passwd *ptr;
|
||||
|
||||
ptr = getpwuid(getuid());
|
||||
strcpy(uname, ptr ? ptr->pw_name : "");
|
||||
strcpy(battlestar_uname, ptr ? ptr->pw_name : "");
|
||||
}
|
||||
|
||||
const char *const list[] = { /* hereditary wizards */
|
||||
@ -102,29 +107,29 @@ const char *const badguys[] = {
|
||||
};
|
||||
|
||||
int
|
||||
wizard(uname)
|
||||
const char *uname;
|
||||
wizard(battlestar_uname)
|
||||
const char *battlestar_uname;
|
||||
{
|
||||
char flag;
|
||||
|
||||
if (flag = checkout(uname))
|
||||
printf("You are the Great wizard %s.\n", uname);
|
||||
if ((flag = checkout(battlestar_uname)) > 0)
|
||||
printf("You are the Great wizard %s.\n", battlestar_uname);
|
||||
return flag;
|
||||
}
|
||||
|
||||
int
|
||||
checkout(uname)
|
||||
const char *uname;
|
||||
checkout(battlestar_uname)
|
||||
const char *battlestar_uname;
|
||||
{
|
||||
const char *const *ptr;
|
||||
|
||||
for (ptr = list; *ptr; ptr++)
|
||||
if (strcmp(*ptr, uname) == 0)
|
||||
if (strcmp(*ptr, battlestar_uname) == 0)
|
||||
return 1;
|
||||
for (ptr = badguys; *ptr; ptr++)
|
||||
if (strcmp(*ptr, uname) == 0) {
|
||||
if (strcmp(*ptr, battlestar_uname) == 0) {
|
||||
printf("You are the Poor anti-wizard %s. Good Luck!\n",
|
||||
uname);
|
||||
battlestar_uname);
|
||||
if (location != NULL) {
|
||||
CUMBER = 3;
|
||||
WEIGHT = 9; /* that'll get him! */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -100,5 +100,5 @@ const struct objs nightobjs[] = {
|
||||
{ 249, FOOT },
|
||||
{ 250, FOOT },
|
||||
{ 93, PAPAYAS },
|
||||
0
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
@ -41,6 +41,11 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
static int hash __P((const char *));
|
||||
static void install __P((struct wlist *));
|
||||
struct wlist *lookup __P((const char *));
|
||||
|
||||
void
|
||||
wordinit()
|
||||
{
|
||||
struct wlist *w;
|
||||
@ -75,6 +80,7 @@ lookup(s)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
install(wp)
|
||||
struct wlist *wp;
|
||||
{
|
||||
@ -88,6 +94,7 @@ install(wp)
|
||||
printf("Multiply defined %s.\n", wp->string);
|
||||
}
|
||||
|
||||
void
|
||||
parse()
|
||||
{
|
||||
struct wlist *wp;
|
||||
|
@ -41,18 +41,19 @@ static const char rcsid[] =
|
||||
|
||||
#include "externs.h"
|
||||
|
||||
void
|
||||
writedes()
|
||||
{
|
||||
int compass;
|
||||
const char *p;
|
||||
int c;
|
||||
unsigned 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++);)
|
||||
if (c != '-' && c != '*' && c != '+')
|
||||
putchar(c);
|
||||
putchar((int)c);
|
||||
else {
|
||||
if (c != '*')
|
||||
printf(truedirec(compass, c));
|
||||
@ -61,9 +62,10 @@ writedes()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
printobjs()
|
||||
{
|
||||
int *p = location[position].objects;
|
||||
unsigned int *p = location[position].objects;
|
||||
int n;
|
||||
|
||||
printf("\n");
|
||||
@ -72,6 +74,7 @@ printobjs()
|
||||
puts(objdes[n]);
|
||||
}
|
||||
|
||||
void
|
||||
whichway(here)
|
||||
struct room here;
|
||||
{
|
||||
@ -111,7 +114,7 @@ struct room here;
|
||||
const char *
|
||||
truedirec(way, option)
|
||||
int way;
|
||||
char option;
|
||||
unsigned int option;
|
||||
{
|
||||
switch(way) {
|
||||
|
||||
@ -169,6 +172,7 @@ char option;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
newway(thisway)
|
||||
int thisway;
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ restore()
|
||||
fread(&meetgirl, sizeof meetgirl, 1, fp);
|
||||
fread(&followgod, sizeof followgod, 1, fp);
|
||||
fread(&godready, sizeof godready, 1, fp);
|
||||
fread(&win, sizeof win, 1, fp);
|
||||
fread(&bs_win, sizeof bs_win, 1, fp);
|
||||
fread(&wintime, sizeof wintime, 1, fp);
|
||||
fread(&matchlight, sizeof matchlight, 1, fp);
|
||||
fread(&matchcount, sizeof matchcount, 1, fp);
|
||||
@ -172,7 +172,7 @@ save()
|
||||
fwrite(&meetgirl, sizeof meetgirl, 1, fp);
|
||||
fwrite(&followgod, sizeof followgod, 1, fp);
|
||||
fwrite(&godready, sizeof godready, 1, fp);
|
||||
fwrite(&win, sizeof win, 1, fp);
|
||||
fwrite(&bs_win, sizeof bs_win, 1, fp);
|
||||
fwrite(&wintime, sizeof wintime, 1, fp);
|
||||
fwrite(&matchlight, sizeof matchlight, 1, fp);
|
||||
fwrite(&matchcount, sizeof matchcount, 1, fp);
|
||||
|
@ -206,5 +206,5 @@ struct wlist wlist[] = {
|
||||
{ "move", 0, ADJS },
|
||||
{ "make", 0, ADJS },
|
||||
{ "to", 0, ADJS },
|
||||
0
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user