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

@@ -5,53 +5,51 @@
#include "hack.h"
static int FDECL(use_camera, (struct obj *));
static int FDECL(use_towel, (struct obj *));
static boolean FDECL(its_dead, (int, int, int *));
static int FDECL(use_stethoscope, (struct obj *));
static void FDECL(use_whistle, (struct obj *));
static void FDECL(use_magic_whistle, (struct obj *));
static int FDECL(use_leash, (struct obj *));
static int FDECL(use_mirror, (struct obj *));
static void FDECL(use_bell, (struct obj **));
static void FDECL(use_candelabrum, (struct obj *));
static void FDECL(use_candle, (struct obj **));
static void FDECL(use_lamp, (struct obj *));
static void FDECL(light_cocktail, (struct obj **));
static int FDECL(rub_ok, (struct obj *));
static void FDECL(display_jump_positions, (int));
static void FDECL(use_tinning_kit, (struct obj *));
static void FDECL(use_figurine, (struct obj **));
static int FDECL(grease_ok, (struct obj *));
static void FDECL(use_grease, (struct obj *));
static void FDECL(use_trap, (struct obj *));
static int FDECL(touchstone_ok, (struct obj *));
static void FDECL(use_stone, (struct obj *));
static int NDECL(set_trap); /* occupation callback */
static int FDECL(use_whip, (struct obj *));
static void FDECL(display_polearm_positions, (int));
static int FDECL(use_pole, (struct obj *));
static int FDECL(use_cream_pie, (struct obj *));
static int FDECL(jelly_ok, (struct obj *));
static int FDECL(use_royal_jelly, (struct obj *));
static int FDECL(use_grapple, (struct obj *));
static int FDECL(do_break_wand, (struct obj *));
static int FDECL(apply_ok, (struct obj *));
static int FDECL(flip_through_book, (struct obj *));
static boolean FDECL(figurine_location_checks, (struct obj *,
coord *, BOOLEAN_P));
static boolean FDECL(check_jump, (genericptr_t, int, int));
static boolean FDECL(is_valid_jump_pos, (int, int, int, BOOLEAN_P));
static boolean FDECL(get_valid_jump_position, (int, int));
static boolean FDECL(get_valid_polearm_position, (int, int));
static boolean FDECL(find_poleable_mon, (coord *, int, int));
static int use_camera(struct obj *);
static int use_towel(struct obj *);
static boolean its_dead(int, int, int *);
static int use_stethoscope(struct obj *);
static void use_whistle(struct obj *);
static void use_magic_whistle(struct obj *);
static int use_leash(struct obj *);
static int use_mirror(struct obj *);
static void use_bell(struct obj **);
static void use_candelabrum(struct obj *);
static void use_candle(struct obj **);
static void use_lamp(struct obj *);
static void light_cocktail(struct obj **);
static int rub_ok(struct obj *);
static void display_jump_positions(int);
static void use_tinning_kit(struct obj *);
static void use_figurine(struct obj **);
static int grease_ok(struct obj *);
static void use_grease(struct obj *);
static void use_trap(struct obj *);
static int touchstone_ok(struct obj *);
static void use_stone(struct obj *);
static int set_trap(void); /* occupation callback */
static int use_whip(struct obj *);
static void display_polearm_positions(int);
static int use_pole(struct obj *);
static int use_cream_pie(struct obj *);
static int jelly_ok(struct obj *);
static int use_royal_jelly(struct obj *);
static int use_grapple(struct obj *);
static int do_break_wand(struct obj *);
static int apply_ok(struct obj *);
static int flip_through_book(struct obj *);
static boolean figurine_location_checks(struct obj *, coord *, boolean);
static boolean check_jump(genericptr_t, int, int);
static boolean is_valid_jump_pos(int, int, int, boolean);
static boolean get_valid_jump_position(int, int);
static boolean get_valid_polearm_position(int, int);
static boolean find_poleable_mon(coord *, int, int);
static const char no_elbow_room[] =
"don't have enough elbow-room to maneuver.";
static int
use_camera(obj)
struct obj *obj;
use_camera(struct obj *obj)
{
struct monst *mtmp;
@@ -80,8 +78,8 @@ struct obj *obj;
(void) zapyourself(obj, TRUE);
} else {
mtmp = bhit(u.dx, u.dy, COLNO, FLASHED_LIGHT,
(int FDECL((*), (MONST_P, OBJ_P))) 0,
(int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj);
(int (*) (MONST_P, OBJ_P)) 0,
(int (*) (OBJ_P, OBJ_P)) 0, &obj);
obj->ox = u.ux, obj->oy = u.uy; /* flash_hits_mon() wants this */
if (mtmp)
(void) flash_hits_mon(mtmp, obj);
@@ -93,8 +91,7 @@ struct obj *obj;
}
static int
use_towel(obj)
struct obj *obj;
use_towel(struct obj *obj)
{
boolean drying_feedback = (obj == uwep);
@@ -180,8 +177,7 @@ struct obj *obj;
/* maybe give a stethoscope message based on floor objects */
static boolean
its_dead(rx, ry, resp)
int rx, ry, *resp;
its_dead(int rx, int ry, int *resp)
{
char buf[BUFSZ];
boolean more_corpses;
@@ -302,8 +298,7 @@ static const char hollow_str[] = "a hollow sound. This must be a secret %s!";
almost useless. As a compromise, one use per turn is free, another
uses up the turn; this makes curse status have a tangible effect. */
static int
use_stethoscope(obj)
register struct obj *obj;
use_stethoscope(struct obj *obj)
{
struct monst *mtmp;
struct rm *lev;
@@ -457,8 +452,7 @@ static const char whistle_str[] = "produce a %s whistling sound.",
alt_whistle_str[] = "produce a %s, sharp vibration.";
static void
use_whistle(obj)
struct obj *obj;
use_whistle(struct obj *obj)
{
if (!can_blow(&g.youmonst)) {
You("are incapable of using the whistle.");
@@ -476,8 +470,7 @@ struct obj *obj;
}
static void
use_magic_whistle(obj)
struct obj *obj;
use_magic_whistle(struct obj *obj)
{
register struct monst *mtmp, *nextmon;
@@ -530,14 +523,13 @@ struct obj *obj;
}
boolean
um_dist(x, y, n)
xchar x, y, n;
um_dist(xchar x, xchar y, xchar n)
{
return (boolean) (abs(u.ux - x) > n || abs(u.uy - y) > n);
}
int
number_leashed()
number_leashed(void)
{
int i = 0;
struct obj *obj;
@@ -550,8 +542,7 @@ number_leashed()
/* otmp is about to be destroyed or stolen */
void
o_unleash(otmp)
struct obj *otmp;
o_unleash(struct obj *otmp)
{
register struct monst *mtmp;
@@ -566,9 +557,7 @@ struct obj *otmp;
/* mtmp is about to die, or become untame */
void
m_unleash(mtmp, feedback)
struct monst *mtmp;
boolean feedback;
m_unleash(struct monst *mtmp, boolean feedback)
{
register struct obj *otmp;
@@ -589,7 +578,7 @@ boolean feedback;
/* player is about to die (for bones) */
void
unleash_all()
unleash_all(void)
{
register struct obj *otmp;
register struct monst *mtmp;
@@ -604,8 +593,7 @@ unleash_all()
#define MAXLEASHED 2
boolean
leashable(mtmp)
struct monst *mtmp;
leashable(struct monst *mtmp)
{
return (boolean) (mtmp->mnum != PM_LONG_WORM
&& !unsolid(mtmp->data)
@@ -614,8 +602,7 @@ struct monst *mtmp;
/* ARGSUSED */
static int
use_leash(obj)
struct obj *obj;
use_leash(struct obj *obj)
{
coord cc;
struct monst *mtmp;
@@ -717,8 +704,7 @@ struct obj *obj;
/* assuming mtmp->mleashed has been checked */
struct obj *
get_mleash(mtmp)
struct monst *mtmp;
get_mleash(struct monst *mtmp)
{
struct obj *otmp;
@@ -729,7 +715,7 @@ struct monst *mtmp;
}
boolean
next_to_u()
next_to_u(void)
{
register struct monst *mtmp;
register struct obj *otmp;
@@ -762,8 +748,7 @@ next_to_u()
}
void
check_leash(x, y)
register xchar x, y;
check_leash(xchar x, xchar y)
{
register struct obj *otmp;
register struct monst *mtmp;
@@ -833,7 +818,7 @@ register xchar x, y;
/* charisma is supposed to include qualities like leadership and personal
magnetism rather than just appearance, but it has devolved to this... */
const char *
beautiful()
beautiful(void)
{
const char *res;
int cha = ACURR(A_CHA);
@@ -854,8 +839,7 @@ beautiful()
static const char look_str[] = "look %s.";
static int
use_mirror(obj)
struct obj *obj;
use_mirror(struct obj *obj)
{
const char *mirror, *uvisage;
struct monst *mtmp;
@@ -933,8 +917,8 @@ struct obj *obj;
return 1;
}
mtmp = bhit(u.dx, u.dy, COLNO, INVIS_BEAM,
(int FDECL((*), (MONST_P, OBJ_P))) 0,
(int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj);
(int (*) (MONST_P, OBJ_P)) 0,
(int (*) (OBJ_P, OBJ_P)) 0, &obj);
if (!mtmp || !haseyes(mtmp->data) || g.notonhead)
return 1;
@@ -1036,8 +1020,7 @@ struct obj *obj;
}
static void
use_bell(optr)
struct obj **optr;
use_bell(struct obj **optr)
{
register struct obj *obj = *optr;
struct monst *mtmp;
@@ -1153,8 +1136,7 @@ struct obj **optr;
}
static void
use_candelabrum(obj)
register struct obj *obj;
use_candelabrum(struct obj *obj)
{
const char *s = (obj->spe != 1) ? "candles" : "candle";
@@ -1222,8 +1204,7 @@ register struct obj *obj;
}
static void
use_candle(optr)
struct obj **optr;
use_candle(struct obj **optr)
{
register struct obj *obj = *optr;
register struct obj *otmp;
@@ -1303,8 +1284,7 @@ struct obj **optr;
/* call in drop, throw, and put in box, etc. */
boolean
snuff_candle(otmp)
struct obj *otmp;
snuff_candle(struct obj *otmp)
{
boolean candle = Is_candle(otmp);
@@ -1329,8 +1309,7 @@ struct obj *otmp;
you've been swallowed by a monster; obj might be in transit while
being thrown or dropped so don't assume that its location is valid */
boolean
snuff_lit(obj)
struct obj *obj;
snuff_lit(struct obj *obj)
{
xchar x, y;
@@ -1351,8 +1330,7 @@ struct obj *obj;
/* called when lit object is hit by water */
boolean
splash_lit(obj)
struct obj *obj;
splash_lit(struct obj *obj)
{
boolean result, dunk = FALSE;
@@ -1409,8 +1387,7 @@ struct obj *obj;
/* Called when potentially lightable object is affected by fire_damage().
Return TRUE if object becomes lit and FALSE otherwise --ALI */
boolean
catch_lit(obj)
struct obj *obj;
catch_lit(struct obj *obj)
{
xchar x, y;
@@ -1453,8 +1430,7 @@ struct obj *obj;
}
static void
use_lamp(obj)
struct obj *obj;
use_lamp(struct obj *obj)
{
char buf[BUFSZ];
@@ -1506,8 +1482,7 @@ struct obj *obj;
}
static void
light_cocktail(optr)
struct obj **optr;
light_cocktail(struct obj **optr)
{
struct obj *obj = *optr; /* obj is a potion of oil */
char buf[BUFSZ];
@@ -1566,8 +1541,7 @@ struct obj **optr;
/* getobj callback for object to be rubbed - not selecting a secondary object to
* rub on a gray stone or rub jelly on */
static int
rub_ok(obj)
struct obj *obj;
rub_ok(struct obj *obj)
{
if (!obj)
return GETOBJ_EXCLUDE;
@@ -1581,7 +1555,7 @@ struct obj *obj;
}
int
dorub()
dorub(void)
{
struct obj *obj;
@@ -1639,7 +1613,7 @@ dorub()
}
int
dojump()
dojump(void)
{
/* Physical jump */
return jump(0);
@@ -1654,9 +1628,7 @@ enum jump_trajectory {
/* callback routine for walk_path() */
static boolean
check_jump(arg, x, y)
genericptr arg;
int x, y;
check_jump(genericptr arg, int x, int y)
{
int traj = *(int *) arg;
struct rm *lev = &levl[x][y];
@@ -1687,9 +1659,7 @@ int x, y;
}
static boolean
is_valid_jump_pos(x, y, magic, showmsg)
int x, y, magic;
boolean showmsg;
is_valid_jump_pos(int x, int y, int magic, boolean showmsg)
{
if (!magic && !(HJumping & ~INTRINSIC) && !EJumping && distu(x, y) != 5) {
/* The Knight jumping restriction still applies when riding a
@@ -1755,8 +1725,7 @@ boolean showmsg;
}
static boolean
get_valid_jump_position(x,y)
int x,y;
get_valid_jump_position(int x, int y)
{
return (isok(x, y)
&& (ACCESSIBLE(levl[x][y].typ) || Passes_walls)
@@ -1764,8 +1733,7 @@ int x,y;
}
static void
display_jump_positions(state)
int state;
display_jump_positions(int state)
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
@@ -1785,8 +1753,7 @@ int state;
}
int
jump(magic)
int magic; /* 0=Physical, otherwise skill level */
jump(int magic) /* 0=Physical, otherwise skill level */
{
coord cc;
@@ -1940,8 +1907,7 @@ int magic; /* 0=Physical, otherwise skill level */
}
boolean
tinnable(corpse)
struct obj *corpse;
tinnable(struct obj *corpse)
{
if (corpse->oeaten)
return 0;
@@ -1951,8 +1917,7 @@ struct obj *corpse;
}
static void
use_tinning_kit(obj)
struct obj *obj;
use_tinning_kit(struct obj *obj)
{
struct obj *corpse, *can;
@@ -2023,8 +1988,7 @@ struct obj *obj;
}
void
use_unicorn_horn(optr)
struct obj **optr;
use_unicorn_horn(struct obj **optr)
{
#define PROP_COUNT 7 /* number of properties we're dealing with */
int idx, val, val_limit, trouble_count, unfixable_trbl, did_prop;
@@ -2166,9 +2130,7 @@ struct obj **optr;
* Timer callback routine: turn figurine into monster
*/
void
fig_transform(arg, timeout)
anything *arg;
long timeout;
fig_transform(anything *arg, long timeout)
{
struct obj *figurine = arg->a_obj;
struct monst *mtmp;
@@ -2280,10 +2242,7 @@ long timeout;
}
static boolean
figurine_location_checks(obj, cc, quietly)
struct obj *obj;
coord *cc;
boolean quietly;
figurine_location_checks(struct obj *obj, coord *cc, boolean quietly)
{
xchar x, y;
@@ -2316,8 +2275,7 @@ boolean quietly;
}
static void
use_figurine(optr)
struct obj **optr;
use_figurine(struct obj **optr)
{
register struct obj *obj = *optr;
xchar x, y;
@@ -2357,8 +2315,7 @@ struct obj **optr;
/* getobj callback for object to apply grease to */
static int
grease_ok(obj)
struct obj *obj;
grease_ok(struct obj *obj)
{
if (!obj)
return GETOBJ_SUGGEST;
@@ -2375,8 +2332,7 @@ struct obj *obj;
}
static void
use_grease(obj)
struct obj *obj;
use_grease(struct obj *obj)
{
struct obj *otmp;
@@ -2429,8 +2385,7 @@ struct obj *obj;
/* getobj callback for object to rub on a known touchstone */
static int
touchstone_ok(obj)
struct obj *obj;
touchstone_ok(struct obj *obj)
{
if (!obj)
return GETOBJ_EXCLUDE;
@@ -2452,8 +2407,7 @@ struct obj *obj;
/* touchstones - by Ken Arnold */
static void
use_stone(tstone)
struct obj *tstone;
use_stone(struct obj *tstone)
{
static const char scritch[] = "\"scritch, scritch\"";
struct obj *obj;
@@ -2586,7 +2540,7 @@ struct obj *tstone;
}
void
reset_trapset()
reset_trapset(void)
{
g.trapinfo.tobj = 0;
g.trapinfo.force_bungle = 0;
@@ -2594,8 +2548,7 @@ reset_trapset()
/* Place a landmine/bear trap. Helge Hafting */
static void
use_trap(otmp)
struct obj *otmp;
use_trap(struct obj *otmp)
{
int ttyp, tmp;
const char *what = (char *) 0;
@@ -2690,7 +2643,7 @@ struct obj *otmp;
}
static int
set_trap()
set_trap(void)
{
struct obj *otmp = g.trapinfo.tobj;
struct trap *ttmp;
@@ -2730,8 +2683,7 @@ set_trap()
}
static int
use_whip(obj)
struct obj *obj;
use_whip(struct obj *obj)
{
char buf[BUFSZ];
struct monst *mtmp;
@@ -3012,9 +2964,7 @@ static const char
/* find pos of monster in range, if only one monster */
static boolean
find_poleable_mon(pos, min_range, max_range)
coord *pos;
int min_range, max_range;
find_poleable_mon(coord *pos, int min_range, int max_range)
{
struct monst *mtmp;
coord mpos;
@@ -3052,8 +3002,7 @@ int min_range, max_range;
}
static boolean
get_valid_polearm_position(x, y)
int x, y;
get_valid_polearm_position(int x, int y)
{
int glyph;
@@ -3066,8 +3015,7 @@ int x, y;
}
static void
display_polearm_positions(state)
int state;
display_polearm_positions(int state)
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
@@ -3089,8 +3037,7 @@ int state;
/* Distance attacks by pole-weapons */
static int
use_pole(obj)
struct obj *obj;
use_pole(struct obj *obj)
{
int res = 0, typ, max_range, min_range, glyph;
coord cc;
@@ -3205,8 +3152,7 @@ struct obj *obj;
}
static int
use_cream_pie(obj)
struct obj *obj;
use_cream_pie(struct obj *obj)
{
boolean wasblind = Blind;
boolean wascreamed = u.ucreamed;
@@ -3244,8 +3190,7 @@ struct obj *obj;
/* getobj callback for object to rub royal jelly on */
static int
jelly_ok(obj)
struct obj *obj;
jelly_ok(struct obj *obj)
{
if (obj && obj->otyp == EGG)
return GETOBJ_SUGGEST;
@@ -3254,8 +3199,7 @@ struct obj *obj;
}
static int
use_royal_jelly(obj)
struct obj *obj;
use_royal_jelly(struct obj *obj)
{
int oldcorpsenm;
unsigned was_timed;
@@ -3319,8 +3263,7 @@ struct obj *obj;
}
static int
use_grapple(obj)
struct obj *obj;
use_grapple(struct obj *obj)
{
int res = 0, typ, max_range = 4, tohit;
boolean save_confirm;
@@ -3469,8 +3412,7 @@ struct obj *obj;
/* return 1 if the wand is broken, hence some time elapsed */
static int
do_break_wand(obj)
struct obj *obj;
do_break_wand(struct obj *obj)
{
static const char nothing_else_happens[] = "But nothing else happens...";
register int i, x, y;
@@ -3699,8 +3641,7 @@ discard_broken_wand:
/* getobj callback for object to apply - this is more complex than most other
* callbacks because there are a lot of appliables */
static int
apply_ok(obj)
struct obj *obj;
apply_ok(struct obj *obj)
{
if (!obj)
return GETOBJ_EXCLUDE;
@@ -3747,7 +3688,7 @@ struct obj *obj;
/* the 'a' command */
int
doapply()
doapply(void)
{
struct obj *obj;
register int res = 1;
@@ -3950,8 +3891,7 @@ doapply()
* great.
*/
int
unfixable_trouble_count(is_horn)
boolean is_horn;
unfixable_trouble_count(boolean is_horn)
{
int unfixable_trbl = 0;
@@ -3991,8 +3931,7 @@ boolean is_horn;
}
static int
flip_through_book(obj)
struct obj *obj;
flip_through_book(struct obj *obj)
{
if (Underwater) {
pline("You don't want to get the pages even more soggy, do you?");