copy in from cvs; cvs2svn fucked up big time

git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@9775 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
2003-12-19 19:12:08 +00:00
parent 351c8ca204
commit 51eabc017b
310 changed files with 7852 additions and 5005 deletions

View File

@@ -1,6 +1,8 @@
# $NetBSD: Makefile,v 1.16 1998/02/18 22:37:32 jtc Exp $
# $NetBSD: Makefile,v 1.26 2002/03/05 21:31:23 thorpej Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
.include <bsd.own.mk>
PROG= phantasia
SRCS= fight.c gamesupport.c interplayer.c io.c main.c misc.c phantglobs.c
@@ -10,22 +12,35 @@ HIDEGAME=hidegame
SETGIDGAME=yes
USETBL=
MAN= phantasia.6
CLEANFILES+=map setup setup.o host_phantglobs.o
all: setup phantasia
FILESDIR=/var/games/phantasia
FILESOWN=games
FILESGRP=games
FILESMODE=0660
ALLFILES=gold lastdead mess monsters void motd characs scoreboard
FILES=gold lastdead mess monsters void motd
# don't overwrite existing characters or scorefile
.for file in characs scoreboard
.if !exists(${DESTDIR}/${FILESDIR}/${file})
FILES+=${file}
.endif
.endfor
setup: host_phantglobs.o setup.o monsters.asc ${LIBM}
${HOST_CC} host_phantglobs.o setup.o -o ${.TARGET} -lm
CLEANFILES+=map setup setup.lo host_phantglobs.lo ${ALLFILES}
host_phantglobs.o: ${.CURDIR}/phantglobs.c
${HOST_COMPILE.c} -o host_phantglobs.o ${.CURDIR}/phantglobs.c
realall: ${FILES}
setup.o: ${.CURDIR}/setup.c
${HOST_COMPILE.c} ${.CURDIR}/setup.c
afterinstall:
${FILES}: setup
./setup -m ${.CURDIR}/monsters.asc
chown games:games ${DESTDIR}/var/games/phantasia/*
setup: host_phantglobs.lo setup.lo monsters.asc ${LIBM}
${HOST_LINK.c} host_phantglobs.lo setup.lo -o ${.TARGET} -lm
host_phantglobs.lo: ${.CURDIR}/phantglobs.c
${HOST_COMPILE.c} -o host_phantglobs.lo ${.CURDIR}/phantglobs.c
setup.lo: ${.CURDIR}/setup.c
${HOST_COMPILE.c} -o setup.lo ${.CURDIR}/setup.c
# Make Phantasia map. Change the map commands reflect your installation.
# PLOTDEVICE is used for plotting the map. Change as appropriate.

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fight.c,v 1.4 1998/08/30 09:19:39 veego Exp $ */
/* $NetBSD: fight.c,v 1.7 2000/04/27 00:30:53 jdc Exp $ */
/*
* fight.c Phantasia monster fighting routines
@@ -10,18 +10,14 @@ void
encounter(particular)
int particular;
{
bool firsthit = Player.p_blessing; /* set if player gets the
* first hit */
int flockcnt = 1; /* how many time flocked */
volatile bool firsthit = Player.p_blessing; /* set if player gets
* the first hit */
volatile int flockcnt = 1; /* how many time flocked */
/* let others know what we are doing */
Player.p_status = S_MONSTER;
writerecord(&Player, Fileloc);
#if __GNUC__
(void)&firsthit; /* XXX shut up gcc */
#endif
#ifdef SYS5
flushinp();
#endif
@@ -396,7 +392,7 @@ monsthits()
/* takes some of the player's strength */
inflict = ROLL(1.0, (Circle - 1.0) / 2.0);
inflict = MIN(Player.p_strength, inflict);
mvprintw(Lines++, 0, "%s sapped %0.f of your strength!",
mvprintw(Lines++, 0, "%s sapped %.0f of your strength!",
Enemyname, inflict);
Player.p_strength -= inflict;
Player.p_might -= inflict;
@@ -549,7 +545,7 @@ monsthits()
mvprintw(Lines++, 0,
"%s flew away, and left you to contend with one of its friends.",
Enemyname);
Whichmonster = 55 + (drandom() > 0.5) ? 22 : 0;
Whichmonster = 55 + ((drandom() > 0.5) ? 22 : 0);
longjmp(Fightenv, 0);
/* NOTREACHED */
@@ -844,7 +840,7 @@ callmonster(which)
which = MIN(which, 99); /* make sure within range */
/* fill structure */
fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0);
fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET);
fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
/* handle some special monsters */
@@ -869,7 +865,7 @@ callmonster(which)
Curmonster.m_energy = Player.p_might * 30.0;
Curmonster.m_type = SM_MORGOTH;
Curmonster.m_speed = Player.p_speed * 1.1
+ (Player.p_specialtype == SC_EXVALAR) ? Player.p_speed : 0.0;
+ ((Player.p_specialtype == SC_EXVALAR) ? Player.p_speed : 0.0);
Curmonster.m_flock = 0.0;
Curmonster.m_treasuretype = 0;
Curmonster.m_experience = 0.0;
@@ -879,7 +875,7 @@ callmonster(which)
/* pick another name */
{
which = (int) ROLL(0.0, 100.0);
fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0);
fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET);
fread(&Othermonster, SZ_MONSTERSTRUCT, 1, Monstfp);
strcpy(Curmonster.m_name, Othermonster.m_name);
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: gamesupport.c,v 1.4 1997/10/13 02:18:16 lukem Exp $ */
/* $NetBSD: gamesupport.c,v 1.6 1999/09/08 21:57:19 jsm Exp $ */
/*
* gamesupport.c - auxiliary routines for support of Phantasia
@@ -13,7 +13,7 @@ changestats(ingameflag)
static char flag[2] = /* for printing values of bools */
{'F', 'T'};
struct player *playerp; /* pointer to structure to alter */
char *prompt; /* pointer to prompt string */
const char *prompt; /* pointer to prompt string */
int c; /* input */
int today; /* day of year of today */
int temp; /* temporary variable */
@@ -443,7 +443,7 @@ monstlist()
int count = 0; /* count in file */
puts(" #) Name Str Brain Quick Energy Exper Treas Type Flock%\n");
fseek(Monstfp, 0L, 0);
fseek(Monstfp, 0L, SEEK_SET);
while (fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp) == 1)
printf("%2d) %-20.20s%4.0f %4.0f %2.0f %5.0f %5.0f %2d %2d %3.0f\n", count++,
Curmonster.m_name, Curmonster.m_strength, Curmonster.m_brains,
@@ -468,7 +468,7 @@ scorelist()
void
activelist()
{
fseek(Playersfp, 0L, 0);
fseek(Playersfp, 0L, SEEK_SET);
printf("Current characters on file are:\n\n");
while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
@@ -492,7 +492,7 @@ purgeoldplayers()
today = localtime(&ltime)->tm_yday;
for (;;) {
fseek(Playersfp, loc, 0);
fseek(Playersfp, loc, SEEK_SET);
if (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) != 1)
break;
@@ -543,7 +543,7 @@ enterscore()
strcpy(sbuf.sb_type, descrtype(&Player, TRUE));
}
/* update entry */
fseek(fp, loc, 0);
fseek(fp, loc, SEEK_SET);
fwrite((char *) &sbuf, SZ_SCORESTRUCT, 1, fp);
fclose(fp);
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: interplayer.c,v 1.3 1997/10/13 02:18:22 lukem Exp $ */
/* $NetBSD: interplayer.c,v 1.6 1999/09/18 19:38:52 jsm Exp $ */
/*
* interplayer.c - player to player routines for Phantasia
@@ -12,7 +12,7 @@ checkbattle()
long foeloc = 0L; /* location in file of person to fight */
Users = 0;
fseek(Playersfp, 0L, 0);
fseek(Playersfp, 0L, SEEK_SET);
while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
if (Other.p_status != S_OFF
@@ -356,7 +356,7 @@ checktampered()
long loc = 0L; /* location in energy void file */
/* first check for energy voids */
fseek(Energyvoidfp, 0L, 0);
fseek(Energyvoidfp, 0L, SEEK_SET);
while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
if (Enrgyvoid.ev_active
&& Enrgyvoid.ev_x == Player.p_x
@@ -508,7 +508,7 @@ tampered(what, arg1, arg2)
addstr("You made to position of Valar!\n");
Player.p_specialtype = SC_VALAR;
Player.p_lives = 5;
fseek(Playersfp, 0L, 0);
fseek(Playersfp, 0L, SEEK_SET);
loc = 0L;
while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
/* search for existing valar */
@@ -545,7 +545,7 @@ userlist(ingameflag)
mvaddstr(8, 0, "You cannot see anyone.\n");
return;
}
fseek(Playersfp, 0L, 0);
fseek(Playersfp, 0L, SEEK_SET);
mvaddstr(8, 0,
"Name X Y Lvl Type Login Status\n");
@@ -607,7 +607,7 @@ throneroom()
if (Player.p_specialtype < SC_KING)
/* not already king -- assumes crown */
{
fseek(Playersfp, 0L, 0);
fseek(Playersfp, 0L, SEEK_SET);
while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
if (Other.p_specialtype == SC_KING && Other.p_status != S_NOTUSED)
/* found old king */
@@ -643,7 +643,7 @@ throneroom()
fclose(fp);
/* clear all energy voids; retain location of holy grail */
fseek(Energyvoidfp, 0L, 0);
fseek(Energyvoidfp, 0L, SEEK_SET);
fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
fp = fopen(_PATH_VOID, "w");
fwrite((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, fp);
@@ -656,7 +656,7 @@ void
dotampered()
{
short tamper; /* value for tampering with other players */
char *option; /* pointer to option description */
const char *option; /* pointer to option description */
double temp1 = 0.0, temp2 = 0.0; /* other tampering values */
int ch; /* input */
long loc; /* location in energy void file */
@@ -718,7 +718,7 @@ dotampered()
/* collect taxes */
{
fread((char *) &temp1, sizeof(double), 1, fp);
fseek(fp, 0L, 0);
fseek(fp, 0L, SEEK_SET);
/* clear out value */
temp2 = 0.0;
fwrite((char *) &temp2, sizeof(double), 1, fp);
@@ -765,7 +765,7 @@ dotampered()
if (Player.p_palantir)
/* need a palantir to seek */
{
fseek(Energyvoidfp, 0L, 0);
fseek(Energyvoidfp, 0L, SEEK_SET);
fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
temp1 = distance(Player.p_x, Enrgyvoid.ev_x, Player.p_y, Enrgyvoid.ev_y);
temp1 += ROLL(-temp1 / 10.0, temp1 / 5.0); /* add some error */
@@ -865,10 +865,10 @@ writevoid(vp, loc)
long loc;
{
fseek(Energyvoidfp, loc, 0);
fseek(Energyvoidfp, loc, SEEK_SET);
fwrite((char *) vp, SZ_VOIDSTRUCT, 1, Energyvoidfp);
fflush(Energyvoidfp);
fseek(Energyvoidfp, 0L, 0);
fseek(Energyvoidfp, 0L, SEEK_SET);
}
long
@@ -876,7 +876,7 @@ allocvoid()
{
long loc = 0L; /* location of new energy void */
fseek(Energyvoidfp, 0L, 0);
fseek(Energyvoidfp, 0L, SEEK_SET);
while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
if (Enrgyvoid.ev_active)
loc += SZ_VOIDSTRUCT;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.3 1997/10/13 02:18:25 lukem Exp $ */
/* $NetBSD: io.c,v 1.5 1999/09/08 21:45:29 jsm Exp $ */
/*
* io.c - input/output routines for Phantasia
@@ -153,7 +153,7 @@ interrupt()
int
getanswer(choices, def)
char *choices;
const char *choices;
bool def;
{
int ch; /* input */
@@ -238,7 +238,7 @@ getanswer(choices, def)
void
catchalarm(dummy)
int dummy __attribute__((unused));
int dummy __attribute__((__unused__));
{
longjmp(Timeoenv, 1);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $NetBSD: phantdefs.h,v 1.2 1995/03/24 03:59:28 cgd Exp $ */
/* $NetBSD: phantdefs.h,v 1.4 2001/09/16 16:34:25 wiz Exp $ */
/*
* phantdefs.h - important constants for Phantasia
@@ -28,7 +28,7 @@
#define S_INBATTLE 4 /* playing - in battle */
#define S_MONSTER 5 /* playing - fighting monster */
#define S_TRADING 6 /* playing - at a trading post */
#define S_HUNGUP 7 /* error occured with character */
#define S_HUNGUP 7 /* error occurred with character */
/* tampered constants */
#define T_OFF 0 /* nothing */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: phantglobs.c,v 1.4 1998/07/27 01:12:35 mycroft Exp $ */
/* $NetBSD: phantglobs.c,v 1.5 1999/09/08 21:17:54 jsm Exp $ */
/*
* phantglobs.c - globals for Phantasia
@@ -30,7 +30,7 @@ jmp_buf Timeoenv; /* used for timing out waiting for input */
long Fileloc; /* location in file of player statistics */
const char *Login; /* pointer to login of player */
char *Enemyname; /* pointer name of monster/player we are battling*/
const char *Enemyname; /* pointer name of monster/player we are battling*/
struct player Player; /* stats for player */
struct player Other; /* stats for another player */
@@ -39,10 +39,10 @@ struct monster Curmonster;/* stats for current monster */
struct energyvoid Enrgyvoid;/* energy void buffer */
struct charstats *Statptr;/* pointer into Stattable[] */
const struct charstats *Statptr;/* pointer into Stattable[] */
/* lookup table for character type dependent statistics */
struct charstats Stattable[7] = {
const struct charstats Stattable[7] = {
/* MAGIC USER */
{
15.0, 200.0, 18.0, 175.0, 10,
@@ -92,7 +92,7 @@ struct charstats Stattable[7] = {
};
/* menu of items for purchase */
struct menuitem Menu[] = {
const struct menuitem Menu[] = {
{"Mana", 1},
{"Shield", 5},
{"Book", 200},
@@ -110,9 +110,9 @@ FILE *Energyvoidfp; /* pointer to open energy void file */
char Databuf[SZ_DATABUF]; /* a place to read data into */
/* some canned strings for messages */
char Illcmd[] = "Illegal command.\n";
char Illmove[] = "Too far.\n";
char Illspell[] = "Illegal spell.\n";
char Nomana[] = "Not enought mana for that spell.\n";
char Somebetter[] = "But you already have something better.\n";
char Nobetter[] = "That's no better than what you already have.\n";
const char Illcmd[] = "Illegal command.\n";
const char Illmove[] = "Too far.\n";
const char Illspell[] = "Illegal spell.\n";
const char Nomana[] = "Not enought mana for that spell.\n";
const char Somebetter[] = "But you already have something better.\n";
const char Nobetter[] = "That's no better than what you already have.\n";

View File

@@ -1,4 +1,4 @@
/* $NetBSD: phantglobs.h,v 1.5 1998/07/27 01:12:35 mycroft Exp $ */
/* $NetBSD: phantglobs.h,v 1.8 2001/02/05 01:01:27 christos Exp $ */
/*
* phantglobs.h - global declarations for Phantasia
@@ -28,7 +28,7 @@ extern jmp_buf Timeoenv; /* used for timing out waiting for input */
extern long Fileloc; /* location in file of player statistics */
extern const char *Login; /* pointer to login of current player */
extern char *Enemyname; /* pointer name of monster/player we are battling*/
extern const char *Enemyname; /* pointer name of monster/player we are battling*/
extern struct player Player; /* stats for player */
extern struct player Other; /* stats for another player */
@@ -37,11 +37,11 @@ extern struct monster Curmonster;/* stats for current monster */
extern struct energyvoid Enrgyvoid;/* energy void buffer */
extern struct charstats Stattable[];/* used for rolling and changing player stats*/
extern const struct charstats Stattable[];/* used for rolling and changing player stats*/
extern struct charstats *Statptr;/* pointer into Stattable[] */
extern const struct charstats *Statptr;/* pointer into Stattable[] */
extern struct menuitem Menu[]; /* menu of items for purchase */
extern const struct menuitem Menu[]; /* menu of items for purchase */
extern FILE *Playersfp; /* pointer to open player file */
extern FILE *Monstfp; /* pointer to open monster file */
@@ -51,18 +51,18 @@ extern FILE *Energyvoidfp; /* pointer to open energy void file */
extern char Databuf[]; /* a place to read data into */
/* some canned strings for messages */
extern char Illcmd[];
extern char Illmove[];
extern char Illspell[];
extern char Nomana[];
extern char Somebetter[];
extern char Nobetter[];
extern const char Illcmd[];
extern const char Illmove[];
extern const char Illspell[];
extern const char Nomana[];
extern const char Somebetter[];
extern const char Nobetter[];
/* functions which we need to know about */
char *descrlocation __P((struct player *, bool));
char *descrstatus __P((struct player *));
char *descrtype __P((struct player *, bool));
const char *descrlocation __P((struct player *, bool));
const char *descrstatus __P((struct player *));
const char *descrtype __P((struct player *, bool));
void activelist __P((void));
void adjuststats __P((void));
long allocrecord __P((void));
@@ -73,26 +73,26 @@ void awardtreasure __P((void));
void battleplayer __P((long));
void callmonster __P((int));
void cancelmonster __P((void));
void catchalarm __P((int));
void catchalarm __P((int)) __attribute__((__noreturn__));
void changestats __P((bool));
void checkbattle __P((void));
void checktampered __P((void));
void cleanup __P((int));
void collecttaxes __P((double, double));
void cursedtreasure __P((void));
void death __P((char *));
void death __P((const char *));
void displaystats __P((void));
double distance __P((double, double, double, double));
void dotampered __P((void));
double drandom __P((void));
void encounter __P((int));
void enterscore __P((void));
void error __P((char *));
void error __P((const char *));
double explevel __P((double));
long findname __P((char *, struct player *));
long findname __P((const char *, struct player *));
void freerecord __P((struct player *, long));
void genchar __P((int));
int getanswer __P((char *, bool));
int getanswer __P((const char *, bool));
void getstring __P((char *, int));
void hitmonster __P((double));
void ill_sig __P((int));
@@ -116,7 +116,6 @@ void purgeoldplayers __P((void));
void readmessage __P((void));
void readrecord __P((struct player *, long));
long recallplayer __P((void));
long recallplayer __P((void));
long rollnewplayer __P((void));
void scorelist __P((void));
void scramblestats __P((void));

View File

@@ -1,4 +1,4 @@
/* $NetBSD: phantstruct.h,v 1.2 1995/03/24 04:00:11 cgd Exp $ */
/* $NetBSD: phantstruct.h,v 1.3 1999/09/08 21:17:55 jsm Exp $ */
/*
* phantstruct.h - structure definitions for Phantasia
@@ -121,6 +121,6 @@ struct charstats /* character type statistics */
struct menuitem /* menu item for purchase */
{
char *item; /* menu item name */
const char *item; /* menu item name */
double cost; /* cost of item */
};