1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Ansify the bulk of phantasia. No binary change on amd64. Based

on an older diff by mestre.

ok mestre@
This commit is contained in:
tb 2016-01-06 09:39:51 +00:00
parent d973fa72ce
commit f0d3161e56
6 changed files with 69 additions and 116 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fight.c,v 1.11 2014/07/12 03:41:04 deraadt Exp $ */
/* $OpenBSD: fight.c,v 1.12 2016/01/06 09:39:51 tb Exp $ */
/* $NetBSD: fight.c,v 1.2 1995/03/24 03:58:39 cgd Exp $ */
/*
@ -38,8 +38,7 @@
*************************************************************************/
void
encounter(particular)
int particular;
encounter(int particular)
{
int flockcnt = 1; /* how many time flocked */
volatile bool firsthit = Player.p_blessing; /* set if player gets
@ -207,7 +206,7 @@ encounter(particular)
*************************************************************************/
int
pickmonster()
pickmonster(void)
{
if (Player.p_specialtype == SC_VALAR)
/* even chance of any monster */
@ -264,7 +263,7 @@ pickmonster()
*************************************************************************/
void
playerhits()
playerhits(void)
{
double inflict; /* damage inflicted */
int ch; /* input */
@ -435,7 +434,7 @@ playerhits()
*************************************************************************/
void
monsthits()
monsthits(void)
{
double inflict; /* damage inflicted */
int ch; /* input */
@ -709,7 +708,7 @@ SPECIALHIT:
*************************************************************************/
void
cancelmonster()
cancelmonster(void)
{
Curmonster.m_energy = 0.0;
Curmonster.m_experience = 0.0;
@ -743,8 +742,7 @@ cancelmonster()
*************************************************************************/
void
hitmonster(inflict)
double inflict;
hitmonster(double inflict)
{
mvprintw(Lines++, 0, "You hit %s %.0f times!", Enemyname, inflict);
Curmonster.m_energy -= inflict;
@ -797,7 +795,7 @@ hitmonster(inflict)
*************************************************************************/
void
throwspell()
throwspell(void)
{
double inflict; /* damage inflicted */
double dtemp; /* for dtemporary calculations */
@ -1028,8 +1026,7 @@ throwspell()
*************************************************************************/
void
callmonster(which)
int which;
callmonster(int which)
{
struct monster Othermonster; /* to find a name for mimics */
@ -1136,7 +1133,7 @@ callmonster(which)
*************************************************************************/
void
awardtreasure()
awardtreasure(void)
{
int whichtreasure; /* calculated treasure to grant */
int temp; /* temporary */
@ -1573,7 +1570,7 @@ awardtreasure()
*************************************************************************/
void
cursedtreasure()
cursedtreasure(void)
{
if (Player.p_charms > 0) {
addstr("But your charm saved you!\n");
@ -1613,7 +1610,7 @@ cursedtreasure()
*************************************************************************/
void
scramblestats()
scramblestats(void)
{
double dbuf[6]; /* to put statistic in */
double dtemp1, dtemp2; /* for swapping values */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gamesupport.c,v 1.7 2010/12/15 06:40:39 tedu Exp $ */
/* $OpenBSD: gamesupport.c,v 1.8 2016/01/06 09:39:51 tb Exp $ */
/* $NetBSD: gamesupport.c,v 1.3 1995/04/24 12:24:28 cgd Exp $ */
/*
@ -54,8 +54,7 @@
*************************************************************************/
void
changestats(ingameflag)
bool ingameflag;
changestats(bool ingameflag)
{
static char flag[2] = /* for printing values of bools */
{'F', 'T'};
@ -198,7 +197,6 @@ changestats(ingameflag)
return;
} else
cleanup(TRUE);
/* NOTREACHED */
}
mvaddstr(20, 0, "!:Quit ?:Delete");
mvaddstr(21, 0, "What would you like to change ? ");
@ -509,7 +507,7 @@ BALTER:
*************************************************************************/
void
monstlist()
monstlist(void)
{
int count = 0; /* count in file */
@ -546,7 +544,7 @@ monstlist()
*************************************************************************/
void
scorelist()
scorelist(void)
{
struct scoreboard sbuf; /* for reading entries */
FILE *fp; /* to open the file */
@ -583,7 +581,7 @@ scorelist()
*************************************************************************/
void
activelist()
activelist(void)
{
fseek(Playersfp, 0L, SEEK_SET);
printf("Current characters on file are:\n\n");
@ -621,7 +619,7 @@ activelist()
*************************************************************************/
void
purgeoldplayers()
purgeoldplayers(void)
{
int today; /* day of year for today */
int daysold; /* how many days since the character has been
@ -678,7 +676,7 @@ purgeoldplayers()
*************************************************************************/
void
enterscore()
enterscore(void)
{
struct scoreboard sbuf; /* buffer to read in scoreboard entries */
FILE *fp; /* to open scoreboard file */
@ -694,7 +692,6 @@ enterscore()
loc += SZ_SCORESTRUCT;
} else {
error(_PATH_SCORE);
/* NOTREACHED */
}
/*

View File

@ -1,4 +1,4 @@
/* $OpenBSD: interplayer.c,v 1.6 2014/07/12 03:41:04 deraadt Exp $ */
/* $OpenBSD: interplayer.c,v 1.7 2016/01/06 09:39:51 tb Exp $ */
/* $NetBSD: interplayer.c,v 1.2 1995/03/24 03:58:47 cgd Exp $ */
/*
@ -33,7 +33,7 @@
*************************************************************************/
void
checkbattle()
checkbattle(void)
{
long foeloc = 0L; /* location in file of person to fight */
@ -110,8 +110,7 @@ checkbattle()
*************************************************************************/
void
battleplayer(foeplace)
long foeplace;
battleplayer(long foeplace)
{
double dtemp; /* for temporary calculations */
double oldhits = 0.0; /* previous damage inflicted by foe */
@ -357,7 +356,7 @@ LEAVE:
*************************************************************************/
void
myturn()
myturn(void)
{
double dtemp; /* for temporary calculations */
int ch; /* input */
@ -459,7 +458,7 @@ HIT:
*************************************************************************/
void
checktampered()
checktampered(void)
{
long loc = 0L; /* location in energy void file */
@ -520,10 +519,7 @@ checktampered()
*************************************************************************/
void
tampered(what, arg1, arg2)
int what;
double arg1;
double arg2;
tampered(int what, double arg1, double arg2)
{
long loc; /* location in file of other players */
@ -704,8 +700,7 @@ tampered(what, arg1, arg2)
*************************************************************************/
void
userlist(ingameflag)
bool ingameflag;
userlist(bool ingameflag)
{
int numusers = 0; /* number of users on file */
@ -795,7 +790,7 @@ userlist(ingameflag)
*************************************************************************/
void
throneroom()
throneroom(void)
{
FILE *fp; /* to clear energy voids */
long loc = 0L; /* location of old king in player file */
@ -876,7 +871,7 @@ throneroom()
*************************************************************************/
void
dotampered()
dotampered(void)
{
short tamper; /* value for tampering with other players */
char *option; /* pointer to option description */
@ -1108,9 +1103,7 @@ dotampered()
*************************************************************************/
void
writevoid(vp, loc)
struct energyvoid *vp;
long loc;
writevoid(struct energyvoid *vp, long loc)
{
fseek(Energyvoidfp, loc, SEEK_SET);
@ -1145,7 +1138,7 @@ writevoid(vp, loc)
*************************************************************************/
long
allocvoid()
allocvoid(void)
{
long loc = 0L; /* location of new energy void */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: io.c,v 1.6 2014/07/12 03:41:04 deraadt Exp $ */
/* $OpenBSD: io.c,v 1.7 2016/01/06 09:39:51 tb Exp $ */
/* $NetBSD: io.c,v 1.2 1995/03/24 03:58:50 cgd Exp $ */
/*
@ -43,9 +43,7 @@
*************************************************************************/
void
getstring(cp, mx)
char *cp;
int mx;
getstring(char *cp, int mx)
{
char *inptr; /* pointer into string for next string */
int x, y; /* original x, y coordinates on screen */
@ -119,8 +117,7 @@ getstring(cp, mx)
*************************************************************************/
void
more(where)
int where;
more(int where)
{
mvaddstr(where, 0, "-- more --");
getanswer(" ", FALSE);
@ -152,7 +149,7 @@ more(where)
*************************************************************************/
double
infloat()
infloat(void)
{
double result; /* return value */
@ -190,7 +187,7 @@ infloat()
*************************************************************************/
int
inputoption()
inputoption(void)
{
++Player.p_age; /* increase age */
@ -233,7 +230,7 @@ inputoption()
*************************************************************************/
void
interrupt()
interrupt(void)
{
char line[81]; /* a place to store data already on screen */
int loop; /* counter */
@ -307,9 +304,7 @@ interrupt()
*************************************************************************/
int
getanswer(choices, def)
char *choices;
bool def;
getanswer(char *choices, bool def)
{
int ch; /* input */
volatile int loop; /* counter */
@ -407,8 +402,7 @@ getanswer(choices, def)
*************************************************************************/
void
catchalarm(dummy)
int dummy;
catchalarm(int dummy)
{
longjmp(Timeoenv, 1);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.17 2014/11/16 04:49:48 guenther Exp $ */
/* $OpenBSD: main.c,v 1.18 2016/01/06 09:39:51 tb Exp $ */
/* $NetBSD: main.c,v 1.3 1995/04/24 12:24:37 cgd Exp $ */
/*
@ -95,9 +95,7 @@
****************************************************************************/
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
bool noheader = FALSE; /* set if don't want header */
bool headeronly = FALSE; /* set if only want header */
@ -313,7 +311,7 @@ main(argc, argv)
*************************************************************************/
void
initialstate()
initialstate(void)
{
#ifdef TERMIOS
struct termios tty;
@ -398,7 +396,7 @@ initialstate()
*************************************************************************/
long
rollnewplayer()
rollnewplayer(void)
{
int chartype; /* character type */
int ch; /* input */
@ -515,7 +513,7 @@ rollnewplayer()
*************************************************************************/
void
procmain()
procmain(void)
{
int ch; /* input */
double x; /* desired new x coordinate */
@ -749,7 +747,7 @@ procmain()
*************************************************************************/
void
titlelist()
titlelist(void)
{
FILE *fp; /* used for opening various files */
bool councilfound = FALSE; /* set if we find a member of the
@ -883,7 +881,7 @@ titlelist()
*************************************************************************/
long
recallplayer()
recallplayer(void)
{
long loc = 0L; /* location in player file */
int loop; /* loop counter */
@ -966,7 +964,7 @@ recallplayer()
*************************************************************************/
void
neatstuff()
neatstuff(void)
{
double temp; /* for temporary calculations */
int ch; /* input */
@ -1090,8 +1088,7 @@ neatstuff()
*************************************************************************/
void
genchar(type)
int type;
genchar(int type)
{
int subscript; /* used for subscripting into Stattable */
struct charstats *statptr; /* for pointing into Stattable */
@ -1188,8 +1185,7 @@ playinit()
*************************************************************************/
void
cleanup(doexit)
int doexit;
cleanup(int doexit)
{
if (Windows) {
move(LINES - 2, 0);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.17 2015/12/26 00:26:39 mestre Exp $ */
/* $OpenBSD: misc.c,v 1.18 2016/01/06 09:39:51 tb Exp $ */
/* $NetBSD: misc.c,v 1.2 1995/03/24 03:59:03 cgd Exp $ */
/*
@ -115,10 +115,8 @@ movelevel()
/
*************************************************************************/
char *
descrlocation(playerp, shortflag)
struct player *playerp;
bool shortflag;
char *
descrlocation(struct player *playerp, bool shortflag)
{
double circle; /* corresponding circle for coordinates */
int quadrant; /* quandrant of grid */
@ -582,10 +580,8 @@ allstatslist()
/
*************************************************************************/
char *
descrtype(playerp, shortflag)
struct player *playerp;
bool shortflag;
char *
descrtype(struct player *playerp, bool shortflag)
{
int type; /* for caluculating result subscript */
static char *results[] =/* description table */
@ -673,9 +669,7 @@ descrtype(playerp, shortflag)
*************************************************************************/
long
findname(name, playerp)
char *name;
struct player *playerp;
findname(char *name, struct player *playerp)
{
long loc = 0; /* location in the file */
@ -764,9 +758,7 @@ allocrecord()
*************************************************************************/
void
freerecord(playerp, loc)
struct player *playerp;
long loc;
freerecord(struct player *playerp, long loc)
{
playerp->p_name[0] = CH_MARKDELETE;
playerp->p_status = S_NOTUSED;
@ -845,8 +837,7 @@ leavegame()
*************************************************************************/
void
death(how)
char *how;
death(char *how)
{
FILE *fp; /* for updating various files */
int ch; /* input */
@ -968,9 +959,7 @@ death(how)
*************************************************************************/
void
writerecord(playerp, place)
struct player *playerp;
long place;
writerecord(struct player *playerp, long place)
{
fseek(Playersfp, place, SEEK_SET);
fwrite(playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
@ -1003,8 +992,7 @@ writerecord(playerp, place)
*************************************************************************/
double
explevel(experience)
double experience;
explevel(double experience)
{
if (experience < 1.1e7)
return (floor(pow((experience / 1000.0), 0.4875)));
@ -1037,8 +1025,7 @@ explevel(experience)
*************************************************************************/
void
truncstring(string)
char *string;
truncstring(char *string)
{
int length; /* length of string */
@ -1075,10 +1062,7 @@ truncstring(string)
*************************************************************************/
void
altercoordinates(xnew, ynew, operation)
double xnew;
double ynew;
int operation;
altercoordinates(double xnew, double ynew, int operation)
{
switch (operation) {
case A_FORCED: /* move with no checks */
@ -1151,9 +1135,7 @@ altercoordinates(xnew, ynew, operation)
*************************************************************************/
void
readrecord(playerp, loc)
struct player *playerp;
long loc;
readrecord(struct player *playerp, long loc)
{
fseek(Playersfp, loc, SEEK_SET);
fread(playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
@ -1183,7 +1165,7 @@ readrecord(playerp, loc)
*************************************************************************/
void
adjuststats()
adjuststats(void)
{
double dtemp; /* for temporary calculations */
@ -1298,8 +1280,7 @@ adjuststats()
*************************************************************************/
void
initplayer(playerp)
struct player *playerp;
initplayer(struct player *playerp)
{
playerp->p_experience =
playerp->p_level =
@ -1381,7 +1362,7 @@ initplayer(playerp)
*************************************************************************/
void
readmessage()
readmessage(void)
{
move(3, 0);
clrtoeol();
@ -1415,8 +1396,7 @@ readmessage()
*************************************************************************/
__dead void
error(whichfile)
char *whichfile;
error(char *whichfile)
{
if (Windows)
@ -1456,8 +1436,7 @@ error(whichfile)
*************************************************************************/
double
distance(x1, x2, y1, y2)
double x1, x2, y1, y2;
distance(double x1, double x2, double y1, double y2)
{
double deltax, deltay;
@ -1491,8 +1470,7 @@ distance(x1, x2, y1, y2)
*************************************************************************/
char *
descrstatus(playerp)
struct player *playerp;
descrstatus(struct player *playerp)
{
switch (playerp->p_status) {
case S_PLAYING:
@ -1551,7 +1529,7 @@ descrstatus(playerp)
*************************************************************************/
double
drandom()
drandom(void)
{
return ((double) arc4random() / (UINT32_MAX + 1.0));
}
@ -1585,9 +1563,7 @@ drandom()
*************************************************************************/
void
collecttaxes(gold, gems)
double gold;
double gems;
collecttaxes(double gold, double gems)
{
FILE *fp; /* to update Goldfile */
double dtemp; /* for temporary calculations */