switch source tree from k&r to c99
This commit is contained in:
383
src/mon.c
383
src/mon.c
@@ -7,26 +7,26 @@
|
||||
#include "mfndpos.h"
|
||||
#include <ctype.h>
|
||||
|
||||
static void FDECL(sanity_check_single_mon, (struct monst *, BOOLEAN_P,
|
||||
const char *));
|
||||
static boolean FDECL(restrap, (struct monst *));
|
||||
static long FDECL(mm_2way_aggression, (struct monst *, struct monst *));
|
||||
static long FDECL(mm_aggression, (struct monst *, struct monst *));
|
||||
static long FDECL(mm_displacement, (struct monst *, struct monst *));
|
||||
static int NDECL(pick_animal);
|
||||
static void FDECL(kill_eggs, (struct obj *));
|
||||
static int FDECL(pickvampshape, (struct monst *));
|
||||
static boolean FDECL(isspecmon, (struct monst *));
|
||||
static boolean FDECL(validspecmon, (struct monst *, int));
|
||||
static struct permonst *FDECL(accept_newcham_form, (struct monst *, int));
|
||||
static struct obj *FDECL(make_corpse, (struct monst *, unsigned));
|
||||
static int FDECL(minliquid_core, (struct monst *));
|
||||
static void FDECL(m_detach, (struct monst *, struct permonst *));
|
||||
static void FDECL(set_mon_min_mhpmax, (struct monst *, int));
|
||||
static void FDECL(lifesaved_monster, (struct monst *));
|
||||
static void FDECL(migrate_mon, (struct monst *, XCHAR_P, XCHAR_P));
|
||||
static boolean FDECL(ok_to_obliterate, (struct monst *));
|
||||
static void FDECL(deal_with_overcrowding, (struct monst *));
|
||||
static void sanity_check_single_mon(struct monst *, boolean,
|
||||
const char *);
|
||||
static boolean restrap(struct monst *);
|
||||
static long mm_2way_aggression(struct monst *, struct monst *);
|
||||
static long mm_aggression(struct monst *, struct monst *);
|
||||
static long mm_displacement(struct monst *, struct monst *);
|
||||
static int pick_animal(void);
|
||||
static void kill_eggs(struct obj *);
|
||||
static int pickvampshape(struct monst *);
|
||||
static boolean isspecmon(struct monst *);
|
||||
static boolean validspecmon(struct monst *, int);
|
||||
static struct permonst *accept_newcham_form(struct monst *, int);
|
||||
static struct obj *make_corpse(struct monst *, unsigned);
|
||||
static int minliquid_core(struct monst *);
|
||||
static void m_detach(struct monst *, struct permonst *);
|
||||
static void set_mon_min_mhpmax(struct monst *, int);
|
||||
static void lifesaved_monster(struct monst *);
|
||||
static void migrate_mon(struct monst *, xchar, xchar);
|
||||
static boolean ok_to_obliterate(struct monst *);
|
||||
static void deal_with_overcrowding(struct monst *);
|
||||
|
||||
#define LEVEL_SPECIFIC_NOCORPSE(mdat) \
|
||||
(Is_rogue_level(&u.uz) \
|
||||
@@ -41,10 +41,10 @@ const char *warnings[] = {
|
||||
|
||||
|
||||
static void
|
||||
sanity_check_single_mon(mtmp, chk_geno, msg)
|
||||
struct monst *mtmp;
|
||||
boolean chk_geno;
|
||||
const char *msg;
|
||||
sanity_check_single_mon(
|
||||
struct monst *mtmp,
|
||||
boolean chk_geno,
|
||||
const char *msg)
|
||||
{
|
||||
struct permonst *mptr = mtmp->data;
|
||||
int mx = mtmp->mx, my = mtmp->my;
|
||||
@@ -175,7 +175,7 @@ const char *msg;
|
||||
}
|
||||
|
||||
void
|
||||
mon_sanity_check()
|
||||
mon_sanity_check(void)
|
||||
{
|
||||
int x, y;
|
||||
struct monst *mtmp, *m;
|
||||
@@ -234,8 +234,7 @@ mon_sanity_check()
|
||||
/* Does not check for actual poison gas at the location. */
|
||||
/* Returns one of M_POISONGAS_foo */
|
||||
int
|
||||
m_poisongas_ok(mtmp)
|
||||
struct monst *mtmp;
|
||||
m_poisongas_ok(struct monst* mtmp)
|
||||
{
|
||||
int px, py;
|
||||
boolean is_you = (mtmp == &g.youmonst);
|
||||
@@ -268,8 +267,7 @@ struct monst *mtmp;
|
||||
/* Return TRUE if this monster is capable of converting other monsters into
|
||||
* zombies. */
|
||||
boolean
|
||||
zombie_maker(pm)
|
||||
struct permonst *pm;
|
||||
zombie_maker(struct permonst* pm)
|
||||
{
|
||||
switch(pm->mlet) {
|
||||
case S_ZOMBIE:
|
||||
@@ -290,8 +288,7 @@ struct permonst *pm;
|
||||
* If a zombie gets passed to this function, it should return NON_PM, not the
|
||||
* same monster again. */
|
||||
int
|
||||
zombie_form(pm)
|
||||
struct permonst *pm;
|
||||
zombie_form(struct permonst* pm)
|
||||
{
|
||||
switch(pm->mlet) {
|
||||
case S_KOBOLD:
|
||||
@@ -320,8 +317,7 @@ struct permonst *pm;
|
||||
|
||||
/* convert the monster index of an undead to its living counterpart */
|
||||
int
|
||||
undead_to_corpse(mndx)
|
||||
int mndx;
|
||||
undead_to_corpse(int mndx)
|
||||
{
|
||||
switch (mndx) {
|
||||
case PM_KOBOLD_ZOMBIE:
|
||||
@@ -374,8 +370,7 @@ int mndx;
|
||||
* if mode is 1.
|
||||
*/
|
||||
int
|
||||
genus(mndx, mode)
|
||||
int mndx, mode;
|
||||
genus(int mndx, int mode)
|
||||
{
|
||||
switch (mndx) {
|
||||
/* Quest guardians */
|
||||
@@ -440,8 +435,7 @@ int mndx, mode;
|
||||
|
||||
/* return monster index if chameleon, or NON_PM if not */
|
||||
int
|
||||
pm_to_cham(mndx)
|
||||
int mndx;
|
||||
pm_to_cham(int mndx)
|
||||
{
|
||||
int mcham = NON_PM;
|
||||
|
||||
@@ -470,9 +464,7 @@ int mndx;
|
||||
* etc....
|
||||
*/
|
||||
static struct obj *
|
||||
make_corpse(mtmp, corpseflags)
|
||||
register struct monst *mtmp;
|
||||
unsigned corpseflags;
|
||||
make_corpse(register struct monst* mtmp, unsigned int corpseflags)
|
||||
{
|
||||
register struct permonst *mdat = mtmp->data;
|
||||
int num;
|
||||
@@ -664,8 +656,7 @@ unsigned corpseflags;
|
||||
|
||||
/* check mtmp and water/lava for compatibility, 0 (survived), 1 (died) */
|
||||
int
|
||||
minliquid(mtmp)
|
||||
struct monst *mtmp;
|
||||
minliquid(struct monst* mtmp)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -679,8 +670,7 @@ struct monst *mtmp;
|
||||
|
||||
/* guts of minliquid() */
|
||||
static int
|
||||
minliquid_core(mtmp)
|
||||
struct monst *mtmp;
|
||||
minliquid_core(struct monst* mtmp)
|
||||
{
|
||||
boolean inpool, inlava, infountain;
|
||||
|
||||
@@ -828,9 +818,9 @@ struct monst *mtmp;
|
||||
|
||||
/* calculate 'mon's movement for current turn; called from moveloop() */
|
||||
int
|
||||
mcalcmove(mon, m_moving)
|
||||
struct monst *mon;
|
||||
boolean m_moving; /* True: adjust for moving; False: just adjust for speed */
|
||||
mcalcmove(
|
||||
struct monst *mon,
|
||||
boolean m_moving) /* True: adjust for moving; False: just adjust for speed */
|
||||
{
|
||||
int mmove = mon->data->mmove;
|
||||
int mmove_adj;
|
||||
@@ -870,7 +860,7 @@ boolean m_moving; /* True: adjust for moving; False: just adjust for speed */
|
||||
individual monster's metabolism; some of these might need to
|
||||
be reclassified to occur more in proportion with movement rate */
|
||||
void
|
||||
mcalcdistress()
|
||||
mcalcdistress(void)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
|
||||
@@ -911,7 +901,7 @@ mcalcdistress()
|
||||
}
|
||||
|
||||
int
|
||||
movemon()
|
||||
movemon(void)
|
||||
{
|
||||
register struct monst *mtmp, *nmtmp;
|
||||
register boolean somebody_can_move = FALSE;
|
||||
@@ -1063,8 +1053,7 @@ movemon()
|
||||
* has young and old forms).
|
||||
*/
|
||||
int
|
||||
meatmetal(mtmp)
|
||||
register struct monst *mtmp;
|
||||
meatmetal(register struct monst* mtmp)
|
||||
{
|
||||
register struct obj *otmp;
|
||||
struct permonst *ptr;
|
||||
@@ -1162,8 +1151,7 @@ register struct monst *mtmp;
|
||||
|
||||
/* monster eats a pile of objects */
|
||||
int
|
||||
meatobj(mtmp) /* for gelatinous cubes */
|
||||
struct monst *mtmp;
|
||||
meatobj(struct monst* mtmp) /* for gelatinous cubes */
|
||||
{
|
||||
struct obj *otmp, *otmp2;
|
||||
struct permonst *ptr, *original_ptr = mtmp->data;
|
||||
@@ -1309,8 +1297,7 @@ struct monst *mtmp;
|
||||
/* Monster eats a corpse off the ground.
|
||||
* Return value is 0 = nothing eaten, 1 = ate a corpse, 2 = died */
|
||||
int
|
||||
meatcorpse(mtmp) /* for purple worms and other voracious monsters */
|
||||
struct monst* mtmp;
|
||||
meatcorpse(struct monst* mtmp) /* for purple worms and other voracious monsters */
|
||||
{
|
||||
struct obj *otmp;
|
||||
struct permonst *ptr, *original_ptr = mtmp->data, *corpsepm;
|
||||
@@ -1389,8 +1376,7 @@ struct monst* mtmp;
|
||||
}
|
||||
|
||||
void
|
||||
mpickgold(mtmp)
|
||||
register struct monst *mtmp;
|
||||
mpickgold(register struct monst* mtmp)
|
||||
{
|
||||
register struct obj *gold;
|
||||
int mat_idx;
|
||||
@@ -1409,9 +1395,7 @@ register struct monst *mtmp;
|
||||
}
|
||||
|
||||
boolean
|
||||
mpickstuff(mtmp, str)
|
||||
register struct monst *mtmp;
|
||||
register const char *str;
|
||||
mpickstuff(register struct monst* mtmp, register const char* str)
|
||||
{
|
||||
register struct obj *otmp, *otmp2, *otmp3;
|
||||
int carryamt = 0;
|
||||
@@ -1459,8 +1443,7 @@ register const char *str;
|
||||
}
|
||||
|
||||
int
|
||||
curr_mon_load(mtmp)
|
||||
struct monst *mtmp;
|
||||
curr_mon_load(struct monst* mtmp)
|
||||
{
|
||||
int curload = 0;
|
||||
struct obj *obj;
|
||||
@@ -1474,8 +1457,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
int
|
||||
max_mon_load(mtmp)
|
||||
struct monst *mtmp;
|
||||
max_mon_load(struct monst* mtmp)
|
||||
{
|
||||
long maxload;
|
||||
|
||||
@@ -1518,9 +1500,7 @@ struct monst *mtmp;
|
||||
* likesgold handling m_move results in picking up the whole stack.
|
||||
*/
|
||||
int
|
||||
can_carry(mtmp, otmp)
|
||||
struct monst *mtmp;
|
||||
struct obj *otmp;
|
||||
can_carry(struct monst* mtmp, struct obj* otmp)
|
||||
{
|
||||
int iquan, otyp = otmp->otyp, newload = otmp->owt;
|
||||
struct permonst *mdat = mtmp->data;
|
||||
@@ -1593,8 +1573,7 @@ struct obj *otmp;
|
||||
|
||||
/* return flags based on monster data, for mfndpos() */
|
||||
long
|
||||
mon_allowflags(mtmp)
|
||||
struct monst *mtmp;
|
||||
mon_allowflags(struct monst* mtmp)
|
||||
{
|
||||
long allowflags = 0L;
|
||||
boolean can_open = !(nohands(mtmp->data) || verysmall(mtmp->data));
|
||||
@@ -1656,11 +1635,11 @@ struct monst *mtmp;
|
||||
|
||||
/* return number of acceptable neighbour positions */
|
||||
int
|
||||
mfndpos(mon, poss, info, flag)
|
||||
struct monst *mon;
|
||||
coord *poss; /* coord poss[9] */
|
||||
long *info; /* long info[9] */
|
||||
long flag;
|
||||
mfndpos(
|
||||
struct monst *mon,
|
||||
coord *poss, /* coord poss[9] */
|
||||
long *info, /* long info[9] */
|
||||
long flag)
|
||||
{
|
||||
struct permonst *mdat = mon->data;
|
||||
register struct trap *ttmp;
|
||||
@@ -1905,8 +1884,7 @@ long flag;
|
||||
* code each case twice, this function contains those cases that ought to
|
||||
* happen twice, and mm_aggression will call it twice. */
|
||||
static long
|
||||
mm_2way_aggression(magr, mdef)
|
||||
struct monst *magr, *mdef;
|
||||
mm_2way_aggression(struct monst* magr, struct monst* mdef)
|
||||
{
|
||||
struct permonst *ma = magr->data;
|
||||
struct permonst *md = mdef->data;
|
||||
@@ -1924,9 +1902,9 @@ struct monst *magr, *mdef;
|
||||
other monsters; just hand to hand fighting when they happen to be
|
||||
next to each other. */
|
||||
static long
|
||||
mm_aggression(magr, mdef)
|
||||
struct monst *magr, /* monster that is currently deciding where to move */
|
||||
*mdef; /* another monster which is next to it */
|
||||
mm_aggression(
|
||||
struct monst *magr, /* monster that is currently deciding where to move */
|
||||
struct monst *mdef) /* another monster which is next to it */
|
||||
{
|
||||
int mndx = monsndx(magr->data);
|
||||
|
||||
@@ -1947,9 +1925,9 @@ struct monst *magr, /* monster that is currently deciding where to move */
|
||||
|
||||
/* Monster displacing another monster out of the way */
|
||||
static long
|
||||
mm_displacement(magr, mdef)
|
||||
struct monst *magr, /* monster that is currently deciding where to move */
|
||||
*mdef; /* another monster which is next to it */
|
||||
mm_displacement(
|
||||
struct monst *magr, /* monster that is currently deciding where to move */
|
||||
struct monst *mdef) /* another monster which is next to it */
|
||||
{
|
||||
struct permonst *pa = magr->data, *pd = mdef->data;
|
||||
|
||||
@@ -1972,9 +1950,7 @@ struct monst *magr, /* monster that is currently deciding where to move */
|
||||
|
||||
/* Is the square close enough for the monster to move or attack into? */
|
||||
boolean
|
||||
monnear(mon, x, y)
|
||||
struct monst *mon;
|
||||
int x, y;
|
||||
monnear(struct monst* mon, int x, int y)
|
||||
{
|
||||
int distance = dist2(mon->mx, mon->my, x, y);
|
||||
|
||||
@@ -1985,7 +1961,7 @@ int x, y;
|
||||
|
||||
/* really free dead monsters */
|
||||
void
|
||||
dmonsfree()
|
||||
dmonsfree(void)
|
||||
{
|
||||
struct monst **mtmp, *freetmp;
|
||||
int count = 0;
|
||||
@@ -2013,8 +1989,7 @@ dmonsfree()
|
||||
|
||||
/* called when monster is moved to larger structure */
|
||||
void
|
||||
replmon(mtmp, mtmp2)
|
||||
struct monst *mtmp, *mtmp2;
|
||||
replmon(struct monst* mtmp, struct monst* mtmp2)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
@@ -2060,9 +2035,9 @@ struct monst *mtmp, *mtmp2;
|
||||
/* release mon from the display and the map's monster list,
|
||||
maybe transfer it to one of the other monster lists */
|
||||
void
|
||||
relmon(mon, monst_list)
|
||||
struct monst *mon;
|
||||
struct monst **monst_list; /* &g.migrating_mons or &g.mydogs or null */
|
||||
relmon(
|
||||
struct monst *mon,
|
||||
struct monst **monst_list) /* &g.migrating_mons or &g.mydogs or null */
|
||||
{
|
||||
struct monst *mtmp;
|
||||
int mx = mon->mx, my = mon->my;
|
||||
@@ -2118,8 +2093,7 @@ struct monst **monst_list; /* &g.migrating_mons or &g.mydogs or null */
|
||||
}
|
||||
|
||||
void
|
||||
copy_mextra(mtmp2, mtmp1)
|
||||
struct monst *mtmp2, *mtmp1;
|
||||
copy_mextra(struct monst* mtmp2, struct monst* mtmp1)
|
||||
{
|
||||
if (!mtmp2 || !mtmp1 || !mtmp1->mextra)
|
||||
return;
|
||||
@@ -2160,8 +2134,7 @@ struct monst *mtmp2, *mtmp1;
|
||||
}
|
||||
|
||||
void
|
||||
dealloc_mextra(m)
|
||||
struct monst *m;
|
||||
dealloc_mextra(struct monst* m)
|
||||
{
|
||||
struct mextra *x = m->mextra;
|
||||
|
||||
@@ -2186,8 +2159,7 @@ struct monst *m;
|
||||
}
|
||||
|
||||
void
|
||||
dealloc_monst(mon)
|
||||
struct monst *mon;
|
||||
dealloc_monst(struct monst* mon)
|
||||
{
|
||||
char buf[QBUFSZ];
|
||||
|
||||
@@ -2203,9 +2175,9 @@ struct monst *mon;
|
||||
|
||||
/* remove effects of mtmp from other data structures */
|
||||
static void
|
||||
m_detach(mtmp, mptr)
|
||||
struct monst *mtmp;
|
||||
struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
|
||||
m_detach(
|
||||
struct monst *mtmp,
|
||||
struct permonst *mptr) /* reflects mtmp->data _prior_ to mtmp's death */
|
||||
{
|
||||
boolean onmap = (mtmp->mx > 0);
|
||||
|
||||
@@ -2254,9 +2226,9 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
|
||||
/* give a life-saved monster a reasonable mhpmax value in case it has
|
||||
been the victim of excessive life draining */
|
||||
static void
|
||||
set_mon_min_mhpmax(mon, minimum_mhpmax)
|
||||
struct monst *mon;
|
||||
int minimum_mhpmax; /* monster life-saving has traditionally used 10 */
|
||||
set_mon_min_mhpmax(
|
||||
struct monst *mon,
|
||||
int minimum_mhpmax) /* monster life-saving has traditionally used 10 */
|
||||
{
|
||||
/* can't be less than m_lev+1 (if we just used m_lev itself, level 0
|
||||
monsters would end up allowing a minimum of 0); since life draining
|
||||
@@ -2273,8 +2245,7 @@ int minimum_mhpmax; /* monster life-saving has traditionally used 10 */
|
||||
|
||||
/* find the worn amulet of life saving which will save a monster */
|
||||
struct obj *
|
||||
mlifesaver(mon)
|
||||
struct monst *mon;
|
||||
mlifesaver(struct monst* mon)
|
||||
{
|
||||
if (!nonliving(mon->data) || is_vampshifter(mon)) {
|
||||
struct obj *otmp = which_armor(mon, W_AMUL);
|
||||
@@ -2286,8 +2257,7 @@ struct monst *mon;
|
||||
}
|
||||
|
||||
static void
|
||||
lifesaved_monster(mtmp)
|
||||
struct monst *mtmp;
|
||||
lifesaved_monster(struct monst* mtmp)
|
||||
{
|
||||
boolean surviver;
|
||||
struct obj *lifesave = mlifesaver(mtmp);
|
||||
@@ -2335,8 +2305,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
void
|
||||
mondead(mtmp)
|
||||
register struct monst *mtmp;
|
||||
mondead(register struct monst* mtmp)
|
||||
{
|
||||
struct permonst *mptr;
|
||||
boolean be_sad;
|
||||
@@ -2496,10 +2465,10 @@ register struct monst *mtmp;
|
||||
|
||||
/* TRUE if corpse might be dropped, magr may die if mon was swallowed */
|
||||
boolean
|
||||
corpse_chance(mon, magr, was_swallowed)
|
||||
struct monst *mon;
|
||||
struct monst *magr; /* killer, if swallowed */
|
||||
boolean was_swallowed; /* digestion */
|
||||
corpse_chance(
|
||||
struct monst *mon,
|
||||
struct monst *magr, /* killer, if swallowed */
|
||||
boolean was_swallowed) /* digestion */
|
||||
{
|
||||
struct permonst *mdat = mon->data;
|
||||
int i, tmp;
|
||||
@@ -2565,8 +2534,7 @@ boolean was_swallowed; /* digestion */
|
||||
|
||||
/* drop (perhaps) a cadaver and remove monster */
|
||||
void
|
||||
mondied(mdef)
|
||||
register struct monst *mdef;
|
||||
mondied(register struct monst* mdef)
|
||||
{
|
||||
mondead(mdef);
|
||||
if (!DEADMONSTER(mdef))
|
||||
@@ -2579,8 +2547,7 @@ register struct monst *mdef;
|
||||
|
||||
/* monster disappears, not dies */
|
||||
void
|
||||
mongone(mdef)
|
||||
struct monst *mdef;
|
||||
mongone(struct monst* mdef)
|
||||
{
|
||||
mdef->mhp = 0; /* can skip some inventory bookkeeping */
|
||||
|
||||
@@ -2603,8 +2570,7 @@ struct monst *mdef;
|
||||
|
||||
/* drop a statue or rock and remove monster */
|
||||
void
|
||||
monstone(mdef)
|
||||
struct monst *mdef;
|
||||
monstone(struct monst* mdef)
|
||||
{
|
||||
struct obj *otmp, *obj, *oldminvent;
|
||||
xchar x = mdef->mx, y = mdef->my;
|
||||
@@ -2693,10 +2659,10 @@ struct monst *mdef;
|
||||
|
||||
/* another monster has killed the monster mdef */
|
||||
void
|
||||
monkilled(mdef, fltxt, how)
|
||||
struct monst *mdef;
|
||||
const char *fltxt;
|
||||
int how;
|
||||
monkilled(
|
||||
struct monst *mdef,
|
||||
const char *fltxt,
|
||||
int how)
|
||||
{
|
||||
struct permonst *mptr = mdef->data;
|
||||
|
||||
@@ -2736,8 +2702,7 @@ int how;
|
||||
}
|
||||
|
||||
void
|
||||
set_ustuck(mtmp)
|
||||
struct monst *mtmp;
|
||||
set_ustuck(struct monst* mtmp)
|
||||
{
|
||||
if (iflags.sanity_check || iflags.debug_fuzzer) {
|
||||
if (mtmp && distu(mtmp->mx, mtmp->my) > 2)
|
||||
@@ -2750,8 +2715,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
void
|
||||
unstuck(mtmp)
|
||||
struct monst *mtmp;
|
||||
unstuck(struct monst* mtmp)
|
||||
{
|
||||
if (u.ustuck == mtmp) {
|
||||
/* do this first so that docrt()'s botl update is accurate;
|
||||
@@ -2776,17 +2740,16 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
void
|
||||
killed(mtmp)
|
||||
struct monst *mtmp;
|
||||
killed(struct monst* mtmp)
|
||||
{
|
||||
xkilled(mtmp, XKILL_GIVEMSG);
|
||||
}
|
||||
|
||||
/* the player has killed the monster mtmp */
|
||||
void
|
||||
xkilled(mtmp, xkill_flags)
|
||||
struct monst *mtmp;
|
||||
int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
|
||||
xkilled(
|
||||
struct monst *mtmp,
|
||||
int xkill_flags) /* 1: suppress message, 2: suppress corpse, 4: pacifist */
|
||||
{
|
||||
int tmp, mndx, x = mtmp->mx, y = mtmp->my;
|
||||
struct permonst *mdat;
|
||||
@@ -2988,8 +2951,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
|
||||
/* changes the monster into a stone monster of the same type
|
||||
this should only be called when poly_when_stoned() is true */
|
||||
void
|
||||
mon_to_stone(mtmp)
|
||||
struct monst *mtmp;
|
||||
mon_to_stone(struct monst* mtmp)
|
||||
{
|
||||
if (mtmp->data->mlet == S_GOLEM) {
|
||||
/* it's a golem, and not a stone golem */
|
||||
@@ -3007,8 +2969,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
boolean
|
||||
vamp_stone(mtmp)
|
||||
struct monst *mtmp;
|
||||
vamp_stone(struct monst* mtmp)
|
||||
{
|
||||
if (is_vampshifter(mtmp)) {
|
||||
int mndx = mtmp->cham;
|
||||
@@ -3077,8 +3038,7 @@ struct monst *mtmp;
|
||||
|
||||
/* drop monster into "limbo" - that is, migrate to the current level */
|
||||
void
|
||||
m_into_limbo(mtmp)
|
||||
struct monst *mtmp;
|
||||
m_into_limbo(struct monst* mtmp)
|
||||
{
|
||||
xchar target_lev = ledger_no(&u.uz), xyloc = MIGR_APPROX_XY;
|
||||
|
||||
@@ -3087,9 +3047,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
static void
|
||||
migrate_mon(mtmp, target_lev, xyloc)
|
||||
struct monst *mtmp;
|
||||
xchar target_lev, xyloc;
|
||||
migrate_mon(struct monst* mtmp, xchar target_lev, xchar xyloc)
|
||||
{
|
||||
unstuck(mtmp);
|
||||
mdrop_special_objs(mtmp);
|
||||
@@ -3098,8 +3056,7 @@ xchar target_lev, xyloc;
|
||||
}
|
||||
|
||||
static boolean
|
||||
ok_to_obliterate(mtmp)
|
||||
struct monst *mtmp;
|
||||
ok_to_obliterate(struct monst* mtmp)
|
||||
{
|
||||
/*
|
||||
* Add checks for monsters that should not be obliterated
|
||||
@@ -3113,8 +3070,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
void
|
||||
elemental_clog(mon)
|
||||
struct monst *mon;
|
||||
elemental_clog(struct monst* mon)
|
||||
{
|
||||
int m_lev = 0;
|
||||
static long msgmv = 0L;
|
||||
@@ -3191,8 +3147,7 @@ struct monst *mon;
|
||||
/* make monster mtmp next to you (if possible);
|
||||
might place monst on far side of a wall or boulder */
|
||||
void
|
||||
mnexto(mtmp)
|
||||
struct monst *mtmp;
|
||||
mnexto(struct monst* mtmp)
|
||||
{
|
||||
coord mm;
|
||||
boolean couldspot = canspotmon(mtmp);
|
||||
@@ -3219,8 +3174,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
static void
|
||||
deal_with_overcrowding(mtmp)
|
||||
struct monst *mtmp;
|
||||
deal_with_overcrowding(struct monst* mtmp)
|
||||
{
|
||||
if (In_endgame(&u.uz)) {
|
||||
debugpline1("overcrowding: elemental_clog on %s", m_monnam(mtmp));
|
||||
@@ -3233,8 +3187,7 @@ struct monst *mtmp;
|
||||
|
||||
/* like mnexto() but requires destination to be directly accessible */
|
||||
void
|
||||
maybe_mnexto(mtmp)
|
||||
struct monst *mtmp;
|
||||
maybe_mnexto(struct monst* mtmp)
|
||||
{
|
||||
coord mm;
|
||||
struct permonst *ptr = mtmp->data;
|
||||
@@ -3265,10 +3218,11 @@ struct monst *mtmp;
|
||||
* will be False on the nested call so there won't be any further recursion.
|
||||
*/
|
||||
int
|
||||
mnearto(mtmp, x, y, move_other)
|
||||
register struct monst *mtmp;
|
||||
xchar x, y;
|
||||
boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */
|
||||
mnearto(
|
||||
register struct monst *mtmp,
|
||||
xchar x,
|
||||
xchar y,
|
||||
boolean move_other) /* make sure mtmp gets to x, y! so move m_at(x, y) */
|
||||
{
|
||||
struct monst *othermon = (struct monst *) 0;
|
||||
xchar newx, newy;
|
||||
@@ -3322,8 +3276,7 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */
|
||||
/* monster responds to player action; not the same as a passive attack;
|
||||
assumes reason for response has been tested, and response _must_ be made */
|
||||
void
|
||||
m_respond(mtmp)
|
||||
struct monst *mtmp;
|
||||
m_respond(struct monst* mtmp)
|
||||
{
|
||||
if (mtmp->data->msound == MS_SHRIEK) {
|
||||
if (!Deaf) {
|
||||
@@ -3359,9 +3312,7 @@ struct monst *mtmp;
|
||||
where mtmp was already hostile; it checks for situations where the player
|
||||
shouldn't be attacking and any ramifications /that/ might have. */
|
||||
void
|
||||
setmangry(mtmp, via_attack)
|
||||
struct monst *mtmp;
|
||||
boolean via_attack;
|
||||
setmangry(struct monst* mtmp, boolean via_attack)
|
||||
{
|
||||
if (via_attack && sengr_at("Elbereth", u.ux, u.uy, TRUE)
|
||||
/* only hypocritical if monster is vulnerable to Elbereth (or
|
||||
@@ -3525,9 +3476,7 @@ boolean via_attack;
|
||||
|
||||
/* wake up a monster, possibly making it angry in the process */
|
||||
void
|
||||
wakeup(mtmp, via_attack)
|
||||
register struct monst *mtmp;
|
||||
boolean via_attack;
|
||||
wakeup(struct monst* mtmp, boolean via_attack)
|
||||
{
|
||||
mtmp->msleeping = 0;
|
||||
if (M_AP_TYPE(mtmp) != M_AP_NOTHING) {
|
||||
@@ -3547,15 +3496,14 @@ boolean via_attack;
|
||||
|
||||
/* Wake up nearby monsters without angering them. */
|
||||
void
|
||||
wake_nearby()
|
||||
wake_nearby(void)
|
||||
{
|
||||
wake_nearto(u.ux, u.uy, u.ulevel * 20);
|
||||
}
|
||||
|
||||
/* Wake up monsters near some particular location. */
|
||||
void
|
||||
wake_nearto(x, y, distance)
|
||||
int x, y, distance;
|
||||
wake_nearto(int x, int y, int distance)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
|
||||
@@ -3583,8 +3531,7 @@ int x, y, distance;
|
||||
|
||||
/* NOTE: we must check for mimicry before calling this routine */
|
||||
void
|
||||
seemimic(mtmp)
|
||||
register struct monst *mtmp;
|
||||
seemimic(register struct monst* mtmp)
|
||||
{
|
||||
boolean is_blocker_appear = (is_lightblocker_mappear(mtmp));
|
||||
|
||||
@@ -3606,7 +3553,7 @@ register struct monst *mtmp;
|
||||
|
||||
/* force all chameleons to become normal */
|
||||
void
|
||||
rescham()
|
||||
rescham(void)
|
||||
{
|
||||
register struct monst *mtmp;
|
||||
int mcham;
|
||||
@@ -3640,7 +3587,7 @@ rescham()
|
||||
|
||||
/* Let the chameleons change again -dgk */
|
||||
void
|
||||
restartcham()
|
||||
restartcham(void)
|
||||
{
|
||||
register struct monst *mtmp;
|
||||
|
||||
@@ -3661,8 +3608,7 @@ restartcham()
|
||||
against shape-changing might be different now than it was at the
|
||||
time the level was saved. */
|
||||
void
|
||||
restore_cham(mon)
|
||||
struct monst *mon;
|
||||
restore_cham(struct monst* mon)
|
||||
{
|
||||
int mcham;
|
||||
|
||||
@@ -3681,8 +3627,7 @@ struct monst *mon;
|
||||
|
||||
/* unwatched hiders may hide again; if so, returns True */
|
||||
static boolean
|
||||
restrap(mtmp)
|
||||
register struct monst *mtmp;
|
||||
restrap(struct monst* mtmp)
|
||||
{
|
||||
struct trap *t;
|
||||
|
||||
@@ -3708,8 +3653,7 @@ register struct monst *mtmp;
|
||||
/* reveal a monster at x,y hiding under an object,
|
||||
if there are no objects there */
|
||||
void
|
||||
maybe_unhide_at(x, y)
|
||||
xchar x, y;
|
||||
maybe_unhide_at(xchar x, xchar y)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
|
||||
@@ -3720,8 +3664,7 @@ xchar x, y;
|
||||
|
||||
/* monster/hero tries to hide under something at the current location */
|
||||
boolean
|
||||
hideunder(mtmp)
|
||||
struct monst *mtmp;
|
||||
hideunder(struct monst* mtmp)
|
||||
{
|
||||
struct trap *t;
|
||||
boolean undetected = FALSE, is_u = (mtmp == &g.youmonst);
|
||||
@@ -3754,8 +3697,7 @@ struct monst *mtmp;
|
||||
|
||||
/* called when returning to a previously visited level */
|
||||
void
|
||||
hide_monst(mon)
|
||||
struct monst *mon;
|
||||
hide_monst(struct monst* mon)
|
||||
{
|
||||
boolean hider_under = hides_under(mon->data) || mon->data->mlet == S_EEL;
|
||||
|
||||
@@ -3778,8 +3720,7 @@ struct monst *mon;
|
||||
}
|
||||
|
||||
void
|
||||
mon_animal_list(construct)
|
||||
boolean construct;
|
||||
mon_animal_list(boolean construct)
|
||||
{
|
||||
if (construct) {
|
||||
short animal_temp[SPECIAL_PM];
|
||||
@@ -3804,7 +3745,7 @@ boolean construct;
|
||||
}
|
||||
|
||||
static int
|
||||
pick_animal()
|
||||
pick_animal(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -3821,9 +3762,7 @@ pick_animal()
|
||||
}
|
||||
|
||||
void
|
||||
decide_to_shapeshift(mon, shiftflags)
|
||||
struct monst *mon;
|
||||
int shiftflags;
|
||||
decide_to_shapeshift(struct monst* mon, int shiftflags)
|
||||
{
|
||||
struct permonst *ptr = 0;
|
||||
int mndx;
|
||||
@@ -3883,8 +3822,7 @@ int shiftflags;
|
||||
}
|
||||
|
||||
static int
|
||||
pickvampshape(mon)
|
||||
struct monst *mon;
|
||||
pickvampshape(struct monst* mon)
|
||||
{
|
||||
int mndx = mon->cham, wolfchance = 10;
|
||||
/* avoid picking monsters with lowercase display symbols ('d' for wolf
|
||||
@@ -3913,8 +3851,7 @@ struct monst *mon;
|
||||
|
||||
/* nonshapechangers who warrant special polymorph handling */
|
||||
static boolean
|
||||
isspecmon(mon)
|
||||
struct monst *mon;
|
||||
isspecmon(struct monst* mon)
|
||||
{
|
||||
return (mon->isshk || mon->ispriest || mon->isgd
|
||||
|| mon->m_id == g.quest_status.leader_m_id);
|
||||
@@ -3924,9 +3861,7 @@ struct monst *mon;
|
||||
vault guards) to forms that allow them to behave sensibly (catching
|
||||
gold, speaking?) so that they don't need too much extra code */
|
||||
static boolean
|
||||
validspecmon(mon, mndx)
|
||||
struct monst *mon;
|
||||
int mndx;
|
||||
validspecmon(struct monst* mon, int mndx)
|
||||
{
|
||||
if (mndx == NON_PM)
|
||||
return TRUE; /* caller wants random */
|
||||
@@ -3948,8 +3883,7 @@ int mndx;
|
||||
|
||||
/* used for hero polyself handling */
|
||||
boolean
|
||||
valid_vampshiftform(base, form)
|
||||
int base, form;
|
||||
valid_vampshiftform(int base, int form)
|
||||
{
|
||||
if (base >= LOW_PM && is_vampire(&mons[base])) {
|
||||
if (form == PM_VAMPIRE_BAT || form == PM_FOG_CLOUD
|
||||
@@ -3962,9 +3896,7 @@ int base, form;
|
||||
/* prevent wizard mode user from specifying invalid vampshifter shape
|
||||
when using monpolycontrol to assign a new form to a vampshifter */
|
||||
boolean
|
||||
validvamp(mon, mndx_p, monclass)
|
||||
struct monst *mon;
|
||||
int *mndx_p, monclass;
|
||||
validvamp(struct monst* mon, int* mndx_p, int monclass)
|
||||
{
|
||||
/* simplify caller's usage */
|
||||
if (!is_vampshifter(mon))
|
||||
@@ -4013,8 +3945,7 @@ int *mndx_p, monclass;
|
||||
}
|
||||
|
||||
int
|
||||
select_newcham_form(mon)
|
||||
struct monst *mon;
|
||||
select_newcham_form(struct monst* mon)
|
||||
{
|
||||
int mndx = NON_PM, tryct;
|
||||
|
||||
@@ -4147,9 +4078,7 @@ struct monst *mon;
|
||||
|
||||
/* this used to be inline within newcham() but monpolycontrol needs it too */
|
||||
static struct permonst *
|
||||
accept_newcham_form(mon, mndx)
|
||||
struct monst *mon;
|
||||
int mndx;
|
||||
accept_newcham_form(struct monst* mon, int mndx)
|
||||
{
|
||||
struct permonst *mdat;
|
||||
|
||||
@@ -4175,9 +4104,7 @@ int mndx;
|
||||
}
|
||||
|
||||
void
|
||||
mgender_from_permonst(mtmp, mdat)
|
||||
struct monst *mtmp;
|
||||
struct permonst *mdat;
|
||||
mgender_from_permonst(struct monst* mtmp, struct permonst* mdat)
|
||||
{
|
||||
if (is_male(mdat)) {
|
||||
if (mtmp->female)
|
||||
@@ -4195,11 +4122,11 @@ struct permonst *mdat;
|
||||
(possibly self-inflicted) become a different monster;
|
||||
returns 1 if it actually changes form */
|
||||
int
|
||||
newcham(mtmp, mdat, polyspot, msg)
|
||||
struct monst *mtmp;
|
||||
struct permonst *mdat;
|
||||
boolean polyspot; /* change is the result of wand or spell of polymorph */
|
||||
boolean msg; /* "The oldmon turns into a newmon!" */
|
||||
newcham(
|
||||
struct monst *mtmp,
|
||||
struct permonst *mdat,
|
||||
boolean polyspot, /* change is the result of wand or spell of polymorph */
|
||||
boolean msg) /* "The oldmon turns into a newmon!" */
|
||||
{
|
||||
int hpn, hpd;
|
||||
int mndx, tryct;
|
||||
@@ -4421,8 +4348,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
|
||||
* NON_PM if the given monster can't be hatched.
|
||||
*/
|
||||
int
|
||||
can_be_hatched(mnum)
|
||||
int mnum;
|
||||
can_be_hatched(int mnum)
|
||||
{
|
||||
/* ranger quest nemesis has the oviparous bit set, making it
|
||||
be possible to wish for eggs of that unique monster; turn
|
||||
@@ -4445,9 +4371,9 @@ int mnum;
|
||||
|
||||
/* type of egg laid by #sit; usually matches parent */
|
||||
int
|
||||
egg_type_from_parent(mnum, force_ordinary)
|
||||
int mnum; /* parent monster; caller must handle lays_eggs() check */
|
||||
boolean force_ordinary;
|
||||
egg_type_from_parent(
|
||||
int mnum, /* parent monster; caller must handle lays_eggs() check */
|
||||
boolean force_ordinary)
|
||||
{
|
||||
if (force_ordinary || !BREEDER_EGG) {
|
||||
if (mnum == PM_QUEEN_BEE)
|
||||
@@ -4461,9 +4387,7 @@ boolean force_ordinary;
|
||||
/* decide whether an egg of the indicated monster type is viable;
|
||||
also used to determine whether an egg or tin can be created... */
|
||||
boolean
|
||||
dead_species(m_idx, egg)
|
||||
int m_idx;
|
||||
boolean egg;
|
||||
dead_species(int m_idx, boolean egg)
|
||||
{
|
||||
int alt_idx;
|
||||
|
||||
@@ -4484,8 +4408,7 @@ boolean egg;
|
||||
|
||||
/* kill off any eggs of genocided monsters */
|
||||
static void
|
||||
kill_eggs(obj_list)
|
||||
struct obj *obj_list;
|
||||
kill_eggs(struct obj* obj_list)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
@@ -4515,7 +4438,7 @@ struct obj *obj_list;
|
||||
|
||||
/* kill all members of genocided species */
|
||||
void
|
||||
kill_genocided_monsters()
|
||||
kill_genocided_monsters(void)
|
||||
{
|
||||
struct monst *mtmp, *mtmp2;
|
||||
boolean kill_cham;
|
||||
@@ -4556,9 +4479,7 @@ kill_genocided_monsters()
|
||||
}
|
||||
|
||||
void
|
||||
golemeffects(mon, damtype, dam)
|
||||
register struct monst *mon;
|
||||
int damtype, dam;
|
||||
golemeffects(register struct monst* mon, int damtype, int dam)
|
||||
{
|
||||
int heal = 0, slow = 0;
|
||||
|
||||
@@ -4591,8 +4512,7 @@ int damtype, dam;
|
||||
}
|
||||
|
||||
boolean
|
||||
angry_guards(silent)
|
||||
boolean silent;
|
||||
angry_guards(boolean silent)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
int ct = 0, nct = 0, sct = 0, slct = 0;
|
||||
@@ -4636,7 +4556,7 @@ boolean silent;
|
||||
}
|
||||
|
||||
void
|
||||
pacify_guards()
|
||||
pacify_guards(void)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
|
||||
@@ -4649,9 +4569,7 @@ pacify_guards()
|
||||
}
|
||||
|
||||
void
|
||||
mimic_hit_msg(mtmp, otyp)
|
||||
struct monst *mtmp;
|
||||
short otyp;
|
||||
mimic_hit_msg(struct monst* mtmp, short otyp)
|
||||
{
|
||||
short ap = mtmp->mappearance;
|
||||
|
||||
@@ -4671,8 +4589,7 @@ short otyp;
|
||||
}
|
||||
|
||||
boolean
|
||||
usmellmon(mdat)
|
||||
struct permonst *mdat;
|
||||
usmellmon(struct permonst* mdat)
|
||||
{
|
||||
int mndx;
|
||||
boolean nonspecific = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user