switch source tree from k&r to c99
This commit is contained in:
154
src/potion.c
154
src/potion.c
@@ -5,21 +5,20 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
static long FDECL(itimeout, (long));
|
||||
static long FDECL(itimeout_incr, (long, int));
|
||||
static void NDECL(ghost_from_bottle);
|
||||
static int FDECL(drink_ok, (struct obj *));
|
||||
static boolean FDECL(H2Opotion_dip, (struct obj *, struct obj *,
|
||||
BOOLEAN_P, const char *));
|
||||
static short FDECL(mixtype, (struct obj *, struct obj *));
|
||||
static int FDECL(dip_ok, (struct obj *));
|
||||
static void FDECL(hold_potion, (struct obj *, const char *,
|
||||
const char *, const char *));
|
||||
static long itimeout(long);
|
||||
static long itimeout_incr(long, int);
|
||||
static void ghost_from_bottle(void);
|
||||
static int drink_ok(struct obj *);
|
||||
static boolean H2Opotion_dip(struct obj *, struct obj *, boolean,
|
||||
const char *);
|
||||
static short mixtype(struct obj *, struct obj *);
|
||||
static int dip_ok(struct obj *);
|
||||
static void hold_potion(struct obj *, const char *, const char *,
|
||||
const char *);
|
||||
|
||||
/* force `val' to be within valid range for intrinsic timeout value */
|
||||
static long
|
||||
itimeout(val)
|
||||
long val;
|
||||
itimeout(long val)
|
||||
{
|
||||
if (val >= TIMEOUT)
|
||||
val = TIMEOUT;
|
||||
@@ -31,17 +30,14 @@ long val;
|
||||
|
||||
/* increment `old' by `incr' and force result to be valid intrinsic timeout */
|
||||
static long
|
||||
itimeout_incr(old, incr)
|
||||
long old;
|
||||
int incr;
|
||||
itimeout_incr(long old, int incr)
|
||||
{
|
||||
return itimeout((old & TIMEOUT) + (long) incr);
|
||||
}
|
||||
|
||||
/* set the timeout field of intrinsic `which' */
|
||||
void
|
||||
set_itimeout(which, val)
|
||||
long *which, val;
|
||||
set_itimeout(long *which, long val)
|
||||
{
|
||||
*which &= ~TIMEOUT;
|
||||
*which |= itimeout(val);
|
||||
@@ -49,17 +45,13 @@ long *which, val;
|
||||
|
||||
/* increment the timeout field of intrinsic `which' */
|
||||
void
|
||||
incr_itimeout(which, incr)
|
||||
long *which;
|
||||
int incr;
|
||||
incr_itimeout(long *which, int incr)
|
||||
{
|
||||
set_itimeout(which, itimeout_incr(*which, incr));
|
||||
}
|
||||
|
||||
void
|
||||
make_confused(xtime, talk)
|
||||
long xtime;
|
||||
boolean talk;
|
||||
make_confused(long xtime, boolean talk)
|
||||
{
|
||||
long old = HConfusion;
|
||||
|
||||
@@ -77,9 +69,7 @@ boolean talk;
|
||||
}
|
||||
|
||||
void
|
||||
make_stunned(xtime, talk)
|
||||
long xtime;
|
||||
boolean talk;
|
||||
make_stunned(long xtime, boolean talk)
|
||||
{
|
||||
long old = HStun;
|
||||
|
||||
@@ -109,11 +99,10 @@ boolean talk;
|
||||
u.usick_type bit mask), but delayed killer can only support one or
|
||||
the other at a time. They should become separate intrinsics.... */
|
||||
void
|
||||
make_sick(xtime, cause, talk, type)
|
||||
long xtime;
|
||||
const char *cause; /* sickness cause */
|
||||
boolean talk;
|
||||
int type;
|
||||
make_sick(long xtime,
|
||||
const char *cause, /* sickness cause */
|
||||
boolean talk,
|
||||
int type)
|
||||
{
|
||||
struct kinfo *kptr;
|
||||
long old = Sick;
|
||||
@@ -168,9 +157,7 @@ int type;
|
||||
}
|
||||
|
||||
void
|
||||
make_slimed(xtime, msg)
|
||||
long xtime;
|
||||
const char *msg;
|
||||
make_slimed(long xtime, const char *msg)
|
||||
{
|
||||
long old = Slimed;
|
||||
|
||||
@@ -197,11 +184,7 @@ const char *msg;
|
||||
|
||||
/* start or stop petrification */
|
||||
void
|
||||
make_stoned(xtime, msg, killedby, killername)
|
||||
long xtime;
|
||||
const char *msg;
|
||||
int killedby;
|
||||
const char *killername;
|
||||
make_stoned(long xtime, const char *msg, int killedby, const char *killername)
|
||||
{
|
||||
long old = Stoned;
|
||||
|
||||
@@ -222,9 +205,7 @@ const char *killername;
|
||||
}
|
||||
|
||||
void
|
||||
make_vomiting(xtime, talk)
|
||||
long xtime;
|
||||
boolean talk;
|
||||
make_vomiting(long xtime, boolean talk)
|
||||
{
|
||||
long old = Vomiting;
|
||||
|
||||
@@ -242,9 +223,7 @@ static const char vismsg[] = "vision seems to %s for a moment but is %s now.";
|
||||
static const char eyemsg[] = "%s momentarily %s.";
|
||||
|
||||
void
|
||||
make_blinded(xtime, talk)
|
||||
long xtime;
|
||||
boolean talk;
|
||||
make_blinded(long xtime, boolean talk)
|
||||
{
|
||||
long old = Blinded;
|
||||
boolean u_could_see, can_see_now;
|
||||
@@ -319,7 +298,7 @@ boolean talk;
|
||||
/* blindness has just started or just ended--caller enforces that;
|
||||
called by Blindf_on(), Blindf_off(), and make_blinded() */
|
||||
void
|
||||
toggle_blindness()
|
||||
toggle_blindness(void)
|
||||
{
|
||||
boolean Stinging = (uwep && (EWarn_of_mon & W_WEP) != 0L);
|
||||
|
||||
@@ -350,10 +329,11 @@ toggle_blindness()
|
||||
}
|
||||
|
||||
boolean
|
||||
make_hallucinated(xtime, talk, mask)
|
||||
long xtime; /* nonzero if this is an attempt to turn on hallucination */
|
||||
boolean talk;
|
||||
long mask; /* nonzero if resistance status should change by mask */
|
||||
make_hallucinated(long xtime, /* nonzero if this is an attempt to turn on
|
||||
hallucination */
|
||||
boolean talk,
|
||||
long mask) /* nonzero if resistance status should change
|
||||
by mask */
|
||||
{
|
||||
long old = HHallucination;
|
||||
boolean changed = 0;
|
||||
@@ -422,9 +402,7 @@ long mask; /* nonzero if resistance status should change by mask */
|
||||
}
|
||||
|
||||
void
|
||||
make_deaf(xtime, talk)
|
||||
long xtime;
|
||||
boolean talk;
|
||||
make_deaf(long xtime, boolean talk)
|
||||
{
|
||||
long old = HDeaf;
|
||||
|
||||
@@ -441,8 +419,7 @@ boolean talk;
|
||||
|
||||
/* set or clear "slippery fingers" */
|
||||
void
|
||||
make_glib(xtime)
|
||||
int xtime;
|
||||
make_glib(int xtime)
|
||||
{
|
||||
g.context.botl |= (!Glib ^ !!xtime);
|
||||
set_itimeout(&Glib, xtime);
|
||||
@@ -452,7 +429,7 @@ int xtime;
|
||||
}
|
||||
|
||||
void
|
||||
self_invis_message()
|
||||
self_invis_message(void)
|
||||
{
|
||||
pline("%s %s.",
|
||||
Hallucination ? "Far out, man! You"
|
||||
@@ -462,7 +439,7 @@ self_invis_message()
|
||||
}
|
||||
|
||||
static void
|
||||
ghost_from_bottle()
|
||||
ghost_from_bottle(void)
|
||||
{
|
||||
struct monst *mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS);
|
||||
|
||||
@@ -486,8 +463,7 @@ ghost_from_bottle()
|
||||
/* getobj callback for object to drink from, which also does double duty as the
|
||||
* callback for dipping into (both just allow potions). */
|
||||
static int
|
||||
drink_ok(obj)
|
||||
struct obj *obj;
|
||||
drink_ok(struct obj *obj)
|
||||
{
|
||||
if (obj && obj->oclass == POTION_CLASS)
|
||||
return GETOBJ_SUGGEST;
|
||||
@@ -497,7 +473,7 @@ struct obj *obj;
|
||||
|
||||
/* "Quaffing is like drinking, except you spill more." - Terry Pratchett */
|
||||
int
|
||||
dodrink()
|
||||
dodrink(void)
|
||||
{
|
||||
register struct obj *otmp;
|
||||
|
||||
@@ -568,8 +544,7 @@ dodrink()
|
||||
}
|
||||
|
||||
int
|
||||
dopotion(otmp)
|
||||
register struct obj *otmp;
|
||||
dopotion(struct obj *otmp)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -595,8 +570,7 @@ register struct obj *otmp;
|
||||
}
|
||||
|
||||
int
|
||||
peffects(otmp)
|
||||
register struct obj *otmp;
|
||||
peffects(struct obj *otmp)
|
||||
{
|
||||
register int i, ii, lim;
|
||||
|
||||
@@ -1172,9 +1146,7 @@ register struct obj *otmp;
|
||||
}
|
||||
|
||||
void
|
||||
healup(nhp, nxtra, curesick, cureblind)
|
||||
int nhp, nxtra;
|
||||
register boolean curesick, cureblind;
|
||||
healup(int nhp, int nxtra, boolean curesick, boolean cureblind)
|
||||
{
|
||||
if (nhp) {
|
||||
if (Upolyd) {
|
||||
@@ -1204,9 +1176,7 @@ register boolean curesick, cureblind;
|
||||
}
|
||||
|
||||
void
|
||||
strange_feeling(obj, txt)
|
||||
struct obj *obj;
|
||||
const char *txt;
|
||||
strange_feeling(struct obj *obj, const char *txt)
|
||||
{
|
||||
if (flags.beginner || !txt)
|
||||
You("have a %s feeling for a moment, then it passes.",
|
||||
@@ -1234,7 +1204,7 @@ const char *hbottlenames[] = {
|
||||
};
|
||||
|
||||
const char *
|
||||
bottlename()
|
||||
bottlename(void)
|
||||
{
|
||||
if (Hallucination)
|
||||
return hbottlenames[rn2(SIZE(hbottlenames))];
|
||||
@@ -1244,12 +1214,12 @@ bottlename()
|
||||
|
||||
/* handle item dipped into water potion or steed saddle splashed by same */
|
||||
static boolean
|
||||
H2Opotion_dip(potion, targobj, useeit, objphrase)
|
||||
struct obj *potion, *targobj;
|
||||
boolean useeit;
|
||||
const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
|
||||
H2Opotion_dip(struct obj *potion, struct obj *targobj,
|
||||
boolean useeit,
|
||||
const char *objphrase) /* "Your widget glows" or "Steed's saddle
|
||||
glows" */
|
||||
{
|
||||
void FDECL((*func), (OBJ_P)) = 0;
|
||||
void (*func)(OBJ_P) = 0;
|
||||
const char *glowcolor = 0;
|
||||
#define COST_alter (-2)
|
||||
#define COST_none (-1)
|
||||
@@ -1332,10 +1302,7 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
|
||||
|
||||
/* potion obj hits monster mon, which might be g.youmonst; obj always used up */
|
||||
void
|
||||
potionhit(mon, obj, how)
|
||||
struct monst *mon;
|
||||
struct obj *obj;
|
||||
int how;
|
||||
potionhit(struct monst *mon, struct obj *obj, int how)
|
||||
{
|
||||
const char *botlnam = bottlename();
|
||||
boolean isyou = (mon == &g.youmonst);
|
||||
@@ -1633,8 +1600,7 @@ int how;
|
||||
|
||||
/* vapors are inhaled or get in your eyes */
|
||||
void
|
||||
potionbreathe(obj)
|
||||
register struct obj *obj;
|
||||
potionbreathe(struct obj *obj)
|
||||
{
|
||||
int i, ii, isdone, kn = 0;
|
||||
boolean cureblind = FALSE;
|
||||
@@ -1815,8 +1781,7 @@ register struct obj *obj;
|
||||
|
||||
/* returns the potion type when o1 is dipped in o2 */
|
||||
static short
|
||||
mixtype(o1, o2)
|
||||
register struct obj *o1, *o2;
|
||||
mixtype(struct obj *o1, struct obj *o2)
|
||||
{
|
||||
int o1typ = o1->otyp, o2typ = o2->otyp;
|
||||
|
||||
@@ -1906,8 +1871,7 @@ register struct obj *o1, *o2;
|
||||
/* getobj callback for object to be dipped (not the thing being dipped into,
|
||||
* that uses drink_ok) */
|
||||
static int
|
||||
dip_ok(obj)
|
||||
struct obj *obj;
|
||||
dip_ok(struct obj *obj)
|
||||
{
|
||||
/* dipping hands and gold isn't currently implemented */
|
||||
if (!obj || obj->oclass == COIN_CLASS)
|
||||
@@ -1923,9 +1887,8 @@ struct obj *obj;
|
||||
won't have changed but it might require an extra slot that isn't available
|
||||
or it might merge into some other carried stack */
|
||||
static void
|
||||
hold_potion(potobj, drop_fmt, drop_arg, hold_msg)
|
||||
struct obj *potobj;
|
||||
const char *drop_fmt, *drop_arg, *hold_msg;
|
||||
hold_potion(struct obj *potobj, const char *drop_fmt, const char *drop_arg,
|
||||
const char *hold_msg)
|
||||
{
|
||||
int cap = near_capacity(),
|
||||
save_pickup_burden = flags.pickup_burden;
|
||||
@@ -1943,7 +1906,7 @@ const char *drop_fmt, *drop_arg, *hold_msg;
|
||||
|
||||
/* #dip command */
|
||||
int
|
||||
dodip()
|
||||
dodip(void)
|
||||
{
|
||||
static const char Dip_[] = "Dip ";
|
||||
register struct obj *potion, *obj;
|
||||
@@ -2356,8 +2319,7 @@ dodip()
|
||||
|
||||
/* *monp grants a wish and then leaves the game */
|
||||
void
|
||||
mongrantswish(monp)
|
||||
struct monst **monp;
|
||||
mongrantswish(struct monst **monp)
|
||||
{
|
||||
struct monst *mon = *monp;
|
||||
int mx = mon->mx, my = mon->my, glyph = glyph_at(mx, my);
|
||||
@@ -2376,8 +2338,7 @@ struct monst **monp;
|
||||
}
|
||||
|
||||
void
|
||||
djinni_from_bottle(obj)
|
||||
struct obj *obj;
|
||||
djinni_from_bottle(struct obj *obj)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
int chance;
|
||||
@@ -2434,9 +2395,8 @@ struct obj *obj;
|
||||
/* clone a gremlin or mold (2nd arg non-null implies heat as the trigger);
|
||||
hit points are cut in half (odd HP stays with original) */
|
||||
struct monst *
|
||||
split_mon(mon, mtmp)
|
||||
struct monst *mon, /* monster being split */
|
||||
*mtmp; /* optional attacker whose heat triggered it */
|
||||
split_mon(struct monst *mon, /* monster being split */
|
||||
struct monst *mtmp) /* optional attacker whose heat triggered it */
|
||||
{
|
||||
struct monst *mtmp2;
|
||||
char reason[BUFSZ];
|
||||
|
||||
Reference in New Issue
Block a user