diff --git a/include/decl.h b/include/decl.h
index f66c0f5a8..7a34be6f1 100644
--- a/include/decl.h
+++ b/include/decl.h
@@ -1082,7 +1082,6 @@ struct instance_globals_y {
/* decl.c */
int y_maze_max;
- struct monst youmonst;
/* pline.c */
/* work buffer for You(), &c and verbalize() */
diff --git a/include/display.h b/include/display.h
index fc52eac41..beac064c0 100644
--- a/include/display.h
+++ b/include/display.h
@@ -253,11 +253,11 @@
((int) U_AP_TYPE == M_AP_NOTHING) \
? hero_glyph \
: ((int) U_AP_TYPE == M_AP_FURNITURE) \
- ? cmap_to_glyph((int) gy.youmonst.mappearance) \
+ ? cmap_to_glyph((int) u.umonst->mappearance) \
: ((int) U_AP_TYPE == M_AP_OBJECT) \
- ? objnum_to_glyph((int) gy.youmonst.mappearance) \
+ ? objnum_to_glyph((int) u.umonst->mappearance) \
/* else U_AP_TYPE == M_AP_MONSTER */ \
- : monnum_to_glyph((int) gy.youmonst.mappearance, Ugender)))
+ : monnum_to_glyph((int) u.umonst->mappearance, Ugender)))
/*
* NetHack glyphs
diff --git a/include/hack.h b/include/hack.h
index f655a8961..1a8e07f14 100644
--- a/include/hack.h
+++ b/include/hack.h
@@ -464,7 +464,7 @@ enum encumbrance_types {
};
struct entity {
- struct monst *emon; /* youmonst for the player */
+ struct monst *emon; /* u.umonst for the player */
struct permonst *edata; /* must be non-zero for record to be valid */
int ex, ey;
};
@@ -1284,7 +1284,7 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
#define FM_FMON 0x01 /* search the fmon chain */
#define FM_MIGRATE 0x02 /* search the migrating monster chain */
#define FM_MYDOGS 0x04 /* search gm.mydogs */
-#define FM_YOU 0x08 /* check for gy.youmonst */
+#define FM_YOU 0x08 /* check for u.umonst */
#define FM_EVERYWHERE (FM_YOU | FM_FMON | FM_MIGRATE | FM_MYDOGS)
/* Flags to control pick_[race,role,gend,align] routines in role.c */
diff --git a/include/monst.h b/include/monst.h
index 8f189b4b7..6b3262706 100644
--- a/include/monst.h
+++ b/include/monst.h
@@ -67,8 +67,8 @@ enum m_ap_types {
#define M_AP_TYPMASK 0x7
#define M_AP_F_DKNOWN 0x8
-#define U_AP_TYPE (gy.youmonst.m_ap_type & M_AP_TYPMASK)
-#define U_AP_FLAG (gy.youmonst.m_ap_type & ~M_AP_TYPMASK)
+#define U_AP_TYPE (u.umonst->m_ap_type & M_AP_TYPMASK)
+#define U_AP_FLAG (u.umonst->m_ap_type & ~M_AP_TYPMASK)
#define M_AP_TYPE(m) ((m)->m_ap_type & M_AP_TYPMASK)
#define M_AP_FLAG(m) ((m)->m_ap_type & ~M_AP_TYPMASK)
diff --git a/include/you.h b/include/you.h
index a073e5c57..1f4b9c592 100644
--- a/include/you.h
+++ b/include/you.h
@@ -496,8 +496,9 @@ struct you {
struct skills weapon_skills[P_NUM_SKILLS];
boolean twoweap; /* KMH -- Using two-weapon combat */
short mcham; /* vampire mndx if shapeshifted to bat/cloud */
- short umovement; /* instead of youmonst.movement */
+ short umovement; /* instead of u.umonst->movement */
schar uachieved[N_ACH]; /* list of achievements in the order attained */
+ struct monst *umonst;
}; /* end of `struct you' */
diff --git a/include/youprop.h b/include/youprop.h
index f2c166606..98862dead 100644
--- a/include/youprop.h
+++ b/include/youprop.h
@@ -67,7 +67,7 @@
#define HSick_resistance u.uprops[SICK_RES].intrinsic
#define ESick_resistance u.uprops[SICK_RES].extrinsic
#define Sick_resistance (HSick_resistance || ESick_resistance \
- || defended(&gy.youmonst, AD_DISE))
+ || defended(u.umonst, AD_DISE))
/* Intrinsics only */
#define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */
@@ -270,11 +270,11 @@
#define HMagical_breathing u.uprops[MAGICAL_BREATHING].intrinsic
#define EMagical_breathing u.uprops[MAGICAL_BREATHING].extrinsic
#define Amphibious \
- (HMagical_breathing || EMagical_breathing || amphibious(gy.youmonst.data))
+ (HMagical_breathing || EMagical_breathing || amphibious(u.umonst->data))
/* Get wet, may go under surface */
#define Breathless \
- (HMagical_breathing || EMagical_breathing || breathless(gy.youmonst.data))
+ (HMagical_breathing || EMagical_breathing || breathless(u.umonst->data))
#define Underwater (u.uinwater)
/* Note that Underwater and u.uinwater are both used in code.
@@ -398,7 +398,7 @@
redundant but allows the function calls to be skipped most of the time */
#define Unaware (gm.multi < 0 && (unconscious() || is_fainted()))
-#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(gy.youmonst.data))
+#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(u.umonst->data))
/* _The_Hitchhikers_Guide_to_the_Galaxy_ on uses for 'towel': "wrap it round
your head to ward off noxious fumes" [we require it to be damp or wet] */
diff --git a/src/allmain.c b/src/allmain.c
index e9865e73e..4ac564c87 100644
--- a/src/allmain.c
+++ b/src/allmain.c
@@ -120,7 +120,7 @@ u_calc_moveamt(int wtcap)
/* your speed doesn't augment steed's speed */
moveamt = mcalcmove(u.usteed, TRUE);
} else {
- moveamt = gy.youmonst.data->mmove;
+ moveamt = u.umonst->data->mmove;
if (Very_fast) { /* speed boots, potion, or spell */
/* gain a free action on 2/3 of turns */
@@ -292,7 +292,7 @@ moveloop_core(void)
mvl_wtcap = UNENCUMBERED;
} else if (!Upolyd ? (u.uhp < u.uhpmax)
: (u.mh < u.mhmax
- || gy.youmonst.data->mlet == S_EEL)) {
+ || u.umonst->data->mlet == S_EEL)) {
/* maybe heal */
regen_hp(mvl_wtcap);
}
@@ -483,7 +483,7 @@ moveloop_core(void)
curs_on_u();
}
- m_everyturn_effect(&gy.youmonst);
+ m_everyturn_effect(u.umonst);
svc.context.move = 1;
@@ -636,7 +636,7 @@ regen_hp(int wtcap)
if (Upolyd) {
if (u.mh < 1) { /* shouldn't happen... */
rehumanize();
- } else if (gy.youmonst.data->mlet == S_EEL
+ } else if (u.umonst->data->mlet == S_EEL
&& !is_pool(u.ux, u.uy) && !Is_waterlevel(&u.uz)
&& !Breathless) {
/* eel out of water loses hp, similar to monster eels;
@@ -775,7 +775,7 @@ newgame(void)
/* make sure welcome messages are given before noticing monsters */
notice_mon_off();
disp.botlx = TRUE;
- svc.context.ident = 2; /* id 1 is reserved for gy.youmonst */
+ svc.context.ident = 2; /* id 1 is reserved for u.umonst->m_id */
svc.context.warnlevel = 1;
svc.context.next_attrib_check = 600L; /* arbitrary first setting */
svc.context.tribute.enabled = TRUE; /* turn on 3.6 tributes */
diff --git a/src/apply.c b/src/apply.c
index 40aefc3d9..7f0d4320e 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -324,7 +324,7 @@ use_stethoscope(struct obj *obj)
boolean interference = (u.uswallow && is_whirly(u.ustuck->data)
&& !rn2(Role_if(PM_HEALER) ? 10 : 3));
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You("have no hands!"); /* not `body_part(HAND)' */
return ECMD_OK;
} else if (Deaf) {
@@ -475,7 +475,7 @@ static const char whistle_str[] = "produce a %s whistling sound.",
staticfn void
use_whistle(struct obj *obj)
{
- if (!can_blow(&gy.youmonst)) {
+ if (!can_blow(u.umonst)) {
You("are incapable of using the whistle.");
} else if (Underwater) {
You("blow bubbles through %s.", yname(obj));
@@ -494,13 +494,13 @@ use_whistle(struct obj *obj)
staticfn void
use_magic_whistle(struct obj *obj)
{
- if (!can_blow(&gy.youmonst)) {
+ if (!can_blow(u.umonst)) {
You("are incapable of using the whistle.");
} else if (obj->cursed && !rn2(2)) {
You("produce a %shigh-%s.", Underwater ? "very " : "",
Deaf ? "frequency vibration" : "pitched humming noise");
wake_nearby(TRUE);
- if (!rn2(2) && !noteleport_level(&gy.youmonst))
+ if (!rn2(2) && !noteleport_level(u.umonst))
tele_to_rnd_pet();
} else {
/* it's magic! it works underwater too (at a higher pitch) */
@@ -1054,8 +1054,8 @@ use_mirror(struct obj *obj)
}
gn.nomovemsg = 0; /* default, "you can move again" */
}
- } else if (is_vampire(gy.youmonst.data)
- || is_vampshifter(&gy.youmonst)) {
+ } else if (is_vampire(u.umonst->data)
+ || is_vampshifter(u.umonst)) {
You("don't have a reflection.");
} else if (u.umonnum == PM_UMBER_HULK) {
pline("Huh? That doesn't look like you!");
@@ -1786,7 +1786,7 @@ dorub(void)
{
struct obj *obj;
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You("aren't able to rub anything without hands.");
return ECMD_OK;
}
@@ -1884,7 +1884,7 @@ check_jump(genericptr arg, coordxy x, coordxy y)
/* let giants jump over boulders (what about Flying?
and is there really enough head room for giants to jump
at all, let alone over something tall?) */
- if (sobj_at(BOULDER, x, y) && !throws_rocks(gy.youmonst.data))
+ if (sobj_at(BOULDER, x, y) && !throws_rocks(u.umonst->data))
return FALSE;
return TRUE;
}
@@ -1993,7 +1993,7 @@ jump(int magic) /* 0=Physical, otherwise skill level */
if (!magic && !Jumping && known_spell(SPE_JUMPING) >= spe_Fresh)
return spelleffects(SPE_JUMPING, FALSE, FALSE);
- if (!magic && (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data))) {
+ if (!magic && (nolimbs(u.umonst->data) || slithy(u.umonst->data))) {
/* normally (nolimbs || slithy) implies !Jumping,
but that isn't necessarily the case for knights */
You_cant("jump; you have no legs!");
@@ -2197,7 +2197,7 @@ use_tinning_kit(struct obj *obj)
char kbuf[BUFSZ];
const char *corpse_name = an(cxname(corpse));
- if (poly_when_stoned(gy.youmonst.data)) {
+ if (poly_when_stoned(u.umonst->data)) {
You("tin %s without wearing gloves.", corpse_name);
kbuf[0] = '\0';
} else {
@@ -2634,7 +2634,7 @@ use_grease(struct obj *obj)
if (otmp != &hands_obj) {
You("cover %s with a thick layer of grease.", yname(otmp));
otmp->greased = 1;
- if (obj->cursed && !nohands(gy.youmonst.data)) {
+ if (obj->cursed && !nohands(u.umonst->data)) {
make_glib(oldglib + rn1(6, 10)); /* + 10..15 */
pline("Some of the grease gets all over your %s.",
fingers_or_gloves(TRUE));
@@ -2826,7 +2826,7 @@ use_trap(struct obj *otmp)
int levtyp = levl[u.ux][u.uy].typ;
const char *occutext = "setting the trap";
- if (nohands(gy.youmonst.data))
+ if (nohands(u.umonst->data))
what = "without hands";
else if (Stunned)
what = "while stunned";
@@ -3108,7 +3108,7 @@ use_whip(struct obj *obj)
cc.y = ry;
You("wrap your bullwhip around %s.", wrapped_what);
if (proficient && rn2(proficient + 2)) {
- if (!mtmp || enexto(&cc, rx, ry, gy.youmonst.data)) {
+ if (!mtmp || enexto(&cc, rx, ry, u.umonst->data)) {
You("yank yourself out of the pit!");
reset_utrap(TRUE); /* [was after teleds(); do this before
* in case it has no alternative other
@@ -3192,7 +3192,7 @@ use_whip(struct obj *obj)
so proficient at catching weapons */
int dam, hitvalu, hitu;
- dam = dmgval(otmp, &gy.youmonst);
+ dam = dmgval(otmp, u.umonst);
hitvalu = 8 + otmp->spe;
hitu = thitu(hitvalu, Maybe_Half_Phys(dam),
&otmp, (char *) 0);
@@ -3210,7 +3210,7 @@ use_whip(struct obj *obj)
if (otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm]) && !uarmg
&& !Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
char kbuf[BUFSZ];
@@ -3581,7 +3581,7 @@ use_cream_pie(struct obj *obj)
You("immerse your %s in %s%s.", body_part(FACE),
several ? "one of " : "",
several ? makeplural(the(xname(obj))) : the(xname(obj)));
- if (can_blnd((struct monst *) 0, &gy.youmonst, AT_WEAP, obj)) {
+ if (can_blnd((struct monst *) 0, u.umonst, AT_WEAP, obj)) {
int blindinc = rnd(25);
u.ucreamed += blindinc;
@@ -3921,7 +3921,7 @@ do_break_wand(struct obj *obj)
boolean is_fragile = (objdescr_is(obj, "balsa")
|| objdescr_is(obj, "glass"));
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You_cant("break %s without hands!", yname(obj));
return ECMD_OK;
} else if (!freehand()) {
@@ -4216,7 +4216,7 @@ doapply(void)
struct obj *obj;
int res = ECMD_TIME;
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You("aren't able to use or apply tools in your current form.");
return ECMD_OK;
}
diff --git a/src/artifact.c b/src/artifact.c
index e0e3df173..17715e10c 100644
--- a/src/artifact.c
+++ b/src/artifact.c
@@ -914,7 +914,7 @@ touch_artifact(struct obj *obj, struct monst *mon)
if (oart == &artilist[ART_NONARTIFACT])
return 1;
- yours = (mon == &gy.youmonst);
+ yours = (mon == u.umonst);
/* all quest artifacts are self-willed; if this ever changes, `badclass'
will have to be extended to explicitly include quest artifacts */
self_willed = ((oart->spfx & SPFX_INTEL) != 0);
@@ -1014,7 +1014,7 @@ spec_applies(const struct artifact *weap, struct monst *mtmp)
if (!(weap->spfx & (SPFX_DBONUS | SPFX_ATTK)))
return (weap->attk.adtyp == AD_PHYS);
- yours = (mtmp == &gy.youmonst);
+ yours = (mtmp == u.umonst);
ptr = mtmp->data;
if (weap->spfx & SPFX_DMONS) {
@@ -1256,8 +1256,8 @@ Mb_hit(struct monst *magr, /* attacker */
{
struct permonst *old_mdat;
const char *verb;
- boolean youattack = (magr == &gy.youmonst),
- youdefend = (mdef == &gy.youmonst),
+ boolean youattack = (magr == u.umonst),
+ youdefend = (mdef == u.umonst),
resisted = FALSE, do_stun, do_confuse, result;
int attack_indx, fakeidx, scare_dieroll = MB_MAX_DIEROLL / 2;
@@ -1313,7 +1313,7 @@ Mb_hit(struct monst *magr, /* attacker */
/* now perform special effects */
switch (attack_indx) {
case MB_INDEX_CANCEL:
- old_mdat = youdefend ? gy.youmonst.data : mdef->data;
+ old_mdat = youdefend ? u.umonst->data : mdef->data;
/* No mdef->mcan check: even a cancelled monster can be polymorphed
* into a golem, and the "cancel" effect acts as if some magical
* energy remains in spellcasting defenders to be absorbed later.
@@ -1323,7 +1323,7 @@ Mb_hit(struct monst *magr, /* attacker */
} else {
do_stun = FALSE;
if (youdefend) {
- if (gy.youmonst.data != old_mdat)
+ if (u.umonst->data != old_mdat)
*dmgptr = 0; /* rehumanized, so no more damage */
if (u.uenmax > 0) {
u.uenmax--;
@@ -1359,7 +1359,7 @@ Mb_hit(struct monst *magr, /* attacker */
nomul(-3);
gm.multi_reason = "being scared stiff";
gn.nomovemsg = "";
- if (magr && magr == u.ustuck && sticks(gy.youmonst.data)) {
+ if (magr && magr == u.ustuck && sticks(u.umonst->data)) {
set_ustuck((struct monst *) 0);
You("release %s!", mon_nam(magr));
}
@@ -1445,14 +1445,14 @@ DISABLE_WARNING_FORMAT_NONLITERAL
*/
boolean
artifact_hit(
- struct monst *magr, /* attacker; might be Null if 'mdef' is youmonst */
+ struct monst *magr, /* attacker; might be Null if 'mdef' is u.umonst */
struct monst *mdef, /* defender */
struct obj *otmp, /* artifact weapon */
int *dmgptr, /* output */
int dieroll) /* needed for Magicbane and vorpal blades */
{
- boolean youattack = (magr == &gy.youmonst);
- boolean youdefend = (mdef == &gy.youmonst);
+ boolean youattack = (magr == u.umonst);
+ boolean youdefend = (mdef == u.umonst);
boolean vis = (!youattack && magr && cansee(magr->mx, magr->my))
|| (!youdefend && cansee(mdef->mx, mdef->my))
|| (youattack && engulfing_u(mdef) && !Blind);
@@ -1575,7 +1575,7 @@ artifact_hit(
observe_object(otmp);
return TRUE;
} else {
- if (bigmonst(gy.youmonst.data)) {
+ if (bigmonst(u.umonst->data)) {
pline("%s cuts deeply into you!",
magr ? Monnam(magr) : wepdesc);
*dmgptr *= 2;
@@ -1622,14 +1622,14 @@ artifact_hit(
observe_object(otmp);
return TRUE;
} else {
- if (!has_head(gy.youmonst.data)) {
+ if (!has_head(u.umonst->data)) {
pline("Somehow, %s misses you wildly.",
magr ? mon_nam(magr) : wepdesc);
*dmgptr = 0;
return TRUE;
}
- if (noncorporeal(gy.youmonst.data)
- || amorphous(gy.youmonst.data)) {
+ if (noncorporeal(u.umonst->data)
+ || amorphous(u.umonst->data)) {
pline("%s slices through your %s.", wepdesc,
body_part(NECK));
return TRUE;
@@ -2517,11 +2517,11 @@ retouch_object(
return 1;
}
- if (touch_artifact(obj, &gy.youmonst)) {
+ if (touch_artifact(obj, u.umonst)) {
char buf[BUFSZ];
int dmg = 0, tmp;
boolean ag = (objects[obj->otyp].oc_material == SILVER && Hate_silver),
- bane = bane_applies(get_artifact(obj), &gy.youmonst);
+ bane = bane_applies(get_artifact(obj), u.umonst);
/* nothing else to do if hero can successfully handle this object */
if (!ag && !bane)
@@ -2776,7 +2776,7 @@ is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */
struct obj *obj)
{
if (is_art(obj, ART_MASTER_KEY_OF_THIEVERY)) {
- if ((mon == &gy.youmonst) ? Role_if(PM_ROGUE)
+ if ((mon == u.umonst) ? Role_if(PM_ROGUE)
: (mon && mon->data == &mons[PM_ROGUE]))
return !obj->cursed; /* a rogue; non-cursed suffices for magic */
/* not a rogue; key must be blessed to behave as a magic one */
@@ -2785,7 +2785,7 @@ is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */
return FALSE;
}
-/* figure out whether 'mon' (usually youmonst) is carrying the magic key */
+/* figure out whether 'mon' (usually u.umonst) is carrying the magic key */
struct obj *
has_magic_key(struct monst *mon) /* if null, hero assumed */
{
@@ -2793,8 +2793,8 @@ has_magic_key(struct monst *mon) /* if null, hero assumed */
short key = artilist[ART_MASTER_KEY_OF_THIEVERY].otyp;
if (!mon)
- mon = &gy.youmonst;
- for (o = ((mon == &gy.youmonst) ? gi.invent : mon->minvent); o;
+ mon = u.umonst;
+ for (o = ((mon == u.umonst) ? gi.invent : mon->minvent); o;
o = nxtobj(o, key, FALSE)) {
if (is_magic_key(mon, o))
return o;
diff --git a/src/attrib.c b/src/attrib.c
index 27f454fd8..bebb46327 100644
--- a/src/attrib.c
+++ b/src/attrib.c
@@ -893,7 +893,7 @@ is_innate(int propidx)
ignore innateness if equipment is going to claim responsibility */
&& !u.uprops[propidx].extrinsic)
return FROM_ROLE;
- if ((propidx == BLINDED && !haseyes(gy.youmonst.data))
+ if ((propidx == BLINDED && !haseyes(u.umonst->data))
|| (propidx == BLND_RES && (HBlnd_resist & FROMFORM) != 0))
return FROM_FORM;
return FROM_NONE;
@@ -1219,7 +1219,7 @@ acurr(int chridx)
there would limit Str to 18/07 [18 + 7] */
result = max(tmp, 3);
} else if (chridx == A_CHA) {
- if (tmp < 18 && (gy.youmonst.data->mlet == S_NYMPH
+ if (tmp < 18 && (u.umonst->data->mlet == S_NYMPH
|| u.umonnum == PM_AMOROUS_DEMON))
result = 18;
} else if (chridx == A_CON) {
diff --git a/src/botl.c b/src/botl.c
index 66c4b8950..b6e72c896 100644
--- a/src/botl.c
+++ b/src/botl.c
@@ -256,7 +256,7 @@ bot(void)
return;
/* dosave() flags completion by setting u.uhp to -1; suppress_map_output()
covers program_state.restoring and is used for status as well as map */
- if (u.uhp != -1 && gy.youmonst.data
+ if (u.uhp != -1 && u.umonst->data
&& iflags.status_updates && !suppress_map_output()) {
if (VIA_WINDOWPORT()) {
bot_via_windowport();
@@ -487,7 +487,7 @@ weapon_status(char *outbuf)
/* no weapon; gloves imply hands; humanoid also implies hands;
otherwise make no assumptions */
res = uarmg ? "Empty-hnd" /* empty handed means "gloves only" */
- : humanoid(gy.youmonst.data) ? "Bare-hnds" /* bare hands */
+ : humanoid(u.umonst->data) ? "Bare-hnds" /* bare hands */
: "No-weapon";
} else if (u.twoweap) {
/* two-weaponing implies hands and a weapon or wep-tool
@@ -1179,7 +1179,7 @@ bot_via_windowport(void)
#else
test_if_enabled(bl_held) = TRUE;
#endif
- } else if (Upolyd && sticks(gy.youmonst.data)) {
+ } else if (Upolyd && sticks(u.umonst->data)) {
test_if_enabled(bl_holding) = TRUE;
} else {
/* grab == hero is held by sea monster and about to be drowned;
diff --git a/src/cmd.c b/src/cmd.c
index de20c283b..93edbe4b9 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -889,7 +889,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL
int
domonability(void)
{
- struct permonst *uptr = gy.youmonst.data;
+ struct permonst *uptr = u.umonst->data;
boolean might_hide = (is_hider(uptr) || hides_under(uptr));
char c = '\0';
@@ -917,12 +917,12 @@ domonability(void)
return domindblast();
else if (u.umonnum == PM_GREMLIN) {
if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) {
- if (split_mon(&gy.youmonst, (struct monst *) 0))
+ if (split_mon(u.umonst, (struct monst *) 0))
dryup(u.ux, u.uy, TRUE);
} else if (is_pool(u.ux, u.uy)) {
/* is_pool: might be wearing water walking boots or amulet of
magical breathing */
- (void) split_mon(&gy.youmonst, (struct monst *) 0);
+ (void) split_mon(u.umonst, (struct monst *) 0);
} else {
There("is no fountain here.");
}
@@ -935,7 +935,7 @@ domonability(void)
pline("Unfortunately sound does not carry well through rock.");
else
aggravate();
- } else if (is_vampire(uptr) || is_vampshifter(&gy.youmonst)) {
+ } else if (is_vampire(uptr) || is_vampshifter(u.umonst)) {
return dopoly();
} else if (u.usteed && can_breathe(u.usteed->data)) {
(void) pet_ranged_attk(u.usteed, TRUE);
diff --git a/src/dbridge.c b/src/dbridge.c
index 72d39be82..6afcac7d5 100644
--- a/src/dbridge.c
+++ b/src/dbridge.c
@@ -320,10 +320,10 @@ m_to_e(struct monst *mtmp, coordxy x, coordxy y, struct entity *etmp)
staticfn void
u_to_e(struct entity *etmp)
{
- etmp->emon = &gy.youmonst;
+ etmp->emon = u.umonst;
etmp->ex = u.ux;
etmp->ey = u.uy;
- etmp->edata = gy.youmonst.data;
+ etmp->edata = u.umonst->data;
}
staticfn void
@@ -337,7 +337,7 @@ set_entity(
m_to_e(m_at(x, y), x, y, etmp);
}
-#define is_u(etmp) (etmp->emon == &gy.youmonst)
+#define is_u(etmp) (etmp->emon == u.umonst)
#define e_canseemon(etmp) (is_u(etmp) || canseemon(etmp->emon))
/*
diff --git a/src/decl.c b/src/decl.c
index 66f3d060e..14a92abb3 100644
--- a/src/decl.c
+++ b/src/decl.c
@@ -842,7 +842,6 @@ static const struct instance_globals_x g_init_x = {
static const struct instance_globals_y g_init_y = {
/* decl.c */
(ROWNO - 1) & ~1, /* y_maze_max */
- DUMMY, /* youmonst */
/* pline.c */
NULL, /* you_buf */
0, /* you_buf_siz */
diff --git a/src/detect.c b/src/detect.c
index bf536e127..ea077b91a 100644
--- a/src/detect.c
+++ b/src/detect.c
@@ -386,7 +386,7 @@ gold_detect(struct obj *sobj)
adjust message if you have gold in your inventory */
char buf[BUFSZ];
- if (gy.youmonst.data == &mons[PM_GOLD_GOLEM])
+ if (u.umonst->data == &mons[PM_GOLD_GOLEM])
Sprintf(buf, "You feel like a million %s!", currency(2L));
else if (money_cnt(gi.invent) || hidden_gold(TRUE))
Strcpy(buf,
@@ -1227,7 +1227,7 @@ use_crystal_ball(struct obj **optr)
make_confused((HConfusion & TIMEOUT) + impair, FALSE);
break;
case 3:
- if (!resists_blnd(&gy.youmonst)) {
+ if (!resists_blnd(u.umonst)) {
pline("%s your vision!", Tobjnam(obj, "damage"));
make_blinded(BlindedTimeout + impair, FALSE);
if (!Blind)
@@ -1776,7 +1776,7 @@ openone(coordxy zx, coordxy zy, genericptr_t num)
newsym(zx, zy);
(*num_p)++;
}
- mon = u_at(zx, zy) ? &gy.youmonst : m_at(zx, zy);
+ mon = u_at(zx, zy) ? u.umonst : m_at(zx, zy);
if (openholdingtrap(mon, &dummy)
|| openfallingtrap(mon, TRUE, &dummy))
(*num_p)++;
diff --git a/src/dig.c b/src/dig.c
index 5e5fc1a74..1c0ff6ceb 100644
--- a/src/dig.c
+++ b/src/dig.c
@@ -200,7 +200,7 @@ is_digging(void)
return FALSE;
}
-#define BY_YOU (&gy.youmonst)
+#define BY_YOU (u.umonst)
#define BY_OBJECT ((struct monst *) 0)
enum digcheck_result
@@ -392,7 +392,7 @@ dig(void)
} else if (ttmp && ttmp->ttyp == BEAR_TRAP && u.utrap) {
if (rnl(7) > (Fumbling ? 1 : 4)) {
char kbuf[BUFSZ];
- int dmg = dmgval(uwep, &gy.youmonst) + dbon();
+ int dmg = dmgval(uwep, u.umonst) + dbon();
if (dmg < 1)
dmg = 1;
@@ -2181,8 +2181,8 @@ rot_corpse(anything *arg, long timeout)
&& hides_under(mtmp->data)) {
mtmp->mundetected = 0;
} else if (u_at(x, y)
- && u.uundetected && hides_under(gy.youmonst.data))
- (void) hideunder(&gy.youmonst);
+ && u.uundetected && hides_under(u.umonst->data))
+ (void) hideunder(u.umonst);
newsym(x, y);
} else if (in_invent)
update_inventory();
@@ -2241,27 +2241,27 @@ void
escape_tomb(void)
{
debugpline0("escape_tomb");
- if ((Teleportation || can_teleport(gy.youmonst.data))
+ if ((Teleportation || can_teleport(u.umonst->data))
&& (Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell.");
(void) dotele(FALSE); /* calls unearth_you() */
} else if (u.uburied) { /* still buried after 'port attempt */
boolean good;
- if (amorphous(gy.youmonst.data) || Passes_walls
- || noncorporeal(gy.youmonst.data)
- || (unsolid(gy.youmonst.data)
- && gy.youmonst.data != &mons[PM_WATER_ELEMENTAL])
- || (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))) {
+ if (amorphous(u.umonst->data) || Passes_walls
+ || noncorporeal(u.umonst->data)
+ || (unsolid(u.umonst->data)
+ && u.umonst->data != &mons[PM_WATER_ELEMENTAL])
+ || (tunnels(u.umonst->data) && !needspick(u.umonst->data))) {
You("%s up through the %s.",
- (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))
+ (tunnels(u.umonst->data) && !needspick(u.umonst->data))
? "try to tunnel"
- : (amorphous(gy.youmonst.data))
+ : (amorphous(u.umonst->data))
? "ooze"
: "phase",
surface(u.ux, u.uy));
- good = (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))
+ good = (tunnels(u.umonst->data) && !needspick(u.umonst->data))
? dighole(TRUE, FALSE, (coord *) 0) : TRUE;
if (good)
unearth_you();
diff --git a/src/do.c b/src/do.c
index cacab11c7..b5aac1445 100644
--- a/src/do.c
+++ b/src/do.c
@@ -228,7 +228,7 @@ flooreffects(
}
mtmp->mtrapped = 0;
} else {
- if (!Passes_walls && !throws_rocks(gy.youmonst.data)) {
+ if (!Passes_walls && !throws_rocks(u.umonst->data)) {
losehp(Maybe_Half_Phys(rnd(15)),
"squished under a boulder", NO_KILLER_PREFIX);
goto deletedwithboulder;
@@ -1110,7 +1110,7 @@ staticfn boolean
u_stuck_cannot_go(const char *updn)
{
if (u.ustuck) {
- if (u.uswallow || !sticks(gy.youmonst.data)) {
+ if (u.uswallow || !sticks(u.umonst->data)) {
You("are %s, and cannot go %s.",
!u.uswallow ? "being held"
: digests(u.ustuck->data) ? "swallowed"
@@ -1257,7 +1257,7 @@ dodown(void)
const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through";
const char *actn = u_locomotion("jump");
- if (gy.youmonst.data->msize >= MZ_HUGE) {
+ if (u.umonst->data->msize >= MZ_HUGE) {
char qbuf[QBUFSZ];
You("don't fit %s easily.", down_or_thru);
@@ -1426,7 +1426,7 @@ u_collide_m(struct monst *mtmp)
it was already here. Randomly move you to an adjacent spot
or else the monster to any nearby location. Prior to 3.3.0
the latter was done unconditionally. */
- if (!rn2(2) && enexto(&cc, u.ux, u.uy, gy.youmonst.data)
+ if (!rn2(2) && enexto(&cc, u.ux, u.uy, u.umonst->data)
&& next2u(cc.x, cc.y))
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
else
@@ -2008,7 +2008,7 @@ hellish_smoke_mesg(void)
if (In_hell(&u.uz) && svl.level.flags.temperature > 0)
You("%s smoke...",
- olfaction(gy.youmonst.data) ? "smell" : "sense");
+ olfaction(u.umonst->data) ? "smell" : "sense");
}
/* give a message when the level temperature is different from previous */
diff --git a/src/do_name.c b/src/do_name.c
index c27396343..b69b56e4d 100644
--- a/src/do_name.c
+++ b/src/do_name.c
@@ -689,7 +689,7 @@ namefloorobj(void)
been moved off the hero's '@' yet, but there's no way to adjust
the help text once getpos() has started */
Sprintf(buf, "object on map (or '.' for one %s you)",
- (u.uundetected && hides_under(gy.youmonst.data))
+ (u.uundetected && hides_under(u.umonst->data))
? "over" : "under");
if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0)
return;
@@ -840,7 +840,7 @@ x_monnam(
mappear_as_mon = (M_AP_TYPE(mtmp) == M_AP_MONSTER);
char *bp, buf2[BUFSZ];
- if (mtmp == &gy.youmonst)
+ if (mtmp == u.umonst)
return strcpy(buf, "you"); /* ignore article, "invisible", &c */
if (program_state.gameover)
@@ -1290,7 +1290,7 @@ Mgender(struct monst *mtmp)
{
int mgender = MALE;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
if (Upolyd ? u.mfemale : flags.female)
mgender = FEMALE;
} else if (mtmp->female) {
diff --git a/src/do_wear.c b/src/do_wear.c
index 382b17741..59e62927d 100644
--- a/src/do_wear.c
+++ b/src/do_wear.c
@@ -281,7 +281,7 @@ Boots_off(void)
/* check for lava since fireproofed boots make it viable */
if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))
&& !Levitation && !Flying
- && !(is_clinger(gy.youmonst.data) && has_ceiling(&u.uz))
+ && !(is_clinger(u.umonst->data) && has_ceiling(&u.uz))
&& !svc.context.takeoff.cancelled_don
/* avoid recursive call to lava_effects() */
&& !iflags.in_lava_effects) {
@@ -1035,7 +1035,7 @@ Amulet_on(struct obj *amul)
}
case AMULET_OF_STRANGULATION:
/* note: might already be Strangled (via #wizintrinsic) */
- if (can_be_strangled(&gy.youmonst) && !Strangled) {
+ if (can_be_strangled(u.umonst) && !Strangled) {
makeknown(AMULET_OF_STRANGULATION);
Strangled = 6L;
disp.botl = TRUE;
@@ -1118,7 +1118,7 @@ Amulet_off(void)
early_off_msg = TRUE;
if (Underwater) {
- if (!cant_drown(gy.youmonst.data) && !Swimming) {
+ if (!cant_drown(u.umonst->data) && !Swimming) {
You("suddenly inhale an unhealthy amount of %s!",
hliquid("water"));
mkn = TRUE; /* in case of life-saving */
@@ -2034,7 +2034,7 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
/* this is the same check as for 'W' (dowear), but different message,
in case we get here via 'P' (doputon) */
- if (verysmall(gy.youmonst.data) || nohands(gy.youmonst.data)) {
+ if (verysmall(u.umonst->data) || nohands(u.umonst->data)) {
if (noisy)
You("can't wear any armor in your current form.");
return 0;
@@ -2044,13 +2044,13 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
: is_shirt(otmp) ? c_shirt
: is_suit(otmp) ? c_suit
: 0;
- if (which && cantweararm(gy.youmonst.data)
+ if (which && cantweararm(u.umonst->data)
/* same exception for cloaks as used in m_dowear() */
&& (which != c_cloak
|| ((otmp->otyp != MUMMY_WRAPPING)
- ? gy.youmonst.data->msize != MZ_SMALL
- : !WrappingAllowed(gy.youmonst.data)))
- && (racial_exception(&gy.youmonst, otmp) < 1)) {
+ ? u.umonst->data->msize != MZ_SMALL
+ : !WrappingAllowed(u.umonst->data)))
+ && (racial_exception(u.umonst, otmp) < 1)) {
if (noisy)
pline_The("%s will not fit on your body.", which);
return 0;
@@ -2072,12 +2072,12 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
if (noisy)
already_wearing(an(helm_simple_name(uarmh)));
err++;
- } else if (Upolyd && has_horns(gy.youmonst.data) && !is_flimsy(otmp)) {
+ } else if (Upolyd && has_horns(u.umonst->data) && !is_flimsy(otmp)) {
/* (flimsy exception matches polyself handling) */
if (noisy)
pline_The("%s won't fit over your horn%s.",
helm_simple_name(otmp),
- plur(num_horns(gy.youmonst.data)));
+ plur(num_horns(u.umonst->data)));
err++;
} else
*mask = W_ARMH;
@@ -2104,11 +2104,11 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
if (noisy)
already_wearing(c_boots);
err++;
- } else if (Upolyd && slithy(gy.youmonst.data)) {
+ } else if (Upolyd && slithy(u.umonst->data)) {
if (noisy)
You("have no feet..."); /* not body_part(FOOT) */
err++;
- } else if (Upolyd && gy.youmonst.data->mlet == S_CENTAUR) {
+ } else if (Upolyd && u.umonst->data->mlet == S_CENTAUR) {
/* break_armor() pushes boots off for centaurs, so don't let
dowear() put them back on;
makeplural(body_part(FOOT)) would yield "rear hooves" here,
@@ -2251,13 +2251,13 @@ accessory_or_armor_on(struct obj *obj)
char answer, qbuf[QBUFSZ];
int res = 0;
- if (nolimbs(gy.youmonst.data)) {
+ if (nolimbs(u.umonst->data)) {
You("cannot make the ring stick to your body.");
return ECMD_OK;
}
if (uleft && uright) {
There("are no more %s%s to fill.",
- humanoid(gy.youmonst.data) ? "ring-" : "",
+ humanoid(u.umonst->data) ? "ring-" : "",
fingers_or_gloves(FALSE));
return ECMD_OK;
}
@@ -2268,7 +2268,7 @@ accessory_or_armor_on(struct obj *obj)
} else {
do {
Sprintf(qbuf, "Which %s%s, Right or Left?",
- humanoid(gy.youmonst.data) ? "ring-" : "",
+ humanoid(u.umonst->data) ? "ring-" : "",
body_part(FINGER));
answer = yn_function(qbuf, rightleftchars, '\0', TRUE);
switch (answer) {
@@ -2321,7 +2321,7 @@ accessory_or_armor_on(struct obj *obj)
return ECMD_OK;
}
} else if (eyewear) {
- if (!has_head(gy.youmonst.data)) {
+ if (!has_head(u.umonst->data)) {
You("have no head to wear %s on.", ansimpleoname(obj));
return ECMD_OK;
}
@@ -2435,7 +2435,7 @@ dowear(void)
/* cantweararm() checks for suits of armor, not what we want here;
verysmall() or nohands() checks for shields, gloves, etc... */
- if (verysmall(gy.youmonst.data) || nohands(gy.youmonst.data)) {
+ if (verysmall(u.umonst->data) || nohands(u.umonst->data)) {
pline("Don't even bother.");
return ECMD_OK;
}
@@ -2459,7 +2459,7 @@ doputon(void)
&& uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf) {
/* 'P' message doesn't mention armor */
Your("%s%s are full, and you're already wearing an amulet and %s.",
- humanoid(gy.youmonst.data) ? "ring-" : "",
+ humanoid(u.umonst->data) ? "ring-" : "",
fingers_or_gloves(FALSE),
(ublindf->otyp == LENSES) ? "some lenses" : "a blindfold");
return ECMD_OK;
@@ -2544,7 +2544,7 @@ glibr(void)
rightfall = (uright && !uright->cursed && (!welded(uwep)));
*/
- if (!uarmg && (leftfall || rightfall) && !nolimbs(gy.youmonst.data)) {
+ if (!uarmg && (leftfall || rightfall) && !nolimbs(u.umonst->data)) {
/* changed so cursed rings don't fall off, GAN 10/30/86 */
Your("%s off your %s.",
(leftfall && rightfall) ? "rings slip" : "ring slips",
@@ -2631,22 +2631,22 @@ some_armor(struct monst *victim)
{
struct obj *otmph, *otmp;
- otmph = (victim == &gy.youmonst) ? uarmc : which_armor(victim, W_ARMC);
+ otmph = (victim == u.umonst) ? uarmc : which_armor(victim, W_ARMC);
if (!otmph)
- otmph = (victim == &gy.youmonst) ? uarm : which_armor(victim, W_ARM);
+ otmph = (victim == u.umonst) ? uarm : which_armor(victim, W_ARM);
if (!otmph)
- otmph = (victim == &gy.youmonst) ? uarmu : which_armor(victim, W_ARMU);
+ otmph = (victim == u.umonst) ? uarmu : which_armor(victim, W_ARMU);
- otmp = (victim == &gy.youmonst) ? uarmh : which_armor(victim, W_ARMH);
+ otmp = (victim == u.umonst) ? uarmh : which_armor(victim, W_ARMH);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
- otmp = (victim == &gy.youmonst) ? uarmg : which_armor(victim, W_ARMG);
+ otmp = (victim == u.umonst) ? uarmg : which_armor(victim, W_ARMG);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
- otmp = (victim == &gy.youmonst) ? uarmf : which_armor(victim, W_ARMF);
+ otmp = (victim == u.umonst) ? uarmf : which_armor(victim, W_ARMF);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
- otmp = (victim == &gy.youmonst) ? uarms : which_armor(victim, W_ARMS);
+ otmp = (victim == u.umonst) ? uarms : which_armor(victim, W_ARMS);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
return otmph;
@@ -2664,7 +2664,7 @@ stuck_ring(struct obj *ring, int otyp)
if (ring && ring->otyp == otyp) {
/* reasons ring can't be removed match those checked by select_off();
limbless case has extra checks because ordinarily it's temporary */
- if (nolimbs(gy.youmonst.data) && uamul
+ if (nolimbs(u.umonst->data) && uamul
&& uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
return uamul;
if (welded(uwep) && ((ring == RING_ON_PRIMARY) || bimanual(uwep)))
@@ -2706,7 +2706,7 @@ select_off(struct obj *otmp)
if (otmp == uright || otmp == uleft) {
struct obj glibdummy;
- if (nolimbs(gy.youmonst.data)) {
+ if (nolimbs(u.umonst->data)) {
pline_The("ring is stuck.");
return 0;
}
diff --git a/src/dog.c b/src/dog.c
index a583de705..f9676050c 100644
--- a/src/dog.c
+++ b/src/dog.c
@@ -1181,7 +1181,7 @@ tamedog(
if (mtmp == u.ustuck) {
if (u.uswallow)
expels(mtmp, mtmp->data, TRUE);
- else if (!(Upolyd && sticks(gy.youmonst.data)))
+ else if (!(Upolyd && sticks(u.umonst->data)))
unstuck(mtmp);
}
@@ -1239,7 +1239,7 @@ tamedog(
with each other anymore] */
|| mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion
|| is_covetous(mtmp->data) || is_human(mtmp->data)
- || (is_demon(mtmp->data) && !is_demon(gy.youmonst.data))
+ || (is_demon(mtmp->data) && !is_demon(u.umonst->data))
|| (obj && dogfood(mtmp, obj) >= MANFOOD))
return FALSE;
@@ -1309,7 +1309,7 @@ wary_dog(struct monst *mtmp, boolean was_dead)
if (!rn2(edog->abuse + 1))
mtmp->mpeaceful = 1;
if (!quietly && cansee(mtmp->mx, mtmp->my)) {
- if (haseyes(gy.youmonst.data)) {
+ if (haseyes(u.umonst->data)) {
if (haseyes(mtmp->data))
pline_mon(mtmp,
"%s %s to look you in the %s.", Monnam(mtmp),
diff --git a/src/dogmove.c b/src/dogmove.c
index 1218c305e..fa209f1d3 100644
--- a/src/dogmove.c
+++ b/src/dogmove.c
@@ -675,7 +675,7 @@ find_targ(
break;
if (curx == mtmp->mux && cury == mtmp->muy)
- return &gy.youmonst;
+ return u.umonst;
if ((targ = m_at(curx, cury)) != 0) {
/* Is the monster visible to the pet? */
@@ -778,7 +778,7 @@ score_targ(struct monst *mtmp, struct monst *mtarg)
return score;
}
/* Is the monster peaceful or tame? */
- if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == &gy.youmonst) {
+ if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == u.umonst) {
/* Pets will never be targeted */
score -= 3000L;
return score;
@@ -907,7 +907,7 @@ pet_ranged_attk(struct monst *mtmp, boolean forced)
if (mtarg && (!hungry || !rn2(5))) {
int mstatus = M_ATTK_MISS;
- if (mtarg == &gy.youmonst) {
+ if (mtarg == u.umonst) {
if (mattacku(mtmp))
return MMOVE_DIED;
/* Treat this as the pet having initiated an attack even if it
@@ -931,7 +931,7 @@ pet_ranged_attk(struct monst *mtmp, boolean forced)
* nothing will happen.
*/
if ((mstatus & M_ATTK_HIT) && !(mstatus & M_ATTK_DEF_DIED)
- && rn2(4) && mtarg != &gy.youmonst) {
+ && rn2(4) && mtarg != u.umonst) {
/* Can monster see? If it can, it can retaliate
* even if the pet is invisible, since it'll see
@@ -1054,7 +1054,7 @@ dog_move(
}
#if 0 /* [this is now handled in dochug()] */
if (!Conflict && !mtmp->mconf
- && mtmp == u.ustuck && !sticks(gy.youmonst.data)) {
+ && mtmp == u.ustuck && !sticks(u.umonst->data)) {
unstuck(mtmp); /* swallowed case handled above */
You("get released!");
}
diff --git a/src/dokick.c b/src/dokick.c
index 45d0b097c..e20f83100 100644
--- a/src/dokick.c
+++ b/src/dokick.c
@@ -6,7 +6,7 @@
#define is_bigfoot(x) ((x) == &mons[PM_SASQUATCH])
#define martial() \
- (martial_bonus() || is_bigfoot(gy.youmonst.data) \
+ (martial_bonus() || is_bigfoot(u.umonst->data) \
|| (uarmf && uarmf->otyp == KICKING_BOOTS))
/* gk.kickedobj (decl.c) tracks a kicked object until placed or destroyed */
@@ -53,7 +53,7 @@ kickdmg(struct monst *mon, boolean clumsy)
if (mon->data == &mons[PM_SHADE])
dmg = 0;
- specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF, (long *) 0);
+ specialdmg = special_dmgval(u.umonst, mon, W_ARMF, (long *) 0);
if (mon->data == &mons[PM_SHADE] && !specialdmg) {
pline_The("%s.", kick_passes_thru);
@@ -180,7 +180,7 @@ kick_monster(struct monst *mon, coordxy x, coordxy y)
* normally, getting all your attacks _including_ all your kicks.
* If you have >1 kick attack, you get all of them.
*/
- if (Upolyd && attacktype(gy.youmonst.data, AT_KICK)) {
+ if (Upolyd && attacktype(u.umonst->data, AT_KICK)) {
struct attack *uattk;
int sum, kickdieroll, armorpenalty, specialdmg,
attknum = 0,
@@ -194,13 +194,13 @@ kick_monster(struct monst *mon, coordxy x, coordxy y)
if (gm.multi < 0)
break;
- uattk = &gy.youmonst.data->mattk[i];
+ uattk = &u.umonst->data->mattk[i];
/* we only care about kicking attacks here */
if (uattk->aatyp != AT_KICK)
continue;
kickdieroll = rnd(20);
- specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF,
+ specialdmg = special_dmgval(u.umonst, mon, W_ARMF,
(long *) 0);
if (mon->data == &mons[PM_SHADE] && !specialdmg) {
/* doesn't matter whether it would have hit or missed,
@@ -545,7 +545,7 @@ really_kick_object(coordxy x, coordxy y)
You("kick %s with your bare %s.",
corpse_xname(gk.kickedobj, (const char *) 0, CXN_PFX_THE),
makeplural(body_part(FOOT)));
- if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
+ if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) {
; /* hero has been transformed but kick continues */
} else {
/* normalize body shape here; foot, not body_part(FOOT) */
@@ -924,7 +924,7 @@ kick_door(coordxy x, coordxy y, int avrg_attrib)
}
exercise(A_DEX, TRUE);
- doorbuster = Upolyd && is_giant(gy.youmonst.data);
+ doorbuster = Upolyd && is_giant(u.umonst->data);
/* door is known to be CLOSED or LOCKED */
if (doorbuster
|| (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX)))) {
@@ -1262,10 +1262,10 @@ dokick(void)
struct monst *mtmp;
boolean no_kick = FALSE;
- if (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data)) {
+ if (nolimbs(u.umonst->data) || slithy(u.umonst->data)) {
You("have no legs to kick with.");
no_kick = TRUE;
- } else if (verysmall(gy.youmonst.data)) {
+ } else if (verysmall(u.umonst->data)) {
You("are too small to do any kicking.");
no_kick = TRUE;
} else if (u.usteed) {
@@ -1282,7 +1282,7 @@ dokick(void)
} else if (near_capacity() > SLT_ENCUMBER) {
Your("load is too heavy to balance yourself for a kick.");
no_kick = TRUE;
- } else if (gy.youmonst.data->mlet == S_LIZARD) {
+ } else if (u.umonst->data->mlet == S_LIZARD) {
Your("legs cannot kick effectively.");
no_kick = TRUE;
} else if (u.uinwater && !rn2(2)) {
@@ -1429,7 +1429,7 @@ dokick(void)
int range;
range =
- ((int) gy.youmonst.data->cwt + (weight_cap() + inv_weight()));
+ ((int) u.umonst->data->cwt + (weight_cap() + inv_weight()));
if (range < 1)
range = 1; /* divide by zero avoidance */
range = (3 * (int) mdat->cwt) / range;
diff --git a/src/dothrow.c b/src/dothrow.c
index 952913a43..e3ff3457c 100644
--- a/src/dothrow.c
+++ b/src/dothrow.c
@@ -125,7 +125,7 @@ throw_obj(struct obj *obj, int shotlimit)
goto unsplit_stack;
}
if ((is_art(obj, ART_MJOLLNIR) && ACURR(A_STR) < STR19(25))
- || (obj->otyp == BOULDER && !throws_rocks(gy.youmonst.data))) {
+ || (obj->otyp == BOULDER && !throws_rocks(u.umonst->data))) {
pline("It's too heavy.");
res = ECMD_TIME;
goto unsplit_stack;
@@ -299,10 +299,10 @@ ok_to_throw(int *shotlimit_p) /* (see dothrow()) */
*shotlimit_p = LIMIT_TO_RANGE_INT(0, LARGEST_INT, gc.command_count);
gm.multi = 0; /* reset; it's been used up */
- if (notake(gy.youmonst.data)) {
+ if (notake(u.umonst->data)) {
You("are physically incapable of throwing or shooting anything.");
return FALSE;
- } else if (nohands(gy.youmonst.data)) {
+ } else if (nohands(u.umonst->data)) {
You_cant("throw or shoot without hands."); /* not body_part(HAND) */
return FALSE;
/*[what about !freehand(), aside from cursed missile launcher?]*/
@@ -341,7 +341,7 @@ throw_ok(struct obj *obj)
if (uslinging() && obj->oclass == GEM_CLASS)
return GETOBJ_SUGGEST;
- if (throws_rocks(gy.youmonst.data) && obj->otyp == BOULDER)
+ if (throws_rocks(u.umonst->data) && obj->otyp == BOULDER)
return GETOBJ_SUGGEST;
return GETOBJ_DOWNPLAY;
@@ -820,12 +820,12 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
why = "touching the edge of the universe";
You("smack into something!");
} else if (diagonal
- && bad_rock(gy.youmonst.data, u.ux, y)
- && bad_rock(gy.youmonst.data, x, u.uy)) {
+ && bad_rock(u.umonst->data, u.ux, y)
+ && bad_rock(u.umonst->data, x, u.uy)) {
boolean too_much = (gi.invent
&& (inv_weight() + weight_cap() > WT_TOOMUCH_DIAGONAL));
- if (bigmonst(gy.youmonst.data) || too_much) {
+ if (bigmonst(u.umonst->data) || too_much) {
why = "wedging into a narrow crevice";
You("%sget forcefully wedged into a crevice.",
too_much ? "and all your belongings " : "");
@@ -874,7 +874,7 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
an(pmname(mon->data, NEUTRAL)));
instapetrify(svk.killer.name);
}
- if (touch_petrifies(gy.youmonst.data)
+ if (touch_petrifies(u.umonst->data)
&& !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) {
minstapetrify(mon, TRUE);
}
@@ -883,8 +883,8 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
}
if ((u.ux - x) && (u.uy - y)
- && bad_rock(gy.youmonst.data, u.ux, y)
- && bad_rock(gy.youmonst.data, x, u.uy)) {
+ && bad_rock(u.umonst->data, u.ux, y)
+ && bad_rock(u.umonst->data, x, u.uy)) {
/* Move at a diagonal. */
if (Sokoban) {
You("come to an abrupt halt!");
@@ -1045,7 +1045,7 @@ mhurtle_step(genericptr_t arg, coordxy x, coordxy y)
pline("%s bumps into you.", Some_Monnam(mon));
stop_occupation();
/* check whether 'mon' is turned to stone by touching poly'd hero */
- if (Upolyd && touch_petrifies(gy.youmonst.data)
+ if (Upolyd && touch_petrifies(u.umonst->data)
&& !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) {
/* give poly'd hero credit/blame despite a monster causing it */
minstapetrify(mon, TRUE);
@@ -1287,14 +1287,14 @@ toss_up(struct obj *obj, boolean hitsroof)
/* object now hits you */
if (obj->oclass == POTION_CLASS) {
- potionhit(&gy.youmonst, obj, POTHIT_HERO_THROW);
+ potionhit(u.umonst, obj, POTHIT_HERO_THROW);
} else if (breaktest(obj)) {
int blindinc;
/* need to check for blindness result prior to destroying obj */
blindinc = ((otyp == CREAM_PIE || otyp == BLINDING_VENOM)
/* AT_WEAP is ok here even if attack type was AT_SPIT */
- && can_blnd(&gy.youmonst, &gy.youmonst, AT_WEAP, obj))
+ && can_blnd(u.umonst, u.umonst, AT_WEAP, obj))
? rnd(25)
: 0;
breakmsg(obj, !Blind);
@@ -1304,7 +1304,7 @@ toss_up(struct obj *obj, boolean hitsroof)
switch (otyp) {
case EGG:
if (petrifier && !Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
/* egg ends up "all over your face"; perhaps
visored helmet should still save you here */
@@ -1344,13 +1344,13 @@ toss_up(struct obj *obj, boolean hitsroof)
less_damage = (hard_helmet(uarmh)
&& (!is_silver || !Hate_silver)),
harmless = (stone_missile(obj)
- && passes_rocks(gy.youmonst.data)),
+ && passes_rocks(u.umonst->data)),
artimsg = FALSE;
- int dmg = dmgval(obj, &gy.youmonst);
+ int dmg = dmgval(obj, u.umonst);
if (obj->oartifact && !harmless)
/* need a fake die roll here; rn1(18,2) avoids 1 and 20 */
- artimsg = artifact_hit((struct monst *) 0, &gy.youmonst, obj,
+ artimsg = artifact_hit((struct monst *) 0, u.umonst, obj,
&dmg, rn1(18, 2));
if (!dmg) { /* probably wasn't a weapon; base damage on weight */
@@ -1364,9 +1364,9 @@ toss_up(struct obj *obj, boolean hitsroof)
dmgval()'s artifact light against gremlin or axe against
woody creature since both involve weapons; hero-as-shade is
hypothetical because hero can't polymorph into that form */
- if (gy.youmonst.data == &mons[PM_SHADE] && !is_silver)
+ if (u.umonst->data == &mons[PM_SHADE] && !is_silver)
dmg = 0;
- if (obj->blessed && mon_hates_blessings(&gy.youmonst))
+ if (obj->blessed && mon_hates_blessings(u.umonst))
dmg += rnd(4);
if (is_silver && Hate_silver)
dmg += rnd(20);
@@ -1399,7 +1399,7 @@ toss_up(struct obj *obj, boolean hitsroof)
harmless, but hitting a worn helmet negates that */
harmless = FALSE;
} else if (petrifier && !Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
petrify:
svk.killer.format = KILLED_BY;
@@ -1415,7 +1415,7 @@ toss_up(struct obj *obj, boolean hitsroof)
if (is_silver && Hate_silver)
pline_The("silver sears you!");
if (harmless)
- hit(thesimpleoname(obj), &gy.youmonst, " but doesn't hurt.");
+ hit(thesimpleoname(obj), u.umonst, " but doesn't hurt.");
hitfloor(obj, TRUE);
gt.thrownobj = 0;
@@ -1603,7 +1603,7 @@ throwit(
hurtle(-u.dx, -u.dy, 1, TRUE);
mon = boomhit(obj, u.dx, u.dy);
iflags.returning_missile = 0; /* has returned or isn't going to */
- if (mon == &gy.youmonst) { /* the thing was caught */
+ if (mon == u.umonst) { /* the thing was caught */
exercise(A_DEX, TRUE);
obj = return_throw_to_inv(obj, wep_mask, twoweap, oldslot);
throwit_return(TRUE);
@@ -1743,7 +1743,7 @@ throwit(
body_part(ARM));
if (obj->oartifact)
(void) artifact_hit((struct monst *) 0,
- &gy.youmonst, obj, &dmg, 0);
+ u.umonst, obj, &dmg, 0);
losehp(Maybe_Half_Phys(dmg), killer_xname(obj),
KILLED_BY);
}
@@ -2034,7 +2034,7 @@ thitmonst(
* Distance and monster size affect chance to hit.
*/
tmp = -1 + Luck + find_mac(mon) + u.uhitinc
- + maybe_polyd(gy.youmonst.data->mlevel, u.ulevel);
+ + maybe_polyd(u.umonst->data->mlevel, u.ulevel);
if (ACURR(A_DEX) < 4)
tmp -= 3;
else if (ACURR(A_DEX) < 6)
@@ -2073,7 +2073,7 @@ thitmonst(
tmp += omon_adj(mon, obj, TRUE);
if (is_orc(mon->data)
- && maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
+ && maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF)))
tmp++;
if (guaranteed_hit) {
tmp += 1000; /* Guaranteed hit */
@@ -2170,7 +2170,7 @@ thitmonst(
* Polymorphing won't make you a bow expert.
*/
if ((Race_if(PM_ELF) || Role_if(PM_SAMURAI))
- && (!Upolyd || your_race(gy.youmonst.data))
+ && (!Upolyd || your_race(u.umonst->data))
&& objects[uwep->otyp].oc_skill == P_BOW) {
++tmp;
if ((Race_if(PM_ELF) && uwep->otyp == ELVEN_BOW)
@@ -2500,16 +2500,16 @@ breakobj(
if (obj->otyp == POT_OIL && obj->lamplit) {
explode_oil(obj, x, y);
} else if (next2u(x, y)) {
- if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data)) {
+ if (!breathless(u.umonst->data) || haseyes(u.umonst->data)) {
/* wet towel protects both eyes and breathing */
if (obj->otyp != POT_WATER && !Half_gas_damage) {
- if (!breathless(gy.youmonst.data)) {
+ if (!breathless(u.umonst->data)) {
/* [what about "familiar odor" when known?] */
You("smell a peculiar odor...");
} else {
const char *eyes = body_part(EYE);
- if (eyecount(gy.youmonst.data) != 1)
+ if (eyecount(u.umonst->data) != 1)
eyes = makeplural(eyes);
Your("%s %s.", eyes, vtense(eyes, "water"));
}
diff --git a/src/eat.c b/src/eat.c
index e62a2ffea..1b58c316f 100644
--- a/src/eat.c
+++ b/src/eat.c
@@ -97,12 +97,12 @@ is_edible(struct obj *obj)
/* above also prevents the Amulet from being eaten, so we must never
allow fake amulets to be eaten either [which is already the case] */
- if (gy.youmonst.data == &mons[PM_FIRE_ELEMENTAL]
+ if (u.umonst->data == &mons[PM_FIRE_ELEMENTAL]
&& is_flammable(obj))
return TRUE;
- if (metallivorous(gy.youmonst.data) && is_metallic(obj)
- && (gy.youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj)))
+ if (metallivorous(u.umonst->data) && is_metallic(obj)
+ && (u.umonst->data != &mons[PM_RUST_MONSTER] || is_rustprone(obj)))
return TRUE;
/* Ghouls only eat non-veggy corpses or eggs (see dogfood()) */
@@ -170,7 +170,7 @@ eatmdone(void)
}
/* update display */
if (U_AP_TYPE) {
- gy.youmonst.m_ap_type = M_AP_NOTHING;
+ u.umonst->m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy);
}
return 0;
@@ -186,11 +186,11 @@ eatmupdate(void)
if (!ge.eatmbuf || gn.nomovemsg != ge.eatmbuf)
return;
- if (is_obj_mappear(&gy.youmonst,ORANGE) && !Hallucination) {
+ if (is_obj_mappear(u.umonst,ORANGE) && !Hallucination) {
/* revert from hallucinatory to "normal" mimicking */
altmsg = "You now prefer mimicking yourself.";
altapp = GOLD_PIECE;
- } else if (is_obj_mappear(&gy.youmonst,GOLD_PIECE) && Hallucination) {
+ } else if (is_obj_mappear(u.umonst,GOLD_PIECE) && Hallucination) {
/* won't happen; anything which might make immobilized
hero begin hallucinating (black light attack, theft
of Grayswandir) will terminate the mimicry first */
@@ -207,7 +207,7 @@ eatmupdate(void)
}
gn.nomovemsg = strcpy(ge.eatmbuf, altmsg);
/* update current image */
- gy.youmonst.mappearance = altapp;
+ u.umonst->mappearance = altapp;
newsym(u.ux, u.uy);
}
}
@@ -343,12 +343,12 @@ adj_victual_nutrition(void)
assert(nut > 0);
if (otyp == LEMBAS_WAFER) {
- if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
+ if (maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF)))
nut += (nut + 2) / 4; /* 800 -> 1000 */
- else if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC)))
+ else if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC)))
nut -= (nut + 2) / 4; /* 800 -> 600 */
} else if (otyp == CRAM_RATION) {
- if (maybe_polyd(is_dwarf(gy.youmonst.data), Race_if(PM_DWARF)))
+ if (maybe_polyd(is_dwarf(u.umonst->data), Race_if(PM_DWARF)))
nut += (nut + 3) / 6; /* 600 -> 700 */
}
nut = max(nut, 1);
@@ -554,7 +554,7 @@ done_eating(boolean message)
gn.nomovemsg = 0;
} else if (message) {
You("finish %s %s.",
- (gy.youmonst.data == &mons[PM_FIRE_ELEMENTAL]) ? "consuming"
+ (u.umonst->data == &mons[PM_FIRE_ELEMENTAL]) ? "consuming"
: "eating",
food_xname(piece, TRUE));
}
@@ -612,18 +612,18 @@ eat_brains(
/* previous tentacle attack might have triggered fatal passive
counterattack [callers ought to be updated to avoid this situation] */
- if (magr != &gy.youmonst && DEADMONSTER(magr)) {
+ if (magr != u.umonst && DEADMONSTER(magr)) {
return M_ATTK_AGR_DIED;
}
if (noncorporeal(pd)) {
if (visflag)
pline("%s brain is unharmed.",
- (mdef == &gy.youmonst) ? "Your" : s_suffix(Monnam(mdef)));
+ (mdef == u.umonst) ? "Your" : s_suffix(Monnam(mdef)));
return M_ATTK_MISS; /* side-effects can't occur */
- } else if (magr == &gy.youmonst) {
+ } else if (magr == u.umonst) {
You("eat %s brain!", s_suffix(mon_nam(mdef)));
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
Your("brain is eaten!");
} else { /* monster against monster */
if (visflag && canspotmon(mdef))
@@ -634,7 +634,7 @@ eat_brains(
/* mind flayer has attempted to eat the brains of a petrification
inducing critter (most likely Medusa; attacking a cockatrice via
tentacle-touch should have been caught before reaching this far) */
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
if (!Stone_resistance && !Stoned)
make_stoned(5L, (char *) 0, KILLED_BY_AN,
pmname(pd, Mgender(mdef)));
@@ -656,7 +656,7 @@ eat_brains(
}
}
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/*
* player mind flayer is eating something's brain
*/
@@ -690,7 +690,7 @@ eat_brains(
is cannibalism */
(void) maybe_cannibal(monsndx(pd), TRUE);
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/*
* monster mind flayer is eating hero's brain
*/
@@ -773,7 +773,7 @@ maybe_cannibal(int pm, boolean allowmsg)
(even if having the form of something which doesn't care
about cannibalism--hero's innate traits aren't altered) */
&& (your_race(fptr)
- || (Upolyd && same_race(gy.youmonst.data, fptr))
+ || (Upolyd && same_race(u.umonst->data, fptr))
|| (ismnum(u.ulycn) && were_beastie(pm) == u.ulycn))) {
if (allowmsg) {
if (Upolyd && your_race(fptr))
@@ -793,7 +793,7 @@ cprefx(int pm)
(void) maybe_cannibal(pm, TRUE);
if (flesh_petrifies(&mons[pm])) {
if (!Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
/* if food was a tin, use it up early to keep it out of bones */
if (svc.context.tin.tin)
@@ -849,7 +849,7 @@ cprefx(int pm)
return;
}
case PM_GREEN_SLIME:
- if (!Slimed && !Unchanging && !slimeproof(gy.youmonst.data)) {
+ if (!Slimed && !Unchanging && !slimeproof(u.umonst->data)) {
You("don't feel very well.");
make_slimed(10L, (char *) 0);
delayed_killer(SLIMED, KILLED_BY_AN, "");
@@ -1191,7 +1191,7 @@ cpostfx(int pm)
/*FALLTHRU*/
case PM_SMALL_MIMIC:
tmp += 20;
- if (gy.youmonst.data->mlet != S_MIMIC && !Unchanging) {
+ if (u.umonst->data->mlet != S_MIMIC && !Unchanging) {
char buf[BUFSZ];
const char *tempshape = !Hallucination ? "a pile of gold"
: "an orange";
@@ -1210,14 +1210,14 @@ cpostfx(int pm)
Hallucination
? "You suddenly dread being peeled and mimic %s again!"
: "You now prefer mimicking %s again.",
- an(Upolyd ? pmname(gy.youmonst.data, Ugender)
+ an(Upolyd ? pmname(u.umonst->data, Ugender)
: gu.urace.noun));
ge.eatmbuf = dupstr(buf);
gn.nomovemsg = ge.eatmbuf;
ga.afternmv = eatmdone;
/* ??? what if this was set before? */
- gy.youmonst.m_ap_type = M_AP_OBJECT;
- gy.youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE;
+ u.umonst->m_ap_type = M_AP_OBJECT;
+ u.umonst->mappearance = Hallucination ? ORANGE : GOLD_PIECE;
newsym(u.ux, u.uy);
curs_on_u();
/* make gold symbol show up now */
@@ -1253,7 +1253,7 @@ cpostfx(int pm)
if (svc.context.tin.tin) {
use_up_tin(svc.context.tin.tin);
/* most tin effects end up being skipped */
- lesshungry(200 + (metallivorous(gy.youmonst.data) ? 5 : 0));
+ lesshungry(200 + (metallivorous(u.umonst->data) ? 5 : 0));
}
You("%s.", (pm == PM_GENETIC_ENGINEER)
@@ -1530,7 +1530,7 @@ consume_tin(const char *mesg)
const char *what;
int which, mnum, r, nutamt;
/* if you've eaten tin itself, chance to not eat contents gets bypassed */
- boolean always_eat = metallivorous(gy.youmonst.data);
+ boolean always_eat = metallivorous(u.umonst->data);
struct obj *tin = svc.context.tin.tin;
r = tin_variety(tin, FALSE);
@@ -1725,10 +1725,10 @@ start_tin(struct obj *otmp)
const char *mesg = 0;
int tmp;
- if (metallivorous(gy.youmonst.data)) {
+ if (metallivorous(u.umonst->data)) {
mesg = "You bite right into the metal tin...";
tmp = 0;
- } else if (cantwield(gy.youmonst.data)) { /* nohands || verysmall */
+ } else if (cantwield(u.umonst->data)) { /* nohands || verysmall */
You("cannot handle the tin properly to open it.");
return;
} else if (otmp->blessed) {
@@ -1859,12 +1859,12 @@ eatcorpse(struct obj *otmp)
int ll_conduct = 0;
boolean stoneable,
slimeable = (mnum == PM_GREEN_SLIME && !Slimed && !Unchanging
- && !slimeproof(gy.youmonst.data)),
+ && !slimeproof(u.umonst->data)),
glob = otmp->globby ? TRUE : FALSE;
assert(ismnum(mnum));
stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
- && !poly_when_stoned(gy.youmonst.data));
+ && !poly_when_stoned(u.umonst->data));
/* KMH, conduct */
if (!vegan(&mons[mnum]))
@@ -1978,13 +1978,13 @@ eatcorpse(struct obj *otmp)
} else {
/* yummy is always False for omnivores, palatable always True */
boolean yummy = (vegan(&mons[mnum])
- ? (!carnivorous(gy.youmonst.data)
- && herbivorous(gy.youmonst.data))
- : (carnivorous(gy.youmonst.data)
- && !herbivorous(gy.youmonst.data))),
+ ? (!carnivorous(u.umonst->data)
+ && herbivorous(u.umonst->data))
+ : (carnivorous(u.umonst->data)
+ && !herbivorous(u.umonst->data))),
palatable = ((vegetarian(&mons[mnum])
- ? herbivorous(gy.youmonst.data)
- : carnivorous(gy.youmonst.data))
+ ? herbivorous(u.umonst->data)
+ : carnivorous(u.umonst->data))
&& rn2(10)
&& (rotted < 1 || !rn2((int) rotted + 1)));
const char *pmxnam = food_xname(otmp, FALSE);
@@ -2129,9 +2129,9 @@ fprefx(struct obj *otmp)
/* [satiation message may be inaccurate if eating gets interrupted] */
break;
case TRIPE_RATION:
- if (carnivorous(gy.youmonst.data) && !humanoid(gy.youmonst.data)) {
+ if (carnivorous(u.umonst->data) && !humanoid(u.umonst->data)) {
pline("This tripe ration is surprisingly good!");
- } else if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC))) {
+ } else if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC))) {
pline(Hallucination ? "Tastes great! Less filling!"
: "Mmm, tripe... not bad!");
} else {
@@ -2146,10 +2146,10 @@ fprefx(struct obj *otmp)
}
break;
case LEMBAS_WAFER:
- if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC))) {
+ if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC))) {
pline("%s", "!#?&* elf kibble!");
break;
- } else if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF))) {
+ } else if (maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF))) {
pline("A little goes a long way.");
break;
}
@@ -2160,7 +2160,7 @@ fprefx(struct obj *otmp)
case MEAT_RING:
goto give_feedback;
case CLOVE_OF_GARLIC:
- if (is_undead(gy.youmonst.data)) {
+ if (is_undead(u.umonst->data)) {
make_vomiting((long) rn1(svc.context.victual.reqtime, 5), FALSE);
break;
}
@@ -2293,7 +2293,7 @@ eataccessory(struct obj *otmp)
set_mimic_blocking();
see_monsters();
if (Invis && !oldprop && !ESee_invisible
- && !perceives(gy.youmonst.data) && !Blind) {
+ && !perceives(u.umonst->data) && !Blind) {
newsym(u.ux, u.uy);
pline("Suddenly you can see yourself.");
makeknown(typ);
@@ -2511,7 +2511,7 @@ fpostfx(struct obj *otmp)
{
switch (otmp->otyp) {
case SPRIG_OF_WOLFSBANE:
- if (ismnum(u.ulycn) || is_were(gy.youmonst.data))
+ if (ismnum(u.ulycn) || is_were(u.umonst->data))
you_unwere(TRUE);
break;
case CARROT:
@@ -2527,7 +2527,7 @@ fpostfx(struct obj *otmp)
"became literate by reading the fortune inside a cookie");
break;
case LUMP_OF_ROYAL_JELLY:
- if (gy.youmonst.data == &mons[PM_KILLER_BEE] && !Unchanging
+ if (u.umonst->data == &mons[PM_KILLER_BEE] && !Unchanging
&& polymon(PM_QUEEN_BEE))
break;
@@ -2561,7 +2561,7 @@ fpostfx(struct obj *otmp)
if (ismnum(otmp->corpsenm)
&& flesh_petrifies(&mons[otmp->corpsenm])) {
if (!Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
if (!Stoned) {
Sprintf(svk.killer.name, "%s egg",
@@ -2646,10 +2646,10 @@ edibility_prompts(struct obj *otmp)
stoneorslime = (ismnum(mnum)
&& flesh_petrifies(&mons[mnum])
&& !Stone_resistance
- && !poly_when_stoned(gy.youmonst.data));
+ && !poly_when_stoned(u.umonst->data));
if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME)
- stoneorslime = (!Unchanging && !slimeproof(gy.youmonst.data));
+ stoneorslime = (!Unchanging && !slimeproof(u.umonst->data));
if (cadaver && !nonrotting_corpse(mnum)) {
long age = peek_at_iced_corpse_age(otmp);
@@ -2870,7 +2870,7 @@ doeat(void)
You_cant("eat %s you're wearing.", something);
return ECMD_OK;
} else if (!(carried(otmp) ? retouch_object(&otmp, FALSE)
- : touch_artifact(otmp, &gy.youmonst))) {
+ : touch_artifact(otmp, u.umonst))) {
return ECMD_TIME; /* got blasted so use a turn */
}
if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER
@@ -3172,9 +3172,9 @@ gethungry(void)
will need to wear an Amulet of Unchanging so still burn a small
amount of nutrition in the 'moves % 20' ring/amulet check below */
if ((!Unaware || !rn2(10)) /* slow metabolic rate while asleep */
- && (carnivorous(gy.youmonst.data)
- || herbivorous(gy.youmonst.data)
- || metallivorous(gy.youmonst.data))
+ && (carnivorous(u.umonst->data)
+ || herbivorous(u.umonst->data)
+ || metallivorous(u.umonst->data))
&& !Slow_digestion)
u.uhunger--; /* ordinary food consumption */
@@ -3583,7 +3583,7 @@ floorfood(
struct obj *otmp;
char qbuf[QBUFSZ];
char c;
- struct permonst *uptr = gy.youmonst.data;
+ struct permonst *uptr = u.umonst->data;
boolean feeding = !strcmp(verb, "eat"), /* corpsecheck==0 */
offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */
@@ -3737,7 +3737,7 @@ vomit(void) /* A good idea from David Neves */
{
boolean spewed = FALSE;
- if (cantvomit(gy.youmonst.data)) {
+ if (cantvomit(u.umonst->data)) {
/* doesn't cure food poisoning; message assumes that we aren't
dealing with some esoteric body_part() */
Your("jaw gapes convulsively.");
@@ -3764,7 +3764,7 @@ vomit(void) /* A good idea from David Neves */
if (spewed) {
struct attack
- *mattk = attacktype_fordmg(gy.youmonst.data, AT_BREA, AD_ACID);
+ *mattk = attacktype_fordmg(u.umonst->data, AT_BREA, AD_ACID);
/* currently, only yellow dragons can breathe acid */
if (mattk) {
@@ -3775,7 +3775,7 @@ vomit(void) /* A good idea from David Neves */
if (IS_ALTAR(levl[u.ux][u.uy].typ))
altar_wrath(u.ux, u.uy);
/* if poly'd into acidic form, stomach acid is stronger than normal */
- if (acidic(gy.youmonst.data)) {
+ if (acidic(u.umonst->data)) {
/* TODO: if there's a web here, destroy that too (before ice) */
if (is_ice(u.ux, u.uy))
melt_ice(u.ux, u.uy,
diff --git a/src/end.c b/src/end.c
index 389d8f548..ff67412eb 100644
--- a/src/end.c
+++ b/src/end.c
@@ -747,7 +747,7 @@ savelife(int how)
/* might drop hero onto a trap that kills her all over again */
expels(u.ustuck, u.ustuck->data, TRUE);
} else if (u.ustuck) {
- if (Upolyd && sticks(gy.youmonst.data))
+ if (Upolyd && sticks(u.umonst->data))
You("release %s.", mon_nam(u.ustuck));
else
pline("%s releases you.", Monnam(u.ustuck));
diff --git a/src/engrave.c b/src/engrave.c
index 22ca30aaf..9768b00b6 100644
--- a/src/engrave.c
+++ b/src/engrave.c
@@ -189,7 +189,7 @@ can_reach_floor(boolean check_pit)
struct trap *t;
if (u.uswallow
- || (u.ustuck && !sticks(gy.youmonst.data)
+ || (u.ustuck && !sticks(u.umonst->data)
/* assume that arms are pinned rather than that the hero
has been lifted up above the floor [doesn't explain
how hero can attack the creature holding him or her;
@@ -200,10 +200,10 @@ can_reach_floor(boolean check_pit)
/* Restricted/unskilled riders can't reach the floor */
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
return FALSE;
- if (u.uundetected && ceiling_hider(gy.youmonst.data))
+ if (u.uundetected && ceiling_hider(u.umonst->data))
return FALSE;
- if (Flying || gy.youmonst.data->msize >= MZ_HUGE)
+ if (Flying || u.umonst->data->msize >= MZ_HUGE)
return TRUE;
if (check_pit && (t = t_at(u.ux, u.uy)) != 0
@@ -531,7 +531,7 @@ u_can_engrave(void)
return FALSE;
}
- if (cantwield(gy.youmonst.data)) {
+ if (cantwield(u.umonst->data)) {
You_cant("even hold anything!");
return FALSE;
}
@@ -570,7 +570,7 @@ doengrave_ctx_init(struct _doengrave_ctx *de)
if (de->oep)
de->oetype = de->oep->engr_type;
- if (is_demon(gy.youmonst.data) || is_vampire(gy.youmonst.data))
+ if (is_demon(u.umonst->data) || is_vampire(u.umonst->data))
de->type = ENGR_BLOOD;
de->jello = (u.uswallow && !(is_animal(u.ustuck->data)
@@ -1245,7 +1245,7 @@ doengrave(void)
if (de->post_engr_text[0])
pline("%s", de->post_engr_text);
- if (de->doblind && !resists_blnd(&gy.youmonst)) {
+ if (de->doblind && !resists_blnd(u.umonst)) {
You("are blinded by the flash!");
make_blinded((long) rnd(50), FALSE);
if (!Blind)
diff --git a/src/exper.c b/src/exper.c
index aee851126..14312e691 100644
--- a/src/exper.c
+++ b/src/exper.c
@@ -213,7 +213,7 @@ losexp(
wizard mode request to reduce level; never fatal though */
if (drainer && !strcmp(drainer, "#levelchange"))
drainer = 0;
- else if (resists_drli(&gy.youmonst))
+ else if (resists_drli(u.umonst))
return;
/* level-loss message; "Goodbye level 1." is fatal; divine anger
@@ -280,7 +280,7 @@ losexp(
u.uexp = newuexp(u.ulevel) - 1;
if (Upolyd) {
- num = monhp_per_lvl(&gy.youmonst);
+ num = monhp_per_lvl(u.umonst);
u.mhmax -= num;
u.mh -= num;
if (u.mh <= 0)
@@ -317,7 +317,7 @@ pluslvl(
/* increase hit points (when polymorphed, do monster form first
in order to retain normal human/whatever increase for later) */
if (Upolyd) {
- hpinc = monhp_per_lvl(&gy.youmonst);
+ hpinc = monhp_per_lvl(u.umonst);
u.mh += hpinc;
setuhpmax(u.mhmax, FALSE); /* acts as setmhmax() when Upolyd */
}
diff --git a/src/explode.c b/src/explode.c
index 70f4c8307..41ef8a4df 100644
--- a/src/explode.c
+++ b/src/explode.c
@@ -24,13 +24,13 @@ enum explode_action {
/* check if shield effects are needed for location affected by explosion */
staticfn int
explosionmask(
- struct monst *m, /* target monster (might be youmonst) */
+ struct monst *m, /* target monster (might be u.umonst) */
uchar adtyp, /* damage type */
char olet) /* object class (only matters for AD_DISN) */
{
int res = EXPL_NONE;
- if (m == &gy.youmonst) {
+ if (m == u.umonst) {
switch (adtyp) {
case AD_PHYS:
/* leave 'res' with EXPL_NONE */
@@ -274,7 +274,7 @@ explode(
so might get hit by double damage */
grabbed = grabbing = FALSE;
if (u.ustuck && !u.uswallow) {
- if (Upolyd && sticks(gy.youmonst.data))
+ if (Upolyd && sticks(u.umonst->data))
grabbing = TRUE;
else
grabbed = TRUE;
@@ -363,7 +363,7 @@ explode(
explmask[i][j] = EXPL_NONE;
if (u_at(xx, yy)) {
- explmask[i][j] = explosionmask(&gy.youmonst, adtyp, olet);
+ explmask[i][j] = explosionmask(u.umonst, adtyp, olet);
}
/* can be both you and mtmp if you're swallowed or riding */
mtmp = m_at(xx, yy);
@@ -611,10 +611,10 @@ explode(
} else if (adtyp == AD_PHYS || adtyp == AD_ACID)
damu = Maybe_Half_Phys(damu);
if (adtyp == AD_FIRE) {
- (void) burnarmor(&gy.youmonst);
+ (void) burnarmor(u.umonst);
ignite_items(gi.invent);
}
- (void) destroy_items(&gy.youmonst, (int) adtyp, dam);
+ (void) destroy_items(u.umonst, (int) adtyp, dam);
ugolemeffects((int) adtyp, damu);
if (uhurt == 2) {
@@ -869,9 +869,9 @@ scatter(
if (gm.multi)
nomul(0);
- dam = dmgval(stmp->obj, &gy.youmonst);
+ dam = dmgval(stmp->obj, u.umonst);
hitvalu = 8 + stmp->obj->spe;
- if (bigmonst(gy.youmonst.data))
+ if (bigmonst(u.umonst->data))
hitvalu++;
hitu = thitu(hitvalu, Maybe_Half_Phys(dam),
&stmp->obj, (char *) 0);
@@ -936,8 +936,8 @@ scatter(
newsym(x, y);
}
newsym(sx, sy);
- if (u_at(sx, sy) && u.uundetected && hides_under(gy.youmonst.data))
- (void) hideunder(&gy.youmonst);
+ if (u_at(sx, sy) && u.uundetected && hides_under(u.umonst->data))
+ (void) hideunder(u.umonst);
if (((mtmp = m_at(sx, sy)) != 0) && mtmp->mtrapped)
mtmp->mtrapped = 0;
maybe_unhide_at(sx, sy);
diff --git a/src/fountain.c b/src/fountain.c
index 78925b04c..aeef118bb 100644
--- a/src/fountain.c
+++ b/src/fountain.c
@@ -791,7 +791,7 @@ dipsink(struct obj *obj)
breathless for this message */
pline("A wisp of vapor rises up...");
/* NB: potionbreathe calls trycall or makeknown as appropriate */
- if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
+ if (!breathless(u.umonst->data) || haseyes(u.umonst->data))
potionbreathe(obj);
break;
}
diff --git a/src/hack.c b/src/hack.c
index 367591eff..4e5ff410b 100644
--- a/src/hack.c
+++ b/src/hack.c
@@ -152,11 +152,11 @@ could_move_onto_boulder(coordxy sx, coordxy sy)
return FALSE;
/* can if a giant, unless doing so allows hero to pass into a
diagonal squeeze at the same time */
- if (throws_rocks(gy.youmonst.data))
+ if (throws_rocks(u.umonst->data))
return (!u.dx || !u.dy || !(IS_OBSTRUCTED(levl[u.ux][sy].typ)
&& IS_OBSTRUCTED(levl[sx][u.uy].typ)));
/* can if tiny (implies carrying very little else couldn't move at all) */
- if (verysmall(gy.youmonst.data))
+ if (verysmall(u.umonst->data))
return TRUE;
/* can squeeze to spot if carrying extremely little, otherwise can't */
return squeezeablylightinvent();
@@ -189,7 +189,7 @@ dopush(
|| svm.moves < gb.bldrpushtime);
what = givemesg ? the(xname(otmp)) : 0;
if (!u.usteed) {
- easypush = throws_rocks(gy.youmonst.data);
+ easypush = throws_rocks(u.umonst->data);
if (givemesg)
pline("With %s effort you move %s.",
easypush ? "little" : "great", what);
@@ -261,7 +261,7 @@ cannot_push_msg(struct obj *otmp, coordxy sx, coordxy sy)
staticfn int
cannot_push(struct obj *otmp, coordxy sx, coordxy sy)
{
- if (throws_rocks(gy.youmonst.data)) {
+ if (throws_rocks(u.umonst->data)) {
boolean
canpickup = (!Sokoban
/* similar exception as in can_lift():
@@ -388,7 +388,7 @@ moverock_core(coordxy sx, coordxy sy)
int res;
feel_location(sx, sy); /* same for all 3 if/else-if/else cases */
- if (throws_rocks(gy.youmonst.data)) {
+ if (throws_rocks(u.umonst->data)) {
/* player has used 'm
' to move, so step to boulder's
spot without pushing it; hero is poly'd into a giant,
so exotic forms of locomotion are out, but might be
@@ -423,7 +423,7 @@ moverock_core(coordxy sx, coordxy sy)
/* Give them a chance to climb over it? */
return -1;
}
- if (verysmall(gy.youmonst.data) && !u.usteed) {
+ if (verysmall(u.umonst->data) && !u.usteed) {
if (Blind)
feel_location(sx, sy);
pline("You're too small to push that %s.", xname(otmp));
@@ -667,7 +667,7 @@ still_chewing(coordxy x, coordxy y)
nomul(0);
return 1;
} else if (lev->typ == IRONBARS
- && metallivorous(gy.youmonst.data) && u.uhunger > 1500) {
+ && metallivorous(u.umonst->data) && u.uhunger > 1500) {
/* finishing eating via 'morehungry()' doesn't handle choking */
You("are too full to eat the bars.");
nomul(0);
@@ -767,7 +767,7 @@ still_chewing(coordxy x, coordxy y)
digtxt = "chew through the tree.";
lev->typ = ROOM;
} else if (lev->typ == IRONBARS) {
- if (metallivorous(gy.youmonst.data)) { /* should always be True here */
+ if (metallivorous(u.umonst->data)) { /* should always be True here */
/* arbitrary amount; unlike proper eating, nutrition is
bestowed in a lump sum at the end */
int nut = (int) objects[HEAVY_IRON_BALL].oc_weight;
@@ -955,7 +955,7 @@ cant_squeeze_thru(struct monst *mon)
int amt;
struct permonst *ptr = mon->data;
- if ((mon == &gy.youmonst) ? Passes_walls : passes_walls(ptr))
+ if ((mon == u.umonst) ? Passes_walls : passes_walls(ptr))
return 0;
/* too big? */
@@ -965,13 +965,13 @@ cant_squeeze_thru(struct monst *mon)
return 1;
/* lugging too much junk? */
- amt = (mon == &gy.youmonst) ? inv_weight() + weight_cap()
+ amt = (mon == u.umonst) ? inv_weight() + weight_cap()
: curr_mon_load(mon);
if (amt > WT_TOOMUCH_DIAGONAL)
return 2;
/* Sokoban restriction applies to hero only */
- if (mon == &gy.youmonst && Sokoban)
+ if (mon == u.umonst && Sokoban)
return 3;
/* can squeeze through */
@@ -1023,19 +1023,19 @@ test_move(
return FALSE;
} else if (tmpr->typ == IRONBARS) {
if (mode == DO_MOVE
- && (dmgtype(gy.youmonst.data, AD_RUST)
- || dmgtype(gy.youmonst.data, AD_CORR)
- || metallivorous(gy.youmonst.data))
+ && (dmgtype(u.umonst->data, AD_RUST)
+ || dmgtype(u.umonst->data, AD_CORR)
+ || metallivorous(u.umonst->data))
&& still_chewing(x, y)) {
return FALSE;
}
- if (!(Passes_walls || passes_bars(gy.youmonst.data))) {
+ if (!(Passes_walls || passes_bars(u.umonst->data))) {
if (mode == DO_MOVE && flags.mention_walls)
You("cannot pass through the bars.");
return FALSE;
}
- } else if (tunnels(gy.youmonst.data)
- && !needspick(gy.youmonst.data)) {
+ } else if (tunnels(u.umonst->data)
+ && !needspick(u.umonst->data)) {
/* Eat the rock. */
if (mode == DO_MOVE && still_chewing(x, y))
return FALSE;
@@ -1077,21 +1077,21 @@ test_move(
feel_location(x, y);
if (Passes_walls) {
; /* do nothing */
- } else if (can_ooze(&gy.youmonst)) {
+ } else if (can_ooze(u.umonst)) {
if (mode == DO_MOVE)
You("ooze under the door.");
} else if (Underwater) {
if (mode == DO_MOVE)
pline("There is an obstacle there.");
return FALSE;
- } else if (tunnels(gy.youmonst.data)
- && !needspick(gy.youmonst.data)) {
+ } else if (tunnels(u.umonst->data)
+ && !needspick(u.umonst->data)) {
/* Eat the door. */
if (mode == DO_MOVE && still_chewing(x, y))
return FALSE;
} else {
if (mode == DO_MOVE) {
- if (amorphous(gy.youmonst.data))
+ if (amorphous(u.umonst->data))
You("try to ooze under the door,"
" but can't squeeze your possessions through.");
if (flags.autoopen && !svc.context.run
@@ -1150,10 +1150,10 @@ test_move(
}
}
}
- if (dx && dy && bad_rock(gy.youmonst.data, ux, y)
- && bad_rock(gy.youmonst.data, x, uy)) {
+ if (dx && dy && bad_rock(u.umonst->data, ux, y)
+ && bad_rock(u.umonst->data, x, uy)) {
/* Move at a diagonal. */
- switch (cant_squeeze_thru(&gy.youmonst)) {
+ switch (cant_squeeze_thru(u.umonst)) {
case 3:
if (mode == DO_MOVE)
You("cannot pass that way.");
@@ -1222,7 +1222,7 @@ test_move(
}
if (mode == DO_MOVE) {
/* tunneling monsters will chew before pushing */
- if (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data)
+ if (tunnels(u.umonst->data) && !needspick(u.umonst->data)
&& !Sokoban) {
if (still_chewing(x, y))
return FALSE;
@@ -1239,8 +1239,8 @@ test_move(
if (sobj_at(BOULDER, ux, uy) && !Sokoban) {
if (!Passes_walls
&& !could_move_onto_boulder(ux, uy)
- && !(tunnels(gy.youmonst.data)
- && !needspick(gy.youmonst.data))
+ && !(tunnels(u.umonst->data)
+ && !needspick(u.umonst->data))
&& !carrying(PICK_AXE) && !carrying(DWARVISH_MATTOCK)
&& !((obj = carrying(WAN_DIGGING))
&& !objects[obj->otyp].oc_name_known))
@@ -1372,7 +1372,7 @@ findtravelpath(int mode)
if (!isok(nx, ny)
|| ((mode == TRAVP_GUESS) && !couldsee(nx, ny)))
continue;
- if ((!Passes_walls && !can_ooze(&gy.youmonst)
+ if ((!Passes_walls && !can_ooze(u.umonst)
&& closed_door(x, y))
|| (sobj_at(BOULDER, x, y)
&& !could_move_onto_boulder(x, y))
@@ -1693,7 +1693,7 @@ trapmove(
boolean
u_rooted(void)
{
- if (!gy.youmonst.data->mmove) {
+ if (!u.umonst->data->mmove) {
You("are rooted %s.",
Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)
? "in place"
@@ -1825,14 +1825,14 @@ u_locomotion(const char *def)
or boots/ring/spell of levitation */
return Levitation ? (capitalize ? "Float" : "float")
: Flying ? (capitalize ? "Fly" : "fly")
- : locomotion(gy.youmonst.data, def);
+ : locomotion(u.umonst->data, def);
}
/* Return a simplified floor solid/liquid state based on hero's state */
staticfn schar
u_simple_floortyp(coordxy x, coordxy y)
{
- boolean u_in_air = (Levitation || Flying || !grounded(gy.youmonst.data));
+ boolean u_in_air = (Levitation || Flying || !grounded(u.umonst->data));
if (is_waterwall(x, y))
return WATER; /* wall of water, fly/lev does not matter */
@@ -1978,8 +1978,8 @@ domove_attackmon_at(
&& (NODIAG(u.umonnum)
|| (bad_rock(mtmp->data, x, u.uy0)
&& bad_rock(mtmp->data, u.ux0, y))
- || (bad_rock(gy.youmonst.data, u.ux0, y)
- && bad_rock(gy.youmonst.data, x, u.uy0))))
+ || (bad_rock(u.umonst->data, u.ux0, y)
+ && bad_rock(u.umonst->data, x, u.uy0))))
&& goodpos(u.ux0, u.uy0, mtmp, GP_ALLOW_U));
/* if not displacing, try to attack; note that it might evade;
also, we don't attack tame or peaceful when safemon() */
@@ -2244,7 +2244,7 @@ domove_fight_empty(coordxy x, coordxy y)
|| (glyph_is_invisible(glyph) && !m_at(x, y)
&& !svc.context.nopick)) {
struct obj *boulder = 0;
- boolean explo = (Upolyd && attacktype(gy.youmonst.data, AT_EXPL)),
+ boolean explo = (Upolyd && attacktype(u.umonst->data, AT_EXPL)),
solid = (off_edge || (!accessible(x, y)
|| IS_FURNITURE(levl[x][y].typ)));
char buf[BUFSZ];
@@ -2323,7 +2323,7 @@ domove_fight_empty(coordxy x, coordxy y)
nomul(0);
if (explo) {
struct attack *attk
- = attacktype_fordmg(gy.youmonst.data, AT_EXPL, AD_ANY);
+ = attacktype_fordmg(u.umonst->data, AT_EXPL, AD_ANY);
/* no monster has been attacked so we have bypassed explum() */
wake_nearto(u.ux, u.uy, 7 * 7); /* same radius as explum() */
@@ -2396,7 +2396,7 @@ staticfn void
slippery_ice_fumbling(void)
{
boolean on_ice = !Levitation && is_ice(u.ux, u.uy);
- struct monst *iceskater = u.usteed ? u.usteed : &gy.youmonst;
+ struct monst *iceskater = u.usteed ? u.usteed : u.umonst;
if (on_ice) {
if ((uarmf && objdescr_is(uarmf, "snow boots"))
@@ -2435,7 +2435,7 @@ impaired_movement(coordxy *x, coordxy *y)
confdir(TRUE);
*x = u.ux + u.dx;
*y = u.uy + u.dy;
- } while (!isok(*x, *y) || bad_rock(gy.youmonst.data, *x, *y));
+ } while (!isok(*x, *y) || bad_rock(u.umonst->data, *x, *y));
}
return FALSE;
}
@@ -2475,7 +2475,7 @@ avoid_moving_on_liquid(
/* and you know you won't fall in */
&& (in_air || Known_lwalking || (is_pool(x, y) && Known_wwalking))
&& !(IS_WATERWALL(levl[x][y].typ) || levl[x][y].typ == LAVAWALL)) {
- /* XXX: should send 'is_clinger(gy.youmonst.data)' here once clinging
+ /* XXX: should send 'is_clinger(u.umonst->data)' here once clinging
polyforms are allowed to move over water */
return FALSE; /* liquid is safe to traverse */
} else if (is_pool_or_lava(x, y) && levl[x][y].seenv) {
@@ -2558,7 +2558,7 @@ avoid_trap_andor_region(coordxy x, coordxy y)
/* check whether attempted move will be viable */
&& test_move(u.ux, u.uy, u.dx, u.dy, TEST_MOVE)
/* override confirmation if the trap is harmless to the hero */
- && (immune_to_trap(&gy.youmonst, trap->ttyp) != TRAP_CLEARLY_IMMUNE
+ && (immune_to_trap(u.umonst, trap->ttyp) != TRAP_CLEARLY_IMMUNE
/* Hallucination: all traps still show as ^, but the
hero can't tell what they are, so treat as dangerous */
|| Hallucination)) {
@@ -2644,7 +2644,7 @@ escape_from_sticky_mon(coordxy x, coordxy y)
if (!m_next2u(u.ustuck)) {
/* perhaps it fled (or was teleported or ... ) */
set_ustuck((struct monst *) 0);
- } else if (sticks(gy.youmonst.data)) {
+ } else if (sticks(u.umonst->data)) {
/* When polymorphed into a sticking monster,
* u.ustuck means it's stuck to you, not you to it.
*/
@@ -2874,7 +2874,7 @@ domove_core(void)
u.ux += u.dx;
u.uy += u.dy;
- m_postmove_effect(&gy.youmonst);
+ m_postmove_effect(u.umonst);
if (u.usteed) {
u.usteed->mx = u.ux;
@@ -2943,12 +2943,12 @@ domove_core(void)
/* your tread on the ground may disturb the slumber of nearby zombies */
if (!Levitation && !Flying && !Stealth
- && gy.youmonst.data->cwt >= (WT_ELF / 2))
+ && u.umonst->data->cwt >= (WT_ELF / 2))
disturb_buried_zombies(u.ux, u.uy);
- if (hides_under(gy.youmonst.data) || gy.youmonst.data->mlet == S_EEL
+ if (hides_under(u.umonst->data) || u.umonst->data->mlet == S_EEL
|| u.dx || u.dy)
- (void) hideunder(&gy.youmonst);
+ (void) hideunder(u.umonst);
/*
* Mimics (or whatever) become noticeable if they move and are
@@ -2957,7 +2957,7 @@ domove_core(void)
*/
if ((u.dx || u.dy) && (U_AP_TYPE == M_AP_OBJECT
|| U_AP_TYPE == M_AP_FURNITURE))
- gy.youmonst.m_ap_type = M_AP_NOTHING;
+ u.umonst->m_ap_type = M_AP_NOTHING;
check_leash(u.ux0, u.uy0);
@@ -3804,8 +3804,8 @@ pickup_checks(void)
}
}
if (is_pool(u.ux, u.uy)) {
- if (Wwalking || is_floater(gy.youmonst.data)
- || is_clinger(gy.youmonst.data) || (Flying && !Breathless)) {
+ if (Wwalking || is_floater(u.umonst->data)
+ || is_clinger(u.umonst->data) || (Flying && !Breathless)) {
You("cannot dive into the %s to pick things up.",
hliquid("water"));
return 0;
@@ -3815,11 +3815,11 @@ pickup_checks(void)
}
}
if (is_lava(u.ux, u.uy)) {
- if (Wwalking || is_floater(gy.youmonst.data)
- || is_clinger(gy.youmonst.data) || (Flying && !Breathless)) {
+ if (Wwalking || is_floater(u.umonst->data)
+ || is_clinger(u.umonst->data) || (Flying && !Breathless)) {
You_cant("reach the bottom to pick things up.");
return 0;
- } else if (!likes_lava(gy.youmonst.data)) {
+ } else if (!likes_lava(u.umonst->data)) {
You("would burn to a crisp trying to pick things up.");
return 0;
}
@@ -4079,7 +4079,7 @@ boolean
crawl_destination(coordxy x, coordxy y)
{
/* is location ok in general? */
- if (!goodpos(x, y, &gy.youmonst, 0))
+ if (!goodpos(x, y, u.umonst, 0))
return FALSE;
/* orthogonal movement is unrestricted when destination is ok */
@@ -4095,9 +4095,9 @@ crawl_destination(coordxy x, coordxy y)
if (IS_DOOR(levl[x][y].typ) && (!doorless_door(x, y) || block_door(x, y)))
return FALSE;
/* finally, are we trying to squeeze through a too-narrow gap? */
- return !(bad_rock(gy.youmonst.data, u.ux, y)
- && bad_rock(gy.youmonst.data, x, u.uy)
- && cant_squeeze_thru(&gy.youmonst));
+ return !(bad_rock(u.umonst->data, u.ux, y)
+ && bad_rock(u.umonst->data, x, u.uy)
+ && cant_squeeze_thru(u.umonst));
}
/* something like lookaround, but we are not running */
@@ -4367,14 +4367,14 @@ weight_cap(void)
+ WT_WEIGHTCAP_SPARE;
if (Upolyd) {
/* consistent with can_carry() in mon.c */
- if (gy.youmonst.data->mlet == S_NYMPH)
+ if (u.umonst->data->mlet == S_NYMPH)
carrcap = MAX_CARR_CAP;
- else if (!gy.youmonst.data->cwt)
- carrcap = (carrcap * (long) gy.youmonst.data->msize) / MZ_HUMAN;
- else if (!strongmonst(gy.youmonst.data)
- || (strongmonst(gy.youmonst.data)
- && (gy.youmonst.data->cwt > WT_HUMAN)))
- carrcap = (carrcap * (long) gy.youmonst.data->cwt / WT_HUMAN);
+ else if (!u.umonst->data->cwt)
+ carrcap = (carrcap * (long) u.umonst->data->msize) / MZ_HUMAN;
+ else if (!strongmonst(u.umonst->data)
+ || (strongmonst(u.umonst->data)
+ && (u.umonst->data->cwt > WT_HUMAN)))
+ carrcap = (carrcap * (long) u.umonst->data->cwt / WT_HUMAN);
}
if (Levitation || Is_airlevel(&u.uz) /* pugh@cornell */
@@ -4411,7 +4411,7 @@ inv_weight(void)
while (otmp) {
if (otmp->oclass == COIN_CLASS)
wt += (int) (((long) otmp->quan + 50L) / 100L);
- else if (otmp->otyp != BOULDER || !throws_rocks(gy.youmonst.data))
+ else if (otmp->otyp != BOULDER || !throws_rocks(u.umonst->data))
wt += otmp->owt;
otmp = otmp->nobj;
}
diff --git a/src/iactions.c b/src/iactions.c
index ca00a2be6..b12b61c18 100644
--- a/src/iactions.c
+++ b/src/iactions.c
@@ -605,7 +605,7 @@ itemactions(struct obj *otmp)
/* w: wield, hold in hands, works on everything but with different
advice text; not mentioned for things that are already wielded */
- if (otmp == uwep || cantwield(gy.youmonst.data)) {
+ if (otmp == uwep || cantwield(u.umonst->data)) {
; /* either already wielded or can't wield anything; skip 'w' */
} else if (otmp->oclass == WEAPON_CLASS || is_weptool(otmp)
|| is_wet_towel(otmp) || otmp->otyp == HEAVY_IRON_BALL) {
@@ -674,7 +674,7 @@ itemactions(struct obj *otmp)
/* if already two-weaponing, no special checks needed to toggle off */
&& (u.twoweap
/* but if not, try to filter most "you can't do that" here */
- || (could_twoweap(gy.youmonst.data) && !uarms
+ || (could_twoweap(u.umonst->data) && !uarms
&& uwep && MAYBETWOWEAPON(uwep)
&& uswapwep && MAYBETWOWEAPON(uswapwep)))) {
Sprintf(buf, "Toggle two-weapon combat %s", u.twoweap ? "off" : "on");
diff --git a/src/insight.c b/src/insight.c
index ab2bcd1a1..12fc1e773 100644
--- a/src/insight.c
+++ b/src/insight.c
@@ -489,8 +489,8 @@ background_enlightenment(int unused_mode UNUSED, int final)
the player to know he's not a samurai at the moment... */
if (Upolyd) {
char anbuf[20]; /* includes trailing space; [4] suffices */
- struct permonst *uasmon = gy.youmonst.data;
- boolean altphrasing = vampshifted(&gy.youmonst);
+ struct permonst *uasmon = u.umonst->data;
+ boolean altphrasing = vampshifted(u.umonst);
tmpbuf[0] = '\0';
/* here we always use current gender, not saved role gender */
@@ -498,7 +498,7 @@ background_enlightenment(int unused_mode UNUSED, int final)
Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj);
if (altphrasing)
Sprintf(eos(tmpbuf), "%s in ",
- pmname(&mons[gy.youmonst.cham],
+ pmname(&mons[u.umonst->cham],
flags.female ? FEMALE : MALE));
Snprintf(buf, sizeof(buf), "%s%s%s%s form",
!final ? "currently " : "",
@@ -1068,7 +1068,7 @@ status_enlightenment(int mode, int final)
if (wizard && (HBlinded == BlindedTimeout && !Blindfolded))
Sprintf(eos(buf), " (%ld)", BlindedTimeout);
/* !haseyes: avoid "you are innately blind innately" */
- you_are(buf, !haseyes(gy.youmonst.data) ? "" : from_what(BLINDED));
+ you_are(buf, !haseyes(u.umonst->data) ? "" : from_what(BLINDED));
}
if (Deaf)
you_are("deaf", from_what(DEAF));
@@ -1122,7 +1122,7 @@ status_enlightenment(int mode, int final)
Sprintf(eos(buf), " (%u)", u.uswldtim);
you_are(buf, "");
} else if (u.ustuck) {
- boolean ustick = (Upolyd && sticks(gy.youmonst.data));
+ boolean ustick = (Upolyd && sticks(u.umonst->data));
int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy;
Snprintf(buf, sizeof buf, "%s %s (%s)",
@@ -1736,7 +1736,7 @@ attributes_enlightenment(
}
/* including this might bring attention to the fact that ceiling
clinging has inconsistencies... */
- if (is_clinger(gy.youmonst.data)) {
+ if (is_clinger(u.umonst->data)) {
boolean has_lid = has_ceiling(&u.uz);
if (has_lid && !u.uinwater) {
@@ -1797,7 +1797,7 @@ attributes_enlightenment(
if (prot)
you_have(enlght_combatinc("defense", prot, final, buf), "");
}
- if ((armpro = magic_negation(&gy.youmonst)) > 0) {
+ if ((armpro = magic_negation(u.umonst)) > 0) {
/* magic cancellation factor, conferred by worn armor */
static const char *const mc_types[] = {
"" /*ordinary*/, "warded", "guarded", "protected",
@@ -1863,20 +1863,20 @@ attributes_enlightenment(
&& !(final == ENL_GAMEOVERDEAD
&& u.umonnum == PM_GREEN_SLIME && !Unchanging)) {
/* foreign shape (except were-form which is handled below) */
- if (!vampshifted(&gy.youmonst))
+ if (!vampshifted(u.umonst))
Sprintf(buf, "polymorphed into %s",
- an(pmname(gy.youmonst.data,
+ an(pmname(u.umonst->data,
flags.female ? FEMALE : MALE)));
else
Sprintf(buf, "polymorphed into %s in %s form",
- an(pmname(&mons[gy.youmonst.cham],
+ an(pmname(&mons[u.umonst->cham],
flags.female ? FEMALE : MALE)),
- pmname(gy.youmonst.data, flags.female ? FEMALE : MALE));
+ pmname(u.umonst->data, flags.female ? FEMALE : MALE));
if (wizard)
Sprintf(eos(buf), " (%d)", u.mtimedone);
you_are(buf, "");
}
- if (lays_eggs(gy.youmonst.data) && flags.female) /* Upolyd */
+ if (lays_eggs(u.umonst->data) && flags.female) /* Upolyd */
you_can("lay eggs", "");
if (ismnum(u.ulycn)) {
/* "you are a werecreature [in beast form]" */
@@ -2046,7 +2046,7 @@ youhiding(boolean via_enlghtmt, /* enlightenment line vs topl message */
for the hypothetical furniture and monster cases */
bp = eos(strcpy(buf, "mimicking"));
if (U_AP_TYPE == M_AP_OBJECT) {
- Sprintf(bp, " %s", an(simple_typename(gy.youmonst.mappearance)));
+ Sprintf(bp, " %s", an(simple_typename(u.umonst->mappearance)));
} else if (U_AP_TYPE == M_AP_FURNITURE) {
Strcpy(bp, " something");
} else if (U_AP_TYPE == M_AP_MONSTER) {
@@ -2056,15 +2056,15 @@ youhiding(boolean via_enlghtmt, /* enlightenment line vs topl message */
}
} else if (u.uundetected) {
bp = eos(buf); /* points past "hiding" */
- if (gy.youmonst.data->mlet == S_EEL) {
+ if (u.umonst->data->mlet == S_EEL) {
if (is_pool(u.ux, u.uy))
Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy));
- } else if (hides_under(gy.youmonst.data)) {
+ } else if (hides_under(u.umonst->data)) {
struct obj *o = svl.level.objects[u.ux][u.uy];
if (o)
Sprintf(bp, " underneath %s", ansimpleoname(o));
- } else if (is_clinger(gy.youmonst.data) || Flying) {
+ } else if (is_clinger(u.umonst->data) || Flying) {
/* Flying: 'lurker above' hides on ceiling but doesn't cling */
Sprintf(bp, " on the %s", ceiling(u.ux, u.uy));
} else {
@@ -3368,7 +3368,7 @@ mstatusline(struct monst *mtmp)
if (mtmp == u.ustuck) {
struct permonst *pm = u.ustuck->data;
- /* being swallowed/engulfed takes priority over sticks(youmonst);
+ /* being swallowed/engulfed takes priority over sticks(u.umonst);
this used to have that backwards and checked sticks() first */
Strcat(info, u.uswallow ? (digests(pm)
? ", digesting you"
@@ -3380,9 +3380,9 @@ mstatusline(struct monst *mtmp)
: (is_animal(pm) && !enfolds(pm))
? ", swallowing you"
: ", engulfing you")
- /* !u.uswallow; if both youmonst and ustuck are holders,
- youmonst wins */
- : (!sticks(gy.youmonst.data) ? ", holding you"
+ /* !u.uswallow; if both u.umonst and ustuck are holders,
+ u.umonst wins */
+ : (!sticks(u.umonst->data) ? ", holding you"
: ", held by you"));
}
if (mtmp == u.usteed) {
@@ -3445,7 +3445,7 @@ ustatusline(void)
Strcat(info, ", blind");
if (u.ucreamed) {
if ((long) u.ucreamed < BlindedTimeout || Blindfolded
- || !haseyes(gy.youmonst.data))
+ || !haseyes(u.umonst->data))
Strcat(info, ", cover");
Strcat(info, "ed by sticky goop");
} /* note: "goop" == "glop"; variation is intentional */
@@ -3481,7 +3481,7 @@ ustatusline(void)
if (u.uswallow)
Strcat(info, digests(u.ustuck->data) ? ", being digested by "
: ", engulfed by ");
- else if (!sticks(gy.youmonst.data))
+ else if (!sticks(u.umonst->data))
Strcat(info, ", held by ");
else
Strcat(info, ", holding ");
diff --git a/src/invent.c b/src/invent.c
index a34517acf..6995bfd4e 100644
--- a/src/invent.c
+++ b/src/invent.c
@@ -1224,7 +1224,7 @@ hold_another_object(
/* in case touching this object turns out to be fatal */
place_object(obj, u.ux, u.uy);
- if (!touch_artifact(obj, &gy.youmonst)) {
+ if (!touch_artifact(obj, u.umonst)) {
obj_extract_self(obj); /* remove it from the floor */
dropy(obj); /* now put it back again :-) */
return obj;
@@ -1496,7 +1496,7 @@ carrying(int type)
{
struct obj *otmp;
- /* this could be replaced by 'return m_carrying(&gy.youmonst, type);' */
+ /* this could be replaced by 'return m_carrying(u.umonst, type);' */
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (otmp->otyp == type)
break;
@@ -4269,7 +4269,7 @@ look_here(
: (otmp->quan > 1L) ? "They're"
: "It's",
corpse_xname(otmp, (const char *) 0, CXN_ARTICLE),
- poly_when_stoned(gy.youmonst.data) ? ""
+ poly_when_stoned(u.umonst->data) ? ""
: ", unfortunately");
feel_cockatrice(otmp, FALSE);
break;
@@ -4348,7 +4348,7 @@ feel_cockatrice(struct obj *otmp, boolean force_touch)
/* "the corpse" */
Strcpy(kbuf, corpse_xname(otmp, (const char *) 0, CXN_PFX_THE));
- if (poly_when_stoned(gy.youmonst.data))
+ if (poly_when_stoned(u.umonst->data))
You("touched %s with your bare %s.", kbuf,
makeplural(body_part(HAND)));
else
@@ -4778,8 +4778,8 @@ useupf(struct obj *obj, long numused)
(void) stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE);
}
delobj(otmp);
- if (at_u && u.uundetected && hides_under(gy.youmonst.data))
- (void) hideunder(&gy.youmonst);
+ if (at_u && u.uundetected && hides_under(u.umonst->data))
+ (void) hideunder(u.umonst);
}
/*
@@ -5360,7 +5360,7 @@ display_minventory(
/* Fool the 'weapon in hand' routine into
* displaying 'weapon in claw', etc. properly.
*/
- gy.youmonst.data = mon->data;
+ u.umonst->data = mon->data;
/* in case inside a shop, don't append "for sale" prices */
iflags.suppress_price++;
@@ -5371,7 +5371,7 @@ display_minventory(
iflags.suppress_price--;
/* was 'set_uasmon();' but that potentially has side-effects */
- gy.youmonst.data = &mons[u.umonnum]; /* basic part of set_uasmon() */
+ u.umonst->data = &mons[u.umonnum]; /* basic part of set_uasmon() */
} else {
invdisp_nothing(title ? title : tmp, "(none)");
n = 0;
diff --git a/src/light.c b/src/light.c
index 93f7ea50a..640ed312a 100644
--- a/src/light.c
+++ b/src/light.c
@@ -13,8 +13,8 @@
* Light sources are "things" that have a physical position and range.
* They have a type, which gives us information about them. Currently
* they are only attached to objects and monsters. Note well: the
- * polymorphed-player handling assumes that gy.youmonst.m_id will
- * always remain 1 and gy.youmonst.mx will always remain 0.
+ * polymorphed-player handling assumes that u.umonst->m_id will
+ * always remain 1 and u.umonst->mx will always remain 0.
*
* Light sources, like timers, either follow game play (RANGE_GLOBAL) or
* stay on a level (RANGE_LEVEL). Light sources are unique by their
@@ -378,7 +378,7 @@ find_mid(unsigned nid, unsigned fmflags)
struct monst *mtmp;
if ((fmflags & FM_YOU) && nid == 1)
- return &gy.youmonst;
+ return u.umonst;
if (fmflags & FM_FMON)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (!DEADMONSTER(mtmp) && mtmp->m_id == nid)
@@ -399,7 +399,7 @@ whereis_mon(struct monst *mon, unsigned fmflags)
{
struct monst *mtmp;
- if ((fmflags & FM_YOU) && mon == &gy.youmonst)
+ if ((fmflags & FM_YOU) && mon == u.umonst)
return FM_YOU;
if (fmflags & FM_FMON)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
@@ -957,7 +957,7 @@ wiz_light_sources(void)
: ls->type == LS_MONSTER
? (mon_is_local(ls->id.a_monst)
? "mon"
- : (ls->id.a_monst == &gy.youmonst)
+ : (ls->id.a_monst == u.umonst)
? "you"
/* migrating monster */
: "")
diff --git a/src/lock.c b/src/lock.c
index 2e8851754..cc3183d00 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -89,7 +89,7 @@ picklock(void)
}
}
- if (gx.xlock.usedtime++ >= 50 || nohands(gy.youmonst.data)) {
+ if (gx.xlock.usedtime++ >= 50 || nohands(u.umonst->data)) {
You("give up your attempt at %s.", lock_action());
exercise(A_DEX, TRUE); /* even if you don't succeed */
return ((gx.xlock.usedtime = 0));
@@ -218,7 +218,7 @@ forcelock(void)
if ((gx.xlock.box->ox != u.ux) || (gx.xlock.box->oy != u.uy))
return ((gx.xlock.usedtime = 0)); /* you or it moved */
- if (gx.xlock.usedtime++ >= 50 || !uwep || nohands(gy.youmonst.data)) {
+ if (gx.xlock.usedtime++ >= 50 || !uwep || nohands(u.umonst->data)) {
You("give up your attempt to force the lock.");
if (gx.xlock.usedtime >= 50) /* you made the effort */
exercise((gx.xlock.picktyp) ? A_DEX : A_STR, TRUE);
@@ -315,7 +315,7 @@ autokey(boolean opening) /* True: key, pick, or card; False: key or pick */
} else {
switch (o->otyp) {
case SKELETON_KEY:
- if (!key || is_magic_key(&gy.youmonst, o))
+ if (!key || is_magic_key(u.umonst, o))
key = o;
break;
case LOCK_PICK:
@@ -380,7 +380,7 @@ pick_lock(
if (gx.xlock.usedtime && picktyp == gx.xlock.picktyp) {
static char no_longer[] = "Unfortunately, you can no longer %s %s.";
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
const char *what = (picktyp == LOCK_PICK) ? "pick" : "key";
if (picktyp == CREDIT_CARD)
@@ -396,13 +396,13 @@ pick_lock(
const char *action = lock_action();
You("resume your attempt at %s.", action);
- gx.xlock.magic_key = is_magic_key(&gy.youmonst, pick);
+ gx.xlock.magic_key = is_magic_key(u.umonst, pick);
set_occupation(picklock, action, 0);
return PICKLOCK_DID_SOMETHING;
}
}
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You_cant("hold %s -- you have no hands!", doname(pick));
return PICKLOCK_DID_NOTHING;
} else if (u.uswallow) {
@@ -513,7 +513,7 @@ pick_lock(
an(simple_typename(picktyp)));
return PICKLOCK_LEARNED_SOMETHING;
} else if (autounlock
- && !touch_artifact(pick, &gy.youmonst)) {
+ && !touch_artifact(pick, u.umonst)) {
/* note: for !autounlock, apply already did touch check */
return PICKLOCK_DID_SOMETHING;
}
@@ -626,7 +626,7 @@ pick_lock(
return PICKLOCK_DID_NOTHING;
/* note: for !autounlock, 'apply' already did touch check */
- if (autounlock && !touch_artifact(pick, &gy.youmonst))
+ if (autounlock && !touch_artifact(pick, u.umonst))
return PICKLOCK_DID_SOMETHING;
switch (picktyp) {
@@ -649,7 +649,7 @@ pick_lock(
svc.context.move = 0;
gx.xlock.chance = ch;
gx.xlock.picktyp = picktyp;
- gx.xlock.magic_key = is_magic_key(&gy.youmonst, pick);
+ gx.xlock.magic_key = is_magic_key(u.umonst, pick);
gx.xlock.usedtime = 0;
set_occupation(picklock, lock_action(), 0);
return PICKLOCK_DID_SOMETHING;
@@ -785,7 +785,7 @@ doopen_indir(coordxy x, coordxy y)
const char *dirprompt;
int res = ECMD_OK;
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You_cant("open anything -- you have no hands!");
return ECMD_OK;
}
@@ -895,7 +895,7 @@ doopen_indir(coordxy x, coordxy y)
return res;
}
- if (verysmall(gy.youmonst.data)) {
+ if (verysmall(u.umonst->data)) {
pline("You're too small to pull the door open.");
return res;
}
@@ -961,7 +961,7 @@ doclose(void)
boolean portcullis;
int res = ECMD_OK;
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You_cant("close anything -- you have no hands!");
return ECMD_OK;
}
@@ -1031,7 +1031,7 @@ doclose(void)
}
if (door->doormask == D_ISOPEN) {
- if (verysmall(gy.youmonst.data) && !u.usteed) {
+ if (verysmall(u.umonst->data) && !u.usteed) {
pline("You're too small to push the door closed.");
return res;
}
@@ -1281,7 +1281,7 @@ chest_shatter_msg(struct obj *otmp)
if (otmp->oclass == POTION_CLASS) {
You("%s %s shatter!", Blind ? "hear" : "see", an(bottlename()));
- if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
+ if (!breathless(u.umonst->data) || haseyes(u.umonst->data))
potionbreathe(otmp);
return;
}
diff --git a/src/mcastu.c b/src/mcastu.c
index 34d839906..c6f5bc3bb 100644
--- a/src/mcastu.c
+++ b/src/mcastu.c
@@ -69,7 +69,7 @@ cursetxt(struct monst *mtmp, boolean undirected)
point_msg = "all around, then curses";
else if ((Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
- || is_obj_mappear(&gy.youmonst, STRANGE_OBJECT)
+ || is_obj_mappear(u.umonst, STRANGE_OBJECT)
|| u.uundetected)
point_msg = "and curses in your general direction";
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
@@ -389,7 +389,7 @@ staticfn void
mcast_death_touch(struct monst *mtmp)
{
pline("Oh no, %s's using the touch of death!", mhe(mtmp));
- if (nonliving(gy.youmonst.data) || is_demon(gy.youmonst.data)) {
+ if (nonliving(u.umonst->data) || is_demon(u.umonst->data)) {
You("seem no deader than before.");
} else if (!Antimagic && rn2(mtmp->m_lev) > 12) {
if (Hallucination) {
@@ -553,9 +553,9 @@ mcast_fire_pillar(struct monst *mtmp, int dmg)
if (Half_spell_damage)
dmg = (dmg + 1) / 2;
burn_away_slime();
- (void) burnarmor(&gy.youmonst);
+ (void) burnarmor(u.umonst);
/* item destruction dmg */
- (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
+ (void) destroy_items(u.umonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent);
/* burn up flammable items on the floor, melt ice terrain */
mon_spell_hits_spot(mtmp, AD_FIRE, u.ux, u.uy);
@@ -586,7 +586,7 @@ mcast_lightning(struct monst *mtmp, int dmg)
}
if (Half_spell_damage)
dmg = (dmg + 1) / 2;
- (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dmg);
+ (void) destroy_items(u.umonst, AD_ELEC, orig_dmg);
/* lightning might destroy iron bars if hero is on such a spot;
reflection protects terrain here [execution won't get here due
to 'if (reflects) break' above] but hero resistance doesn't;
@@ -730,7 +730,7 @@ mcast_blind_you(void)
{
/* note: resists_blnd() doesn't apply here */
if (!Blinded) {
- int num_eyes = eyecount(gy.youmonst.data);
+ int num_eyes = eyecount(u.umonst->data);
pline("Scales cover your %s!", (num_eyes == 1)
? body_part(EYE)
diff --git a/src/mhitm.c b/src/mhitm.c
index 5e8bb928e..c6db44600 100644
--- a/src/mhitm.c
+++ b/src/mhitm.c
@@ -607,7 +607,7 @@ failed_grab(
&& (mattk->aatyp == AT_HUGS || mattk->adtyp == AD_WRAP
|| mattk->adtyp == AD_STCK || mattk->adtyp == AD_DGST)) {
if ((gv.vis && canspotmon(mdef)) /* mon-vs-mon */
- || magr == &gy.youmonst || mdef == &gy.youmonst) {
+ || magr == u.umonst || mdef == u.umonst) {
char magrnam[BUFSZ], mdefnam[BUFSZ];
boolean tailmiss = gn.notonhead;
const char *verb = (mattk->adtyp == AD_DGST) ? "gulp"
@@ -618,14 +618,14 @@ failed_grab(
mon_nam(x_monnam) calls s_suffix() for named ghosts and
s_suffix() uses a single static buffer; make copies of both
names to overcome that [note: comment predates 'tailmiss'] */
- Strcpy(magrnam, (magr == &gy.youmonst) ? "Your"
+ Strcpy(magrnam, (magr == u.umonst) ? "Your"
: s_suffix(Monnam(magr)));
if (!tailmiss) {
- Strcpy(mdefnam, (mdef == &gy.youmonst) ? "you"
+ Strcpy(mdefnam, (mdef == u.umonst) ? "you"
: mon_nam(mdef));
} else {
/* hero poly'd into long worm can't grow tail
- so no 'youmonst' handling is needed here */
+ so no 'u.umonst' handling is needed here */
Sprintf(mdefnam, "%s tail", s_suffix(some_mon_nam(mdef)));
}
/* unsolid grab misses are actually somewhat iffy--how come
@@ -808,8 +808,8 @@ engulf_target(struct monst *magr, struct monst *mdef)
{
struct rm *lev;
int ax, ay, dx, dy;
- boolean uatk = (magr == &gy.youmonst),
- udef = (mdef == &gy.youmonst);
+ boolean uatk = (magr == u.umonst),
+ udef = (mdef == u.umonst);
/* can't swallow something that's too big */
if (mdef->data->msize >= MZ_HUGE
@@ -825,16 +825,16 @@ engulf_target(struct monst *magr, struct monst *mdef)
might not be able to place attacker and defender both back on map;
when defender is the hero, a sanity_check complaint about placing
the hero on top of a monster can occur */
- dx = (mdef == &gy.youmonst) ? u.ux : mdef->mx;
- dy = (mdef == &gy.youmonst) ? u.uy : mdef->my;
+ dx = (mdef == u.umonst) ? u.ux : mdef->mx;
+ dy = (mdef == u.umonst) ? u.uy : mdef->my;
lev = &levl[dx][dy];
if (!(udef ? Passes_walls : passes_walls(mdef->data))
&& (IS_OBSTRUCTED(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ)
/* not passes_bars(); engulfer isn't squeezing through */
|| (lev->typ == IRONBARS && !is_whirly(magr->data))))
return FALSE;
- ax = (magr == &gy.youmonst) ? u.ux : magr->mx;
- ay = (magr == &gy.youmonst) ? u.uy : magr->my;
+ ax = (magr == u.umonst) ? u.ux : magr->mx;
+ ay = (magr == u.umonst) ? u.uy : magr->my;
lev = &levl[ax][ay];
if (!(uatk ? Passes_walls : passes_walls(magr->data))
&& (IS_OBSTRUCTED(lev->typ) || closed_door(ax, ay) || IS_TREE(lev->typ)
@@ -1124,7 +1124,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
static const char freaky[] = " undergoes a freakish metamorphosis";
struct permonst *oldform = mdef->data;
- if (mdef == &gy.youmonst) {
+ if (mdef == u.umonst) {
if (Antimagic) {
shieldeff(u.ux, u.uy);
} else if (Unchanging) {
@@ -1166,7 +1166,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
mdef->mhp -= dmg;
dmg = 0;
if (DEADMONSTER(mdef)) {
- if (magr == &gy.youmonst)
+ if (magr == u.umonst)
xkilled(mdef, XKILL_GIVEMSG | XKILL_NOCORPSE);
else
monkilled(mdef, "", AD_RBRE);
@@ -1182,13 +1182,13 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
x_monnam(mdef, ARTICLE_A, (char *) 0,
(SUPPRESS_NAME | SUPPRESS_IT
| SUPPRESS_INVISIBLE), FALSE));
- else if (was_seen || magr == &gy.youmonst)
+ else if (was_seen || magr == u.umonst)
pline("%s%s%s.", Before, freaky,
!was_seen ? "" : " and disappears");
}
dmg = 0;
if (can_teleport(magr->data)) {
- if (magr == &gy.youmonst)
+ if (magr == u.umonst)
tele();
else if (!tele_restrict(magr))
(void) rloc(magr, RLOC_MSG);
@@ -1200,7 +1200,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
}
/* when a transformation has happened, can't attack again for poly
effect during next turn or two; not enforced for poly'd hero */
- if (mdef->data != oldform && magr != &gy.youmonst)
+ if (mdef->data != oldform && magr != u.umonst)
magr->mspec_used += rnd(2);
return dmg;
@@ -1250,7 +1250,7 @@ void
slept_monst(struct monst *mon)
{
if (helpless(mon) && mon == u.ustuck
- && !sticks(gy.youmonst.data) && !u.uswallow) {
+ && !sticks(u.umonst->data) && !u.uswallow) {
pline_mon(mon, "%s grip relaxes.", s_suffix(Monnam(mon)));
unstuck(mon);
}
diff --git a/src/mhitu.c b/src/mhitu.c
index 71d90a8ec..b71104cb9 100644
--- a/src/mhitu.c
+++ b/src/mhitu.c
@@ -34,7 +34,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
/* Note: if opposite gender, "seductively";
if same gender, "engagingly" for nymph, normal msg for others. */
- if ((compat = could_seduce(mtmp, &gy.youmonst, mattk)) != 0
+ if ((compat = could_seduce(mtmp, u.umonst, mattk)) != 0
&& !mtmp->mcan && !mtmp->mspec_used) {
pline_mon(mtmp, "%s %s you %s.", Monst_name,
!Blind ? "smiles at" : !Deaf ? "talks to" : "touches",
@@ -45,7 +45,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
verb = "bites";
break;
case AT_KICK:
- if (thick_skinned(gy.youmonst.data))
+ if (thick_skinned(u.umonst->data))
punct = ".";
verb = "kicks";
break;
@@ -90,7 +90,7 @@ missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk)
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
- if (could_seduce(mtmp, &gy.youmonst, mattk) && !mtmp->mcan)
+ if (could_seduce(mtmp, u.umonst, mattk) && !mtmp->mcan)
pline_mon(mtmp, "%s pretends to be friendly.", Monnam(mtmp));
else
pline_mon(mtmp, "%s %smisses!", Monnam(mtmp),
@@ -147,7 +147,7 @@ mpoisons_subj(
struct attack *mattk)
{
if (mattk->aatyp == AT_WEAP) {
- struct obj *mwep = (mtmp == &gy.youmonst) ? uwep : MON_WEP(mtmp);
+ struct obj *mwep = (mtmp == u.umonst) ? uwep : MON_WEP(mtmp);
/* "Foo's attack was poisoned." is pretty lame, but at least
it's better than "sting" when not a stinging attack... */
return (!mwep || !mwep->opoisoned) ? "attack" : "weapon";
@@ -200,7 +200,7 @@ wildmiss(struct monst *mtmp, struct attack *mattk)
/* maybe it's attacking an image around the corner? */
compat = ((mattk->adtyp == AD_SEDU || mattk->adtyp == AD_SSEX)
- ? could_seduce(mtmp, &gy.youmonst, mattk) : 0);
+ ? could_seduce(mtmp, u.umonst, mattk) : 0);
Monst_name = Monnam(mtmp);
set_msg_xy(mtmp->mx, mtmp->my);
@@ -314,8 +314,8 @@ getmattk(
{
struct permonst *mptr = magr->data;
struct attack *attk = &mptr->mattk[indx];
- struct obj *weap = (magr == &gy.youmonst) ? uwep : MON_WEP(magr);
- boolean udefend = mdef == &gy.youmonst;
+ struct obj *weap = (magr == u.umonst) ? uwep : MON_WEP(magr);
+ boolean udefend = mdef == u.umonst;
/* honor SEDUCE=0 */
if (!SYSOPT_SEDUCE) {
@@ -396,7 +396,7 @@ getmattk(
if weapon is sufficiently interesting; a few unique creatures
have two weapon attacks where one does physical damage and other
doesn't--avoid forcing physical damage for those */
- } else if (indx == 0 && magr != &gy.youmonst
+ } else if (indx == 0 && magr != u.umonst
&& attk->aatyp == AT_WEAP && attk->adtyp != AD_PHYS
&& !(mptr->mattk[1].aatyp == AT_WEAP
&& mptr->mattk[1].adtyp == AD_PHYS)
@@ -468,7 +468,7 @@ mtrapped_in_pit(struct monst *mtmp)
{
struct trap *ttmp = 0;
- if (mtmp == &gy.youmonst)
+ if (mtmp == u.umonst)
ttmp = (u.utrap && u.utraptype == TT_PIT) ? t_at(u.ux, u.uy) : 0;
else
ttmp = mtmp->mtrapped ? t_at(mtmp->mx, mtmp->my) : 0;
@@ -552,7 +552,7 @@ mattacku(struct monst *mtmp)
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
u.uundetected = 0;
- if (is_hider(gy.youmonst.data) && u.umonnum != PM_TRAPPER) {
+ if (is_hider(u.umonst->data) && u.umonnum != PM_TRAPPER) {
/* ceiling hider */
coord cc; /* maybe we need a unexto() function? */
struct obj *obj;
@@ -562,7 +562,7 @@ mattacku(struct monst *mtmp)
is eligible for placing hero; we assume that a
removed monster remembers its old spot */
remove_monster(mtmp->mx, mtmp->my);
- if (!enexto(&cc, u.ux, u.uy, gy.youmonst.data)
+ if (!enexto(&cc, u.ux, u.uy, u.umonst->data)
/* a fish won't voluntarily swap positions
when it's in water and hero is over land */
|| (mtmp->data->mlet == S_EEL
@@ -587,13 +587,13 @@ mattacku(struct monst *mtmp)
/* tail hasn't grown, so if it now occupies
then one of its original spots must be free */
if (m_at(cc.x, cc.y))
- (void) enexto(&cc, u.ux, u.uy, gy.youmonst.data);
+ (void) enexto(&cc, u.ux, u.uy, u.umonst->data);
}
teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG); /* move hero */
set_apparxy(mtmp);
newsym(u.ux, u.uy);
- if (gy.youmonst.data->mlet != S_PIERCER)
+ if (u.umonst->data->mlet != S_PIERCER)
return 0; /* lurkers don't attack */
obj = which_armor(mtmp, WORN_HELMET);
@@ -625,7 +625,7 @@ mattacku(struct monst *mtmp)
struct obj *obj = svl.level.objects[u.ux][u.uy];
if (obj || u.umonnum == PM_TRAPPER
- || (gy.youmonst.data->mlet == S_EEL
+ || (u.umonst->data->mlet == S_EEL
&& is_pool(u.ux, u.uy))) {
int save_spe = 0; /* suppress warning */
@@ -636,17 +636,17 @@ mattacku(struct monst *mtmp)
}
/* note that m_monnam() overrides hallucination, which is
what we want when message is from mtmp's perspective */
- if (gy.youmonst.data->mlet == S_EEL
+ if (u.umonst->data->mlet == S_EEL
|| u.umonnum == PM_TRAPPER)
pline(
"Wait, %s! There's a hidden %s named %s there!",
m_monnam(mtmp),
- pmname(gy.youmonst.data, Ugender), svp.plname);
+ pmname(u.umonst->data, Ugender), svp.plname);
else
pline(
"Wait, %s! There's a %s named %s hiding under %s!",
m_monnam(mtmp),
- pmname(gy.youmonst.data, Ugender),
+ pmname(u.umonst->data, Ugender),
svp.plname,
doname(svl.level.objects[u.ux][u.uy]));
if (obj)
@@ -660,9 +660,9 @@ mattacku(struct monst *mtmp)
}
/* hero might be a mimic, concealed via #monster */
- if (gy.youmonst.data->mlet == S_MIMIC && U_AP_TYPE && !range2
+ if (u.umonst->data->mlet == S_MIMIC && U_AP_TYPE && !range2
&& foundyou && !u.uswallow) {
- boolean sticky = sticks(gy.youmonst.data);
+ boolean sticky = sticks(u.umonst->data);
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
@@ -670,11 +670,11 @@ mattacku(struct monst *mtmp)
pline("It gets stuck on you.");
else /* see note about m_monnam() above */
pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp),
- pmname(gy.youmonst.data, Ugender), svp.plname);
+ pmname(u.umonst->data, Ugender), svp.plname);
if (sticky)
set_ustuck(mtmp);
- gy.youmonst.m_ap_type = M_AP_NOTHING;
- gy.youmonst.mappearance = 0;
+ u.umonst->m_ap_type = M_AP_NOTHING;
+ u.umonst->mappearance = 0;
newsym(u.ux, u.uy);
return 0;
}
@@ -686,18 +686,18 @@ mattacku(struct monst *mtmp)
if (!youseeit)
pline("%s %s!", Something,
(likes_gold(mtmp->data)
- && gy.youmonst.mappearance == GOLD_PIECE)
+ && u.umonst->mappearance == GOLD_PIECE)
? "tries to pick you up"
: "disturbs you");
else /* see note about m_monnam() above */
pline("Wait, %s! That %s is really %s named %s!", m_monnam(mtmp),
- mimic_obj_name(&gy.youmonst),
+ mimic_obj_name(u.umonst),
an(pmname(&mons[u.umonnum], Ugender)), svp.plname);
if (gm.multi < 0) { /* this should always be the case */
char buf[BUFSZ];
Sprintf(buf, "You appear to be %s again.",
- Upolyd ? (const char *) an(pmname(gy.youmonst.data,
+ Upolyd ? (const char *) an(pmname(u.umonst->data,
flags.female))
: (const char *) "yourself");
unmul(buf); /* immediately stop mimicking */
@@ -783,7 +783,7 @@ mattacku(struct monst *mtmp)
continue;
}
mon_currwep = (struct obj *) 0;
- mattk = getmattk(mtmp, &gy.youmonst, i, sum, &alt_attk);
+ mattk = getmattk(mtmp, u.umonst, i, sum, &alt_attk);
if ((u.uswallow && mattk->aatyp != AT_ENGL)
|| (skipnonmagc && mattk->aatyp != AT_MAGC)
|| (gs.skipdrin && mattk->aatyp == AT_TENT
@@ -801,14 +801,14 @@ mattacku(struct monst *mtmp)
if (mattk->aatyp == AT_KICK && mtrapped_in_pit(mtmp))
continue;
if (!range2 && (!MON_WEP(mtmp) || mtmp->mconf || Conflict
- || !touch_petrifies(gy.youmonst.data))) {
+ || !touch_petrifies(u.umonst->data))) {
if (foundyou) {
if (tmp > (j = rnd(20 + i))) {
- if (unsolid(gy.youmonst.data)
- && failed_grab(mtmp, &gy.youmonst, mattk))
+ if (unsolid(u.umonst->data)
+ && failed_grab(mtmp, u.umonst, mattk))
continue;
if (mattk->aatyp != AT_KICK
- || !thick_skinned(gy.youmonst.data))
+ || !thick_skinned(u.umonst->data))
sum[i] = hitmu(mtmp, mattk);
} else
missmu(mtmp, (tmp == j), mattk);
@@ -824,7 +824,7 @@ mattacku(struct monst *mtmp)
/* Note: if displaced, prev attacks never succeeded */
if ((!range2 && i >= 2 && sum[i - 1] && sum[i - 2])
|| mtmp == u.ustuck) {
- if (!failed_grab(mtmp, &gy.youmonst, mattk))
+ if (!failed_grab(mtmp, u.umonst, mattk))
sum[i] = hitmu(mtmp, mattk);
}
break;
@@ -905,7 +905,7 @@ mattacku(struct monst *mtmp)
ART_SNICKERSNEE)
&& m_next2u(mtmp));
- hittmp = hitval(mon_currwep, &gy.youmonst);
+ hittmp = hitval(mon_currwep, u.umonst);
tmp += hittmp;
mswings(mtmp, mon_currwep, bash);
}
@@ -1091,7 +1091,7 @@ magic_negation(struct monst *mon)
struct obj *o;
long wearmask;
int armpro, mc = 0;
- boolean is_you = (mon == &gy.youmonst),
+ boolean is_you = (mon == u.umonst),
via_amul = FALSE,
gotprot = is_you ? (EProtection != 0L)
/* high priests have innate protection */
@@ -1144,7 +1144,7 @@ staticfn int
hitmu(struct monst *mtmp, struct attack *mattk)
{
struct permonst *mdat = mtmp->data;
- struct permonst *olduasmon = gy.youmonst.data;
+ struct permonst *olduasmon = u.umonst->data;
int res;
struct mhitm_data mhm;
mhm.hitflags = M_ATTK_MISS;
@@ -1188,9 +1188,9 @@ hitmu(struct monst *mtmp, struct attack *mattk)
if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight())
mhm.damage += d((int) mattk->damn, (int) mattk->damd); /* extra dmg */
- mhitm_adtyping(mtmp, mattk, &gy.youmonst, &mhm);
+ mhitm_adtyping(mtmp, mattk, u.umonst, &mhm);
- (void) mhitm_knockback(mtmp, &gy.youmonst, mattk, &mhm.hitflags,
+ (void) mhitm_knockback(mtmp, u.umonst, mattk, &mhm.hitflags,
(MON_WEP(mtmp) != 0));
if (mhm.done)
@@ -1240,8 +1240,8 @@ hitmu(struct monst *mtmp, struct attack *mattk)
if (Upolyd) {
hpmax_p = &u.mhmax;
- /* [can't use gy.youmonst.m_lev] */
- lowerlimit = min((int) gy.youmonst.data->mlevel, u.ulevel);
+ /* [can't use u.umonst->m_lev] */
+ lowerlimit = min((int) u.umonst->data->mlevel, u.ulevel);
} else {
hpmax_p = &u.uhpmax;
lowerlimit = minuhpmax(1);
@@ -1276,7 +1276,7 @@ gulp_blnd_check(void)
if (!Blinded && u.uswallow
&& (mattk = attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
- && can_blnd(u.ustuck, &gy.youmonst, mattk->aatyp, (struct obj *) 0)) {
+ && can_blnd(u.ustuck, u.umonst, mattk->aatyp, (struct obj *) 0)) {
++u.uswldtim; /* compensate for gulpmu change */
(void) gulpmu(u.ustuck, mattk);
return TRUE;
@@ -1298,11 +1298,11 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
if (!u.uswallow) { /* swallows you */
int omx = mtmp->mx, omy = mtmp->my;
- if (!engulf_target(mtmp, &gy.youmonst))
+ if (!engulf_target(mtmp, u.umonst))
return M_ATTK_MISS;
if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy))
return M_ATTK_MISS;
- if (failed_grab(mtmp, &gy.youmonst, mattk))
+ if (failed_grab(mtmp, u.umonst, mattk))
return M_ATTK_MISS;
if (Punished)
@@ -1354,7 +1354,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
unleash_all();
}
- if (touch_petrifies(gy.youmonst.data) && !resists_ston(mtmp)) {
+ if (touch_petrifies(u.umonst->data) && !resists_ston(mtmp)) {
/* put the attacker back where it started;
the resulting statue will end up there
[note: if poly'd hero could ride or non-poly'd hero could
@@ -1438,13 +1438,13 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
physical_damage = TRUE;
if (mtmp->data == &mons[PM_FOG_CLOUD]) {
You("are laden with moisture and %s",
- flaming(gy.youmonst.data)
+ flaming(u.umonst->data)
? "are smoldering out!"
: Breathless ? "find it mildly uncomfortable."
- : amphibious(gy.youmonst.data)
+ : amphibious(u.umonst->data)
? "feel comforted."
: "can barely breathe!");
- if ((Amphibious || Breathless) && !flaming(gy.youmonst.data))
+ if ((Amphibious || Breathless) && !flaming(u.umonst->data))
tmp = 0;
} else {
You("are %s!", enfolds(mtmp->data) ? "being squashed"
@@ -1469,7 +1469,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
}
break;
case AD_BLND:
- if (can_blnd(mtmp, &gy.youmonst, mattk->aatyp, (struct obj *) 0)) {
+ if (can_blnd(mtmp, u.umonst, mattk->aatyp, (struct obj *) 0)) {
if (!Blind) {
long was_blinded = Blinded;
@@ -1564,13 +1564,13 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
if (!u.uswallow) {
; /* life-saving has already expelled swallowed hero */
- } else if (touch_petrifies(gy.youmonst.data) && !resists_ston(mtmp)) {
+ } else if (touch_petrifies(u.umonst->data) && !resists_ston(mtmp)) {
pline("%s very hurriedly %s you!", Monnam(mtmp),
digests(mtmp->data) ? "regurgitates"
: enfolds(mtmp->data) ? "releases"
: "expels");
expels(mtmp, mtmp->data, FALSE);
- } else if (!u.uswldtim || gy.youmonst.data->msize >= MZ_HUGE) {
+ } else if (!u.uswldtim || u.umonst->data->msize >= MZ_HUGE) {
/* As of 3.6.2: u.uswldtim used to be set to 0 by life-saving but it
expels now so the !u.uswldtim case is no longer possible;
however, polymorphing into a huge form while already
@@ -1621,7 +1621,7 @@ explmu(
kill_agr = FALSE; /* lifesaving? */
break;
case AD_BLND:
- not_affected = resists_blnd(&gy.youmonst);
+ not_affected = resists_blnd(u.umonst);
if (ufound && !not_affected) {
/* sometimes you're affected even if it's invisible */
if (mon_visible(mtmp) || (rnd(tmp /= 2) > u.ulevel)) {
@@ -1636,7 +1636,7 @@ explmu(
case AD_HALU:
not_affected |= Blind || (u.umonnum == PM_BLACK_LIGHT
|| u.umonnum == PM_VIOLET_FUNGUS
- || dmgtype(gy.youmonst.data, AD_STUN));
+ || dmgtype(u.umonst->data, AD_STUN));
if (ufound && !not_affected) {
boolean chg;
if (!Hallucination)
@@ -1748,7 +1748,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
&& !Stone_resistance && !Unaware) {
You("meet %s gaze.", s_suffix(mon_nam(mtmp)));
stop_occupation();
- if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))
+ if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM))
break;
urgent_pline("You turn to stone...");
svk.killer.format = KILLED_BY;
@@ -1791,7 +1791,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
}
break;
case AD_BLND:
- if (canseemon(mtmp) && !resists_blnd(&gy.youmonst)
+ if (canseemon(mtmp) && !resists_blnd(u.umonst)
&& mdistu(mtmp) <= BOLT_LIM * BOLT_LIM) {
if (cancelled) {
react = rn1(2, 2); /* "puzzled" || "dazzled" */
@@ -1842,9 +1842,9 @@ gazemu(struct monst *mtmp, struct attack *mattk)
}
burn_away_slime();
if (lev > rn2(20))
- (void) burnarmor(&gy.youmonst);
+ (void) burnarmor(u.umonst);
if (lev > rn2(20)) {
- (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
+ (void) destroy_items(u.umonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent);
}
if (dmg)
@@ -1943,8 +1943,8 @@ could_seduce(
if (is_animal(magr->data))
return 0;
- if (magr == &gy.youmonst) {
- pagr = gy.youmonst.data;
+ if (magr == u.umonst) {
+ pagr = u.umonst->data;
agrinvis = (Invis != 0);
genagr = poly_gender();
} else {
@@ -1952,7 +1952,7 @@ could_seduce(
agrinvis = magr->minvis;
genagr = gender(magr);
}
- if (mdef == &gy.youmonst) {
+ if (mdef == u.umonst) {
defperc = (See_invisible != 0);
gendef = poly_gender();
} else {
@@ -2202,7 +2202,7 @@ doseduce(struct monst *mon)
disp.botl = TRUE;
break;
case 3:
- if (!resists_drli(&gy.youmonst)) {
+ if (!resists_drli(u.umonst)) {
You_feel("out of shape.");
losexp("overexertion");
} else {
@@ -2541,7 +2541,7 @@ passiveum(
&& (perceives(mtmp->data) || !Invis)) {
if (Blind) {
pline("As a blind %s, you cannot defend yourself.",
- pmname(gy.youmonst.data,
+ pmname(u.umonst->data,
flags.female ? FEMALE : MALE));
} else {
if (mon_reflects(mtmp,
@@ -2571,8 +2571,8 @@ passiveum(
u.mh += (tmp + rn2(2)) / 2;
if (u.mhmax < u.mh)
u.mhmax = u.mh;
- if (u.mhmax > (((int) gy.youmonst.data->mlevel + 1) * 8))
- (void) split_mon(&gy.youmonst, mtmp);
+ if (u.mhmax > (((int) u.umonst->data->mlevel + 1) * 8))
+ (void) split_mon(u.umonst, mtmp);
break;
case AD_STUN: /* Yellow mold */
if (!mtmp->mstun) {
@@ -2617,20 +2617,20 @@ struct monst *
cloneu(void)
{
struct monst *mon;
- int mndx = monsndx(gy.youmonst.data);
+ int mndx = monsndx(u.umonst->data);
if (u.mh <= 1)
return (struct monst *) 0;
if (svm.mvitals[mndx].mvflags & G_EXTINCT)
return (struct monst *) 0;
- mon = makemon(gy.youmonst.data, u.ux, u.uy,
+ mon = makemon(u.umonst->data, u.ux, u.uy,
NO_MINVENT | MM_EDOG | MM_NOMSG);
if (!mon)
return NULL;
mon->mcloned = 1;
mon = christen_monst(mon, svp.plname);
initedog(mon, TRUE);
- mon->m_lev = gy.youmonst.data->mlevel;
+ mon->m_lev = u.umonst->data->mlevel;
mon->mhpmax = u.mhmax;
mon->mhp = u.mh / 2;
u.mh -= mon->mhp;
diff --git a/src/minion.c b/src/minion.c
index 96f9ffe1c..833e5597f 100644
--- a/src/minion.c
+++ b/src/minion.c
@@ -296,7 +296,7 @@ demon_talk(struct monst *mtmp)
}
newsym(mtmp->mx, mtmp->my);
}
- if (gy.youmonst.data->mlet == S_DEMON) { /* Won't blackmail their own. */
+ if (u.umonst->data->mlet == S_DEMON) { /* Won't blackmail their own. */
if (!Deaf)
pline("%s says, \"Good hunting, %s.\"", Amonnam(mtmp),
flags.female ? "Sister" : "Brother");
diff --git a/src/mon.c b/src/mon.c
index 789ca8276..2452813e4 100644
--- a/src/mon.c
+++ b/src/mon.c
@@ -330,7 +330,7 @@ int
m_poisongas_ok(struct monst *mtmp)
{
int px, py;
- boolean is_you = (mtmp == &gy.youmonst);
+ boolean is_you = (mtmp == u.umonst);
/* Non living, non breathing, immune monsters are not concerned */
if (nonliving(mtmp->data) || is_vampshifter(mtmp)
@@ -2104,8 +2104,8 @@ mon_allowflags(struct monst *mtmp)
if (passes_bars(mtmp->data)
/* restrict engulfer or holder who might try to pass iron bars while
carrying hero; accept small subset for poly'd hero passes_bars() */
- && (mtmp != u.ustuck || (unsolid(gy.youmonst.data)
- || verysmall(gy.youmonst.data))))
+ && (mtmp != u.ustuck || (unsolid(u.umonst->data)
+ || verysmall(u.umonst->data))))
allowflags |= ALLOW_BARS;
#if 0 /* can't do this here; leave it for mfndpos() */
if (is_displacer(mtmp->data))
@@ -3209,7 +3209,7 @@ corpse_chance(
if (was_swallowed && magr) {
/* mdef is a gas spore (AT_BOOM) that is exploding inside an
engulfer; suppress usual explosion since it's contained */
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
There("is an explosion in your %s!", body_part(STOMACH));
Sprintf(svk.killer.name, "%s explosion",
s_suffix(pmname(mdat, Mgender(mon))));
@@ -3617,7 +3617,7 @@ xkilled(
/* corpse--none if hero was inside the monster */
if (!wasinside && corpse_chance(mtmp, (struct monst *) 0, FALSE)) {
gz.zombify = (!gt.thrownobj && !gs.stoned && !uwep
- && zombie_maker(&gy.youmonst)
+ && zombie_maker(u.umonst)
&& zombie_form(mtmp->data) != NON_PM);
cadaver = make_corpse(mtmp, burycorpse ? CORPSTAT_BURIED
: CORPSTAT_NONE);
@@ -4595,7 +4595,7 @@ get_iter_mons_xy(
int
healmon(struct monst *mtmp, int amt, int overheal)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
int oldhp = Upolyd ? u.mh : u.uhp;
healup(amt, 0, 0, 0);
return (Upolyd ? u.mh : u.uhp) - oldhp;
@@ -4704,7 +4704,7 @@ maybe_unhide_at(coordxy x, coordxy y)
undetected = mtmp->mundetected;
trapped = mtmp->mtrapped;
} else if (u_at(x, y)) {
- mtmp = &gy.youmonst;
+ mtmp = u.umonst;
undetected = u.uundetected;
trapped = u.utrap;
} else {
@@ -4730,7 +4730,7 @@ hideunder(struct monst *mtmp)
const char *seenmon = (char *) 0, *seenobj = (char *) 0,
*locomo = (char *) 0;
int seeit = gi.in_mklev ? 0 : canseemon(mtmp);
- boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &gy.youmonst);
+ boolean oldundetctd, undetected = FALSE, is_u = (mtmp == u.umonst);
coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my;
if (mtmp == u.ustuck) {
@@ -5437,7 +5437,7 @@ newcham(
/* update swallow glyphs for new monster */
swallowed(0);
}
- } else if ((!sticks(mdat) && !sticks(gy.youmonst.data))
+ } else if ((!sticks(mdat) && !sticks(u.umonst->data))
/* sticky hero can't continue to hold mtmp if it has
turned into a non-solid creature; we don't use
uunstick() for that because its message would be
@@ -5800,7 +5800,7 @@ usmellmon(struct permonst *mdat)
boolean msg_given = FALSE;
if (mdat) {
- if (!olfaction(gy.youmonst.data))
+ if (!olfaction(u.umonst->data))
return FALSE;
mndx = monsndx(mdat);
switch (mndx) {
@@ -5895,7 +5895,7 @@ usmellmon(struct permonst *mdat)
msg_given = TRUE;
break;
case S_ORC:
- if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC)))
+ if (maybe_polyd(is_orc(u.umonst->data), Race_if(PM_ORC)))
You("notice an attractive smell.");
else
pline("A foul stench makes you feel a little nauseated.");
diff --git a/src/mondata.c b/src/mondata.c
index d7ea80245..2e6d049a2 100644
--- a/src/mondata.c
+++ b/src/mondata.c
@@ -13,7 +13,7 @@ void
set_mon_data(struct monst *mon, struct permonst *ptr)
{
int new_speed, old_speed = mon->data ? mon->data->mmove : 0;
- short *movement_p = (mon == &gy.youmonst) ? &u.umovement : &mon->movement;
+ short *movement_p = (mon == u.umonst) ? &u.umovement : &mon->movement;
mon->data = ptr;
mon->mnum = (short) monsndx(ptr);
@@ -85,14 +85,14 @@ poly_when_stoned(struct permonst *ptr)
/* allow G_EXTINCT */
}
-/* is 'mon' (possibly youmonst) protected against damage type 'adtype' via
+/* is 'mon' (possibly u.umonst) protected against damage type 'adtype' via
wielded weapon or worn dragon scales? [or by virtue of being a dragon?] */
boolean
defended(struct monst *mon, int adtyp)
{
struct obj *o, otemp;
int mndx;
- boolean is_you = (mon == &gy.youmonst);
+ boolean is_you = (mon == u.umonst);
/* is 'mon' wielding an artifact that protects against 'adtyp'? */
o = is_you ? uwep : MON_WEP(mon);
@@ -130,7 +130,7 @@ Resists_Elem(struct monst *mon, int propindx)
{
struct obj *o;
long slotmask;
- boolean is_you = (mon == &gy.youmonst);
+ boolean is_you = (mon == u.umonst);
int u_resist = 0, damgtype = 0, rsstmask = 0;
/*
@@ -204,7 +204,7 @@ resists_drli(struct monst *mon)
if (is_undead(ptr) || is_demon(ptr) || is_were(ptr)
/* is_were() doesn't handle hero in human form */
- || (mon == &gy.youmonst && u.ulycn >= LOW_PM)
+ || (mon == u.umonst && u.ulycn >= LOW_PM)
|| ptr == &mons[PM_DEATH] || is_vampshifter(mon))
return TRUE;
return defended(mon, AD_DRLI);
@@ -215,7 +215,7 @@ boolean
resists_magm(struct monst *mon)
{
struct permonst *ptr = mon->data;
- boolean is_you = (mon == &gy.youmonst);
+ boolean is_you = (mon == u.umonst);
long slotmask;
struct obj *o;
@@ -248,7 +248,7 @@ boolean
resists_blnd(struct monst *mon)
{
struct permonst *ptr = mon->data;
- boolean is_you = (mon == &gy.youmonst);
+ boolean is_you = (mon == u.umonst);
if (is_you ? (Blind || Unaware)
: (mon->mblinded || !mon->mcansee || !haseyes(ptr)
@@ -278,7 +278,7 @@ boolean
resists_blnd_by_arti(struct monst *mon)
{
struct obj *o;
- boolean is_you = (mon == &gy.youmonst);
+ boolean is_you = (mon == u.umonst);
o = is_you ? uwep : MON_WEP(mon);
if (o && o->oartifact && defends(AD_BLND, o))
@@ -308,7 +308,7 @@ can_blnd(
uchar aatyp,
struct obj *obj) /* aatyp == AT_WEAP, AT_SPIT */
{
- boolean is_you = (mdef == &gy.youmonst);
+ boolean is_you = (mdef == u.umonst);
boolean check_visor = FALSE;
struct obj *o;
@@ -354,7 +354,7 @@ can_blnd(
return TRUE; /* no defense */
} else
return FALSE; /* other objects cannot cause blindness yet */
- if ((magr == &gy.youmonst) && u.uswallow)
+ if ((magr == u.umonst) && u.uswallow)
return FALSE; /* can't affect eyes while inside monster */
break;
@@ -369,7 +369,7 @@ can_blnd(
/* e.g. raven: all ublindf, including LENSES, protect */
if (is_you && ublindf)
return FALSE;
- if ((magr == &gy.youmonst) && u.uswallow)
+ if ((magr == u.umonst) && u.uswallow)
return FALSE; /* can't affect eyes while inside monster */
check_visor = TRUE;
break;
@@ -387,7 +387,7 @@ can_blnd(
/* check if wearing a visor (only checked if visor might help) */
if (check_visor) {
- o = (mdef == &gy.youmonst) ? gi.invent : mdef->minvent;
+ o = (mdef == u.umonst) ? gi.invent : mdef->minvent;
for (; o; o = o->nobj)
if ((o->owornmask & W_ARMH)
&& objdescr_is(o, "visored helmet"))
@@ -570,7 +570,7 @@ can_blow(struct monst *mtmp)
&& (breathless(mtmp->data) || verysmall(mtmp->data)
|| !has_head(mtmp->data) || mtmp->data->mlet == S_EEL))
return FALSE;
- if ((mtmp == &gy.youmonst) && Strangled)
+ if ((mtmp == u.umonst) && Strangled)
return FALSE;
return TRUE;
}
@@ -579,7 +579,7 @@ can_blow(struct monst *mtmp)
boolean
can_chant(struct monst *mtmp)
{
- if ((mtmp == &gy.youmonst && Strangled)
+ if ((mtmp == u.umonst && Strangled)
|| is_silent(mtmp->data) || !has_head(mtmp->data)
|| mtmp->data->msound == MS_BUZZ || mtmp->data->msound == MS_BURBLE)
return FALSE;
@@ -602,10 +602,10 @@ can_be_strangled(struct monst *mon)
are non-breathing creatures which have higher brain function. */
if (!has_head(mon->data))
return FALSE;
- if (mon == &gy.youmonst) {
+ if (mon == u.umonst) {
/* hero can't be mindless but poly'ing into mindless form can
confer strangulation protection */
- nobrainer = mindless(gy.youmonst.data);
+ nobrainer = mindless(u.umonst->data);
nonbreathing = Breathless;
} else {
nobrainer = mindless(mon->data);
@@ -1358,7 +1358,7 @@ big_little_match(int montyp1, int montyp2)
const struct permonst *
raceptr(struct monst *mtmp)
{
- if (mtmp == &gy.youmonst && !Upolyd)
+ if (mtmp == u.umonst && !Upolyd)
return &mons[gu.urace.mnum];
return mtmp->data;
}
diff --git a/src/monmove.c b/src/monmove.c
index 6489d19d4..fe3040da3 100644
--- a/src/monmove.c
+++ b/src/monmove.c
@@ -364,7 +364,7 @@ release_hero(struct monst *mon)
if (mon == u.ustuck) {
if (u.uswallow) {
expels(mon, mon->data, TRUE);
- } else if (!sticks(gy.youmonst.data)) {
+ } else if (!sticks(u.umonst->data)) {
unstuck(mon); /* let go */
You("get released!");
}
@@ -608,8 +608,8 @@ mind_blast(struct monst *mtmp)
/* hero has no way to hide as monster but
check for that theoretical case anyway */
&& U_AP_TYPE != M_AP_MONSTER) {
- gy.youmonst.m_ap_type = M_AP_NOTHING;
- gy.youmonst.mappearance = 0;
+ u.umonst->m_ap_type = M_AP_NOTHING;
+ u.umonst->mappearance = 0;
newsym(u.ux, u.uy);
}
pline("It locks on to your %s!",
@@ -649,7 +649,7 @@ mind_blast(struct monst *mtmp)
void
m_everyturn_effect(struct monst *mtmp)
{
- boolean is_u = (mtmp == &gy.youmonst) ? TRUE : FALSE;
+ boolean is_u = (mtmp == u.umonst) ? TRUE : FALSE;
coordxy x = is_u ? u.ux : mtmp->mx,
y = is_u ? u.uy : mtmp->my;
@@ -671,7 +671,7 @@ m_everyturn_effect(struct monst *mtmp)
void
m_postmove_effect(struct monst *mtmp)
{
- boolean is_u = (mtmp == &gy.youmonst) ? TRUE : FALSE;
+ boolean is_u = (mtmp == u.umonst) ? TRUE : FALSE;
coordxy x = is_u ? u.ux0 : mtmp->mx,
y = is_u ? u.uy0 : mtmp->my;
@@ -806,7 +806,7 @@ dochug(struct monst *mtmp)
pline("%s whispers at thin air.",
cansee(mtmp->mux, mtmp->muy) ? Monnam(mtmp) : "It");
- if (is_demon(gy.youmonst.data)) {
+ if (is_demon(u.umonst->data)) {
/* "Good hunting, brother" */
if (!tele_restrict(mtmp))
(void) rloc(mtmp, RLOC_MSG);
@@ -1052,7 +1052,7 @@ mon_would_consume_item(struct monst *mtmp, struct obj *otmp)
boolean
itsstuck(struct monst *mtmp)
{
- if (sticks(gy.youmonst.data) && mtmp == u.ustuck && !u.uswallow) {
+ if (sticks(u.umonst->data) && mtmp == u.ustuck && !u.uswallow) {
pline_mon(mtmp, "%s cannot escape from you!", Monnam(mtmp));
return TRUE;
}
@@ -1862,8 +1862,8 @@ m_move(struct monst *mtmp, int after)
if (!mtmp->mcansee
|| (should_see && Invis && !perceives(ptr) && rn2(11))
- || is_obj_mappear(&gy.youmonst, STRANGE_OBJECT) || u.uundetected
- || (is_obj_mappear(&gy.youmonst, GOLD_PIECE) && !likes_gold(ptr))
+ || is_obj_mappear(u.umonst, STRANGE_OBJECT) || u.uundetected
+ || (is_obj_mappear(u.umonst, GOLD_PIECE) && !likes_gold(ptr))
|| (mtmp->mpeaceful && !mtmp->isshk) /* allow shks to follow */
|| ((monsndx(ptr) == PM_STALKER || ptr->mlet == S_BAT
|| ptr->mlet == S_LIGHT) && !rn2(3)))
@@ -1889,7 +1889,7 @@ m_move(struct monst *mtmp, int after)
if ((!mtmp->mpeaceful || !rn2(10)) && (!Is_rogue_level(&u.uz))) {
boolean in_line = (lined_up(mtmp)
&& (distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy)
- <= (throws_rocks(gy.youmonst.data) ? 20
+ <= (throws_rocks(u.umonst->data) ? 20
: (ACURRSTR / 2 + 1))));
if (appr != 1 || !in_line) {
@@ -2318,7 +2318,7 @@ stuff_prevents_passage(struct monst *mtmp)
{
struct obj *chain, *obj;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
chain = gi.invent;
} else {
chain = mtmp->minvent;
diff --git a/src/mthrowu.c b/src/mthrowu.c
index 6f8ed721c..850abac8a 100644
--- a/src/mthrowu.c
+++ b/src/mthrowu.c
@@ -124,7 +124,7 @@ thitu(
pline("It doesn't seem to hurt you.");
monstseesu(M_SEEN_ACID);
} else if (obj && stone_missile(obj)
- && passes_rocks(gy.youmonst.data)) {
+ && passes_rocks(u.umonst->data)) {
/* use 'named' as an approximation for "hitting from above";
we avoid "passes through you" for horizontal flight path
because missile stops and that wording would suggest that
@@ -134,7 +134,7 @@ thitu(
} else if (obj && obj->oclass == POTION_CLASS) {
/* an explosion which scatters objects might hit hero with one
(potions deliberately thrown at hero are handled by m_throw) */
- potionhit(&gy.youmonst, obj, POTHIT_OTHER_THROW);
+ potionhit(u.umonst, obj, POTHIT_OTHER_THROW);
*objp = obj = 0; /* potionhit() uses up the potion */
} else {
if (obj && objects[obj->otyp].oc_material == SILVER
@@ -184,7 +184,7 @@ drop_throw(
if (!(broken = flooreffects(obj, x, y, "fall"))) {
place_object(obj, x, y);
if (!mtmp && u_at(x, y))
- mtmp = &gy.youmonst;
+ mtmp = u.umonst;
if (mtmp && ohit)
passive_obj(mtmp, obj, (struct attack *) 0);
stackobj(obj);
@@ -508,7 +508,7 @@ ucatchgem(
struct monst *mon)
{
/* won't catch rock or gray stone; catch (then drop) worthless glass */
- if (gem->otyp <= LAST_GLASS_GEM && is_unicorn(gy.youmonst.data)) {
+ if (gem->otyp <= LAST_GLASS_GEM && is_unicorn(u.umonst->data)) {
char *gem_xname = xname(gem),
*mon_s_name = s_suffix(mon_nam(mon));
@@ -537,7 +537,7 @@ u_catch_thrown_obj(struct obj *otmp)
if (!Blind && !Confusion && !Stunned && !Fumbling
&& otmp->oclass != VENOM_CLASS
- && !nohands(gy.youmonst.data) && freehand()
+ && !nohands(u.umonst->data) && freehand()
&& calc_capacity(otmp->owt) <= SLT_ENCUMBER && !rn2(catch_chance)) {
char buf[BUFSZ];
@@ -696,7 +696,7 @@ m_throw(
break;
if (singleobj->oclass == POTION_CLASS) {
- potionhit(&gy.youmonst, singleobj, POTHIT_MONST_THROW);
+ potionhit(u.umonst, singleobj, POTHIT_MONST_THROW);
break;
}
oldumort = u.umortality;
@@ -719,7 +719,7 @@ m_throw(
{
int dam, hitv;
- dam = dmgval(singleobj, &gy.youmonst);
+ dam = dmgval(singleobj, u.umonst);
hitv = 3 - distmin(u.ux, u.uy, mon->mx, mon->my);
if (hitv < -4)
hitv = -4;
@@ -732,7 +732,7 @@ m_throw(
if (singleobj->otyp == ELVEN_ARROW)
dam++;
}
- if (bigmonst(gy.youmonst.data))
+ if (bigmonst(u.umonst->data))
hitv++;
hitv += 8 + singleobj->spe;
if (dam < 1)
@@ -752,7 +752,7 @@ m_throw(
poison is limited to attrib loss */
(u.umortality > oldumort) ? 0 : 10, TRUE);
}
- if (hitu && can_blnd((struct monst *) 0, &gy.youmonst,
+ if (hitu && can_blnd((struct monst *) 0, u.umonst,
(uchar) ((singleobj->otyp == BLINDING_VENOM)
? AT_SPIT
: AT_WEAP),
@@ -767,7 +767,7 @@ m_throw(
} else if (singleobj->otyp == BLINDING_VENOM) {
const char *eyes = body_part(EYE);
- if (eyecount(gy.youmonst.data) != 1)
+ if (eyecount(u.umonst->data) != 1)
eyes = makeplural(eyes);
/* venom in the eyes */
if (!Blind)
@@ -778,7 +778,7 @@ m_throw(
}
if (hitu && singleobj->otyp == EGG) {
if (!Stoned && !Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
make_stoned(5L, (char *) 0, KILLED_BY, "");
}
@@ -1030,7 +1030,7 @@ spitmm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg)
return M_ATTK_MISS;
}
if (m_lined_up(mtarg, mtmp)) {
- boolean utarg = (mtarg == &gy.youmonst);
+ boolean utarg = (mtarg == u.umonst);
coordxy tx = utarg ? mtmp->mux : mtarg->mx;
coordxy ty = utarg ? mtmp->muy : mtarg->my;
@@ -1093,7 +1093,7 @@ int
breamm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg)
{
int typ = get_atkdam_type(mattk->adtyp);
- boolean utarget = (mtarg == &gy.youmonst);
+ boolean utarget = (mtarg == u.umonst);
if (m_lined_up(mtarg, mtmp)) {
if (mtmp->mcan) {
@@ -1225,11 +1225,11 @@ thrwmu(struct monst *mtmp)
obj_is_pname(otmp) ? the(onm) : an(onm));
}
- dam = dmgval(otmp, &gy.youmonst);
+ dam = dmgval(otmp, u.umonst);
hitv = 3 - distmin(u.ux, u.uy, mtmp->mx, mtmp->my);
if (hitv < -4)
hitv = -4;
- if (bigmonst(gy.youmonst.data))
+ if (bigmonst(u.umonst->data))
hitv++;
hitv += 8 + otmp->spe;
if (dam < 1)
@@ -1267,14 +1267,14 @@ thrwmu(struct monst *mtmp)
int
spitmu(struct monst *mtmp, struct attack *mattk)
{
- return spitmm(mtmp, mattk, &gy.youmonst);
+ return spitmm(mtmp, mattk, u.umonst);
}
/* monster breathes at you (ranged) */
int
breamu(struct monst *mtmp, struct attack *mattk)
{
- return breamm(mtmp, mattk, &gy.youmonst);
+ return breamm(mtmp, mattk, u.umonst);
}
/* return TRUE if terrain at x,y blocks linedup checks */
@@ -1375,7 +1375,7 @@ linedup(
staticfn int
m_lined_up(struct monst *mtarg, struct monst *mtmp)
{
- boolean utarget = (mtarg == &gy.youmonst);
+ boolean utarget = (mtarg == u.umonst);
coordxy tx = utarget ? mtmp->mux : mtarg->mx;
coordxy ty = utarget ? mtmp->muy : mtarg->my;
boolean ignore_boulders = utarget && (throws_rocks(mtmp->data)
@@ -1397,7 +1397,7 @@ m_lined_up(struct monst *mtarg, struct monst *mtmp)
boolean
lined_up(struct monst *mtmp)
{
- return m_lined_up(&gy.youmonst, mtmp) ? TRUE : FALSE;
+ return m_lined_up(u.umonst, mtmp) ? TRUE : FALSE;
}
/* check if a monster is carrying an item of a particular type */
@@ -1406,7 +1406,7 @@ m_carrying(struct monst *mtmp, int type)
{
struct obj *otmp;
- for (otmp = (mtmp == &gy.youmonst) ? gi.invent : mtmp->minvent; otmp;
+ for (otmp = (mtmp == u.umonst) ? gi.invent : mtmp->minvent; otmp;
otmp = otmp->nobj)
if (otmp->otyp == type)
break;
diff --git a/src/muse.c b/src/muse.c
index 78b61c10b..07cc865da 100644
--- a/src/muse.c
+++ b/src/muse.c
@@ -252,7 +252,7 @@ mreadmsg(struct monst *mtmp, struct obj *otmp)
pline_mon(mtmp, "%s reads %s!", Monnam(mtmp), onambuf);
} else { /* !Deaf, otherwise we wouldn't reach here */
char blindbuf[BUFSZ];
- boolean similar = same_race(gy.youmonst.data, mtmp->data),
+ boolean similar = same_race(u.umonst->data, mtmp->data),
uniqmon = ((mtmp->data->geno & G_UNIQ) != 0
/* shopkeepers aren't unique monsters but since
they have distinct names, treat them as such */
@@ -1565,8 +1565,8 @@ find_offensive(struct monst *mtmp)
}
nomore(MUSE_CAMERA);
if (obj->otyp == EXPENSIVE_CAMERA
- && ((!Blind && !resists_blnd(&gy.youmonst))
- || hates_light(gy.youmonst.data))
+ && ((!Blind && !resists_blnd(u.umonst))
+ || hates_light(u.umonst->data))
&& dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <= 2
&& obj->spe > 0 && !rn2(6)) {
gm.m.offensive = obj;
@@ -1598,7 +1598,7 @@ mbhitm(struct monst *mtmp, struct obj *otmp)
{
int tmp;
boolean reveal_invis = FALSE, learnit = FALSE,
- hits_you = (mtmp == &gy.youmonst);
+ hits_you = (mtmp == u.umonst);
if (!hits_you && otmp->otyp != WAN_UNDEAD_TURNING) {
mtmp->msleeping = 0;
@@ -1761,7 +1761,7 @@ mbhit(
break;
}
if (u_at(gb.bhitpos.x, gb.bhitpos.y)) {
- (*fhitm)(&gy.youmonst, obj);
+ (*fhitm)(u.umonst, obj);
range -= 3;
} else if ((mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y)) != 0) {
if (cansee(gb.bhitpos.x, gb.bhitpos.y) && !canspotmon(mtmp))
@@ -1944,7 +1944,7 @@ use_offensive(struct monst *mtmp)
Monnam(mtmp), an(xname(otmp)));
}
gm.m_using = TRUE;
- if (!Blind && !resists_blnd(&gy.youmonst)) {
+ if (!Blind && !resists_blnd(u.umonst)) {
You("are blinded by the flash of light!");
make_blinded(BlindedTimeout + (long) rnd(1 + 50), FALSE);
}
@@ -2857,7 +2857,7 @@ ureflects(const char *fmt, const char *str)
if (fmt && str)
pline(fmt, str, uskin ? "luster" : "armor");
return TRUE;
- } else if (gy.youmonst.data == &mons[PM_SILVER_DRAGON]) {
+ } else if (u.umonst->data == &mons[PM_SILVER_DRAGON]) {
if (fmt && str)
pline(fmt, str, "scales");
return TRUE;
diff --git a/src/music.c b/src/music.c
index 21614860d..7034577a5 100644
--- a/src/music.c
+++ b/src/music.c
@@ -165,7 +165,7 @@ awaken_soldiers(struct monst *bugler /* monster that played instrument */)
int distance, distm;
/* distance of affected non-soldier monsters to bugler */
- distance = ((bugler == &gy.youmonst) ? u.ulevel
+ distance = ((bugler == u.umonst) ? u.ulevel
: bugler->data->mlevel) * 30;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
@@ -182,7 +182,7 @@ awaken_soldiers(struct monst *bugler /* monster that played instrument */)
else if (!Deaf)
Norep("%s the rattle of battle gear being readied.",
"You hear"); /* Deaf-aware */
- } else if ((distm = ((bugler == &gy.youmonst)
+ } else if ((distm = ((bugler == u.umonst)
? mdistu(mtmp)
: dist2(bugler->mx, bugler->my, mtmp->mx,
mtmp->my))) < distance) {
@@ -301,7 +301,7 @@ do_pit(coordxy x, coordxy y, unsigned tu_pit)
Your("chain breaks!");
reset_utrap(TRUE);
}
- if (Levitation || Flying || is_clinger(gy.youmonst.data)) {
+ if (Levitation || Flying || is_clinger(u.umonst->data)) {
if (!tu_pit) { /* no pit here previously */
pline("A chasm opens up under you!");
You("don't fall in!");
@@ -327,8 +327,8 @@ do_pit(coordxy x, coordxy y, unsigned tu_pit)
if (keepfooting)
exercise(A_DEX, TRUE);
else
- selftouch((Upolyd && (slithy(gy.youmonst.data)
- || nolimbs(gy.youmonst.data)))
+ selftouch((Upolyd && (slithy(u.umonst->data)
+ || nolimbs(u.umonst->data)))
? "Shaken, you"
: "Falling down, you");
}
@@ -653,7 +653,7 @@ do_improvisation(struct obj *instr)
else
You("blow into the bugle.");
Hero_playnotes(obj_to_instr(&itmp), improvisation, 80);
- awaken_soldiers(&gy.youmonst);
+ awaken_soldiers(u.umonst);
exercise(A_WIS, FALSE);
break;
case MAGIC_HARP: /* Charm monsters */
@@ -769,7 +769,7 @@ do_play_instrument(struct obj *instr)
} else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE
|| instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN
|| instr->otyp == FIRE_HORN || instr->otyp == BUGLE)
- && !can_blow(&gy.youmonst)) {
+ && !can_blow(u.umonst)) {
You("are incapable of playing %s.", thesimpleoname(instr));
return ECMD_OK;
}
diff --git a/src/pager.c b/src/pager.c
index 82b8bc7eb..ac8b5f61e 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -121,7 +121,7 @@ self_lookat(char *outbuf)
Sprintf(eos(outbuf), ", mounted on %s", y_monnam(u.usteed));
if (u.uundetected || (Upolyd && U_AP_TYPE)
|| visible_region_at(u.ux, u.uy))
- mhidden_description(&gy.youmonst,
+ mhidden_description(u.umonst,
MHID_PREFIX | MHID_ARTICLE | MHID_REGION,
eos(outbuf));
if (Punished)
@@ -196,7 +196,7 @@ mhidden_description(
incl_article = (mhid_flags & MHID_ARTICLE) != 0,
show_altmon = (mhid_flags & MHID_ALTMON) != 0,
force_region = (mhid_flags & MHID_REGION) != 0;
- boolean fakeobj, isyou = (mon == &gy.youmonst);
+ boolean fakeobj, isyou = (mon == u.umonst);
coordxy x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my;
int glyph = (svl.level.flags.hero_memory && !isyou) ? levl[x][y].glyph
: glyph_at(x, y);
@@ -446,7 +446,7 @@ look_at_monster(
Strcat(buf, digests(mtmp->data) ? ", swallowing you"
: ", engulfing you");
else
- Strcat(buf, (Upolyd && sticks(gy.youmonst.data))
+ Strcat(buf, (Upolyd && sticks(u.umonst->data))
? ", being held" : ", holding you");
}
/* if mtmp isn't able to move (other than because it is a type of
@@ -1167,7 +1167,7 @@ add_cmap_descr(
/* grab a scratch buffer we can safely return (via *firstmatch
when applicable) */
- mbuf = mon_nam(&gy.youmonst);
+ mbuf = mon_nam(u.umonst);
if (absidx == S_pool) {
levl[cc.x][cc.y].typ = (idx == S_pool) ? POOL : MOAT;
diff --git a/src/pickup.c b/src/pickup.c
index 331933137..5f6e55de8 100644
--- a/src/pickup.c
+++ b/src/pickup.c
@@ -287,7 +287,7 @@ fatal_corpse_mistake(struct obj *obj, boolean remotely)
if (u_safe_from_fatal_corpse(obj, st_all) || remotely)
return FALSE;
- if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
+ if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) {
display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */
return FALSE;
}
@@ -723,9 +723,9 @@ pickup(int what) /* should be a long */
*/
if ((gm.multi && !svc.context.run)
|| (autopickup && !flags.pickup)
- || notake(gy.youmonst.data)) {
+ || notake(u.umonst->data)) {
check_here(FALSE);
- if (notake(gy.youmonst.data) && OBJ_AT(u.ux, u.uy)
+ if (notake(u.umonst->data) && OBJ_AT(u.ux, u.uy)
&& (autopickup || flags.pickup))
You("are physically incapable of picking anything up.");
return 0;
@@ -892,8 +892,8 @@ pickup(int what) /* should be a long */
}
if (!u.uswallow) {
- if (hides_under(gy.youmonst.data))
- (void) hideunder(&gy.youmonst);
+ if (hides_under(u.umonst->data))
+ (void) hideunder(u.umonst);
/* position may need updating (invisible hero) */
if (n_picked)
@@ -1155,7 +1155,7 @@ query_objlist(const char *qstr, /* query string */
fake_hero_object = cg.zeroobj;
fake_hero_object.quan = 1L; /* not strictly necessary... */
any.a_obj = &fake_hero_object;
- tmpglyph = mon_to_glyph(&gy.youmonst, rn2_on_display_rng);
+ tmpglyph = mon_to_glyph(u.umonst, rn2_on_display_rng);
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
add_menu(win, &tmpglyphinfo, &any,
/* fake inventory letter, no group accelerator */
@@ -1719,7 +1719,7 @@ lift_object(
and for boulder picked up by hero poly'd into a giant; override
availability of open inventory slot iff not already carrying one */
if (obj->otyp == LOADSTONE
- || (obj->otyp == BOULDER && throws_rocks(gy.youmonst.data))) {
+ || (obj->otyp == BOULDER && throws_rocks(u.umonst->data))) {
if (inv_cnt(FALSE) < invlet_basic || !carrying(obj->otyp)
|| merge_choice(gi.invent, obj))
return 1; /* lift regardless of current situation */
@@ -1823,7 +1823,7 @@ pickup_object(
&& engulfing_u(obj->ocarry)) {
You_cant("pick %s up.", ysimple_name(obj));
return 0;
- } else if (obj->oartifact && !touch_artifact(obj, &gy.youmonst)) {
+ } else if (obj->oartifact && !touch_artifact(obj, u.umonst)) {
return 0;
} else if (obj->otyp == CORPSE) {
if (fatal_corpse_mistake(obj, telekinesis)
@@ -1983,7 +1983,7 @@ encumber_msg(void)
break;
case 3:
You("%s under your heavy load. Movement is very hard.",
- stagger(gy.youmonst.data, "stagger"));
+ stagger(u.umonst->data, "stagger"));
break;
default:
You("%s move a handspan with this load!",
@@ -2004,7 +2004,7 @@ encumber_msg(void)
break;
case 3:
You("%s under your load. Movement is still very hard.",
- stagger(gy.youmonst.data, "stagger"));
+ stagger(u.umonst->data, "stagger"));
break;
}
disp.botl = TRUE;
@@ -2051,7 +2051,7 @@ able_to_loot(
You("cannot %s things that are deep in the %s.", verb,
hliquid(is_lava(x, y) ? "lava" : "water"));
return FALSE;
- } else if (nolimbs(gy.youmonst.data)) {
+ } else if (nolimbs(u.umonst->data)) {
pline("Without limbs, you cannot %s anything.", verb);
return FALSE;
} else if (looting && !freehand()) {
@@ -2189,7 +2189,7 @@ doloot_core(void)
/* "Can't do that while carrying so much stuff." */
return ECMD_OK;
}
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You("have no hands!"); /* not `body_part(HAND)' */
return ECMD_OK;
}
@@ -2440,7 +2440,7 @@ loot_mon(struct monst *mtmp, int *passed_info, boolean *prev_loot)
x_monnam(mtmp, ARTICLE_THE, (char *) 0,
SUPPRESS_SADDLE, FALSE));
if ((c = yn_function(qbuf, ynqchars, 'n', TRUE)) == 'y') {
- if (nolimbs(gy.youmonst.data)) {
+ if (nolimbs(u.umonst->data)) {
You_cant("do that without limbs."); /* not body_part(HAND) */
return 0;
}
@@ -2732,7 +2732,7 @@ out_container(struct obj *obj)
obj->owt = weight(obj);
}
- if (obj->oartifact && !touch_artifact(obj, &gy.youmonst))
+ if (obj->oartifact && !touch_artifact(obj, u.umonst))
return 0;
if (fatal_corpse_mistake(obj, FALSE))
@@ -2936,7 +2936,7 @@ explain_container_prompt(boolean more_containers)
boolean
u_handsy(void)
{
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You("have no hands!"); /* not `body_part(HAND)' */
return FALSE;
} else if (!freehand()) {
diff --git a/src/pline.c b/src/pline.c
index 79dd8b28b..c8d61b09d 100644
--- a/src/pline.c
+++ b/src/pline.c
@@ -139,7 +139,7 @@ pline_mon(struct monst *mtmp, const char *line, ...)
{
va_list the_args;
- if (mtmp == &gy.youmonst)
+ if (mtmp == u.umonst)
set_msg_xy(0, 0);
else
set_msg_xy(mtmp->mx, mtmp->my);
diff --git a/src/polyself.c b/src/polyself.c
index 43c76cf40..2461a1b79 100644
--- a/src/polyself.c
+++ b/src/polyself.c
@@ -5,8 +5,8 @@
/*
* Polymorph self routine.
*
- * Note: the light source handling code assumes that gy.youmonst.m_id
- * always remains 1 and gy.youmonst.mx will always remain 0 when it handles
+ * Note: the light source handling code assumes that u.umonst->m_id
+ * always remains 1 and u.umonst->mx will always remain 0 when it handles
* the case of the player polymorphed into a light-emitting monster.
*
* Transformation sequences:
@@ -33,24 +33,24 @@ staticfn void polysense(void);
static const char no_longer_petrify_resistant[] =
"No longer petrify-resistant, you";
-/* update the gy.youmonst.data structure pointer and intrinsics */
+/* update the u.umonst->data structure pointer and intrinsics */
void
set_uasmon(void)
{
struct permonst *mdat = &mons[u.umonnum];
- boolean was_vampshifter = valid_vampshiftform(gy.youmonst.cham, u.umonnum);
+ boolean was_vampshifter = valid_vampshiftform(u.umonst->cham, u.umonnum);
- set_mon_data(&gy.youmonst, mdat);
- gy.youmonst.m_id = 1;
+ set_mon_data(u.umonst, mdat);
+ u.umonst->m_id = 1;
if (Protection_from_shape_changers)
- gy.youmonst.cham = NON_PM;
- else if (is_vampire(gy.youmonst.data))
- gy.youmonst.cham = gy.youmonst.mnum;
+ u.umonst->cham = NON_PM;
+ else if (is_vampire(u.umonst->data))
+ u.umonst->cham = u.umonst->mnum;
/* assume hero-as-chameleon/doppelganger/sandestin doesn't change shape */
else if (!was_vampshifter)
- gy.youmonst.cham = NON_PM;
- u.mcham = gy.youmonst.cham; /* for save/restore since youmonst isn't */
+ u.umonst->cham = NON_PM;
+ u.mcham = u.umonst->cham; /* for save/restore since u.umonst isn't */
#define PROPSET(PropIndx, ON) \
do { \
@@ -59,7 +59,7 @@ set_uasmon(void)
else \
u.uprops[PropIndx].intrinsic &= ~FROMFORM; \
} while (0)
-#define resist_from_form(MRtyp) ((gy.youmonst.data->mresists & (MRtyp)) != 0)
+#define resist_from_form(MRtyp) ((u.umonst->data->mresists & (MRtyp)) != 0)
PROPSET(FIRE_RES, resist_from_form(MR_FIRE));
PROPSET(COLD_RES, resist_from_form( MR_COLD));
@@ -74,7 +74,7 @@ set_uasmon(void)
struct obj *save_uwep = uwep;
uwep = 0;
- PROPSET(DRAIN_RES, resists_drli(&gy.youmonst));
+ PROPSET(DRAIN_RES, resists_drli(u.umonst));
uwep = save_uwep;
}
/* resists_magm() takes wielded, worn, and carried equipment into
@@ -174,7 +174,7 @@ check_strangling(boolean on)
/* when Strangled is already set, polymorphing from one
vulnerable form into another causes the counter to be reset */
if (uamul && uamul->otyp == AMULET_OF_STRANGULATION
- && can_be_strangled(&gy.youmonst)) {
+ && can_be_strangled(u.umonst)) {
Strangled = 6L;
disp.botl = TRUE;
Your("%s %s your %s!", simpleonames(uamul),
@@ -185,7 +185,7 @@ check_strangling(boolean on)
/* off -- maybe block strangling */
} else {
- if (Strangled && !can_be_strangled(&gy.youmonst)) {
+ if (Strangled && !can_be_strangled(u.umonst)) {
Strangled = 0L;
disp.botl = TRUE;
You("are no longer being strangled.");
@@ -199,7 +199,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL
staticfn void
polyman(const char *fmt, const char *arg)
{
- boolean sticking = (sticks(gy.youmonst.data) && u.ustuck && !u.uswallow),
+ boolean sticking = (sticks(u.umonst->data) && u.ustuck && !u.uswallow),
was_mimicking = (U_AP_TYPE != M_AP_NOTHING);
boolean was_blind = !!Blind,
had_see_invis = !!See_invisible;
@@ -223,8 +223,8 @@ polyman(const char *fmt, const char *arg)
if (was_mimicking) {
if (gm.multi < 0)
unmul("");
- gy.youmonst.m_ap_type = M_AP_NOTHING;
- gy.youmonst.mappearance = 0;
+ u.umonst->m_ap_type = M_AP_NOTHING;
+ u.umonst->mappearance = 0;
}
newsym(u.ux, u.uy);
@@ -249,7 +249,7 @@ polyman(const char *fmt, const char *arg)
if (!!See_invisible ^ had_see_invis)
set_mimic_blocking(); /* See_invisible just toggled */
- if (u.twoweap && !could_twoweap(gy.youmonst.data))
+ if (u.twoweap && !could_twoweap(u.umonst->data))
untwoweapon();
if (u.utrap && u.utraptype == TT_PIT) {
@@ -279,8 +279,8 @@ change_sex(void)
* may be true for certain roles
*/
if (!Upolyd
- || (!is_male(gy.youmonst.data) && !is_female(gy.youmonst.data)
- && !is_neuter(gy.youmonst.data)))
+ || (!is_male(u.umonst->data) && !is_female(u.umonst->data)
+ && !is_neuter(u.umonst->data)))
flags.female = !flags.female;
if (Upolyd) /* poly'd: also change saved sex */
u.mfemale = !u.mfemale;
@@ -476,8 +476,8 @@ polyself(int psflags)
formrevert = ((psflags & POLY_REVERT) != 0),
draconian = (uarm && Is_dragon_armor(uarm)),
iswere = (ismnum(u.ulycn)),
- isvamp = (is_vampire(gy.youmonst.data)
- || is_vampshifter(&gy.youmonst)),
+ isvamp = (is_vampire(u.umonst->data)
+ || is_vampshifter(u.umonst)),
controllable_poly = Polymorph_control && !(Stunned || Unaware);
if (Unchanging) {
@@ -494,11 +494,11 @@ polyself(int psflags)
return;
}
}
- old_light = emits_light(gy.youmonst.data);
+ old_light = emits_light(u.umonst->data);
mntmp = NON_PM;
if (formrevert) {
- mntmp = gy.youmonst.cham;
+ mntmp = u.umonst->cham;
monsterpoly = TRUE;
controllable_poly = FALSE;
}
@@ -670,13 +670,13 @@ polyself(int psflags)
} else if (isvamp) {
do_vampyr:
if (mntmp < LOW_PM || (mons[mntmp].geno & G_UNIQ)) {
- mntmp = (gy.youmonst.data == &mons[PM_VAMPIRE_LEADER]
+ mntmp = (u.umonst->data == &mons[PM_VAMPIRE_LEADER]
&& !rn2(10)) ? PM_WOLF
: !rn2(4) ? PM_FOG_CLOUD
: PM_VAMPIRE_BAT;
- if (ismnum(gy.youmonst.cham)
- && !is_vampire(gy.youmonst.data) && !rn2(2))
- mntmp = gy.youmonst.cham;
+ if (ismnum(u.umonst->cham)
+ && !is_vampire(u.umonst->data) && !rn2(2))
+ mntmp = u.umonst->cham;
}
if (controllable_poly) {
Sprintf(buf, "Become %s?",
@@ -718,15 +718,15 @@ polyself(int psflags)
gs.sex_change_ok--; /* reset */
made_change:
- new_light = emits_light(gy.youmonst.data);
+ new_light = emits_light(u.umonst->data);
if (old_light != new_light) {
if (old_light)
- del_light_source(LS_MONSTER, monst_to_any(&gy.youmonst));
+ del_light_source(LS_MONSTER, monst_to_any(u.umonst));
if (new_light == 1)
++new_light; /* otherwise it's undetectable */
if (new_light)
new_light_source(u.ux, u.uy, new_light, LS_MONSTER,
- monst_to_any(&gy.youmonst));
+ monst_to_any(u.umonst));
}
}
@@ -735,9 +735,9 @@ int
polymon(int mntmp)
{
char buf[BUFSZ], ustuckNam[BUFSZ];
- boolean sticking = sticks(gy.youmonst.data) && u.ustuck && !u.uswallow,
+ boolean sticking = sticks(u.umonst->data) && u.ustuck && !u.uswallow,
was_blind = !!Blind, dochange = FALSE, was_expelled = FALSE,
- was_hiding_under = u.uundetected && hides_under(gy.youmonst.data);
+ was_hiding_under = u.uundetected && hides_under(u.umonst->data);
int mlvl, newMaxStr;
if (svm.mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
@@ -774,13 +774,13 @@ polymon(int mntmp)
/* if stuck mimicking gold, stop immediately */
if (gm.multi < 0 && U_AP_TYPE == M_AP_OBJECT
- && gy.youmonst.data->mlet != S_MIMIC)
+ && u.umonst->data->mlet != S_MIMIC)
unmul("");
/* if becoming a non-mimic, stop mimicking anything */
if (mons[mntmp].mlet != S_MIMIC) {
/* as in polyman() */
- gy.youmonst.m_ap_type = M_AP_NOTHING;
- gy.youmonst.mappearance = 0;
+ u.umonst->m_ap_type = M_AP_NOTHING;
+ u.umonst->mappearance = 0;
}
if (is_male(&mons[mntmp])) {
if (flags.female)
@@ -840,7 +840,7 @@ polymon(int mntmp)
You("no longer feel sick.");
}
if (Slimed) {
- if (flaming(gy.youmonst.data)) {
+ if (flaming(u.umonst->data)) {
make_slimed(0L, "The slime burns away!");
} else if (mntmp == PM_GREEN_SLIME) {
/* do it silently */
@@ -848,7 +848,7 @@ polymon(int mntmp)
}
}
check_strangling(FALSE); /* maybe stop strangling */
- if (nohands(gy.youmonst.data))
+ if (nohands(u.umonst->data))
make_glib(0);
/*
@@ -857,9 +857,9 @@ polymon(int mntmp)
* "experience level of you as a monster" for a polymorphed character.
*/
mlvl = (int) mons[mntmp].mlevel;
- if (gy.youmonst.data->mlet == S_DRAGON && mntmp >= PM_GRAY_DRAGON) {
+ if (u.umonst->data->mlet == S_DRAGON && mntmp >= PM_GRAY_DRAGON) {
u.mhmax = In_endgame(&u.uz) ? (8 * mlvl) : (4 * mlvl + d(mlvl, 4));
- } else if (is_golem(gy.youmonst.data)) {
+ } else if (is_golem(u.umonst->data)) {
u.mhmax = golemhp(mntmp);
} else {
if (!mlvl)
@@ -891,7 +891,7 @@ polymon(int mntmp)
/* if hiding under something and can't hide anymore, unhide now;
but don't auto-hide when not already hiding-under */
if (was_hiding_under)
- (void) hideunder(&gy.youmonst);
+ (void) hideunder(u.umonst);
if (u.utrap && u.utraptype == TT_PIT) {
set_utrap(rn1(6, 2), TT_PIT); /* time to escape resets */
@@ -904,7 +904,7 @@ polymon(int mntmp)
/* you now know what an egg of your type looks like; [moved from
below in case expels() -> spoteffects() drops hero onto any eggs] */
- if (lays_eggs(gy.youmonst.data)) {
+ if (lays_eggs(u.umonst->data)) {
learn_egg_type(u.umonnum);
/* make queen bees recognize killer bee eggs */
learn_egg_type(egg_type_from_parent(u.umonnum, TRUE));
@@ -914,13 +914,13 @@ polymon(int mntmp)
uchar usiz;
/* if new form can't be swallowed, make engulfer expel hero */
- if (unsolid(gy.youmonst.data)
+ if (unsolid(u.umonst->data)
/* subset of engulf_target() */
- || (usiz = gy.youmonst.data->msize) >= MZ_HUGE
+ || (usiz = u.umonst->data->msize) >= MZ_HUGE
|| (u.ustuck->data->msize < usiz && !is_whirly(u.ustuck->data))) {
boolean expels_mesg = TRUE;
- if (unsolid(gy.youmonst.data)) {
+ if (unsolid(u.umonst->data)) {
if (canspotmon(u.ustuck)) /* [see below for explanation] */
Strcpy(ustuckNam, Monnam(u.ustuck));
pline("%s can no longer contain you.", ustuckNam);
@@ -939,7 +939,7 @@ polymon(int mntmp)
/* being held; if now capable of holding, make holder
release so that hero doesn't automagically start holding
it; or, release if no longer capable of being held */
- && (sticks(gy.youmonst.data) || unsolid(gy.youmonst.data))) {
+ && (sticks(u.umonst->data) || unsolid(u.umonst->data))) {
/* u.ustuck name was saved above in case we're changing from can-see
to can't-see; but might have changed from can't-see to can-see so
override here if hero knows who u.ustuck is */
@@ -947,7 +947,7 @@ polymon(int mntmp)
Strcpy(ustuckNam, Monnam(u.ustuck));
set_ustuck((struct monst *) 0);
pline("%s loses its grip on you.", ustuckNam);
- } else if (sticking && !sticks(gy.youmonst.data)) {
+ } else if (sticking && !sticks(u.umonst->data)) {
/* was holding onto u.ustuck but no longer capable of that */
uunstick();
}
@@ -982,13 +982,13 @@ polymon(int mntmp)
buried_ball_to_freedom();
}
reset_utrap(TRUE);
- } else if (likes_lava(gy.youmonst.data) && u.utrap
+ } else if (likes_lava(u.umonst->data) && u.utrap
&& u.utraptype == TT_LAVA) {
pline_The("%s now feels soothing.", hliquid("lava"));
reset_utrap(TRUE);
}
- if (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
- || unsolid(gy.youmonst.data)) {
+ if (amorphous(u.umonst->data) || is_whirly(u.umonst->data)
+ || unsolid(u.umonst->data)) {
if (Punished) {
You("slip out of the iron chain.");
unpunish();
@@ -998,16 +998,16 @@ polymon(int mntmp)
}
}
if (u.utrap && (u.utraptype == TT_WEB || u.utraptype == TT_BEARTRAP)
- && (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
- || unsolid(gy.youmonst.data)
- || (gy.youmonst.data->msize <= MZ_SMALL
+ && (amorphous(u.umonst->data) || is_whirly(u.umonst->data)
+ || unsolid(u.umonst->data)
+ || (u.umonst->data->msize <= MZ_SMALL
&& u.utraptype == TT_BEARTRAP))) {
You("are no longer stuck in the %s.",
u.utraptype == TT_WEB ? "web" : "bear trap");
/* probably should burn webs too if PM_FIRE_ELEMENTAL */
reset_utrap(TRUE);
}
- if (webmaker(gy.youmonst.data) && u.utrap && u.utraptype == TT_WEB) {
+ if (webmaker(u.umonst->data) && u.utrap && u.utraptype == TT_WEB) {
You("orient yourself on the web.");
reset_utrap(TRUE);
}
@@ -1031,7 +1031,7 @@ polymon(int mntmp)
if (flags.verbose) {
static const char use_thec[] = "Use the command #%s to %s.";
static const char monsterc[] = "monster";
- struct permonst *uptr = gy.youmonst.data;
+ struct permonst *uptr = u.umonst->data;
boolean might_hide = (is_hider(uptr) || hides_under(uptr));
if (can_breathe(uptr))
@@ -1058,7 +1058,7 @@ polymon(int mntmp)
pline(use_thec, monsterc, "emit a mental blast");
if (uptr->msound == MS_SHRIEK) /* worthless, actually */
pline(use_thec, monsterc, "shriek");
- if (is_vampire(uptr) || is_vampshifter(&gy.youmonst))
+ if (is_vampire(uptr) || is_vampshifter(u.umonst))
pline(use_thec, monsterc, "change shape");
if (lays_eggs(uptr) && flags.female
@@ -1157,7 +1157,7 @@ staticfn void
break_armor(void)
{
struct obj *otmp;
- struct permonst *uptr = gy.youmonst.data;
+ struct permonst *uptr = u.umonst->data;
if (breakarm(uptr)) {
if ((otmp = uarm) != 0) {
@@ -1196,7 +1196,7 @@ break_armor(void)
useup(uarmu);
}
} else if (sliparm(uptr)) {
- if ((otmp = uarm) != 0 && racial_exception(&gy.youmonst, otmp) < 1) {
+ if ((otmp = uarm) != 0 && racial_exception(u.umonst, otmp) < 1) {
if (donning(otmp))
cancel_don();
Your("armor falls around you!");
@@ -1313,7 +1313,7 @@ drop_weapon(int alone)
* future it might not be so if there are monsters which cannot
* wear gloves but can wield weapons
*/
- if (!alone || cantwield(gy.youmonst.data)) {
+ if (!alone || cantwield(u.umonst->data)) {
candropwep = canletgo(uwep, "");
candropswapwep = !u.twoweap || canletgo(uswapwep, "");
if (alone) {
@@ -1355,7 +1355,7 @@ drop_weapon(int alone)
if (updateinv)
update_inventory();
- } else if (!could_twoweap(gy.youmonst.data)) {
+ } else if (!could_twoweap(u.umonst->data)) {
untwoweapon();
}
}
@@ -1390,8 +1390,8 @@ rehumanize(void)
* reverts to human rather than to vampire.
*/
- if (emits_light(gy.youmonst.data))
- del_light_source(LS_MONSTER, monst_to_any(&gy.youmonst));
+ if (emits_light(u.umonst->data))
+ del_light_source(LS_MONSTER, monst_to_any(u.umonst));
polyman("You return to %s form!", gu.urace.adj);
if (u.uhp < 1) {
@@ -1435,7 +1435,7 @@ dobreathe(void)
if (!getdir((char *) 0))
return ECMD_CANCEL;
- mattk = attacktype_fordmg(gy.youmonst.data, AT_BREA, AD_ANY);
+ mattk = attacktype_fordmg(u.umonst->data, AT_BREA, AD_ANY);
if (!mattk)
impossible("bad breath attack?"); /* mouthwash needed... */
else if (!u.dx && !u.dy && !u.dz)
@@ -1453,7 +1453,7 @@ dospit(void)
if (!getdir((char *) 0))
return ECMD_CANCEL;
- mattk = attacktype_fordmg(gy.youmonst.data, AT_SPIT, AD_ANY);
+ mattk = attacktype_fordmg(u.umonst->data, AT_SPIT, AD_ANY);
if (!mattk) {
impossible("bad spit attack?");
} else {
@@ -1632,7 +1632,7 @@ dosummon(void)
You("call upon your brethren for help!");
exercise(A_WIS, TRUE);
- if (!were_summon(gy.youmonst.data, TRUE, &placeholder, (char *) 0))
+ if (!were_summon(u.umonst->data, TRUE, &placeholder, (char *) 0))
pline("But none arrive.");
return ECMD_TIME;
}
@@ -1647,8 +1647,8 @@ dogaze(void)
uchar adtyp = 0;
for (i = 0; i < NATTK; i++) {
- if (gy.youmonst.data->mattk[i].aatyp == AT_GAZE) {
- adtyp = gy.youmonst.data->mattk[i].adtyp;
+ if (u.umonst->data->mattk[i].aatyp == AT_GAZE) {
+ adtyp = u.umonst->data->mattk[i].adtyp;
break;
}
}
@@ -1775,8 +1775,8 @@ dogaze(void)
int
dohide(void)
{
- boolean ismimic = gy.youmonst.data->mlet == S_MIMIC,
- on_ceiling = is_clinger(gy.youmonst.data) || Flying;
+ boolean ismimic = u.umonst->data->mlet == S_MIMIC,
+ on_ceiling = is_clinger(u.umonst->data) || Flying;
/* can't hide while being held (or holding) or while trapped
(except for floor hiders [trapper or mimic] in pits) */
@@ -1785,19 +1785,19 @@ dohide(void)
!u.ustuck ? "trapped"
: u.uswallow ? (digests(u.ustuck->data) ? "swallowed"
: "engulfed")
- : !sticks(gy.youmonst.data) ? "being held"
+ : !sticks(u.umonst->data) ? "being held"
: (humanoid(u.ustuck->data) ? "holding someone"
: "holding that creature"));
if (u.uundetected || (ismimic && U_AP_TYPE != M_AP_NOTHING)) {
u.uundetected = 0;
- gy.youmonst.m_ap_type = M_AP_NOTHING;
+ u.umonst->m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy);
}
return ECMD_OK;
}
/* note: hero-as-eel handling is incomplete but unnecessary;
such critters aren't offered the option of hiding via #monster */
- if (gy.youmonst.data->mlet == S_EEL && !is_pool(u.ux, u.uy)) {
+ if (u.umonst->data->mlet == S_EEL && !is_pool(u.ux, u.uy)) {
if (IS_FOUNTAIN(levl[u.ux][u.uy].typ))
pline_The("fountain is not deep enough to hide in.");
else
@@ -1805,7 +1805,7 @@ dohide(void)
u.uundetected = 0;
return ECMD_OK;
}
- if (hides_under(gy.youmonst.data)) {
+ if (hides_under(u.umonst->data)) {
long ct = 0L;
struct obj *otmp, *otop = svl.level.objects[u.ux][u.uy];
@@ -1846,7 +1846,7 @@ dohide(void)
u.uundetected = 0;
return ECMD_OK;
}
- if ((is_hider(gy.youmonst.data) && !Flying) /* floor hider */
+ if ((is_hider(u.umonst->data) && !Flying) /* floor hider */
&& (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))) {
There("is nowhere to hide beneath you.");
u.uundetected = 0;
@@ -1863,8 +1863,8 @@ dohide(void)
if (ismimic) {
/* should bring up a dialog "what would you like to imitate?" */
- gy.youmonst.m_ap_type = M_AP_OBJECT;
- gy.youmonst.mappearance = STRANGE_OBJECT;
+ u.umonst->m_ap_type = M_AP_OBJECT;
+ u.umonst->mappearance = STRANGE_OBJECT;
} else
u.uundetected = 1;
newsym(u.ux, u.uy);
@@ -1875,13 +1875,13 @@ dohide(void)
int
dopoly(void)
{
- struct permonst *savedat = gy.youmonst.data;
+ struct permonst *savedat = u.umonst->data;
- if (is_vampire(gy.youmonst.data) || is_vampshifter(&gy.youmonst)) {
+ if (is_vampire(u.umonst->data) || is_vampshifter(u.umonst)) {
polyself(POLY_MONSTER);
- if (savedat != gy.youmonst.data) {
+ if (savedat != u.umonst->data) {
You("transform into %s.",
- an(pmname(gy.youmonst.data, Ugender)));
+ an(pmname(u.umonst->data, Ugender)));
newsym(u.ux, u.uy);
}
}
@@ -2141,7 +2141,7 @@ mbodypart(struct monst *mon, int part)
const char *
body_part(int part)
{
- return mbodypart(&gy.youmonst, part);
+ return mbodypart(u.umonst, part);
}
int
@@ -2150,7 +2150,7 @@ poly_gender(void)
/* Returns gender of polymorphed player;
* 0/1=same meaning as flags.female, 2=none.
*/
- if (is_neuter(gy.youmonst.data) || !humanoid(gy.youmonst.data))
+ if (is_neuter(u.umonst->data) || !humanoid(u.umonst->data))
return 2;
return flags.female;
}
@@ -2275,9 +2275,9 @@ udeadinside(void)
seems silly when you're polymorphed into something undead;
monkilled() distinguishes between living (killed) and non (destroyed)
for monster death message; we refine the nonliving aspect a bit */
- return !nonliving(gy.youmonst.data)
+ return !nonliving(u.umonst->data)
? "dead" /* living, including demons */
- : !weirdnonliving(gy.youmonst.data)
+ : !weirdnonliving(u.umonst->data)
? "condemned" /* undead plus manes */
: "empty"; /* golems plus vortices */
}
diff --git a/src/potion.c b/src/potion.c
index d56b64155..3ac39333a 100644
--- a/src/potion.c
+++ b/src/potion.c
@@ -121,7 +121,7 @@ make_stunned(long xtime, boolean talk)
if (u.usteed)
You("wobble in the saddle.");
else
- You("%s...", stagger(gy.youmonst.data, "stagger"));
+ You("%s...", stagger(u.umonst->data, "stagger"));
}
}
if ((!xtime && old) || (xtime && !old))
@@ -210,9 +210,9 @@ make_slimed(long xtime, const char *msg)
dealloc_killer(find_delayed_killer(SLIMED));
/* fake appearance is set late in turn-to-slime countdown */
if (U_AP_TYPE == M_AP_MONSTER
- && gy.youmonst.mappearance == PM_GREEN_SLIME) {
- gy.youmonst.m_ap_type = M_AP_NOTHING;
- gy.youmonst.mappearance = 0;
+ && u.umonst->mappearance == PM_GREEN_SLIME) {
+ u.umonst->m_ap_type = M_AP_NOTHING;
+ u.umonst->mappearance = 0;
}
}
}
@@ -284,11 +284,11 @@ make_blinded(long xtime, boolean talk)
} else if (old && !xtime) {
/* clearing temporary blindness without toggling blindness */
if (talk) {
- if (!haseyes(gy.youmonst.data) || PermaBlind) {
+ if (!haseyes(u.umonst->data) || PermaBlind) {
strange_feeling((struct obj *) 0, (char *) 0);
} else if (Blindfolded) {
eyes = body_part(EYE);
- if (eyecount(gy.youmonst.data) != 1)
+ if (eyecount(u.umonst->data) != 1)
eyes = makeplural(eyes);
Your(eyemsg, eyes, vtense(eyes, "itch"));
} else { /* Eyes of the Overworld */
@@ -310,11 +310,11 @@ make_blinded(long xtime, boolean talk)
} else if (!old && xtime) {
/* setting temporary blindness without toggling blindness */
if (talk) {
- if (!haseyes(gy.youmonst.data) || PermaBlind) {
+ if (!haseyes(u.umonst->data) || PermaBlind) {
strange_feeling((struct obj *) 0, (char *) 0);
} else if (Blindfolded) {
eyes = body_part(EYE);
- if (eyecount(gy.youmonst.data) != 1)
+ if (eyecount(u.umonst->data) != 1)
eyes = makeplural(eyes);
Your(eyemsg, eyes, vtense(eyes, "twitch"));
} else { /* Eyes of the Overworld */
@@ -397,12 +397,12 @@ make_hallucinated(
/* clearing temporary hallucination without toggling vision */
if (!changed && !HHallucination && old && talk) {
- if (!haseyes(gy.youmonst.data)) {
+ if (!haseyes(u.umonst->data)) {
strange_feeling((struct obj *) 0, (char *) 0);
} else if (Blind) {
const char *eyes = body_part(EYE);
- if (eyecount(gy.youmonst.data) != 1)
+ if (eyecount(u.umonst->data) != 1)
eyes = makeplural(eyes);
Your(eyemsg, eyes, vtense(eyes, "itch"));
} else { /* Grayswandir */
@@ -723,7 +723,7 @@ peffect_water(struct obj *otmp)
return;
}
gp.potion_unkn++;
- if (mon_hates_blessings(&gy.youmonst) /* undead or demon */
+ if (mon_hates_blessings(u.umonst) /* undead or demon */
|| u.ualign.type == A_CHAOTIC) {
if (otmp->blessed) {
pline("This burns like %s!", hliquid("acid"));
@@ -731,7 +731,7 @@ peffect_water(struct obj *otmp)
if (ismnum(u.ulycn)) {
Your("affinity to %s disappears!",
makeplural(mons[u.ulycn].pmnames[NEUTRAL]));
- if (gy.youmonst.data == &mons[u.ulycn])
+ if (u.umonst->data == &mons[u.ulycn])
you_unwere(FALSE);
set_ulycn(NON_PM); /* cure lycanthropy */
}
@@ -1262,7 +1262,7 @@ peffect_oil(struct obj *otmp)
boolean good_for_you = FALSE, vulnerable;
if (otmp->lamplit) {
- if (likes_fire(gy.youmonst.data)) {
+ if (likes_fire(u.umonst->data)) {
pline("Ahh, a refreshing drink.");
good_for_you = TRUE;
} else {
@@ -1620,12 +1620,12 @@ impact_arti_light(
return;
}
-/* potion obj hits monster mon, which might be youmonst; obj always used up */
+/* potion obj hits monster mon, which might be u.umonst; obj always used up */
void
potionhit(struct monst *mon, struct obj *obj, int how)
{
const char *botlnam = bottlename();
- boolean isyou = (mon == &gy.youmonst);
+ boolean isyou = (mon == u.umonst);
int distance, tx, ty;
struct obj *saddle = (struct obj *) 0;
boolean hit_saddle = FALSE, your_fault = (how <= POTHIT_HERO_THROW);
@@ -1905,7 +1905,7 @@ potionhit(struct monst *mon, struct obj *obj, int how)
/* Note: potionbreathe() does its own docall() */
if ((distance == 0 || (distance < 3 && !rn2((1+ACURR(A_DEX))/2)))
- && (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data)))
+ && (!breathless(u.umonst->data) || haseyes(u.umonst->data)))
potionbreathe(obj);
else if (obj->dknown && cansee(tx, ty))
trycall(obj);
@@ -1950,12 +1950,12 @@ potionbreathe(struct obj *obj)
case POT_RESTORE_ABILITY:
case POT_GAIN_ABILITY:
if (obj->cursed) {
- if (!breathless(gy.youmonst.data)) {
+ if (!breathless(u.umonst->data)) {
pline("Ulch! That potion smells terrible!");
- } else if (haseyes(gy.youmonst.data)) {
+ } else if (haseyes(u.umonst->data)) {
const char *eyes = body_part(EYE);
- if (eyecount(gy.youmonst.data) != 1)
+ if (eyecount(u.umonst->data) != 1)
eyes = makeplural(eyes);
Your("%s %s!", eyes, vtense(eyes, "sting"));
}
@@ -2079,11 +2079,11 @@ potionbreathe(struct obj *obj)
break;
case POT_WATER:
if (u.umonnum == PM_GREMLIN) {
- (void) split_mon(&gy.youmonst, (struct monst *) 0);
+ (void) split_mon(u.umonst, (struct monst *) 0);
} else if (ismnum(u.ulycn)) {
/* vapor from [un]holy water will trigger
transformation but won't cure lycanthropy */
- if (obj->blessed && gy.youmonst.data == &mons[u.ulycn])
+ if (obj->blessed && u.umonst->data == &mons[u.ulycn])
you_unwere(FALSE);
else if (obj->cursed && !Upolyd)
you_were();
@@ -2427,7 +2427,7 @@ dip_potion_explosion(struct obj *obj, int dmg)
pline("%sThey explode!", !Deaf ? "BOOM! " : "");
wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1));
exercise(A_STR, FALSE);
- if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
+ if (!breathless(u.umonst->data) || haseyes(u.umonst->data))
potionbreathe(obj);
useupall(obj);
losehp(dmg, /* not physical damage */
@@ -2880,10 +2880,10 @@ split_mon(
reason[0] = '\0';
if (mtmp)
Sprintf(reason, " from %s heat",
- (mtmp == &gy.youmonst) ? the_your[1]
+ (mtmp == u.umonst) ? the_your[1]
: (const char *) s_suffix(mon_nam(mtmp)));
- if (mon == &gy.youmonst) {
+ if (mon == u.umonst) {
if (u.mh > u.mhmax) /* sanity precaution */
u.mh = u.mhmax;
mtmp2 = (u.mh > 1) ? cloneu() : (struct monst *) 0;
diff --git a/src/pray.c b/src/pray.c
index 55e95e096..c008e3205 100644
--- a/src/pray.c
+++ b/src/pray.c
@@ -173,7 +173,7 @@ stuck_in_wall(void)
if (!isok(x, y)
|| (IS_OBSTRUCTED(levl[x][y].typ)
&& (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR))
- || (blocked_boulder(i, j) && !throws_rocks(gy.youmonst.data)))
+ || (blocked_boulder(i, j) && !throws_rocks(u.umonst->data)))
++count;
}
}
@@ -229,13 +229,13 @@ in_trouble(void)
|| stuck_ring(uleft, RIN_LEVITATION)
|| stuck_ring(uright, RIN_LEVITATION))
return TROUBLE_CURSED_LEVITATION;
- if (nohands(gy.youmonst.data) || !freehand()) {
+ if (nohands(u.umonst->data) || !freehand()) {
/* for bag/box access [cf use_container()]...
make sure it's a case that we know how to handle;
otherwise "fix all troubles" would get stuck in a loop */
if (welded(uwep))
return TROUBLE_UNUSEABLE_HANDS;
- if (Upolyd && nohands(gy.youmonst.data)
+ if (Upolyd && nohands(u.umonst->data)
&& (!Unchanging || ((otmp = unchanger()) != 0 && otmp->cursed)))
return TROUBLE_UNUSEABLE_HANDS;
}
@@ -494,7 +494,7 @@ fix_worst_trouble(int trouble)
fix_curse_trouble(otmp, what);
break;
}
- if (Upolyd && nohands(gy.youmonst.data)) {
+ if (Upolyd && nohands(u.umonst->data)) {
if (!Unchanging) {
Your("shape becomes uncertain.");
rehumanize(); /* "You return to {normal} form." */
@@ -504,7 +504,7 @@ fix_worst_trouble(int trouble)
break;
}
}
- if (nohands(gy.youmonst.data) || !freehand())
+ if (nohands(u.umonst->data) || !freehand())
impossible("fix_worst_trouble: couldn't cure hands.");
break;
case TROUBLE_CURSED_BLINDFOLD:
@@ -559,7 +559,7 @@ fix_worst_trouble(int trouble)
msgbuf[0] = '\0';
if (Blinded) {
- if (eyecount(gy.youmonst.data) != 1)
+ if (eyecount(u.umonst->data) != 1)
eyes = makeplural(eyes);
Sprintf(msgbuf, "Your %s %s better", eyes, vtense(eyes, "feel"));
u.ucreamed = 0;
@@ -735,7 +735,7 @@ angrygods(aligntyp resp_god)
(ugod_is_angry() && resp_god == u.ualign.type)
? "hast strayed from the path"
: "art arrogant",
- gy.youmonst.data->mlet == S_HUMAN ? "mortal" : "creature");
+ u.umonst->data->mlet == S_HUMAN ? "mortal" : "creature");
SetVoice((struct monst *) 0, 0, 80, voice_deity);
verbalize("Thou must relearn thy lessons!");
(void) adjattrib(A_WIS, -1, FALSE);
@@ -767,7 +767,7 @@ angrygods(aligntyp resp_god)
: "call upon");
/* [why isn't this using verbalize()?] */
pline("\"Then die, %s!\"",
- (gy.youmonst.data->mlet == S_HUMAN) ? "mortal" : "creature");
+ (u.umonst->data->mlet == S_HUMAN) ? "mortal" : "creature");
summon_minion(resp_god, FALSE);
break;
@@ -1224,7 +1224,7 @@ pleased(aligntyp g_align)
if (u.uevent.uheard_tune < 1) {
godvoice(g_align, (char *) 0);
SetVoice((struct monst *) 0, 0, 80, voice_deity);
- verbalize("Hark, %s!", is_human(gy.youmonst.data)
+ verbalize("Hark, %s!", is_human(u.umonst->data)
? "mortal"
: "creature");
SetVoice((struct monst *) 0, 0, 80, voice_deity);
@@ -1702,7 +1702,7 @@ sacrifice_your_race(
{
int pm;
- if (is_demon(gy.youmonst.data)) {
+ if (is_demon(u.umonst->data)) {
You("find the idea very satisfying.");
exercise(A_WIS, TRUE);
} else if (u.ualign.type != A_CHAOTIC) {
@@ -2128,7 +2128,7 @@ can_pray(boolean praying) /* false means no messages should be given */
gp.p_aligntyp = on_altar() ? a_align(u.ux, u.uy) : u.ualign.type;
gp.p_trouble = in_trouble();
- if (is_demon(gy.youmonst.data) /* ok if chaotic or none (Moloch) */
+ if (is_demon(u.umonst->data) /* ok if chaotic or none (Moloch) */
&& (gp.p_aligntyp == A_LAWFUL || gp.p_aligntyp != A_NEUTRAL)) {
if (praying)
pline_The("very idea of praying to a %s god is repugnant to you.",
@@ -2161,7 +2161,7 @@ can_pray(boolean praying) /* false means no messages should be given */
gp.p_type = 3;
}
- if (is_undead(gy.youmonst.data) && !Inhell
+ if (is_undead(u.umonst->data) && !Inhell
&& (gp.p_aligntyp == A_LAWFUL
|| (gp.p_aligntyp == A_NEUTRAL && !rn2(10))))
gp.p_type = -1;
@@ -2429,7 +2429,7 @@ doturn(void)
Gname = halu_gname(u.ualign.type);
/* [What about needing free hands (does #turn involve any gesturing)?] */
- if (!can_chant(&gy.youmonst)) {
+ if (!can_chant(u.umonst)) {
/* "evilness": "demons and undead" is too verbose and too precise */
You("are %s upon %s to turn aside evilness.",
Strangled ? "not able to call" : "incapable of calling", Gname);
@@ -2439,8 +2439,8 @@ doturn(void)
return (u.uconduct.gnostic == 1) ? ECMD_TIME : ECMD_OK;
}
if ((u.ualign.type != A_CHAOTIC
- && (is_demon(gy.youmonst.data)
- || is_undead(gy.youmonst.data) || is_vampshifter(&gy.youmonst)))
+ && (is_demon(u.umonst->data)
+ || is_undead(u.umonst->data) || is_vampshifter(u.umonst)))
|| u.ugangr > 6) { /* "Die, mortal!" */
pline("For some reason, %s seems to ignore you.", Gname);
aggravate();
diff --git a/src/read.c b/src/read.c
index b422ee082..e9b98eb31 100644
--- a/src/read.c
+++ b/src/read.c
@@ -610,7 +610,7 @@ doread(void)
}
scroll->in_use = TRUE; /* scroll, not spellbook, now being read */
if (otyp != SCR_BLANK_PAPER) {
- boolean silently = !can_chant(&gy.youmonst);
+ boolean silently = !can_chant(u.umonst);
/* a few scroll feedback messages describe something happening
to the scroll itself, so avoid "it disappears" for those */
@@ -1118,7 +1118,7 @@ seffect_enchant_armor(struct obj **sobjp)
schar s;
boolean special_armor;
boolean same_color;
- struct obj *otmp = some_armor(&gy.youmonst);
+ struct obj *otmp = some_armor(u.umonst);
boolean sblessed = sobj->blessed;
boolean scursed = sobj->cursed;
boolean confused = (Confusion != 0);
@@ -1324,7 +1324,7 @@ staticfn void
seffect_destroy_armor(struct obj **sobjp)
{
struct obj *sobj = *sobjp;
- struct obj *otmp = some_armor(&gy.youmonst);
+ struct obj *otmp = some_armor(u.umonst);
boolean scursed = sobj->cursed;
boolean confused = (Confusion != 0);
boolean old_erodeproof, new_erodeproof;
@@ -1405,7 +1405,7 @@ seffect_confuse_monster(struct obj **sobjp)
altfeedback = (Blind || Invisible);
const char *const hands = makeplural(body_part(HAND));
- if (gy.youmonst.data->mlet != S_HUMAN || scursed) {
+ if (u.umonst->data->mlet != S_HUMAN || scursed) {
if (!HConfusion)
You_feel("confused.");
make_confused(HConfusion + rnd(100), FALSE);
@@ -2311,10 +2311,10 @@ drop_boulder_on_player(
return;
otmp2->quan = confused ? rn1(5, 2) : 1;
otmp2->owt = weight(otmp2);
- if (!amorphous(gy.youmonst.data) && !Passes_walls
- && !noncorporeal(gy.youmonst.data) && !unsolid(gy.youmonst.data)) {
+ if (!amorphous(u.umonst->data) && !Passes_walls
+ && !noncorporeal(u.umonst->data) && !unsolid(u.umonst->data)) {
You("are hit by %s!", doname(otmp2));
- dmg = (int) (dmgval(otmp2, &gy.youmonst) * otmp2->quan);
+ dmg = (int) (dmgval(otmp2, u.umonst) * otmp2->quan);
if (uarmh && helmet_protects) {
if (hard_helmet(uarmh)) {
pline("Fortunately, you are wearing a hard helmet.");
@@ -2749,9 +2749,9 @@ do_class_genocide(void)
kill_genocided_monsters();
update_inventory(); /* eggs & tins */
pline("Wiped out all %s.", nam);
- if (Upolyd && vampshifted(&gy.youmonst)
+ if (Upolyd && vampshifted(u.umonst)
/* current shifted form or base vampire form */
- && (i == u.umonnum || i == gy.youmonst.cham))
+ && (i == u.umonnum || i == u.umonst->cham))
polyself(POLY_REVERT); /* vampshifter to vampire */
if (Upolyd && i == u.umonnum) {
u.mh = -1;
@@ -2895,8 +2895,8 @@ do_genocide(
}
ptr = &mons[mndx];
/* first revert if current shifted form or base vampire form */
- if (Upolyd && vampshifted(&gy.youmonst)
- && (mndx == u.umonnum || mndx == gy.youmonst.cham))
+ if (Upolyd && vampshifted(u.umonst)
+ && (mndx == u.umonnum || mndx == u.umonst->cham))
polyself(POLY_REVERT); /* vampshifter (bat, &c) to vampire */
/* Although "genus" is Latin for race, the hero benefits
* from both race and role; thus genocide affects either.
@@ -2926,7 +2926,7 @@ do_genocide(
continue;
}
/* KMH -- Unchanging prevents rehumanization */
- if (Unchanging && ptr == gy.youmonst.data)
+ if (Unchanging && ptr == u.umonst->data)
killplayer++;
break;
}
@@ -2938,7 +2938,7 @@ do_genocide(
if (Hallucination) {
/* hallucinate hero's type */
if (Upolyd) {
- Strcpy(buf, pmname(gy.youmonst.data,
+ Strcpy(buf, pmname(u.umonst->data,
flags.female ? FEMALE : MALE));
} else {
Strcpy(buf, (flags.female && gu.urole.name.f) ? gu.urole.name.f
@@ -2981,13 +2981,13 @@ do_genocide(
/* Polymorphed characters will die as soon as they're rehumanized.
KMH -- Unchanging prevents rehumanization. */
- if (Upolyd && ptr != gy.youmonst.data) {
+ if (Upolyd && ptr != u.umonst->data) {
delayed_killer(POLYMORPH, svk.killer.format, svk.killer.name);
You_feel("%s inside.", udeadinside());
} else {
done(GENOCIDED);
}
- } else if (ptr == gy.youmonst.data) {
+ } else if (ptr == u.umonst->data) {
rehumanize();
}
kill_genocided_monsters();
@@ -3033,8 +3033,8 @@ punish(struct obj *sobj)
uball->owt += WT_IRON_BALL_INCR * (1 + cursed_levy);
return;
}
- if (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
- || unsolid(gy.youmonst.data)) {
+ if (amorphous(u.umonst->data) || is_whirly(u.umonst->data)
+ || unsolid(u.umonst->data)) {
if (!reuse_ball) {
pline("A ball and chain appears, then falls away.");
dropy(mkobj(BALL_CLASS, TRUE));
diff --git a/src/region.c b/src/region.c
index 796d48fc1..938a3e2bf 100644
--- a/src/region.c
+++ b/src/region.c
@@ -1092,7 +1092,7 @@ inside_gas_cloud(genericptr_t p1, genericptr_t p2)
{
NhRegion *reg = (NhRegion *) p1;
struct monst *mtmp = (struct monst *) p2;
- struct monst *umon = mtmp ? mtmp : &gy.youmonst;
+ struct monst *umon = mtmp ? mtmp : u.umonst;
int dam = reg->arg.a_int;
/*
@@ -1107,8 +1107,8 @@ inside_gas_cloud(genericptr_t p1, genericptr_t p2)
if (dam < 1)
return FALSE; /* if no damage then there's nothing to do here... */
- if (!mtmp) { /* hero is indicated by Null rather than by &youmonst */
- if (m_poisongas_ok(&gy.youmonst) == M_POISONGAS_OK)
+ if (!mtmp) { /* hero is indicated by Null rather than by u.umonst */
+ if (m_poisongas_ok(u.umonst) == M_POISONGAS_OK)
return FALSE;
if (!Blind) {
Your("%s sting.", makeplural(body_part(EYE)));
@@ -1232,7 +1232,7 @@ create_gas_cloud(
probably a natural cause of being polyed. don't message about it */
if (!svc.context.mon_moving && u_at(x, y) && cloudsize == 1
&& (!damage
- || (damage && m_poisongas_ok(&gy.youmonst) == M_POISONGAS_OK)))
+ || (damage && m_poisongas_ok(u.umonst) == M_POISONGAS_OK)))
inside_cloud = TRUE;
if (cloudsize > MAX_CLOUD_SIZE) {
@@ -1350,7 +1350,7 @@ region_danger(void)
/* the only type of region we understand is gas_cloud */
if (f_indx == INSIDE_GAS_CLOUD) {
/* completely harmless if you don't need to breathe */
- if (nonliving(gy.youmonst.data) || Breathless)
+ if (nonliving(u.umonst->data) || Breathless)
continue;
/* minor inconvenience if you're poison resistant;
not harmful enough to be a prayer-level trouble */
diff --git a/src/restore.c b/src/restore.c
index 33066d662..83e2ca546 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -22,6 +22,7 @@ staticfn struct fruit *loadfruitchn(NHFILE *);
staticfn void freefruitchn(struct fruit *);
staticfn void rest_levl(NHFILE *);
staticfn void rest_stairs(NHFILE *);
+staticfn void rest_u(NHFILE *, boolean);
#ifndef SFCTOOL
staticfn void ghostfruit(struct obj *);
staticfn boolean restgamestate(NHFILE *);
@@ -527,11 +528,11 @@ restgamestate(NHFILE *nhfp)
int i;
struct flag newgameflags;
struct context_info newgamecontext; /* all 0, but has some pointers */
- struct obj *bc_obj;
- char timebuf[15];
unsigned long uid = 0;
+ struct obj *bc_obj;
+ boolean restoring_special = (wizard || discover);
#ifndef SFCTOOL
- boolean defer_perm_invent, restoring_special;
+ boolean defer_perm_invent;
struct obj *otmp;
#endif
@@ -583,7 +584,6 @@ restgamestate(NHFILE *nhfp)
in the discover case, we don't want to set that for a normal
game until after the save file has been removed */
iflags.deferred_X = (newgameflags.explore && !discover);
- restoring_special = (wizard || discover);
if (newgameflags.debug) {
/* authorized by startup code; wizard mode exists and is allowed */
wizard = TRUE, discover = iflags.deferred_X = FALSE;
@@ -596,31 +596,9 @@ restgamestate(NHFILE *nhfp)
amii_setpens(amii_numcolors); /* use colors from save file */
#endif
#endif /* !SFCTOOL */
- Sfi_you(nhfp, &u, "gamestate-you");
- gy.youmonst.cham = u.mcham;
+ rest_u(nhfp, restoring_special);
#ifndef SFCTOOL
- if (restoring_special && iflags.explore_error_flag) {
- /* savefile has wizard or explore mode, but player is no longer
- authorized to access either; can't downgrade mode any further, so
- fail restoration. */
- u.uhp = 0;
- }
-#endif
-
- Sfi_char(nhfp, timebuf, "gamestate-ubirthday", 14);
- timebuf[14] = '\0';
- ubirthday = time_from_yyyymmddhhmmss(timebuf);
- Sfi_long(nhfp, &urealtime.realtime, "gamestate-realtime");
- Sfi_char(nhfp, timebuf, "gamestate-start_timing", 14);
- timebuf[14] = '\0';
-#ifndef SFCTOOL
- urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf);
-
- /* current time is the time to use for next urealtime.realtime update */
- urealtime.start_timing = getnow();
-
- set_uasmon();
#ifdef CLIPPING
cliparound(u.ux, u.uy);
#endif
@@ -638,7 +616,7 @@ restgamestate(NHFILE *nhfp)
iflags.perm_invent = defer_perm_invent;
flags = newgameflags;
svc.context = newgamecontext;
- gy.youmonst = cg.zeromonst;
+ free((genericptr_t) u.umonst), u.umonst = 0;
return FALSE;
}
/* in case hangup save occurred in midst of level change */
@@ -663,7 +641,8 @@ restgamestate(NHFILE *nhfp)
setworn(bc_obj, bc_obj->owornmask);
bc_obj = nobj;
}
-#endif
+#endif /* !SFCTOOL */
+
gm.migrating_objs = restobjchn(nhfp, FALSE);
gm.migrating_mons = restmonchn(nhfp);
@@ -732,6 +711,43 @@ restgamestate(NHFILE *nhfp)
return TRUE;
}
+void
+rest_u(NHFILE *nhfp, boolean restoring_special)
+{
+ char timebuf[15];
+
+ Sfi_you(nhfp, &u, "gamestate-you");
+#ifndef SFCTOOL
+ if (restoring_special && iflags.explore_error_flag) {
+ /* savefile has wizard or explore mode, but player is no longer
+ authorized to access either; can't downgrade mode any further, so
+ fail restoration. */
+ u.uhp = 0;
+ }
+#endif
+
+ Sfi_char(nhfp, timebuf, "gamestate-ubirthday", 14);
+ timebuf[14] = '\0';
+ ubirthday = time_from_yyyymmddhhmmss(timebuf);
+ Sfi_long(nhfp, &urealtime.realtime, "gamestate-realtime");
+ Sfi_char(nhfp, timebuf, "gamestate-start_timing", 14);
+ timebuf[14] = '\0';
+#ifndef SFCTOOL
+ urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf);
+
+ /* current time is the time to use for next urealtime.realtime update */
+ urealtime.start_timing = getnow();
+
+ u.umonst = newmonst();
+ *u.umonst = cg.zeromonst;
+ u.umonst->cham = u.mcham;
+ set_uasmon();
+#else
+ nhUse(restoring_special);
+#endif /* !SFCTOOL */
+}
+
+
#ifndef SFCTOOL
/* update game state pointers to those valid for the current level (so we
don't dereference a wild u.ustuck when saving game state, for instance) */
diff --git a/src/save.c b/src/save.c
index fd6dfae2f..a93ae35a4 100644
--- a/src/save.c
+++ b/src/save.c
@@ -31,6 +31,7 @@ staticfn void save_gamelog(NHFILE *);
staticfn void savegamestate(NHFILE *);
staticfn void savelev_core(NHFILE *, xint8);
staticfn void save_msghistory(NHFILE *);
+staticfn void save_u(NHFILE *);
staticfn void save_adjust_levelflags(void);
#if defined(HANGUPHANDLING)
#define HUP if (!program_state.done_hup)
@@ -261,6 +262,27 @@ save_gamelog(NHFILE *nhfp)
gg.gamelog = NULL;
}
+staticfn void
+save_u(NHFILE *nhfp)
+{
+ struct monst *save_umonst;
+
+ urealtime.finish_time = getnow();
+ urealtime.realtime += timet_delta(urealtime.finish_time,
+ urealtime.start_timing);
+
+ save_umonst = u.umonst;
+ u.umonst = (struct monst *) 0;
+ Sfo_you(nhfp, &u, "gamestate-you");
+ u.umonst = save_umonst;
+
+ Sfo_char(nhfp, yyyymmddhhmmss(ubirthday), "gamestate-ubirthday", 14);
+ Sfo_long(nhfp, &urealtime.realtime, "gamestate-realtime");
+ Sfo_char(nhfp, yyyymmddhhmmss(urealtime.start_timing), "gamestate-start_timing", 14);
+ /* this is the value to use for the next update of urealtime.realtime */
+ urealtime.start_timing = urealtime.finish_time;
+}
+
staticfn void
savegamestate(NHFILE *nhfp)
{
@@ -275,17 +297,8 @@ savegamestate(NHFILE *nhfp)
Sfo_context_info(nhfp, &svc.context, "gamestate-context");
relative_time_to_moves(&svc.context.seer_turn);
relative_time_to_moves(&svc.context.digging.lastdigtime);
-
Sfo_flag(nhfp, &flags, "gamestate-flags");
- urealtime.finish_time = getnow();
- urealtime.realtime += timet_delta(urealtime.finish_time,
- urealtime.start_timing);
- Sfo_you(nhfp, &u, "gamestate-you");
- Sfo_char(nhfp, yyyymmddhhmmss(ubirthday), "gamestate-ubirthday", 14);
- Sfo_long(nhfp, &urealtime.realtime, "gamestate-realtime");
- Sfo_char(nhfp, yyyymmddhhmmss(urealtime.start_timing), "gamestate-start_timing", 14);
- /* this is the value to use for the next update of urealtime.realtime */
- urealtime.start_timing = urealtime.finish_time;
+ save_u(nhfp);
save_killers(nhfp);
/* must come before gm.migrating_objs and gm.migrating_mons are freed */
@@ -1171,6 +1184,9 @@ freedynamicdata(void)
if (options_set_window_colors_flag)
options_free_window_colors();
+ if (u.umonst)
+ free((genericptr_t) u.umonst), u.umonst = 0;
+
if (glyphid_cache_status())
free_glyphid_cache();
diff --git a/src/shk.c b/src/shk.c
index 927352971..69a716df7 100644
--- a/src/shk.c
+++ b/src/shk.c
@@ -3609,12 +3609,12 @@ append_honorific(char *buf)
};
Strcat(buf, honored[rn2(SIZE(honored) - 1) + u.uevent.udemigod]);
- if (is_vampire(gy.youmonst.data))
+ if (is_vampire(u.umonst->data))
Strcat(buf, (flags.female) ? " dark lady" : " dark lord");
- else if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
+ else if (maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF)))
Strcat(buf, (flags.female) ? " hiril" : " hir");
else
- Strcat(buf, !is_human(gy.youmonst.data) ? " creature"
+ Strcat(buf, !is_human(u.umonst->data) ? " creature"
: (flags.female) ? " lady"
: " sir");
}
@@ -5910,7 +5910,7 @@ cad(
{
const char *res = 0;
- switch (is_demon(gy.youmonst.data) ? 3 : poly_gender()) {
+ switch (is_demon(u.umonst->data) ? 3 : poly_gender()) {
case 0:
res = "cad";
break;
@@ -5929,7 +5929,7 @@ cad(
break;
}
if (altusage) {
- char *cadbuf = mon_nam(&gy.youmonst); /* snag an output buffer */
+ char *cadbuf = mon_nam(u.umonst); /* snag an output buffer */
/* alternate usage adds a leading double quote and trailing
exclamation point plus sentence separating spaces */
diff --git a/src/sit.c b/src/sit.c
index 15c16dbdf..8f355d95a 100644
--- a/src/sit.c
+++ b/src/sit.c
@@ -157,7 +157,7 @@ throne_sit_effect(void)
if (!Blind) {
Your("vision becomes clear.");
} else {
- int num_of_eyes = eyecount(gy.youmonst.data);
+ int num_of_eyes = eyecount(u.umonst->data);
const char *eye = body_part(EYE);
/* note: 1 eye case won't actually happen--can't
@@ -208,7 +208,7 @@ throne_sit_effect(void)
break;
}
} else {
- if (is_prince(gy.youmonst.data) || u.uevent.uhand_of_elbereth)
+ if (is_prince(u.umonst->data) || u.uevent.uhand_of_elbereth)
You_feel("very comfortable here.");
else
You_feel("somehow out of place...");
@@ -325,7 +325,7 @@ special_throne_effect(int effect) {
case 11:
/* polymorph effect (not blocked by magic resistance, but other things
that protect from polymorphs work) */
- if (is_vampire(gy.youmonst.data)) {
+ if (is_vampire(u.umonst->data)) {
You_feel("unworthy.");
} else {
pline("This throne was not meant for those such as you!");
@@ -368,14 +368,14 @@ lay_an_egg(void)
} else if (u.uhunger < (int) objects[EGG].oc_nutrition) {
You("don't have enough energy to lay an egg.");
return ECMD_OK;
- } else if (eggs_in_water(gy.youmonst.data)) {
+ } else if (eggs_in_water(u.umonst->data)) {
if (!(Underwater || Is_waterlevel(&u.uz))) {
pline("A splash tetra you are not.");
return ECMD_OK;
}
if (Upolyd
- && (gy.youmonst.data == &mons[PM_GIANT_EEL]
- || gy.youmonst.data == &mons[PM_ELECTRIC_EEL])) {
+ && (u.umonst->data == &mons[PM_GIANT_EEL]
+ || u.umonst->data == &mons[PM_ELECTRIC_EEL])) {
You("yearn for the Sargasso Sea.");
return ECMD_OK;
}
@@ -388,7 +388,7 @@ lay_an_egg(void)
set_corpsenm(uegg, egg_type_from_parent(u.umonnum, FALSE));
uegg->known = 1;
observe_object(uegg);
- You("%s an egg.", eggs_in_water(gy.youmonst.data) ? "spawn" : "lay");
+ You("%s an egg.", eggs_in_water(u.umonst->data) ? "spawn" : "lay");
dropy(uegg);
stackobj(uegg);
morehungry((int) objects[EGG].oc_nutrition);
@@ -407,7 +407,7 @@ dosit(void)
You("are already sitting on %s.", mon_nam(u.usteed));
return ECMD_OK;
}
- if (u.uundetected && is_hider(gy.youmonst.data)
+ if (u.uundetected && is_hider(u.umonst->data)
&& u.umonnum != PM_TRAPPER) /* trapper can stay hidden on floor */
u.uundetected = 0; /* no longer on the ceiling */
@@ -419,7 +419,7 @@ dosit(void)
else
You("are sitting on air.");
return ECMD_OK;
- } else if (u.ustuck && !sticks(gy.youmonst.data)) {
+ } else if (u.ustuck && !sticks(u.umonst->data)) {
/* holding monster is next to hero rather than beneath, but
hero is in no condition to actually sit at has/her own spot */
if (humanoid(u.ustuck->data))
@@ -440,14 +440,14 @@ dosit(void)
struct obj *obj;
obj = svl.level.objects[u.ux][u.uy];
- if (gy.youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) {
+ if (u.umonst->data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) {
You("coil up around your %shoard.",
(obj->quan + money_cnt(gi.invent) < u.ulevel * 1000)
? "meager " : "");
} else if (obj->otyp == TOWEL) {
pline("It's probably not a good time for a picnic...");
} else {
- if (slithy(gy.youmonst.data))
+ if (slithy(u.umonst->data))
You("coil up around %s.", the(xname(obj)));
else
You("sit on %s.", the(xname(obj)));
@@ -503,16 +503,16 @@ dosit(void)
dotrap(trap, VIASITTING);
}
} else if ((Underwater || Is_waterlevel(&u.uz))
- && !eggs_in_water(gy.youmonst.data)) {
+ && !eggs_in_water(u.umonst->data)) {
if (Is_waterlevel(&u.uz))
There("are no cushions floating nearby.");
else
You("sit down on the muddy bottom.");
- } else if (is_pool(u.ux, u.uy) && !eggs_in_water(gy.youmonst.data)) {
+ } else if (is_pool(u.ux, u.uy) && !eggs_in_water(u.umonst->data)) {
in_water:
You("sit in the %s.", hliquid("water"));
if (Upolyd && u.umonnum == PM_GREMLIN) {
- if (split_mon(&gy.youmonst, (struct monst *) 0)) {
+ if (split_mon(u.umonst, (struct monst *) 0)) {
if (levl[u.ux][u.uy].typ == FOUNTAIN)
dryup(u.ux, u.uy, TRUE);
}
@@ -526,7 +526,7 @@ dosit(void)
} else if (IS_SINK(typ)) {
You(sit_message, defsyms[S_sink].explanation);
Your("%s gets wet.",
- humanoid(gy.youmonst.data) ? "rump" : "underside");
+ humanoid(u.umonst->data) ? "rump" : "underside");
} else if (IS_ALTAR(typ)) {
You(sit_message, defsyms[S_altar].explanation);
altar_wrath(u.ux, u.uy);
@@ -540,7 +540,7 @@ dosit(void)
/* must be WWalking */
You(sit_message, hliquid("lava"));
burn_away_slime();
- if (likes_lava(gy.youmonst.data)) {
+ if (likes_lava(u.umonst->data)) {
pline_The("%s feels warm.", hliquid("lava"));
return ECMD_TIME;
}
@@ -556,7 +556,7 @@ dosit(void)
} else if (IS_THRONE(typ)) {
You(sit_message, defsyms[S_throne].explanation);
throne_sit_effect();
- } else if (lays_eggs(gy.youmonst.data)) {
+ } else if (lays_eggs(u.umonst->data)) {
return lay_an_egg();
} else {
pline("Having fun sitting on the %s?", surface(u.ux, u.uy));
diff --git a/src/sounds.c b/src/sounds.c
index 5e4a0e1cd..002cd8854 100644
--- a/src/sounds.c
+++ b/src/sounds.c
@@ -591,7 +591,7 @@ maybe_gasp(struct monst *mon)
case MS_VAMPIRE: /* vampire in its own form */
case MS_WERE: /* lycanthrope in human form */
case MS_SPELL: /* titan, barrow wight, Nazgul, nalfeshnee */
- dogasp = (mptr->mlet == gy.youmonst.data->mlet);
+ dogasp = (mptr->mlet == u.umonst->data->mlet);
break;
/* capable of speech but don't care if you attack peacefuls */
case MS_BRIBE:
@@ -703,7 +703,7 @@ domonnoise(struct monst *mtmp)
msound = MS_SELL;
/* some normally non-speaking types can/will speak if hero is similar */
else if (msound == MS_ORC
- && ((same_race(ptr, gy.youmonst.data) /* current form, */
+ && ((same_race(ptr, u.umonst->data) /* current form, */
|| same_race(ptr, &mons[Race_switch])) /* unpoly'd form */
|| Hallucination))
msound = MS_HUMANOID;
@@ -794,12 +794,12 @@ domonnoise(struct monst *mtmp)
if (kindred) {
verbl_msg = "This is my hunting ground"
" that you dare to prowl!";
- } else if (gy.youmonst.data == &mons[PM_SILVER_DRAGON]
- || gy.youmonst.data == &mons[PM_BABY_SILVER_DRAGON]) {
+ } else if (u.umonst->data == &mons[PM_SILVER_DRAGON]
+ || u.umonst->data == &mons[PM_BABY_SILVER_DRAGON]) {
/* Silver dragons are silver in color, not made of silver */
Sprintf(verbuf,
"%s! Your silver sheen"" does not frighten me!",
- (gy.youmonst.data == &mons[PM_SILVER_DRAGON])
+ (u.umonst->data == &mons[PM_SILVER_DRAGON])
? "Fool"
: "Young Fool");
verbl_msg = verbuf;
@@ -1107,7 +1107,7 @@ domonnoise(struct monst *mtmp)
if (SYSOPT_SEDUCE) {
if (ptr->mlet != S_NYMPH
- && (could_seduce(mtmp, &gy.youmonst, (struct attack *) 0)
+ && (could_seduce(mtmp, u.umonst, (struct attack *) 0)
== 1)) {
(void) doseduce(mtmp);
break;
@@ -1260,9 +1260,9 @@ dochat(void)
int tx, ty;
struct obj *otmp;
- if (is_silent(gy.youmonst.data)) {
+ if (is_silent(u.umonst->data)) {
pline("As %s, you cannot speak.",
- an(pmname(gy.youmonst.data, flags.female ? FEMALE : MALE)));
+ an(pmname(u.umonst->data, flags.female ? FEMALE : MALE)));
return ECMD_OK;
}
if (Strangled) {
@@ -1395,7 +1395,7 @@ dochat(void)
return ECMD_OK;
}
if (Deaf) {
- const char *xresponse = humanoid(gy.youmonst.data)
+ const char *xresponse = humanoid(u.umonst->data)
? "falls on deaf ears"
: "is inaudible";
diff --git a/src/spell.c b/src/spell.c
index 43c2acd51..4d489a123 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -316,7 +316,7 @@ deadbook(struct obj *book2)
set_malign(mtmp);
}
/* next handle the affect on things you're carrying */
- (void) unturn_dead(&gy.youmonst);
+ (void) unturn_dead(u.umonst);
/* last place some monsters around you */
mm.x = u.ux;
mm.y = u.uy;
@@ -483,7 +483,7 @@ study_book(struct obj *spellbook)
if (dullbook > 0) {
eyes = body_part(EYE);
- if (eyecount(gy.youmonst.data) > 1)
+ if (eyecount(u.umonst->data) > 1)
eyes = makeplural(eyes);
pline("This book is so dull that you can't keep your %s open.",
eyes);
@@ -690,7 +690,7 @@ rejectcasting(void)
if (Stunned) {
You("are too impaired to cast a spell.");
return TRUE;
- } else if (!can_chant(&gy.youmonst)) {
+ } else if (!can_chant(u.umonst)) {
You("are unable to chant the incantation.");
return TRUE;
} else if (!freehand() && !(uwep && uwep->otyp == QUARTERSTAFF)) {
diff --git a/src/steal.c b/src/steal.c
index fd53ff1b7..1c9fcb305 100644
--- a/src/steal.c
+++ b/src/steal.c
@@ -79,7 +79,7 @@ stealgold(struct monst *mtmp)
whose = s_suffix(y_monnam(who));
what = makeplural(mbodypart(who, FOOT));
} else {
- who = &gy.youmonst;
+ who = u.umonst;
whose = "your";
what = makeplural(body_part(FOOT));
}
@@ -387,7 +387,7 @@ steal(struct monst *mtmp, char *objnambuf)
/* buried ball is not tracked via 'uball' and there is no chain
at all (hence no uchain to take off) */
pline("%s takes off your unseen chain.", Monnambuf);
- (void) openholdingtrap(&gy.youmonst, &dummy);
+ (void) openholdingtrap(u.umonst, &dummy);
} else if (Blind) {
pline("Somebody tries to rob you, but finds nothing to steal.");
} else if (inv_cnt(TRUE) > inv_cnt(FALSE)) {
diff --git a/src/steed.c b/src/steed.c
index 835a8562f..553e1df3a 100644
--- a/src/steed.c
+++ b/src/steed.c
@@ -68,7 +68,7 @@ use_saddle(struct obj *otmp)
char kbuf[BUFSZ];
You("touch %s.", mon_nam(mtmp));
- if (!(poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))) {
+ if (!(poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM))) {
Sprintf(kbuf, "attempting to saddle %s",
an(pmname(mtmp->data, Mgender(mtmp))));
instapetrify(kbuf);
@@ -168,8 +168,8 @@ put_saddle_on_mon(struct obj *saddle, struct monst *mtmp)
boolean
can_ride(struct monst *mtmp)
{
- return (mtmp->mtame && humanoid(gy.youmonst.data)
- && !verysmall(gy.youmonst.data) && !bigmonst(gy.youmonst.data)
+ return (mtmp->mtame && humanoid(u.umonst->data)
+ && !verysmall(u.umonst->data) && !bigmonst(u.umonst->data)
&& (!Underwater || is_swimmer(mtmp->data)));
}
@@ -238,10 +238,10 @@ mount_steed(
return (FALSE);
}
- if (Upolyd && (!humanoid(gy.youmonst.data)
- || verysmall(gy.youmonst.data)
- || bigmonst(gy.youmonst.data)
- || slithy(gy.youmonst.data))) {
+ if (Upolyd && (!humanoid(u.umonst->data)
+ || verysmall(u.umonst->data)
+ || bigmonst(u.umonst->data)
+ || slithy(u.umonst->data))) {
You("won't fit on a saddle.");
return (FALSE);
}
@@ -545,7 +545,7 @@ landing_spot(
kn_trap = i == 0 && ((t = t_at(x, y)) != 0 && t->tseen
&& t->ttyp != VIBRATING_SQUARE);
boulder = i <= 1 && (sobj_at(BOULDER, x, y)
- && !throws_rocks(gy.youmonst.data));
+ && !throws_rocks(u.umonst->data));
if (!kn_trap && !boulder) {
spot->x = x;
spot->y = y;
@@ -566,7 +566,7 @@ landing_spot(
/* If we didn't find a good spot and forceit is on, try enexto(). */
if (forceit && !found)
- found = enexto(spot, u.ux, u.uy, gy.youmonst.data);
+ found = enexto(spot, u.ux, u.uy, u.umonst->data);
return found;
}
diff --git a/src/teleport.c b/src/teleport.c
index b235cb238..48fa7da78 100644
--- a/src/teleport.c
+++ b/src/teleport.c
@@ -105,7 +105,7 @@ goodpos(
* oh well.
*/
if (!allow_u) {
- if (u_at(x, y) && mtmp != &gy.youmonst
+ if (u_at(x, y) && mtmp != u.umonst
&& (mtmp != u.ustuck || !u.uswallow)
&& (!u.usteed || mtmp != u.usteed))
return FALSE;
@@ -133,7 +133,7 @@ goodpos(
mdat = mtmp->data;
if (is_pool(x, y) && !ignorewater) {
/* [what about Breathless?] */
- if (mtmp == &gy.youmonst)
+ if (mtmp == u.umonst)
return (Swimming || Amphibious
|| (!Is_waterlevel(&u.uz)
&& !is_waterwall(x, y)
@@ -152,11 +152,11 @@ goodpos(
that due the effect of the heat causing it to dry out */
if (mdat == &mons[PM_FLOATING_EYE])
return FALSE;
- else if (mtmp == &gy.youmonst)
+ else if (mtmp == u.umonst)
return (Levitation || Flying
|| (Fire_resistance && Wwalking && uarmf
&& uarmf->oerodeproof)
- || (Upolyd && likes_lava(gy.youmonst.data)));
+ || (Upolyd && likes_lava(u.umonst->data)));
else
return (m_in_air(mtmp) || likes_lava(mdat));
}
@@ -435,7 +435,7 @@ teleok(coordxy x, coordxy y, boolean trapok)
if (!trapok)
return FALSE;
}
- if (!goodpos(x, y, &gy.youmonst, 0))
+ if (!goodpos(x, y, u.umonst, 0))
return FALSE;
if (!tele_jump_ok(u.ux, u.uy, x, y))
return FALSE;
@@ -490,9 +490,9 @@ teleds(coordxy nux, coordxy nuy, int teleds_flags)
u.ux0 = u.ux;
u.uy0 = u.uy;
- if (!hideunder(&gy.youmonst) && gy.youmonst.data->mlet == S_MIMIC) {
+ if (!hideunder(u.umonst) && u.umonst->data->mlet == S_MIMIC) {
/* mimics stop being unnoticed */
- gy.youmonst.m_ap_type = M_AP_NOTHING;
+ u.umonst->m_ap_type = M_AP_NOTHING;
}
if (was_swallowed) {
@@ -816,7 +816,7 @@ tele_to_rnd_pet(void)
struct monst *mtmp, *pet = (struct monst *) 0;
int cnt = 0;
- if (noteleport_level(&gy.youmonst)) {
+ if (noteleport_level(u.umonst)) {
impossible("%s", "attempt to teleport hero to be near a pet"
" on no-teleport level");
return;
@@ -851,7 +851,7 @@ scrolltele(struct obj *scroll)
coord cc;
/* Disable teleportation in stronghold && Vlad's Tower */
- if (noteleport_level(&gy.youmonst) && !wizard) {
+ if (noteleport_level(u.umonst) && !wizard) {
pline("A mysterious force prevents you from teleporting!");
if (scroll)
learnscroll(scroll); /* this is obviously a teleport scroll */
@@ -1072,7 +1072,7 @@ dotele(
int energy = 0;
if (!Teleportation || (u.ulevel < (Role_if(PM_WIZARD) ? 8 : 12)
- && !can_teleport(gy.youmonst.data))) {
+ && !can_teleport(u.umonst->data))) {
/* Try to use teleport away spell. */
int knownsp = known_spell(SPE_TELEPORT_AWAY);
@@ -1257,7 +1257,7 @@ level_tele(void)
if (ynq("Go to Nowhere. Are you sure?") != 'y')
return;
You("%s in agony as your body begins to warp...",
- is_silent(gy.youmonst.data) ? "writhe" : "scream");
+ is_silent(u.umonst->data) ? "writhe" : "scream");
display_nhwindow(WIN_MESSAGE, FALSE);
You("cease to exist.");
if (gi.invent)
@@ -1499,7 +1499,7 @@ tele_trap(struct trap *trap)
return;
in_tele_trap = TRUE;
- if (In_endgame(&u.uz) || Antimagic || noteleport_level(&gy.youmonst)) {
+ if (In_endgame(&u.uz) || Antimagic || noteleport_level(u.umonst)) {
if (Antimagic)
shieldeff(u.ux, u.uy);
You_feel("a wrenching sensation.");
diff --git a/src/timeout.c b/src/timeout.c
index af974c84e..34d11d601 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -142,7 +142,7 @@ stoned_dialogue(void)
char buf[BUFSZ];
Strcpy(buf, stoned_texts[SIZE(stoned_texts) - i]);
- if (nolimbs(gy.youmonst.data) && strstri(buf, "limbs"))
+ if (nolimbs(u.umonst->data) && strstri(buf, "limbs"))
(void) strsubst(buf, "limbs", "extremities");
urgent_pline("%s", buf);
}
@@ -232,7 +232,7 @@ vomiting_dialogue(void)
break;
case 2:
txt = vomiting_texts[4];
- if (cantvomit(gy.youmonst.data))
+ if (cantvomit(u.umonst->data))
txt = "gag uncontrollably.";
else if (Hallucination)
/* "hurl" is short for "hurl chunks" which is slang for
@@ -241,7 +241,7 @@ vomiting_dialogue(void)
break;
case 0:
stop_occupation();
- if (!cantvomit(gy.youmonst.data)) {
+ if (!cantvomit(u.umonst->data)) {
morehungry(20);
/* case 2 used to be "You suddenly vomit!" but it wasn't sudden
since you've just been through the earlier messages of the
@@ -332,8 +332,8 @@ sickness_dialogue(void)
if ((u.usick_type & SICK_NONVOMITABLE) == 0)
(void) strsubst(buf, "illness", "sickness");
if (Hallucination && strstri(buf, "Death's door")) {
- /* youmonst: for Hallucination, mhe()'s mon argument isn't used */
- Strcpy(pronounbuf, mhe(&gy.youmonst));
+ /* u.umonst: for Hallucination, mhe()'s mon argument isn't used */
+ Strcpy(pronounbuf, mhe(u.umonst));
Sprintf(eos(buf), " %s %s inviting you in.",
/* upstart() modifies its argument but vtense() doesn't
care whether or not that has already happened */
@@ -394,8 +394,8 @@ slime_dialogue(void)
/* display as green slime during "You have become green slime."
but don't worry about not being able to see self; if already
mimicking something else at the time, implicitly be revealed */
- gy.youmonst.m_ap_type = M_AP_MONSTER;
- gy.youmonst.mappearance = PM_GREEN_SLIME;
+ u.umonst->m_ap_type = M_AP_MONSTER;
+ u.umonst->mappearance = PM_GREEN_SLIME;
/* no message given when 't' is odd, so no automatic update of
self; force one */
newsym(u.ux, u.uy);
@@ -405,7 +405,7 @@ slime_dialogue(void)
char buf[BUFSZ];
Strcpy(buf, slime_texts[SIZE(slime_texts) - i - 1L]);
- if (nolimbs(gy.youmonst.data) && strstri(buf, "limbs"))
+ if (nolimbs(u.umonst->data) && strstri(buf, "limbs"))
(void) strsubst(buf, "limbs", "extremities");
if (strchr(buf, '%')) {
@@ -459,7 +459,7 @@ slimed_to_death(struct kinfo *kptr)
uchar save_mvflags;
/* redundant: polymon() cures sliming when polying into green slime */
- if (Upolyd && gy.youmonst.data == &mons[PM_GREEN_SLIME]) {
+ if (Upolyd && u.umonst->data == &mons[PM_GREEN_SLIME]) {
dealloc_killer(kptr);
return;
}
@@ -485,11 +485,11 @@ slimed_to_death(struct kinfo *kptr)
* [formerly implicit] change of form; polymon() takes care of that.
* Temporarily ungenocide if necessary.
*/
- if (emits_light(gy.youmonst.data))
- del_light_source(LS_MONSTER, monst_to_any(&gy.youmonst));
+ if (emits_light(u.umonst->data))
+ del_light_source(LS_MONSTER, monst_to_any(u.umonst));
save_mvflags = svm.mvitals[PM_GREEN_SLIME].mvflags;
svm.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags & ~G_GENOD;
- /* become a green slime; also resets youmonst.m_ap_type+.mappearance */
+ /* become a green slime; also resets u.umonst.m_ap_type+.mappearance */
(void) polymon(PM_GREEN_SLIME);
svm.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags;
done_timeout(TURNED_SLIME, SLIMED);
@@ -640,8 +640,8 @@ nh_timeout(void)
sleep_dialogue();
if (u.mtimedone && !--u.mtimedone) {
if (Unchanging)
- u.mtimedone = rnd(100 * gy.youmonst.data->mlevel + 1);
- else if (is_were(gy.youmonst.data))
+ u.mtimedone = rnd(100 * u.umonst->data->mlevel + 1);
+ else if (is_were(u.umonst->data))
you_unwere(FALSE); /* if polycontrl, asks whether to rehumanize */
else
rehumanize();
diff --git a/src/trap.c b/src/trap.c
index c6b5d7227..cc62fdd3e 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -94,7 +94,7 @@ burnarmor(struct monst *victim)
if (!victim)
return 0;
- hitting_u = (victim == &gy.youmonst);
+ hitting_u = (victim == u.umonst);
/* burning damage may dry wet towel */
item = hitting_u ? carrying(TOWEL) : m_carrying(victim, TOWEL);
@@ -190,11 +190,11 @@ erode_obj(
if (!otmp)
return ER_NOTHING;
- victim = carried(otmp) ? &gy.youmonst
+ victim = carried(otmp) ? u.umonst
: mcarried(otmp) ? otmp->ocarry
: (struct monst *) 0;
- uvictim = (victim == &gy.youmonst);
- vismon = victim && (victim != &gy.youmonst) && canseemon(victim);
+ uvictim = (victim == u.umonst);
+ vismon = victim && (victim != u.umonst) && canseemon(victim);
/* Is gb.bhitpos correct here? Ugh. */
visobj = (!victim && cansee(gb.bhitpos.x, gb.bhitpos.y)
&& (!is_pool(gb.bhitpos.x, gb.bhitpos.y)
@@ -269,7 +269,7 @@ erode_obj(
*/
if (otmp->oerodeproof) {
otmp->rknown = TRUE;
- if (victim == &gy.youmonst)
+ if (victim == u.umonst)
update_inventory();
}
@@ -294,7 +294,7 @@ erode_obj(
else
otmp->oeroded2++;
- if (victim == &gy.youmonst)
+ if (victim == u.umonst)
update_inventory();
return ER_DAMAGED;
@@ -363,15 +363,15 @@ grease_protect(
struct monst *victim)
{
static const char txt[] = "protected by the layer of grease!";
- boolean vismon = victim && (victim != &gy.youmonst) && canseemon(victim);
+ boolean vismon = victim && (victim != u.umonst) && canseemon(victim);
if (ostr) {
- if (victim == &gy.youmonst)
+ if (victim == u.umonst)
Your("%s %s %s", ostr, vtense(ostr, "are"), txt);
else if (vismon)
pline("%s's %s %s %s", Monnam(victim),
ostr, vtense(ostr, "are"), txt);
- } else if (victim == &gy.youmonst || vismon) {
+ } else if (victim == u.umonst || vismon) {
pline("%s %s", Yobjnam2(otmp, "are"), txt);
}
if (!rn2(2)) {
@@ -634,11 +634,11 @@ fall_through(
; /* KMH -- You can't escape the Sokoban level traps */
} else if (Levitation || u.ustuck
|| (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig)
- || ((Flying || is_clinger(gy.youmonst.data)
- || (ceiling_hider(gy.youmonst.data) && u.uundetected))
+ || ((Flying || is_clinger(u.umonst->data)
+ || (ceiling_hider(u.umonst->data) && u.uundetected))
&& !(ftflags & TOOKPLUNGE))) {
dont_fall = "don't fall in.";
- } else if (gy.youmonst.data->msize >= MZ_HUGE) {
+ } else if (u.umonst->data->msize >= MZ_HUGE) {
dont_fall = "don't fit through.";
} else if (!next_to_u()) {
dont_fall = "are jerked back by your pet!";
@@ -653,7 +653,7 @@ fall_through(
}
return;
}
- if ((Flying || is_clinger(gy.youmonst.data))
+ if ((Flying || is_clinger(u.umonst->data))
&& (ftflags & TOOKPLUNGE) && td && t) {
if (Flying)
controlled_flight = TRUE;
@@ -890,7 +890,7 @@ animate_statue(
delobj(statue);
/* avoid hiding under nothing */
- if (u_at(x, y) && Upolyd && hides_under(gy.youmonst.data)
+ if (u_at(x, y) && Upolyd && hides_under(u.umonst->data)
&& !OBJ_AT(x, y))
u.uundetected = 0;
@@ -974,7 +974,7 @@ mu_maybe_destroy_web(
boolean domsg,
struct trap *trap)
{
- boolean isyou = (mtmp == &gy.youmonst);
+ boolean isyou = (mtmp == u.umonst);
struct permonst *mptr = mtmp->data;
if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr)
@@ -1085,7 +1085,7 @@ floor_trigger(int ttyp)
staticfn boolean
check_in_air(struct monst *mtmp, unsigned trflags)
{
- boolean is_you = mtmp == &gy.youmonst,
+ boolean is_you = mtmp == u.umonst,
plunged = (trflags & (TOOKPLUNGE | VIASITTING)) != 0;
return ((trflags & HURTLING) != 0
@@ -1195,7 +1195,7 @@ trapeffect_arrow_trap(
struct obj *otmp;
int dam;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
if (trap->once && trap->tseen && !rn2(15)) {
Soundeffect(se_loud_click, 100);
You_hear("a loud click!");
@@ -1207,7 +1207,7 @@ trapeffect_arrow_trap(
seetrap(trap);
pline("An arrow shoots out at you!");
otmp = t_missile(ARROW, trap);
- dam = dmgval(otmp, &gy.youmonst);
+ dam = dmgval(otmp, u.umonst);
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
; /* nothing */
} else if (thitu(8, Maybe_Half_Phys(dam), &otmp, "arrow")) {
@@ -1256,7 +1256,7 @@ trapeffect_dart_trap(
struct obj *otmp;
int dam;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
int oldumort = u.umortality;
if (trap->once && trap->tseen && !rn2(15)) {
@@ -1272,7 +1272,7 @@ trapeffect_dart_trap(
otmp = t_missile(DART, trap);
if (!rn2(6))
otmp->opoisoned = 1;
- dam = dmgval(otmp, &gy.youmonst);
+ dam = dmgval(otmp, u.umonst);
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
; /* nothing */
} else if (thitu(7, Maybe_Half_Phys(dam), &otmp, "little dart")) {
@@ -1329,7 +1329,7 @@ trapeffect_rocktrap(
struct obj *otmp;
boolean harmless = FALSE;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
if (trap->once && trap->tseen && !rn2(15)) {
pline("A trap door in %s opens, but nothing falls out!",
the(ceiling(u.ux, u.uy)));
@@ -1348,7 +1348,7 @@ trapeffect_rocktrap(
if (uarmh) {
/* normally passes_rocks() would protect against a falling
rock, but not when wearing a helmet */
- if (passes_rocks(gy.youmonst.data)) {
+ if (passes_rocks(u.umonst->data)) {
pline("Unfortunately, you are wearing %s.",
an(helm_simple_name(uarmh))); /* helm or hat */
dmg = 2;
@@ -1358,7 +1358,7 @@ trapeffect_rocktrap(
} else if (flags.verbose) {
pline("%s does not protect you.", Yname2(uarmh));
}
- } else if (passes_rocks(gy.youmonst.data)) {
+ } else if (passes_rocks(u.umonst->data)) {
pline("It passes harmlessly through you.");
harmless = TRUE;
}
@@ -1415,7 +1415,7 @@ trapeffect_sqky_board(
|| (trflags & FAILEDUNTRAP) != 0
|| (Flying && (trflags & VIASITTING) != 0));
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
if ((Levitation || Flying) && !forcetrap) {
if (!Blind) {
seetrap(trap);
@@ -1481,7 +1481,7 @@ trapeffect_bear_trap(
struct trap *trap,
unsigned trflags)
{
- boolean is_you = mtmp == &gy.youmonst,
+ boolean is_you = mtmp == u.umonst,
forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0
|| (is_you && (trflags & VIASITTING) != 0));
@@ -1492,13 +1492,13 @@ trapeffect_bear_trap(
if ((Levitation || Flying) && !forcetrap)
return Trap_Effect_Finished;
feeltrap(trap);
- if (amorphous(gy.youmonst.data) || is_whirly(gy.youmonst.data)
- || unsolid(gy.youmonst.data)) {
+ if (amorphous(u.umonst->data) || is_whirly(u.umonst->data)
+ || unsolid(u.umonst->data)) {
pline("%s bear trap closes harmlessly through you.",
A_Your[trap->madeby_u]);
return Trap_Effect_Finished;
}
- if (!u.usteed && gy.youmonst.data->msize <= MZ_SMALL) {
+ if (!u.usteed && u.umonst->data->msize <= MZ_SMALL) {
pline("%s bear trap closes harmlessly over you.",
A_Your[trap->madeby_u]);
return Trap_Effect_Finished;
@@ -1565,9 +1565,9 @@ trapeffect_slp_gas_trap(
struct trap *trap,
unsigned int trflags UNUSED)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
seetrap(trap);
- if (Sleep_resistance || breathless(gy.youmonst.data)) {
+ if (Sleep_resistance || breathless(u.umonst->data)) {
You("are enveloped in a cloud of gas!");
monstseesu(M_SEEN_SLEEP);
} else {
@@ -1599,7 +1599,7 @@ trapeffect_rust_trap(
{
struct obj *otmp, *nextobj;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
seetrap(trap);
/* Unlike monsters, traps cannot aim their rust attacks at
@@ -1650,7 +1650,7 @@ trapeffect_rust_trap(
You("are covered with rust!");
losehp(Maybe_Half_Phys(dam), "rusting away", KILLED_BY);
} else if (u.umonnum == PM_GREMLIN && rn2(3)) {
- (void) split_mon(&gy.youmonst, (struct monst *) 0);
+ (void) split_mon(u.umonst, (struct monst *) 0);
}
} else {
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
@@ -1732,7 +1732,7 @@ trapeffect_fire_trap(
struct trap *trap,
unsigned int trflags UNUSED)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
seetrap(trap);
dofiretrap((struct obj *) 0);
} else {
@@ -1832,7 +1832,7 @@ trapeffect_pit(
set to false if the spikes are found to not be relevant */
boolean relevant_spikes = ttype == SPIKED_PIT;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
boolean plunged = (trflags & TOOKPLUNGE) != 0;
boolean viasitting = (trflags & VIASITTING) != 0;
boolean conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE);
@@ -1850,7 +1850,7 @@ trapeffect_pit(
if (!Sokoban && (Levitation || (Flying && !plunged && !viasitting)))
return Trap_Effect_Finished;
feeltrap(trap);
- if (!Sokoban && is_clinger(gy.youmonst.data) && !plunged) {
+ if (!Sokoban && is_clinger(u.umonst->data) && !plunged) {
if (already_known) {
You_see("%s %spit below you.", a_your[trap->madeby_u],
ttype == SPIKED_PIT ? "spiked " : "");
@@ -1946,7 +1946,7 @@ trapeffect_pit(
} else {
/* plunging flyers take spike damage but not pit damage */
if (!conj_pit && !deliberate
- && !(plunged && (Flying || is_clinger(gy.youmonst.data))))
+ && !(plunged && (Flying || is_clinger(u.umonst->data))))
losehp(Maybe_Half_Phys(rnd(adj_pit ? 3 : 6)),
plunged ? "deliberately plunged into a pit"
: "fell into a pit",
@@ -2015,7 +2015,7 @@ trapeffect_hole(
struct trap *trap,
unsigned int trflags)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
if (!Can_fall_thru(&u.uz)) {
seetrap(trap); /* normally done in fall_through */
impossible("dotrap: %ss cannot exist on this level.",
@@ -2072,7 +2072,7 @@ trapeffect_telep_trap(
struct trap *trap,
unsigned int trflags UNUSED)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
seetrap(trap);
tele_trap(trap);
} else {
@@ -2090,7 +2090,7 @@ trapeffect_level_telep(
struct trap *trap,
unsigned int trflags)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
seetrap(trap);
level_tele_trap(trap, trflags);
} else {
@@ -2108,7 +2108,7 @@ trapeffect_web(
struct trap *trap,
unsigned int trflags)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
boolean webmsgok = (trflags & NOWEBMSG) == 0;
boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0);
@@ -2121,9 +2121,9 @@ trapeffect_web(
steed_article = ARTICLE_NONE;
feeltrap(trap);
- if (mu_maybe_destroy_web(&gy.youmonst, webmsgok, trap))
+ if (mu_maybe_destroy_web(u.umonst, webmsgok, trap))
return Trap_Effect_Finished;
- if (webmaker(gy.youmonst.data)) {
+ if (webmaker(u.umonst->data)) {
if (webmsgok)
pline(trap->madeby_u ? "You take a walk on your web."
: "There is a spider web here.");
@@ -2281,7 +2281,7 @@ trapeffect_statue_trap(
struct trap *trap,
unsigned int trflags UNUSED)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
(void) activate_statue_trap(trap, u.ux, u.uy, FALSE);
} else {
/* monsters don't trigger statue traps */
@@ -2295,7 +2295,7 @@ trapeffect_magic_trap(
struct trap *trap,
unsigned int trflags)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
seetrap(trap);
if (!rn2(30)) {
deltrap(trap);
@@ -2332,7 +2332,7 @@ trapeffect_anti_magic(
rather than the wearer */
if (shoes->spe > 0) {
/* no message if a monster does this, it isn't visible enough */
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
seetrap(trap);
pline("A lethargic aura surrounds %s.", yname(shoes));
costly_alteration(shoes, COST_DECHNT);
@@ -2343,7 +2343,7 @@ trapeffect_anti_magic(
}
}
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
int drain, halfd;
boolean exclaim_it = FALSE;
@@ -2455,7 +2455,7 @@ trapeffect_poly_trap(
struct trap *trap,
unsigned int trflags)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
boolean viasitting = (trflags & VIASITTING) != 0;
int steed_article = ARTICLE_THE;
char verbbuf[BUFSZ];
@@ -2537,7 +2537,7 @@ trapeffect_landmine(
if (wearing_iron_shoes(mtmp))
damage = (damage + 3) / 4;
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
boolean already_seen = trap->tseen;
boolean forcetrap = ((trflags & FORCETRAP) != 0
|| (trflags & FAILEDUNTRAP) != 0);
@@ -2663,7 +2663,7 @@ trapeffect_rolling_boulder_trap(
struct trap *trap,
unsigned int trflags UNUSED)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);
feeltrap(trap);
@@ -2715,7 +2715,7 @@ trapeffect_magic_portal(
struct trap *trap,
unsigned int trflags)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
feeltrap(trap);
domagicportal(trap);
} else {
@@ -2730,7 +2730,7 @@ trapeffect_vibrating_square(
struct trap *trap,
unsigned int trflags UNUSED)
{
- if (mtmp == &gy.youmonst) {
+ if (mtmp == u.umonst) {
feeltrap(trap);
/* messages handled elsewhere; the trap symbol is merely to mark the
square for future reference */
@@ -2794,7 +2794,7 @@ immune_to_trap(struct monst *mon, unsigned ttype)
return TRAP_NOT_IMMUNE;
}
pm = mon->data;
- is_you = (mon == &gy.youmonst);
+ is_you = (mon == u.umonst);
switch (ttype) {
case ARROW_TRAP:
@@ -2989,7 +2989,7 @@ trapeffect_selector(
return trapeffect_vibrating_square(mtmp, trap, trflags);
default:
impossible("%s encountered a strange trap of type %d.",
- (mtmp == &gy.youmonst) ? "You" : "Some monster",
+ (mtmp == u.umonst) ? "You" : "Some monster",
trap->ttyp);
}
return Trap_Effect_Finished;
@@ -3026,7 +3026,7 @@ dotrap(struct trap *trap, unsigned trflags)
trapname(ttype, TRUE)); /* do force "pit" while hallucinating */
/* then proceed to normal trap effect */
} else if (!forcetrap) {
- if (floor_trigger(ttype) && check_in_air(&gy.youmonst, trflags)) {
+ if (floor_trigger(ttype) && check_in_air(u.umonst, trflags)) {
if (already_seen) {
You("%s over %s %s.", u_locomotion("step"),
(ttype == ARROW_TRAP && !trap->madeby_u)
@@ -3038,7 +3038,7 @@ dotrap(struct trap *trap, unsigned trflags)
if (already_seen && !Fumbling && !undestroyable_trap(ttype)
&& ttype != ANTI_MAGIC && !forcebungle && !plunged
&& !conj_pit && !adj_pit
- && (!rn2(5) || (is_pit(ttype) && is_clinger(gy.youmonst.data)))) {
+ && (!rn2(5) || (is_pit(ttype) && is_clinger(u.umonst->data)))) {
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
? "an"
: a_your[trap->madeby_u],
@@ -3059,7 +3059,7 @@ dotrap(struct trap *trap, unsigned trflags)
* would be somewhat harsh for what's usually a minor impairment.
*/
- (void) trapeffect_selector(&gy.youmonst, trap, trflags);
+ (void) trapeffect_selector(u.umonst, trap, trflags);
}
staticfn char *
@@ -3398,7 +3398,7 @@ launch_obj(
break;
}
} else if (u_at(x, y)) {
- int dam = dmgval(singleobj, &gy.youmonst);
+ int dam = dmgval(singleobj, u.umonst);
if (gm.multi)
nomul(0);
@@ -3831,7 +3831,7 @@ instapetrify(const char *str)
{
if (Stone_resistance)
return;
- if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))
+ if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM))
return;
urgent_pline("You turn to stone...");
svk.killer.format = KILLED_BY;
@@ -4071,7 +4071,7 @@ float_down(
/* check for falling into pool - added by GAN 10/20/86 */
if (!Flying) {
if (!u.uswallow && u.ustuck) {
- if (sticks(gy.youmonst.data))
+ if (sticks(u.umonst->data))
You("aren't able to maintain your hold on %s.",
mon_nam(u.ustuck));
else
@@ -4185,14 +4185,14 @@ climb_pit(void)
display_nhwindow(WIN_MESSAGE, FALSE);
clear_nhwindow(WIN_MESSAGE);
You("free your %s.", body_part(LEG));
- } else if ((Flying || is_clinger(gy.youmonst.data)) && !Sokoban) {
+ } else if ((Flying || is_clinger(u.umonst->data)) && !Sokoban) {
/* eg fell in pit, then poly'd to a flying monster;
or used '>' to deliberately enter it */
You("%s from the %s.", u_locomotion("climb"), pitname);
reset_utrap(FALSE);
fill_pit(u.ux, u.uy);
gv.vision_full_recalc = 1; /* vision limits change */
- } else if (!(--u.utrap) || m_easy_escape_pit(&gy.youmonst)) {
+ } else if (!(--u.utrap) || m_easy_escape_pit(u.umonst)) {
reset_utrap(FALSE);
You("%s to the edge of the %s.",
(Sokoban && Levitation)
@@ -4289,8 +4289,8 @@ dofiretrap(
losehp(num, tower_of_flame, KILLED_BY_AN); /* fire damage */
burn_away_slime();
- if (burnarmor(&gy.youmonst) || rn2(3)) {
- (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
+ if (burnarmor(u.umonst) || rn2(3)) {
+ (void) destroy_items(u.umonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent);
}
if (!box && burn_floor_objects(u.ux, u.uy, see_it, TRUE) && !see_it)
@@ -4311,7 +4311,7 @@ domagictrap(void)
int cnt = rnd(4);
/* blindness effects */
- if (!resists_blnd(&gy.youmonst)) {
+ if (!resists_blnd(u.umonst)) {
You("are momentarily blinded by a flash of light!");
make_blinded((long) rn1(5, 10), FALSE);
if (!Blind)
@@ -4348,7 +4348,7 @@ domagictrap(void)
if (!Invis) {
if (!Blind)
self_invis_message();
- } else if (!EInvis && !pm_invisible(gy.youmonst.data)) {
+ } else if (!EInvis && !pm_invisible(u.umonst->data)) {
if (!Blind) {
if (!See_invisible)
You("can see yourself again!");
@@ -4379,7 +4379,7 @@ domagictrap(void)
if (on_level(&u.uz, &qstart_level))
You_feel(
"%slike the prodigal son.",
- (flags.female || (Upolyd && is_neuter(gy.youmonst.data)))
+ (flags.female || (Upolyd && is_neuter(u.umonst->data)))
? "oddly "
: "");
else
@@ -4610,10 +4610,10 @@ acid_damage(struct obj *obj)
if (!obj)
return;
- victim = carried(obj) ? &gy.youmonst : mcarried(obj) ? obj->ocarry : NULL;
- vismon = victim && (victim != &gy.youmonst) && canseemon(victim);
+ victim = carried(obj) ? u.umonst : mcarried(obj) ? obj->ocarry : NULL;
+ vismon = victim && (victim != u.umonst) && canseemon(victim);
- if (victim == &gy.youmonst && inventory_resistance_check(AD_ACID))
+ if (victim == u.umonst && inventory_resistance_check(AD_ACID))
return;
if (obj->greased) {
@@ -4625,7 +4625,7 @@ acid_damage(struct obj *obj)
#endif
) {
if (!Blind) {
- if (victim == &gy.youmonst)
+ if (victim == u.umonst)
Your("%s.", aobjnam(obj, "fade"));
else if (vismon)
pline("%s %s.", s_suffix(Monnam(victim)),
@@ -4927,13 +4927,13 @@ emergency_disrobe(boolean *lostsome)
}
/* pick a random goodpos() next to x,y for monster mtmp.
- mtmp could be &gy.youmonst, uses then crawl_destination().
+ mtmp could be u.umonst, uses then crawl_destination().
returns TRUE if any good position found, with the coord in x,y */
boolean
rnd_nextto_goodpos(coordxy *x, coordxy *y, struct monst *mtmp)
{
int i, j;
- boolean is_u = (mtmp == &gy.youmonst);
+ boolean is_u = (mtmp == u.umonst);
coordxy nx, ny, k, dirs[N_DIRS];
for (i = 0; i < N_DIRS; ++i)
@@ -5072,7 +5072,7 @@ drown(void)
water_damage_chain(gi.invent, FALSE);
if (u.umonnum == PM_GREMLIN && rn2(3)) {
- (void) split_mon(&gy.youmonst, (struct monst *) 0);
+ (void) split_mon(u.umonst, (struct monst *) 0);
} else if (u.umonnum == PM_IRON_GOLEM) {
You("rust!");
i = Maybe_Half_Phys(d(2, 6));
@@ -5110,10 +5110,10 @@ drown(void)
gv.vision_full_recalc = 1;
return FALSE;
}
- if ((Teleportation || can_teleport(gy.youmonst.data)) && !Unaware
+ if ((Teleportation || can_teleport(u.umonst->data)) && !Unaware
&& (Teleport_control || rn2(3) < Luck + 2)) {
You("attempt a teleport spell."); /* utcsri!carroll */
- if (!noteleport_level(&gy.youmonst)) {
+ if (!noteleport_level(u.umonst)) {
(void) dotele(FALSE);
if (!is_pool(u.ux, u.uy))
return TRUE;
@@ -5136,8 +5136,8 @@ drown(void)
x = u.ux, y = u.uy;
/* have to be able to move in order to crawl */
- if (gm.multi >= 0 && gy.youmonst.data->mmove
- && rnd_nextto_goodpos(&x, &y, &gy.youmonst)) {
+ if (gm.multi >= 0 && u.umonst->data->mmove
+ && rnd_nextto_goodpos(&x, &y, u.umonst)) {
boolean lost = FALSE;
/* time to do some strip-tease... */
boolean succ = Is_waterlevel(&u.uz) ? TRUE : emergency_disrobe(&lost);
@@ -5248,10 +5248,10 @@ could_untrap(boolean verbosely, boolean check_floor)
buf[0] = '\0';
if (near_capacity() >= HVY_ENCUMBER) {
Strcpy(buf, "You're too strained to do that.");
- } else if ((nohands(gy.youmonst.data) && !webmaker(gy.youmonst.data))
- || !gy.youmonst.data->mmove) {
+ } else if ((nohands(u.umonst->data) && !webmaker(u.umonst->data))
+ || !u.umonst->data->mmove) {
Strcpy(buf, "And just how do you expect to do that?");
- } else if (u.ustuck && sticks(gy.youmonst.data)) {
+ } else if (u.ustuck && sticks(u.umonst->data)) {
Sprintf(buf, "You'll have to let go of %s first.", mon_nam(u.ustuck));
} else if (u.ustuck || (welded(uwep) && bimanual(uwep))) {
Sprintf(buf, "Your %s seem to be too busy for that.",
@@ -5293,7 +5293,7 @@ untrap_prob(
if (u_wield_art(ART_STING) || attacks(AD_FIRE, wep))
chance = 1;
/* else chance stays 3 */
- } else if (!webmaker(gy.youmonst.data)) {
+ } else if (!webmaker(u.umonst->data)) {
chance = 7; /* 3.7: used to be 30 */
}
}
@@ -5444,10 +5444,10 @@ try_disarm(
return 0;
}
/* duplicate tight-space checks from test_move */
- if (u.dx && u.dy && bad_rock(gy.youmonst.data, u.ux, ttmp->ty)
- && bad_rock(gy.youmonst.data, ttmp->tx, u.uy)) {
+ if (u.dx && u.dy && bad_rock(u.umonst->data, u.ux, ttmp->ty)
+ && bad_rock(u.umonst->data, ttmp->tx, u.uy)) {
if ((gi.invent && (inv_weight() + weight_cap() > WT_TOOMUCH_DIAGONAL))
- || bigmonst(gy.youmonst.data)) {
+ || bigmonst(u.umonst->data)) {
/* don't allow untrap if they can't get thru to it */
You("are unable to reach the %s!", trapname(ttype, FALSE));
return 0;
@@ -5476,7 +5476,7 @@ try_disarm(
} else if (ttype == WEB) {
struct trap *ttmp2 = t_at(u.ux, u.uy);
- if (!webmaker(gy.youmonst.data)
+ if (!webmaker(u.umonst->data)
/* don't always try to spread the web */
&& !rn2(3)
/* is there already a trap at hero's spot?
@@ -5722,7 +5722,7 @@ help_monster_out(
You("grab the trapped %s using your bare %s.",
mtmp_pmname, makeplural(body_part(HAND)));
- if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
+ if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) {
display_nhwindow(WIN_MESSAGE, FALSE);
} else {
char kbuf[BUFSZ];
@@ -5850,7 +5850,7 @@ untrap(
/* 'force' is true for #invoke; if carrying MKoT, make it be true
for #untrap or autounlock */
- if (!force && has_magic_key(&gy.youmonst))
+ if (!force && has_magic_key(u.umonst))
force = TRUE;
if (!rx && !container) {
@@ -6092,7 +6092,7 @@ openholdingtrap(
struct trap *t, tdummy;
char buf[BUFSZ], whichbuf[20];
const char *trapdescr = 0, *which = 0;
- boolean ishero = (mon == &gy.youmonst);
+ boolean ishero = (mon == u.umonst);
if (!mon)
return FALSE;
@@ -6200,7 +6200,7 @@ closeholdingtrap(
{
struct trap *t;
unsigned dotrapflags;
- boolean ishero = (mon == &gy.youmonst), result;
+ boolean ishero = (mon == u.umonst), result;
if (!mon)
return FALSE;
@@ -6241,7 +6241,7 @@ openfallingtrap(
boolean *noticed) /* set to true iff hero notices the effect; */
{ /* otherwise left with its previous value intact */
struct trap *t;
- boolean ishero = (mon == &gy.youmonst), result;
+ boolean ishero = (mon == u.umonst), result;
if (!mon)
return FALSE;
@@ -6437,7 +6437,7 @@ chest_trap(
} else {
monstunseesu(M_SEEN_ELEC);
}
- (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dmg);
+ (void) destroy_items(u.umonst, AD_ELEC, orig_dmg);
if (dmg)
losehp(dmg, "electric shock", KILLED_BY_AN);
break;
@@ -6464,7 +6464,7 @@ chest_trap(
if (Hallucination)
pline("What a groovy feeling!");
else
- You("%s%s...", stagger(gy.youmonst.data, "stagger"),
+ You("%s%s...", stagger(u.umonst->data, "stagger"),
Halluc_resistance ? ""
: Blind ? " and get dizzy"
: " and your vision blurs");
@@ -6791,7 +6791,7 @@ lava_effects(void)
}
feel_newsym(u.ux, u.uy); /* in case Blind, map the lava here */
burn_away_slime();
- if (likes_lava(gy.youmonst.data))
+ if (likes_lava(u.umonst->data))
return FALSE;
usurvive = Fire_resistance || (Wwalking && dmg < u.uhp);
@@ -6967,7 +6967,7 @@ lava_effects(void)
}
burn_stuff:
- (void) destroy_items(&gy.youmonst, AD_FIRE, dmg);
+ (void) destroy_items(u.umonst, AD_FIRE, dmg);
ignite_items(gi.invent);
return FALSE;
}
diff --git a/src/u_init.c b/src/u_init.c
index 2b322b497..1d5a5c80f 100644
--- a/src/u_init.c
+++ b/src/u_init.c
@@ -956,6 +956,9 @@ u_init_misc(void)
(void) memset((genericptr_t) &ubirthday, 0, sizeof(ubirthday));
(void) memset((genericptr_t) &urealtime, 0, sizeof(urealtime));
+ u.umonst = newmonst();
+ *u.umonst = cg.zeromonst;
+ u.umonst->cham = u.mcham = NON_PM;
u.uroleplay = tmpuroleplay; /* restore options set via rcfile */
#if 0 /* documentation of more zero values as desirable */
diff --git a/src/uhitm.c b/src/uhitm.c
index 00858508e..eb04e0d1a 100644
--- a/src/uhitm.c
+++ b/src/uhitm.c
@@ -79,8 +79,8 @@ mhitm_mgc_atk_negated(
int armpro;
boolean negated;
- /* mcan doesn't apply to youmonst; hero can't be cancelled */
- if (magr != &gy.youmonst && magr->mcan)
+ /* mcan doesn't apply to u.umonst; hero can't be cancelled */
+ if (magr != u.umonst && magr->mcan)
return TRUE; /* no message if attacker has been cancelled */
armpro = magic_negation(mdef);
@@ -88,7 +88,7 @@ mhitm_mgc_atk_negated(
if (negated) {
/* attack has been thwarted by negation, aka magical cancellation */
if (verbosely) {
- if (mdef == &gy.youmonst)
+ if (mdef == u.umonst)
You("avoid harm.");
else if (gv.vis && canseemon(mdef))
pline_mon(mdef, "%s avoids harm.", Monnam(mdef));
@@ -375,7 +375,7 @@ find_roll_to_hit(
tmp = 1 + abon() + find_mac(mtmp) + u.uhitinc
+ (sgn(Luck) * ((abs(Luck) + 2) / 3))
- + maybe_polyd(gy.youmonst.data->mlevel, u.ulevel);
+ + maybe_polyd(u.umonst->data->mlevel, u.ulevel);
/* some actions should occur only once during multiple attacks */
if (!(*attk_count)++) {
@@ -401,7 +401,7 @@ find_roll_to_hit(
tmp += (u.ulevel / 3) + 2;
}
if (is_orc(mtmp->data)
- && maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
+ && maybe_polyd(is_elf(u.umonst->data), Race_if(PM_ELF)))
tmp++;
/* encumbrance: with a lot of luggage, your agility diminishes */
@@ -521,7 +521,7 @@ do_attack(struct monst *mtmp)
if (attack_checks(mtmp, uwep))
return TRUE;
- if (Upolyd && noattacks(gy.youmonst.data)) {
+ if (Upolyd && noattacks(u.umonst->data)) {
/* certain "pacifist" monsters don't attack */
You("have no way to attack monsters physically.");
mtmp->mstrategy &= ~STRAT_WAITMASK;
@@ -541,7 +541,7 @@ do_attack(struct monst *mtmp)
if (flags.verbose) {
if (uwep)
You("begin bashing monsters with %s.", yname(uwep));
- else if (!cantwield(gy.youmonst.data))
+ else if (!cantwield(u.umonst->data))
You("begin %s monsters with your %s %s.",
ing_suffix(Role_if(PM_MONK) ? "strike" : "bash"),
uarmg ? "gloved" : "bare", /* Del Lamb */
@@ -565,7 +565,7 @@ do_attack(struct monst *mtmp)
if (Upolyd)
(void) hmonas(mtmp);
else
- (void) hitum(mtmp, gy.youmonst.data->mattk);
+ (void) hitum(mtmp, u.umonst->data->mattk);
mtmp->mstrategy &= ~STRAT_WAITMASK;
atk_done:
@@ -628,7 +628,7 @@ known_hitum(
monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE);
if (u.ustuck == mon && !u.uswallow
- && !sticks(gy.youmonst.data))
+ && !sticks(u.umonst->data))
set_ustuck((struct monst *) 0);
}
/* Vorpal Blade hit converted to miss */
@@ -858,7 +858,7 @@ hmon_hitmon_barehands(struct _hitmon_data *hmd, struct monst *mon)
spcdmgflg = uarmg ? W_ARMG
: (((hmd->twohits == 0 || hmd->twohits == 1) ? W_RINGR : 0L)
| ((hmd->twohits == 0 || hmd->twohits == 2) ? W_RINGL : 0L));
- hmd->dmg += special_dmgval(&gy.youmonst, mon, spcdmgflg, &silverhit);
+ hmd->dmg += special_dmgval(u.umonst, mon, spcdmgflg, &silverhit);
/* copy silverhit info back into struct _hitmon_data *hmd */
switch (hmd->twohits) {
@@ -1013,7 +1013,7 @@ hmon_hitmon_weapon_melee(
}
if (obj->oartifact
- && artifact_hit(&gy.youmonst, mon, obj, &hmd->dmg, hmd->dieroll)) {
+ && artifact_hit(u.umonst, mon, obj, &hmd->dmg, hmd->dieroll)) {
/* artifact_hit updates 'tmp' but doesn't inflict any
damage; however, it might cause carried items to be
destroyed and they might do so */
@@ -1265,7 +1265,7 @@ hmon_hitmon_misc_obj(
case CREAM_PIE:
case BLINDING_VENOM:
mon->msleeping = 0;
- if (can_blnd(&gy.youmonst, mon,
+ if (can_blnd(u.umonst, mon,
(uchar) ((obj->otyp == BLINDING_VENOM)
? AT_SPIT
: AT_WEAP),
@@ -1819,7 +1819,7 @@ hmon_hitmon(
&& thrown != HMON_THROWN && thrown != HMON_KICKED)
/* this gives "harmlessly passes through" feedback even when
hero doesn't see it happen; presumably sensed by touch? */
- hmd.hittxt = shade_miss(&gy.youmonst, mon, obj, FALSE, TRUE);
+ hmd.hittxt = shade_miss(u.umonst, mon, obj, FALSE, TRUE);
}
if (hmd.jousting) {
@@ -1925,7 +1925,7 @@ hmon_hitmon(
wakeup(mon, TRUE);
if (maybe_knockback
- && mhitm_knockback(&gy.youmonst, mon, gy.youmonst.data->mattk,
+ && mhitm_knockback(u.umonst, mon, u.umonst->data->mattk,
&hitflags, TRUE)) {
if ((hitflags & M_ATTK_DEF_DIED) != 0)
hmd.destroyed = TRUE;
@@ -2021,7 +2021,7 @@ shade_miss(
boolean verbose)
{
const char *what, *whose, *target;
- boolean youagr = (magr == &gy.youmonst), youdef = (mdef == &gy.youmonst);
+ boolean youagr = (magr == u.umonst), youdef = (mdef == u.umonst);
/* we're using dmgval() for zero/not-zero, not for actual damage amount */
if (mdef->data != &mons[PM_SHADE] || (obj && dmgval(obj, mdef)))
@@ -2029,7 +2029,7 @@ shade_miss(
if (verbose
&& ((youdef || cansee(mdef->mx, mdef->my) || sensemon(mdef))
- || (magr == &gy.youmonst && m_next2u(mdef)))) {
+ || (magr == u.umonst && m_next2u(mdef)))) {
static const char harmlessly_thru[] = " harmlessly through ";
what = (!obj || shade_aware(obj)) ? "attack" : cxname(obj);
@@ -2138,7 +2138,7 @@ demonpet(void)
pline("Some hell-p has arrived!");
i = !rn2(6) ? ndemon(u.ualign.type) : NON_PM;
- pm = i != NON_PM ? &mons[i] : gy.youmonst.data;
+ pm = i != NON_PM ? &mons[i] : u.umonst->data;
if ((dtmp = makemon(pm, u.ux, u.uy, NO_MM_FLAGS)) != 0)
(void) tamedog(dtmp, (struct obj *) 0, FALSE);
exercise(A_WIS, TRUE);
@@ -2152,7 +2152,7 @@ theft_petrifies(struct obj *otmp)
return FALSE;
#if 0 /* no poly_when_stoned() critter has theft capability */
- if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
+ if (poly_when_stoned(u.umonst->data) && polymon(PM_STONE_GOLEM)) {
display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */
return TRUE;
}
@@ -2182,7 +2182,7 @@ steal_it(struct monst *mdef, struct attack *mattk)
/* look for worn body armor */
ustealo = (struct obj *) 0;
- if (could_seduce(&gy.youmonst, mdef, mattk) && mdef->mcanmove) {
+ if (could_seduce(u.umonst, mdef, mattk) && mdef->mcanmove) {
/* find armor, and move it to end of inventory in the process */
minvent_ptr = &mdef->minvent;
while ((otmp = *minvent_ptr) != 0)
@@ -2206,7 +2206,7 @@ steal_it(struct monst *mdef, struct attack *mattk)
but was using hardcoded pronouns She/her for target monster;
switch to dynamic pronoun */
if (gender(mdef) == (int) u.mfemale
- && gy.youmonst.data->mlet == S_NYMPH)
+ && u.umonst->data->mlet == S_NYMPH)
You("charm %s. %s gladly hands over %s%s possessions.",
mon_nam(mdef), upstart(strcpy(heshe, mhe(mdef))),
!gold ? "" : "most of ", mhis(mdef));
@@ -2284,7 +2284,7 @@ mhitm_ad_rust(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (completelyrusts(pd)) { /* iron golem */
/* note: the life-saved case is hypothetical because
@@ -2296,7 +2296,7 @@ mhitm_ad_rust(
}
erode_armor(mdef, ERODE_RUST);
mhm->damage = 0; /* damageum(), int tmp */
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (magr->mcan) {
@@ -2308,7 +2308,7 @@ mhitm_ad_rust(
rehumanize();
return;
}
- erode_armor(&gy.youmonst, ERODE_RUST);
+ erode_armor(u.umonst, ERODE_RUST);
} else {
/* mhitm */
if (magr->mcan)
@@ -2339,11 +2339,11 @@ mhitm_ad_corr(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
erode_armor(mdef, ERODE_CORRODE);
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (magr->mcan)
@@ -2366,7 +2366,7 @@ mhitm_ad_dcay(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (completelyrots(pd)) { /* wood golem or leather golem */
pline("%s %s to pieces!", Monnam(mdef),
@@ -2375,7 +2375,7 @@ mhitm_ad_dcay(
}
erode_armor(mdef, ERODE_ROT);
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (magr->mcan)
@@ -2421,12 +2421,12 @@ mhitm_ad_dren(
{
boolean negated = mhitm_mgc_atk_negated(magr, mdef, FALSE);
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!negated && !rn2(4))
xdrainenergym(mdef, TRUE);
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!negated && !rn2(4)) /* 25% chance */
@@ -2446,7 +2446,7 @@ mhitm_ad_drli(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!rn2(3) && !(resists_drli(mdef) || defended(mdef, AD_DRLI))
&& !mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
@@ -2476,7 +2476,7 @@ mhitm_ad_drli(
/* unlike hitting with Stormbringer, wounded hero doesn't
heal any from the drained life */
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!rn2(3) && !Drain_resistance
@@ -2525,7 +2525,7 @@ mhitm_ad_fire(
struct permonst *pd = mdef->data;
const int orig_dmg = mhm->damage; /* damage coming into the function */
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
mhm->damage = 0;
@@ -2558,7 +2558,7 @@ mhitm_ad_fire(
}
mhm->damage += destroy_items(mdef, AD_FIRE, orig_dmg);
ignite_items(mdef->minvent);
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
@@ -2577,7 +2577,7 @@ mhitm_ad_fire(
monstunseesu(M_SEEN_FIRE);
}
if ((int) magr->m_lev > rn2(20)) {
- (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
+ (void) destroy_items(u.umonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent);
}
burn_away_slime();
@@ -2629,7 +2629,7 @@ mhitm_ad_cold(
{
const int orig_dmg = mhm->damage;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
mhm->damage = 0;
@@ -2645,7 +2645,7 @@ mhitm_ad_cold(
mhm->damage = 0;
}
mhm->damage += destroy_items(mdef, AD_COLD, orig_dmg);
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
@@ -2658,7 +2658,7 @@ mhitm_ad_cold(
monstunseesu(M_SEEN_COLD);
}
if ((int) magr->m_lev > rn2(20))
- (void) destroy_items(&gy.youmonst, AD_COLD, orig_dmg);
+ (void) destroy_items(u.umonst, AD_COLD, orig_dmg);
} else
mhm->damage = 0;
} else {
@@ -2687,7 +2687,7 @@ mhitm_ad_elec(
{
const int orig_dmg = mhm->damage;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
mhm->damage = 0;
@@ -2703,7 +2703,7 @@ mhitm_ad_elec(
mhm->damage = 0;
}
mhm->damage += destroy_items(mdef, AD_ELEC, orig_dmg);
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
@@ -2716,7 +2716,7 @@ mhitm_ad_elec(
monstunseesu(M_SEEN_ELEC);
}
if ((int) magr->m_lev > rn2(20))
- (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dmg);
+ (void) destroy_items(u.umonst, AD_ELEC, orig_dmg);
} else
mhm->damage = 0;
} else {
@@ -2743,11 +2743,11 @@ mhitm_ad_acid(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (resists_acid(mdef) || defended(mdef, AD_ACID))
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!magr->mcan && !rn2(3))
@@ -2794,7 +2794,7 @@ mhitm_ad_sgld(
struct permonst *pa = magr->data;
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
struct obj *mongold = findgold(mdef->minvent);
@@ -2812,7 +2812,7 @@ mhitm_ad_sgld(
}
exercise(A_DEX, TRUE);
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (pd->mlet == pa->mlet)
@@ -2860,7 +2860,7 @@ mhitm_ad_tlpt(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (mhm->damage <= 0)
mhm->damage = 1;
@@ -2881,7 +2881,7 @@ mhitm_ad_tlpt(
mhm->damage = mdef->mhp - 1;
}
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
int tmphp;
@@ -2961,7 +2961,7 @@ mhitm_ad_blnd(
struct monst *mdef, /* defender */
struct mhitm_data *mhm) /* optional for monster vs monster */
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
if (!Blind && mdef->mcansee)
@@ -2973,7 +2973,7 @@ mhitm_ad_blnd(
mdef->mblinded = mhm->damage;
}
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
if (!Blind)
@@ -3019,7 +3019,7 @@ mhitm_ad_curs(
struct permonst *pa = magr->data;
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (night() && !rn2(10) && !mdef->mcan) {
if (pd == &mons[PM_CLAY_GOLEM]) {
@@ -3034,7 +3034,7 @@ mhitm_ad_curs(
}
}
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!night() && pa == &mons[PM_GREMLIN])
@@ -3126,7 +3126,7 @@ mhitm_ad_drst(
boolean negated = mhitm_mgc_atk_negated(magr, mdef, FALSE);
struct permonst *pa = magr->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!negated && !rn2(8)) {
Your("%s was poisoned!", mpoisons_subj(magr, mattk));
@@ -3140,7 +3140,7 @@ mhitm_ad_drst(
mhm->damage += rn1(10, 6);
}
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
int ptmp = A_STR; /* A_STR == 0 */
char buf[BUFSZ];
@@ -3182,7 +3182,7 @@ mhitm_ad_drin(
* attack and no longer wearing any amulet after the attack.
*/
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
struct obj *helmet;
@@ -3213,13 +3213,13 @@ mhitm_ad_drin(
amu = which_armor(mdef, W_AMUL);
lifsav = amu && amu->otyp == AMULET_OF_LIFE_SAVING;
- (void) eat_brains(&gy.youmonst, mdef, TRUE, &mhm->damage);
+ (void) eat_brains(u.umonst, mdef, TRUE, &mhm->damage);
/* skip further AD_DRIN if amulet of life-saving got used up */
if (lifsav && !which_armor(mdef, W_AMUL))
gs.skipdrin = TRUE;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (defends(AD_DRIN, uwep) || !has_head(pd)) {
@@ -3311,14 +3311,14 @@ mhitm_ad_stck(
struct permonst *pd = mdef->data;
boolean barbs = (magr->data == &mons[PM_BARBED_DEVIL]);
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!negated && !sticks(pd) && m_next2u(mdef)) {
set_ustuck(mdef); /* it's now stuck to you */
if (barbs)
Your("barbs stick to %s!", y_monnam(mdef));
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!negated && !u.ustuck && !sticks(pd)) {
@@ -3341,7 +3341,7 @@ mhitm_ad_wrap(
struct permonst *pd = mdef->data, *pa = magr->data;
boolean coil = slithy(pa) && (pa->mlet == S_SNAKE || pa->mlet == S_NAGA);
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!sticks(pd)) {
boolean tailmiss = !gn.notonhead;
@@ -3373,7 +3373,7 @@ mhitm_ad_wrap(
}
} else
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
if ((!magr->mcan || u.ustuck == magr) && !sticks(pd)) {
if (!u.ustuck && !rn2(10)) {
@@ -3432,7 +3432,7 @@ mhitm_ad_plys(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!rn2(3) && mhm->damage < mdef->mhp
&& !mhitm_mgc_atk_negated(magr, mdef, TRUE)) {
@@ -3440,7 +3440,7 @@ mhitm_ad_plys(
pline("%s is frozen by you!", Monnam(mdef));
paralyze_monst(mdef, rnd(10));
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (gm.multi >= 0 && !rn2(3)
@@ -3481,7 +3481,7 @@ mhitm_ad_slee(
struct monst *mdef,
struct mhitm_data *mhm UNUSED)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!mdef->msleeping && !mhitm_mgc_atk_negated(magr, mdef, FALSE)
&& sleep_monst(mdef, rnd(10), -1)) {
@@ -3489,7 +3489,7 @@ mhitm_ad_slee(
pline("%s is put to sleep by you!", Monnam(mdef));
slept_monst(mdef);
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (gm.multi >= 0 && !rn2(5)
@@ -3530,7 +3530,7 @@ mhitm_ad_slim(
boolean negated = mhitm_mgc_atk_negated(magr, mdef, FALSE);
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (negated)
return; /* physical damage only */
@@ -3550,7 +3550,7 @@ mhitm_ad_slim(
}
mhm->damage = 0;
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (negated) {
@@ -3605,10 +3605,10 @@ mhitm_ad_ench(
struct monst *mdef,
struct mhitm_data *mhm UNUSED)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
/* there's no msomearmor() function, so just do damage */
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
boolean negated = mhitm_mgc_atk_negated(magr, mdef, FALSE);
@@ -3659,7 +3659,7 @@ mhitm_ad_slow(
if (defended(mdef, AD_SLOW))
return;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!negated && mdef->mspeed != MSLOW) {
unsigned int oldspeed = mdef->mspeed;
@@ -3668,7 +3668,7 @@ mhitm_ad_slow(
if (mdef->mspeed != oldspeed && canseemon(mdef))
pline("%s slows down.", Monnam(mdef));
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!negated && HFast && !rn2(4))
@@ -3691,14 +3691,14 @@ mhitm_ad_conf(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!mdef->mconf) {
if (canseemon(mdef))
pline("%s looks confused.", Monnam(mdef));
mdef->mconf = 1;
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!magr->mcan && !rn2(4) && !magr->mspec_used) {
@@ -3733,7 +3733,7 @@ mhitm_ad_poly(
boolean negated = (mhitm_mgc_atk_negated(magr, mdef, FALSE)
|| magr->mspec_used);
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
/* require weaponless attack in order to honor AD_POLY */
if (!uwep && mhm->damage < mdef->mhp) {
@@ -3741,14 +3741,14 @@ mhitm_ad_poly(
/* assume that you can tell by touch if blinded */
pline("%s is not transformed.", Monnam(mdef));
} else {
- mhm->damage = mon_poly(&gy.youmonst, mdef, mhm->damage);
+ mhm->damage = mon_poly(u.umonst, mdef, mhm->damage);
if (DEADMONSTER(mdef))
mhm->hitflags |= M_ATTK_DEF_DIED;
mhm->hitflags |= M_ATTK_HIT;
mhm->done = TRUE;
}
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (Maybe_Half_Phys(mhm->damage) < (Upolyd ? u.mh : u.uhp)) {
@@ -3756,7 +3756,7 @@ mhitm_ad_poly(
if (magr->mcan)
You("aren't transformed.");
} else {
- mhm->damage = mon_poly(magr, &gy.youmonst, mhm->damage);
+ mhm->damage = mon_poly(magr, u.umonst, mhm->damage);
mhm->hitflags |= M_ATTK_HIT;
mhm->done = TRUE;
}
@@ -3781,12 +3781,12 @@ mhitm_ad_famn(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm; hero can't polymorph into anything with this attack
so this won't happen; if it could, it would be the same as
the mhitm case except for messaging */
goto mhitm_famn;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
pline_mon(magr, "%s reaches out, and your body shrivels.",
Monnam(magr));
@@ -3812,12 +3812,12 @@ mhitm_ad_pest(
struct attack alt_attk;
struct permonst *pa = magr->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm; hero can't polymorph into anything with this attack
so this won't happen; if it could, it would be the same as
the mhitm case except for messaging */
goto mhitm_pest;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
pline_mon(magr, "%s reaches out, and you feel fever and chills.",
Monnam(magr));
@@ -3841,12 +3841,12 @@ mhitm_ad_deth(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm; hero can't polymorph into anything with this attack
so this won't happen; if it could, it would be the same as
the mhitm case except for messaging */
goto mhitm_deth;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
pline_mon(magr, "%s reaches out with its deadly touch.", Monnam(magr));
if (is_undead(pd)) {
@@ -3901,10 +3901,10 @@ mhitm_ad_halu(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
mhm->damage = 0;
} else {
@@ -3924,7 +3924,7 @@ boolean
do_stone_u(struct monst *mtmp)
{
if (!Stoned && !Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
int kformat = KILLED_BY_AN;
const char *kname = pmname(mtmp->data, Mgender(mtmp));
@@ -3985,7 +3985,7 @@ mhitm_ad_phys(
struct permonst *pa = magr->data;
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (pd == &mons[PM_SHADE]) {
mhm->damage = 0;
@@ -4018,7 +4018,7 @@ mhitm_ad_phys(
mhm->damage = 1;
}
}
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
if (mattk->aatyp == AT_HUGS && !sticks(pd)) {
if (!u.ustuck && rn2(2)) {
@@ -4103,7 +4103,7 @@ mhitm_ad_phys(
if (cloneu())
You("divide as %s hits you!", mon_nam(magr));
}
- rustm(&gy.youmonst, otmp);
+ rustm(u.umonst, otmp);
if (was_poisoned && gm.mhitu_dieroll <= 5) {
char buf[BUFSZ];
@@ -4204,12 +4204,12 @@ mhitm_ad_ston(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!munstone(mdef, TRUE))
minstapetrify(mdef, TRUE);
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!rn2(3)) {
@@ -4268,12 +4268,12 @@ mhitm_ad_were(
{
struct permonst *pa = magr->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
mhitm_ad_phys(magr, mattk, mdef, mhm);
if (mhm->done)
return;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!rn2(4) && u.ulycn == NON_PM
@@ -4299,12 +4299,12 @@ mhitm_ad_heal(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
mhitm_ad_phys(magr, mattk, mdef, mhm);
if (mhm->done)
return;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
/* a cancelled nurse is just an ordinary monster,
* nurses don't heal those that cause petrification */
@@ -4391,7 +4391,7 @@ mhitm_ad_stun(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
if (!Blind)
pline("%s %s for a moment.", Monnam(mdef),
@@ -4400,7 +4400,7 @@ mhitm_ad_stun(
mhitm_ad_phys(magr, mattk, mdef, mhm);
if (mhm->done)
return;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!magr->mcan && !rn2(4)) {
@@ -4426,7 +4426,7 @@ mhitm_ad_legs(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
#if 0
if (u.ucancelled) {
@@ -4437,7 +4437,7 @@ mhitm_ad_legs(
mhitm_ad_phys(magr, mattk, mdef, mhm);
if (mhm->done)
return;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE;
const char *sidestr = (side == RIGHT_SIDE) ? "right" : "left",
@@ -4496,10 +4496,10 @@ mhitm_ad_dgst(
{
struct permonst *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
mhm->damage = 0;
} else {
@@ -4571,10 +4571,10 @@ mhitm_ad_samu(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
/* when the Wizard or quest nemesis hits, there's a 1/20 chance
@@ -4596,12 +4596,12 @@ mhitm_ad_dise(
{
struct permonst *pa = magr->data, *pd = mdef->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm; hero can't polymorph into anything with this attack so
this won't happen; if it could, it would be the same as the
mhitm case except for messaging */
goto mhitm_dise;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!diseasemu(pa))
@@ -4626,11 +4626,11 @@ mhitm_ad_sedu(
{
struct permonst *pa = magr->data;
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
steal_it(mdef, mattk);
mhm->damage = 0;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
char buf[BUFSZ];
@@ -4639,11 +4639,11 @@ mhitm_ad_sedu(
if (magr->mcan)
return;
/* Continue below */
- } else if (dmgtype(gy.youmonst.data, AD_SEDU)
+ } else if (dmgtype(u.umonst->data, AD_SEDU)
/* !SYSOPT_SEDUCE: when hero is attacking and AD_SSEX
is disabled, it would be changed to another damage
type, but when defending, it remains as-is */
- || dmgtype(gy.youmonst.data, AD_SSEX)) {
+ || dmgtype(u.umonst->data, AD_SSEX)) {
pline_mon(magr, "%s %s.", Monnam(magr),
Deaf ? "says something but you can't hear it"
: magr->minvent
@@ -4751,12 +4751,12 @@ void
mhitm_ad_ssex(struct monst *magr, struct attack *mattk, struct monst *mdef,
struct mhitm_data *mhm)
{
- if (magr == &gy.youmonst) {
+ if (magr == u.umonst) {
/* uhitm */
mhitm_ad_sedu(magr, mattk, mdef, mhm);
if (mhm->done)
return;
- } else if (mdef == &gy.youmonst) {
+ } else if (mdef == u.umonst) {
/* mhitu */
if (SYSOPT_SEDUCE) {
if (could_seduce(magr, mdef, mattk) == 1 && !magr->mcan)
@@ -4845,13 +4845,13 @@ damageum(
mhm.specialdmg = specialdmg;
mhm.done = FALSE;
- if (is_demon(gy.youmonst.data) && !rn2(13) && !uwep
+ if (is_demon(u.umonst->data) && !rn2(13) && !uwep
&& u.umonnum != PM_AMOROUS_DEMON && u.umonnum != PM_BALROG) {
demonpet();
return M_ATTK_MISS;
}
- mhitm_adtyping(&gy.youmonst, mattk, mdef, &mhm);
+ mhitm_adtyping(u.umonst, mattk, mdef, &mhm);
if (mhm.done)
return mhm.hitflags;
@@ -4930,12 +4930,12 @@ explum(struct monst *mdef, struct attack *mattk)
staticfn void
start_engulf(struct monst *mdef)
{
- boolean u_digest = digests(gy.youmonst.data),
- u_enfold = enfolds(gy.youmonst.data);
+ boolean u_digest = digests(u.umonst->data),
+ u_enfold = enfolds(u.umonst->data);
if (!Invisible) {
map_location(u.ux, u.uy, TRUE);
- tmp_at(DISP_ALWAYS, mon_to_glyph(&gy.youmonst, rn2_on_display_rng));
+ tmp_at(DISP_ALWAYS, mon_to_glyph(u.umonst, rn2_on_display_rng));
tmp_at(mdef->mx, mdef->my);
}
You("%s %s%s!",
@@ -4961,8 +4961,8 @@ gulpum(struct monst *mdef, struct attack *mattk)
int tmp;
int dam = d((int) mattk->damn, (int) mattk->damd);
boolean fatal_gulp,
- u_digest = digests(gy.youmonst.data),
- u_enfold = enfolds(gy.youmonst.data);
+ u_digest = digests(u.umonst->data),
+ u_enfold = enfolds(u.umonst->data);
struct obj *otmp;
struct permonst *pd = mdef->data;
const char *expel_verb = u_digest ? "regurgitate"
@@ -4977,11 +4977,11 @@ gulpum(struct monst *mdef, struct attack *mattk)
* after exactly 1 round of attack otherwise. -KAA
*/
- if (!engulf_target(&gy.youmonst, mdef))
+ if (!engulf_target(u.umonst, mdef))
return M_ATTK_MISS;
if (!(u_digest && u.uhunger >= 1500) && !u.uswallow) {
- if (!flaming(gy.youmonst.data)) {
+ if (!flaming(u.umonst->data)) {
for (otmp = mdef->minvent; otmp; otmp = otmp->nobj)
(void) snuff_lit(otmp);
}
@@ -5060,14 +5060,14 @@ gulpum(struct monst *mdef, struct attack *mattk)
"you totally digest " will be coming soon (after
several turns) but the level-gain message seems out of
order if the kill message is left implicit */
- gm.mswallower = &gy.youmonst;
+ gm.mswallower = u.umonst;
xkilled(mdef, XKILL_GIVEMSG | XKILL_NOCORPSE);
if (!DEADMONSTER(mdef)) { /* monster lifesaved */
You("hurriedly regurgitate the sizzling in your %s.",
body_part(STOMACH));
} else {
tmp = 1 + (pd->cwt >> 8);
- if (corpse_chance(mdef, &gy.youmonst, TRUE)
+ if (corpse_chance(mdef, u.umonst, TRUE)
&& !(svm.mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) {
/* nutrition only if there can be a corpse */
u.uhunger += (pd->cnutrit + 1) / 2;
@@ -5105,7 +5105,7 @@ gulpum(struct monst *mdef, struct attack *mattk)
end_engulf();
return M_ATTK_DEF_DIED;
case AD_PHYS:
- if (gy.youmonst.data == &mons[PM_FOG_CLOUD]) {
+ if (u.umonst->data == &mons[PM_FOG_CLOUD]) {
pline("%s is laden with your moisture.", Monnam(mdef));
if ((breathless(pd) || amphibious(pd)) && !flaming(pd)) {
dam = 0;
@@ -5113,7 +5113,7 @@ gulpum(struct monst *mdef, struct attack *mattk)
}
} else {
pline("%s is %s!", Monnam(mdef),
- enfolds(gy.youmonst.data) ? "being squashed"
+ enfolds(u.umonst->data) ? "being squashed"
: "pummeled with your debris");
}
break;
@@ -5125,7 +5125,7 @@ gulpum(struct monst *mdef, struct attack *mattk)
}
break;
case AD_BLND:
- if (can_blnd(&gy.youmonst, mdef, mattk->aatyp,
+ if (can_blnd(u.umonst, mdef, mattk->aatyp,
(struct obj *) 0)) {
if (mdef->mcansee)
pline("%s can't see in there!", Monnam(mdef));
@@ -5185,7 +5185,7 @@ gulpum(struct monst *mdef, struct attack *mattk)
return M_ATTK_DEF_DIED;
}
You("%s %s!", expel_verb, mon_nam(mdef));
- if ((Slow_digestion || is_animal(gy.youmonst.data)) && u_digest) {
+ if ((Slow_digestion || is_animal(u.umonst->data)) && u_digest) {
pline("Obviously, you didn't like %s taste.",
s_suffix(mon_nam(mdef)));
}
@@ -5203,7 +5203,7 @@ missum(
if (wouldhavehit) /* monk is missing due to penalty for wearing suit */
Your("armor is rather cumbersome...");
- if (could_seduce(&gy.youmonst, mdef, mattk))
+ if (could_seduce(u.umonst, mdef, mattk))
You("pretend to be friendly to %s.", mon_nam(mdef));
else if (canspotmon(mdef) && flags.verbose)
You("miss %s.", mon_nam(mdef));
@@ -5217,7 +5217,7 @@ missum(
boolean
m_is_steadfast(struct monst *mtmp)
{
- boolean is_u = (mtmp == &gy.youmonst);
+ boolean is_u = (mtmp == u.umonst);
struct obj *otmp = is_u ? uwep : MON_WEP(mtmp);
/* must be on the ground (or in water) */
@@ -5231,7 +5231,7 @@ m_is_steadfast(struct monst *mtmp)
return TRUE;
/* steadfast if carrying any loadstone (and not floating or flying);
- 'is_u' test not needed here; m_carrying() is 'youmonst' aware */
+ 'is_u' test not needed here; m_carrying() is 'u.umonst' aware */
if (m_carrying(mtmp, LOADSTONE))
return TRUE;
/* when mounted and steed is target of knockback, check the rider for
@@ -5257,8 +5257,8 @@ mhitm_knockback(
coordxy dx, dy, defx, defy;
int knockdistance = rn2(3) ? 1 : 2; /* 67%: 1 step, 33%: 2 steps */
int chance = 6; /* 1/6 chance of attack knocking back a monster */
- boolean u_agr = (magr == &gy.youmonst);
- boolean u_def = (mdef == &gy.youmonst);
+ boolean u_agr = (magr == u.umonst);
+ boolean u_def = (mdef == u.umonst);
boolean was_u = FALSE, dismount = FALSE;
struct obj *wep = weapon_used ? (u_agr ? uwep : MON_WEP(magr))
: (struct obj *) 0;
@@ -5438,7 +5438,7 @@ hmonas(struct monst *mon)
whether silver ring causes successful hit */
for (i = 0; i < NATTK; i++) {
sum[i] = M_ATTK_MISS;
- mattk = getmattk(&gy.youmonst, mon, i, sum, &alt_attk);
+ mattk = getmattk(u.umonst, mon, i, sum, &alt_attk);
if (mattk->aatyp == AT_WEAP)
++multi_weap;
if (mattk->aatyp == AT_WEAP
@@ -5460,7 +5460,7 @@ hmonas(struct monst *mon)
|| DEADMONSTER(mon)))
continue;
- mattk = getmattk(&gy.youmonst, mon, i, sum, &alt_attk);
+ mattk = getmattk(u.umonst, mon, i, sum, &alt_attk);
if (gs.skipdrin && mattk->aatyp == AT_TENT && mattk->adtyp == AD_DRIN)
continue;
weapon = 0;
@@ -5546,17 +5546,17 @@ hmonas(struct monst *mon)
sum[i] = damageum(mon, mattk, 0);
break;
case AT_CLAW:
- if (uwep && !cantwield(gy.youmonst.data) && !weapon_used)
+ if (uwep && !cantwield(u.umonst->data) && !weapon_used)
goto use_weapon;
FALLTHROUGH;
/*FALLTHRU*/
case AT_TUCH:
- if (uwep && gy.youmonst.data->mlet == S_LICH && !weapon_used)
+ if (uwep && u.umonst->data->mlet == S_LICH && !weapon_used)
goto use_weapon;
FALLTHROUGH;
/*FALLTHRU*/
case AT_KICK:
- if (mattk->aatyp == AT_KICK && mtrapped_in_pit(&gy.youmonst))
+ if (mattk->aatyp == AT_KICK && mtrapped_in_pit(u.umonst))
continue;
FALLTHROUGH;
/*FALLTHRU*/
@@ -5576,7 +5576,7 @@ hmonas(struct monst *mon)
const char *verb = 0; /* verb or body part */
if (!u.uswallow
- && (compat = could_seduce(&gy.youmonst, mon, mattk))
+ && (compat = could_seduce(u.umonst, mon, mattk))
!= 0) {
You("%s %s %s.",
(mon->mcansee && haseyes(mon->data)) ? "smile at"
@@ -5604,7 +5604,7 @@ hmonas(struct monst *mon)
{bite,claw,claw} instead of {claw,claw,bite} doesn't
make poly'd hero mysteriously switch handedness */
odd_claw = !odd_claw;
- specialdmg = special_dmgval(&gy.youmonst, mon,
+ specialdmg = special_dmgval(u.umonst, mon,
W_ARMG
| ((odd_claw || !multi_claw)
? W_RINGL : 0L)
@@ -5619,7 +5619,7 @@ hmonas(struct monst *mon)
break;
case AT_KICK:
verb = "kick";
- specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF,
+ specialdmg = special_dmgval(u.umonst, mon, W_ARMF,
&silverhit);
break;
case AT_BUTT:
@@ -5627,7 +5627,7 @@ hmonas(struct monst *mon)
/* hypothetical; if any form with a head-butt attack
could wear a helmet, it would hit shades when
wearing a blessed (or silver) one */
- specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMH,
+ specialdmg = special_dmgval(u.umonst, mon, W_ARMH,
&silverhit);
break;
case AT_BITE:
@@ -5649,7 +5649,7 @@ hmonas(struct monst *mon)
} else {
/* either not a shade or no special silver/blessed damage,
other unsolid monsters are immune to AT_TUCH+AD_WRAP */
- if (failed_grab(&gy.youmonst, mon, mattk))
+ if (failed_grab(u.umonst, mon, mattk))
break; /* miss; message already given */
if (mattk->aatyp == AT_TENT) {
@@ -5659,7 +5659,7 @@ hmonas(struct monst *mon)
verb = "hit"; /* not "claws" */
You("%s %s.", verb, mon_nam(mon));
if (silverhit && flags.verbose)
- silver_sears(&gy.youmonst, mon, silverhit);
+ silver_sears(u.umonst, mon, silverhit);
}
sum[i] = damageum(mon, mattk, specialdmg);
}
@@ -5694,7 +5694,7 @@ hmonas(struct monst *mon)
wakeup(mon, TRUE);
/* choking hug/throttling grab uses hands (gloves or rings);
normal hug uses outermost of cloak/suit/shirt */
- specialdmg = special_dmgval(&gy.youmonst, mon,
+ specialdmg = special_dmgval(u.umonst, mon,
byhand ? (W_ARMG | W_RINGL | W_RINGR)
: (W_ARMC | W_ARM | W_ARMU),
&silverhit);
@@ -5723,7 +5723,7 @@ hmonas(struct monst *mon)
if (specialdmg) {
You("%s %s%s", verb, mon_nam(mon), exclam(specialdmg));
if (silverhit && flags.verbose)
- silver_sears(&gy.youmonst, mon, silverhit);
+ silver_sears(u.umonst, mon, silverhit);
sum[i] = damageum(mon, mattk, specialdmg);
} else {
Your("%s passes harmlessly through %s.",
@@ -5732,7 +5732,7 @@ hmonas(struct monst *mon)
break;
}
/* can't grab unsolid creatures (checked after shade handling) */
- if (failed_grab(&gy.youmonst, mon, mattk))
+ if (failed_grab(u.umonst, mon, mattk))
break;
/* hug attack against ordinary foe */
if (mon == u.ustuck) {
@@ -5741,7 +5741,7 @@ hmonas(struct monst *mon)
/* extra feedback for non-breather being choked */
unconcerned ? " but doesn't seem concerned" : "");
if (silverhit && flags.verbose)
- silver_sears(&gy.youmonst, mon, silverhit);
+ silver_sears(u.umonst, mon, silverhit);
sum[i] = damageum(mon, mattk, specialdmg);
} else if (i >= 2 && (sum[i - 1] > M_ATTK_MISS)
&& (sum[i - 2] > M_ATTK_MISS)) {
@@ -5753,7 +5753,7 @@ hmonas(struct monst *mon)
You("grab %s!", mon_nam(mon));
set_ustuck(mon);
if (silverhit && flags.verbose)
- silver_sears(&gy.youmonst, mon, silverhit);
+ silver_sears(u.umonst, mon, silverhit);
sum[i] = damageum(mon, mattk, specialdmg);
}
break; /* AT_HUGS */
@@ -5776,7 +5776,7 @@ hmonas(struct monst *mon)
if (mon->data == &mons[PM_SHADE]) {
/* no specialdmg check needed */
Your("attempt to surround %s is harmless.", mon_nam(mon));
- } else if (failed_grab(&gy.youmonst, mon, mattk)) {
+ } else if (failed_grab(u.umonst, mon, mattk)) {
; /* non-shade miss; message already given */
} else {
sum[i] = gulpum(mon, mattk);
@@ -5797,9 +5797,9 @@ hmonas(struct monst *mon)
/* No check for uwep; if wielding nothing we want to
* do the normal 1-2 points bare hand damage...
*/
- if ((gy.youmonst.data->mlet == S_KOBOLD
- || gy.youmonst.data->mlet == S_ORC
- || gy.youmonst.data->mlet == S_GNOME) && !weapon_used)
+ if ((u.umonst->data->mlet == S_KOBOLD
+ || u.umonst->data->mlet == S_ORC
+ || u.umonst->data->mlet == S_GNOME) && !weapon_used)
goto use_weapon;
FALLTHROUGH;
/*FALLTHRU*/
@@ -5830,7 +5830,7 @@ hmonas(struct monst *mon)
mattk->aatyp, FALSE);
}
- if (mhitm_knockback(&gy.youmonst, mon, mattk, &sum[i], weapon_used))
+ if (mhitm_knockback(u.umonst, mon, mattk, &sum[i], weapon_used))
break;
/* don't use sum[i] beyond this point;
@@ -5918,7 +5918,7 @@ passive(
monstseesu(M_SEEN_ACID);
}
if (!rn2(30))
- erode_armor(&gy.youmonst, ERODE_CORRODE);
+ erode_armor(u.umonst, ERODE_CORRODE);
}
if (mhitb && weapon) {
if (aatyp == AT_KICK) {
@@ -5947,7 +5947,7 @@ passive(
|| (protector == W_ARMH && !uarmh)
|| (protector == (W_ARMC | W_ARMG) && (!uarmc || !uarmg))) {
if (!Stone_resistance
- && !(poly_when_stoned(gy.youmonst.data)
+ && !(poly_when_stoned(u.umonst->data)
&& polymon(PM_STONE_GOLEM))) {
done_in_by(mon, STONING); /* "You turn to stone..." */
return M_ATTK_DEF_DIED;
@@ -6079,7 +6079,7 @@ passive(
healmon(mon, (tmp + rn2(2)) / 2, (tmp + 1) / 2);
/* at a certain point, the monster will reproduce! */
if (mon->mhpmax > (((int) mon->m_lev) + 1) * 8)
- (void) split_mon(mon, &gy.youmonst);
+ (void) split_mon(mon, u.umonst);
}
break;
case AD_STUN: /* specifically yellow mold */
diff --git a/src/vault.c b/src/vault.c
index 90157b7fa..ef4065805 100644
--- a/src/vault.c
+++ b/src/vault.c
@@ -466,18 +466,18 @@ invault(void)
}
if (U_AP_TYPE == M_AP_OBJECT || u.uundetected) {
if (U_AP_TYPE == M_AP_OBJECT
- && gy.youmonst.mappearance != GOLD_PIECE)
+ && u.umonst->mappearance != GOLD_PIECE)
if (!Deaf) {
SetVoice(guard, 0, 80, 0);
verbalize("Hey! Who left that %s in here?",
- mimic_obj_name(&gy.youmonst));
+ mimic_obj_name(u.umonst));
}
/* You're mimicking some object or you're hidden. */
pline("Puzzled, %s turns around and leaves.", mhe(guard));
mongone(guard);
return;
}
- if (Strangled || is_silent(gy.youmonst.data) || gm.multi < 0) {
+ if (Strangled || is_silent(u.umonst->data) || gm.multi < 0) {
/* [we ought to record whether this message has already
been given in order to vary it upon repeat visits, but
discarding the monster and its egd data renders that hard] */
@@ -1065,7 +1065,7 @@ gd_move(struct monst *grd)
}
if (um_dist(grd->mx, grd->my, 1) || egrd->gddone) {
if (!egrd->gddone && !rn2(10) && !Deaf && !u.uswallow
- && !(u.ustuck && !sticks(gy.youmonst.data))) {
+ && !(u.ustuck && !sticks(u.umonst->data))) {
SetVoice(grd, 0, 80, 0);
verbalize("Move along!");
}
diff --git a/src/weapon.c b/src/weapon.c
index 81da05613..b400ac91c 100644
--- a/src/weapon.c
+++ b/src/weapon.c
@@ -405,7 +405,7 @@ special_dmgval(
}
/* when no gloves we check for silver rings (blessed rings ignored) */
- } else if ((left_ring || right_ring) && magr == &gy.youmonst) {
+ } else if ((left_ring || right_ring) && magr == u.umonst) {
if (left_ring && uleft) {
if (objects[uleft->otyp].oc_material == SILVER
&& mon_hates_silver(mdef)) {
diff --git a/src/were.c b/src/were.c
index 59197177f..df6ebc15c 100644
--- a/src/were.c
+++ b/src/were.c
@@ -218,12 +218,12 @@ you_unwere(boolean purify)
You_feel("purified.");
set_ulycn(NON_PM); /* cure lycanthropy */
}
- if (!Unchanging && is_were(gy.youmonst.data)
+ if (!Unchanging && is_were(u.umonst->data)
&& !monster_nearby()
&& (!controllable_poly
|| !paranoid_query(ParanoidWerechange, "Remain in beast form?")))
rehumanize();
- else if (is_were(gy.youmonst.data) && !u.mtimedone)
+ else if (is_were(u.umonst->data) && !u.mtimedone)
u.mtimedone = rn1(200, 200); /* 40% of initial were change */
}
diff --git a/src/wield.c b/src/wield.c
index 21aad53c4..b6fbdc83a 100644
--- a/src/wield.c
+++ b/src/wield.c
@@ -158,7 +158,7 @@ const char *
empty_handed(void)
{
return uarmg ? "empty handed" /* gloves imply hands */
- : humanoid(gy.youmonst.data)
+ : humanoid(u.umonst->data)
/* hands but no weapon and no gloves */
? "bare handed"
/* alternate phrasing for paws or lack of hands */
@@ -360,7 +360,7 @@ dowield(void)
/* May we attempt this? */
gm.multi = 0;
- if (cantwield(gy.youmonst.data)) {
+ if (cantwield(u.umonst->data)) {
pline("Don't be ridiculous!");
return ECMD_FAIL;
}
@@ -465,7 +465,7 @@ doswapweapon(void)
/* May we attempt this? */
gm.multi = 0;
- if (cantwield(gy.youmonst.data)) {
+ if (cantwield(u.umonst->data)) {
pline("Don't be ridiculous!");
return ECMD_FAIL;
}
@@ -716,7 +716,7 @@ wield_tool(struct obj *obj,
}
return FALSE;
}
- if (cantwield(gy.youmonst.data)) {
+ if (cantwield(u.umonst->data)) {
You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
return FALSE;
}
@@ -762,7 +762,7 @@ can_twoweapon(void)
{
struct obj *otmp;
- if (!could_twoweap(gy.youmonst.data)) {
+ if (!could_twoweap(u.umonst->data)) {
if (Upolyd)
You_cant("use two weapons in your current form.");
else
diff --git a/src/wizcmds.c b/src/wizcmds.c
index b045578b8..0bee2da86 100644
--- a/src/wizcmds.c
+++ b/src/wizcmds.c
@@ -892,7 +892,7 @@ wiz_smell(void)
cc.x = u.ux;
cc.y = u.uy;
- if (!olfaction(gy.youmonst.data)) {
+ if (!olfaction(u.umonst->data)) {
You("are incapable of detecting odors in your present form.");
return ECMD_OK;
}
@@ -909,7 +909,7 @@ wiz_smell(void)
if (u.usteed) {
mptr = u.usteed->data;
} else {
- mptr = gy.youmonst.data;
+ mptr = u.umonst->data;
is_you = TRUE;
}
} else if ((mtmp = m_at(cc.x, cc.y)) != (struct monst *) 0) {
diff --git a/src/worn.c b/src/worn.c
index a481f3372..9ffcb8c24 100644
--- a/src/worn.c
+++ b/src/worn.c
@@ -459,7 +459,7 @@ check_wornmask_slots(void)
why = "uswapwep is not a melee weapon";
else if (bimanual(uswapwep))
why = "uswapwep is two-handed";
- else if (!could_twoweap(gy.youmonst.data))
+ else if (!could_twoweap(u.umonst->data))
why = "without two weapon attacks";
if (why)
@@ -1005,7 +1005,7 @@ m_dowear_type(
struct obj *
which_armor(struct monst *mon, long flag)
{
- if (mon == &gy.youmonst) {
+ if (mon == u.umonst) {
switch (flag) {
case W_ARM:
return uarm;
diff --git a/src/write.c b/src/write.c
index d7a1eddb4..dc7ccbd36 100644
--- a/src/write.c
+++ b/src/write.c
@@ -84,7 +84,7 @@ dowrite(struct obj *pen)
const char *typeword;
int spell_knowledge;
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You("need hands to be able to write!");
return ECMD_OK;
} else if (Glib) {
diff --git a/src/zap.c b/src/zap.c
index bdaa54cec..163ee6c38 100644
--- a/src/zap.c
+++ b/src/zap.c
@@ -590,7 +590,7 @@ release_hold(void)
}
/* gives "you get regurgitated" or "you get expelled from " */
expels(mtmp, mtmp->data, TRUE);
- } else if (sticks(gy.youmonst.data)) {
+ } else if (sticks(u.umonst->data)) {
/* order matters if 'holding' status condition is enabled;
set_ustuck() will set flag for botl update, You() pline will
trigger a status update with "UHold" removed */
@@ -694,7 +694,7 @@ get_mon_location(
coordxy *xp, coordxy *yp,
int locflags) /* non-zero means get location even if monster is buried */
{
- if (mon == &gy.youmonst || (u.usteed && mon == u.usteed)) {
+ if (mon == u.umonst || (u.usteed && mon == u.usteed)) {
*xp = u.ux;
*yp = u.uy;
return TRUE;
@@ -1159,7 +1159,7 @@ unturn_dead(struct monst *mon)
struct monst *mtmp2;
char owner[BUFSZ], corpse[BUFSZ];
unsigned save_norevive;
- boolean youseeit, different_type, is_u = (mon == &gy.youmonst);
+ boolean youseeit, different_type, is_u = (mon == u.umonst);
int corpsenm, res = 0;
youseeit = is_u ? TRUE : canseemon(mon);
@@ -1224,9 +1224,9 @@ unturn_dead(struct monst *mon)
void
unturn_you(void)
{
- (void) unturn_dead(&gy.youmonst); /* hit carried corpses and eggs */
+ (void) unturn_dead(u.umonst); /* hit carried corpses and eggs */
- if (is_undead(gy.youmonst.data)) {
+ if (is_undead(u.umonst->data)) {
You_feel("frightened and %sstunned.", Stunned ? "even more " : "");
make_stunned((HStun & TIMEOUT) + (long) rnd(30), FALSE);
} else {
@@ -2102,7 +2102,7 @@ stone_to_flesh_obj(struct obj *obj) /* nonnull */
non-omnivorous form, regardless of whether it's herbivorous,
non-eating, or something stranger) */
if (Role_if(PM_MONK) || !u.uconduct.unvegetarian
- || !carnivorous(gy.youmonst.data))
+ || !carnivorous(u.umonst->data))
Norep("You smell the odor of meat.");
else
Norep("You smell a delicious smell.");
@@ -2206,14 +2206,14 @@ bhito(struct obj *obj, struct obj *otmp)
if (obj_shudders(obj)) {
boolean cover = ((obj == svl.level.objects[u.ux][u.uy])
&& u.uundetected
- && hides_under(gy.youmonst.data));
+ && hides_under(u.umonst->data));
if (cansee(obj->ox, obj->oy))
learn_it = TRUE;
do_osshock(obj);
/* eek - your cover might have been blown */
if (cover)
- (void) hideunder(&gy.youmonst);
+ (void) hideunder(u.umonst);
break;
}
obj = poly_obj(obj, STRANGE_OBJECT);
@@ -2440,7 +2440,7 @@ bhitpile(
/* if hiding underneath an object and zapping up or down, the top item
is either the only thing hit (up) or is skipped (down) */
- hidingunder = (zz != 0 && u.uundetected && hides_under(gy.youmonst.data));
+ hidingunder = (zz != 0 && u.uundetected && hides_under(u.umonst->data));
first = TRUE;
if (obj->otyp == SPE_FORCE_BOLT || obj->otyp == WAN_STRIKING) {
@@ -2629,7 +2629,7 @@ dozap(void)
struct obj *obj;
int damage, need_dir;
- if (nohands(gy.youmonst.data)) {
+ if (nohands(u.umonst->data)) {
You("aren't able to zap anything in your current form.");
return ECMD_OK;
}
@@ -2741,7 +2741,7 @@ zapyourself(struct obj *obj, boolean ordinary)
monstseesu(M_SEEN_ELEC);
ugolemeffects(AD_ELEC, orig_dmg);
}
- (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dmg);
+ (void) destroy_items(u.umonst, AD_ELEC, orig_dmg);
(void) flashburn((long) rnd(100), TRUE);
break;
@@ -2764,8 +2764,8 @@ zapyourself(struct obj *obj, boolean ordinary)
monstunseesu(M_SEEN_FIRE);
}
burn_away_slime();
- (void) burnarmor(&gy.youmonst);
- (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dmg);
+ (void) burnarmor(u.umonst);
+ (void) destroy_items(u.umonst, AD_FIRE, orig_dmg);
ignite_items(gi.invent);
break;
@@ -2784,7 +2784,7 @@ zapyourself(struct obj *obj, boolean ordinary)
damage = orig_dmg;
monstunseesu(M_SEEN_COLD);
}
- (void) destroy_items(&gy.youmonst, AD_COLD, orig_dmg);
+ (void) destroy_items(u.umonst, AD_COLD, orig_dmg);
break;
case WAN_MAGIC_MISSILE:
@@ -2811,7 +2811,7 @@ zapyourself(struct obj *obj, boolean ordinary)
case WAN_CANCELLATION:
case SPE_CANCELLATION:
- (void) cancel_monst(&gy.youmonst, obj, TRUE, TRUE, TRUE);
+ (void) cancel_monst(u.umonst, obj, TRUE, TRUE, TRUE);
break;
case SPE_DRAIN_LIFE:
@@ -2884,7 +2884,7 @@ zapyourself(struct obj *obj, boolean ordinary)
case WAN_DEATH:
case SPE_FINGER_OF_DEATH:
- if (nonliving(gy.youmonst.data) || is_demon(gy.youmonst.data)) {
+ if (nonliving(u.umonst->data) || is_demon(u.umonst->data)) {
pline((obj->otyp == WAN_DEATH)
? "The wand shoots an apparently harmless beam at you."
: "You seem no deader than before.");
@@ -2939,16 +2939,16 @@ zapyourself(struct obj *obj, boolean ordinary)
unpunish();
}
/* invent is hit iff hero doesn't escape from a trap */
- if (!u.utrap || !openholdingtrap(&gy.youmonst, &learn_it)) {
+ if (!u.utrap || !openholdingtrap(u.umonst, &learn_it)) {
boxlock_invent(obj);
/* trigger previously escaped trapdoor */
- (void) openfallingtrap(&gy.youmonst, TRUE, &learn_it);
+ (void) openfallingtrap(u.umonst, TRUE, &learn_it);
}
break;
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
/* similar logic to opening; invent is hit iff no trap triggered */
- if (u.utrap || !closeholdingtrap(&gy.youmonst, &learn_it)) {
+ if (u.utrap || !closeholdingtrap(u.umonst, &learn_it)) {
boxlock_invent(obj);
}
break;
@@ -3032,7 +3032,7 @@ lightdamage(
const char *how;
int dmg = amt;
- if (dmg && gy.youmonst.data == &mons[PM_GREMLIN]) {
+ if (dmg && u.umonst->data == &mons[PM_GREMLIN]) {
/* reduce high values (from destruction of wand with many charges) */
dmg = rnd(dmg);
if (dmg > 10)
@@ -3059,7 +3059,7 @@ lightdamage(
boolean
flashburn(long duration, boolean via_lightning)
{
- if (!resists_blnd(&gy.youmonst)) {
+ if (!resists_blnd(u.umonst)) {
You(are_blinded_by_the_flash);
make_blinded(duration, FALSE);
if (!Blind)
@@ -3072,7 +3072,7 @@ flashburn(long duration, boolean via_lightning)
if hero is both lightning resistant and blindness resistant, or
worse, have a single sparkle where the player confuses blindness
resistance for lightning resistance */
- if (!via_lightning && resists_blnd_by_arti(&gy.youmonst)) {
+ if (!via_lightning && resists_blnd_by_arti(u.umonst)) {
shieldeff(u.ux, u.uy);
return TRUE;
}
@@ -3153,7 +3153,7 @@ cancel_monst(struct monst *mdef, struct obj *obj, boolean youattack,
static const char
writing_vanishes[] = "Some writing vanishes from %s head!",
your[] = "your"; /* should be extern */
- boolean youdefend = (mdef == &gy.youmonst);
+ boolean youdefend = (mdef == u.umonst);
if (youdefend ? (!youattack && Antimagic)
: resist(mdef, obj->oclass, 0, NOTELL))
@@ -3281,10 +3281,10 @@ zap_updown(struct obj *obj) /* wand or spell, nonnull */
}
/* down will release you from bear trap or web */
if (u.dz > 0 && u.utrap) {
- (void) openholdingtrap(&gy.youmonst, &disclose);
+ (void) openholdingtrap(u.umonst, &disclose);
/* down will trigger trapdoor, hole, or [spiked-] pit */
} else if (u.dz > 0 && !u.utrap) {
- (void) openfallingtrap(&gy.youmonst, FALSE, &disclose);
+ (void) openfallingtrap(u.umonst, FALSE, &disclose);
}
break;
case WAN_STRIKING:
@@ -3319,7 +3319,7 @@ zap_updown(struct obj *obj) /* wand or spell, nonnull */
}
newsym(x, y);
} else if (u.dz > 0 && ttmp) {
- if (!striking && closeholdingtrap(&gy.youmonst, &disclose)) {
+ if (!striking && closeholdingtrap(u.umonst, &disclose)) {
; /* now stuck in web or bear trap */
} else if (striking && ttmp->ttyp == TRAPDOOR) {
/* striking transforms trapdoor into hole */
@@ -3394,14 +3394,14 @@ zap_updown(struct obj *obj) /* wand or spell, nonnull */
/* game flavor: if you're hiding under "something"
* a zap upward should hit that "something".
*/
- if (u.uundetected && hides_under(gy.youmonst.data)) {
+ if (u.uundetected && hides_under(u.umonst->data)) {
int hitit = 0;
otmp = svl.level.objects[u.ux][u.uy];
if (otmp)
hitit = bhito(otmp, obj);
if (hitit) {
- (void) hideunder(&gy.youmonst);
+ (void) hideunder(u.umonst);
disclose = TRUE;
}
}
@@ -3558,7 +3558,7 @@ hit(
struct monst *mtmp, /* target; for missile, might be hero */
const char *force) /* usually either "." or "!" via exclam() */
{
- boolean verbosely = (mtmp == &gy.youmonst
+ boolean verbosely = (mtmp == u.umonst
|| (flags.verbose
&& (cansee(gb.bhitpos.x, gb.bhitpos.y)
|| canspotmon(mtmp) || engulfing_u(mtmp))));
@@ -3982,7 +3982,7 @@ bhit(
they will be aiming at the monster */
xyglyph = glyph_at(x, y);
if (mtmp && (((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON)
- && (shade_miss(&gy.youmonst, mtmp, obj, TRUE, TRUE)
+ && (shade_miss(u.umonst, mtmp, obj, TRUE, TRUE)
|| (M_AP_TYPE(mtmp) == M_AP_OBJECT
&& !glyph_is_monster(xyglyph)
&& !glyph_is_warning(xyglyph)
@@ -4201,7 +4201,7 @@ boomhit(struct obj *obj, int dx, int dy)
}
if (u_at(gb.bhitpos.x, gb.bhitpos.y)) { /* ct == 9 */
if (Fumbling || rn2(20) >= ACURR(A_DEX)) {
- int dam = dmgval(obj, &gy.youmonst);
+ int dam = dmgval(obj, u.umonst);
/* we hit ourselves */
(void) thitu(10 + obj->spe, Maybe_Half_Phys(dam), &obj,
@@ -4211,7 +4211,7 @@ boomhit(struct obj *obj, int dx, int dy)
} else { /* we catch it */
tmp_at(DISP_END, 0);
You("skillfully catch the boomerang.");
- return &gy.youmonst;
+ return u.umonst;
}
}
tmp_at(gb.bhitpos.x, gb.bhitpos.y);
@@ -4430,9 +4430,9 @@ zhitu(
monstunseesu(M_SEEN_FIRE);
}
burn_away_slime();
- if (burnarmor(&gy.youmonst)) { /* "body hit" */
+ if (burnarmor(u.umonst)) { /* "body hit" */
if (!rn2(3))
- (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dam);
+ (void) destroy_items(u.umonst, AD_FIRE, orig_dam);
if (!rn2(3))
ignite_items(gi.invent);
}
@@ -4449,7 +4449,7 @@ zhitu(
monstunseesu(M_SEEN_COLD);
}
if (!rn2(3))
- (void) destroy_items(&gy.youmonst, AD_COLD, orig_dam);
+ (void) destroy_items(u.umonst, AD_COLD, orig_dam);
break;
case ZT_SLEEP:
if (Sleep_resistance) {
@@ -4490,7 +4490,7 @@ zhitu(
(void) disintegrate_arm(uarmc);
if (uarmu)
(void) disintegrate_arm(uarmu);
- } else if (nonliving(gy.youmonst.data) || is_demon(gy.youmonst.data)) {
+ } else if (nonliving(u.umonst->data) || is_demon(u.umonst->data)) {
shieldeff(sx, sy);
You("seem unaffected.");
break;
@@ -4520,7 +4520,7 @@ zhitu(
monstunseesu(M_SEEN_ELEC);
}
if (!rn2(3))
- (void) destroy_items(&gy.youmonst, AD_ELEC, orig_dam);
+ (void) destroy_items(u.umonst, AD_ELEC, orig_dam);
break;
case ZT_POISON_GAS:
poisoned("blast", A_DEX, "poisoned blast", 15, FALSE);
@@ -4542,7 +4542,7 @@ zhitu(
if (u.twoweap && !rn2(3))
acid_damage(uswapwep);
if (!rn2(6))
- erode_armor(&gy.youmonst, ERODE_CORRODE);
+ erode_armor(u.umonst, ERODE_CORRODE);
break;
}
@@ -4891,7 +4891,7 @@ dobuzz(
pline("%s disintegrates.", Monnam(mon));
pline("%s body reintegrates before your %s!",
s_suffix(Monnam(mon)),
- (eyecount(gy.youmonst.data) == 1)
+ (eyecount(u.umonst->data) == 1)
? body_part(EYE)
: makeplural(body_part(EYE)));
pline("%s resurrects!", Monnam(mon));
@@ -5803,7 +5803,7 @@ maybe_destroy_item(
long i, cnt, quan;
int dmg, xresist, skip, dindx;
const char *mult;
- boolean u_carry = (carrier == &gy.youmonst);
+ boolean u_carry = (carrier == u.umonst);
boolean vis = !u_carry && canseemon(carrier);
boolean chargeit = FALSE;
@@ -5912,8 +5912,8 @@ maybe_destroy_item(
}
if (u_carry) { /* effects that happen only to the player */
if (osym == POTION_CLASS && dmgtyp != AD_COLD
- && (!breathless(gy.youmonst.data)
- || haseyes(gy.youmonst.data))) {
+ && (!breathless(u.umonst->data)
+ || haseyes(u.umonst->data))) {
potionbreathe(obj);
}
if (obj->owornmask) { /* m_useup handles these for monster */
@@ -5977,7 +5977,7 @@ destroy_items(
boolean deferred;
} items_to_destroy[MAX_ITEMS_DESTROYED];
int elig_stacks = 0; /* number of destroyable objects found so far */
- boolean u_carry = (mon == &gy.youmonst);
+ boolean u_carry = (mon == u.umonst);
/* this is a struct obj** because we might destroy the first item in it */
struct obj **objchn = u_carry ? &gi.invent : &mon->minvent;
int dmg_out = 0; /* damage caused by items getting destroyed */