switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions

View File

@@ -7,20 +7,18 @@
#include "mfndpos.h"
#include "artifact.h"
static void FDECL(watch_on_duty, (struct monst *));
static int FDECL(disturb, (struct monst *));
static void FDECL(release_hero, (struct monst *));
static void FDECL(distfleeck, (struct monst *, int *, int *, int *));
static int FDECL(m_arrival, (struct monst *));
static boolean FDECL(m_balks_at_approaching, (struct monst *));
static boolean FDECL(stuff_prevents_passage, (struct monst *));
static int FDECL(vamp_shift, (struct monst *, struct permonst *,
BOOLEAN_P));
static void watch_on_duty(struct monst *);
static int disturb(struct monst *);
static void release_hero(struct monst *);
static void distfleeck(struct monst *, int *, int *, int *);
static int m_arrival(struct monst *);
static boolean m_balks_at_approaching(struct monst *);
static boolean stuff_prevents_passage(struct monst *);
static int vamp_shift(struct monst *, struct permonst *, boolean);
/* True if mtmp died */
boolean
mb_trapped(mtmp)
struct monst *mtmp;
mb_trapped(struct monst* mtmp)
{
if (flags.verbose) {
if (cansee(mtmp->mx, mtmp->my) && !Unaware)
@@ -43,9 +41,9 @@ struct monst *mtmp;
/* check whether a monster is carrying a locking/unlocking tool */
boolean
monhaskey(mon, for_unlocking)
struct monst *mon;
boolean for_unlocking; /* true => credit card ok, false => not ok */
monhaskey(
struct monst *mon,
boolean for_unlocking) /* true => credit card ok, false => not ok */
{
if (for_unlocking && m_carrying(mon, CREDIT_CARD))
return TRUE;
@@ -53,9 +51,7 @@ boolean for_unlocking; /* true => credit card ok, false => not ok */
}
void
mon_yells(mon, shout)
struct monst *mon;
const char *shout;
mon_yells(struct monst* mon, const char* shout)
{
if (Deaf) {
if (canspotmon(mon))
@@ -78,8 +74,7 @@ const char *shout;
}
static void
watch_on_duty(mtmp)
register struct monst *mtmp;
watch_on_duty(register struct monst* mtmp)
{
int x, y;
@@ -106,8 +101,7 @@ register struct monst *mtmp;
}
int
dochugw(mtmp)
register struct monst *mtmp;
dochugw(register struct monst* mtmp)
{
int x = mtmp->mx, y = mtmp->my;
boolean already_saw_mon = !g.occupation ? 0 : canspotmon(mtmp);
@@ -133,9 +127,7 @@ register struct monst *mtmp;
}
boolean
onscary(x, y, mtmp)
int x, y;
struct monst *mtmp;
onscary(int x, int y, struct monst* mtmp)
{
/* creatures who are directly resistant to magical scaring:
* humans aren't monsters
@@ -188,9 +180,7 @@ struct monst *mtmp;
/* regenerate lost hit points */
void
mon_regen(mon, digest_meal)
struct monst *mon;
boolean digest_meal;
mon_regen(struct monst* mon, boolean digest_meal)
{
if (mon->mhp < mon->mhpmax && (g.moves % 20 == 0 || regenerates(mon->data)))
mon->mhp++;
@@ -210,8 +200,7 @@ boolean digest_meal;
* jolted awake.
*/
static int
disturb(mtmp)
register struct monst *mtmp;
disturb(register struct monst* mtmp)
{
/*
* + Ettins are hard to surprise.
@@ -245,8 +234,7 @@ register struct monst *mtmp;
/* ungrab/expel held/swallowed hero */
static void
release_hero(mon)
struct monst *mon;
release_hero(struct monst* mon)
{
if (mon == u.ustuck) {
if (u.uswallow) {
@@ -259,8 +247,7 @@ struct monst *mon;
}
struct monst *
find_pmmonst(pm)
int pm;
find_pmmonst(int pm)
{
struct monst *mtmp = 0;
@@ -279,9 +266,7 @@ int pm;
will eat it if there is no queen bee on the level; return 1: mon died,
0: mon ate jelly and lived; -1: mon didn't eat jelly to use its move */
int
bee_eat_jelly(mon, obj)
struct monst *mon;
struct obj *obj;
bee_eat_jelly(struct monst* mon, struct obj* obj)
{
int m_delay;
struct monst *mtmp = find_pmmonst(PM_QUEEN_BEE);
@@ -319,11 +304,11 @@ struct obj *obj;
* if first, only adds fleetime if monster isn't already fleeing
* if fleemsg, prints a message about new flight, otherwise, caller should */
void
monflee(mtmp, fleetime, first, fleemsg)
struct monst *mtmp;
int fleetime;
boolean first;
boolean fleemsg;
monflee(
struct monst *mtmp,
int fleetime,
boolean first,
boolean fleemsg)
{
/* shouldn't happen; maybe warrants impossible()? */
if (DEADMONSTER(mtmp))
@@ -367,9 +352,7 @@ boolean fleemsg;
}
static void
distfleeck(mtmp, inrange, nearby, scared)
register struct monst *mtmp;
int *inrange, *nearby, *scared;
distfleeck(register struct monst* mtmp, int* inrange, int* nearby, int* scared)
{
int seescaryx, seescaryy;
boolean sawscary = FALSE, bravegremlin = (rn2(5) == 0);
@@ -408,8 +391,7 @@ int *inrange, *nearby, *scared;
/* perform a special one-time action for a monster; returns -1 if nothing
special happened, 0 if monster uses up its turn, 1 if monster is killed */
static int
m_arrival(mon)
struct monst *mon;
m_arrival(struct monst* mon)
{
mon->mstrategy &= ~STRAT_ARRIVE; /* always reset */
@@ -421,8 +403,7 @@ struct monst *mon;
* code. --KAA
*/
int
dochug(mtmp)
register struct monst *mtmp;
dochug(register struct monst* mtmp)
{
register struct permonst *mdat;
register int tmp = 0;
@@ -762,8 +743,7 @@ static NEARDATA const char boulder_class[] = { ROCK_CLASS, 0 };
static NEARDATA const char gem_class[] = { GEM_CLASS, 0 };
boolean
itsstuck(mtmp)
register struct monst *mtmp;
itsstuck(register struct monst* mtmp)
{
if (sticks(g.youmonst.data) && mtmp == u.ustuck && !u.uswallow) {
pline("%s cannot escape from you!", Monnam(mtmp));
@@ -780,12 +760,13 @@ register struct monst *mtmp;
* those should be used instead. This function does that evaluation.
*/
boolean
should_displace(mtmp, poss, info, cnt, gx, gy)
struct monst *mtmp;
coord *poss; /* coord poss[9] */
long *info; /* long info[9] */
int cnt;
xchar gx, gy;
should_displace(
struct monst *mtmp,
coord *poss, /* coord poss[9] */
long *info, /* long info[9] */
int cnt,
xchar gx,
xchar gy)
{
int shortest_with_displacing = -1;
int shortest_without_displacing = -1;
@@ -817,9 +798,7 @@ xchar gx, gy;
}
boolean
m_digweapon_check(mtmp, nix, niy)
struct monst *mtmp;
xchar nix,niy;
m_digweapon_check(struct monst* mtmp, xchar nix, xchar niy)
{
boolean can_tunnel = 0;
struct obj *mw_tmp = MON_WEP(mtmp);
@@ -850,8 +829,7 @@ xchar nix,niy;
/* does monster want to avoid you? */
static boolean
m_balks_at_approaching(mtmp)
struct monst *mtmp;
m_balks_at_approaching(struct monst* mtmp)
{
/* peaceful, far away, or can't see you */
if (mtmp->mpeaceful
@@ -885,9 +863,7 @@ struct monst *mtmp;
* 3: did not move, and can't do anything else either.
*/
int
m_move(mtmp, after)
register struct monst *mtmp;
register int after;
m_move(register struct monst* mtmp, register int after)
{
int appr, etmp;
xchar gx, gy, nix, niy, chcnt;
@@ -1601,9 +1577,7 @@ register int after;
* (mtmp died) or 3 (mtmp made its move).
*/
int
m_move_aggress(mtmp, x, y)
struct monst * mtmp;
xchar x, y;
m_move_aggress(struct monst* mtmp, xchar x, xchar y)
{
struct monst *mtmp2;
int mstatus;
@@ -1629,8 +1603,7 @@ xchar x, y;
}
void
dissolve_bars(x, y)
register int x, y;
dissolve_bars(register int x, register int y)
{
levl[x][y].typ = (Is_special(&u.uz) || *in_rooms(x, y, 0)) ? ROOM : CORR;
levl[x][y].flags = 0;
@@ -1640,16 +1613,14 @@ register int x, y;
}
boolean
closed_door(x, y)
register int x, y;
closed_door(register int x, register int y)
{
return (boolean) (IS_DOOR(levl[x][y].typ)
&& (levl[x][y].doormask & (D_LOCKED | D_CLOSED)));
}
boolean
accessible(x, y)
register int x, y;
accessible(register int x, register int y)
{
int levtyp = levl[x][y].typ;
@@ -1662,8 +1633,7 @@ register int x, y;
/* decide where the monster thinks you are standing */
void
set_apparxy(mtmp)
register struct monst *mtmp;
set_apparxy(register struct monst* mtmp)
{
boolean notseen, notthere, gotu;
int disp, mx = mtmp->mux, my = mtmp->muy;
@@ -1737,9 +1707,10 @@ register struct monst *mtmp;
* location however.
*/
boolean
undesirable_disp(mtmp, x, y)
struct monst *mtmp; /* barging creature */
xchar x, y; /* spot 'mtmp' is considering moving to */
undesirable_disp(
struct monst *mtmp, /* barging creature */
xchar x,
xchar y) /* spot 'mtmp' is considering moving to */
{
boolean is_pet = (mtmp && mtmp->mtame && !mtmp->isminion);
struct trap *trap = t_at(x, y);
@@ -1778,8 +1749,7 @@ xchar x, y; /* spot 'mtmp' is considering moving to */
* Used by can_ooze() and can_fog().
*/
static boolean
stuff_prevents_passage(mtmp)
struct monst *mtmp;
stuff_prevents_passage(struct monst* mtmp)
{
struct obj *chain, *obj;
@@ -1816,8 +1786,7 @@ struct monst *mtmp;
}
boolean
can_ooze(mtmp)
struct monst *mtmp;
can_ooze(struct monst* mtmp)
{
if (!amorphous(mtmp->data) || stuff_prevents_passage(mtmp))
return FALSE;
@@ -1826,8 +1795,7 @@ struct monst *mtmp;
/* monster can change form into a fog if necessary */
boolean
can_fog(mtmp)
struct monst *mtmp;
can_fog(struct monst* mtmp)
{
if (!(g.mvitals[PM_FOG_CLOUD].mvflags & G_GENOD) && is_vampshifter(mtmp)
&& !Protection_from_shape_changers && !stuff_prevents_passage(mtmp))
@@ -1836,10 +1804,10 @@ struct monst *mtmp;
}
static int
vamp_shift(mon, ptr, domsg)
struct monst *mon;
struct permonst *ptr;
boolean domsg;
vamp_shift(
struct monst *mon,
struct permonst *ptr,
boolean domsg)
{
int reslt = 0;
char oldmtype[BUFSZ];