From 8c1a4d9a97067c1e6469aeac779018db8c849d5f Mon Sep 17 00:00:00 2001 From: Bart House Date: Mon, 24 Dec 2018 21:04:15 -0800 Subject: [PATCH] invent, youmonst, hackdir moved to g. --- include/attrib.h | 2 +- include/config.h | 2 +- include/decl.h | 9 +- include/display.h | 12 +-- include/ntconf.h | 1 - include/youprop.h | 10 +-- src/allmain.c | 22 ++--- src/apply.c | 46 +++++----- src/artifact.c | 44 +++++----- src/attrib.c | 6 +- src/ball.c | 4 +- src/bones.c | 2 +- src/botl.c | 8 +- src/cmd.c | 78 ++++++++--------- src/dbridge.c | 6 +- src/decl.c | 10 +-- src/detect.c | 16 ++-- src/dig.c | 26 +++--- src/do.c | 40 ++++----- src/do_name.c | 4 +- src/do_wear.c | 58 ++++++------- src/dog.c | 6 +- src/dogmove.c | 12 +-- src/dokick.c | 20 ++--- src/dothrow.c | 50 +++++------ src/eat.c | 102 +++++++++++----------- src/end.c | 20 ++--- src/engrave.c | 8 +- src/exper.c | 6 +- src/explode.c | 12 +-- src/files.c | 4 +- src/fountain.c | 6 +- src/hack.c | 104 +++++++++++----------- src/invent.c | 154 ++++++++++++++++----------------- src/light.c | 8 +- src/lock.c | 22 ++--- src/mcastu.c | 10 +-- src/mhitm.c | 6 +- src/mhitu.c | 172 ++++++++++++++++++------------------- src/minion.c | 6 +- src/mkobj.c | 6 +- src/mon.c | 16 ++-- src/mondata.c | 30 +++---- src/monmove.c | 22 ++--- src/mthrowu.c | 26 +++--- src/muse.c | 10 +-- src/music.c | 14 +-- src/pager.c | 10 +-- src/pickup.c | 62 +++++++------- src/polyself.c | 200 +++++++++++++++++++++---------------------- src/potion.c | 42 ++++----- src/pray.c | 34 ++++---- src/priest.c | 14 +-- src/quest.c | 2 +- src/questpgr.c | 2 +- src/read.c | 34 ++++---- src/region.c | 4 +- src/restore.c | 6 +- src/rumors.c | 2 +- src/save.c | 6 +- src/shk.c | 40 ++++----- src/sit.c | 24 +++--- src/sounds.c | 16 ++-- src/spell.c | 8 +- src/steal.c | 22 ++--- src/steed.c | 14 +-- src/teleport.c | 26 +++--- src/timeout.c | 22 ++--- src/trap.c | 124 +++++++++++++-------------- src/uhitm.c | 70 +++++++-------- src/vault.c | 24 +++--- src/weapon.c | 2 +- src/were.c | 4 +- src/wield.c | 8 +- src/worn.c | 4 +- src/write.c | 6 +- src/zap.c | 78 ++++++++--------- sys/winnt/windmain.c | 14 +-- win/win32/mhmain.c | 2 +- 79 files changed, 1093 insertions(+), 1091 deletions(-) diff --git a/include/attrib.h b/include/attrib.h index fe97a9fb2..b56bb08fc 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -41,7 +41,7 @@ struct attribs { }; #define ATTRMAX(x) \ - ((x == A_STR && Upolyd && strongmonst(youmonst.data)) \ + ((x == A_STR && Upolyd && strongmonst(g.youmonst.data)) \ ? STR18(100) \ : urace.attrmax[x]) #define ATTRMIN(x) (urace.attrmin[x]) diff --git a/include/config.h b/include/config.h index ec4f5b7b6..43861f058 100644 --- a/include/config.h +++ b/include/config.h @@ -80,7 +80,7 @@ #ifdef __BEOS__ #define BEOS_GRAPHICS /* (optional) */ #define DEFAULT_WINDOW_SYS "BeOS" /* "tty" */ -#ifndef HACKDIR /* override the default hackdir below */ +#ifndef HACKDIR /* override the default g.hackdir below */ #define HACKDIR "/boot/apps/NetHack" #endif #endif diff --git a/include/decl.h b/include/decl.h index 147f2bc6c..998c1e49a 100644 --- a/include/decl.h +++ b/include/decl.h @@ -169,7 +169,7 @@ E const struct class_sym def_monsyms[MAXMCLASSES]; /* default class symbols */ E uchar monsyms[MAXMCLASSES]; /* current class symbols */ #include "obj.h" -E NEARDATA struct obj *invent, *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf, +E NEARDATA struct obj *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf, *uarmu, /* under-wear, so to speak */ *uskin, *uamul, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver; @@ -191,7 +191,6 @@ E NEARDATA struct u_realtime urealtime; #endif E NEARDATA struct monst zeromonst; /* for init of new or temp monsters */ -E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */ struct mvitals { uchar born; @@ -694,6 +693,12 @@ struct instance_globals { long wailmsg; struct obj *migrating_objs; /* objects moving to another dungeon level */ struct obj *billobjs; /* objects not yet paid for */ +#if defined(MICRO) || defined(WIN32) + char hackdir[PATHLEN]; /* where rumors, help, record are */ +#endif /* MICRO || WIN32 */ + struct monst youmonst; + struct obj *invent; + /* dig.c */ diff --git a/include/display.h b/include/display.h index dcf0bba7e..907d90216 100644 --- a/include/display.h +++ b/include/display.h @@ -202,14 +202,14 @@ #define display_self() \ show_glyph(u.ux, u.uy, \ - maybe_display_usteed((youmonst.m_ap_type == M_AP_NOTHING) \ + maybe_display_usteed((g.youmonst.m_ap_type == M_AP_NOTHING) \ ? hero_glyph \ - : (youmonst.m_ap_type == M_AP_FURNITURE) \ - ? cmap_to_glyph(youmonst.mappearance) \ - : (youmonst.m_ap_type == M_AP_OBJECT) \ - ? objnum_to_glyph(youmonst.mappearance) \ + : (g.youmonst.m_ap_type == M_AP_FURNITURE) \ + ? cmap_to_glyph(g.youmonst.mappearance) \ + : (g.youmonst.m_ap_type == M_AP_OBJECT) \ + ? objnum_to_glyph(g.youmonst.mappearance) \ /* else M_AP_MONSTER */ \ - : monnum_to_glyph(youmonst.mappearance))) + : monnum_to_glyph(g.youmonst.mappearance))) /* * A glyph is an abstraction that represents a _unique_ monster, object, diff --git a/include/ntconf.h b/include/ntconf.h index 6859d52b0..7c86363b2 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -207,7 +207,6 @@ extern void FDECL(interject, (int)); /* this was part of the MICRO stuff in the past */ extern const char *alllevels, *allbones; -extern char hackdir[]; #define ABORT C('a') #define getuid() 1 #define getlogin() ((char *) 0) diff --git a/include/youprop.h b/include/youprop.h index 2afb2e0fd..625732a37 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -87,13 +87,13 @@ /* ...means blind because of a cover */ #define Blind \ ((u.uroleplay.blind || Blinded || Blindfolded \ - || !haseyes(youmonst.data)) \ + || !haseyes(g.youmonst.data)) \ && !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD)) /* ...the Eyes operate even when you really are blind or don't have any eyes */ #define Blindfolded_only \ (Blindfolded && ublindf->oartifact != ART_EYES_OF_THE_OVERWORLD \ - && !u.uroleplay.blind && !Blinded && haseyes(youmonst.data)) + && !u.uroleplay.blind && !Blinded && haseyes(g.youmonst.data)) /* ...blind because of a blindfold, and *only* that */ #define Sick u.uprops[SICK].intrinsic @@ -248,11 +248,11 @@ #define HMagical_breathing u.uprops[MAGICAL_BREATHING].intrinsic #define EMagical_breathing u.uprops[MAGICAL_BREATHING].extrinsic #define Amphibious \ - (HMagical_breathing || EMagical_breathing || amphibious(youmonst.data)) + (HMagical_breathing || EMagical_breathing || amphibious(g.youmonst.data)) /* Get wet, may go under surface */ #define Breathless \ - (HMagical_breathing || EMagical_breathing || breathless(youmonst.data)) + (HMagical_breathing || EMagical_breathing || breathless(g.youmonst.data)) #define Underwater (u.uinwater) /* Note that Underwater and u.uinwater are both used in code. @@ -372,6 +372,6 @@ redundant but allows the function calls to be skipped most of the time */ #define Unaware (g.multi < 0 && (unconscious() || is_fainted())) -#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(youmonst.data)) +#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(g.youmonst.data)) #endif /* YOUPROP_H */ diff --git a/src/allmain.c b/src/allmain.c index f77ddffc3..d6edfdbd9 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -69,7 +69,7 @@ boolean resuming; initrack(); u.uz0.dlevel = u.uz.dlevel; - youmonst.movement = NORMAL_SPEED; /* give the hero some movement points */ + g.youmonst.movement = NORMAL_SPEED; /* give the hero some movement points */ context.move = 0; program_state.in_moveloop = 1; @@ -85,7 +85,7 @@ boolean resuming; if (context.move) { /* actual time passed */ - youmonst.movement -= NORMAL_SPEED; + g.youmonst.movement -= NORMAL_SPEED; do { /* hero can't move this turn loop */ wtcap = encumber_msg(); @@ -93,12 +93,12 @@ boolean resuming; context.mon_moving = TRUE; do { monscanmove = movemon(); - if (youmonst.movement >= NORMAL_SPEED) + if (g.youmonst.movement >= NORMAL_SPEED) break; /* it's now your turn */ } while (monscanmove); context.mon_moving = FALSE; - if (!monscanmove && youmonst.movement < NORMAL_SPEED) { + if (!monscanmove && g.youmonst.movement < NORMAL_SPEED) { /* both you and the monsters are out of steam this round */ /* set up for a new turn */ @@ -122,7 +122,7 @@ boolean resuming; /* your speed doesn't augment steed's speed */ moveamt = mcalcmove(u.usteed); } else { - moveamt = youmonst.data->mmove; + moveamt = g.youmonst.data->mmove; if (Very_fast) { /* speed boots or potion */ /* gain a free action on 2/3 of turns */ @@ -154,9 +154,9 @@ boolean resuming; break; } - youmonst.movement += moveamt; - if (youmonst.movement < 0) - youmonst.movement = 0; + g.youmonst.movement += moveamt; + if (g.youmonst.movement < 0) + g.youmonst.movement = 0; settrack(); g.monstermoves++; @@ -189,7 +189,7 @@ boolean resuming; wtcap = UNENCUMBERED; } else if (!Upolyd ? (u.uhp < u.uhpmax) : (u.mh < u.mhmax - || youmonst.data->mlet == S_EEL)) { + || g.youmonst.data->mlet == S_EEL)) { /* maybe heal */ regen_hp(wtcap); } @@ -306,7 +306,7 @@ boolean resuming; } } } - } while (youmonst.movement + } while (g.youmonst.movement < NORMAL_SPEED); /* hero can't move loop */ /******************************************/ @@ -449,7 +449,7 @@ int wtcap; if (Upolyd) { if (u.mh < 1) { /* shouldn't happen... */ rehumanize(); - } else if (youmonst.data->mlet == S_EEL + } else if (g.youmonst.data->mlet == S_EEL && !is_pool(u.ux, u.uy) && !Is_waterlevel(&u.uz)) { /* eel out of water loses hp, similar to monster eels; as hp gets lower, rate of further loss slows down */ diff --git a/src/apply.c b/src/apply.c index e0f0d3977..4a1f50ebd 100644 --- a/src/apply.c +++ b/src/apply.c @@ -304,7 +304,7 @@ register struct obj *obj; boolean interference = (u.uswallow && is_whirly(u.ustuck->data) && !rn2(Role_if(PM_HEALER) ? 10 : 3)); - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You("have no hands!"); /* not `body_part(HAND)' */ return 0; } else if (Deaf) { @@ -318,9 +318,9 @@ register struct obj *obj; return 0; res = (g.moves == context.stethoscope_move) - && (youmonst.movement == context.stethoscope_movement); + && (g.youmonst.movement == context.stethoscope_movement); context.stethoscope_move = g.moves; - context.stethoscope_movement = youmonst.movement; + context.stethoscope_movement = g.youmonst.movement; g.bhitpos.x = u.ux, g.bhitpos.y = u.uy; /* tentative, reset below */ g.notonhead = u.uswallow; @@ -433,7 +433,7 @@ STATIC_OVL void use_whistle(obj) struct obj *obj; { - if (!can_blow(&youmonst)) { + if (!can_blow(&g.youmonst)) { You("are incapable of using the whistle."); } else if (Underwater) { You("blow bubbles through %s.", yname(obj)); @@ -455,7 +455,7 @@ struct obj *obj; { register struct monst *mtmp, *nextmon; - if (!can_blow(&youmonst)) { + if (!can_blow(&g.youmonst)) { You("are incapable of using the whistle."); } else if (obj->cursed && !rn2(2)) { You("produce a %shigh-pitched humming noise.", @@ -515,7 +515,7 @@ number_leashed() int i = 0; struct obj *obj; - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if (obj->otyp == LEASH && obj->leashmon != 0) i++; return i; @@ -548,7 +548,7 @@ boolean feedback; else Your("leash falls slack."); } - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->otyp == LEASH && otmp->leashmon == (int) mtmp->m_id) otmp->leashmon = 0; mtmp->mleashed = 0; @@ -561,7 +561,7 @@ unleash_all() register struct obj *otmp; register struct monst *mtmp; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->otyp == LEASH) otmp->leashmon = 0; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) @@ -684,7 +684,7 @@ struct monst *mtmp; { struct obj *otmp; - otmp = invent; + otmp = g.invent; while (otmp) { if (otmp->otyp == LEASH && otmp->leashmon == (int) mtmp->m_id) return otmp; @@ -706,7 +706,7 @@ next_to_u() if (distu(mtmp->mx, mtmp->my) > 2) mnexto(mtmp); if (distu(mtmp->mx, mtmp->my) > 2) { - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->otyp == LEASH && otmp->leashmon == (int) mtmp->m_id) { if (otmp->cursed) @@ -732,7 +732,7 @@ register xchar x, y; register struct obj *otmp; register struct monst *mtmp; - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (otmp->otyp != LEASH || otmp->leashmon == 0) continue; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { @@ -845,7 +845,7 @@ struct obj *obj; } g.nomovemsg = 0; /* default, "you can move again" */ } - } else if (youmonst.data->mlet == S_VAMPIRE) + } else if (g.youmonst.data->mlet == S_VAMPIRE) You("don't have a reflection."); else if (u.umonnum == PM_UMBER_HULK) { pline("Huh? That doesn't look like you!"); @@ -1525,7 +1525,7 @@ int x, 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(youmonst.data)) + if (sobj_at(BOULDER, x, y) && !throws_rocks(g.youmonst.data)) return FALSE; return TRUE; } @@ -1645,7 +1645,7 @@ int magic; /* 0=Physical, otherwise skill level */ return spelleffects(sp_no, FALSE); } - if (!magic && (nolimbs(youmonst.data) || slithy(youmonst.data))) { + if (!magic && (nolimbs(g.youmonst.data) || slithy(g.youmonst.data))) { /* normally (nolimbs || slithy) implies !Jumping, but that isn't necessarily the case for knights */ You_cant("jump; you have no legs!"); @@ -1827,7 +1827,7 @@ struct obj *obj; && !uarmg) { char kbuf[BUFSZ]; - if (poly_when_stoned(youmonst.data)) + if (poly_when_stoned(g.youmonst.data)) You("tin %s without wearing gloves.", an(mons[corpse->corpsenm].mname)); else { @@ -2290,7 +2290,7 @@ struct obj *obj; if (otmp != &zeroobj) { You("cover %s with a thick layer of grease.", yname(otmp)); otmp->greased = 1; - if (obj->cursed && !nohands(youmonst.data)) { + if (obj->cursed && !nohands(g.youmonst.data)) { incr_itimeout(&Glib, rnd(15)); pline("Some of the grease gets all over your %s.", makeplural(body_part(HAND))); @@ -2455,7 +2455,7 @@ struct obj *otmp; int levtyp = levl[u.ux][u.uy].typ; const char *occutext = "setting the trap"; - if (nohands(youmonst.data)) + if (nohands(g.youmonst.data)) what = "without hands"; else if (Stunned) what = "while stunned"; @@ -2725,7 +2725,7 @@ 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, youmonst.data)) { + if (!mtmp || enexto(&cc, rx, ry, g.youmonst.data)) { You("yank yourself out of the pit!"); teleds(cc.x, cc.y, TRUE); reset_utrap(TRUE); @@ -2788,7 +2788,7 @@ struct obj *obj; int hitu, hitvalu; hitvalu = 8 + otmp->spe; - hitu = thitu(hitvalu, dmgval(otmp, &youmonst), + hitu = thitu(hitvalu, dmgval(otmp, &g.youmonst), &otmp, (char *)0); if (hitu) { pline_The("%s hits you as you try to snatch it!", @@ -2804,7 +2804,7 @@ struct obj *obj; if (otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm]) && !uarmg && !Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { char kbuf[BUFSZ]; @@ -3071,7 +3071,7 @@ struct obj *obj; pline("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, &youmonst, AT_WEAP, obj)) { + if (can_blnd((struct monst *) 0, &g.youmonst, AT_WEAP, obj)) { int blindinc = rnd(25); u.ucreamed += blindinc; make_blinded(Blinded + (long) blindinc, FALSE); @@ -3262,7 +3262,7 @@ struct obj *obj; "?", obj, yname, ysimple_name, "the wand"))) return 0; - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You_cant("break %s without hands!", yname(obj)); return 0; } else if (ACURR(A_STR) < (is_fragile ? 5 : 10)) { @@ -3492,7 +3492,7 @@ char class_list[]; knowoil = objects[POT_OIL].oc_name_known; knowtouchstone = objects[TOUCHSTONE].oc_name_known; addpotions = addstones = addfood = FALSE; - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { otyp = otmp->otyp; if (otyp == POT_OIL || (otmp->oclass == POTION_CLASS diff --git a/src/artifact.c b/src/artifact.c index 5550d8568..702060c65 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -488,7 +488,7 @@ long wp_mask; if (mask && wp_mask == W_ART && !on) { /* find out if some other artifact also confers this intrinsic; if so, leave the mask alone */ - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { if (obj != otmp && obj->oartifact) { art = get_artifact(obj); if (art && art->cary.adtyp == dtyp) { @@ -509,7 +509,7 @@ long wp_mask; spfx = (wp_mask != W_ART) ? oart->spfx : oart->cspfx; if (spfx && wp_mask == W_ART && !on) { /* don't change any spfx also conferred by other artifacts */ - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if (obj != otmp && obj->oartifact) { art = get_artifact(obj); if (art) @@ -646,7 +646,7 @@ struct monst *mon; if (!oart) return 1; - yours = (mon == &youmonst); + yours = (mon == &g.youmonst); /* 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); @@ -751,7 +751,7 @@ struct monst *mtmp; if (!(weap->spfx & (SPFX_DBONUS | SPFX_ATTK))) return (weap->attk.adtyp == AD_PHYS); - yours = (mtmp == &youmonst); + yours = (mtmp == &g.youmonst); ptr = mtmp->data; if (weap->spfx & SPFX_DMONS) { @@ -960,7 +960,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */ { struct permonst *old_uasmon; const char *verb, *fakename; - boolean youattack = (magr == &youmonst), youdefend = (mdef == &youmonst), + boolean youattack = (magr == &g.youmonst), youdefend = (mdef == &g.youmonst), resisted = FALSE, do_stun, do_confuse, result; int attack_indx, scare_dieroll = MB_MAX_DIEROLL / 2; @@ -1016,7 +1016,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */ /* now perform special effects */ switch (attack_indx) { case MB_INDEX_CANCEL: - old_uasmon = youmonst.data; + old_uasmon = g.youmonst.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. @@ -1026,7 +1026,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */ } else { do_stun = FALSE; if (youdefend) { - if (youmonst.data != old_uasmon) + if (g.youmonst.data != old_uasmon) *dmgptr = 0; /* rehumanized, so no more damage */ if (u.uenmax > 0) { You("lose magical energy!"); @@ -1056,7 +1056,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */ nomul(-3); g.multi_reason = "being scared stiff"; g.nomovemsg = ""; - if (magr && magr == u.ustuck && sticks(youmonst.data)) { + if (magr && magr == u.ustuck && sticks(g.youmonst.data)) { u.ustuck = (struct monst *) 0; You("release %s!", mon_nam(magr)); } @@ -1145,8 +1145,8 @@ struct obj *otmp; int *dmgptr; int dieroll; /* needed for Magicbane and vorpal blades */ { - boolean youattack = (magr == &youmonst); - boolean youdefend = (mdef == &youmonst); + boolean youattack = (magr == &g.youmonst); + boolean youdefend = (mdef == &g.youmonst); boolean vis = (!youattack && magr && cansee(magr->mx, magr->my)) || (!youdefend && cansee(mdef->mx, mdef->my)) || (youattack && u.uswallow && mdef == u.ustuck && !Blind); @@ -1265,7 +1265,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */ otmp->dknown = TRUE; return TRUE; } else { - if (bigmonst(youmonst.data)) { + if (bigmonst(g.youmonst.data)) { pline("%s cuts deeply into you!", magr ? Monnam(magr) : wepdesc); *dmgptr *= 2; @@ -1312,13 +1312,13 @@ int dieroll; /* needed for Magicbane and vorpal blades */ otmp->dknown = TRUE; return TRUE; } else { - if (!has_head(youmonst.data)) { + if (!has_head(g.youmonst.data)) { pline("Somehow, %s misses you wildly.", magr ? mon_nam(magr) : wepdesc); *dmgptr = 0; return TRUE; } - if (noncorporeal(youmonst.data) || amorphous(youmonst.data)) { + if (noncorporeal(g.youmonst.data) || amorphous(g.youmonst.data)) { pline("%s slices through your %s.", wepdesc, body_part(NECK)); return TRUE; @@ -1805,7 +1805,7 @@ long *abil; spfx = abil_to_spfx(abil); wornbits = (wornmask & *abil); - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { if (obj->oartifact && (abil != &EWarn_of_mon || context.warntype.obj)) { const struct artifact *art = get_artifact(obj); @@ -1920,11 +1920,11 @@ boolean loseit; /* whether to drop it if hero can longer touch it */ { struct obj *obj = *objp; - if (touch_artifact(obj, &youmonst)) { + if (touch_artifact(obj, &g.youmonst)) { char buf[BUFSZ]; int dmg = 0, tmp; boolean ag = (objects[obj->otyp].oc_material == SILVER && Hate_silver), - bane = bane_applies(get_artifact(obj), &youmonst); + bane = bane_applies(get_artifact(obj), &g.youmonst); /* nothing else to do if hero can successfully handle this object */ if (!ag && !bane) @@ -1955,7 +1955,7 @@ boolean loseit; /* whether to drop it if hero can longer touch it */ struct obj *otmp; remove_worn_item(obj, FALSE); - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp == obj) break; if (!otmp) @@ -2076,9 +2076,9 @@ int dropflag; /* 0==don't drop, 1==drop all, 2==drop weapon */ /* loss of levitation (silver ring, or Heart of Ahriman invocation) might cause hero to lose inventory items (by dropping into lava, for instance), so inventory traversal needs to rescan the whole - invent chain each time it moves on to another object; we use bypass + g.invent chain each time it moves on to another object; we use bypass handling to keep track of which items have already been processed */ - while ((obj = nxt_unbypassed_obj(invent)) != 0) + while ((obj = nxt_unbypassed_obj(g.invent)) != 0) (void) untouchable(obj, dropit); if (had_rings != (!!uleft + !!uright) && uarmg && uarmg->cursed) @@ -2164,7 +2164,7 @@ struct monst *mon; /* if null, non-rogue is assumed */ struct obj *obj; { if (((obj && obj->oartifact == ART_MASTER_KEY_OF_THIEVERY) - && ((mon == &youmonst) ? Role_if(PM_ROGUE) + && ((mon == &g.youmonst) ? Role_if(PM_ROGUE) : (mon && mon->data == &mons[PM_ROGUE]))) ? !obj->cursed : obj->blessed) return TRUE; @@ -2180,8 +2180,8 @@ struct monst *mon; /* if null, hero assumed */ short key = artilist[ART_MASTER_KEY_OF_THIEVERY].otyp; if (!mon) - mon = &youmonst; - for (o = ((mon == &youmonst) ? invent : mon->minvent); o; + mon = &g.youmonst; + for (o = ((mon == &g.youmonst) ? g.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 e03100375..b932ffce2 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -336,7 +336,7 @@ boolean parameter; /* So I can't think up of a good name. So sue me. --KAA */ register struct obj *otmp; register long bonchance = 0; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (confers_luck(otmp)) { if (otmp->cursed) bonchance -= otmp->quan; @@ -789,7 +789,7 @@ int propidx; ignore innateness if equipment is going to claim responsibility */ && !u.uprops[propidx].extrinsic) return FROM_ROLE; - if (propidx == BLINDED && !haseyes(youmonst.data)) + if (propidx == BLINDED && !haseyes(g.youmonst.data)) return FROM_FORM; return FROM_NONE; } @@ -1031,7 +1031,7 @@ int x; #endif } else if (x == A_CHA) { if (tmp < 18 - && (youmonst.data->mlet == S_NYMPH || u.umonnum == PM_SUCCUBUS + && (g.youmonst.data->mlet == S_NYMPH || u.umonnum == PM_SUCCUBUS || u.umonnum == PM_INCUBUS)) return (schar) 18; } else if (x == A_CON) { diff --git a/src/ball.c b/src/ball.c index fc1208003..02cf0c31a 100644 --- a/src/ball.c +++ b/src/ball.c @@ -588,7 +588,7 @@ drag: if (near_capacity() > SLT_ENCUMBER && dist2(x, y, u.ux, u.uy) <= 2) { You("cannot %sdrag the heavy iron ball.", - invent ? "carry all that and also " : ""); + g.invent ? "carry all that and also " : ""); nomul(0); return FALSE; } @@ -777,7 +777,7 @@ xchar x, y; STATIC_OVL void litter() { - struct obj *otmp = invent, *nextobj; + struct obj *otmp = g.invent, *nextobj; int capacity = weight_cap(); while (otmp) { diff --git a/src/bones.c b/src/bones.c index f635033f1..5ba3ffe5a 100644 --- a/src/bones.c +++ b/src/bones.c @@ -220,7 +220,7 @@ int x, y; struct obj *otmp; u.twoweap = 0; /* ensure curse() won't cause swapwep to drop twice */ - while ((otmp = invent) != 0) { + while ((otmp = g.invent) != 0) { obj_extract_self(otmp); obj_no_longer_held(otmp); diff --git a/src/botl.c b/src/botl.c index 05074f1d0..d8e06f565 100644 --- a/src/botl.c +++ b/src/botl.c @@ -121,7 +121,7 @@ do_statusline2() /* dungeon location plus gold */ (void) describe_level(dloc); /* includes at least one trailing space */ - if ((money = money_cnt(invent)) < 0L) + if ((money = money_cnt(g.invent)) < 0L) money = 0L; /* ought to issue impossible() and then discard gold */ Sprintf(eos(dloc), "%s:%-2ld", /* strongest hero can lift ~300000 gold */ (iflags.in_dumplog || iflags.invis_goldsym) ? "$" @@ -236,7 +236,7 @@ void bot() { /* dosave() flags completion by setting u.uhp to -1 */ - if ((u.uhp != -1) && youmonst.data && iflags.status_updates) { + if ((u.uhp != -1) && g.youmonst.data && iflags.status_updates) { #ifdef STATUS_HILITES bot_via_windowport(); #else @@ -359,7 +359,7 @@ botl_score() long deepest = deepest_lev_reached(FALSE); long utotal; - utotal = money_cnt(invent) + hidden_gold(); + utotal = money_cnt(g.invent) + hidden_gold(); if ((utotal -= u.umoney0) < 0L) utotal = 0L; utotal += u.urexp + (50 * (deepest - 1)) @@ -567,7 +567,7 @@ bot_via_windowport() g.valset[BL_LEVELDESC] = TRUE; /* indicate val already set */ /* Gold */ - if ((money = money_cnt(invent)) < 0L) + if ((money = money_cnt(g.invent)) < 0L) money = 0L; /* ought to issue impossible() and then discard gold */ g.blstats[idx][BL_GOLD].a.a_long = min(money, 999999L); /* diff --git a/src/cmd.c b/src/cmd.c index 42d0c1ea6..7933a2a22 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -673,38 +673,38 @@ extcmd_via_menu() int domonability(VOID_ARGS) { - if (can_breathe(youmonst.data)) + if (can_breathe(g.youmonst.data)) return dobreathe(); - else if (attacktype(youmonst.data, AT_SPIT)) + else if (attacktype(g.youmonst.data, AT_SPIT)) return dospit(); - else if (youmonst.data->mlet == S_NYMPH) + else if (g.youmonst.data->mlet == S_NYMPH) return doremove(); - else if (attacktype(youmonst.data, AT_GAZE)) + else if (attacktype(g.youmonst.data, AT_GAZE)) return dogaze(); - else if (is_were(youmonst.data)) + else if (is_were(g.youmonst.data)) return dosummon(); - else if (webmaker(youmonst.data)) + else if (webmaker(g.youmonst.data)) return dospinweb(); - else if (is_hider(youmonst.data)) + else if (is_hider(g.youmonst.data)) return dohide(); - else if (is_mind_flayer(youmonst.data)) + else if (is_mind_flayer(g.youmonst.data)) return domindblast(); else if (u.umonnum == PM_GREMLIN) { if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) { - if (split_mon(&youmonst, (struct monst *) 0)) + if (split_mon(&g.youmonst, (struct monst *) 0)) dryup(u.ux, u.uy, TRUE); } else There("is no fountain here."); - } else if (is_unicorn(youmonst.data)) { + } else if (is_unicorn(g.youmonst.data)) { use_unicorn_horn((struct obj *) 0); return 1; - } else if (youmonst.data->msound == MS_SHRIEK) { + } else if (g.youmonst.data->msound == MS_SHRIEK) { You("shriek."); if (u.uburied) pline("Unfortunately sound does not carry well through rock."); else aggravate(); - } else if (youmonst.data->mlet == S_VAMPIRE) + } else if (g.youmonst.data->mlet == S_VAMPIRE) return dopoly(); else if (Upolyd) pline("Any special ability you may have is purely reflexive."); @@ -1279,7 +1279,7 @@ wiz_smell(VOID_ARGS) cc.x = u.ux; cc.y = u.uy; mndx = 0; /* gcc -Wall lint */ - if (!olfaction(youmonst.data)) { + if (!olfaction(g.youmonst.data)) { You("are incapable of detecting odors in your present form."); return 0; } @@ -1663,7 +1663,7 @@ int propindx; /* index of a property which can be conveyed by worn item */ /* simpler than from_what()/what_gives(); we don't attempt to handle artifacts and we deliberately ignore wielded items */ - for (o = invent; o; o = o->nobj) { + for (o = g.invent; o; o = o->nobj) { if (!(o->owornmask & mask)) continue; if ((int) objects[o->otyp].oc_oprop == propindx @@ -1774,7 +1774,7 @@ int final; (with countdown timer appended for wizard mode); we really want the player to know he's not a samurai at the moment... */ if (Upolyd) { - struct permonst *uasmon = youmonst.data; + struct permonst *uasmon = g.youmonst.data; tmpbuf[0] = '\0'; /* here we always use current gender, not saved role gender */ @@ -1995,7 +1995,7 @@ int final; same amount as shown on status line which ignores container contents */ { static const char Your_wallet[] = "Your wallet "; - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); if (!umoney) { enl_msg(Your_wallet, "is ", "was ", "empty", ""); @@ -2204,7 +2204,7 @@ int final; : surface(u.ux, u.uy)); /* catchall; shouldn't happen */ you_are(buf, from_what(WWALKING)); } - if (Upolyd && (u.uundetected || youmonst.m_ap_type != M_AP_NOTHING)) + if (Upolyd && (u.uundetected || g.youmonst.m_ap_type != M_AP_NOTHING)) youhiding(TRUE, final); /* internal troubles, mostly in the order that prayer ranks them */ @@ -2241,16 +2241,16 @@ int final; /* from_what() (currently wizard-mode only) checks !haseyes() before u.uroleplay.blind, so we should too */ Sprintf(buf, "%s blind", - !haseyes(youmonst.data) ? "innately" + !haseyes(g.youmonst.data) ? "innately" : u.uroleplay.blind ? "permanently" /* better phrasing desperately wanted... */ : Blindfolded_only ? "deliberately" : "temporarily"); if (wizard && (Blinded & TIMEOUT) != 0L - && !u.uroleplay.blind && haseyes(youmonst.data)) + && !u.uroleplay.blind && haseyes(g.youmonst.data)) Sprintf(eos(buf), " (%ld)", (Blinded & TIMEOUT)); /* !haseyes: avoid "you are innately blind innately" */ - you_are(buf, !haseyes(youmonst.data) ? "" : from_what(BLINDED)); + you_are(buf, !haseyes(g.youmonst.data) ? "" : from_what(BLINDED)); } if (Deaf) you_are("deaf", from_what(DEAF)); @@ -2295,7 +2295,7 @@ int final; you_are(buf, ""); } else if (u.ustuck) { Sprintf(buf, "%s %s", - (Upolyd && sticks(youmonst.data)) ? "holding" : "held by", + (Upolyd && sticks(g.youmonst.data)) ? "holding" : "held by", a_monnam(u.ustuck)); you_are(buf, ""); } @@ -2390,7 +2390,7 @@ int final; /* report being weaponless; distinguish whether gloves are worn */ if (!uwep) { you_are(uarmg ? "empty handed" /* gloves imply hands */ - : humanoid(youmonst.data) + : humanoid(g.youmonst.data) /* hands but no weapon and no gloves */ ? "bare handed" /* alternate phrasing for paws or lack of hands */ @@ -2517,7 +2517,7 @@ int final; you_can("recognize detrimental food", ""); /*** Vision and senses ***/ - if (!Blind && (Blinded || !haseyes(youmonst.data))) + if (!Blind && (Blinded || !haseyes(g.youmonst.data))) you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */ if (See_invisible) { if (!Blind) @@ -2701,7 +2701,7 @@ int final; if (prot) you_have(enlght_combatinc("defense", prot, final, buf), ""); } - if ((armpro = magic_negation(&youmonst)) > 0) { + if ((armpro = magic_negation(&g.youmonst)) > 0) { /* magic cancellation factor, conferred by worn armor */ static const char *const mc_types[] = { "" /*ordinary*/, "warded", "guarded", "protected", @@ -2748,12 +2748,12 @@ int final; && !(final == ENL_GAMEOVERDEAD && u.umonnum == PM_GREEN_SLIME && !Unchanging)) { /* foreign shape (except were-form which is handled below) */ - Sprintf(buf, "polymorphed into %s", an(youmonst.data->mname)); + Sprintf(buf, "polymorphed into %s", an(g.youmonst.data->mname)); if (wizard) Sprintf(eos(buf), " (%d)", u.mtimedone); you_are(buf, ""); } - if (lays_eggs(youmonst.data) && flags.female) /* Upolyd */ + if (lays_eggs(g.youmonst.data) && flags.female) /* Upolyd */ you_can("lay eggs", ""); if (u.ulycn >= LOW_PM) { /* "you are a werecreature [in beast form]" */ @@ -2943,7 +2943,7 @@ minimal_enlightenment() add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, "Current", FALSE); - Sprintf(buf, fmtstr, "race", Upolyd ? youmonst.data->mname : urace.noun); + Sprintf(buf, fmtstr, "race", Upolyd ? g.youmonst.data->mname : urace.noun); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); if (Upolyd) { Sprintf(buf, fmtstr, "role (base)", @@ -2957,7 +2957,7 @@ minimal_enlightenment() add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); } /* don't want poly_gender() here; it forces `2' for non-humanoids */ - genidx = is_neuter(youmonst.data) ? 2 : flags.female; + genidx = is_neuter(g.youmonst.data) ? 2 : flags.female; Sprintf(buf, fmtstr, "gender", genders[genidx].adj); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); if (Upolyd && (int) u.mfemale != genidx) { @@ -3026,31 +3026,31 @@ int msgflag; /* for variant message phrasing */ char *bp, buf[BUFSZ]; Strcpy(buf, "hiding"); - if (youmonst.m_ap_type != M_AP_NOTHING) { + if (g.youmonst.m_ap_type != M_AP_NOTHING) { /* mimic; hero is only able to mimic a strange object or gold or hallucinatory alternative to gold, so we skip the details for the hypothetical furniture and monster cases */ bp = eos(strcpy(buf, "mimicking")); - if (youmonst.m_ap_type == M_AP_OBJECT) { - Sprintf(bp, " %s", an(simple_typename(youmonst.mappearance))); - } else if (youmonst.m_ap_type == M_AP_FURNITURE) { + if (g.youmonst.m_ap_type == M_AP_OBJECT) { + Sprintf(bp, " %s", an(simple_typename(g.youmonst.mappearance))); + } else if (g.youmonst.m_ap_type == M_AP_FURNITURE) { Strcpy(bp, " something"); - } else if (youmonst.m_ap_type == M_AP_MONSTER) { + } else if (g.youmonst.m_ap_type == M_AP_MONSTER) { Strcpy(bp, " someone"); } else { ; /* something unexpected; leave 'buf' as-is */ } } else if (u.uundetected) { bp = eos(buf); /* points past "hiding" */ - if (youmonst.data->mlet == S_EEL) { + if (g.youmonst.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(youmonst.data)) { + } else if (hides_under(g.youmonst.data)) { struct obj *o = g.level.objects[u.ux][u.uy]; if (o) Sprintf(bp, " underneath %s", ansimpleoname(o)); - } else if (is_clinger(youmonst.data) || Flying) { + } else if (is_clinger(g.youmonst.data) || Flying) { /* Flying: 'lurker above' hides on ceiling but doesn't cling */ Sprintf(bp, " on the %s", ceiling(u.ux, u.uy)); } else { @@ -3746,7 +3746,7 @@ long *total_size; long count = 0, size = 0; struct monst *mon; - count_obj(invent, &count, &size, FALSE, TRUE); + count_obj(g.invent, &count, &size, FALSE, TRUE); count_obj(fobj, &count, &size, FALSE, TRUE); count_obj(g.level.buriedobjlist, &count, &size, FALSE, TRUE); count_obj(g.migrating_objs, &count, &size, FALSE, TRUE); @@ -3961,7 +3961,7 @@ wiz_show_stats() putstr(win, 0, stats_hdr); Sprintf(buf, " Objects, base size %ld", (long) sizeof (struct obj)); putstr(win, 0, buf); - obj_chain(win, "invent", invent, TRUE, &total_obj_count, &total_obj_size); + obj_chain(win, "invent", g.invent, TRUE, &total_obj_count, &total_obj_size); obj_chain(win, "fobj", fobj, TRUE, &total_obj_count, &total_obj_size); obj_chain(win, "buried", g.level.buriedobjlist, FALSE, &total_obj_count, &total_obj_size); @@ -5293,7 +5293,7 @@ boolean doit; } } - if (invent) + if (g.invent) add_herecmd_menuitem(win, dodrop, "Drop items"); add_herecmd_menuitem(win, donull, "Rest one turn"); diff --git a/src/dbridge.c b/src/dbridge.c index 00ae87e3b..5afff74bd 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -323,10 +323,10 @@ STATIC_OVL void u_to_e(etmp) struct entity *etmp; { - etmp->emon = &youmonst; + etmp->emon = &g.youmonst; etmp->ex = u.ux; etmp->ey = u.uy; - etmp->edata = youmonst.data; + etmp->edata = g.youmonst.data; } STATIC_OVL void @@ -342,7 +342,7 @@ struct entity *etmp; etmp->edata = (struct permonst *) 0; } -#define is_u(etmp) (etmp->emon == &youmonst) +#define is_u(etmp) (etmp->emon == &g.youmonst) #define e_canseemon(etmp) \ (is_u(etmp) ? (boolean) TRUE : canseemon(etmp->emon)) diff --git a/src/decl.c b/src/decl.c index 7e8a60d77..c418612f3 100644 --- a/src/decl.c +++ b/src/decl.c @@ -29,12 +29,9 @@ NEARDATA long yn_number = 0L; const char disclosure_options[] = "iavgco"; -#if defined(MICRO) || defined(WIN32) -char hackdir[PATHLEN]; /* where rumors, help, record are */ #ifdef MICRO char levels[PATHLEN]; /* where levels are */ -#endif -#endif /* MICRO || WIN32 */ +#endif /* MICRO */ #ifdef MFLOPPY char permbones[PATHLEN]; /* where permanent copy of bones go */ @@ -51,7 +48,6 @@ const schar xdir[10] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 }; const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 }; const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 }; -NEARDATA struct monst youmonst = DUMMY; NEARDATA struct context_info context = DUMMY; NEARDATA struct flag flags = DUMMY; #ifdef SYSFLAGS @@ -63,7 +59,6 @@ NEARDATA time_t ubirthday = DUMMY; NEARDATA struct u_realtime urealtime = DUMMY; NEARDATA struct obj - *invent = (struct obj *) 0, *uwep = (struct obj *) 0, *uarm = (struct obj *) 0, *uswapwep = (struct obj *) 0, *uquiver = (struct obj *) 0, /* quiver */ @@ -318,6 +313,9 @@ const struct instance_globals g_init = { 0, /* wailmsg */ NULL, /* migrating_objs */ NULL, /* billobjs */ + UNDEFINED_VALUES, /* hackdir */ + DUMMY, /* youmonst */ + NULL, /* invent */ /* dig.c */ UNDEFINED_VALUE, /* did_dig_msg */ diff --git a/src/detect.c b/src/detect.c index 58f566cfd..df61ef992 100644 --- a/src/detect.c +++ b/src/detect.c @@ -114,7 +114,7 @@ int x, y; return TRUE; /* in inventory, we need to find one which is actually trapped */ if (x == u.ux && y == u.uy) { - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (Is_box(otmp) && otmp->otrapped) return TRUE; if (u.usteed) { /* steed isn't on map so won't be found by m_at() */ @@ -352,9 +352,9 @@ register struct obj *sobj; if (sobj) { char buf[BUFSZ]; - if (youmonst.data == &mons[PM_GOLD_GOLEM]) + if (g.youmonst.data == &mons[PM_GOLD_GOLEM]) Sprintf(buf, "You feel like a million %s!", currency(2L)); - else if (money_cnt(invent) || hidden_gold()) + else if (money_cnt(g.invent) || hidden_gold()) Strcpy(buf, "You feel worried about your future financial situation."); else if (steedgold) @@ -613,7 +613,7 @@ int class; /* an object class, 0 for all */ Strcat(stuff, " and/or large stones"); if (do_dknown) - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) do_dknown_of(obj); for (obj = fobj; obj; obj = obj->nobj) { @@ -968,7 +968,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */ found = TRUE; } } - if (detect_obj_traps(invent, FALSE, 0) != OTRAP_NONE) + if (detect_obj_traps(g.invent, FALSE, 0) != OTRAP_NONE) found = TRUE; /* door traps */ for (door = 0; door < g.doorindex; door++) { @@ -1004,7 +1004,7 @@ outtrapmap: continue; (void) detect_obj_traps(mon->minvent, TRUE, cursed_src); } - (void) detect_obj_traps(invent, TRUE, cursed_src); + (void) detect_obj_traps(g.invent, TRUE, cursed_src); for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) sense_trap(ttmp, 0, 0, cursed_src); @@ -1110,7 +1110,7 @@ struct obj **optr; make_confused((HConfusion & TIMEOUT) + (long) rnd(100), FALSE); break; case 3: - if (!resists_blnd(&youmonst)) { + if (!resists_blnd(&g.youmonst)) { pline("%s your vision!", Tobjnam(obj, "damage")); make_blinded((Blinded & TIMEOUT) + (long) rnd(100), FALSE); if (!Blind) @@ -1533,7 +1533,7 @@ genericptr_t num; newsym(zx, zy); (*num_p)++; } - mon = (zx == u.ux && zy == u.uy) ? &youmonst : m_at(zx, zy); + mon = (zx == u.ux && zy == u.uy) ? &g.youmonst : 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 614cedcbb..647708ec1 100644 --- a/src/dig.c +++ b/src/dig.c @@ -174,7 +174,7 @@ is_digging() return FALSE; } -#define BY_YOU (&youmonst) +#define BY_YOU (&g.youmonst) #define BY_OBJECT ((struct monst *) 0) boolean @@ -324,7 +324,7 @@ dig(VOID_ARGS) } else if (ttmp && ttmp->ttyp == BEAR_TRAP && u.utrap) { if (rnl(7) > (Fumbling ? 1 : 4)) { char kbuf[BUFSZ]; - int dmg = dmgval(uwep, &youmonst) + dbon(); + int dmg = dmgval(uwep, &g.youmonst) + dbon(); if (dmg < 1) dmg = 1; @@ -2017,8 +2017,8 @@ long timeout; if (mtmp && !OBJ_AT(x, y) && mtmp->mundetected && hides_under(mtmp->data)) { mtmp->mundetected = 0; - } else if (x == u.ux && y == u.uy && u.uundetected && hides_under(youmonst.data)) - (void) hideunder(&youmonst); + } else if (x == u.ux && y == u.uy && u.uundetected && hides_under(g.youmonst.data)) + (void) hideunder(&g.youmonst); newsym(x, y); } else if (in_invent) update_inventory(); @@ -2078,27 +2078,27 @@ void escape_tomb() { debugpline0("escape_tomb"); - if ((Teleportation || can_teleport(youmonst.data)) + if ((Teleportation || can_teleport(g.youmonst.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(youmonst.data) || Passes_walls - || noncorporeal(youmonst.data) - || (unsolid(youmonst.data) - && youmonst.data != &mons[PM_WATER_ELEMENTAL]) - || (tunnels(youmonst.data) && !needspick(youmonst.data))) { + if (amorphous(g.youmonst.data) || Passes_walls + || noncorporeal(g.youmonst.data) + || (unsolid(g.youmonst.data) + && g.youmonst.data != &mons[PM_WATER_ELEMENTAL]) + || (tunnels(g.youmonst.data) && !needspick(g.youmonst.data))) { You("%s up through the %s.", - (tunnels(youmonst.data) && !needspick(youmonst.data)) + (tunnels(g.youmonst.data) && !needspick(g.youmonst.data)) ? "try to tunnel" - : (amorphous(youmonst.data)) + : (amorphous(g.youmonst.data)) ? "ooze" : "phase", surface(u.ux, u.uy)); - good = (tunnels(youmonst.data) && !needspick(youmonst.data)) + good = (tunnels(g.youmonst.data) && !needspick(g.youmonst.data)) ? dighole(TRUE, FALSE, (coord *)0) : TRUE; if (good) unearth_you(); diff --git a/src/do.c b/src/do.c index d77662042..a17cc1634 100644 --- a/src/do.c +++ b/src/do.c @@ -26,7 +26,7 @@ static NEARDATA const char drop_types[] = { ALLOW_COUNT, COIN_CLASS, int dodrop() { - int result, i = (invent) ? 0 : (SIZE(drop_types) - 1); + int result, i = (g.invent) ? 0 : (SIZE(drop_types) - 1); if (*u.ushops) sellobj_state(SELL_DELIBERATE); @@ -164,7 +164,7 @@ const char *verb; } mtmp->mtrapped = 0; } else { - if (!Passes_walls && !throws_rocks(youmonst.data)) { + if (!Passes_walls && !throws_rocks(g.youmonst.data)) { losehp(Maybe_Half_Phys(rnd(15)), "squished under a boulder", NO_KILLER_PREFIX); return FALSE; /* player remains trapped */ @@ -759,7 +759,7 @@ doddrop() { int result = 0; - if (!invent) { + if (!g.invent) { You("have nothing to drop."); return 0; } @@ -793,7 +793,7 @@ int retry; all_categories = (retry == -2); } else if (flags.menu_style == MENU_FULL) { all_categories = FALSE; - n = query_category("Drop what type of items?", invent, + n = query_category("Drop what type of items?", g.invent, UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL | BUC_BLESSED | BUC_CURSED | BUC_UNCURSED | BUC_UNKNOWN, &pick_list, PICK_ANY); @@ -827,7 +827,7 @@ int retry; * Dropping a burning potion of oil while levitating can cause * an explosion which might destroy some of hero's inventory, * so the old code - * for (otmp = invent; otmp; otmp = otmp2) { + * for (otmp = g.invent; otmp; otmp = otmp2) { * otmp2 = otmp->nobj; * n_dropped += drop(otmp); * } @@ -837,15 +837,15 @@ int retry; * not droppable) and rescan inventory until no unbypassed * items remain. */ - bypass_objlist(invent, FALSE); /* clear bypass bit for invent */ - while ((otmp = nxt_unbypassed_obj(invent)) != 0) + bypass_objlist(g.invent, FALSE); /* clear bypass bit for invent */ + while ((otmp = nxt_unbypassed_obj(g.invent)) != 0) n_dropped += drop(otmp); /* we might not have dropped everything (worn armor, welded weapon, cursed loadstones), so reset any remaining inventory to normal */ - bypass_objlist(invent, FALSE); + bypass_objlist(g.invent, FALSE); } else { /* should coordinate with perm invent, maybe not show worn items */ - n = query_objlist("What would you like to drop?", &invent, + n = query_objlist("What would you like to drop?", &g.invent, (USE_INVLET | INVORDER_SORT), &pick_list, PICK_ANY, all_categories ? allow_all : allow_category); if (n > 0) { @@ -853,18 +853,18 @@ int retry; * picklist[] contains a set of pointers into inventory, but * as soon as something gets dropped, they might become stale * (see the drop_everything code above for an explanation). - * Just checking to see whether one is still in the invent + * Just checking to see whether one is still in the g.invent * chain is not sufficient validation since destroyed items * will be freed and items we've split here might have already * reused that memory and put the same pointer value back into - * invent. Ditto for using invlet to validate. So we start - * by setting bypass on all of invent, then check each pointer - * to verify that it is in invent and has that bit set. + * g.invent. Ditto for using invlet to validate. So we start + * by setting bypass on all of g.invent, then check each pointer + * to verify that it is in g.invent and has that bit set. */ - bypass_objlist(invent, TRUE); + bypass_objlist(g.invent, TRUE); for (i = 0; i < n; i++) { otmp = pick_list[i].item.a_obj; - for (otmp2 = invent; otmp2; otmp2 = otmp2->nobj) + for (otmp2 = g.invent; otmp2; otmp2 = otmp2->nobj) if (otmp2 == otmp) break; if (!otmp2 || !otmp2->bypass) @@ -883,7 +883,7 @@ int retry; } n_dropped += drop(otmp); } - bypass_objlist(invent, FALSE); /* reset invent to normal */ + bypass_objlist(g.invent, FALSE); /* reset g.invent to normal */ free((genericptr_t) pick_list); } } @@ -916,7 +916,7 @@ dodown() if (ELevitation & W_ARTI) { struct obj *obj; - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { if (obj->oartifact && artifact_has_invprop(obj, LEVITATION)) { if (obj->age < g.monstermoves) @@ -996,9 +996,9 @@ dodown() if (trap) { const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through"; - const char *actn = Flying ? "fly" : locomotion(youmonst.data, "jump"); + const char *actn = Flying ? "fly" : locomotion(g.youmonst.data, "jump"); - if (youmonst.data->msize >= MZ_HUGE) { + if (g.youmonst.data->msize >= MZ_HUGE) { char qbuf[QBUFSZ]; You("don't fit %s easily.", down_or_thru); @@ -1448,7 +1448,7 @@ boolean at_stairs, falling, portal; the latter was done unconditionally. */ coord cc; - if (!rn2(2) && enexto(&cc, u.ux, u.uy, youmonst.data) + if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data) && distu(cc.x, cc.y) <= 2) u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/ else diff --git a/src/do_name.c b/src/do_name.c index 23349fce4..35a6a8ad8 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1336,7 +1336,7 @@ docallcmd() any.a_char = 'm'; /* group accelerator 'C' */ add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'C', ATR_NONE, "a monster", MENU_UNSELECTED); - if (invent) { + if (g.invent) { /* we use y and n as accelerators so that we can accept user's response keyed to old "name an individual object?" prompt */ any.a_char = 'i'; /* group accelerator 'y' */ @@ -1497,7 +1497,7 @@ namefloorobj() 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(youmonst.data)) ? "over" : "under"); + (u.uundetected && hides_under(g.youmonst.data)) ? "over" : "under"); if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0) return; if (cc.x == u.ux && cc.y == u.uy) { diff --git a/src/do_wear.c b/src/do_wear.c index e4067f736..2a04424cf 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -218,7 +218,7 @@ Boots_off(VOID_ARGS) case WATER_WALKING_BOOTS: /* 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(youmonst.data) + && !Levitation && !Flying && !is_clinger(g.youmonst.data) && !context.takeoff.cancelled_don /* avoid recursive call to lava_effects() */ && !iflags.in_lava_effects) { @@ -725,7 +725,7 @@ Amulet_on() break; } case AMULET_OF_STRANGULATION: - if (can_be_strangled(&youmonst)) { + if (can_be_strangled(&g.youmonst)) { makeknown(AMULET_OF_STRANGULATION); Strangled = 6L; context.botl = TRUE; @@ -768,7 +768,7 @@ Amulet_off() /* HMagical_breathing must be set off before calling drown() */ setworn((struct obj *) 0, W_AMUL); - if (!breathless(youmonst.data) && !amphibious(youmonst.data) + if (!breathless(g.youmonst.data) && !amphibious(g.youmonst.data) && !Swimming) { You("suddenly inhale an unhealthy amount of %s!", hliquid("water")); @@ -1308,7 +1308,7 @@ struct obj *stolenobj; /* no message if stolenobj is already being doffing */ boolean putting_on; int result = 0; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if ((otmp->owornmask & W_ARMOR) && donning(otmp)) break; /* at most one item will pass donning() test at any given time */ @@ -1606,7 +1606,7 @@ boolean noisy; /* this is the same check as for 'W' (dowear), but different message, in case we get here via 'P' (doputon) */ - if (verysmall(youmonst.data) || nohands(youmonst.data)) { + if (verysmall(g.youmonst.data) || nohands(g.youmonst.data)) { if (noisy) You("can't wear any armor in your current form."); return 0; @@ -1619,10 +1619,10 @@ boolean noisy; : is_suit(otmp) ? c_suit : 0; - if (which && cantweararm(youmonst.data) + if (which && cantweararm(g.youmonst.data) /* same exception for cloaks as used in m_dowear() */ - && (which != c_cloak || youmonst.data->msize != MZ_SMALL) - && (racial_exception(&youmonst, otmp) < 1)) { + && (which != c_cloak || g.youmonst.data->msize != MZ_SMALL) + && (racial_exception(&g.youmonst, otmp) < 1)) { if (noisy) pline_The("%s will not fit on your body.", which); return 0; @@ -1644,12 +1644,12 @@ boolean noisy; if (noisy) already_wearing(an(helm_simple_name(uarmh))); err++; - } else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) { + } else if (Upolyd && has_horns(g.youmonst.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(youmonst.data))); + plur(num_horns(g.youmonst.data))); err++; } else *mask = W_ARMH; @@ -1676,11 +1676,11 @@ boolean noisy; if (noisy) already_wearing(c_boots); err++; - } else if (Upolyd && slithy(youmonst.data)) { + } else if (Upolyd && slithy(g.youmonst.data)) { if (noisy) You("have no feet..."); /* not body_part(FOOT) */ err++; - } else if (Upolyd && youmonst.data->mlet == S_CENTAUR) { + } else if (Upolyd && g.youmonst.data->mlet == S_CENTAUR) { /* break_armor() pushes boots off for centaurs, so don't let dowear() put them back on... */ if (noisy) @@ -1807,13 +1807,13 @@ struct obj *obj; char answer, qbuf[QBUFSZ]; int res = 0; - if (nolimbs(youmonst.data)) { + if (nolimbs(g.youmonst.data)) { You("cannot make the ring stick to your body."); return 0; } if (uleft && uright) { There("are no more %s%s to fill.", - humanoid(youmonst.data) ? "ring-" : "", + humanoid(g.youmonst.data) ? "ring-" : "", makeplural(body_part(FINGER))); return 0; } @@ -1824,7 +1824,7 @@ struct obj *obj; } else { do { Sprintf(qbuf, "Which %s%s, Right or Left?", - humanoid(youmonst.data) ? "ring-" : "", + humanoid(g.youmonst.data) ? "ring-" : "", body_part(FINGER)); answer = yn_function(qbuf, "rl", '\0'); switch (answer) { @@ -1959,7 +1959,7 @@ dowear() /* cantweararm() checks for suits of armor, not what we want here; verysmall() or nohands() checks for shields, gloves, etc... */ - if (verysmall(youmonst.data) || nohands(youmonst.data)) { + if (verysmall(g.youmonst.data) || nohands(g.youmonst.data)) { pline("Don't even bother."); return 0; } @@ -1983,7 +1983,7 @@ doputon() && 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(youmonst.data) ? "ring-" : "", + humanoid(g.youmonst.data) ? "ring-" : "", makeplural(body_part(FINGER)), (ublindf->otyp == LENSES) ? "some lenses" : "a blindfold"); return 0; @@ -2050,7 +2050,7 @@ glibr() leftfall = (uleft && !uleft->cursed && (!uwep || !welded(uwep) || !bimanual(uwep))); rightfall = (uright && !uright->cursed && (!welded(uwep))); - if (!uarmg && (leftfall || rightfall) && !nolimbs(youmonst.data)) { + if (!uarmg && (leftfall || rightfall) && !nolimbs(g.youmonst.data)) { /* changed so cursed rings don't fall off, GAN 10/30/86 */ Your("%s off your %s.", (leftfall && rightfall) ? "rings slip" : "ring slips", @@ -2132,22 +2132,22 @@ struct monst *victim; { register struct obj *otmph, *otmp; - otmph = (victim == &youmonst) ? uarmc : which_armor(victim, W_ARMC); + otmph = (victim == &g.youmonst) ? uarmc : which_armor(victim, W_ARMC); if (!otmph) - otmph = (victim == &youmonst) ? uarm : which_armor(victim, W_ARM); + otmph = (victim == &g.youmonst) ? uarm : which_armor(victim, W_ARM); if (!otmph) - otmph = (victim == &youmonst) ? uarmu : which_armor(victim, W_ARMU); + otmph = (victim == &g.youmonst) ? uarmu : which_armor(victim, W_ARMU); - otmp = (victim == &youmonst) ? uarmh : which_armor(victim, W_ARMH); + otmp = (victim == &g.youmonst) ? uarmh : which_armor(victim, W_ARMH); if (otmp && (!otmph || !rn2(4))) otmph = otmp; - otmp = (victim == &youmonst) ? uarmg : which_armor(victim, W_ARMG); + otmp = (victim == &g.youmonst) ? uarmg : which_armor(victim, W_ARMG); if (otmp && (!otmph || !rn2(4))) otmph = otmp; - otmp = (victim == &youmonst) ? uarmf : which_armor(victim, W_ARMF); + otmp = (victim == &g.youmonst) ? uarmf : which_armor(victim, W_ARMF); if (otmp && (!otmph || !rn2(4))) otmph = otmp; - otmp = (victim == &youmonst) ? uarms : which_armor(victim, W_ARMS); + otmp = (victim == &g.youmonst) ? uarms : which_armor(victim, W_ARMS); if (otmp && (!otmph || !rn2(4))) otmph = otmp; return otmph; @@ -2167,7 +2167,7 @@ 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(youmonst.data) && uamul + if (nolimbs(g.youmonst.data) && uamul && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed) return uamul; if (welded(uwep) && (ring == uright || bimanual(uwep))) @@ -2204,7 +2204,7 @@ register struct obj *otmp; /* special ring checks */ if (otmp == uright || otmp == uleft) { - if (nolimbs(youmonst.data)) { + if (nolimbs(g.youmonst.data)) { pline_The("ring is stuck."); return 0; } @@ -2536,7 +2536,7 @@ int retry; } else if (flags.menu_style == MENU_FULL) { all_worn_categories = FALSE; n = query_category("What type of things do you want to take off?", - invent, (WORN_TYPES | ALL_TYPES + g.invent, (WORN_TYPES | ALL_TYPES | UNPAID_TYPES | BUCX_TYPES), &pick_list, PICK_ANY); if (!n) @@ -2561,7 +2561,7 @@ int retry; || menu_class_present('C') || menu_class_present('X')) all_worn_categories = FALSE; - n = query_objlist("What do you want to take off?", &invent, + n = query_objlist("What do you want to take off?", &g.invent, (SIGNAL_NOMENU | USE_INVLET | INVORDER_SORT), &pick_list, PICK_ANY, all_worn_categories ? is_worn : is_worn_by_type); diff --git a/src/dog.c b/src/dog.c index 8c961da8a..a56ebfe1a 100644 --- a/src/dog.c +++ b/src/dog.c @@ -904,7 +904,7 @@ register struct obj *obj; if (mtmp == u.ustuck) { if (u.uswallow) expels(mtmp, mtmp->data, TRUE); - else if (!(Upolyd && sticks(youmonst.data))) + else if (!(Upolyd && sticks(g.youmonst.data))) unstuck(mtmp); } @@ -940,7 +940,7 @@ register struct obj *obj; /* monsters with conflicting structures cannot be tamed */ || mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion || is_covetous(mtmp->data) || is_human(mtmp->data) - || (is_demon(mtmp->data) && !is_demon(youmonst.data)) + || (is_demon(mtmp->data) && !is_demon(g.youmonst.data)) || (obj && dogfood(mtmp, obj) >= MANFOOD)) return FALSE; @@ -1002,7 +1002,7 @@ boolean was_dead; if (!rn2(edog->abuse + 1)) mtmp->mpeaceful = 1; if (!quietly && cansee(mtmp->mx, mtmp->my)) { - if (haseyes(youmonst.data)) { + if (haseyes(g.youmonst.data)) { if (haseyes(mtmp->data)) pline("%s %s to look you in the %s.", Monnam(mtmp), mtmp->mpeaceful ? "seems unable" : "refuses", diff --git a/src/dogmove.c b/src/dogmove.c index 83de282e5..cb1a26bd3 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -570,7 +570,7 @@ int after, udist, whappr; } /* if you have dog food it'll follow you more closely */ if (appr == 0) - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if (dogfood(mtmp, obj) == DOGFOOD) { appr = 1; break; @@ -650,7 +650,7 @@ int maxdist; targ = m_at(curx, cury); if (curx == mtmp->mux && cury == mtmp->muy) - return &youmonst; + return &g.youmonst; if (targ) { /* Is the monster visible to the pet? */ @@ -754,7 +754,7 @@ struct monst *mtmp, *mtarg; return score; } /* Is the monster peaceful or tame? */ - if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == &youmonst) { + if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == &g.youmonst) { /* Pets will never be targeted */ score -= 3000L; return score; @@ -953,7 +953,7 @@ int after; /* this is extra fast monster movement */ } #if 0 /* [this is now handled in dochug()] */ if (!Conflict && !mtmp->mconf - && mtmp == u.ustuck && !sticks(youmonst.data)) { + && mtmp == u.ustuck && !sticks(g.youmonst.data)) { unstuck(mtmp); /* swallowed case handled above */ You("get released!"); } @@ -1155,7 +1155,7 @@ int after; /* this is extra fast monster movement */ if (mtarg && (!hungry || !rn2(5))) { int mstatus; - if (mtarg == &youmonst) { + if (mtarg == &g.youmonst) { if (mattacku(mtmp)) return 2; } else { @@ -1170,7 +1170,7 @@ int after; /* this is extra fast monster movement */ * nothing will happen. */ if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) - && rn2(4) && mtarg != &youmonst) { + && rn2(4) && mtarg != &g.youmonst) { /* Can monster see? If it can, it can retaliate * even if the pet is invisible, since it'll see diff --git a/src/dokick.c b/src/dokick.c index 565bb4f81..0bff002fc 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(youmonst.data) \ + (martial_bonus() || is_bigfoot(g.youmonst.data) \ || (uarmf && uarmf->otyp == KICKING_BOOTS)) /* g.kickedobj (decl.c) tracks a kicked object until placed or destroyed */ @@ -182,7 +182,7 @@ xchar x, y; * normally, getting all your attacks _including_ all your kicks. * If you have >1 kick attack, you get all of them. */ - if (Upolyd && attacktype(youmonst.data, AT_KICK)) { + if (Upolyd && attacktype(g.youmonst.data, AT_KICK)) { struct attack *uattk; int sum, kickdieroll, armorpenalty, attknum = 0, @@ -195,7 +195,7 @@ xchar x, y; if (g.multi < 0) break; - uattk = &youmonst.data->mattk[i]; + uattk = &g.youmonst.data->mattk[i]; /* we only care about kicking attacks here */ if (uattk->aatyp != AT_KICK) continue; @@ -336,7 +336,7 @@ register struct obj *gold; else verbalize("Thanks, scum!"); } else if (mtmp->isgd) { - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); /* Some of these are iffy, because a hostile guard won't become peaceful and resume leading hero out of the vault. If he did do that, player @@ -364,7 +364,7 @@ register struct obj *gold; goldreqd = 750L; if (goldreqd) { - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); if (value > goldreqd + (umoney + u.ulevel * rn2(5)) / ACURR(A_CHA)) @@ -515,7 +515,7 @@ xchar x, y; You("kick %s with your bare %s.", corpse_xname(g.kickedobj, (const char *) 0, CXN_PFX_THE), makeplural(body_part(FOOT))); - if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) { + if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) { ; /* hero has been transformed but kick continues */ } else { /* normalize body shape here; foot, not body_part(FOOT) */ @@ -759,10 +759,10 @@ dokick() char buf[BUFSZ], kickobjnam[BUFSZ]; kickobjnam[0] = '\0'; - if (nolimbs(youmonst.data) || slithy(youmonst.data)) { + if (nolimbs(g.youmonst.data) || slithy(g.youmonst.data)) { You("have no legs to kick with."); no_kick = TRUE; - } else if (verysmall(youmonst.data)) { + } else if (verysmall(g.youmonst.data)) { You("are too small to do any kicking."); no_kick = TRUE; } else if (u.usteed) { @@ -787,7 +787,7 @@ dokick() } else if (near_capacity() > SLT_ENCUMBER) { Your("load is too heavy to balance yourself for a kick."); no_kick = TRUE; - } else if (youmonst.data->mlet == S_LIZARD) { + } else if (g.youmonst.data->mlet == S_LIZARD) { Your("legs cannot kick effectively."); no_kick = TRUE; } else if (u.uinwater && !rn2(2)) { @@ -928,7 +928,7 @@ dokick() int range; range = - ((int) youmonst.data->cwt + (weight_cap() + inv_weight())); + ((int) g.youmonst.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 f2fb77abe..b52280556 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -73,7 +73,7 @@ int shotlimit; return 0; } if ((obj->oartifact == ART_MJOLLNIR && ACURR(A_STR) < STR19(25)) - || (obj->otyp == BOULDER && !throws_rocks(youmonst.data))) { + || (obj->otyp == BOULDER && !throws_rocks(g.youmonst.data))) { pline("It's too heavy."); return 1; } @@ -240,10 +240,10 @@ int *shotlimit_p; /* (see dothrow()) */ *shotlimit_p = (g.multi || g.save_cm) ? g.multi + 1 : 0; g.multi = 0; /* reset; it's been used up */ - if (notake(youmonst.data)) { + if (notake(g.youmonst.data)) { You("are physically incapable of throwing or shooting anything."); return FALSE; - } else if (nohands(youmonst.data)) { + } else if (nohands(g.youmonst.data)) { You_cant("throw or shoot without hands."); /* not body_part(HAND) */ return FALSE; /*[what about !freehand(), aside from cursed missile launcher?]*/ @@ -292,7 +292,7 @@ autoquiver() return; /* Scan through the inventory */ - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (otmp->owornmask || otmp->oartifact || !otmp->dknown) { ; /* Skip it */ } else if (otmp->otyp == ROCK @@ -630,12 +630,12 @@ int x, y; wake_nearto(x,y, 10); return FALSE; } - if ((u.ux - x) && (u.uy - y) && bad_rock(youmonst.data, u.ux, y) - && bad_rock(youmonst.data, x, u.uy)) { - boolean too_much = (invent && (inv_weight() + weight_cap() > 600)); + if ((u.ux - x) && (u.uy - y) && bad_rock(g.youmonst.data, u.ux, y) + && bad_rock(g.youmonst.data, x, u.uy)) { + boolean too_much = (g.invent && (inv_weight() + weight_cap() > 600)); /* Move at a diagonal. */ - if (bigmonst(youmonst.data) || too_much) { + if (bigmonst(g.youmonst.data) || too_much) { You("%sget forcefully wedged into a crevice.", too_much ? "and all your belongings " : ""); dmg = rnd(2 + *range); @@ -679,8 +679,8 @@ int x, y; } if ((u.ux - x) && (u.uy - y) - && bad_rock(youmonst.data, u.ux, y) - && bad_rock(youmonst.data, x, u.uy)) { + && bad_rock(g.youmonst.data, u.ux, y) + && bad_rock(g.youmonst.data, x, u.uy)) { /* Move at a diagonal. */ if (Sokoban) { You("come to an abrupt halt!"); @@ -953,7 +953,7 @@ boolean hitsroof; /* object now hits you */ if (obj->oclass == POTION_CLASS) { - potionhit(&youmonst, obj, POTHIT_HERO_THROW); + potionhit(&g.youmonst, obj, POTHIT_HERO_THROW); } else if (breaktest(obj)) { int otyp = obj->otyp; int blindinc; @@ -961,7 +961,7 @@ boolean hitsroof; /* 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(&youmonst, &youmonst, AT_WEAP, obj)) + && can_blnd(&g.youmonst, &g.youmonst, AT_WEAP, obj)) ? rnd(25) : 0; breakmsg(obj, !Blind); @@ -970,7 +970,7 @@ boolean hitsroof; switch (otyp) { case EGG: if (petrifier && !Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { /* egg ends up "all over your face"; perhaps visored helmet should still save you here */ @@ -997,11 +997,11 @@ boolean hitsroof; return FALSE; } else { /* neither potion nor other breaking object */ boolean less_damage = uarmh && is_metallic(uarmh), artimsg = FALSE; - int dmg = dmgval(obj, &youmonst); + int dmg = dmgval(obj, &g.youmonst); if (obj->oartifact) /* need a fake die roll here; rn1(18,2) avoids 1 and 20 */ - artimsg = artifact_hit((struct monst *) 0, &youmonst, obj, &dmg, + artimsg = artifact_hit((struct monst *) 0, &g.youmonst, obj, &dmg, rn1(18, 2)); if (!dmg) { /* probably wasn't a weapon; base damage on weight */ @@ -1010,7 +1010,7 @@ boolean hitsroof; dmg = 1; else if (dmg > 6) dmg = 6; - if (youmonst.data == &mons[PM_SHADE] + if (g.youmonst.data == &mons[PM_SHADE] && objects[obj->otyp].oc_material != SILVER) dmg = 0; } @@ -1033,7 +1033,7 @@ boolean hitsroof; Your("%s does not protect you.", helm_simple_name(uarmh)); } } else if (petrifier && !Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { petrify: g.killer.format = KILLED_BY; @@ -1175,7 +1175,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ if (Is_airlevel(&u.uz) || Levitation) hurtle(-u.dx, -u.dy, 1, TRUE); mon = boomhit(obj, u.dx, u.dy); - if (mon == &youmonst) { /* the thing was caught */ + if (mon == &g.youmonst) { /* the thing was caught */ exercise(A_DEX, TRUE); obj = addinv(obj); (void) encumber_msg(); @@ -1344,7 +1344,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ Tobjnam(obj, Blind ? "hit" : "fly"), body_part(ARM)); if (obj->oartifact) - (void) artifact_hit((struct monst *) 0, &youmonst, + (void) artifact_hit((struct monst *) 0, &g.youmonst, obj, &dmg, 0); losehp(Maybe_Half_Phys(dmg), killer_xname(obj), KILLED_BY); @@ -1527,7 +1527,7 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */ * Distance and monster size affect chance to hit. */ tmp = -1 + Luck + find_mac(mon) + u.uhitinc - + maybe_polyd(youmonst.data->mlevel, u.ulevel); + + maybe_polyd(g.youmonst.data->mlevel, u.ulevel); if (ACURR(A_DEX) < 4) tmp -= 3; else if (ACURR(A_DEX) < 6) @@ -1566,7 +1566,7 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */ tmp += omon_adj(mon, obj, TRUE); if (is_orc(mon->data) - && maybe_polyd(is_elf(youmonst.data), Race_if(PM_ELF))) + && maybe_polyd(is_elf(g.youmonst.data), Race_if(PM_ELF))) tmp++; if (guaranteed_hit) { tmp += 1000; /* Guaranteed hit */ @@ -1638,7 +1638,7 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */ * Polymorphing won't make you a bow expert. */ if ((Race_if(PM_ELF) || Role_if(PM_SAMURAI)) - && (!Upolyd || your_race(youmonst.data)) + && (!Upolyd || your_race(g.youmonst.data)) && objects[uwep->otyp].oc_skill == P_BOW) { tmp++; if (Race_if(PM_ELF) && uwep->otyp == ELVEN_BOW) @@ -1960,15 +1960,15 @@ boolean from_invent; if (obj->otyp == POT_OIL && obj->lamplit) { explode_oil(obj, x, y); } else if (distu(x, y) <= 2) { - if (!breathless(youmonst.data) || haseyes(youmonst.data)) { + if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) { if (obj->otyp != POT_WATER) { - if (!breathless(youmonst.data)) { + if (!breathless(g.youmonst.data)) { /* [what about "familiar odor" when known?] */ You("smell a peculiar odor..."); } else { const char *eyes = body_part(EYE); - if (eyecount(youmonst.data) != 1) + if (eyecount(g.youmonst.data) != 1) eyes = makeplural(eyes); Your("%s %s.", eyes, vtense(eyes, "water")); } diff --git a/src/eat.c b/src/eat.c index 826ffd84b..1ebc46978 100644 --- a/src/eat.c +++ b/src/eat.c @@ -86,8 +86,8 @@ register 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 (metallivorous(youmonst.data) && is_metallic(obj) - && (youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj))) + if (metallivorous(g.youmonst.data) && is_metallic(obj) + && (g.youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj))) return TRUE; /* Ghouls only eat non-veggy corpses or eggs (see dogfood()) */ @@ -155,8 +155,8 @@ eatmdone(VOID_ARGS) free((genericptr_t) g.eatmbuf), g.eatmbuf = 0; } /* update display */ - if (youmonst.m_ap_type) { - youmonst.m_ap_type = M_AP_NOTHING; + if (g.youmonst.m_ap_type) { + g.youmonst.m_ap_type = M_AP_NOTHING; newsym(u.ux, u.uy); } return 0; @@ -172,11 +172,11 @@ eatmupdate() if (!g.eatmbuf || g.nomovemsg != g.eatmbuf) return; - if (is_obj_mappear(&youmonst,ORANGE) && !Hallucination) { + if (is_obj_mappear(&g.youmonst,ORANGE) && !Hallucination) { /* revert from hallucinatory to "normal" mimicking */ altmsg = "You now prefer mimicking yourself."; altapp = GOLD_PIECE; - } else if (is_obj_mappear(&youmonst,GOLD_PIECE) && Hallucination) { + } else if (is_obj_mappear(&g.youmonst,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 */ @@ -192,7 +192,7 @@ eatmupdate() } g.nomovemsg = strcpy(g.eatmbuf, altmsg); /* update current image */ - youmonst.mappearance = altapp; + g.youmonst.mappearance = altapp; newsym(u.ux, u.uy); } } @@ -315,9 +315,9 @@ struct obj *otmp; : (unsigned) objects[otmp->otyp].oc_nutrition; if (otmp->otyp == LEMBAS_WAFER) { - if (maybe_polyd(is_elf(youmonst.data), Race_if(PM_ELF))) + if (maybe_polyd(is_elf(g.youmonst.data), Race_if(PM_ELF))) nut += nut / 4; /* 800 -> 1000 */ - else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC))) + else if (maybe_polyd(is_orc(g.youmonst.data), Race_if(PM_ORC))) nut -= nut / 4; /* 800 -> 600 */ /* prevent polymorph making a partly eaten wafer become more nutritious than an untouched one */ @@ -325,7 +325,7 @@ struct obj *otmp; otmp->oeaten = (otmp->oeaten < objects[LEMBAS_WAFER].oc_nutrition) ? (nut - 1) : nut; } else if (otmp->otyp == CRAM_RATION) { - if (maybe_polyd(is_dwarf(youmonst.data), Race_if(PM_DWARF))) + if (maybe_polyd(is_dwarf(g.youmonst.data), Race_if(PM_DWARF))) nut += nut / 6; /* 600 -> 700 */ } return nut; @@ -499,11 +499,11 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */ if (noncorporeal(pd)) { if (visflag) pline("%s brain is unharmed.", - (mdef == &youmonst) ? "Your" : s_suffix(Monnam(mdef))); + (mdef == &g.youmonst) ? "Your" : s_suffix(Monnam(mdef))); return MM_MISS; /* side-effects can't occur */ - } else if (magr == &youmonst) { + } else if (magr == &g.youmonst) { You("eat %s brain!", s_suffix(mon_nam(mdef))); - } else if (mdef == &youmonst) { + } else if (mdef == &g.youmonst) { Your("brain is eaten!"); } else { /* monster against monster */ if (visflag && canspotmon(mdef)) @@ -514,7 +514,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */ /* 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 == &youmonst) { + if (magr == &g.youmonst) { if (!Stone_resistance && !Stoned) make_stoned(5L, (char *) 0, KILLED_BY_AN, pd->mname); } else { @@ -535,7 +535,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */ } } - if (magr == &youmonst) { + if (magr == &g.youmonst) { /* * player mind flayer is eating something's brain */ @@ -568,7 +568,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */ is cannibalism */ (void) maybe_cannibal(monsndx(pd), TRUE); - } else if (mdef == &youmonst) { + } else if (mdef == &g.youmonst) { /* * monster mind flayer is eating hero's brain */ @@ -653,7 +653,7 @@ 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(youmonst.data, fptr)) + || (Upolyd && same_race(g.youmonst.data, fptr)) || (u.ulycn >= LOW_PM && were_beastie(pm) == u.ulycn))) { if (allowmsg) { if (Upolyd && your_race(fptr)) @@ -674,7 +674,7 @@ register int pm; (void) maybe_cannibal(pm, TRUE); if (flesh_petrifies(&mons[pm])) { if (!Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { Sprintf(g.killer.name, "tasting %s meat", mons[pm].mname); g.killer.format = KILLED_BY; @@ -722,7 +722,7 @@ register int pm; return; } case PM_GREEN_SLIME: - if (!Slimed && !Unchanging && !slimeproof(youmonst.data)) { + if (!Slimed && !Unchanging && !slimeproof(g.youmonst.data)) { You("don't feel very well."); make_slimed(10L, (char *) 0); delayed_killer(SLIMED, KILLED_BY_AN, ""); @@ -1015,7 +1015,7 @@ int pm; /*FALLTHRU*/ case PM_SMALL_MIMIC: tmp += 20; - if (youmonst.data->mlet != S_MIMIC && !Unchanging) { + if (g.youmonst.data->mlet != S_MIMIC && !Unchanging) { char buf[BUFSZ]; u.uconduct.polyselfs++; /* you're changing form */ @@ -1030,13 +1030,13 @@ int pm; Hallucination ? "You suddenly dread being peeled and mimic %s again!" : "You now prefer mimicking %s again.", - an(Upolyd ? youmonst.data->mname : urace.noun)); + an(Upolyd ? g.youmonst.data->mname : urace.noun)); g.eatmbuf = dupstr(buf); g.nomovemsg = g.eatmbuf; g.afternmv = eatmdone; /* ??? what if this was set before? */ - youmonst.m_ap_type = M_AP_OBJECT; - youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE; + g.youmonst.m_ap_type = M_AP_OBJECT; + g.youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE; newsym(u.ux, u.uy); curs_on_u(); /* make gold symbol show up now */ @@ -1457,10 +1457,10 @@ struct obj *otmp; const char *mesg = 0; register int tmp; - if (metallivorous(youmonst.data)) { + if (metallivorous(g.youmonst.data)) { mesg = "You bite right into the metal tin..."; tmp = 0; - } else if (cantwield(youmonst.data)) { /* nohands || verysmall */ + } else if (cantwield(g.youmonst.data)) { /* nohands || verysmall */ You("cannot handle the tin properly to open it."); return; } else if (otmp->blessed) { @@ -1590,9 +1590,9 @@ struct obj *otmp; int retcode = 0, tp = 0, mnum = otmp->corpsenm; long rotted = 0L; boolean stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance - && !poly_when_stoned(youmonst.data)), + && !poly_when_stoned(g.youmonst.data)), slimeable = (mnum == PM_GREEN_SLIME && !Slimed && !Unchanging - && !slimeproof(youmonst.data)), + && !slimeproof(g.youmonst.data)), glob = otmp->globby ? TRUE : FALSE; /* KMH, conduct */ @@ -1691,13 +1691,13 @@ struct obj *otmp; } else { /* yummy is always False for omnivores, palatable always True */ boolean yummy = (vegan(&mons[mnum]) - ? (!carnivorous(youmonst.data) - && herbivorous(youmonst.data)) - : (carnivorous(youmonst.data) - && !herbivorous(youmonst.data))), + ? (!carnivorous(g.youmonst.data) + && herbivorous(g.youmonst.data)) + : (carnivorous(g.youmonst.data) + && !herbivorous(g.youmonst.data))), palatable = ((vegetarian(&mons[mnum]) - ? herbivorous(youmonst.data) - : carnivorous(youmonst.data)) + ? herbivorous(g.youmonst.data) + : carnivorous(g.youmonst.data)) && rn2(10) && ((rotted < 1) ? TRUE : !rn2(rotted+1))); const char *pmxnam = food_xname(otmp, FALSE); @@ -1794,9 +1794,9 @@ struct obj *otmp; pline("That satiated your %s!", body_part(STOMACH)); break; case TRIPE_RATION: - if (carnivorous(youmonst.data) && !humanoid(youmonst.data)) + if (carnivorous(g.youmonst.data) && !humanoid(g.youmonst.data)) pline("That tripe ration was surprisingly good!"); - else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC))) + else if (maybe_polyd(is_orc(g.youmonst.data), Race_if(PM_ORC))) pline(Hallucination ? "Tastes great! Less filling!" : "Mmm, tripe... not bad!"); else { @@ -1810,10 +1810,10 @@ struct obj *otmp; } break; case LEMBAS_WAFER: - if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC))) { + if (maybe_polyd(is_orc(g.youmonst.data), Race_if(PM_ORC))) { pline("%s", "!#?&* elf kibble!"); break; - } else if (maybe_polyd(is_elf(youmonst.data), Race_if(PM_ELF))) { + } else if (maybe_polyd(is_elf(g.youmonst.data), Race_if(PM_ELF))) { pline("A little goes a long way."); break; } @@ -1824,7 +1824,7 @@ struct obj *otmp; case MEAT_RING: goto give_feedback; case CLOVE_OF_GARLIC: - if (is_undead(youmonst.data)) { + if (is_undead(g.youmonst.data)) { make_vomiting((long) rn1(context.victual.reqtime, 5), FALSE); break; } @@ -1964,7 +1964,7 @@ struct obj *otmp; set_mimic_blocking(); see_monsters(); if (Invis && !oldprop && !ESee_invisible - && !perceives(youmonst.data) && !Blind) { + && !perceives(g.youmonst.data) && !Blind) { newsym(u.ux, u.uy); pline("Suddenly you can see yourself."); makeknown(typ); @@ -2181,7 +2181,7 @@ struct obj *otmp; { switch (otmp->otyp) { case SPRIG_OF_WOLFSBANE: - if (u.ulycn >= LOW_PM || is_were(youmonst.data)) + if (u.ulycn >= LOW_PM || is_were(g.youmonst.data)) you_unwere(TRUE); break; case CARROT: @@ -2224,7 +2224,7 @@ struct obj *otmp; case EGG: if (flesh_petrifies(&mons[otmp->corpsenm])) { if (!Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { if (!Stoned) { Sprintf(g.killer.name, "%s egg", @@ -2307,10 +2307,10 @@ struct obj *otmp; if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN) { /* These checks must match those in eatcorpse() */ stoneorslime = (flesh_petrifies(&mons[mnum]) && !Stone_resistance - && !poly_when_stoned(youmonst.data)); + && !poly_when_stoned(g.youmonst.data)); if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME) - stoneorslime = (!Unchanging && !slimeproof(youmonst.data)); + stoneorslime = (!Unchanging && !slimeproof(g.youmonst.data)); if (cadaver && !nonrotting_corpse(mnum)) { long age = peek_at_iced_corpse_age(otmp); @@ -2476,7 +2476,7 @@ doeat() You_cant("eat %s you're wearing.", something); return 0; } else if (!(carried(otmp) ? retouch_object(&otmp, FALSE) - : touch_artifact(otmp, &youmonst))) { + : touch_artifact(otmp, &g.youmonst))) { return 1; /* got blasted so use a turn */ } if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER @@ -2780,9 +2780,9 @@ gethungry() 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(youmonst.data) - || herbivorous(youmonst.data) - || metallivorous(youmonst.data)) + && (carnivorous(g.youmonst.data) + || herbivorous(g.youmonst.data) + || metallivorous(g.youmonst.data)) && !Slow_digestion) u.uhunger--; /* ordinary food consumption */ @@ -3085,11 +3085,11 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */ if (iflags.menu_requested /* command was preceded by 'm' prefix */ || !can_reach_floor(TRUE) || (feeding && u.usteed) || (is_pool_or_lava(u.ux, u.uy) - && (Wwalking || is_clinger(youmonst.data) + && (Wwalking || is_clinger(g.youmonst.data) || (Flying && !Breathless)))) goto skipfloor; - if (feeding && metallivorous(youmonst.data)) { + if (feeding && metallivorous(g.youmonst.data)) { struct obj *gold; struct trap *ttmp = t_at(u.ux, u.uy); @@ -3111,7 +3111,7 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */ } } - if (youmonst.data != &mons[PM_RUST_MONSTER] + if (g.youmonst.data != &mons[PM_RUST_MONSTER] && (gold = g_at(u.ux, u.uy)) != 0) { if (gold->quan == 1L) Sprintf(qbuf, "There is 1 gold piece here; eat it?"); @@ -3178,7 +3178,7 @@ skipfloor: void vomit() /* A good idea from David Neves */ { - if (cantvomit(youmonst.data)) { + if (cantvomit(g.youmonst.data)) { /* doesn't cure food poisoning; message assumes that we aren't dealing with some esoteric body_part() */ Your("jaw gapes convulsively."); diff --git a/src/end.c b/src/end.c index 43d470333..e2015a0e3 100644 --- a/src/end.c +++ b/src/end.c @@ -732,7 +732,7 @@ time_t when; /* date+time at end of game */ putstr(0, 0, ""); putstr(0, 0, "Inventory:"); (void) display_inventory((char *) 0, TRUE); - container_contents(invent, TRUE, TRUE, FALSE); + container_contents(g.invent, TRUE, TRUE, FALSE); enlightenment((BASICENLIGHTENMENT | MAGICENLIGHTENMENT), (how >= PANICKED) ? ENL_GAMEOVERALIVE : ENL_GAMEOVERDEAD); putstr(0, 0, ""); @@ -760,7 +760,7 @@ boolean taken; char qbuf[QBUFSZ]; boolean ask = FALSE; - if (invent && !done_stopprint) { + if (g.invent && !done_stopprint) { if (taken) Sprintf(qbuf, "Do you want to see what you had when you %s?", (how == QUIT) ? "quit" : "died"); @@ -772,7 +772,7 @@ boolean taken; if (c == 'y') { /* caller has already ID'd everything */ (void) display_inventory((char *) 0, TRUE); - container_contents(invent, TRUE, TRUE, FALSE); + container_contents(g.invent, TRUE, TRUE, FALSE); } if (c == 'q') done_stopprint++; @@ -861,7 +861,7 @@ 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(youmonst.data)) + if (Upolyd && sticks(g.youmonst.data)) You("release %s.", mon_nam(u.ustuck)); else pline("%s releases you.", Monnam(u.ustuck)); @@ -1217,7 +1217,7 @@ int how; * Both are optional, so do it once here instead of duplicating * it in both of those places. */ - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { discover_object(obj->otyp, TRUE, FALSE); obj->known = obj->bknown = obj->dknown = obj->rknown = 1; if (Is_container(obj) || obj->otyp == STATUE) @@ -1281,7 +1281,7 @@ int how; { int deepest = deepest_lev_reached(FALSE); - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); tmp = u.umoney0; umoney += hidden_gold(); /* accumulate gold from containers */ tmp = umoney - tmp; /* net gain */ @@ -1393,7 +1393,7 @@ int how; for (i = 0; i < val->size; i++) { val->list[i].count = 0L; } - get_valuables(invent); + get_valuables(g.invent); /* add points for collected valuables */ for (val = g.valuables; val->list; val++) @@ -1405,7 +1405,7 @@ int how; } /* count the points for artifacts */ - artifact_score(invent, TRUE, endwin); + artifact_score(g.invent, TRUE, endwin); g.viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */ mtmp = g.mydogs; @@ -1438,11 +1438,11 @@ int how; dump_forward_putstr(endwin, 0, pbuf, done_stopprint); if (!done_stopprint) - artifact_score(invent, FALSE, endwin); /* list artifacts */ + artifact_score(g.invent, FALSE, endwin); /* list artifacts */ #ifdef DUMPLOG dump_redirect(TRUE); if (iflags.in_dumplog) - artifact_score(invent, FALSE, 0); + artifact_score(g.invent, FALSE, 0); dump_redirect(FALSE); #endif diff --git a/src/engrave.c b/src/engrave.c index cc8ba228e..7680a1e05 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -159,7 +159,7 @@ boolean check_pit; return (boolean) ((!Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) - && (!u.uundetected || !is_hider(youmonst.data) + && (!u.uundetected || !is_hider(g.youmonst.data) || u.umonnum == PM_TRAPPER)); } @@ -498,7 +498,7 @@ doengrave() maxelen = BUFSZ - 1; if (oep) oetype = oep->engr_type; - if (is_demon(youmonst.data) || youmonst.data->mlet == S_VAMPIRE) + if (is_demon(g.youmonst.data) || g.youmonst.data->mlet == S_VAMPIRE) type = ENGR_BLOOD; /* Can the adventurer engrave at all? */ @@ -527,7 +527,7 @@ doengrave() You_cant("write here."); return 0; } - if (cantwield(youmonst.data)) { + if (cantwield(g.youmonst.data)) { You_cant("even hold anything!"); return 0; } @@ -1151,7 +1151,7 @@ doengrave() if (post_engr_text[0]) pline("%s", post_engr_text); - if (doblind && !resists_blnd(&youmonst)) { + if (doblind && !resists_blnd(&g.youmonst)) { 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 4ba12aa93..6a935fb55 100644 --- a/src/exper.c +++ b/src/exper.c @@ -194,7 +194,7 @@ const char *drainer; /* cause of death, if drain should be fatal */ wizard mode request to reduce level; never fatal though */ if (drainer && !strcmp(drainer, "#levelchange")) drainer = 0; - else if (resists_drli(&youmonst)) + else if (resists_drli(&g.youmonst)) return; if (u.ulevel > 1) { @@ -236,7 +236,7 @@ const char *drainer; /* cause of death, if drain should be fatal */ u.uexp = newuexp(u.ulevel) - 1; if (Upolyd) { - num = monhp_per_lvl(&youmonst); + num = monhp_per_lvl(&g.youmonst); u.mhmax -= num; u.mh -= num; if (u.mh <= 0) @@ -271,7 +271,7 @@ boolean incr; /* true iff via incremental experience growth */ /* 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(&youmonst); + hpinc = monhp_per_lvl(&g.youmonst); u.mhmax += hpinc; u.mh += hpinc; } diff --git a/src/explode.c b/src/explode.c index 405c77b2f..ccecca7ed 100644 --- a/src/explode.c +++ b/src/explode.c @@ -92,7 +92,7 @@ int expltype; so might get hit by double damage */ grabbed = grabbing = FALSE; if (u.ustuck && !u.uswallow) { - if (Upolyd && sticks(youmonst.data)) + if (Upolyd && sticks(g.youmonst.data)) grabbing = TRUE; else grabbed = TRUE; @@ -184,8 +184,8 @@ int expltype; break; case AD_DISN: explmask[i][j] = (olet == WAND_CLASS) - ? !!(nonliving(youmonst.data) - || is_demon(youmonst.data)) + ? !!(nonliving(g.youmonst.data) + || is_demon(g.youmonst.data)) : !!Disint_resistance; break; case AD_ELEC: @@ -501,7 +501,7 @@ int expltype; } else if (adtyp == AD_PHYS || physical_dmg) damu = Maybe_Half_Phys(damu); if (adtyp == AD_FIRE) - (void) burnarmor(&youmonst); + (void) burnarmor(&g.youmonst); destroy_item(SCROLL_CLASS, (int) adtyp); destroy_item(SPBOOK_CLASS, (int) adtyp); destroy_item(POTION_CLASS, (int) adtyp); @@ -726,9 +726,9 @@ struct obj *obj; /* only scatter this obj */ if (g.multi) nomul(0); hitvalu = 8 + stmp->obj->spe; - if (bigmonst(youmonst.data)) + if (bigmonst(g.youmonst.data)) hitvalu++; - hitu = thitu(hitvalu, dmgval(stmp->obj, &youmonst), + hitu = thitu(hitvalu, dmgval(stmp->obj, &g.youmonst), &stmp->obj, (char *) 0); if (!stmp->obj) stmp->stopped = TRUE; diff --git a/src/files.c b/src/files.c index 51f6f8b2a..7c7de3e67 100644 --- a/src/files.c +++ b/src/files.c @@ -2313,7 +2313,7 @@ char *origbuf; #else /*NOCWD_ASSUMPTIONS*/ #ifdef MICRO } else if (match_varname(buf, "HACKDIR", 4)) { - (void) strncpy(hackdir, bufp, PATHLEN - 1); + (void) strncpy(g.hackdir, bufp, PATHLEN - 1); #ifdef MFLOPPY } else if (match_varname(buf, "RAMDISK", 3)) { /* The following ifdef is NOT in the wrong @@ -2938,7 +2938,7 @@ struct obj *obj; obj->bknown = 1; /* same criteria as lift_object()'s check for available inventory slot */ if (obj->oclass != COIN_CLASS && inv_cnt(FALSE) >= 52 - && !merge_choice(invent, obj)) { + && !merge_choice(g.invent, obj)) { /* inventory overflow; can't just place & stack object since hero isn't in position yet, so schedule for arrival later */ add_to_migration(obj); diff --git a/src/fountain.c b/src/fountain.c index 1d53f7664..c316aac7f 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -299,7 +299,7 @@ drinkfountain() pline("This water's no good!"); morehungry(rn1(20, 11)); exercise(A_CON, FALSE); - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if (!rn2(5)) curse(obj); break; @@ -457,13 +457,13 @@ register struct obj *obj; case 28: /* Strange feeling */ pline("An urge to take a bath overwhelms you."); { - long money = money_cnt(invent); + long money = money_cnt(g.invent); struct obj *otmp; if (money > 10) { /* Amount to lose. Might get rounded up as fountains don't * pay change... */ money = somegold(money) / 10; - for (otmp = invent; otmp && money > 0; otmp = otmp->nobj) + for (otmp = g.invent; otmp && money > 0; otmp = otmp->nobj) if (otmp->oclass == COIN_CLASS) { int denomination = objects[otmp->otyp].oc_cost; long coin_loss = diff --git a/src/hack.c b/src/hack.c index 7012deb37..e39473982 100644 --- a/src/hack.c +++ b/src/hack.c @@ -121,7 +121,7 @@ moverock() /* Give them a chance to climb over it? */ return -1; } - if (verysmall(youmonst.data) && !u.usteed) { + if (verysmall(g.youmonst.data) && !u.usteed) { if (Blind) feel_location(sx, sy); pline("You're too small to push that %s.", xname(otmp)); @@ -281,7 +281,7 @@ moverock() if (!u.usteed) { if (g.moves > lastmovetime + 2 || g.moves < lastmovetime) pline("With %s effort you move %s.", - throws_rocks(youmonst.data) ? "little" + throws_rocks(g.youmonst.data) ? "little" : "great", the(xname(otmp))); exercise(A_STR, TRUE); @@ -311,7 +311,7 @@ moverock() if (Blind) feel_location(sx, sy); cannot_push: - if (throws_rocks(youmonst.data)) { + if (throws_rocks(g.youmonst.data)) { boolean canpickup = (!Sokoban /* similar exception as in can_lift(): @@ -343,10 +343,10 @@ moverock() } if (!u.usteed - && (((!invent || inv_weight() <= -850) + && (((!g.invent || inv_weight() <= -850) && (!u.dx || !u.dy || (IS_ROCK(levl[u.ux][sy].typ) && IS_ROCK(levl[sx][u.uy].typ)))) - || verysmall(youmonst.data))) { + || verysmall(g.youmonst.data))) { pline( "However, you can squeeze yourself into a small opening."); sokoban_guilt(); @@ -663,13 +663,13 @@ struct monst *mon; return 1; /* lugging too much junk? */ - amt = (mon == &youmonst) ? inv_weight() + weight_cap() + amt = (mon == &g.youmonst) ? inv_weight() + weight_cap() : curr_mon_load(mon); if (amt > 600) return 2; /* Sokoban restriction applies to hero only */ - if (mon == &youmonst && Sokoban) + if (mon == &g.youmonst && Sokoban) return 3; /* can squeeze through */ @@ -715,17 +715,17 @@ int mode; pline("There is an obstacle there."); return FALSE; } else if (tmpr->typ == IRONBARS) { - if ((dmgtype(youmonst.data, AD_RUST) - || dmgtype(youmonst.data, AD_CORR)) && mode == DO_MOVE + if ((dmgtype(g.youmonst.data, AD_RUST) + || dmgtype(g.youmonst.data, AD_CORR)) && mode == DO_MOVE && still_chewing(x, y)) { return FALSE; } - if (!(Passes_walls || passes_bars(youmonst.data))) { + if (!(Passes_walls || passes_bars(g.youmonst.data))) { if (mode == DO_MOVE && iflags.mention_walls) You("cannot pass through the bars."); return FALSE; } - } else if (tunnels(youmonst.data) && !needspick(youmonst.data)) { + } else if (tunnels(g.youmonst.data) && !needspick(g.youmonst.data)) { /* Eat the rock. */ if (mode == DO_MOVE && still_chewing(x, y)) return FALSE; @@ -757,20 +757,20 @@ int mode; feel_location(x, y); if (Passes_walls) { ; /* do nothing */ - } else if (can_ooze(&youmonst)) { + } else if (can_ooze(&g.youmonst)) { 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(youmonst.data) && !needspick(youmonst.data)) { + } else if (tunnels(g.youmonst.data) && !needspick(g.youmonst.data)) { /* Eat the door. */ if (mode == DO_MOVE && still_chewing(x, y)) return FALSE; } else { if (mode == DO_MOVE) { - if (amorphous(youmonst.data)) + if (amorphous(g.youmonst.data)) You( "try to ooze under the door, but can't squeeze your possessions through."); if (flags.autoopen && !context.run && !Confusion @@ -809,10 +809,10 @@ int mode; } } } - if (dx && dy && bad_rock(youmonst.data, ux, y) - && bad_rock(youmonst.data, x, uy)) { + if (dx && dy && bad_rock(g.youmonst.data, ux, y) + && bad_rock(g.youmonst.data, x, uy)) { /* Move at a diagonal. */ - switch (cant_squeeze_thru(&youmonst)) { + switch (cant_squeeze_thru(&g.youmonst)) { case 3: if (mode == DO_MOVE) You("cannot pass that way."); @@ -842,7 +842,7 @@ int mode; struct trap *t = t_at(x, y); if ((t && t->tseen) - || (!Levitation && !Flying && !is_clinger(youmonst.data) + || (!Levitation && !Flying && !is_clinger(g.youmonst.data) && is_pool_or_lava(x, y) && levl[x][y].seenv)) return (mode == TEST_TRAP); } @@ -870,7 +870,7 @@ int mode; } if (mode == DO_MOVE) { /* tunneling monsters will chew before pushing */ - if (tunnels(youmonst.data) && !needspick(youmonst.data) + if (tunnels(g.youmonst.data) && !needspick(g.youmonst.data) && !Sokoban) { if (still_chewing(x, y)) return FALSE; @@ -886,7 +886,7 @@ int mode; /* don't pick two boulders in a row, unless there's a way thru */ if (sobj_at(BOULDER, ux, uy) && !Sokoban) { if (!Passes_walls - && !(tunnels(youmonst.data) && !needspick(youmonst.data)) + && !(tunnels(g.youmonst.data) && !needspick(g.youmonst.data)) && !carrying(PICK_AXE) && !carrying(DWARVISH_MATTOCK) && !((obj = carrying(WAN_DIGGING)) && !objects[obj->otyp].oc_name_known)) @@ -1014,7 +1014,7 @@ int mode; if (!isok(nx, ny) || ((mode == TRAVP_GUESS) && !couldsee(nx, ny))) continue; - if ((!Passes_walls && !can_ooze(&youmonst) + if ((!Passes_walls && !can_ooze(&g.youmonst) && closed_door(x, y)) || sobj_at(BOULDER, x, y) || test_move(x, y, nx-x, ny-y, TEST_TRAP)) { /* closed doors and boulders usually @@ -1314,7 +1314,7 @@ wriggle_free: boolean u_rooted() { - if (!youmonst.data->mmove) { + if (!g.youmonst.data->mmove) { You("are rooted %s.", Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) ? "in place" @@ -1390,9 +1390,9 @@ domove() if (!skates) skates = find_skates(); - if ((uarmf && uarmf->otyp == skates) || resists_cold(&youmonst) - || Flying || is_floater(youmonst.data) - || is_clinger(youmonst.data) || is_whirly(youmonst.data)) { + if ((uarmf && uarmf->otyp == skates) || resists_cold(&g.youmonst) + || Flying || is_floater(g.youmonst.data) + || is_clinger(g.youmonst.data) || is_whirly(g.youmonst.data)) { on_ice = FALSE; } else if (!rn2(Cold_resistance ? 3 : 2)) { HFumbling |= FROMOUTSIDE; @@ -1416,7 +1416,7 @@ domove() confdir(); x = u.ux + u.dx; y = u.uy + u.dy; - } while (!isok(x, y) || bad_rock(youmonst.data, x, y)); + } while (!isok(x, y) || bad_rock(g.youmonst.data, x, y)); } /* turbulence might alter your actual destination */ if (u.uinwater) { @@ -1446,7 +1446,7 @@ domove() return; } if (((trap = t_at(x, y)) && trap->tseen) - || (Blind && !Levitation && !Flying && !is_clinger(youmonst.data) + || (Blind && !Levitation && !Flying && !is_clinger(g.youmonst.data) && is_pool_or_lava(x, y) && levl[x][y].seenv)) { if (context.run >= 2) { if (iflags.mention_walls) { @@ -1471,7 +1471,7 @@ domove() if (distu(u.ustuck->mx, u.ustuck->my) > 2) { /* perhaps it fled (or was teleported or ... ) */ u.ustuck = 0; - } else if (sticks(youmonst.data)) { + } else if (sticks(g.youmonst.data)) { /* When polymorphed into a sticking monster, * u.ustuck means it's stuck to you, not you to it. */ @@ -1598,7 +1598,7 @@ domove() /* remembered an 'I' && didn't use a move command */ || (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) { struct obj *boulder = 0; - boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)), + boolean explo = (Upolyd && attacktype(g.youmonst.data, AT_EXPL)), solid = !accessible(x, y); int glyph = glyph_at(x, y); /* might be monster */ char buf[BUFSZ]; @@ -1842,18 +1842,18 @@ domove() nomul(0); } - if (hides_under(youmonst.data) || youmonst.data->mlet == S_EEL + if (hides_under(g.youmonst.data) || g.youmonst.data->mlet == S_EEL || u.dx || u.dy) - (void) hideunder(&youmonst); + (void) hideunder(&g.youmonst); /* * Mimics (or whatever) become noticeable if they move and are * imitating something that doesn't move. We could extend this * to non-moving monsters... */ - if ((u.dx || u.dy) && (youmonst.m_ap_type == M_AP_OBJECT - || youmonst.m_ap_type == M_AP_FURNITURE)) - youmonst.m_ap_type = M_AP_NOTHING; + if ((u.dx || u.dy) && (g.youmonst.m_ap_type == M_AP_OBJECT + || g.youmonst.m_ap_type == M_AP_FURNITURE)) + g.youmonst.m_ap_type = M_AP_NOTHING; check_leash(u.ux0, u.uy0); @@ -2405,7 +2405,7 @@ register boolean newlev; break; case MORGUE: if (midnight()) { - const char *run = locomotion(youmonst.data, "Run"); + const char *run = locomotion(g.youmonst.data, "Run"); pline("%s away! %s away!", run, run); } else You("have an uncanny feeling..."); @@ -2515,7 +2515,7 @@ pickup_checks() } } if (is_pool(u.ux, u.uy)) { - if (Wwalking || is_floater(youmonst.data) || is_clinger(youmonst.data) + if (Wwalking || is_floater(g.youmonst.data) || is_clinger(g.youmonst.data) || (Flying && !Breathless)) { You("cannot dive into the %s to pick things up.", hliquid("water")); @@ -2526,11 +2526,11 @@ pickup_checks() } } if (is_lava(u.ux, u.uy)) { - if (Wwalking || is_floater(youmonst.data) || is_clinger(youmonst.data) + if (Wwalking || is_floater(g.youmonst.data) || is_clinger(g.youmonst.data) || (Flying && !Breathless)) { You_cant("reach the bottom to pick things up."); return 0; - } else if (!likes_lava(youmonst.data)) { + } else if (!likes_lava(g.youmonst.data)) { You("would burn to a crisp trying to pick things up."); return 0; } @@ -2687,7 +2687,7 @@ lookaround() /* water and lava only stop you if directly in front, and stop * you even if you are running */ - if (!Levitation && !Flying && !is_clinger(youmonst.data) + if (!Levitation && !Flying && !is_clinger(g.youmonst.data) && x == u.ux + u.dx && y == u.uy + u.dy) { /* No Wwalking check; otherwise they'd be able * to test boots by trying to SHIFT-direction @@ -2772,7 +2772,7 @@ crawl_destination(x, y) int x, y; { /* is location ok in general? */ - if (!goodpos(x, y, &youmonst, 0)) + if (!goodpos(x, y, &g.youmonst, 0)) return FALSE; /* orthogonal movement is unrestricted when destination is ok */ @@ -2788,8 +2788,8 @@ int x, 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(youmonst.data, u.ux, y) - && bad_rock(youmonst.data, x, u.uy)); + return !(bad_rock(g.youmonst.data, u.ux, y) + && bad_rock(g.youmonst.data, x, u.uy)); } /* something like lookaround, but we are not running */ @@ -2945,14 +2945,14 @@ weight_cap() carrcap = 25 * (ACURRSTR + ACURR(A_CON)) + 50; if (Upolyd) { /* consistent with can_carry() in mon.c */ - if (youmonst.data->mlet == S_NYMPH) + if (g.youmonst.data->mlet == S_NYMPH) carrcap = MAX_CARR_CAP; - else if (!youmonst.data->cwt) - carrcap = (carrcap * (long) youmonst.data->msize) / MZ_HUMAN; - else if (!strongmonst(youmonst.data) - || (strongmonst(youmonst.data) - && (youmonst.data->cwt > WT_HUMAN))) - carrcap = (carrcap * (long) youmonst.data->cwt / WT_HUMAN); + else if (!g.youmonst.data->cwt) + carrcap = (carrcap * (long) g.youmonst.data->msize) / MZ_HUMAN; + else if (!strongmonst(g.youmonst.data) + || (strongmonst(g.youmonst.data) + && (g.youmonst.data->cwt > WT_HUMAN))) + carrcap = (carrcap * (long) g.youmonst.data->cwt / WT_HUMAN); } if (Levitation || Is_airlevel(&u.uz) /* pugh@cornell */ @@ -2985,13 +2985,13 @@ weight_cap() int inv_weight() { - register struct obj *otmp = invent; + register struct obj *otmp = g.invent; register int wt = 0; while (otmp) { if (otmp->oclass == COIN_CLASS) wt += (int) (((long) otmp->quan + 50L) / 100L); - else if (otmp->otyp != BOULDER || !throws_rocks(youmonst.data)) + else if (otmp->otyp != BOULDER || !throws_rocks(g.youmonst.data)) wt += otmp->owt; otmp = otmp->nobj; } @@ -3049,7 +3049,7 @@ int inv_cnt(incl_gold) boolean incl_gold; { - register struct obj *otmp = invent; + register struct obj *otmp = g.invent; register int ct = 0; while (otmp) { diff --git a/src/invent.c b/src/invent.c index 4ee3ea186..5a3c0beb4 100644 --- a/src/invent.c +++ b/src/invent.c @@ -559,7 +559,7 @@ register struct obj *otmp; for (i = 0; i < 52; i++) inuse[i] = FALSE; - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if (obj != otmp) { i = obj->invlet; if ('a' <= i && i <= 'z') @@ -601,14 +601,14 @@ reorder_invent() * isn't nearly as inefficient as it may first appear. */ need_more_sorting = FALSE; - for (otmp = invent, prev = 0; otmp;) { + for (otmp = g.invent, prev = 0; otmp;) { next = otmp->nobj; if (next && inv_rank(next) < inv_rank(otmp)) { need_more_sorting = TRUE; if (prev) prev->nobj = next; else - invent = next; + g.invent = next; otmp->nobj = next->nobj; next->nobj = otmp; prev = next; @@ -638,7 +638,7 @@ struct obj *objlist, *obj; have when carried are different from what they are now; prevent that from eliciting an incorrect result from mergable() */ save_nocharge = obj->no_charge; - if (objlist == invent && obj->where == OBJ_FLOOR + if (objlist == g.invent && obj->where == OBJ_FLOOR && (shkp = shop_keeper(inside_shop(obj->ox, obj->oy))) != 0) { if (obj->no_charge) obj->no_charge = 0; @@ -871,7 +871,7 @@ struct obj *obj; goto added; } /* merge if possible; find end of chain in the process */ - for (prev = 0, otmp = invent; otmp; prev = otmp, otmp = otmp->nobj) + for (prev = 0, otmp = g.invent; otmp; prev = otmp, otmp = otmp->nobj) if (merged(&otmp, &obj)) { obj = otmp; if (!obj) @@ -881,8 +881,8 @@ struct obj *obj; /* didn't merge, so insert into chain */ assigninvlet(obj); if (flags.invlet_constant || !prev) { - obj->nobj = invent; /* insert at beginning */ - invent = obj; + obj->nobj = g.invent; /* insert at beginning */ + g.invent = obj; if (flags.invlet_constant) reorder_invent(); } else { @@ -951,7 +951,7 @@ const char *drop_fmt, *drop_arg, *hold_msg; /* in case touching this object turns out to be fatal */ place_object(obj, u.ux, u.uy); - if (!touch_artifact(obj, &youmonst)) { + if (!touch_artifact(obj, &g.youmonst)) { obj_extract_self(obj); /* remove it from the floor */ dropy(obj); /* now put it back again :-) */ return obj; @@ -1110,7 +1110,7 @@ void freeinv(obj) register struct obj *obj; { - extract_nobj(obj, &invent); + extract_nobj(obj, &g.invent); freeinv_core(obj); update_inventory(); } @@ -1197,7 +1197,7 @@ register int type; { register struct obj *otmp; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->otyp == type) return otmp; return (struct obj *) 0; @@ -1247,7 +1247,7 @@ have_lizard() { register struct obj *otmp; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->otyp == CORPSE && otmp->corpsenm == PM_LIZARD) return TRUE; return FALSE; @@ -1259,7 +1259,7 @@ u_have_novel() { register struct obj *otmp; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->otyp == SPE_NOVEL) return otmp; return (struct obj *) 0; @@ -1410,8 +1410,8 @@ register const char *let, *word; /* Equivalent of an "ugly check" for gold */ if (usegold && !strcmp(word, "eat") - && (!metallivorous(youmonst.data) - || youmonst.data == &mons[PM_RUST_MONSTER])) + && (!metallivorous(g.youmonst.data) + || g.youmonst.data == &mons[PM_RUST_MONSTER])) usegold = FALSE; if (*let == ALL_CLASSES) @@ -1429,7 +1429,7 @@ register const char *let, *word; /* another ugly check: show boulders (not statues) */ if (*let == WEAPON_CLASS && !strcmp(word, "throw") - && throws_rocks(youmonst.data)) + && throws_rocks(g.youmonst.data)) useboulder = TRUE; if (allownone) @@ -1441,7 +1441,7 @@ register const char *let, *word; /* force invent to be in invlet order before collecting candidate inventory letters */ - sortedinvent = sortloot(&invent, SORTLOOT_INVLET, FALSE, + sortedinvent = sortloot(&g.invent, SORTLOOT_INVLET, FALSE, (boolean FDECL((*), (OBJ_P))) 0); for (srtinv = sortedinvent; (otmp = srtinv->obj) != 0; ++srtinv) { @@ -1712,7 +1712,7 @@ redo_menu: /* they typed a letter (not a space) at the prompt */ } /* find the item which was picked */ - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->invlet == ilet) break; /* some items have restrictions */ @@ -1900,7 +1900,7 @@ unsigned *resultflags; char extra_removeables[3 + 1]; /* uwep,uswapwep,uquiver */ char buf[BUFSZ] = DUMMY, qbuf[QBUFSZ]; - if (!invent) { + if (!g.invent) { You("have nothing to %s.", word); if (resultflags) *resultflags = ALL_FINISHED; @@ -1918,22 +1918,22 @@ unsigned *resultflags; ofilter = not_fully_identified; } - iletct = collect_obj_classes(ilets, invent, FALSE, ofilter, &itemcount); - unpaid = count_unpaid(invent); + iletct = collect_obj_classes(ilets, g.invent, FALSE, ofilter, &itemcount); + unpaid = count_unpaid(g.invent); if (ident && !iletct) { return -1; /* no further identifications */ - } else if (invent) { + } else if (g.invent) { ilets[iletct++] = ' '; if (unpaid) ilets[iletct++] = 'u'; - if (count_buc(invent, BUC_BLESSED, ofilter)) + if (count_buc(g.invent, BUC_BLESSED, ofilter)) ilets[iletct++] = 'B'; - if (count_buc(invent, BUC_UNCURSED, ofilter)) + if (count_buc(g.invent, BUC_UNCURSED, ofilter)) ilets[iletct++] = 'U'; - if (count_buc(invent, BUC_CURSED, ofilter)) + if (count_buc(g.invent, BUC_CURSED, ofilter)) ilets[iletct++] = 'C'; - if (count_buc(invent, BUC_UNKNOWN, ofilter)) + if (count_buc(g.invent, BUC_UNKNOWN, ofilter)) ilets[iletct++] = 'X'; ilets[iletct++] = 'a'; } @@ -1955,7 +1955,7 @@ unsigned *resultflags; /* applicable inventory letters; if empty, show entire invent */ ailets[0] = '\0'; if (ofilter) - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) /* index() check: limit overflow items to one '#' */ if ((*ofilter)(otmp) && !index(ailets, otmp->invlet)) (void) strkitten(ailets, otmp->invlet); @@ -2045,7 +2045,7 @@ unsigned *resultflags; return 1; /* you dropped gold (or at least tried to) */ #endif } else { - int cnt = askchain(&invent, olets, allflag, fn, ckfn, mx, word); + int cnt = askchain(&g.invent, olets, allflag, fn, ckfn, mx, word); /* * askchain() has already finished the job in this case * so set a special flag to convey that back to the caller @@ -2085,7 +2085,7 @@ int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P)); put_in = !strcmp(word, "put in"); nodot = (!strcmp(word, "nodot") || !strcmp(word, "drop") || ident || takeoff || take_out || put_in); - ininv = (*objchn == invent); + ininv = (*objchn == g.invent); bycat = (menu_class_present('u') || menu_class_present('B') || menu_class_present('U') || menu_class_present('C') || menu_class_present('X')); @@ -2106,7 +2106,7 @@ nextclass: if (*objchn && (*objchn)->oclass == COIN_CLASS) ilet--; /* extra iteration */ /* - * Multiple Drop can change the invent chain while it operates + * Multiple Drop can change the g.invent chain while it operates * (dropping a burning potion of oil while levitating creates * an explosion which can destroy inventory items), so simple * list traversal @@ -2259,7 +2259,7 @@ int id_limit; while (id_limit) { Sprintf(buf, "What would you like to identify %s?", first ? "first" : "next"); - n = query_objlist(buf, &invent, (SIGNAL_NOMENU | SIGNAL_ESCAPE + n = query_objlist(buf, &g.invent, (SIGNAL_NOMENU | SIGNAL_ESCAPE | USE_INVLET | INVORDER_SORT), &pick_list, PICK_ANY, not_fully_identified); @@ -2305,7 +2305,7 @@ int id_limit; boolean learning_id; /* true if we just read unknown identify scroll */ { struct obj *obj; - int n, unid_cnt = count_unidentified(invent); + int n, unid_cnt = count_unidentified(g.invent); if (!unid_cnt) { You("have already identified all %sof your possessions.", @@ -2313,7 +2313,7 @@ boolean learning_id; /* true if we just read unknown identify scroll */ } else if (!id_limit || id_limit >= unid_cnt) { /* identify everything */ /* TODO: use fully_identify_obj and cornline/menu/whatever here */ - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { if (not_fully_identified(obj)) { (void) identify(obj); if (unid_cnt == 1) @@ -2346,7 +2346,7 @@ learn_unseen_invent() if (Blind) return; /* sanity check */ - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (otmp->dknown) continue; /* already seen */ /* set dknown, perhaps bknown (for priest[ess]) */ @@ -2538,9 +2538,9 @@ long *out_cnt; */ n = (iflags.perm_invent && !lets && !want_reply) ? 2 : lets ? (int) strlen(lets) - : !invent ? 0 : !invent->nobj ? 1 : 2; + : !g.invent ? 0 : !g.invent->nobj ? 1 : 2; /* for xtra_choice, there's another 'item' not included in initial 'n'; - for !lets (full invent) and for override_ID (wizard mode identify), + for !lets (full g.invent) and for override_ID (wizard mode identify), skip message_menu handling of single item even if item count was 1 */ if (xtra_choice || (n == 1 && (!lets || iflags.override_ID))) ++n; @@ -2566,7 +2566,7 @@ long *out_cnt; xprname((struct obj *) 0, xtra_choice, HANDS_SYM, TRUE, 0L, 0L)); /* '-' */ } else { - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (!lets || otmp->invlet == lets[0]) break; if (otmp) @@ -2583,7 +2583,7 @@ long *out_cnt; sortflags = (flags.sortloot == 'f') ? SORTLOOT_LOOT : SORTLOOT_INVLET; if (flags.sortpack) sortflags |= SORTLOOT_PACK; - sortedinvent = sortloot(&invent, sortflags, FALSE, + sortedinvent = sortloot(&g.invent, sortflags, FALSE, (boolean FDECL((*), (OBJ_P))) 0); start_menu(win); @@ -2592,7 +2592,7 @@ long *out_cnt; int unid_cnt; char prompt[QBUFSZ]; - unid_cnt = count_unidentified(invent); + unid_cnt = count_unidentified(g.invent); Sprintf(prompt, "Debug Identify"); /* 'title' rather than 'prompt' */ if (unid_cnt) Sprintf(eos(prompt), @@ -2742,13 +2742,13 @@ char avoidlet; anything any; menu_item *selected; - if (invent) { + if (g.invent) { win = create_nhwindow(NHW_MENU); start_menu(win); while (!invdone) { any = zeroany; /* set all bits to zero */ classcount = 0; - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { ilet = otmp->invlet; if (ilet == avoidlet) continue; @@ -2911,11 +2911,11 @@ dounpaid() int classcount, count, num_so_far; long cost, totcost; - count = count_unpaid(invent); + count = count_unpaid(g.invent); otmp = marker = contnr = (struct obj *) 0; if (count == 1) { - otmp = find_unpaid(invent, &marker); + otmp = find_unpaid(g.invent, &marker); contnr = unknwn_contnr_contents(otmp); } if (otmp && !contnr) { @@ -2937,7 +2937,7 @@ dounpaid() do { classcount = 0; - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { ilet = otmp->invlet; if (otmp->unpaid) { if (!flags.sortpack || otmp->oclass == *invlet) { @@ -2966,7 +2966,7 @@ dounpaid() * unpaid items. The top level inventory items have already * been listed. */ - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (Has_contents(otmp)) { long contcost = 0L; @@ -3049,12 +3049,12 @@ dotypeinv() boolean traditional = TRUE; const char *prompt = "What type of object do you want an inventory of?"; - if (!invent && !billx) { + if (!g.invent && !billx) { You("aren't carrying anything."); return 0; } - unpaid_count = count_unpaid(invent); - tally_BUCX(invent, FALSE, &bcnt, &ucnt, &ccnt, &xcnt, &ocnt); + unpaid_count = count_unpaid(g.invent); + tally_BUCX(g.invent, FALSE, &bcnt, &ucnt, &ccnt, &xcnt, &ocnt); if (flags.menu_style != MENU_TRADITIONAL) { if (flags.menu_style == MENU_FULL @@ -3071,7 +3071,7 @@ dotypeinv() i |= BUC_CURSED; if (xcnt) i |= BUC_UNKNOWN; - n = query_category(prompt, invent, i, &pick_list, PICK_ONE); + n = query_category(prompt, g.invent, i, &pick_list, PICK_ONE); if (!n) return 0; g.this_type = c = pick_list[0].item.a_int; @@ -3082,7 +3082,7 @@ dotypeinv() /* collect a list of classes of objects carried, for use as a prompt */ types[0] = 0; - class_count = collect_obj_classes(types, invent, FALSE, + class_count = collect_obj_classes(types, g.invent, FALSE, (boolean FDECL((*), (OBJ_P))) 0, &itemcount); if (unpaid_count || billx || (bcnt + ccnt + ucnt + xcnt) != 0) @@ -3194,7 +3194,7 @@ dotypeinv() } g.this_type = oclass; } - if (query_objlist((char *) 0, &invent, + if (query_objlist((char *) 0, &g.invent, ((flags.invlet_constant ? USE_INVLET : 0) | INVORDER_SORT), &pick_list, PICK_NONE, this_type_only) > 0) @@ -3395,7 +3395,7 @@ boolean picked_some; ? "They're" : "It's", corpse_xname(otmp, (const char *) 0, CXN_ARTICLE), - poly_when_stoned(youmonst.data) + poly_when_stoned(g.youmonst.data) ? "" : ", unfortunately"); feel_cockatrice(otmp, FALSE); @@ -3479,7 +3479,7 @@ boolean force_touch; /* "the corpse" */ Strcpy(kbuf, corpse_xname(otmp, (const char *) 0, CXN_PFX_THE)); - if (poly_when_stoned(youmonst.data)) + if (poly_when_stoned(g.youmonst.data)) You("touched %s with your bare %s.", kbuf, makeplural(body_part(HAND))); else @@ -3602,7 +3602,7 @@ doprgold() { /* the messages used to refer to "carrying gold", but that didn't take containers into account */ - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); if (!umoney) Your("wallet is empty."); @@ -3736,7 +3736,7 @@ doprtool() int ct = 0; char lets[52 + 1]; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (tool_in_use(otmp)) lets[ct++] = obj_to_let(otmp); lets[ct] = '\0'; @@ -3756,7 +3756,7 @@ doprinuse() int ct = 0; char lets[52 + 1]; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (is_worn(otmp) || tool_in_use(otmp)) lets[ct++] = obj_to_let(otmp); lets[ct] = '\0'; @@ -3791,8 +3791,8 @@ long numused; (void) stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE); } delobj(otmp); - if (at_u && u.uundetected && hides_under(youmonst.data)) - (void) hideunder(&youmonst); + if (at_u && u.uundetected && hides_under(g.youmonst.data)) + (void) hideunder(&g.youmonst); } /* @@ -3870,24 +3870,24 @@ reassign() /* first, remove [first instance of] gold from invent, if present */ prevobj = goldobj = 0; - for (obj = invent; obj; prevobj = obj, obj = obj->nobj) + for (obj = g.invent; obj; prevobj = obj, obj = obj->nobj) if (obj->oclass == COIN_CLASS) { goldobj = obj; if (prevobj) prevobj->nobj = goldobj->nobj; else - invent = goldobj->nobj; + g.invent = goldobj->nobj; break; } /* second, re-letter the rest of the list */ - for (obj = invent, i = 0; obj; obj = obj->nobj, i++) + for (obj = g.invent, i = 0; obj; obj = obj->nobj, i++) obj->invlet = (i < 26) ? ('a' + i) : (i < 52) ? ('A' + i - 26) : NOINVSYM; /* third, assign gold the "letter" '$' and re-insert it at head */ if (goldobj) { goldobj->invlet = GOLD_SYM; - goldobj->nobj = invent; - invent = goldobj; + goldobj->nobj = g.invent; + g.invent = goldobj; } if (i >= 52) i = 52 - 1; @@ -3951,7 +3951,7 @@ doorganize() /* inventory organizer by Del Lamb */ const char *adj_type; boolean ever_mind = FALSE, collect; - if (!invent) { + if (!g.invent) { You("aren't carrying anything to adjust."); return 0; } @@ -3962,7 +3962,7 @@ doorganize() /* inventory organizer by Del Lamb */ allowall[0] = ALLOW_COUNT; allowall[1] = ALL_CLASSES; allowall[2] = '\0'; - for (goldstacks = 0, otmp = invent; otmp; otmp = otmp->nobj) { + for (goldstacks = 0, otmp = g.invent; otmp; otmp = otmp->nobj) { /* gold should never end up in a letter slot, nor should two '$' slots occur, but if they ever do, allow #adjust to handle them (in the past, things like this have happened, usually due to @@ -3981,7 +3981,7 @@ doorganize() /* inventory organizer by Del Lamb */ /* figure out whether user gave a split count to getobj() */ splitting = bumped = 0; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->nobj == obj) { /* knowledge of splitobj() operation */ if (otmp->invlet == obj->invlet) splitting = otmp; @@ -4002,7 +4002,7 @@ doorganize() /* inventory organizer by Del Lamb */ /* blank out all the letters currently in use in the inventory except those that will be merged with the selected object */ - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp != obj && !mergable(otmp, obj)) { let = otmp->invlet; if (let >= 'a' && let <= 'z') @@ -4026,7 +4026,7 @@ doorganize() /* inventory organizer by Del Lamb */ /* get 'to' slot to use as destination */ Sprintf(qbuf, "Adjust letter to what [%s]%s?", lets, - invent ? " (? see used letters)" : ""); + g.invent ? " (? see used letters)" : ""); for (trycnt = 1; ; ++trycnt) { let = yn_function(qbuf, (char *) 0, '\0'); if (let == '?' || let == '*') { @@ -4071,9 +4071,9 @@ doorganize() /* inventory organizer by Del Lamb */ * don't use freeinv/addinv to avoid double-touching artifacts, * dousing lamps, losing luck, cursing loadstone, etc. */ - extract_nobj(obj, &invent); + extract_nobj(obj, &g.invent); - for (otmp = invent; otmp;) { + for (otmp = g.invent; otmp;) { /* it's tempting to pull this outside the loop, but merged() could free ONAME(obj) [via obfree()] and replace it with ONAME(otmp) */ objname = has_oname(obj) ? ONAME(obj) : (char *) 0; @@ -4091,7 +4091,7 @@ doorganize() /* inventory organizer by Del Lamb */ adj_type = "Merging:"; obj = otmp; otmp = otmp->nobj; - extract_nobj(obj, &invent); + extract_nobj(obj, &g.invent); continue; /* otmp has already been updated */ } } else if (otmp->invlet == let) { @@ -4118,7 +4118,7 @@ doorganize() /* inventory organizer by Del Lamb */ if (merged(&otmp, &obj)) { adj_type = "Splitting and merging:"; obj = otmp; - extract_nobj(obj, &invent); + extract_nobj(obj, &g.invent); } else if (inv_cnt(FALSE) >= 52) { (void) merged(&splitting, &obj); /* undo split */ /* "knapsack cannot accommodate any more items" */ @@ -4126,7 +4126,7 @@ doorganize() /* inventory organizer by Del Lamb */ return 0; } else { bumped = otmp; - extract_nobj(bumped, &invent); + extract_nobj(bumped, &g.invent); } } /* moving vs splitting */ break; /* not collecting and found 'to' slot */ @@ -4136,18 +4136,18 @@ doorganize() /* inventory organizer by Del Lamb */ /* inline addinv; insert loose object at beginning of inventory */ obj->invlet = let; - obj->nobj = invent; + obj->nobj = g.invent; obj->where = OBJ_INVENT; - invent = obj; + g.invent = obj; reorder_invent(); if (bumped) { /* splitting the 'from' stack is causing an incompatible stack in the 'to' slot to be moved into an open one; we need to do another inline insertion to inventory */ assigninvlet(bumped); - bumped->nobj = invent; + bumped->nobj = g.invent; bumped->where = OBJ_INVENT; - invent = bumped; + g.invent = bumped; reorder_invent(); } @@ -4240,7 +4240,7 @@ char *title; /* Fool the 'weapon in hand' routine into * displaying 'weapon in claw', etc. properly. */ - youmonst.data = mon->data; + g.youmonst.data = mon->data; n = query_objlist(title ? title : tmp, &(mon->minvent), (INVORDER_SORT | (incl_hero ? INCLUDE_HERO : 0)), diff --git a/src/light.c b/src/light.c index b1a67fc99..0abc99646 100644 --- a/src/light.c +++ b/src/light.c @@ -14,8 +14,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 both youmonst.m_id and - * youmonst.mx will always remain 0. + * polymorphed-player handling assumes that both g.youmonst.m_id and + * g.youmonst.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 @@ -219,7 +219,7 @@ unsigned fmflags; struct monst *mtmp; if (!nid) - return &youmonst; + return &g.youmonst; if (fmflags & FM_FMON) for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) if (!DEADMONSTER(mtmp) && mtmp->m_id == nid) @@ -718,7 +718,7 @@ wiz_light_sources() : ls->type == LS_MONSTER ? (mon_is_local(ls->id.a_monst) ? "mon" - : (ls->id.a_monst == &youmonst) + : (ls->id.a_monst == &g.youmonst) ? "you" /* migrating monster */ : "") diff --git a/src/lock.c b/src/lock.c index 9d6254c12..7e5f9a41a 100644 --- a/src/lock.c +++ b/src/lock.c @@ -90,7 +90,7 @@ picklock(VOID_ARGS) } } - if (g.xlock.usedtime++ >= 50 || nohands(youmonst.data)) { + if (g.xlock.usedtime++ >= 50 || nohands(g.youmonst.data)) { You("give up your attempt at %s.", lock_action()); exercise(A_DEX, TRUE); /* even if you don't succeed */ return ((g.xlock.usedtime = 0)); @@ -216,7 +216,7 @@ forcelock(VOID_ARGS) if ((g.xlock.box->ox != u.ux) || (g.xlock.box->oy != u.uy)) return ((g.xlock.usedtime = 0)); /* you or it moved */ - if (g.xlock.usedtime++ >= 50 || !uwep || nohands(youmonst.data)) { + if (g.xlock.usedtime++ >= 50 || !uwep || nohands(g.youmonst.data)) { You("give up your attempt to force the lock."); if (g.xlock.usedtime >= 50) /* you made the effort */ exercise((g.xlock.picktyp) ? A_DEX : A_STR, TRUE); @@ -291,7 +291,7 @@ struct obj *pick; if (g.xlock.usedtime && picktyp == g.xlock.picktyp) { static char no_longer[] = "Unfortunately, you can no longer %s %s."; - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { const char *what = (picktyp == LOCK_PICK) ? "pick" : "key"; if (picktyp == CREDIT_CARD) @@ -307,13 +307,13 @@ struct obj *pick; const char *action = lock_action(); You("resume your attempt at %s.", action); - g.xlock.magic_key = is_magic_key(&youmonst, pick); + g.xlock.magic_key = is_magic_key(&g.youmonst, pick); set_occupation(picklock, action, 0); return PICKLOCK_DID_SOMETHING; } } - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You_cant("hold %s -- you have no hands!", doname(pick)); return PICKLOCK_DID_NOTHING; } else if (u.uswallow) { @@ -493,7 +493,7 @@ struct obj *pick; context.move = 0; g.xlock.chance = ch; g.xlock.picktyp = picktyp; - g.xlock.magic_key = is_magic_key(&youmonst, pick); + g.xlock.magic_key = is_magic_key(&g.youmonst, pick); g.xlock.usedtime = 0; set_occupation(picklock, lock_action(), 0); return PICKLOCK_DID_SOMETHING; @@ -611,7 +611,7 @@ int x, y; boolean portcullis; int res = 0; - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You_cant("open anything -- you have no hands!"); return 0; } @@ -686,7 +686,7 @@ int x, y; return res; } - if (verysmall(youmonst.data)) { + if (verysmall(g.youmonst.data)) { pline("You're too small to pull the door open."); return res; } @@ -754,7 +754,7 @@ doclose() boolean portcullis; int res = 0; - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You_cant("close anything -- you have no hands!"); return 0; } @@ -823,7 +823,7 @@ doclose() } if (door->doormask == D_ISOPEN) { - if (verysmall(youmonst.data) && !u.usteed) { + if (verysmall(g.youmonst.data) && !u.usteed) { pline("You're too small to push the door closed."); return res; } @@ -1053,7 +1053,7 @@ struct obj *otmp; if (otmp->oclass == POTION_CLASS) { You("%s %s shatter!", Blind ? "hear" : "see", an(bottlename())); - if (!breathless(youmonst.data) || haseyes(youmonst.data)) + if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) potionbreathe(otmp); return; } diff --git a/src/mcastu.c b/src/mcastu.c index 680f8fa67..6617e05f9 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -60,7 +60,7 @@ 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(&youmonst, STRANGE_OBJECT) + || is_obj_mappear(&g.youmonst, STRANGE_OBJECT) || u.uundetected) point_msg = "and curses in your general direction"; else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy)) @@ -360,7 +360,7 @@ int spellnum; switch (spellnum) { case MGC_DEATH_TOUCH: pline("Oh no, %s's using the touch of death!", mhe(mtmp)); - if (nonliving(youmonst.data) || is_demon(youmonst.data)) { + if (nonliving(g.youmonst.data) || is_demon(g.youmonst.data)) { You("seem no deader than before."); } else if (!Antimagic && rn2(mtmp->m_lev) > 12) { if (Hallucination) { @@ -422,7 +422,7 @@ int spellnum; if (Antimagic) { shieldeff(u.ux, u.uy); pline("A field of force surrounds you!"); - } else if (!destroy_arm(some_armor(&youmonst))) { + } else if (!destroy_arm(some_armor(&g.youmonst))) { Your("skin itches."); } dmg = 0; @@ -541,7 +541,7 @@ int spellnum; if (Half_spell_damage) dmg = (dmg + 1) / 2; burn_away_slime(); - (void) burnarmor(&youmonst); + (void) burnarmor(&g.youmonst); destroy_item(SCROLL_CLASS, AD_FIRE); destroy_item(POTION_CLASS, AD_FIRE); destroy_item(SPBOOK_CLASS, AD_FIRE); @@ -646,7 +646,7 @@ int spellnum; case CLC_BLIND_YOU: /* note: resists_blnd() doesn't apply here */ if (!Blinded) { - int num_eyes = eyecount(youmonst.data); + int num_eyes = eyecount(g.youmonst.data); pline("Scales cover your %s!", (num_eyes == 1) ? body_part(EYE) : makeplural(body_part(EYE))); diff --git a/src/mhitm.c b/src/mhitm.c index a39638830..03952fa18 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -646,14 +646,14 @@ struct monst *magr, *mdef; /* (hypothetical) engulfers who can pass through walls aren't limited by rock|trees|bars */ - if ((magr == &youmonst) ? Passes_walls : passes_walls(magr->data)) + if ((magr == &g.youmonst) ? Passes_walls : passes_walls(magr->data)) return TRUE; /* don't swallow something in a spot where attacker wouldn't otherwise be able to move onto; we don't want to engulf a wall-phaser and end up with a non-phaser inside a wall */ dx = mdef->mx, dy = mdef->my; - if (mdef == &youmonst) + if (mdef == &g.youmonst) dx = u.ux, dy = u.uy; lev = &levl[dx][dy]; if (IS_ROCK(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ) @@ -1456,7 +1456,7 @@ slept_monst(mon) struct monst *mon; { if ((mon->msleeping || !mon->mcanmove) && mon == u.ustuck - && !sticks(youmonst.data) && !u.uswallow) { + && !sticks(g.youmonst.data) && !u.uswallow) { pline("%s grip relaxes.", s_suffix(Monnam(mon))); unstuck(mon); } diff --git a/src/mhitu.c b/src/mhitu.c index 9d5b1f4f1..a2a4dfd13 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -33,7 +33,7 @@ struct attack *mattk; /* Note: if opposite gender, "seductively" */ /* If same gender, "engagingly" for nymph, normal msg for others */ - if ((compat = could_seduce(mtmp, &youmonst, mattk)) != 0 + if ((compat = could_seduce(mtmp, &g.youmonst, mattk)) != 0 && !mtmp->mcan && !mtmp->mspec_used) { pline("%s %s you %s.", Monst_name, !Blind ? "smiles at" : !Deaf ? "talks to" : "touches", @@ -45,7 +45,7 @@ struct attack *mattk; break; case AT_KICK: pline("%s kicks%c", Monst_name, - thick_skinned(youmonst.data) ? '.' : '!'); + thick_skinned(g.youmonst.data) ? '.' : '!'); break; case AT_STNG: pfmt = "%s stings!"; @@ -82,7 +82,7 @@ struct attack *mattk; if (!canspotmon(mtmp)) map_invisible(mtmp->mx, mtmp->my); - if (could_seduce(mtmp, &youmonst, mattk) && !mtmp->mcan) + if (could_seduce(mtmp, &g.youmonst, mattk) && !mtmp->mcan) pline("%s pretends to be friendly.", Monnam(mtmp)); else pline("%s %smisses!", Monnam(mtmp), @@ -111,7 +111,7 @@ struct monst *mtmp; struct attack *mattk; { if (mattk->aatyp == AT_WEAP) { - struct obj *mwep = (mtmp == &youmonst) ? uwep : MON_WEP(mtmp); + struct obj *mwep = (mtmp == &g.youmonst) ? 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"; @@ -152,7 +152,7 @@ struct attack *mattk; /* maybe it's attacking an image around the corner? */ compat = ((mattk->adtyp == AD_SEDU || mattk->adtyp == AD_SSEX) - ? could_seduce(mtmp, &youmonst, (struct attack *) 0) : 0); + ? could_seduce(mtmp, &g.youmonst, (struct attack *) 0) : 0); Monst_name = Monnam(mtmp); if (!mtmp->mcansee || (Invis && !perceives(mtmp->data))) { @@ -262,7 +262,7 @@ struct attack *alt_attk_buf; { struct permonst *mptr = magr->data; struct attack *attk = &mptr->mattk[indx]; - struct obj *weap = (magr == &youmonst) ? uwep : MON_WEP(magr); + struct obj *weap = (magr == &g.youmonst) ? uwep : MON_WEP(magr); /* prevent a monster with two consecutive disease or hunger attacks from hitting with both of them on the same turn; if the first has @@ -276,7 +276,7 @@ struct attack *alt_attk_buf; attk->adtyp = AD_STUN; /* make drain-energy damage be somewhat in proportion to energy */ - } else if (attk->adtyp == AD_DREN && mdef == &youmonst) { + } else if (attk->adtyp == AD_DREN && mdef == &g.youmonst) { int ulev = max(u.ulevel, 6); *alt_attk_buf = *attk; @@ -314,7 +314,7 @@ struct attack *alt_attk_buf; 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 != &youmonst + } else if (indx == 0 && magr != &g.youmonst && attk->aatyp == AT_WEAP && attk->adtyp != AD_PHYS && !(mptr->mattk[1].aatyp == AT_WEAP && mptr->mattk[1].adtyp == AD_PHYS) @@ -399,7 +399,7 @@ register struct monst *mtmp; if (!canspotmon(mtmp)) map_invisible(mtmp->mx, mtmp->my); u.uundetected = 0; - if (is_hider(youmonst.data) && u.umonnum != PM_TRAPPER) { + if (is_hider(g.youmonst.data) && u.umonnum != PM_TRAPPER) { /* ceiling hider */ coord cc; /* maybe we need a unexto() function? */ struct obj *obj; @@ -409,7 +409,7 @@ register 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, youmonst.data) + if (!enexto(&cc, u.ux, u.uy, g.youmonst.data) /* a fish won't voluntarily swap positions when it's in water and hero is over land */ || (mtmp->data->mlet == S_EEL @@ -434,13 +434,13 @@ register 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, youmonst.data); + (void) enexto(&cc, u.ux, u.uy, g.youmonst.data); } teleds(cc.x, cc.y, TRUE); /* move hero */ set_apparxy(mtmp); newsym(u.ux, u.uy); - if (youmonst.data->mlet != S_PIERCER) + if (g.youmonst.data->mlet != S_PIERCER) return 0; /* lurkers don't attack */ obj = which_armor(mtmp, WORN_HELMET); @@ -472,7 +472,7 @@ register struct monst *mtmp; struct obj *obj = g.level.objects[u.ux][u.uy]; if (obj || u.umonnum == PM_TRAPPER - || (youmonst.data->mlet == S_EEL + || (g.youmonst.data->mlet == S_EEL && is_pool(u.ux, u.uy))) { int save_spe = 0; /* suppress warning */ @@ -483,15 +483,15 @@ register struct monst *mtmp; } /* note that m_monnam() overrides hallucination, which is what we want when message is from mtmp's perspective */ - if (youmonst.data->mlet == S_EEL + if (g.youmonst.data->mlet == S_EEL || u.umonnum == PM_TRAPPER) pline( "Wait, %s! There's a hidden %s named %s there!", - m_monnam(mtmp), youmonst.data->mname, g.plname); + m_monnam(mtmp), g.youmonst.data->mname, g.plname); else pline( "Wait, %s! There's a %s named %s hiding under %s!", - m_monnam(mtmp), youmonst.data->mname, g.plname, + m_monnam(mtmp), g.youmonst.data->mname, g.plname, doname(g.level.objects[u.ux][u.uy])); if (obj) obj->spe = save_spe; @@ -504,9 +504,9 @@ register struct monst *mtmp; } /* hero might be a mimic, concealed via #monster */ - if (youmonst.data->mlet == S_MIMIC && youmonst.m_ap_type && !range2 + if (g.youmonst.data->mlet == S_MIMIC && g.youmonst.m_ap_type && !range2 && foundyou && !u.uswallow) { - boolean sticky = sticks(youmonst.data); + boolean sticky = sticks(g.youmonst.data); if (!canspotmon(mtmp)) map_invisible(mtmp->mx, mtmp->my); @@ -514,34 +514,34 @@ register 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), - youmonst.data->mname, g.plname); + g.youmonst.data->mname, g.plname); if (sticky) u.ustuck = mtmp; - youmonst.m_ap_type = M_AP_NOTHING; - youmonst.mappearance = 0; + g.youmonst.m_ap_type = M_AP_NOTHING; + g.youmonst.mappearance = 0; newsym(u.ux, u.uy); return 0; } /* non-mimic hero might be mimicking an object after eating m corpse */ - if (youmonst.m_ap_type == M_AP_OBJECT && !range2 && foundyou + if (g.youmonst.m_ap_type == M_AP_OBJECT && !range2 && foundyou && !u.uswallow) { if (!canspotmon(mtmp)) map_invisible(mtmp->mx, mtmp->my); if (!youseeit) pline("%s %s!", Something, (likes_gold(mtmp->data) - && youmonst.mappearance == GOLD_PIECE) + && g.youmonst.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(&youmonst), an(mons[u.umonnum].mname), + mimic_obj_name(&g.youmonst), an(mons[u.umonnum].mname), g.plname); if (g.multi < 0) { /* this should always be the case */ char buf[BUFSZ]; Sprintf(buf, "You appear to be %s again.", - Upolyd ? (const char *) an(youmonst.data->mname) + Upolyd ? (const char *) an(g.youmonst.data->mname) : (const char *) "yourself"); unmul(buf); /* immediately stop mimicking */ } @@ -644,7 +644,7 @@ register struct monst *mtmp; for (i = 0; i < NATTK; i++) { sum[i] = 0; mon_currwep = (struct obj *)0; - mattk = getmattk(mtmp, &youmonst, i, sum, &alt_attk); + mattk = getmattk(mtmp, &g.youmonst, i, sum, &alt_attk); if ((u.uswallow && mattk->aatyp != AT_ENGL) || (skipnonmagc && mattk->aatyp != AT_MAGC)) continue; @@ -658,11 +658,11 @@ register struct monst *mtmp; case AT_BUTT: case AT_TENT: if (!range2 && (!MON_WEP(mtmp) || mtmp->mconf || Conflict - || !touch_petrifies(youmonst.data))) { + || !touch_petrifies(g.youmonst.data))) { if (foundyou) { if (tmp > (j = rnd(20 + i))) { if (mattk->aatyp != AT_KICK - || !thick_skinned(youmonst.data)) + || !thick_skinned(g.youmonst.data)) sum[i] = hitmu(mtmp, mattk); } else missmu(mtmp, (tmp == j), mattk); @@ -747,7 +747,7 @@ register struct monst *mtmp; if (foundyou) { mon_currwep = MON_WEP(mtmp); if (mon_currwep) { - hittmp = hitval(mon_currwep, &youmonst); + hittmp = hitval(mon_currwep, &g.youmonst); tmp += hittmp; mswings(mtmp, mon_currwep); } @@ -852,12 +852,12 @@ struct monst *mon; struct obj *o; long wearmask; int armpro, mc = 0; - boolean is_you = (mon == &youmonst), + boolean is_you = (mon == &g.youmonst), gotprot = is_you ? (EProtection != 0L) /* high priests have innate protection */ : (mon->data == &mons[PM_HIGH_PRIEST]); - for (o = is_you ? invent : mon->minvent; o; o = o->nobj) { + for (o = is_you ? g.invent : mon->minvent; o; o = o->nobj) { /* a_can field is only applicable for armor (which must be worn) */ if ((o->owornmask & W_ARMOR) != 0L) { armpro = objects[o->otyp].a_can; @@ -906,7 +906,7 @@ register struct attack *mattk; int uncancelled, ptmp; int dmg, armpro, permdmg; char buf[BUFSZ]; - struct permonst *olduasmon = youmonst.data; + struct permonst *olduasmon = g.youmonst.data; int res; if (!canspotmon(mtmp)) @@ -944,14 +944,14 @@ register struct attack *mattk; * Use uncancelled when cancellation factor takes into account certain * armor's special magic protection. Otherwise just use !mtmp->mcan. */ - armpro = magic_negation(&youmonst); + armpro = magic_negation(&g.youmonst); uncancelled = !mtmp->mcan && (rn2(10) >= 3 * armpro); permdmg = 0; /* Now, adjust damages via resistances or specific attacks */ switch (mattk->adtyp) { case AD_PHYS: - if (mattk->aatyp == AT_HUGS && !sticks(youmonst.data)) { + if (mattk->aatyp == AT_HUGS && !sticks(g.youmonst.data)) { if (!u.ustuck && rn2(2)) { if (u_slip_free(mtmp, mattk)) { dmg = 0; @@ -980,14 +980,14 @@ register struct attack *mattk; if (!Stoned) goto do_stone; } - dmg += dmgval(otmp, &youmonst); + dmg += dmgval(otmp, &g.youmonst); if ((marmg = which_armor(mtmp, W_ARMG)) != 0 && marmg->otyp == GAUNTLETS_OF_POWER) dmg += rn1(4, 3); /* 3..6 */ if (dmg <= 0) dmg = 1; if (!(otmp->oartifact - && artifact_hit(mtmp, &youmonst, otmp, &dmg, g.mhitu_dieroll))) + && artifact_hit(mtmp, &g.youmonst, otmp, &dmg, g.mhitu_dieroll))) hitmsg(mtmp, mattk); if (!dmg) break; @@ -1019,7 +1019,7 @@ register struct attack *mattk; if (cloneu()) You("divide as %s hits you!", mon_nam(mtmp)); } - rustm(&youmonst, otmp); + rustm(&g.youmonst, otmp); } else if (mattk->aatyp != AT_TUCH || dmg != 0 || mtmp != u.ustuck) hitmsg(mtmp, mattk); @@ -1033,8 +1033,8 @@ register struct attack *mattk; case AD_FIRE: hitmsg(mtmp, mattk); if (uncancelled) { - pline("You're %s!", on_fire(youmonst.data, mattk)); - if (completelyburns(youmonst.data)) { /* paper or straw golem */ + pline("You're %s!", on_fire(g.youmonst.data, mattk)); + if (completelyburns(g.youmonst.data)) { /* paper or straw golem */ You("go up in flames!"); /* KMH -- this is okay with unchanging */ rehumanize(); @@ -1094,7 +1094,7 @@ register struct attack *mattk; } break; case AD_BLND: - if (can_blnd(mtmp, &youmonst, mattk->aatyp, (struct obj *) 0)) { + if (can_blnd(mtmp, &g.youmonst, mattk->aatyp, (struct obj *) 0)) { if (!Blind) pline("%s blinds you!", Monnam(mtmp)); make_blinded(Blinded + (long) dmg, FALSE); @@ -1121,7 +1121,7 @@ register struct attack *mattk; break; case AD_DRIN: hitmsg(mtmp, mattk); - if (defends(AD_DRIN, uwep) || !has_head(youmonst.data)) { + if (defends(AD_DRIN, uwep) || !has_head(g.youmonst.data)) { You("don't seem harmed."); /* Not clear what to do for green slimes */ break; @@ -1147,7 +1147,7 @@ register struct attack *mattk; regardless of current shape) or is noncorporeal (can't happen here; no one can poly into a ghost or shade) so this check for missing is academic */ - if (eat_brains(mtmp, &youmonst, TRUE, (int *) 0) == MM_MISS) + if (eat_brains(mtmp, &g.youmonst, TRUE, (int *) 0) == MM_MISS) break; } /* adjattrib gives dunce cap message when appropriate */ @@ -1232,7 +1232,7 @@ register struct attack *mattk; || (flags.moonphase == NEW_MOON && !have_lizard())) { do_stone: if (!Stoned && !Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { int kformat = KILLED_BY_AN; const char *kname = mtmp->data->mname; @@ -1252,11 +1252,11 @@ register struct attack *mattk; break; case AD_STCK: hitmsg(mtmp, mattk); - if (uncancelled && !u.ustuck && !sticks(youmonst.data)) + if (uncancelled && !u.ustuck && !sticks(g.youmonst.data)) u.ustuck = mtmp; break; case AD_WRAP: - if ((!mtmp->mcan || u.ustuck == mtmp) && !sticks(youmonst.data)) { + if ((!mtmp->mcan || u.ustuck == mtmp) && !sticks(g.youmonst.data)) { if (!u.ustuck && !rn2(10)) { if (u_slip_free(mtmp, mattk)) { dmg = 0; @@ -1300,7 +1300,7 @@ register struct attack *mattk; break; case AD_SGLD: hitmsg(mtmp, mattk); - if (youmonst.data->mlet == mdat->mlet) + if (g.youmonst.data->mlet == mdat->mlet) break; if (!mtmp->mcan) stealgold(mtmp); @@ -1308,7 +1308,7 @@ register struct attack *mattk; case AD_SSEX: if (SYSOPT_SEDUCE) { - if (could_seduce(mtmp, &youmonst, mattk) == 1 && !mtmp->mcan) + if (could_seduce(mtmp, &g.youmonst, mattk) == 1 && !mtmp->mcan) if (doseduce(mtmp)) return 3; break; @@ -1321,8 +1321,8 @@ register struct attack *mattk; if (mtmp->mcan) break; /* Continue below */ - } else if (dmgtype(youmonst.data, AD_SEDU) - || (SYSOPT_SEDUCE && dmgtype(youmonst.data, AD_SSEX))) { + } else if (dmgtype(g.youmonst.data, AD_SEDU) + || (SYSOPT_SEDUCE && dmgtype(g.youmonst.data, AD_SSEX))) { pline("%s %s.", Monnam(mtmp), Deaf ? "says something but you can't hear it" : mtmp->minvent @@ -1390,13 +1390,13 @@ register struct attack *mattk; rehumanize(); break; } - erode_armor(&youmonst, ERODE_RUST); + erode_armor(&g.youmonst, ERODE_RUST); break; case AD_CORR: hitmsg(mtmp, mattk); if (mtmp->mcan) break; - erode_armor(&youmonst, ERODE_CORRODE); + erode_armor(&g.youmonst, ERODE_CORRODE); break; case AD_DCAY: hitmsg(mtmp, mattk); @@ -1408,12 +1408,12 @@ register struct attack *mattk; rehumanize(); break; } - erode_armor(&youmonst, ERODE_ROT); + erode_armor(&g.youmonst, ERODE_ROT); break; case AD_HEAL: /* a cancelled nurse is just an ordinary monster, * nurses don't heal those that cause petrification */ - if (mtmp->mcan || (Upolyd && touch_petrifies(youmonst.data))) { + if (mtmp->mcan || (Upolyd && touch_petrifies(g.youmonst.data))) { hitmsg(mtmp, mattk); break; } @@ -1536,7 +1536,7 @@ register struct attack *mattk; break; case AD_DETH: pline("%s reaches out with its deadly touch.", Monnam(mtmp)); - if (is_undead(youmonst.data)) { + if (is_undead(g.youmonst.data)) { /* Still does normal damage */ pline("Was that the touch of death?"); break; @@ -1584,11 +1584,11 @@ register struct attack *mattk; hitmsg(mtmp, mattk); if (!uncancelled) break; - if (flaming(youmonst.data)) { + if (flaming(g.youmonst.data)) { pline_The("slime burns away!"); dmg = 0; - } else if (Unchanging || noncorporeal(youmonst.data) - || youmonst.data == &mons[PM_GREEN_SLIME]) { + } else if (Unchanging || noncorporeal(g.youmonst.data) + || g.youmonst.data == &mons[PM_GREEN_SLIME]) { You("are unaffected."); dmg = 0; } else if (!Slimed) { @@ -1603,7 +1603,7 @@ register struct attack *mattk; /* uncancelled is sufficient enough; please don't make this attack less frequent */ if (uncancelled) { - struct obj *obj = some_armor(&youmonst); + struct obj *obj = some_armor(&g.youmonst); if (!obj) { /* some rings are susceptible; @@ -1678,8 +1678,8 @@ register struct attack *mattk; if (Upolyd) { hpmax_p = &u.mhmax; - /* [can't use youmonst.m_lev] */ - lowerlimit = min((int) youmonst.data->mlevel, u.ulevel); + /* [can't use g.youmonst.m_lev] */ + lowerlimit = min((int) g.youmonst.data->mlevel, u.ulevel); } else { hpmax_p = &u.uhpmax; lowerlimit = u.ulevel; @@ -1714,7 +1714,7 @@ gulp_blnd_check() if (!Blinded && u.uswallow && (mattk = attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)) - && can_blnd(u.ustuck, &youmonst, mattk->aatyp, (struct obj *) 0)) { + && can_blnd(u.ustuck, &g.youmonst, mattk->aatyp, (struct obj *) 0)) { ++u.uswldtim; /* compensate for gulpmu change */ (void) gulpmu(u.ustuck, mattk); return TRUE; @@ -1738,7 +1738,7 @@ struct attack *mattk; if (!u.uswallow) { /* swallows you */ int omx = mtmp->mx, omy = mtmp->my; - if (!engulf_target(mtmp, &youmonst)) + if (!engulf_target(mtmp, &g.youmonst)) return 0; if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy)) @@ -1781,7 +1781,7 @@ struct attack *mattk; unleash_all(); } - if (touch_petrifies(youmonst.data) && !resists_ston(mtmp)) { + if (touch_petrifies(g.youmonst.data) && !resists_ston(mtmp)) { /* put the attacker back where it started; the resulting statue will end up there */ remove_monster(mtmp->mx, mtmp->my); /* u.ux,u.uy */ @@ -1818,7 +1818,7 @@ struct attack *mattk; /* u.uswldtim always set > 1 */ u.uswldtim = (unsigned) ((tim_tmp < 2) ? 2 : tim_tmp); swallowed(1); - for (otmp2 = invent; otmp2; otmp2 = otmp2->nobj) + for (otmp2 = g.invent; otmp2; otmp2 = otmp2->nobj) (void) snuff_lit(otmp2); } @@ -1850,14 +1850,14 @@ struct attack *mattk; physical_damage = TRUE; if (mtmp->data == &mons[PM_FOG_CLOUD]) { You("are laden with moisture and %s", - flaming(youmonst.data) + flaming(g.youmonst.data) ? "are smoldering out!" : Breathless ? "find it mildly uncomfortable." - : amphibious(youmonst.data) + : amphibious(g.youmonst.data) ? "feel comforted." : "can barely breathe!"); /* NB: Amphibious includes Breathless */ - if (Amphibious && !flaming(youmonst.data)) + if (Amphibious && !flaming(g.youmonst.data)) tmp = 0; } else { You("are pummeled with debris!"); @@ -1877,7 +1877,7 @@ struct attack *mattk; } break; case AD_BLND: - if (can_blnd(mtmp, &youmonst, mattk->aatyp, (struct obj *) 0)) { + if (can_blnd(mtmp, &g.youmonst, mattk->aatyp, (struct obj *) 0)) { if (!Blind) { long was_blinded = Blinded; @@ -1954,11 +1954,11 @@ struct attack *mattk; if (!u.uswallow) { ; /* life-saving has already expelled swallowed hero */ - } else if (touch_petrifies(youmonst.data) && !resists_ston(mtmp)) { + } else if (touch_petrifies(g.youmonst.data) && !resists_ston(mtmp)) { pline("%s very hurriedly %s you!", Monnam(mtmp), is_animal(mtmp->data) ? "regurgitates" : "expels"); expels(mtmp, mtmp->data, FALSE); - } else if (!u.uswldtim || youmonst.data->msize >= MZ_HUGE) { + } else if (!u.uswldtim || g.youmonst.data->msize >= MZ_HUGE) { /* 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 @@ -2034,7 +2034,7 @@ boolean ufound; break; case AD_BLND: - not_affected = resists_blnd(&youmonst); + not_affected = resists_blnd(&g.youmonst); if (!not_affected) { /* sometimes you're affected even if it's invisible */ if (mon_visible(mtmp) || (rnd(tmp /= 2) > u.ulevel)) { @@ -2050,7 +2050,7 @@ boolean ufound; case AD_HALU: not_affected |= Blind || (u.umonnum == PM_BLACK_LIGHT || u.umonnum == PM_VIOLET_FUNGUS - || dmgtype(youmonst.data, AD_STUN)); + || dmgtype(g.youmonst.data, AD_STUN)); if (!not_affected) { boolean chg; if (!Hallucination) @@ -2149,7 +2149,7 @@ struct attack *mattk; && !Stone_resistance) { You("meet %s gaze.", s_suffix(mon_nam(mtmp))); stop_occupation(); - if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) + if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) break; You("turn to stone..."); g.killer.format = KILLED_BY; @@ -2193,7 +2193,7 @@ struct attack *mattk; } break; case AD_BLND: - if (canseemon(mtmp) && !resists_blnd(&youmonst) + if (canseemon(mtmp) && !resists_blnd(&g.youmonst) && distu(mtmp->mx, mtmp->my) <= BOLT_LIM * BOLT_LIM) { if (cancelled) { react = rn1(2, 2); /* "puzzled" || "dazzled" */ @@ -2327,8 +2327,8 @@ struct attack *mattk; if (is_animal(magr->data)) return 0; - if (magr == &youmonst) { - pagr = youmonst.data; + if (magr == &g.youmonst) { + pagr = g.youmonst.data; agrinvis = (Invis != 0); genagr = poly_gender(); } else { @@ -2336,7 +2336,7 @@ struct attack *mattk; agrinvis = magr->minvis; genagr = gender(magr); } - if (mdef == &youmonst) { + if (mdef == &g.youmonst) { defperc = (See_invisible != 0); gendef = poly_gender(); } else { @@ -2394,7 +2394,7 @@ struct monst *mon; if (welded(uwep)) tried_gloves = 1; - for (ring = invent; ring; ring = nring) { + for (ring = g.invent; ring; ring = nring) { nring = ring->nobj; if (ring->otyp != RIN_ADORNMENT) continue; @@ -2561,7 +2561,7 @@ struct monst *mon; context.botl = 1; break; case 3: - if (!resists_drli(&youmonst)) { + if (!resists_drli(&g.youmonst)) { You_feel("out of shape."); losexp("overexertion"); } else { @@ -2627,7 +2627,7 @@ struct monst *mon; pline("%s tries to take your money, but fails...", noit_Monnam(mon)); } else { long cost; - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); if (umoney > (long) LARGEST_INT - 10L) cost = (long) rnd(LARGEST_INT) + 500L; @@ -2818,7 +2818,7 @@ struct attack *mattk; && (perceives(mtmp->data) || !Invis)) { if (Blind) pline("As a blind %s, you cannot defend yourself.", - youmonst.data->mname); + g.youmonst.data->mname); else { if (mon_reflects(mtmp, "Your gaze is reflected by %s %s.")) @@ -2846,8 +2846,8 @@ struct attack *mattk; u.mh += tmp / 2; if (u.mhmax < u.mh) u.mhmax = u.mh; - if (u.mhmax > ((youmonst.data->mlevel + 1) * 8)) - (void) split_mon(&youmonst, mtmp); + if (u.mhmax > ((g.youmonst.data->mlevel + 1) * 8)) + (void) split_mon(&g.youmonst, mtmp); break; case AD_STUN: /* Yellow mold */ if (!mtmp->mstun) { @@ -2899,19 +2899,19 @@ struct monst * cloneu() { struct monst *mon; - int mndx = monsndx(youmonst.data); + int mndx = monsndx(g.youmonst.data); if (u.mh <= 1) return (struct monst *) 0; if (g.mvitals[mndx].mvflags & G_EXTINCT) return (struct monst *) 0; - mon = makemon(youmonst.data, u.ux, u.uy, NO_MINVENT | MM_EDOG); + mon = makemon(g.youmonst.data, u.ux, u.uy, NO_MINVENT | MM_EDOG); if (!mon) return NULL; mon->mcloned = 1; mon = christen_monst(mon, g.plname); initedog(mon); - mon->m_lev = youmonst.data->mlevel; + mon->m_lev = g.youmonst.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 b0e785002..26217f4f5 100644 --- a/src/minion.c +++ b/src/minion.c @@ -251,14 +251,14 @@ register struct monst *mtmp; } newsym(mtmp->mx, mtmp->my); } - if (youmonst.data->mlet == S_DEMON) { /* Won't blackmail their own. */ + if (g.youmonst.data->mlet == S_DEMON) { /* Won't blackmail their own. */ pline("%s says, \"Good hunting, %s.\"", Amonnam(mtmp), flags.female ? "Sister" : "Brother"); if (!tele_restrict(mtmp)) (void) rloc(mtmp, TRUE); return 1; } - cash = money_cnt(invent); + cash = money_cnt(g.invent); demand = (cash * (rnd(80) + 20 * Athome)) / (100 * (1 + (sgn(u.ualign.type) == sgn(mtmp->data->maligntyp)))); @@ -301,7 +301,7 @@ struct monst *mtmp; { char buf[BUFSZ] = DUMMY; long offer; - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); getlin("How much will you offer?", buf); if (sscanf(buf, "%ld", &offer) != 1) diff --git a/src/mkobj.c b/src/mkobj.c index 133142541..b5d70c354 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -492,7 +492,7 @@ struct obj *obj; default: return (struct obj *) 0; case OBJ_INVENT: - list = invent; + list = g.invent; break; case OBJ_MINVENT: list = obj->ocarry->minvent; @@ -567,7 +567,7 @@ struct obj *otmp; case OBJ_INVENT: otmp->nobj = obj->nobj; obj->nobj = otmp; - extract_nobj(obj, &invent); + extract_nobj(obj, &g.invent); break; case OBJ_CONTAINED: otmp->nobj = obj->nobj; @@ -2242,7 +2242,7 @@ obj_sanity_check() } } - objlist_sanity(invent, OBJ_INVENT, "invent sanity"); + objlist_sanity(g.invent, OBJ_INVENT, "invent sanity"); objlist_sanity(g.migrating_objs, OBJ_MIGRATING, "migrating sanity"); objlist_sanity(g.level.buriedobjlist, OBJ_BURIED, "buried sanity"); objlist_sanity(g.billobjs, OBJ_ONBILL, "bill sanity"); diff --git a/src/mon.c b/src/mon.c index edfdbcadb..5522812a5 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2066,7 +2066,7 @@ boolean was_swallowed; /* digestion */ else tmp = 0; if (was_swallowed && magr) { - if (magr == &youmonst) { + if (magr == &g.youmonst) { There("is an explosion in your %s!", body_part(STOMACH)); Sprintf(g.killer.name, "%s explosion", s_suffix(mdat->mname)); @@ -2229,7 +2229,7 @@ struct monst *mdef; if (wasinside) { if (is_animal(mdef->data)) You("%s through an opening in the new %s.", - locomotion(youmonst.data, "jump"), xname(otmp)); + locomotion(g.youmonst.data, "jump"), xname(otmp)); } } @@ -3030,7 +3030,7 @@ hideunder(mtmp) struct monst *mtmp; { struct trap *t; - boolean undetected = FALSE, is_u = (mtmp == &youmonst); + boolean undetected = FALSE, is_u = (mtmp == &g.youmonst); xchar x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my; if (mtmp == u.ustuck) { @@ -3046,7 +3046,7 @@ struct monst *mtmp; /* most monsters won't hide under cockatrice corpse */ if (otmp->nexthere || otmp->otyp != CORPSE - || (mtmp == &youmonst ? Stone_resistance : resists_ston(mtmp)) + || (mtmp == &g.youmonst ? Stone_resistance : resists_ston(mtmp)) || !touch_petrifies(&mons[otmp->corpsenm])) undetected = TRUE; } @@ -3608,7 +3608,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */ /* update swallow glyphs for new monster */ swallowed(0); } - } else if (!sticks(mdat) && !sticks(youmonst.data)) + } else if (!sticks(mdat) && !sticks(g.youmonst.data)) unstuck(mtmp); } @@ -3821,7 +3821,7 @@ kill_genocided_monsters() kill_eggs(mtmp->minvent); } - kill_eggs(invent); + kill_eggs(g.invent); kill_eggs(fobj); kill_eggs(g.migrating_objs); kill_eggs(g.level.buriedobjlist); @@ -3951,7 +3951,7 @@ struct permonst *mdat; boolean msg_given = FALSE; if (mdat) { - if (!olfaction(youmonst.data)) + if (!olfaction(g.youmonst.data)) return FALSE; mndx = monsndx(mdat); switch (mndx) { @@ -4047,7 +4047,7 @@ struct permonst *mdat; msg_given = TRUE; break; case S_ORC: - if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC))) + if (maybe_polyd(is_orc(g.youmonst.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 3557fcc96..4890cf1b1 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -102,10 +102,10 @@ struct monst *mon; if (is_undead(ptr) || is_demon(ptr) || is_were(ptr) /* is_were() doesn't handle hero in human form */ - || (mon == &youmonst && u.ulycn >= LOW_PM) + || (mon == &g.youmonst && u.ulycn >= LOW_PM) || ptr == &mons[PM_DEATH] || is_vampshifter(mon)) return TRUE; - wep = (mon == &youmonst) ? uwep : MON_WEP(mon); + wep = (mon == &g.youmonst) ? uwep : MON_WEP(mon); return (boolean) (wep && wep->oartifact && defends(AD_DRLI, wep)); } @@ -115,7 +115,7 @@ resists_magm(mon) struct monst *mon; { struct permonst *ptr = mon->data; - boolean is_you = (mon == &youmonst); + boolean is_you = (mon == &g.youmonst); long slotmask; struct obj *o; @@ -128,7 +128,7 @@ struct monst *mon; if (o && o->oartifact && defends(AD_MAGM, o)) return TRUE; /* check for magic resistance granted by worn or carried items */ - o = is_you ? invent : mon->minvent; + o = is_you ? g.invent : mon->minvent; slotmask = W_ARMOR | W_ACCESSORY; if (!is_you /* assumes monsters don't wield non-weapons */ || (uwep && (uwep->oclass == WEAPON_CLASS || is_weptool(uwep)))) @@ -149,7 +149,7 @@ resists_blnd(mon) struct monst *mon; { struct permonst *ptr = mon->data; - boolean is_you = (mon == &youmonst); + boolean is_you = (mon == &g.youmonst); long slotmask; struct obj *o; @@ -166,7 +166,7 @@ struct monst *mon; o = is_you ? uwep : MON_WEP(mon); if (o && o->oartifact && defends(AD_BLND, o)) return TRUE; - o = is_you ? invent : mon->minvent; + o = is_you ? g.invent : mon->minvent; slotmask = W_ARMOR | W_ACCESSORY; if (!is_you /* assumes monsters don't wield non-weapons */ || (uwep && (uwep->oclass == WEAPON_CLASS || is_weptool(uwep)))) @@ -190,7 +190,7 @@ struct monst *mdef; uchar aatyp; struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */ { - boolean is_you = (mdef == &youmonst); + boolean is_you = (mdef == &g.youmonst); boolean check_visor = FALSE; struct obj *o; const char *s; @@ -226,7 +226,7 @@ struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */ return TRUE; /* no defense */ } else return FALSE; /* other objects cannot cause blindness yet */ - if ((magr == &youmonst) && u.uswallow) + if ((magr == &g.youmonst) && u.uswallow) return FALSE; /* can't affect eyes while inside monster */ break; @@ -241,7 +241,7 @@ struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */ /* e.g. raven: all ublindf, including LENSES, protect */ if (is_you && ublindf) return FALSE; - if ((magr == &youmonst) && u.uswallow) + if ((magr == &g.youmonst) && u.uswallow) return FALSE; /* can't affect eyes while inside monster */ check_visor = TRUE; break; @@ -259,7 +259,7 @@ struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */ /* check if wearing a visor (only checked if visor might help) */ if (check_visor) { - o = (mdef == &youmonst) ? invent : mdef->minvent; + o = (mdef == &g.youmonst) ? g.invent : mdef->minvent; for (; o; o = o->nobj) if ((o->owornmask & W_ARMH) && (s = OBJ_DESCR(objects[o->otyp])) != (char *) 0 @@ -340,7 +340,7 @@ struct monst *mtmp; && (breathless(mtmp->data) || verysmall(mtmp->data) || !has_head(mtmp->data) || mtmp->data->mlet == S_EEL)) return FALSE; - if ((mtmp == &youmonst) && Strangled) + if ((mtmp == &g.youmonst) && Strangled) return FALSE; return TRUE; } @@ -350,7 +350,7 @@ boolean can_chant(mtmp) struct monst *mtmp; { - if ((mtmp == &youmonst && Strangled) + if ((mtmp == &g.youmonst && Strangled) || is_silent(mtmp->data) || !has_head(mtmp->data) || mtmp->data->msound == MS_BUZZ || mtmp->data->msound == MS_BURBLE) return FALSE; @@ -374,10 +374,10 @@ struct monst *mon; are non-breathing creatures which have higher brain function. */ if (!has_head(mon->data)) return FALSE; - if (mon == &youmonst) { + if (mon == &g.youmonst) { /* hero can't be mindless but poly'ing into mindless form can confer strangulation protection */ - nobrainer = mindless(youmonst.data); + nobrainer = mindless(g.youmonst.data); nonbreathing = Breathless; } else { nobrainer = mindless(mon->data); @@ -1075,7 +1075,7 @@ const struct permonst * raceptr(mtmp) struct monst *mtmp; { - if (mtmp == &youmonst && !Upolyd) + if (mtmp == &g.youmonst && !Upolyd) return &mons[urace.malenum]; else return mtmp->data; diff --git a/src/monmove.c b/src/monmove.c index 295a7ce62..b7e0568cc 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -245,7 +245,7 @@ struct monst *mon; if (mon == u.ustuck) { if (u.uswallow) { expels(mon, mon->data, TRUE); - } else if (!sticks(youmonst.data)) { + } else if (!sticks(g.youmonst.data)) { unstuck(mon); /* let go */ You("get released!"); } @@ -512,7 +512,7 @@ register struct monst *mtmp; pline("%s whispers at thin air.", cansee(mtmp->mux, mtmp->muy) ? Monnam(mtmp) : "It"); - if (is_demon(youmonst.data)) { + if (is_demon(g.youmonst.data)) { /* "Good hunting, brother" */ if (!tele_restrict(mtmp)) (void) rloc(mtmp, TRUE); @@ -621,7 +621,7 @@ register struct monst *mtmp; if (!nearby || mtmp->mflee || scared || mtmp->mconf || mtmp->mstun || (mtmp->minvis && !rn2(3)) - || (mdat->mlet == S_LEPRECHAUN && !findgold(invent) + || (mdat->mlet == S_LEPRECHAUN && !findgold(g.invent) && (findgold(mtmp->minvent) || rn2(2))) || (is_wanderer(mdat) && !rn2(4)) || (Conflict && !mtmp->iswiz) || (!mtmp->mcansee && !rn2(4)) || mtmp->mpeaceful) { @@ -723,7 +723,7 @@ boolean itsstuck(mtmp) register struct monst *mtmp; { - if (sticks(youmonst.data) && mtmp == u.ustuck && !u.uswallow) { + if (sticks(g.youmonst.data) && mtmp == u.ustuck && !u.uswallow) { pline("%s cannot escape from you!", Monnam(mtmp)); return TRUE; } @@ -962,8 +962,8 @@ register int after; if (!mtmp->mcansee || (should_see && Invis && !perceives(ptr) && rn2(11)) - || is_obj_mappear(&youmonst,STRANGE_OBJECT) || u.uundetected - || (is_obj_mappear(&youmonst,GOLD_PIECE) && !likes_gold(ptr)) + || is_obj_mappear(&g.youmonst,STRANGE_OBJECT) || u.uundetected + || (is_obj_mappear(&g.youmonst,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))) @@ -972,7 +972,7 @@ register int after; if (monsndx(ptr) == PM_LEPRECHAUN && (appr == 1) && ((lepgold = findgold(mtmp->minvent)) && (lepgold->quan - > ((ygold = findgold(invent)) ? ygold->quan : 0L)))) + > ((ygold = findgold(g.invent)) ? ygold->quan : 0L)))) appr = -1; if (!should_see && can_track(ptr)) { @@ -989,7 +989,7 @@ register 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(youmonst.data) ? 20 : ACURRSTR / 2 + 1))); + <= (throws_rocks(g.youmonst.data) ? 20 : ACURRSTR / 2 + 1))); if (appr != 1 || !in_line) { /* Monsters in combat won't pick stuff up, avoiding the @@ -1583,7 +1583,7 @@ register struct monst *mtmp; { boolean notseen, gotu; register int disp, mx = mtmp->mux, my = mtmp->muy; - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); /* * do cheapest and/or most likely tests first @@ -1685,8 +1685,8 @@ struct monst *mtmp; { struct obj *chain, *obj; - if (mtmp == &youmonst) { - chain = invent; + if (mtmp == &g.youmonst) { + chain = g.invent; } else { chain = mtmp->minvent; } diff --git a/src/mthrowu.c b/src/mthrowu.c index 480492c32..9ca3ddc79 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -82,7 +82,7 @@ const char *name; /* if null, then format `*objp' */ } 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(&youmonst, obj, POTHIT_OTHER_THROW); + potionhit(&g.youmonst, obj, POTHIT_OTHER_THROW); *objp = obj = 0; /* potionhit() uses up the potion */ } else { if (obj && objects[obj->otyp].oc_material == SILVER @@ -134,7 +134,7 @@ int x, y; if (!flooreffects(obj, x, y, "fall")) { place_object(obj, x, y); if (!mtmp && x == u.ux && y == u.uy) - mtmp = &youmonst; + mtmp = &g.youmonst; if (mtmp && ohit) passive_obj(mtmp, obj, (struct attack *) 0); stackobj(obj); @@ -544,7 +544,7 @@ struct obj *obj; /* missile (or stack providing it) */ if (singleobj->oclass == GEM_CLASS && singleobj->otyp <= LAST_GEM + 9 /* 9 glass colors */ - && is_unicorn(youmonst.data)) { + && is_unicorn(g.youmonst.data)) { if (singleobj->otyp > LAST_GEM) { You("catch the %s.", xname(singleobj)); You("are not interested in %s junk.", @@ -565,7 +565,7 @@ struct obj *obj; /* missile (or stack providing it) */ if (singleobj->oclass == POTION_CLASS) { if (!Blind) singleobj->dknown = 1; - potionhit(&youmonst, singleobj, POTHIT_MONST_THROW); + potionhit(&g.youmonst, singleobj, POTHIT_MONST_THROW); break; } oldumort = u.umortality; @@ -584,7 +584,7 @@ struct obj *obj; /* missile (or stack providing it) */ hitu = thitu(8, 0, &singleobj, (char *) 0); break; default: - dam = dmgval(singleobj, &youmonst); + dam = dmgval(singleobj, &g.youmonst); hitv = 3 - distmin(u.ux, u.uy, mon->mx, mon->my); if (hitv < -4) hitv = -4; @@ -596,7 +596,7 @@ struct obj *obj; /* missile (or stack providing it) */ if (singleobj->otyp == ELVEN_ARROW) dam++; } - if (bigmonst(youmonst.data)) + if (bigmonst(g.youmonst.data)) hitv++; hitv += 8 + singleobj->spe; if (dam < 1) @@ -613,7 +613,7 @@ struct obj *obj; /* missile (or stack providing it) */ poison is limited to attrib loss */ (u.umortality > oldumort) ? 0 : 10, TRUE); } - if (hitu && can_blnd((struct monst *) 0, &youmonst, + if (hitu && can_blnd((struct monst *) 0, &g.youmonst, (uchar) ((singleobj->otyp == BLINDING_VENOM) ? AT_SPIT : AT_WEAP), @@ -628,7 +628,7 @@ struct obj *obj; /* missile (or stack providing it) */ } else if (singleobj->otyp == BLINDING_VENOM) { const char *eyes = body_part(EYE); - if (eyecount(youmonst.data) != 1) + if (eyecount(g.youmonst.data) != 1) eyes = makeplural(eyes); /* venom in the eyes */ if (!Blind) @@ -639,7 +639,7 @@ struct obj *obj; /* missile (or stack providing it) */ } if (hitu && singleobj->otyp == EGG) { if (!Stoned && !Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { make_stoned(5L, (char *) 0, KILLED_BY, ""); } @@ -897,11 +897,11 @@ struct monst *mtmp; obj_is_pname(otmp) ? the(onm) : an(onm)); } - dam = dmgval(otmp, &youmonst); + dam = dmgval(otmp, &g.youmonst); hitv = 3 - distmin(u.ux, u.uy, mtmp->mx, mtmp->my); if (hitv < -4) hitv = -4; - if (bigmonst(youmonst.data)) + if (bigmonst(g.youmonst.data)) hitv++; hitv += 8 + otmp->spe; if (dam < 1) @@ -1072,8 +1072,8 @@ register struct monst *mtmp; /* hero concealment usually trumps monst awareness of being lined up */ if (Upolyd && rn2(25) - && (u.uundetected || (youmonst.m_ap_type != M_AP_NOTHING - && youmonst.m_ap_type != M_AP_MONSTER))) + && (u.uundetected || (g.youmonst.m_ap_type != M_AP_NOTHING + && g.youmonst.m_ap_type != M_AP_MONSTER))) return FALSE; ignore_boulders = (throws_rocks(mtmp->data) diff --git a/src/muse.c b/src/muse.c index 7d4888e05..979a7b65a 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1191,7 +1191,7 @@ register struct obj *otmp; int tmp; boolean reveal_invis = FALSE; - if (mtmp != &youmonst) { + if (mtmp != &g.youmonst) { mtmp->msleeping = 0; if (mtmp->m_ap_type) seemimic(mtmp); @@ -1199,7 +1199,7 @@ register struct obj *otmp; switch (otmp->otyp) { case WAN_STRIKING: reveal_invis = TRUE; - if (mtmp == &youmonst) { + if (mtmp == &g.youmonst) { if (g.zap_oseen) makeknown(WAN_STRIKING); if (Antimagic) { @@ -1232,7 +1232,7 @@ register struct obj *otmp; break; #if 0 /* disabled because find_offensive() never picks WAN_TELEPORTATION */ case WAN_TELEPORTATION: - if (mtmp == &youmonst) { + if (mtmp == &g.youmonst) { if (g.zap_oseen) makeknown(WAN_TELEPORTATION); tele(); @@ -1301,7 +1301,7 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */ destroy_drawbridge(x, y); } if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) { - (*fhitm)(&youmonst, obj); + (*fhitm)(&g.youmonst, obj); range -= 3; } else if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) { if (cansee(g.bhitpos.x, g.bhitpos.y) && !canspotmon(mtmp)) @@ -2151,7 +2151,7 @@ const char *fmt, *str; if (fmt && str) pline(fmt, str, uskin ? "luster" : "armor"); return TRUE; - } else if (youmonst.data == &mons[PM_SILVER_DRAGON]) { + } else if (g.youmonst.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 45fef0bb1..cd8af1e15 100644 --- a/src/music.c +++ b/src/music.c @@ -176,7 +176,7 @@ struct monst *bugler; /* monster that played instrument */ int distance, distm; /* distance of affected non-soldier monsters to bugler */ - distance = ((bugler == &youmonst) ? u.ulevel : bugler->data->mlevel) * 30; + distance = ((bugler == &g.youmonst) ? u.ulevel : bugler->data->mlevel) * 30; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) @@ -189,7 +189,7 @@ struct monst *bugler; /* monster that played instrument */ pline("%s is now ready for battle!", Monnam(mtmp)); else Norep("You hear the rattle of battle gear being readied."); - } else if ((distm = ((bugler == &youmonst) + } else if ((distm = ((bugler == &g.youmonst) ? distu(mtmp->mx, mtmp->my) : dist2(bugler->mx, bugler->my, mtmp->mx, mtmp->my))) < distance) { @@ -388,7 +388,7 @@ int force; reset_utrap(TRUE); } if (Levitation || Flying - || is_clinger(youmonst.data)) { + || is_clinger(g.youmonst.data)) { if (!tu_pit) { /* no pit here previously */ pline("A chasm opens up under you!"); You("don't fall in!"); @@ -416,8 +416,8 @@ int force; exercise(A_DEX, TRUE); else selftouch( - (Upolyd && (slithy(youmonst.data) - || nolimbs(youmonst.data))) + (Upolyd && (slithy(g.youmonst.data) + || nolimbs(g.youmonst.data))) ? "Shaken, you" : "Falling down, you"); } @@ -579,7 +579,7 @@ struct obj *instr; break; case BUGLE: /* Awaken & attract soldiers */ You("extract a loud noise from %s.", yname(instr)); - awaken_soldiers(&youmonst); + awaken_soldiers(&g.youmonst); exercise(A_WIS, FALSE); break; case MAGIC_HARP: /* Charm monsters */ @@ -648,7 +648,7 @@ 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(&youmonst)) { + && !can_blow(&g.youmonst)) { You("are incapable of playing %s.", the(distant_name(instr, xname))); return 0; } diff --git a/src/pager.c b/src/pager.c index 2e06a6588..b88ec2e05 100644 --- a/src/pager.c +++ b/src/pager.c @@ -89,8 +89,8 @@ char *outbuf; mons[u.umonnum].mname, g.plname); if (u.usteed) Sprintf(eos(outbuf), ", mounted on %s", y_monnam(u.usteed)); - if (u.uundetected || (Upolyd && youmonst.m_ap_type)) - mhidden_description(&youmonst, FALSE, eos(outbuf)); + if (u.uundetected || (Upolyd && g.youmonst.m_ap_type)) + mhidden_description(&g.youmonst, FALSE, eos(outbuf)); return outbuf; } @@ -103,7 +103,7 @@ boolean altmon; /* for probing: if mimicking a monster, say so */ char *outbuf; { struct obj *otmp; - boolean fakeobj, isyou = (mon == &youmonst); + boolean fakeobj, isyou = (mon == &g.youmonst); int x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my, glyph = (g.level.flags.hero_memory && !isyou) ? levl[x][y].glyph : glyph_at(x, y); @@ -272,7 +272,7 @@ int x, y; Strcat(buf, is_animal(mtmp->data) ? ", swallowing you" : ", engulfing you"); else - Strcat(buf, (Upolyd && sticks(youmonst.data)) + Strcat(buf, (Upolyd && sticks(g.youmonst.data)) ? ", being held" : ", holding you"); } if (mtmp->mleashed) @@ -1161,7 +1161,7 @@ coord *click_cc; if (!invlet || invlet == '\033') return 0; *out_str = '\0'; - for (invobj = invent; invobj; invobj = invobj->nobj) + for (invobj = g.invent; invobj; invobj = invobj->nobj) if (invobj->invlet == invlet) { strcpy(out_str, singular(invobj, xname)); break; diff --git a/src/pickup.c b/src/pickup.c index 8e20b6d2e..9159c95a1 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -160,7 +160,7 @@ int *menu_on_demand; ilets[iletct++] = ' '; ilets[iletct++] = 'a'; ilets[iletct++] = 'A'; - ilets[iletct++] = (objs == invent ? 'i' : ':'); + ilets[iletct++] = (objs == g.invent ? 'i' : ':'); } if (itemcount && menu_on_demand) ilets[iletct++] = 'm'; @@ -258,7 +258,7 @@ boolean remotely; || !touch_petrifies(&mons[obj->corpsenm]) || Stone_resistance) return FALSE; - if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) { + if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) { display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */ return FALSE; } @@ -521,7 +521,7 @@ int what; /* should be a long */ check_here(FALSE); return 0; } - if (notake(youmonst.data)) { + if (notake(g.youmonst.data)) { if (!autopickup) You("are physically incapable of picking anything up."); else @@ -683,8 +683,8 @@ int what; /* should be a long */ } if (!u.uswallow) { - if (hides_under(youmonst.data)) - (void) hideunder(&youmonst); + if (hides_under(g.youmonst.data)) + (void) hideunder(&g.youmonst); /* position may need updating (invisible hero) */ if (n_picked) @@ -927,7 +927,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */ fake_hero_object = zeroobj; fake_hero_object.quan = 1L; /* not strictly necessary... */ any.a_obj = &fake_hero_object; - add_menu(win, mon_to_glyph(&youmonst), &any, + add_menu(win, mon_to_glyph(&g.youmonst), &any, /* fake inventory letter, no group accelerator */ CONTAINED_SYM, 0, ATR_NONE, an(self_lookat(buf)), MENU_UNSELECTED); @@ -1234,7 +1234,7 @@ int *wt_before, *wt_after; savequan = obj->quan; saveowt = obj->owt; - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); iw = max_capacity(); if (count != savequan) { @@ -1335,7 +1335,7 @@ int *wt_before, *wt_after; if (!container) Strcpy(where, "here"); /* slightly shorter form */ - if (invent || umoney) { + if (g.invent || umoney) { prefx1 = "you cannot "; prefx2 = ""; suffx = " any more"; @@ -1370,9 +1370,9 @@ boolean telekinesis; 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(youmonst.data))) { + || (obj->otyp == BOULDER && throws_rocks(g.youmonst.data))) { if (inv_cnt(FALSE) < 52 || !carrying(obj->otyp) - || merge_choice(invent, obj)) + || merge_choice(g.invent, obj)) return 1; /* lift regardless of current situation */ /* if we reach here, we're out of slots and already have at least one of these, so treat this one more like a normal item */ @@ -1388,7 +1388,7 @@ boolean telekinesis; } else if (obj->oclass != COIN_CLASS /* [exception for gold coins will have to change if silver/copper ones ever get implemented] */ - && inv_cnt(FALSE) >= 52 && !merge_choice(invent, obj)) { + && inv_cnt(FALSE) >= 52 && !merge_choice(g.invent, obj)) { Your("knapsack cannot accommodate any more items."); result = -1; /* nothing lifted */ } else { @@ -1461,7 +1461,7 @@ boolean telekinesis; /* not picking it up directly by hand */ if (obj == uchain) { /* do not pick up attached chain */ return 0; - } else if (obj->oartifact && !touch_artifact(obj, &youmonst)) { + } else if (obj->oartifact && !touch_artifact(obj, &g.youmonst)) { return 0; } else if (obj->otyp == CORPSE) { if (fatal_corpse_mistake(obj, telekinesis) @@ -1573,7 +1573,7 @@ encumber_msg() break; case 3: You("%s under your heavy load. Movement is very hard.", - stagger(youmonst.data, "stagger")); + stagger(g.youmonst.data, "stagger")); break; default: You("%s move a handspan with this load!", @@ -1594,7 +1594,7 @@ encumber_msg() break; case 3: You("%s under your load. Movement is still very hard.", - stagger(youmonst.data, "stagger")); + stagger(g.youmonst.data, "stagger")); break; } context.botl = 1; @@ -1643,7 +1643,7 @@ boolean looting; /* loot vs tip */ You("cannot %s things that are deep in the %s.", verb, hliquid(is_lava(x, y) ? "lava" : "water")); return FALSE; - } else if (nolimbs(youmonst.data)) { + } else if (nolimbs(g.youmonst.data)) { pline("Without limbs, you cannot %s anything.", verb); return FALSE; } else if (looting && !freehand()) { @@ -1731,7 +1731,7 @@ doloot() /* "Can't do that while carrying so much stuff." */ return 0; } - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You("have no hands!"); /* not `body_part(HAND)' */ return 0; } @@ -1900,7 +1900,7 @@ reverse_loot() if (!rn2(3)) { /* n objects: 1/(n+1) chance per object plus 1/(n+1) to fall off end */ - for (n = inv_cnt(TRUE), otmp = invent; otmp; --n, otmp = otmp->nobj) + for (n = inv_cnt(TRUE), otmp = g.invent; otmp; --n, otmp = otmp->nobj) if (!rn2(n + 1)) { prinv("You find old loot:", otmp, 0L); return TRUE; @@ -1909,7 +1909,7 @@ reverse_loot() } /* find a money object to mess with */ - for (goldob = invent; goldob; goldob = goldob->nobj) + for (goldob = g.invent; goldob; goldob = goldob->nobj) if (goldob->oclass == COIN_CLASS) { contribution = ((long) rnd(5) * goldob->quan + 4L) / 5L; if (contribution < goldob->quan) @@ -1991,7 +1991,7 @@ boolean *prev_loot; x_monnam(mtmp, ARTICLE_THE, (char *) 0, SUPPRESS_SADDLE, FALSE)); if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') { - if (nolimbs(youmonst.data)) { + if (nolimbs(g.youmonst.data)) { You_cant("do that without limbs."); /* not body_part(HAND) */ return 0; } @@ -2247,7 +2247,7 @@ register struct obj *obj; obj->owt = weight(obj); } - if (obj->oartifact && !touch_artifact(obj, &youmonst)) + if (obj->oartifact && !touch_artifact(obj, &g.youmonst)) return 0; if (fatal_corpse_mistake(obj, FALSE)) @@ -2436,7 +2436,7 @@ boolean more_containers; boolean u_handsy() { - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You("have no hands!"); /* not `body_part(HAND)' */ return FALSE; } else if (!freehand()) { @@ -2510,8 +2510,8 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */ You("owe %ld %s for lost merchandise.", loss, currency(loss)); g.current_container->owt = weight(g.current_container); } - inokay = (invent != 0 - && !(invent == g.current_container && !g.current_container->nobj)); + inokay = (g.invent != 0 + && !(g.invent == g.current_container && !g.current_container->nobj)); outokay = Has_contents(g.current_container); if (!outokay) /* preformat the empty-container message */ Sprintf(emptymsg, "%s is %sempty.", Ysimple_name2(g.current_container), @@ -2621,8 +2621,8 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */ } if ((loot_in || stash_one) - && (!invent || (invent == g.current_container && !invent->nobj))) { - You("don't have anything%s to %s.", invent ? " else" : "", + && (!g.invent || (g.invent == g.current_container && !g.invent->nobj))) { + You("don't have anything%s to %s.", g.invent ? " else" : "", stash_one ? "stash" : "put in"); loot_in = stash_one = FALSE; } @@ -2704,7 +2704,7 @@ boolean put_in; if (put_in) { action = "put in"; - objlist = &invent; + objlist = &g.invent; actionfunc = in_container; checkfunc = ck_bag; } else { @@ -2746,7 +2746,7 @@ boolean put_in; all_categories = FALSE; Sprintf(buf, "%s what type of objects?", action); mflags = (ALL_TYPES | UNPAID_TYPES | BUCX_TYPES | CHOOSE_ALL); - n = query_category(buf, put_in ? invent : g.current_container->cobj, + n = query_category(buf, put_in ? g.invent : g.current_container->cobj, mflags, &pick_list, PICK_ANY); if (!n) return 0; @@ -2772,7 +2772,7 @@ boolean put_in; n_looted += res; } } else { - for (otmp = invent; otmp && g.current_container; otmp = otmp2) { + for (otmp = g.invent; otmp && g.current_container; otmp = otmp2) { otmp2 = otmp->nobj; res = in_container(otmp); if (res < 0) @@ -2787,7 +2787,7 @@ boolean put_in; if (!put_in) g.current_container->cknown = 1; Sprintf(buf, "%s what?", action); - n = query_objlist(buf, put_in ? &invent : &(g.current_container->cobj), + n = query_objlist(buf, put_in ? &g.invent : &(g.current_container->cobj), mflags, &pick_list, PICK_ANY, all_categories ? allow_all : allow_category); if (n) { @@ -2942,7 +2942,7 @@ dotip() add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, doname(cobj), MENU_UNSELECTED); } - if (invent) { + if (g.invent) { any = zeroany; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); @@ -2974,7 +2974,7 @@ dotip() } if (n == -1) return 0; - /* else pick-from-invent below */ + /* else pick-from-g.invent below */ } else { for (cobj = g.level.objects[cc.x][cc.y]; cobj; cobj = nobj) { nobj = cobj->nexthere; diff --git a/src/polyself.c b/src/polyself.c index 625f7e1e9..b22031ffc 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -5,8 +5,8 @@ /* * Polymorph self routine. * - * Note: the light source handling code assumes that both youmonst.m_id - * and youmonst.mx will always remain 0 when it handles the case of the + * Note: the light source handling code assumes that both g.youmonst.m_id + * and g.youmonst.mx will always remain 0 when it handles the case of the * player polymorphed into a light-emitting monster. * * Transformation sequences: @@ -33,14 +33,14 @@ STATIC_DCL void NDECL(polysense); STATIC_VAR const char no_longer_petrify_resistant[] = "No longer petrify-resistant, you"; -/* update the youmonst.data structure pointer and intrinsics */ +/* update the g.youmonst.data structure pointer and intrinsics */ void set_uasmon() { struct permonst *mdat = &mons[u.umonnum]; - int new_speed, old_speed = youmonst.data ? youmonst.data->mmove : 0; + int new_speed, old_speed = g.youmonst.data ? g.youmonst.data->mmove : 0; - set_mon_data(&youmonst, mdat, 0); + set_mon_data(&g.youmonst, mdat, 0); #define PROPSET(PropIndx, ON) \ do { \ @@ -50,20 +50,20 @@ set_uasmon() u.uprops[PropIndx].intrinsic &= ~FROMFORM; \ } while (0) - PROPSET(FIRE_RES, resists_fire(&youmonst)); - PROPSET(COLD_RES, resists_cold(&youmonst)); - PROPSET(SLEEP_RES, resists_sleep(&youmonst)); - PROPSET(DISINT_RES, resists_disint(&youmonst)); - PROPSET(SHOCK_RES, resists_elec(&youmonst)); - PROPSET(POISON_RES, resists_poison(&youmonst)); - PROPSET(ACID_RES, resists_acid(&youmonst)); - PROPSET(STONE_RES, resists_ston(&youmonst)); + PROPSET(FIRE_RES, resists_fire(&g.youmonst)); + PROPSET(COLD_RES, resists_cold(&g.youmonst)); + PROPSET(SLEEP_RES, resists_sleep(&g.youmonst)); + PROPSET(DISINT_RES, resists_disint(&g.youmonst)); + PROPSET(SHOCK_RES, resists_elec(&g.youmonst)); + PROPSET(POISON_RES, resists_poison(&g.youmonst)); + PROPSET(ACID_RES, resists_acid(&g.youmonst)); + PROPSET(STONE_RES, resists_ston(&g.youmonst)); { /* resists_drli() takes wielded weapon into account; suppress it */ struct obj *save_uwep = uwep; uwep = 0; - PROPSET(DRAIN_RES, resists_drli(&youmonst)); + PROPSET(DRAIN_RES, resists_drli(&g.youmonst)); uwep = save_uwep; } /* resists_magm() takes wielded, worn, and carried equipment into @@ -97,13 +97,13 @@ set_uasmon() float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */ polysense(); - if (youmonst.movement) { + if (g.youmonst.movement) { new_speed = mdat->mmove; /* prorate unused movement if new form is slower so that it doesn't get extra moves leftover from previous form; if new form is faster, leave unused movement as is */ if (new_speed < old_speed) - youmonst.movement = new_speed * youmonst.movement / old_speed; + g.youmonst.movement = new_speed * g.youmonst.movement / old_speed; } #ifdef STATUS_HILITES @@ -143,7 +143,7 @@ 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(&youmonst)) { + && can_be_strangled(&g.youmonst)) { Strangled = 6L; context.botl = TRUE; Your("%s %s your %s!", simpleonames(uamul), @@ -154,7 +154,7 @@ boolean on; /* off -- maybe block strangling */ } else { - if (Strangled && !can_be_strangled(&youmonst)) { + if (Strangled && !can_be_strangled(&g.youmonst)) { Strangled = 0L; context.botl = TRUE; You("are no longer being strangled."); @@ -167,8 +167,8 @@ STATIC_OVL void polyman(fmt, arg) const char *fmt, *arg; { - boolean sticky = (sticks(youmonst.data) && u.ustuck && !u.uswallow), - was_mimicking = (youmonst.m_ap_type == M_AP_OBJECT); + boolean sticky = (sticks(g.youmonst.data) && u.ustuck && !u.uswallow), + was_mimicking = (g.youmonst.m_ap_type == M_AP_OBJECT); boolean was_blind = !!Blind; if (Upolyd) { @@ -190,7 +190,7 @@ const char *fmt, *arg; if (was_mimicking) { if (g.multi < 0) unmul(""); - youmonst.m_ap_type = M_AP_NOTHING; + g.youmonst.m_ap_type = M_AP_NOTHING; } newsym(u.ux, u.uy); @@ -212,7 +212,7 @@ const char *fmt, *arg; done(GENOCIDED); } - if (u.twoweap && !could_twoweap(youmonst.data)) + if (u.twoweap && !could_twoweap(g.youmonst.data)) untwoweapon(); if (u.utrap && u.utraptype == TT_PIT) { @@ -244,8 +244,8 @@ change_sex() * are true if the player is a priest/priestess. */ if (!already_polyd - || (!is_male(youmonst.data) && !is_female(youmonst.data) - && !is_neuter(youmonst.data))) + || (!is_male(g.youmonst.data) && !is_female(g.youmonst.data) + && !is_neuter(g.youmonst.data))) flags.female = !flags.female; if (already_polyd) /* poly'd: also change saved sex */ u.mfemale = !u.mfemale; @@ -396,7 +396,7 @@ int psflags; int old_light, new_light, mntmp, class, tryct; boolean forcecontrol = (psflags == 1), monsterpoly = (psflags == 2), draconian = (uarm && Is_dragon_armor(uarm)), - iswere = (u.ulycn >= LOW_PM), isvamp = is_vampire(youmonst.data), + iswere = (u.ulycn >= LOW_PM), isvamp = is_vampire(g.youmonst.data), controllable_poly = Polymorph_control && !(Stunned || Unaware); if (Unchanging) { @@ -413,7 +413,7 @@ int psflags; return; } } - old_light = emits_light(youmonst.data); + old_light = emits_light(g.youmonst.data); mntmp = NON_PM; if (monsterpoly && isvamp) @@ -537,7 +537,7 @@ int psflags; } else if (isvamp) { do_vampyr: if (mntmp < LOW_PM || (mons[mntmp].geno & G_UNIQ)) - mntmp = (youmonst.data != &mons[PM_VAMPIRE] && !rn2(10)) + mntmp = (g.youmonst.data != &mons[PM_VAMPIRE] && !rn2(10)) ? PM_WOLF : !rn2(4) ? PM_FOG_CLOUD : PM_VAMPIRE_BAT; if (controllable_poly) { @@ -579,15 +579,15 @@ int psflags; g.sex_change_ok--; /* reset */ made_change: - new_light = emits_light(youmonst.data); + new_light = emits_light(g.youmonst.data); if (old_light != new_light) { if (old_light) - del_light_source(LS_MONSTER, monst_to_any(&youmonst)); + del_light_source(LS_MONSTER, monst_to_any(&g.youmonst)); 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(&youmonst)); + monst_to_any(&g.youmonst)); } } @@ -598,7 +598,7 @@ polymon(mntmp) int mntmp; { char buf[BUFSZ]; - boolean sticky = sticks(youmonst.data) && u.ustuck && !u.uswallow, + boolean sticky = sticks(g.youmonst.data) && u.ustuck && !u.uswallow, was_blind = !!Blind, dochange = FALSE; int mlvl; @@ -631,13 +631,13 @@ int mntmp; } /* if stuck mimicking gold, stop immediately */ - if (g.multi < 0 && youmonst.m_ap_type == M_AP_OBJECT - && youmonst.data->mlet != S_MIMIC) + if (g.multi < 0 && g.youmonst.m_ap_type == M_AP_OBJECT + && g.youmonst.data->mlet != S_MIMIC) unmul(""); /* if becoming a non-mimic, stop mimicking anything */ if (mons[mntmp].mlet != S_MIMIC) { /* as in polyman() */ - youmonst.m_ap_type = M_AP_NOTHING; + g.youmonst.m_ap_type = M_AP_NOTHING; } if (is_male(&mons[mntmp])) { if (flags.female) @@ -684,7 +684,7 @@ int mntmp; You("no longer feel sick."); } if (Slimed) { - if (flaming(youmonst.data)) { + if (flaming(g.youmonst.data)) { make_slimed(0L, "The slime burns away!"); } else if (mntmp == PM_GREEN_SLIME) { /* do it silently */ @@ -692,7 +692,7 @@ int mntmp; } } check_strangling(FALSE); /* maybe stop strangling */ - if (nohands(youmonst.data)) + if (nohands(g.youmonst.data)) Glib = 0; /* @@ -701,9 +701,9 @@ int mntmp; * "experience level of you as a monster" for a polymorphed character. */ mlvl = (int) mons[mntmp].mlevel; - if (youmonst.data->mlet == S_DRAGON && mntmp >= PM_GRAY_DRAGON) { + if (g.youmonst.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(youmonst.data)) { + } else if (is_golem(g.youmonst.data)) { u.mhmax = golemhp(mntmp); } else { if (!mlvl) @@ -731,7 +731,7 @@ int mntmp; skinback(FALSE); break_armor(); drop_weapon(1); - (void) hideunder(&youmonst); + (void) hideunder(&g.youmonst); if (u.utrap && u.utraptype == TT_PIT) { set_utrap(rn1(6, 2), TT_PIT); /* time to escape resets */ @@ -742,9 +742,9 @@ int mntmp; } newsym(u.ux, u.uy); /* Change symbol */ - if (!sticky && !u.uswallow && u.ustuck && sticks(youmonst.data)) + if (!sticky && !u.uswallow && u.ustuck && sticks(g.youmonst.data)) u.ustuck = 0; - else if (sticky && !sticks(youmonst.data)) + else if (sticky && !sticks(g.youmonst.data)) uunstick(); if (u.usteed) { if (touch_petrifies(u.usteed->data) && !Stone_resistance && rnl(3)) { @@ -761,37 +761,37 @@ int mntmp; static const char use_thec[] = "Use the command #%s to %s."; static const char monsterc[] = "monster"; - if (can_breathe(youmonst.data)) + if (can_breathe(g.youmonst.data)) pline(use_thec, monsterc, "use your breath weapon"); - if (attacktype(youmonst.data, AT_SPIT)) + if (attacktype(g.youmonst.data, AT_SPIT)) pline(use_thec, monsterc, "spit venom"); - if (youmonst.data->mlet == S_NYMPH) + if (g.youmonst.data->mlet == S_NYMPH) pline(use_thec, monsterc, "remove an iron ball"); - if (attacktype(youmonst.data, AT_GAZE)) + if (attacktype(g.youmonst.data, AT_GAZE)) pline(use_thec, monsterc, "gaze at monsters"); - if (is_hider(youmonst.data)) + if (is_hider(g.youmonst.data)) pline(use_thec, monsterc, "hide"); - if (is_were(youmonst.data)) + if (is_were(g.youmonst.data)) pline(use_thec, monsterc, "summon help"); - if (webmaker(youmonst.data)) + if (webmaker(g.youmonst.data)) pline(use_thec, monsterc, "spin a web"); if (u.umonnum == PM_GREMLIN) pline(use_thec, monsterc, "multiply in a fountain"); - if (is_unicorn(youmonst.data)) + if (is_unicorn(g.youmonst.data)) pline(use_thec, monsterc, "use your horn"); - if (is_mind_flayer(youmonst.data)) + if (is_mind_flayer(g.youmonst.data)) pline(use_thec, monsterc, "emit a mental blast"); - if (youmonst.data->msound == MS_SHRIEK) /* worthless, actually */ + if (g.youmonst.data->msound == MS_SHRIEK) /* worthless, actually */ pline(use_thec, monsterc, "shriek"); - if (is_vampire(youmonst.data)) + if (is_vampire(g.youmonst.data)) pline(use_thec, monsterc, "change shape"); - if (lays_eggs(youmonst.data) && flags.female) + if (lays_eggs(g.youmonst.data) && flags.female) pline(use_thec, "sit", "lay an egg"); } /* you now know what an egg of your type looks like */ - if (lays_eggs(youmonst.data)) { + if (lays_eggs(g.youmonst.data)) { learn_egg_type(u.umonnum); /* make queen bees recognize killer bee eggs */ learn_egg_type(egg_type_from_parent(u.umonnum, TRUE)); @@ -809,13 +809,13 @@ int mntmp; buried_ball_to_freedom(); } reset_utrap(TRUE); - } else if (likes_lava(youmonst.data) && u.utrap + } else if (likes_lava(g.youmonst.data) && u.utrap && u.utraptype == TT_LAVA) { pline_The("%s now feels soothing.", hliquid("lava")); reset_utrap(TRUE); } - if (amorphous(youmonst.data) || is_whirly(youmonst.data) - || unsolid(youmonst.data)) { + if (amorphous(g.youmonst.data) || is_whirly(g.youmonst.data) + || unsolid(g.youmonst.data)) { if (Punished) { You("slip out of the iron chain."); unpunish(); @@ -825,15 +825,15 @@ int mntmp; } } if (u.utrap && (u.utraptype == TT_WEB || u.utraptype == TT_BEARTRAP) - && (amorphous(youmonst.data) || is_whirly(youmonst.data) - || unsolid(youmonst.data) || (youmonst.data->msize <= MZ_SMALL + && (amorphous(g.youmonst.data) || is_whirly(g.youmonst.data) + || unsolid(g.youmonst.data) || (g.youmonst.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(youmonst.data) && u.utrap && u.utraptype == TT_WEB) { + if (webmaker(g.youmonst.data) && u.utrap && u.utraptype == TT_WEB) { You("orient yourself on the web."); reset_utrap(TRUE); } @@ -858,7 +858,7 @@ break_armor() { register struct obj *otmp; - if (breakarm(youmonst.data)) { + if (breakarm(g.youmonst.data)) { if ((otmp = uarm) != 0) { if (donning(otmp)) cancel_don(); @@ -882,8 +882,8 @@ break_armor() Your("shirt rips to shreds!"); useup(uarmu); } - } else if (sliparm(youmonst.data)) { - if (((otmp = uarm) != 0) && (racial_exception(&youmonst, otmp) < 1)) { + } else if (sliparm(g.youmonst.data)) { + if (((otmp = uarm) != 0) && (racial_exception(&g.youmonst, otmp) < 1)) { if (donning(otmp)) cancel_don(); Your("armor falls around you!"); @@ -891,7 +891,7 @@ break_armor() dropx(otmp); } if ((otmp = uarmc) != 0) { - if (is_whirly(youmonst.data)) + if (is_whirly(g.youmonst.data)) Your("%s falls, unsupported!", cloak_simple_name(otmp)); else You("shrink out of your %s!", cloak_simple_name(otmp)); @@ -899,7 +899,7 @@ break_armor() dropx(otmp); } if ((otmp = uarmu) != 0) { - if (is_whirly(youmonst.data)) + if (is_whirly(g.youmonst.data)) You("seep right through your shirt!"); else You("become much too small for your shirt!"); @@ -907,13 +907,13 @@ break_armor() dropx(otmp); } } - if (has_horns(youmonst.data)) { + if (has_horns(g.youmonst.data)) { if ((otmp = uarmh) != 0) { if (is_flimsy(otmp) && !donning(otmp)) { char hornbuf[BUFSZ]; /* Future possibilities: This could damage/destroy helmet */ - Sprintf(hornbuf, "horn%s", plur(num_horns(youmonst.data))); + Sprintf(hornbuf, "horn%s", plur(num_horns(g.youmonst.data))); Your("%s %s through %s.", hornbuf, vtense(hornbuf, "pierce"), yname(otmp)); } else { @@ -926,7 +926,7 @@ break_armor() } } } - if (nohands(youmonst.data) || verysmall(youmonst.data)) { + if (nohands(g.youmonst.data) || verysmall(g.youmonst.data)) { if ((otmp = uarmg) != 0) { if (donning(otmp)) cancel_don(); @@ -950,16 +950,16 @@ break_armor() dropx(otmp); } } - if (nohands(youmonst.data) || verysmall(youmonst.data) - || slithy(youmonst.data) || youmonst.data->mlet == S_CENTAUR) { + if (nohands(g.youmonst.data) || verysmall(g.youmonst.data) + || slithy(g.youmonst.data) || g.youmonst.data->mlet == S_CENTAUR) { if ((otmp = uarmf) != 0) { if (donning(otmp)) cancel_don(); - if (is_whirly(youmonst.data)) + if (is_whirly(g.youmonst.data)) Your("boots fall away!"); else Your("boots %s off your feet!", - verysmall(youmonst.data) ? "slide" : "are pushed"); + verysmall(g.youmonst.data) ? "slide" : "are pushed"); (void) Boots_off(); dropx(otmp); } @@ -979,7 +979,7 @@ int alone; * future it might not be so if there are monsters which cannot * wear gloves but can wield weapons */ - if (!alone || cantwield(youmonst.data)) { + if (!alone || cantwield(g.youmonst.data)) { candropwep = canletgo(uwep, ""); candropswapwep = !u.twoweap || canletgo(uswapwep, ""); if (alone) { @@ -1017,7 +1017,7 @@ int alone; if (updateinv) update_inventory(); - } else if (!could_twoweap(youmonst.data)) { + } else if (!could_twoweap(g.youmonst.data)) { untwoweapon(); } } @@ -1041,8 +1041,8 @@ rehumanize() } } - if (emits_light(youmonst.data)) - del_light_source(LS_MONSTER, monst_to_any(&youmonst)); + if (emits_light(g.youmonst.data)) + del_light_source(LS_MONSTER, monst_to_any(&g.youmonst)); polyman("return to %s form!", urace.adj); if (u.uhp < 1) { @@ -1085,7 +1085,7 @@ dobreathe() if (!getdir((char *) 0)) return 0; - mattk = attacktype_fordmg(youmonst.data, AT_BREA, AD_ANY); + mattk = attacktype_fordmg(g.youmonst.data, AT_BREA, AD_ANY); if (!mattk) impossible("bad breath attack?"); /* mouthwash needed... */ else if (!u.dx && !u.dy && !u.dz) @@ -1104,7 +1104,7 @@ dospit() if (!getdir((char *) 0)) return 0; - mattk = attacktype_fordmg(youmonst.data, AT_SPIT, AD_ANY); + mattk = attacktype_fordmg(g.youmonst.data, AT_SPIT, AD_ANY); if (!mattk) { impossible("bad spit attack?"); } else { @@ -1273,7 +1273,7 @@ dosummon() You("call upon your brethren for help!"); exercise(A_WIS, TRUE); - if (!were_summon(youmonst.data, TRUE, &placeholder, (char *) 0)) + if (!were_summon(g.youmonst.data, TRUE, &placeholder, (char *) 0)) pline("But none arrive."); return 1; } @@ -1288,8 +1288,8 @@ dogaze() uchar adtyp = 0; for (i = 0; i < NATTK; i++) { - if (youmonst.data->mattk[i].aatyp == AT_GAZE) { - adtyp = youmonst.data->mattk[i].adtyp; + if (g.youmonst.data->mattk[i].aatyp == AT_GAZE) { + adtyp = g.youmonst.data->mattk[i].adtyp; break; } } @@ -1416,8 +1416,8 @@ dogaze() int dohide() { - boolean ismimic = youmonst.data->mlet == S_MIMIC, - on_ceiling = is_clinger(youmonst.data) || Flying; + boolean ismimic = g.youmonst.data->mlet == S_MIMIC, + on_ceiling = is_clinger(g.youmonst.data) || Flying; /* can't hide while being held (or holding) or while trapped (except for floor hiders [trapper or mimic] in pits) */ @@ -1426,20 +1426,20 @@ dohide() !u.ustuck ? "trapped" : u.uswallow ? (is_animal(u.ustuck->data) ? "swallowed" : "engulfed") - : !sticks(youmonst.data) ? "being held" + : !sticks(g.youmonst.data) ? "being held" : (humanoid(u.ustuck->data) ? "holding someone" : "holding that creature")); if (u.uundetected - || (ismimic && youmonst.m_ap_type != M_AP_NOTHING)) { + || (ismimic && g.youmonst.m_ap_type != M_AP_NOTHING)) { u.uundetected = 0; - youmonst.m_ap_type = M_AP_NOTHING; + g.youmonst.m_ap_type = M_AP_NOTHING; newsym(u.ux, u.uy); } return 0; } /* note: the eel and hides_under cases are hypothetical; such critters aren't offered the option of hiding via #monster */ - if (youmonst.data->mlet == S_EEL && !is_pool(u.ux, u.uy)) { + if (g.youmonst.data->mlet == S_EEL && !is_pool(u.ux, u.uy)) { if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) The("fountain is not deep enough to hide in."); else @@ -1447,7 +1447,7 @@ dohide() u.uundetected = 0; return 0; } - if (hides_under(youmonst.data) && !g.level.objects[u.ux][u.uy]) { + if (hides_under(g.youmonst.data) && !g.level.objects[u.ux][u.uy]) { There("is nothing to hide under here."); u.uundetected = 0; return 0; @@ -1458,7 +1458,7 @@ dohide() u.uundetected = 0; return 0; } - if ((is_hider(youmonst.data) && !Flying) /* floor hider */ + if ((is_hider(g.youmonst.data) && !Flying) /* floor hider */ && (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))) { There("is nowhere to hide beneath you."); u.uundetected = 0; @@ -1468,15 +1468,15 @@ dohide() * else make youhiding() give smarter messages at such spots. */ - if (u.uundetected || (ismimic && youmonst.m_ap_type != M_AP_NOTHING)) { + if (u.uundetected || (ismimic && g.youmonst.m_ap_type != M_AP_NOTHING)) { youhiding(FALSE, 1); /* "you are already hiding" */ return 0; } if (ismimic) { /* should bring up a dialog "what would you like to imitate?" */ - youmonst.m_ap_type = M_AP_OBJECT; - youmonst.mappearance = STRANGE_OBJECT; + g.youmonst.m_ap_type = M_AP_OBJECT; + g.youmonst.mappearance = STRANGE_OBJECT; } else u.uundetected = 1; newsym(u.ux, u.uy); @@ -1487,12 +1487,12 @@ dohide() int dopoly() { - struct permonst *savedat = youmonst.data; + struct permonst *savedat = g.youmonst.data; - if (is_vampire(youmonst.data)) { + if (is_vampire(g.youmonst.data)) { polyself(2); - if (savedat != youmonst.data) { - You("transform into %s.", an(youmonst.data->mname)); + if (savedat != g.youmonst.data) { + You("transform into %s.", an(g.youmonst.data->mname)); newsym(u.ux, u.uy); } } @@ -1719,7 +1719,7 @@ const char * body_part(part) int part; { - return mbodypart(&youmonst, part); + return mbodypart(&g.youmonst, part); } int @@ -1728,7 +1728,7 @@ poly_gender() /* Returns gender of polymorphed player; * 0/1=same meaning as flags.female, 2=none. */ - if (is_neuter(youmonst.data) || !humanoid(youmonst.data)) + if (is_neuter(g.youmonst.data) || !humanoid(g.youmonst.data)) return 2; return flags.female; } @@ -1855,9 +1855,9 @@ udeadinside() 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(youmonst.data) + return !nonliving(g.youmonst.data) ? "dead" /* living, including demons */ - : !weirdnonliving(youmonst.data) + : !weirdnonliving(g.youmonst.data) ? "condemned" /* undead plus manes */ : "empty"; /* golems plus vortices */ } diff --git a/src/potion.c b/src/potion.c index 2d7bb67d5..b2389896a 100644 --- a/src/potion.c +++ b/src/potion.c @@ -94,7 +94,7 @@ boolean talk; if (u.usteed) You("wobble in the saddle."); else - You("%s...", stagger(youmonst.data, "stagger")); + You("%s...", stagger(g.youmonst.data, "stagger")); } } if ((!xtime && old) || (xtime && !old)) @@ -261,11 +261,11 @@ boolean talk; } else if (old && !xtime) { /* clearing temporary blindness without toggling blindness */ if (talk) { - if (!haseyes(youmonst.data)) { + if (!haseyes(g.youmonst.data)) { strange_feeling((struct obj *) 0, (char *) 0); } else if (Blindfolded) { eyes = body_part(EYE); - if (eyecount(youmonst.data) != 1) + if (eyecount(g.youmonst.data) != 1) eyes = makeplural(eyes); Your(eyemsg, eyes, vtense(eyes, "itch")); } else { /* Eyes of the Overworld */ @@ -287,11 +287,11 @@ boolean talk; } else if (!old && xtime) { /* setting temporary blindness without toggling blindness */ if (talk) { - if (!haseyes(youmonst.data)) { + if (!haseyes(g.youmonst.data)) { strange_feeling((struct obj *) 0, (char *) 0); } else if (Blindfolded) { eyes = body_part(EYE); - if (eyecount(youmonst.data) != 1) + if (eyecount(g.youmonst.data) != 1) eyes = makeplural(eyes); Your(eyemsg, eyes, vtense(eyes, "twitch")); } else { /* Eyes of the Overworld */ @@ -372,12 +372,12 @@ long mask; /* nonzero if resistance status should change by mask */ /* clearing temporary hallucination without toggling vision */ if (!changed && !HHallucination && old && talk) { - if (!haseyes(youmonst.data)) { + if (!haseyes(g.youmonst.data)) { strange_feeling((struct obj *) 0, (char *) 0); } else if (Blind) { const char *eyes = body_part(EYE); - if (eyecount(youmonst.data) != 1) + if (eyecount(g.youmonst.data) != 1) eyes = makeplural(eyes); Your(eyemsg, eyes, vtense(eyes, "itch")); } else { /* Grayswandir */ @@ -627,7 +627,7 @@ register struct obj *otmp; break; } g.potion_unkn++; - if (is_undead(youmonst.data) || is_demon(youmonst.data) + if (is_undead(g.youmonst.data) || is_demon(g.youmonst.data) || u.ualign.type == A_CHAOTIC) { if (otmp->blessed) { pline("This burns like %s!", hliquid("acid")); @@ -635,7 +635,7 @@ register struct obj *otmp; if (u.ulycn >= LOW_PM) { Your("affinity to %s disappears!", makeplural(mons[u.ulycn].mname)); - if (youmonst.data == &mons[u.ulycn]) + if (g.youmonst.data == &mons[u.ulycn]) you_unwere(FALSE); set_ulycn(NON_PM); /* cure lycanthropy */ } @@ -1091,7 +1091,7 @@ register struct obj *otmp; boolean good_for_you = FALSE; if (otmp->lamplit) { - if (likes_fire(youmonst.data)) { + if (likes_fire(g.youmonst.data)) { pline("Ahh, a refreshing drink."); good_for_you = TRUE; } else { @@ -1276,7 +1276,7 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */ return res; } -/* potion obj hits monster mon, which might be youmonst; obj always used up */ +/* potion obj hits monster mon, which might be g.youmonst; obj always used up */ void potionhit(mon, obj, how) struct monst *mon; @@ -1284,7 +1284,7 @@ struct obj *obj; int how; { const char *botlnam = bottlename(); - boolean isyou = (mon == &youmonst); + boolean isyou = (mon == &g.youmonst); int distance, tx, ty; struct obj *saddle = (struct obj *) 0; boolean hit_saddle = FALSE, your_fault = (how <= POTHIT_HERO_THROW); @@ -1553,7 +1553,7 @@ int how; /* Note: potionbreathe() does its own docall() */ if ((distance == 0 || (distance < 3 && rn2(5))) - && (!breathless(youmonst.data) || haseyes(youmonst.data))) + && (!breathless(g.youmonst.data) || haseyes(g.youmonst.data))) potionbreathe(obj); else if (obj->dknown && !objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname && cansee(tx, ty)) @@ -1593,12 +1593,12 @@ register struct obj *obj; case POT_RESTORE_ABILITY: case POT_GAIN_ABILITY: if (obj->cursed) { - if (!breathless(youmonst.data)) + if (!breathless(g.youmonst.data)) pline("Ulch! That potion smells terrible!"); - else if (haseyes(youmonst.data)) { + else if (haseyes(g.youmonst.data)) { const char *eyes = body_part(EYE); - if (eyecount(youmonst.data) != 1) + if (eyecount(g.youmonst.data) != 1) eyes = makeplural(eyes); Your("%s %s!", eyes, vtense(eyes, "sting")); } @@ -1716,11 +1716,11 @@ register struct obj *obj; break; case POT_WATER: if (u.umonnum == PM_GREMLIN) { - (void) split_mon(&youmonst, (struct monst *) 0); + (void) split_mon(&g.youmonst, (struct monst *) 0); } else if (u.ulycn >= LOW_PM) { /* vapor from [un]holy water will trigger transformation but won't cure lycanthropy */ - if (obj->blessed && youmonst.data == &mons[u.ulycn]) + if (obj->blessed && g.youmonst.data == &mons[u.ulycn]) you_unwere(FALSE); else if (obj->cursed && !Upolyd) you_were(); @@ -2005,7 +2005,7 @@ dodip() pline("BOOM! They explode!"); wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1)); exercise(A_STR, FALSE); - if (!breathless(youmonst.data) || haseyes(youmonst.data)) + if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) potionbreathe(obj); useupall(obj); useup(potion); @@ -2340,10 +2340,10 @@ struct monst *mon, /* monster being split */ reason[0] = '\0'; if (mtmp) Sprintf(reason, " from %s heat", - (mtmp == &youmonst) ? the_your[1] + (mtmp == &g.youmonst) ? the_your[1] : (const char *) s_suffix(mon_nam(mtmp))); - if (mon == &youmonst) { + if (mon == &g.youmonst) { mtmp2 = cloneu(); if (mtmp2) { mtmp2->mhpmax = u.mhmax / 2; diff --git a/src/pray.c b/src/pray.c index e10b81f8f..77cbcefe5 100644 --- a/src/pray.c +++ b/src/pray.c @@ -153,7 +153,7 @@ stuck_in_wall() if (!isok(x, y) || (IS_ROCK(levl[x][y].typ) && (levl[x][y].typ != SDOOR || levl[x][y].typ != SCORR)) - || (blocked_boulder(i, j) && !throws_rocks(youmonst.data))) + || (blocked_boulder(i, j) && !throws_rocks(g.youmonst.data))) ++count; } } @@ -209,13 +209,13 @@ in_trouble() || stuck_ring(uleft, RIN_LEVITATION) || stuck_ring(uright, RIN_LEVITATION)) return TROUBLE_CURSED_LEVITATION; - if (nohands(youmonst.data) || !freehand()) { + if (nohands(g.youmonst.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(youmonst.data) + if (Upolyd && nohands(g.youmonst.data) && (!Unchanging || ((otmp = unchanger()) != 0 && otmp->cursed))) return TROUBLE_UNUSEABLE_HANDS; } @@ -238,7 +238,7 @@ in_trouble() return TROUBLE_SADDLE; } - if (Blinded > 1 && haseyes(youmonst.data) + if (Blinded > 1 && haseyes(g.youmonst.data) && (!u.uswallow || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))) return TROUBLE_BLIND; @@ -266,7 +266,7 @@ worst_cursed_item() /* if strained or worse, check for loadstone first */ if (near_capacity() >= HVY_ENCUMBER) { - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (Cursed_obj(otmp, LOADSTONE)) return otmp; } @@ -310,7 +310,7 @@ worst_cursed_item() otmp = uswapwep; /* all worn items ought to be handled by now */ } else { - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (!otmp->cursed) continue; if (otmp->otyp == LOADSTONE || confers_luck(otmp)) @@ -438,7 +438,7 @@ int trouble; otmp = uwep; goto decurse; } - if (Upolyd && nohands(youmonst.data)) { + if (Upolyd && nohands(g.youmonst.data)) { if (!Unchanging) { Your("shape becomes uncertain."); rehumanize(); /* "You return to {normal} form." */ @@ -447,7 +447,7 @@ int trouble; goto decurse; } } - if (nohands(youmonst.data) || !freehand()) + if (nohands(g.youmonst.data) || !freehand()) impossible("fix_worst_trouble: couldn't cure hands."); break; case TROUBLE_CURSED_BLINDFOLD: @@ -511,7 +511,7 @@ int trouble; case TROUBLE_BLIND: { const char *eyes = body_part(EYE); - if (eyecount(youmonst.data) != 1) + if (eyecount(g.youmonst.data) != 1) eyes = makeplural(eyes); Your("%s %s better.", eyes, vtense(eyes, "feel")); u.ucreamed = 0; @@ -673,7 +673,7 @@ aligntyp resp_god; (ugod_is_angry() && resp_god == u.ualign.type) ? "hast strayed from the path" : "art arrogant", - youmonst.data->mlet == S_HUMAN ? "mortal" : "creature"); + g.youmonst.data->mlet == S_HUMAN ? "mortal" : "creature"); verbalize("Thou must relearn thy lessons!"); (void) adjattrib(A_WIS, -1, FALSE); losexp((char *) 0); @@ -699,7 +699,7 @@ aligntyp resp_god; ? "scorn" : "call upon"); pline("\"Then die, %s!\"", - youmonst.data->mlet == S_HUMAN ? "mortal" : "creature"); + g.youmonst.data->mlet == S_HUMAN ? "mortal" : "creature"); summon_minion(resp_god, FALSE); break; @@ -1038,7 +1038,7 @@ aligntyp g_align; if (!u.uevent.uopened_dbridge && !u.uevent.gehennom_entered) { if (u.uevent.uheard_tune < 1) { godvoice(g_align, (char *) 0); - verbalize("Hark, %s!", youmonst.data->mlet == S_HUMAN + verbalize("Hark, %s!", g.youmonst.data->mlet == S_HUMAN ? "mortal" : "creature"); verbalize( @@ -1096,7 +1096,7 @@ aligntyp g_align; You_feel("the power of %s.", u_gname()); else You("are surrounded by %s aura.", an(hcolor(NH_LIGHT_BLUE))); - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (otmp->cursed && (otmp != uarmh /* [see worst_cursed_item()] */ || uarmh->otyp != HELM_OF_OPPOSITE_ALIGNMENT)) { @@ -1342,7 +1342,7 @@ dosacrifice() } if (your_race(ptr)) { - if (is_demon(youmonst.data)) { + if (is_demon(g.youmonst.data)) { You("find the idea very satisfying."); exercise(A_WIS, TRUE); } else if (u.ualign.type != A_CHAOTIC) { @@ -1766,7 +1766,7 @@ boolean praying; /* false means no messages should be given */ g.p_aligntyp = on_altar() ? a_align(u.ux, u.uy) : u.ualign.type; g.p_trouble = in_trouble(); - if (is_demon(youmonst.data) && (g.p_aligntyp != A_CHAOTIC)) { + if (is_demon(g.youmonst.data) && (g.p_aligntyp != A_CHAOTIC)) { if (praying) pline_The("very idea of praying to a %s god is repugnant to you.", g.p_aligntyp ? "lawful" : "neutral"); @@ -1796,7 +1796,7 @@ boolean praying; /* false means no messages should be given */ g.p_type = 3; } - if (is_undead(youmonst.data) && !Inhell + if (is_undead(g.youmonst.data) && !Inhell && (g.p_aligntyp == A_LAWFUL || (g.p_aligntyp == A_NEUTRAL && !rn2(10)))) g.p_type = -1; /* Note: when !praying, the random factor for neutrals makes the @@ -1932,7 +1932,7 @@ doturn() u.uconduct.gnostic++; if ((u.ualign.type != A_CHAOTIC - && (is_demon(youmonst.data) || is_undead(youmonst.data))) + && (is_demon(g.youmonst.data) || is_undead(g.youmonst.data))) || u.ugangr > 6) { /* "Die, mortal!" */ pline("For some reason, %s seems to ignore you.", u_gname()); aggravate(); diff --git a/src/priest.c b/src/priest.c index 7814fb1a5..26e981f08 100644 --- a/src/priest.c +++ b/src/priest.c @@ -573,7 +573,7 @@ register struct monst *priest; priest->mpeaceful = 0; return; } - if (!money_cnt(invent)) { + if (!money_cnt(g.invent)) { if (coaligned && !strayed) { long pmoney = money_cnt(priest->minvent); if (pmoney > 0L) { @@ -597,7 +597,7 @@ register struct monst *priest; if (coaligned) adjalign(-1); } else if (offer < (u.ulevel * 200)) { - if (money_cnt(invent) > (offer * 2L)) { + if (money_cnt(g.invent) > (offer * 2L)) { verbalize("Cheapskate."); } else { verbalize("I thank thee for thy contribution."); @@ -606,7 +606,7 @@ register struct monst *priest; } } else if (offer < (u.ulevel * 400)) { verbalize("Thou art indeed a pious individual."); - if (money_cnt(invent) < (offer * 2L)) { + if (money_cnt(g.invent) < (offer * 2L)) { if (coaligned && u.ualign.record <= ALGN_SINNED) adjalign(1); verbalize("I bestow upon thee a blessing."); @@ -629,7 +629,7 @@ register struct monst *priest; u.ublessed++; } else { verbalize("Thy selfless generosity is deeply appreciated."); - if (money_cnt(invent) < (offer * 2L) && coaligned) { + if (money_cnt(g.invent) < (offer * 2L) && coaligned) { if (strayed && (g.moves - u.ucleansed) > 5000L) { u.ualign.record = 0; /* cleanse thee */ u.ucleansed = g.moves; @@ -1007,7 +1007,7 @@ struct monst *mtmp; if (mtmp->minvis) Strcat(info, ", invisible"); if (mtmp == u.ustuck) - Strcat(info, sticks(youmonst.data) ? ", held by you" + Strcat(info, sticks(g.youmonst.data) ? ", held by you" : !u.uswallow ? ", holding you" : attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_DGST) ? ", digesting you" @@ -1057,7 +1057,7 @@ ustatusline() Strcat(info, ", blind"); if (u.ucreamed) { if ((long) u.ucreamed < Blinded || Blindfolded - || !haseyes(youmonst.data)) + || !haseyes(g.youmonst.data)) Strcat(info, ", cover"); Strcat(info, "ed by sticky goop"); } /* note: "goop" == "glop"; variation is intentional */ @@ -1081,7 +1081,7 @@ ustatusline() if (Invis) Strcat(info, ", invisible"); if (u.ustuck) { - if (sticks(youmonst.data)) + if (sticks(g.youmonst.data)) Strcat(info, ", holding "); else Strcat(info, ", held by "); diff --git a/src/quest.c b/src/quest.c index babcd67cf..46a30e667 100644 --- a/src/quest.c +++ b/src/quest.c @@ -266,7 +266,7 @@ chat_with_leader() } else if (u.uhave.questart) { struct obj *otmp; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (is_quest_artifact(otmp)) break; diff --git a/src/questpgr.c b/src/questpgr.c index cd2200399..1799ce8de 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -213,7 +213,7 @@ unsigned whichchains; struct obj *qarti = 0; if ((whichchains & (1 << OBJ_INVENT)) != 0) - qarti = find_qarti(invent); + qarti = find_qarti(g.invent); if (!qarti && (whichchains & (1 << OBJ_FLOOR)) != 0) qarti = find_qarti(fobj); if (!qarti && (whichchains & (1 << OBJ_MINVENT)) != 0) diff --git a/src/read.c b/src/read.c index 8d356e01d..f7a726c4b 100644 --- a/src/read.c +++ b/src/read.c @@ -369,7 +369,7 @@ doread() } scroll->in_use = TRUE; /* scroll, not spellbook, now being read */ if (scroll->otyp != SCR_BLANK_PAPER) { - boolean silently = !can_chant(&youmonst); + boolean silently = !can_chant(&g.youmonst); /* a few scroll feedback messages describe something happening to the scroll itself, so avoid "it disappears" for those */ @@ -1031,7 +1031,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ boolean special_armor; boolean same_color; - otmp = some_armor(&youmonst); + otmp = some_armor(&g.youmonst); if (!otmp) { strange_feeling(sobj, !Blind ? "Your skin glows then fades." @@ -1153,7 +1153,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ break; } case SCR_DESTROY_ARMOR: { - otmp = some_armor(&youmonst); + otmp = some_armor(&g.youmonst); if (confused) { if (!otmp) { strange_feeling(sobj, "Your bones itch."); @@ -1194,7 +1194,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ } break; case SCR_CONFUSE_MONSTER: case SPE_CONFUSE_MONSTER: - if (youmonst.data->mlet != S_HUMAN || scursed) { + if (g.youmonst.data->mlet != S_HUMAN || scursed) { if (!HConfusion) You_feel("confused."); make_confused(HConfusion + rnd(100), FALSE); @@ -1277,7 +1277,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ if (scursed) { pline_The("scroll disintegrates."); } else { - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { long wornmask; /* gold isn't subject to cursing and blessing */ @@ -1481,7 +1481,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ sobj = 0; /* it's gone */ if (confused) You("identify this as an identify scroll."); - else if (!already_known || !invent) + else if (!already_known || !g.invent) /* force feedback now if invent became empty after using up this scroll */ pline("This is an identify scroll."); @@ -1496,7 +1496,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ if (cval == 1 && sblessed && Luck > 0) ++cval; } - if (invent && !confused) { + if (g.invent && !confused) { identify_pack(cval, !already_known); } else if (otyp == SPE_IDENTIFY) { /* when casting a spell we know we're not confused, @@ -1738,10 +1738,10 @@ boolean confused, helmet_protects, byu, skip_uswallow; return; otmp2->quan = confused ? rn1(5, 2) : 1; otmp2->owt = weight(otmp2); - if (!amorphous(youmonst.data) && !Passes_walls - && !noncorporeal(youmonst.data) && !unsolid(youmonst.data)) { + if (!amorphous(g.youmonst.data) && !Passes_walls + && !noncorporeal(g.youmonst.data) && !unsolid(g.youmonst.data)) { You("are hit by %s!", doname(otmp2)); - dmg = dmgval(otmp2, &youmonst) * otmp2->quan; + dmg = dmgval(otmp2, &g.youmonst) * otmp2->quan; if (uarmh && helmet_protects) { if (is_metallic(uarmh)) { pline("Fortunately, you are wearing a hard helmet."); @@ -1945,7 +1945,7 @@ struct obj *obj; } /* the magic douses lamps, et al, too */ - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->lamplit) (void) snuff_lit(otmp); } else { /* on */ @@ -2247,7 +2247,7 @@ int how; continue; } /* KMH -- Unchanging prevents rehumanization */ - if (Unchanging && ptr == youmonst.data) + if (Unchanging && ptr == g.youmonst.data) killplayer++; break; } @@ -2257,7 +2257,7 @@ int how; which = "all "; if (Hallucination) { if (Upolyd) - Strcpy(buf, youmonst.data->mname); + Strcpy(buf, g.youmonst.data->mname); else { Strcpy(buf, (flags.female && urole.name.f) ? urole.name.f : urole.name.m); @@ -2301,12 +2301,12 @@ int how; /* Polymorphed characters will die as soon as they're rehumanized. */ /* KMH -- Unchanging prevents rehumanization */ - if (Upolyd && ptr != youmonst.data) { + if (Upolyd && ptr != g.youmonst.data) { delayed_killer(POLYMORPH, g.killer.format, g.killer.name); You_feel("%s inside.", udeadinside()); } else done(GENOCIDED); - } else if (ptr == youmonst.data) { + } else if (ptr == g.youmonst.data) { rehumanize(); } reset_rndmonst(mndx); @@ -2350,8 +2350,8 @@ struct obj *sobj; uball->owt += IRON_BALL_W_INCR * (1 + sobj->cursed); return; } - if (amorphous(youmonst.data) || is_whirly(youmonst.data) - || unsolid(youmonst.data)) { + if (amorphous(g.youmonst.data) || is_whirly(g.youmonst.data) + || unsolid(g.youmonst.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 846e78031..3c3fcba4d 100644 --- a/src/region.c +++ b/src/region.c @@ -955,7 +955,7 @@ genericptr_t p2; reg = (NhRegion *) p1; dam = reg->arg.a_int; if (p2 == (genericptr_t) 0) { /* This means *YOU* Bozo! */ - if (u.uinvulnerable || nonliving(youmonst.data) || Breathless + if (u.uinvulnerable || nonliving(g.youmonst.data) || Breathless || Underwater) return FALSE; if (!Blind) { @@ -1064,7 +1064,7 @@ region_danger() /* 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(youmonst.data) || Breathless) + if (nonliving(g.youmonst.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 4f1035a29..424af1a21 100644 --- a/src/restore.c +++ b/src/restore.c @@ -122,7 +122,7 @@ boolean quietly; { register struct obj *otmp, *otmp2; - for (otmp = invent; otmp; otmp = otmp2) { + for (otmp = g.invent; otmp; otmp = otmp2) { otmp2 = otmp->nobj; if (otmp->in_use) { if (!quietly) @@ -635,7 +635,7 @@ unsigned int *stuckid, *steedid; restore_killers(fd); restore_timers(fd, RANGE_GLOBAL, FALSE, 0L); restore_light_sources(fd); - invent = restobjchn(fd, FALSE, FALSE); + g.invent = restobjchn(fd, FALSE, FALSE); /* tmp_bc only gets set here if the ball & chain were orphaned because you were swallowed; otherwise they will be on the floor or in your inventory */ @@ -661,7 +661,7 @@ unsigned int *stuckid, *steedid; g.defer_see_monsters = TRUE; /* this comes after inventory has been loaded */ - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->owornmask) setworn(otmp, otmp->owornmask); /* reset weapon so that player will get a reminder about "bashing" diff --git a/src/rumors.c b/src/rumors.c index d77617309..06b52d86a 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -477,7 +477,7 @@ struct monst *oracl; char qbuf[QBUFSZ]; g.multi = 0; - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); if (!oracl) { There("is no one here to consult."); diff --git a/src/save.c b/src/save.c index f4b8b9934..74bcca773 100644 --- a/src/save.c +++ b/src/save.c @@ -304,7 +304,7 @@ register int fd, mode; save_timers(fd, mode, RANGE_GLOBAL); save_light_sources(fd, mode, RANGE_GLOBAL); - saveobjchn(fd, invent, mode); + saveobjchn(fd, g.invent, mode); if (BALL_IN_MON) { /* prevent loss of ball & chain when swallowed */ uball->nobj = uchain; @@ -317,7 +317,7 @@ register int fd, mode; saveobjchn(fd, g.migrating_objs, mode); savemonchn(fd, g.migrating_mons, mode); if (release_data(mode)) { - invent = 0; + g.invent = 0; g.migrating_objs = 0; g.migrating_mons = 0; } @@ -1368,7 +1368,7 @@ freedynamicdata() free_killers(); free_timers(RANGE_GLOBAL); free_light_sources(RANGE_GLOBAL); - freeobjchn(invent); + freeobjchn(g.invent); freeobjchn(g.migrating_objs); freemonchn(g.migrating_mons); freemonchn(g.mydogs); /* ascension or dungeon escape */ diff --git a/src/shk.c b/src/shk.c index b41dfa41f..a3adb309f 100644 --- a/src/shk.c +++ b/src/shk.c @@ -101,7 +101,7 @@ money2mon(mon, amount) struct monst *mon; long amount; { - struct obj *ygold = findgold(invent); + struct obj *ygold = findgold(g.invent); if (amount <= 0) { impossible("%s payment in money2mon!", amount ? "negative" : "zero"); @@ -148,7 +148,7 @@ long amount; mongold = splitobj(mongold, amount); obj_extract_self(mongold); - if (!merge_choice(invent, mongold) && inv_cnt(FALSE) >= 52) { + if (!merge_choice(g.invent, mongold) && inv_cnt(FALSE) >= 52) { You("have no room for the money!"); dropy(mongold); } else { @@ -293,7 +293,7 @@ register struct monst *shkp; register struct obj *obj; register struct monst *mtmp; - clear_unpaid(shkp, invent); + clear_unpaid(shkp, g.invent); clear_unpaid(shkp, fobj); clear_unpaid(shkp, g.level.buriedobjlist); if (g.thrownobj) @@ -1330,7 +1330,7 @@ proceed: } if (shkp != resident && NOTANGRY(shkp)) { - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); if (!ltmp) You("do not owe %s anything.", shkname(shkp)); else if (!umoney) { @@ -1360,7 +1360,7 @@ proceed: /* ltmp is still eshkp->robbed here */ if (!eshkp->billct && !eshkp->debit) { - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); if (!ltmp && NOTANGRY(shkp)) { You("do not owe %s anything.", shkname(shkp)); if (!umoney) @@ -1417,7 +1417,7 @@ proceed: long loan = eshkp->loan; char sbuf[BUFSZ]; - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); Sprintf(sbuf, "You owe %s %ld %s ", shkname(shkp), dtmp, currency(dtmp)); if (loan) { @@ -1464,7 +1464,7 @@ proceed: register boolean itemize; int iprompt; - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); if (!umoney && !eshkp->credit) { You("%shave no money or credit%s.", stashed_gold ? "seem to " : "", paid ? " left" : ""); @@ -1567,7 +1567,7 @@ boolean itemize; { register struct obj *obj = *obj_p; long ltmp, quan, save_quan; - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); int buy; boolean stashed_gold = (hidden_gold() > 0L), consumed = (which == 0); @@ -1791,7 +1791,7 @@ int croaked; if (roomno == eshkp->shoproom && inhishop(shkp) && !eshkp->billct && !eshkp->robbed && !eshkp->debit && NOTANGRY(shkp) && !eshkp->following && u.ugrave_arise < LOW_PM) { - taken = (invent != 0); + taken = (g.invent != 0); if (taken) pline("%s gratefully inherits all your possessions.", Shknam(shkp)); @@ -1808,9 +1808,9 @@ int croaked; } if (eshkp->following || ANGRY(shkp) || take) { - if (!invent) + if (!g.invent) goto skip; - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); takes[0] = '\0'; if (!shkp->mcanmove || shkp->msleeping) Strcat(takes, "wakes up and "); @@ -1897,7 +1897,7 @@ finish_paybill() unleash_all(); /* if hero has any gold left, take it into shopkeeper's possession */ if (shkp) { - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); if (umoney) money2mon(shkp, umoney); @@ -1935,7 +1935,7 @@ unsigned id; int i; /* first check various obj lists directly */ - if ((obj = o_on(id, invent)) != 0) + if ((obj = o_on(id, g.invent)) != 0) return obj; if ((obj = o_on(id, fobj)) != 0) return obj; @@ -2635,12 +2635,12 @@ char *buf; "most renowned and sacred" }; Strcat(buf, honored[rn2(SIZE(honored) - 1) + u.uevent.udemigod]); - if (is_vampire(youmonst.data)) + if (is_vampire(g.youmonst.data)) Strcat(buf, (flags.female) ? " dark lady" : " dark lord"); - else if (is_elf(youmonst.data)) + else if (is_elf(g.youmonst.data)) Strcat(buf, (flags.female) ? " hiril" : " hir"); else - Strcat(buf, !is_human(youmonst.data) ? " creature" + Strcat(buf, !is_human(g.youmonst.data) ? " creature" : (flags.female) ? " lady" : " sir"); } @@ -3874,7 +3874,7 @@ register int fall; } else pline("%s %s your backpack!", Shknam(shkp), grabs); - for (obj = invent; obj; obj = obj2) { + for (obj = g.invent; obj; obj = obj2) { obj2 = obj->nobj; if ((obj->owornmask & ~(W_SWAPWEP | W_QUIVER)) != 0 || (obj == uswapwep && u.twoweap) @@ -4038,7 +4038,7 @@ boolean cant_mollify; } if ((um_dist(x, y, 1) && !uinshp) || cant_mollify - || (money_cnt(invent) + ESHK(shkp)->credit) < cost_of_damage + || (money_cnt(g.invent) + ESHK(shkp)->credit) < cost_of_damage || !rn2(50)) { getcad: if (muteshk(shkp)) { @@ -4617,7 +4617,7 @@ boolean altusage; /* used as a verbalized exclamation: \"Cad! ...\" */ { const char *res = 0; - switch (is_demon(youmonst.data) ? 3 : poly_gender()) { + switch (is_demon(g.youmonst.data) ? 3 : poly_gender()) { case 0: res = "cad"; break; @@ -4636,7 +4636,7 @@ boolean altusage; /* used as a verbalized exclamation: \"Cad! ...\" */ break; } if (altusage) { - char *cadbuf = mon_nam(&youmonst); /* snag an output buffer */ + char *cadbuf = mon_nam(&g.youmonst); /* 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 b95ae5f57..8f891622e 100644 --- a/src/sit.c +++ b/src/sit.c @@ -14,7 +14,7 @@ take_gold() struct obj *otmp, *nobj; int lost_money = 0; - for (otmp = invent; otmp; otmp = nobj) { + for (otmp = g.invent; otmp; otmp = nobj) { nobj = otmp->nobj; if (otmp->oclass == COIN_CLASS) { lost_money = 1; @@ -42,7 +42,7 @@ dosit() You("are already sitting on %s.", mon_nam(u.usteed)); return 0; } - if (u.uundetected && is_hider(youmonst.data) && u.umonnum != PM_TRAPPER) + if (u.uundetected && is_hider(g.youmonst.data) && u.umonnum != PM_TRAPPER) u.uundetected = 0; /* no longer on the ceiling */ if (!can_reach_floor(FALSE)) { @@ -53,7 +53,7 @@ dosit() else You("are sitting on air."); return 0; - } else if (u.ustuck && !sticks(youmonst.data)) { + } else if (u.ustuck && !sticks(g.youmonst.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)) @@ -71,9 +71,9 @@ dosit() register struct obj *obj; obj = g.level.objects[u.ux][u.uy]; - if (youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { + if (g.youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { You("coil up around your %shoard.", - (obj->quan + money_cnt(invent) < u.ulevel * 1000) ? "meager " + (obj->quan + money_cnt(g.invent) < u.ulevel * 1000) ? "meager " : ""); } else { You("sit on %s.", the(xname(obj))); @@ -130,7 +130,7 @@ dosit() (void) water_damage(uarm, "armor", TRUE); } else if (IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); - Your("%s gets wet.", humanoid(youmonst.data) ? "rump" : "underside"); + Your("%s gets wet.", humanoid(g.youmonst.data) ? "rump" : "underside"); } else if (IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); @@ -144,7 +144,7 @@ dosit() /* must be WWalking */ You(sit_message, hliquid("lava")); burn_away_slime(); - if (likes_lava(youmonst.data)) { + if (likes_lava(g.youmonst.data)) { pline_The("%s feels warm.", hliquid("lava")); return 1; } @@ -258,7 +258,7 @@ dosit() break; case 12: You("are granted an insight!"); - if (invent) { + if (g.invent) { /* rn2(5) agrees w/seffects() */ identify_pack(rn2(5), FALSE); } @@ -273,7 +273,7 @@ dosit() break; } } else { - if (is_prince(youmonst.data)) + if (is_prince(g.youmonst.data)) You_feel("very comfortable here."); else You_feel("somehow out of place..."); @@ -285,7 +285,7 @@ dosit() pline_The("throne vanishes in a puff of logic."); newsym(u.ux, u.uy); } - } else if (lays_eggs(youmonst.data)) { + } else if (lays_eggs(g.youmonst.data)) { struct obj *uegg; if (!flags.female) { @@ -335,7 +335,7 @@ rndcurse() You(mal_aura, "you"); } - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { /* gold isn't subject to being cursed or blessed */ if (otmp->oclass == COIN_CLASS) continue; @@ -345,7 +345,7 @@ rndcurse() for (cnt = rnd(6 / ((!!Antimagic) + (!!Half_spell_damage) + 1)); cnt > 0; cnt--) { onum = rnd(nobj); - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { /* as above */ if (otmp->oclass == COIN_CLASS) continue; diff --git a/src/sounds.c b/src/sounds.c index 58b53eff0..b162df5a5 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -512,7 +512,7 @@ register struct monst *mtmp; msound = mons[genus(monsndx(ptr), 1)].msound; /* some normally non-speaking types can/will speak if hero is similar */ else if (msound == MS_ORC /* note: MS_ORC is same as MS_GRUNT */ - && (same_race(ptr, youmonst.data) /* current form, */ + && (same_race(ptr, g.youmonst.data) /* current form, */ || same_race(ptr, &mons[Race_switch]))) /* unpoly'd form */ msound = MS_HUMANOID; /* silliness, with slight chance to interfere with shopping */ @@ -598,11 +598,11 @@ register struct monst *mtmp; if (kindred) verbl_msg = "This is my hunting ground that you dare to prowl!"; - else if (youmonst.data == &mons[PM_SILVER_DRAGON] - || youmonst.data == &mons[PM_BABY_SILVER_DRAGON]) { + else if (g.youmonst.data == &mons[PM_SILVER_DRAGON] + || g.youmonst.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!", - youmonst.data == &mons[PM_SILVER_DRAGON] + g.youmonst.data == &mons[PM_SILVER_DRAGON] ? "Fool" : "Young Fool"); verbl_msg = verbuf; @@ -828,7 +828,7 @@ register struct monst *mtmp; if (SYSOPT_SEDUCE) { if (ptr->mlet != S_NYMPH - && could_seduce(mtmp, &youmonst, (struct attack *) 0) == 1) { + && could_seduce(mtmp, &g.youmonst, (struct attack *) 0) == 1) { (void) doseduce(mtmp); break; } @@ -889,7 +889,7 @@ register struct monst *mtmp; verbl_msg = "Relax, this won't hurt a bit."; break; case MS_GUARD: - if (money_cnt(invent)) + if (money_cnt(g.invent)) verbl_msg = "Please drop that gold and follow me."; else verbl_msg = "Please follow me."; @@ -974,8 +974,8 @@ dochat() int tx, ty; struct obj *otmp; - if (is_silent(youmonst.data)) { - pline("As %s, you cannot speak.", an(youmonst.data->mname)); + if (is_silent(g.youmonst.data)) { + pline("As %s, you cannot speak.", an(g.youmonst.data->mname)); return 0; } if (Strangled) { diff --git a/src/spell.c b/src/spell.c index b8d14aa0a..91d1d9c3e 100644 --- a/src/spell.c +++ b/src/spell.c @@ -232,7 +232,7 @@ struct obj *book2; return; } - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (otmp->otyp == CANDELABRUM_OF_INVOCATION && otmp->spe == 7 && otmp->lamplit) { if (!otmp->cursed) @@ -285,7 +285,7 @@ struct obj *book2; set_malign(mtmp); } /* next handle the affect on things you're carrying */ - (void) unturn_dead(&youmonst); + (void) unturn_dead(&g.youmonst); /* last place some monsters around you */ mm.x = u.ux; mm.y = u.uy; @@ -454,7 +454,7 @@ register struct obj *spellbook; if (dullbook > 0) { eyes = body_part(EYE); - if (eyecount(youmonst.data) > 1) + if (eyecount(g.youmonst.data) > 1) eyes = makeplural(eyes); pline("This book is so dull that you can't keep your %s open.", eyes); @@ -644,7 +644,7 @@ rejectcasting() if (Stunned) { You("are too impaired to cast a spell."); return TRUE; - } else if (!can_chant(&youmonst)) { + } else if (!can_chant(&g.youmonst)) { You("are unable to chant the incantation."); return TRUE; } else if (!freehand()) { diff --git a/src/steal.c b/src/steal.c index 39cb4aace..7252a3a10 100644 --- a/src/steal.c +++ b/src/steal.c @@ -92,7 +92,7 @@ register struct monst *mtmp; fgold = fgold->nexthere; /* Do you have real gold? */ - ygold = findgold(invent); + ygold = findgold(g.invent); if (fgold && (!ygold || fgold->quan > ygold->quan || !rn2(5))) { obj_extract_self(fgold); @@ -103,7 +103,7 @@ register struct monst *mtmp; whose = s_suffix(y_monnam(who)); what = makeplural(mbodypart(who, FOOT)); } else { - who = &youmonst; + who = &g.youmonst; whose = "your"; what = makeplural(body_part(FOOT)); } @@ -123,7 +123,7 @@ register struct monst *mtmp; } else if (ygold) { const int gold_price = objects[GOLD_PIECE].oc_cost; - tmp = (somegold(money_cnt(invent)) + gold_price - 1) / gold_price; + tmp = (somegold(money_cnt(g.invent)) + gold_price - 1) / gold_price; tmp = min(tmp, ygold->quan); if (tmp < ygold->quan) ygold = splitobj(ygold, tmp); @@ -149,7 +149,7 @@ stealarm(VOID_ARGS) register struct monst *mtmp; register struct obj *otmp; - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { if (otmp->o_id == stealoid) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (mtmp->m_id == stealmid) { @@ -263,7 +263,7 @@ char *objnambuf; if (g.occupation) (void) maybe_finished_meal(FALSE); - if (!invent || (inv_cnt(FALSE) == 1 && uskin)) { + if (!g.invent || (inv_cnt(FALSE) == 1 && uskin)) { nothing_to_steal: /* Not even a thousand men in armor can strip a naked man. */ if (Blind) @@ -287,14 +287,14 @@ char *objnambuf; retry: tmp = 0; - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if ((!uarm || otmp != uarmc) && otmp != uskin && otmp->oclass != COIN_CLASS) tmp += (otmp->owornmask & (W_ARMOR | W_ACCESSORY)) ? 5 : 1; if (!tmp) goto nothing_to_steal; tmp = rn2(tmp); - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if ((!uarm || otmp != uarmc) && otmp != uskin && otmp->oclass != COIN_CLASS) { tmp -= (otmp->owornmask & (W_ARMOR | W_ACCESSORY)) ? 5 : 1; @@ -519,12 +519,12 @@ struct monst *mtmp; /* target every quest artifact, not just current role's; if hero has more than one, choose randomly so that player can't use inventory ordering to influence the theft */ - for (n = 0, obj = invent; obj; obj = obj->nobj) + for (n = 0, obj = g.invent; obj; obj = obj->nobj) if (any_quest_artifact(obj)) ++n, otmp = obj; if (n > 1) { n = rnd(n); - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (any_quest_artifact(otmp) && !--n) break; } @@ -545,12 +545,12 @@ struct monst *mtmp; return; /* you have nothing of special interest */ /* If we get here, real and fake have been set up. */ - for (n = 0, obj = invent; obj; obj = obj->nobj) + for (n = 0, obj = g.invent; obj; obj = obj->nobj) if (obj->otyp == real || (obj->otyp == fake && !mtmp->iswiz)) ++n, otmp = obj; if (n > 1) { n = rnd(n); - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if ((otmp->otyp == real || (otmp->otyp == fake && !mtmp->iswiz)) && !--n) break; diff --git a/src/steed.c b/src/steed.c index 6a2109dc3..22b3db182 100644 --- a/src/steed.c +++ b/src/steed.c @@ -70,7 +70,7 @@ struct obj *otmp; char kbuf[BUFSZ]; You("touch %s.", mon_nam(mtmp)); - if (!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { + if (!(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { Sprintf(kbuf, "attempting to saddle %s", an(mtmp->data->mname)); instapetrify(kbuf); } @@ -162,8 +162,8 @@ boolean can_ride(mtmp) struct monst *mtmp; { - return (mtmp->mtame && humanoid(youmonst.data) - && !verysmall(youmonst.data) && !bigmonst(youmonst.data) + return (mtmp->mtame && humanoid(g.youmonst.data) + && !verysmall(g.youmonst.data) && !bigmonst(g.youmonst.data) && (!Underwater || is_swimmer(mtmp->data))); } @@ -226,8 +226,8 @@ boolean force; /* Quietly force this animal */ return (FALSE); } - if (Upolyd && (!humanoid(youmonst.data) || verysmall(youmonst.data) - || bigmonst(youmonst.data) || slithy(youmonst.data))) { + if (Upolyd && (!humanoid(g.youmonst.data) || verysmall(g.youmonst.data) + || bigmonst(g.youmonst.data) || slithy(g.youmonst.data))) { You("won't fit on a saddle."); return (FALSE); } @@ -455,7 +455,7 @@ int forceit; || (distance == min_distance && rn2(2))) { if (i > 0 || (((t = t_at(x, y)) == 0 || !t->tseen) && (!sobj_at(BOULDER, x, y) - || throws_rocks(youmonst.data)))) { + || throws_rocks(g.youmonst.data)))) { spot->x = x; spot->y = y; min_distance = distance; @@ -468,7 +468,7 @@ int forceit; /* If we didn't find a good spot and forceit is on, try enexto(). */ if (forceit && min_distance < 0 - && !enexto(spot, u.ux, u.uy, youmonst.data)) + && !enexto(spot, u.ux, u.uy, g.youmonst.data)) return FALSE; return found; diff --git a/src/teleport.c b/src/teleport.c index b3522a080..2416d0f5f 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -39,7 +39,7 @@ unsigned gpflags; * which could be co-located and thus get restricted a bit too much. * oh well. */ - if (mtmp != &youmonst && x == u.ux && y == u.uy + if (mtmp != &g.youmonst && x == u.ux && y == u.uy && (!u.usteed || mtmp != u.usteed)) return FALSE; @@ -61,7 +61,7 @@ unsigned gpflags; mdat = mtmp->data; if (is_pool(x, y) && !ignorewater) { - if (mtmp == &youmonst) + if (mtmp == &g.youmonst) return (Levitation || Flying || Wwalking || Swimming || Amphibious); else @@ -70,11 +70,11 @@ unsigned gpflags; } else if (mdat->mlet == S_EEL && rn2(13) && !ignorewater) { return FALSE; } else if (is_lava(x, y)) { - if (mtmp == &youmonst) + if (mtmp == &g.youmonst) return (Levitation || Flying || (Fire_resistance && Wwalking && uarmf && uarmf->oerodeproof) - || (Upolyd && likes_lava(youmonst.data))); + || (Upolyd && likes_lava(g.youmonst.data))); else return (is_floater(mdat) || is_flyer(mdat) || likes_lava(mdat)); @@ -237,7 +237,7 @@ boolean trapok; { if (!trapok && t_at(x, y)) return FALSE; - if (!goodpos(x, y, &youmonst, 0)) + if (!goodpos(x, y, &g.youmonst, 0)) return FALSE; if (!tele_jump_ok(u.ux, u.uy, x, y)) return FALSE; @@ -294,9 +294,9 @@ boolean allow_drag; u.ux0 = u.ux; u.uy0 = u.uy; - if (!hideunder(&youmonst) && youmonst.data->mlet == S_MIMIC) { + if (!hideunder(&g.youmonst) && g.youmonst.data->mlet == S_MIMIC) { /* mimics stop being unnoticed */ - youmonst.m_ap_type = M_AP_NOTHING; + g.youmonst.m_ap_type = M_AP_NOTHING; } if (u.uswallow) { @@ -526,14 +526,14 @@ boolean break_the_rules; } if (trap) You("%s onto the teleportation trap.", - locomotion(youmonst.data, "jump")); + locomotion(g.youmonst.data, "jump")); } if (!trap) { boolean castit = FALSE; register int sp_no = 0, energy = 0; if (!Teleportation || (u.ulevel < (Role_if(PM_WIZARD) ? 8 : 12) - && !can_teleport(youmonst.data))) { + && !can_teleport(g.youmonst.data))) { /* Try to use teleport away spell. */ if (objects[SPE_TELEPORT_AWAY].oc_name_known && !Confusion) for (sp_no = 0; sp_no < MAXSPELL; sp_no++) @@ -694,10 +694,10 @@ level_tele() if (ynq("Go to Nowhere. Are you sure?") != 'y') return; You("%s in agony as your body begins to warp...", - is_silent(youmonst.data) ? "writhe" : "scream"); + is_silent(g.youmonst.data) ? "writhe" : "scream"); display_nhwindow(WIN_MESSAGE, FALSE); You("cease to exist."); - if (invent) + if (g.invent) Your("possessions land on the %s with a thud.", surface(u.ux, u.uy)); g.killer.format = NO_KILLER_PREFIX; @@ -705,7 +705,7 @@ level_tele() done(DIED); pline("An energized cloud of dust begins to coalesce."); Your("body rematerializes%s.", - invent ? ", and you gather up all your possessions" : ""); + g.invent ? ", and you gather up all your possessions" : ""); return; } @@ -917,7 +917,7 @@ unsigned trflags; else Sprintf(verbbuf, "%s onto", Levitation ? (const char *) "float" - : locomotion(youmonst.data, "step")); + : locomotion(g.youmonst.data, "step")); You("%s a level teleport trap!", verbbuf); if (Antimagic) { diff --git a/src/timeout.c b/src/timeout.c index 1305f7c6a..c5bb11e52 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -114,7 +114,7 @@ stoned_dialogue() char buf[BUFSZ]; Strcpy(buf, stoned_texts[SIZE(stoned_texts) - i]); - if (nolimbs(youmonst.data) && strstri(buf, "limbs")) + if (nolimbs(g.youmonst.data) && strstri(buf, "limbs")) (void) strsubst(buf, "limbs", "extremities"); pline1(buf); } @@ -198,7 +198,7 @@ vomiting_dialogue() break; case 2: txt = vomiting_texts[4]; - if (cantvomit(youmonst.data)) + if (cantvomit(g.youmonst.data)) txt = "gag uncontrollably."; else if (Hallucination) /* "hurl" is short for "hurl chunks" which is slang for @@ -207,7 +207,7 @@ vomiting_dialogue() break; case 0: stop_occupation(); - if (!cantvomit(youmonst.data)) { + if (!cantvomit(g.youmonst.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 @@ -315,14 +315,14 @@ slime_dialogue() /* 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 */ - youmonst.m_ap_type = M_AP_MONSTER; - youmonst.mappearance = PM_GREEN_SLIME; + g.youmonst.m_ap_type = M_AP_MONSTER; + g.youmonst.mappearance = PM_GREEN_SLIME; } if (((Slimed & TIMEOUT) % 2L) && i >= 0L && i < SIZE(slime_texts)) { char buf[BUFSZ]; Strcpy(buf, slime_texts[SIZE(slime_texts) - i - 1L]); - if (nolimbs(youmonst.data) && strstri(buf, "limbs")) + if (nolimbs(g.youmonst.data) && strstri(buf, "limbs")) (void) strsubst(buf, "limbs", "extremities"); if (index(buf, '%')) { @@ -373,7 +373,7 @@ struct kinfo *kptr; uchar save_mvflags; /* redundant: polymon() cures sliming when polying into green slime */ - if (Upolyd && youmonst.data == &mons[PM_GREEN_SLIME]) { + if (Upolyd && g.youmonst.data == &mons[PM_GREEN_SLIME]) { dealloc_killer(kptr); return; } @@ -399,8 +399,8 @@ struct kinfo *kptr; * [formerly implicit] change of form; polymon() takes care of that. * Temporarily ungenocide if necessary. */ - if (emits_light(youmonst.data)) - del_light_source(LS_MONSTER, monst_to_any(&youmonst)); + if (emits_light(g.youmonst.data)) + del_light_source(LS_MONSTER, monst_to_any(&g.youmonst)); save_mvflags = g.mvitals[PM_GREEN_SLIME].mvflags; g.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags & ~G_GENOD; (void) polymon(PM_GREEN_SLIME); @@ -489,8 +489,8 @@ nh_timeout() phaze_dialogue(); if (u.mtimedone && !--u.mtimedone) { if (Unchanging) - u.mtimedone = rnd(100 * youmonst.data->mlevel + 1); - else if (is_were(youmonst.data)) + u.mtimedone = rnd(100 * g.youmonst.data->mlevel + 1); + else if (is_were(g.youmonst.data)) you_unwere(FALSE); /* if polycontrl, asks whether to rehumanize */ else rehumanize(); diff --git a/src/trap.c b/src/trap.c index 93f10ef16..a7245a7b8 100644 --- a/src/trap.c +++ b/src/trap.c @@ -60,7 +60,7 @@ struct monst *victim; if (!victim) return 0; - hitting_u = (victim == &youmonst); + hitting_u = (victim == &g.youmonst); /* burning damage may dry wet towel */ item = hitting_u ? carrying(TOWEL) : m_carrying(victim, TOWEL); @@ -154,9 +154,9 @@ int ef_flags; if (!otmp) return ER_NOTHING; - victim = carried(otmp) ? &youmonst : mcarried(otmp) ? otmp->ocarry : NULL; - uvictim = (victim == &youmonst); - vismon = victim && (victim != &youmonst) && canseemon(victim); + victim = carried(otmp) ? &g.youmonst : mcarried(otmp) ? otmp->ocarry : NULL; + uvictim = (victim == &g.youmonst); + vismon = victim && (victim != &g.youmonst) && canseemon(victim); /* Is g.bhitpos correct here? Ugh. */ visobj = !victim && cansee(g.bhitpos.x, g.bhitpos.y); @@ -219,7 +219,7 @@ int ef_flags; */ if (otmp->oerodeproof) { otmp->rknown = TRUE; - if (victim == &youmonst) + if (victim == &g.youmonst) update_inventory(); } @@ -244,7 +244,7 @@ int ef_flags; else otmp->oeroded2++; - if (victim == &youmonst) + if (victim == &g.youmonst) update_inventory(); return ER_DAMAGED; @@ -286,15 +286,15 @@ const char *ostr; struct monst *victim; { static const char txt[] = "protected by the layer of grease!"; - boolean vismon = victim && (victim != &youmonst) && canseemon(victim); + boolean vismon = victim && (victim != &g.youmonst) && canseemon(victim); if (ostr) { - if (victim == &youmonst) + if (victim == &g.youmonst) 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 == &youmonst || vismon) { + } else if (victim == &g.youmonst || vismon) { pline("%s %s", Yobjnam2(otmp, "are"), txt); } if (!rn2(2)) { @@ -485,10 +485,10 @@ boolean td; /* td == TRUE : trap door or hole */ ; /* 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(youmonst.data) + || is_clinger(g.youmonst.data) || (Inhell && !u.uevent.invoked && newlevel == bottom)) { dont_fall = "don't fall in."; - } else if (youmonst.data->msize >= MZ_HUGE) { + } else if (g.youmonst.data->msize >= MZ_HUGE) { dont_fall = "don't fit through."; } else if (!next_to_u()) { dont_fall = "are jerked back by your pet!"; @@ -718,7 +718,7 @@ int *fail_reason; delobj(statue); /* avoid hiding under nothing */ - if (x == u.ux && y == u.uy && Upolyd && hides_under(youmonst.data) + if (x == u.ux && y == u.uy && Upolyd && hides_under(g.youmonst.data) && !OBJ_AT(x, y)) u.uundetected = 0; @@ -800,7 +800,7 @@ struct monst *mtmp; boolean domsg; struct trap *trap; { - boolean isyou = (mtmp == &youmonst); + boolean isyou = (mtmp == &g.youmonst); struct permonst *mptr = mtmp->data; if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr) @@ -927,7 +927,7 @@ unsigned trflags; && ttype != ANTI_MAGIC && !forcebungle && !plunged && !conj_pit && !adj_pit && (!rn2(5) || (is_pit(ttype) - && is_clinger(youmonst.data)))) { + && is_clinger(g.youmonst.data)))) { You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u) ? "an" : a_your[trap->madeby_u], @@ -958,7 +958,7 @@ unsigned trflags; otmp = t_missile(ARROW, trap); if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { ; /* nothing */ - } else if (thitu(8, dmgval(otmp, &youmonst), &otmp, "arrow")) { + } else if (thitu(8, dmgval(otmp, &g.youmonst), &otmp, "arrow")) { if (otmp) obfree(otmp, (struct obj *) 0); } else { @@ -986,7 +986,7 @@ unsigned trflags; oldumort = u.umortality; if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { ; /* nothing */ - } else if (thitu(7, dmgval(otmp, &youmonst), &otmp, "little dart")) { + } else if (thitu(7, dmgval(otmp, &g.youmonst), &otmp, "little dart")) { if (otmp) { if (otmp->opoisoned) poisoned("dart", A_CON, "little dart", @@ -1062,13 +1062,13 @@ unsigned trflags; if ((Levitation || Flying) && !forcetrap) break; feeltrap(trap); - if (amorphous(youmonst.data) || is_whirly(youmonst.data) - || unsolid(youmonst.data)) { + if (amorphous(g.youmonst.data) || is_whirly(g.youmonst.data) + || unsolid(g.youmonst.data)) { pline("%s bear trap closes harmlessly through you.", A_Your[trap->madeby_u]); break; } - if (!u.usteed && youmonst.data->msize <= MZ_SMALL) { + if (!u.usteed && g.youmonst.data->msize <= MZ_SMALL) { pline("%s bear trap closes harmlessly over you.", A_Your[trap->madeby_u]); break; @@ -1093,7 +1093,7 @@ unsigned trflags; case SLP_GAS_TRAP: seetrap(trap); - if (Sleep_resistance || breathless(youmonst.data)) { + if (Sleep_resistance || breathless(g.youmonst.data)) { You("are enveloped in a cloud of gas!"); } else { pline("A cloud of gas puts you to sleep!"); @@ -1133,7 +1133,7 @@ unsigned trflags; goto glovecheck; default: pline("%s you!", A_gush_of_water_hits); - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->lamplit && otmp != uwep && (otmp != uswapwep || !u.twoweap)) (void) snuff_lit(otmp); @@ -1152,7 +1152,7 @@ unsigned trflags; 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(&youmonst, (struct monst *) 0); + (void) split_mon(&g.youmonst, (struct monst *) 0); } break; @@ -1168,7 +1168,7 @@ unsigned trflags; if (!Sokoban && (Levitation || (Flying && !plunged))) break; feeltrap(trap); - if (!Sokoban && is_clinger(youmonst.data) && !plunged) { + if (!Sokoban && is_clinger(g.youmonst.data) && !plunged) { if (trap->tseen) { You_see("%s %spit below you.", a_your[trap->madeby_u], ttype == SPIKED_PIT ? "spiked " : ""); @@ -1256,7 +1256,7 @@ unsigned trflags; } else { /* plunging flyers take spike damage but not pit damage */ if (!conj_pit - && !(plunged && (Flying || is_clinger(youmonst.data)))) + && !(plunged && (Flying || is_clinger(g.youmonst.data)))) losehp(Maybe_Half_Phys(rnd(adj_pit ? 3 : 6)), plunged ? "deliberately plunged into a pit" : "fell into a pit", @@ -1298,9 +1298,9 @@ unsigned trflags; case WEB: /* Our luckless player has stumbled into a web. */ feeltrap(trap); - if (mu_maybe_destroy_web(&youmonst, webmsgok, trap)) + if (mu_maybe_destroy_web(&g.youmonst, webmsgok, trap)) break; - if (webmaker(youmonst.data)) { + if (webmaker(g.youmonst.data)) { if (webmsgok) pline(trap->madeby_u ? "You take a walk on your web." : "There is a spider web here."); @@ -1318,7 +1318,7 @@ unsigned trflags; } else { Sprintf(verbbuf, "%s into", Levitation ? (const char *) "float" - : locomotion(youmonst.data, "stumble")); + : locomotion(g.youmonst.data, "stumble")); } You("%s %s spider web!", verbbuf, a_your[trap->madeby_u]); } @@ -1421,7 +1421,7 @@ unsigned trflags; /* having an artifact--other than own quest one--which confers magic resistance simply by being carried also increases the effect */ - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (otmp->oartifact && !is_quest_artifact(otmp) && defends_when_carried(AD_MAGM, otmp)) break; @@ -1451,7 +1451,7 @@ unsigned trflags; else Sprintf(verbbuf, "%s onto", Levitation ? (const char *) "float" - : locomotion(youmonst.data, "step")); + : locomotion(g.youmonst.data, "step")); You("%s a polymorph trap!", verbbuf); if (Antimagic || Unchanging) { shieldeff(u.ux, u.uy); @@ -1850,7 +1850,7 @@ int style; } else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) { if (g.multi) nomul(0); - if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst), + if (thitu(9 + singleobj->spe, dmgval(singleobj, &g.youmonst), &singleobj, (char *) 0)) stop_occupation(); } @@ -2720,7 +2720,7 @@ const char *str; { if (Stone_resistance) return; - if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) + if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) return; You("turn to stone..."); g.killer.format = KILLED_BY; @@ -2955,7 +2955,7 @@ long hmask, emask; /* might cancel timeout */ /* check for falling into pool - added by GAN 10/20/86 */ if (!Flying) { if (!u.uswallow && u.ustuck) { - if (sticks(youmonst.data)) + if (sticks(g.youmonst.data)) You("aren't able to maintain your hold on %s.", mon_nam(u.ustuck)); else @@ -3065,7 +3065,7 @@ climb_pit() display_nhwindow(WIN_MESSAGE, FALSE); clear_nhwindow(WIN_MESSAGE); You("free your %s.", body_part(LEG)); - } else if ((Flying || is_clinger(youmonst.data)) && !Sokoban) { + } else if ((Flying || is_clinger(g.youmonst.data)) && !Sokoban) { /* eg fell in pit, then poly'd to a flying monster; or used '>' to deliberately enter it */ You("%s from the pit.", Flying ? "fly" : "climb"); @@ -3149,7 +3149,7 @@ struct obj *box; /* null for floor trap */ losehp(num, tower_of_flame, KILLED_BY_AN); /* fire damage */ burn_away_slime(); - if (burnarmor(&youmonst) || rn2(3)) { + if (burnarmor(&g.youmonst) || rn2(3)) { destroy_item(SCROLL_CLASS, AD_FIRE); destroy_item(SPBOOK_CLASS, AD_FIRE); destroy_item(POTION_CLASS, AD_FIRE); @@ -3172,7 +3172,7 @@ domagictrap() int cnt = rnd(4); /* blindness effects */ - if (!resists_blnd(&youmonst)) { + if (!resists_blnd(&g.youmonst)) { You("are momentarily blinded by a flash of light!"); make_blinded((long) rn1(5, 10), FALSE); if (!Blind) @@ -3219,7 +3219,7 @@ domagictrap() if (on_level(&u.uz, &qstart_level)) You_feel( "%slike the prodigal son.", - (flags.female || (Upolyd && is_neuter(youmonst.data))) + (flags.female || (Upolyd && is_neuter(g.youmonst.data))) ? "oddly " : ""); else @@ -3447,8 +3447,8 @@ struct obj *obj; if (!obj) return; - victim = carried(obj) ? &youmonst : mcarried(obj) ? obj->ocarry : NULL; - vismon = victim && (victim != &youmonst) && canseemon(victim); + victim = carried(obj) ? &g.youmonst : mcarried(obj) ? obj->ocarry : NULL; + vismon = victim && (victim != &g.youmonst) && canseemon(victim); if (obj->greased) { grease_protect(obj, (char *) 0, victim); @@ -3459,7 +3459,7 @@ struct obj *obj; #endif ) { if (!Blind) { - if (victim == &youmonst) + if (victim == &g.youmonst) pline("Your %s.", aobjnam(obj, "fade")); else if (vismon) pline("%s %s.", s_suffix(Monnam(victim)), @@ -3667,7 +3667,7 @@ boolean *lostsome; /* Pick a random object */ if (invc > 0) { i = rn2(invc); - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { /* * Undroppables are: body armor, boots, gloves, * amulets, and rings because of the time and effort @@ -3726,10 +3726,10 @@ drown() You("sink like %s.", Hallucination ? "the Titanic" : "a rock"); } - water_damage_chain(invent, FALSE); + water_damage_chain(g.invent, FALSE); if (u.umonnum == PM_GREMLIN && rn2(3)) - (void) split_mon(&youmonst, (struct monst *) 0); + (void) split_mon(&g.youmonst, (struct monst *) 0); else if (u.umonnum == PM_IRON_GOLEM) { You("rust!"); i = Maybe_Half_Phys(d(2, 6)); @@ -3767,7 +3767,7 @@ drown() g.vision_full_recalc = 1; return FALSE; } - if ((Teleportation || can_teleport(youmonst.data)) && !Unaware + if ((Teleportation || can_teleport(g.youmonst.data)) && !Unaware && (Teleport_control || rn2(3) < Luck + 2)) { You("attempt a teleport spell."); /* utcsri!carroll */ if (!g.level.flags.noteleport) { @@ -3793,7 +3793,7 @@ drown() if (is_fainted()) reset_faint(); /* can't crawl if unable to move (crawl_ok flag stays false) */ - if (g.multi < 0 || (Upolyd && !youmonst.data->mmove)) + if (g.multi < 0 || (Upolyd && !g.youmonst.data->mmove)) goto crawl; /* look around for a place to crawl to */ for (i = 0; i < 100; i++) { @@ -3886,11 +3886,11 @@ dountrap() pline("You're too strained to do that."); return 0; } - if ((nohands(youmonst.data) && !webmaker(youmonst.data)) - || !youmonst.data->mmove) { + if ((nohands(g.youmonst.data) && !webmaker(g.youmonst.data)) + || !g.youmonst.data->mmove) { pline("And just how do you expect to do that?"); return 0; - } else if (u.ustuck && sticks(youmonst.data)) { + } else if (u.ustuck && sticks(g.youmonst.data)) { pline("You'll have to let go of %s first.", mon_nam(u.ustuck)); return 0; } @@ -3909,7 +3909,7 @@ struct trap *ttmp; int chance = 3; /* Only spiders know how to deal with webs reliably */ - if (ttmp->ttyp == WEB && !webmaker(youmonst.data)) + if (ttmp->ttyp == WEB && !webmaker(g.youmonst.data)) chance = 30; if (Confusion || Hallucination) chance++; @@ -4027,10 +4027,10 @@ boolean force_failure; return 0; } /* duplicate tight-space checks from test_move */ - if (u.dx && u.dy && bad_rock(youmonst.data, u.ux, ttmp->ty) - && bad_rock(youmonst.data, ttmp->tx, u.uy)) { - if ((invent && (inv_weight() + weight_cap() > 600)) - || bigmonst(youmonst.data)) { + if (u.dx && u.dy && bad_rock(g.youmonst.data, u.ux, ttmp->ty) + && bad_rock(g.youmonst.data, ttmp->tx, u.uy)) { + if ((g.invent && (inv_weight() + weight_cap() > 600)) + || bigmonst(g.youmonst.data)) { /* don't allow untrap if they can't get thru to it */ You("are unable to reach the %s!", defsyms[trap_to_defsym(ttype)].explanation); @@ -4059,7 +4059,7 @@ boolean force_failure; if (DEADMONSTER(mtmp)) killed(mtmp); } else if (ttype == WEB) { - if (!webmaker(youmonst.data)) { + if (!webmaker(g.youmonst.data)) { struct trap *ttmp2 = maketrap(u.ux, u.uy, WEB); if (ttmp2) { @@ -4278,7 +4278,7 @@ struct trap *ttmp; You("grab the trapped %s using your bare %s.", mtmp->data->mname, makeplural(body_part(HAND))); - if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) { + if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) { display_nhwindow(WIN_MESSAGE, FALSE); } else { char kbuf[BUFSZ]; @@ -4356,7 +4356,7 @@ boolean force; } /* 'force' is true for #invoke; make it be true for #untrap if carrying MKoT */ - if (!force && has_magic_key(&youmonst)) + if (!force && has_magic_key(&g.youmonst)) force = TRUE; ttmp = t_at(x, y); @@ -4581,7 +4581,7 @@ boolean *noticed; /* set to true iff hero notices the effect; */ struct trap *t; char buf[BUFSZ], whichbuf[20]; const char *trapdescr = 0, *which = 0; - boolean ishero = (mon == &youmonst); + boolean ishero = (mon == &g.youmonst); if (!mon) return FALSE; @@ -4670,7 +4670,7 @@ boolean *noticed; /* set to true iff hero notices the effect; */ { /* otherwise left with its previous value intact */ struct trap *t; unsigned dotrapflags; - boolean ishero = (mon == &youmonst), result; + boolean ishero = (mon == &g.youmonst), result; if (!mon) return FALSE; @@ -4715,7 +4715,7 @@ boolean trapdoor_only; boolean *noticed; /* set to true iff hero notices the effect; */ { /* otherwise left with its previous value intact */ struct trap *t; - boolean ishero = (mon == &youmonst), result; + boolean ishero = (mon == &g.youmonst), result; if (!mon) return FALSE; @@ -4919,7 +4919,7 @@ boolean disarm; if (Hallucination) pline("What a groovy feeling!"); else - You("%s%s...", stagger(youmonst.data, "stagger"), + You("%s%s...", stagger(g.youmonst.data, "stagger"), Halluc_resistance ? "" : Blind ? " and get dizzy" : " and your vision blurs"); @@ -5213,7 +5213,7 @@ lava_effects() boolean usurvive, boil_away; burn_away_slime(); - if (likes_lava(youmonst.data)) + if (likes_lava(g.youmonst.data)) return FALSE; usurvive = Fire_resistance || (Wwalking && dmg < u.uhp); @@ -5228,7 +5228,7 @@ lava_effects() * emergency save file created before item destruction. */ if (!usurvive) - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if ((is_organic(obj) || obj->oclass == POTION_CLASS) && !obj->oerodeproof && objects[obj->otyp].oc_oprop != FIRE_RES @@ -5270,7 +5270,7 @@ lava_effects() here in the outer call (and access stale memory, probably panic) */ iflags.in_lava_effects++; - for (obj = invent; obj; obj = obj2) { + for (obj = g.invent; obj; obj = obj2) { obj2 = obj->nobj; /* above, we set in_use for objects which are to be destroyed */ if (obj->otyp == SPE_BOOK_OF_THE_DEAD && !Blind) { diff --git a/src/uhitm.c b/src/uhitm.c index e0b538efc..89b124d7a 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -259,7 +259,7 @@ int *attk_count, *role_roll_penalty; *role_roll_penalty = 0; /* default is `none' */ tmp = 1 + Luck + abon() + find_mac(mtmp) + u.uhitinc - + maybe_polyd(youmonst.data->mlevel, u.ulevel); + + maybe_polyd(g.youmonst.data->mlevel, u.ulevel); /* some actions should occur only once during multiple attacks */ if (!(*attk_count)++) { @@ -293,7 +293,7 @@ int *attk_count, *role_roll_penalty; tmp += (u.ulevel / 3) + 2; } if (is_orc(mtmp->data) - && maybe_polyd(is_elf(youmonst.data), Race_if(PM_ELF))) + && maybe_polyd(is_elf(g.youmonst.data), Race_if(PM_ELF))) tmp++; /* encumbrance: with a lot of luggage, your agility diminishes */ @@ -390,7 +390,7 @@ register struct monst *mtmp; if (attack_checks(mtmp, uwep)) return TRUE; - if (Upolyd && noattacks(youmonst.data)) { + if (Upolyd && noattacks(g.youmonst.data)) { /* certain "pacifist" monsters don't attack */ You("have no way to attack monsters physically."); mtmp->mstrategy &= ~STRAT_WAITMASK; @@ -410,7 +410,7 @@ register struct monst *mtmp; if (flags.verbose) { if (uwep) You("begin bashing monsters with %s.", yname(uwep)); - else if (!cantwield(youmonst.data)) + else if (!cantwield(g.youmonst.data)) You("begin %s monsters with your %s %s.", ing_suffix(Role_if(PM_MONK) ? "strike" : "bash"), uarmg ? "gloved" : "bare", /* Del Lamb */ @@ -434,7 +434,7 @@ register struct monst *mtmp; if (Upolyd) (void) hmonas(mtmp); else - (void) hitum(mtmp, youmonst.data->mattk); + (void) hitum(mtmp, g.youmonst.data->mattk); mtmp->mstrategy &= ~STRAT_WAITMASK; atk_done: @@ -493,7 +493,7 @@ int dieroll; /* maybe should regurgitate if swallowed? */ monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE); - if (u.ustuck == mon && !u.uswallow && !sticks(youmonst.data)) + if (u.ustuck == mon && !u.uswallow && !sticks(g.youmonst.data)) u.ustuck = 0; } /* Vorpal Blade hit converted to miss */ @@ -811,7 +811,7 @@ int dieroll; } if (obj->oartifact - && artifact_hit(&youmonst, mon, obj, &tmp, dieroll)) { + && artifact_hit(&g.youmonst, mon, obj, &tmp, dieroll)) { if (DEADMONSTER(mon)) /* artifact killed monster */ return FALSE; if (tmp == 0) @@ -995,7 +995,7 @@ int dieroll; case CREAM_PIE: case BLINDING_VENOM: mon->msleeping = 0; - if (can_blnd(&youmonst, mon, + if (can_blnd(&g.youmonst, mon, (uchar) (obj->otyp == BLINDING_VENOM ? AT_SPIT : AT_WEAP), @@ -1448,7 +1448,7 @@ demonpet() pline("Some hell-p has arrived!"); i = !rn2(6) ? ndemon(u.ualign.type) : NON_PM; - pm = i != NON_PM ? &mons[i] : youmonst.data; + pm = i != NON_PM ? &mons[i] : g.youmonst.data; if ((dtmp = makemon(pm, u.ux, u.uy, NO_MM_FLAGS)) != 0) (void) tamedog(dtmp, (struct obj *) 0); exercise(A_WIS, TRUE); @@ -1463,7 +1463,7 @@ struct obj *otmp; return FALSE; #if 0 /* no poly_when_stoned() critter has theft capability */ - if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) { + if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) { display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */ return TRUE; } @@ -1494,7 +1494,7 @@ struct attack *mattk; /* look for worn body armor */ stealoid = (struct obj *) 0; - if (could_seduce(&youmonst, mdef, mattk)) { + if (could_seduce(&g.youmonst, mdef, mattk)) { /* find armor, and move it to end of inventory in the process */ minvent_ptr = &mdef->minvent; while ((otmp = *minvent_ptr) != 0) @@ -1511,7 +1511,7 @@ struct attack *mattk; } if (stealoid) { /* we will be taking everything */ - if (gender(mdef) == (int) u.mfemale && youmonst.data->mlet == S_NYMPH) + if (gender(mdef) == (int) u.mfemale && g.youmonst.data->mlet == S_NYMPH) You("charm %s. She gladly hands over her possessions.", mon_nam(mdef)); else @@ -1574,7 +1574,7 @@ register struct attack *mattk; /* since hero can't be cancelled, only defender's armor applies */ negated = !(rn2(10) >= 3 * armpro); - if (is_demon(youmonst.data) && !rn2(13) && !uwep + if (is_demon(g.youmonst.data) && !rn2(13) && !uwep && u.umonnum != PM_SUCCUBUS && u.umonnum != PM_INCUBUS && u.umonnum != PM_BALROG) { demonpet(); @@ -1711,7 +1711,7 @@ register struct attack *mattk; mongold = findgold(mdef->minvent); if (mongold) { obj_extract_self(mongold); - if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) { + if (merge_choice(g.invent, mongold) || inv_cnt(FALSE) < 52) { addinv(mongold); Your("purse feels heavier."); } else { @@ -1739,7 +1739,7 @@ register struct attack *mattk; } break; case AD_BLND: - if (can_blnd(&youmonst, mdef, mattk->aatyp, (struct obj *) 0)) { + if (can_blnd(&g.youmonst, mdef, mattk->aatyp, (struct obj *) 0)) { if (!Blind && mdef->mcansee) pline("%s is blinded.", Monnam(mdef)); mdef->mcansee = 0; @@ -1811,7 +1811,7 @@ register struct attack *mattk; case AD_DRDX: case AD_DRCO: if (!negated && !rn2(8)) { - Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk)); + Your("%s was poisoned!", mpoisons_subj(&g.youmonst, mattk)); if (resists_poison(mdef)) { pline_The("poison doesn't seem to affect %s.", mon_nam(mdef)); } else { @@ -1847,7 +1847,7 @@ register struct attack *mattk; break; } - (void) eat_brains(&youmonst, mdef, TRUE, &tmp); + (void) eat_brains(&g.youmonst, mdef, TRUE, &tmp); break; } case AD_STCK: @@ -2013,7 +2013,7 @@ struct monst *mdef; { if (!Invisible) { map_location(u.ux, u.uy, TRUE); - tmp_at(DISP_ALWAYS, mon_to_glyph(&youmonst)); + tmp_at(DISP_ALWAYS, mon_to_glyph(&g.youmonst)); tmp_at(mdef->mx, mdef->my); } You("engulf %s!", mon_nam(mdef)); @@ -2054,7 +2054,7 @@ register struct attack *mattk; * after exactly 1 round of attack otherwise. -KAA */ - if (!engulf_target(&youmonst, mdef)) + if (!engulf_target(&g.youmonst, mdef)) return 0; if (u.uhunger < 1500 && !u.uswallow) { @@ -2128,7 +2128,7 @@ register struct attack *mattk; body_part(STOMACH)); } else { tmp = 1 + (pd->cwt >> 8); - if (corpse_chance(mdef, &youmonst, TRUE) + if (corpse_chance(mdef, &g.youmonst, TRUE) && !(g.mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) { /* nutrition only if there can be a corpse */ u.uhunger += (pd->cnutrit + 1) / 2; @@ -2161,7 +2161,7 @@ register struct attack *mattk; end_engulf(); return 2; case AD_PHYS: - if (youmonst.data == &mons[PM_FOG_CLOUD]) { + if (g.youmonst.data == &mons[PM_FOG_CLOUD]) { pline("%s is laden with your moisture.", Monnam(mdef)); if (amphibious(pd) && !flaming(pd)) { dam = 0; @@ -2178,7 +2178,7 @@ register struct attack *mattk; } break; case AD_BLND: - if (can_blnd(&youmonst, mdef, mattk->aatyp, + if (can_blnd(&g.youmonst, mdef, mattk->aatyp, (struct obj *) 0)) { if (mdef->mcansee) pline("%s can't see in there!", Monnam(mdef)); @@ -2237,9 +2237,9 @@ register struct attack *mattk; if (DEADMONSTER(mdef)) /* not lifesaved */ return 2; } - You("%s %s!", is_animal(youmonst.data) ? "regurgitate" : "expel", + You("%s %s!", is_animal(g.youmonst.data) ? "regurgitate" : "expel", mon_nam(mdef)); - if (Slow_digestion || is_animal(youmonst.data)) { + if (Slow_digestion || is_animal(g.youmonst.data)) { pline("Obviously, you didn't like %s taste.", s_suffix(mon_nam(mdef))); } @@ -2257,7 +2257,7 @@ boolean wouldhavehit; if (wouldhavehit) /* monk is missing due to penalty for wearing suit */ Your("armor is rather cumbersome..."); - if (could_seduce(&youmonst, mdef, mattk)) + if (could_seduce(&g.youmonst, mdef, mattk)) You("pretend to be friendly to %s.", mon_nam(mdef)); else if (canspotmon(mdef) && flags.verbose) You("miss %s.", mon_nam(mdef)); @@ -2280,7 +2280,7 @@ register struct monst *mon; for (i = 0; i < NATTK; i++) { sum[i] = 0; - mattk = getmattk(&youmonst, mon, i, sum, &alt_attk); + mattk = getmattk(&g.youmonst, mon, i, sum, &alt_attk); weapon = 0; switch (mattk->aatyp) { case AT_WEAP: @@ -2336,11 +2336,11 @@ register struct monst *mon; sum[i] = damageum(mon, mattk); break; case AT_CLAW: - if (uwep && !cantwield(youmonst.data) && !weapon_used) + if (uwep && !cantwield(g.youmonst.data) && !weapon_used) goto use_weapon; /*FALLTHRU*/ case AT_TUCH: - if (uwep && youmonst.data->mlet == S_LICH && !weapon_used) + if (uwep && g.youmonst.data->mlet == S_LICH && !weapon_used) goto use_weapon; /*FALLTHRU*/ case AT_KICK: @@ -2356,7 +2356,7 @@ register struct monst *mon; int compat; if (!u.uswallow - && (compat = could_seduce(&youmonst, mon, mattk))) { + && (compat = could_seduce(&g.youmonst, mon, mattk))) { You("%s %s %s.", mon->mcansee && haseyes(mon->data) ? "smile at" : "talk to", @@ -2447,9 +2447,9 @@ register struct monst *mon; /* No check for uwep; if wielding nothing we want to * do the normal 1-2 points bare hand damage... */ - if ((youmonst.data->mlet == S_KOBOLD - || youmonst.data->mlet == S_ORC - || youmonst.data->mlet == S_GNOME) && !weapon_used) + if ((g.youmonst.data->mlet == S_KOBOLD + || g.youmonst.data->mlet == S_ORC + || g.youmonst.data->mlet == S_GNOME) && !weapon_used) goto use_weapon; /*FALLTHRU*/ @@ -2539,7 +2539,7 @@ boolean wep_was_destroyed; if (!Acid_resistance) mdamageu(mon, tmp); if (!rn2(30)) - erode_armor(&youmonst, ERODE_CORRODE); + erode_armor(&g.youmonst, ERODE_CORRODE); } if (mhit && weapon) { if (aatyp == AT_KICK) { @@ -2568,7 +2568,7 @@ boolean wep_was_destroyed; || (protector == W_ARMH && !uarmh) || (protector == (W_ARMC | W_ARMG) && (!uarmc || !uarmg))) { if (!Stone_resistance - && !(poly_when_stoned(youmonst.data) + && !(poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))) { done_in_by(mon, STONING); /* "You turn to stone..." */ return 2; @@ -2682,7 +2682,7 @@ boolean wep_was_destroyed; mon->mhpmax = mon->mhp; /* at a certain point, the monster will reproduce! */ if (mon->mhpmax > ((int) (mon->m_lev + 1) * 8)) - (void) split_mon(mon, &youmonst); + (void) split_mon(mon, &g.youmonst); } break; case AD_STUN: /* specifically yellow mold */ diff --git a/src/vault.c b/src/vault.c index e08467d15..43806e83c 100644 --- a/src/vault.c +++ b/src/vault.c @@ -382,18 +382,18 @@ invault() mongone(guard); return; } - if (youmonst.m_ap_type == M_AP_OBJECT || u.uundetected) { - if (youmonst.m_ap_type == M_AP_OBJECT - && youmonst.mappearance != GOLD_PIECE) + if (g.youmonst.m_ap_type == M_AP_OBJECT || u.uundetected) { + if (g.youmonst.m_ap_type == M_AP_OBJECT + && g.youmonst.mappearance != GOLD_PIECE) if (!Deaf) verbalize("Hey! Who left that %s in here?", - mimic_obj_name(&youmonst)); + mimic_obj_name(&g.youmonst)); /* 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(youmonst.data) || g.multi < 0) { + if (Strangled || is_silent(g.youmonst.data) || g.multi < 0) { /* [we ought to record whether this 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] */ @@ -458,7 +458,7 @@ invault() (Blind) ? "" : "appear to "); else verbalize("I don't know you."); - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); if (!umoney && !hidden_gold()) { if (Deaf) pline("%s stomps%s.", noit_Monnam(guard), @@ -470,7 +470,7 @@ invault() if (Deaf) { if (!Blind) pline("%s glares at you%s.", noit_Monnam(guard), - invent ? "r stuff" : ""); + g.invent ? "r stuff" : ""); } else { verbalize("You have hidden gold."); } @@ -765,7 +765,7 @@ register struct monst *grd; return -1; } - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); u_carry_gold = umoney > 0L || hidden_gold() > 0L; if (egrd->fcend == 1) { if (u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) { @@ -879,7 +879,7 @@ register struct monst *grd; } if (um_dist(grd->mx, grd->my, 1) || egrd->gddone) { if (!egrd->gddone && !rn2(10) && !Deaf && !u.uswallow - && !(u.ustuck && !sticks(youmonst.data))) + && !(u.ustuck && !sticks(g.youmonst.data))) verbalize("Move along!"); restfakecorr(grd); return 0; /* didn't move */ @@ -1037,7 +1037,7 @@ void paygd() { register struct monst *grd = findgd(); - long umoney = money_cnt(invent); + long umoney = money_cnt(g.invent); struct obj *coins, *nextcoins; int gx, gy; char buf[BUFSZ]; @@ -1063,7 +1063,7 @@ paygd() g.plname, mons[u.umonster].mname); make_grave(gx, gy, buf); } - for (coins = invent; coins; coins = nextcoins) { + for (coins = g.invent; coins; coins = nextcoins) { nextcoins = coins->nobj; if (objects[coins->otyp].oc_class == COIN_CLASS) { freeinv(coins); @@ -1080,7 +1080,7 @@ hidden_gold() long value = 0L; struct obj *obj; - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if (Has_contents(obj)) value += contained_gold(obj); /* unknown gold stuck inside statues may cause some consternation... */ diff --git a/src/weapon.c b/src/weapon.c index d8543c717..e8bc49133 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -1451,7 +1451,7 @@ const struct def_skill *class_skill; } /* Set skill for all weapons in inventory to be basic */ - for (obj = invent; obj; obj = obj->nobj) { + for (obj = g.invent; obj; obj = obj->nobj) { /* don't give skill just because of carried ammo, wait until we see the relevant launcher (prevents an archeologist's touchstone from inadvertently providing skill in sling) */ diff --git a/src/were.c b/src/were.c index 2c73877f6..4c37b8b1c 100644 --- a/src/were.c +++ b/src/were.c @@ -200,11 +200,11 @@ boolean purify; You_feel("purified."); set_ulycn(NON_PM); /* cure lycanthropy */ } - if (!Unchanging && is_were(youmonst.data) + if (!Unchanging && is_were(g.youmonst.data) && (!controllable_poly || !paranoid_query(ParanoidWerechange, "Remain in beast form?"))) rehumanize(); - else if (is_were(youmonst.data) && !u.mtimedone) + else if (is_were(g.youmonst.data) && !u.mtimedone) u.mtimedone = rn1(200, 200); /* 40% of initial were change */ } diff --git a/src/wield.c b/src/wield.c index 23dba0729..138b3fba8 100644 --- a/src/wield.c +++ b/src/wield.c @@ -263,7 +263,7 @@ dowield() /* May we attempt this? */ g.multi = 0; - if (cantwield(youmonst.data)) { + if (cantwield(g.youmonst.data)) { pline("Don't be ridiculous!"); return 0; } @@ -314,7 +314,7 @@ doswapweapon() /* May we attempt this? */ g.multi = 0; - if (cantwield(youmonst.data)) { + if (cantwield(g.youmonst.data)) { pline("Don't be ridiculous!"); return 0; } @@ -554,7 +554,7 @@ const char *verb; /* "rub",&c */ } return FALSE; } - if (cantwield(youmonst.data)) { + if (cantwield(g.youmonst.data)) { You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it"); return FALSE; } @@ -601,7 +601,7 @@ can_twoweapon() struct obj *otmp; #define NOT_WEAPON(obj) (!is_weptool(obj) && obj->oclass != WEAPON_CLASS) - if (!could_twoweap(youmonst.data)) { + if (!could_twoweap(g.youmonst.data)) { if (Upolyd) You_cant("use two weapons in your current form."); else diff --git a/src/worn.c b/src/worn.c index 5632690e1..ff2f157f2 100644 --- a/src/worn.c +++ b/src/worn.c @@ -656,7 +656,7 @@ which_armor(mon, flag) struct monst *mon; long flag; { - if (mon == &youmonst) { + if (mon == &g.youmonst) { switch (flag) { case W_ARM: return uarm; @@ -739,7 +739,7 @@ clear_bypasses() #endif /*0*/ } } - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) otmp->bypass = 0; for (otmp = g.migrating_objs; otmp; otmp = otmp->nobj) otmp->bypass = 0; diff --git a/src/write.c b/src/write.c index a2985ceec..2e2023eb8 100644 --- a/src/write.c +++ b/src/write.c @@ -104,7 +104,7 @@ register struct obj *pen; boolean by_descr = FALSE; const char *typeword; - if (nohands(youmonst.data)) { + if (nohands(g.youmonst.data)) { You("need hands to be able to write!"); return 0; } else if (Glib) { @@ -287,7 +287,7 @@ found: /* if known, then either by-name or by-descr works */ if (!objects[new_obj->otyp].oc_name_known /* else if named, then only by-descr works */ - && !(by_descr && label_known(new_obj->otyp, invent)) + && !(by_descr && label_known(new_obj->otyp, g.invent)) /* and Luck might override after both checks have failed */ && rnl(Role_if(PM_WIZARD) ? 5 : 15)) { You("%s to write that.", by_descr ? "fail" : "don't know how"); @@ -343,7 +343,7 @@ found: specifically chosen item so hero recognizes it even if blind; the exception is for being lucky writing an undiscovered scroll, where the label associated with the type-name isn't known yet */ - new_obj->dknown = label_known(new_obj->otyp, invent) ? 1 : 0; + new_obj->dknown = label_known(new_obj->otyp, g.invent) ? 1 : 0; new_obj = hold_another_object(new_obj, "Oops! %s out of your grasp!", The(aobjnam(new_obj, "slip")), diff --git a/src/zap.c b/src/zap.c index 714db23ef..1dd5c91a6 100644 --- a/src/zap.c +++ b/src/zap.c @@ -554,7 +554,7 @@ struct monst *mon; xchar *xp, *yp; int locflags; /* non-zero means get location even if monster is buried */ { - if (mon == &youmonst) { + if (mon == &g.youmonst) { *xp = u.ux; *yp = u.uy; return TRUE; @@ -957,8 +957,8 @@ struct monst *mon; boolean youseeit; int res = 0; - youseeit = (mon == &youmonst) ? TRUE : canseemon(mon); - otmp2 = (mon == &youmonst) ? invent : mon->minvent; + youseeit = (mon == &g.youmonst) ? TRUE : canseemon(mon); + otmp2 = (mon == &g.youmonst) ? g.invent : mon->minvent; owner[0] = corpse[0] = '\0'; /* lint suppression */ while ((otmp = otmp2) != 0) { @@ -1789,7 +1789,7 @@ struct obj *obj; non-omnivorous form, regardless of whether it's herbivorous, non-eating, or something stranger) */ if (Role_if(PM_MONK) || !u.uconduct.unvegetarian - || !carnivorous(youmonst.data)) + || !carnivorous(g.youmonst.data)) Norep("You smell the odor of meat."); else Norep("You smell a delicious smell."); @@ -1893,14 +1893,14 @@ struct obj *obj, *otmp; if (obj_shudders(obj)) { boolean cover = ((obj == g.level.objects[u.ux][u.uy]) && u.uundetected - && hides_under(youmonst.data)); + && hides_under(g.youmonst.data)); if (cansee(obj->ox, obj->oy)) learn_it = TRUE; do_osshock(obj); /* eek - your cover might have been blown */ if (cover) - (void) hideunder(&youmonst); + (void) hideunder(&g.youmonst); break; } obj = poly_obj(obj, STRANGE_OBJECT); @@ -2073,7 +2073,7 @@ schar zz; next_obj = otmp->nexthere; /* for zap downwards, don't hit object poly'd hero is hiding under */ if (zz > 0 && u.uundetected && otmp == g.level.objects[u.ux][u.uy] - && hides_under(youmonst.data)) + && hides_under(g.youmonst.data)) continue; hitanything += (*fhito)(otmp, obj); @@ -2283,7 +2283,7 @@ boolean ordinary; damage = d(12, 6); } burn_away_slime(); - (void) burnarmor(&youmonst); + (void) burnarmor(&g.youmonst); destroy_item(SCROLL_CLASS, AD_FIRE); destroy_item(POTION_CLASS, AD_FIRE); destroy_item(SPBOOK_CLASS, AD_FIRE); @@ -2327,7 +2327,7 @@ boolean ordinary; case WAN_CANCELLATION: case SPE_CANCELLATION: - (void) cancel_monst(&youmonst, obj, TRUE, TRUE, TRUE); + (void) cancel_monst(&g.youmonst, obj, TRUE, TRUE, TRUE); break; case SPE_DRAIN_LIFE: @@ -2405,7 +2405,7 @@ boolean ordinary; case WAN_DEATH: case SPE_FINGER_OF_DEATH: - if (nonliving(youmonst.data) || is_demon(youmonst.data)) { + if (nonliving(g.youmonst.data) || is_demon(g.youmonst.data)) { pline((obj->otyp == WAN_DEATH) ? "The wand shoots an apparently harmless beam at you." : "You seem no deader than before."); @@ -2422,8 +2422,8 @@ boolean ordinary; case WAN_UNDEAD_TURNING: case SPE_TURN_UNDEAD: learn_it = TRUE; - (void) unturn_dead(&youmonst); - if (is_undead(youmonst.data)) { + (void) unturn_dead(&g.youmonst); + if (is_undead(g.youmonst.data)) { You_feel("frightened and %sstunned.", Stunned ? "even more " : ""); make_stunned((HStun & TIMEOUT) + (long) rnd(30), FALSE); @@ -2457,21 +2457,21 @@ boolean ordinary; unpunish(); } if (u.utrap) { /* escape web or bear trap */ - (void) openholdingtrap(&youmonst, &learn_it); + (void) openholdingtrap(&g.youmonst, &learn_it); } else { struct obj *otmp; /* unlock carried boxes */ - for (otmp = invent; otmp; otmp = otmp->nobj) + for (otmp = g.invent; otmp; otmp = otmp->nobj) if (Is_box(otmp)) (void) boxlock(otmp, obj); /* trigger previously escaped trapdoor */ - (void) openfallingtrap(&youmonst, TRUE, &learn_it); + (void) openfallingtrap(&g.youmonst, TRUE, &learn_it); } break; case WAN_LOCKING: case SPE_WIZARD_LOCK: if (!u.utrap) { - (void) closeholdingtrap(&youmonst, &learn_it); + (void) closeholdingtrap(&g.youmonst, &learn_it); } break; case WAN_DIGGING: @@ -2482,7 +2482,7 @@ boolean ordinary; case WAN_PROBING: { struct obj *otmp; - for (otmp = invent; otmp; otmp = otmp->nobj) { + for (otmp = g.invent; otmp; otmp = otmp->nobj) { otmp->dknown = 1; if (Is_container(otmp) || otmp->otyp == STATUE) { otmp->lknown = 1; @@ -2507,7 +2507,7 @@ boolean ordinary; fix_petrification(); /* saved! */ } /* but at a cost.. */ - for (otmp = invent; otmp; otmp = onxt) { + for (otmp = g.invent; otmp; otmp = onxt) { onxt = otmp->nobj; if (bhito(otmp, obj)) learn_it = TRUE; @@ -2519,7 +2519,7 @@ boolean ordinary; */ do { didmerge = FALSE; - for (otmp = invent; !didmerge && otmp; otmp = otmp->nobj) + for (otmp = g.invent; !didmerge && otmp; otmp = otmp->nobj) for (onxt = otmp->nobj; onxt; onxt = onxt->nobj) if (merged(&otmp, &onxt)) { didmerge = TRUE; @@ -2561,7 +2561,7 @@ int amt; /* pseudo-damage used to determine blindness duration */ const char *how; int dmg = amt; - if (dmg && youmonst.data == &mons[PM_GREMLIN]) { + if (dmg && g.youmonst.data == &mons[PM_GREMLIN]) { /* reduce high values (from destruction of wand with many charges) */ dmg = rnd(dmg); if (dmg > 10) @@ -2589,7 +2589,7 @@ boolean flashburn(duration) long duration; { - if (!resists_blnd(&youmonst)) { + if (!resists_blnd(&g.youmonst)) { You(are_blinded_by_the_flash); make_blinded(duration, FALSE); if (!Blind) @@ -2673,7 +2673,7 @@ register struct monst *mdef; register struct obj *obj; boolean youattack, allow_cancel_kill, self_cancel; { - boolean youdefend = (mdef == &youmonst); + boolean youdefend = (mdef == &g.youmonst); static const char writing_vanishes[] = "Some writing vanishes from %s head!"; static const char your[] = "your"; /* should be extern */ @@ -2685,7 +2685,7 @@ boolean youattack, allow_cancel_kill, self_cancel; if (self_cancel) { /* 1st cancel inventory */ struct obj *otmp; - for (otmp = (youdefend ? invent : mdef->minvent); otmp; + for (otmp = (youdefend ? g.invent : mdef->minvent); otmp; otmp = otmp->nobj) cancel_item(otmp); if (youdefend) { @@ -2792,10 +2792,10 @@ struct obj *obj; /* wand or spell */ } /* down will release you from bear trap or web */ if (u.dz > 0 && u.utrap) { - (void) openholdingtrap(&youmonst, &disclose); + (void) openholdingtrap(&g.youmonst, &disclose); /* down will trigger trapdoor, hole, or [spiked-] pit */ } else if (u.dz > 0 && !u.utrap) { - (void) openfallingtrap(&youmonst, FALSE, &disclose); + (void) openfallingtrap(&g.youmonst, FALSE, &disclose); } break; case WAN_STRIKING: @@ -2829,7 +2829,7 @@ struct obj *obj; /* wand or spell */ } newsym(x, y); } else if (u.dz > 0 && ttmp) { - if (!striking && closeholdingtrap(&youmonst, &disclose)) { + if (!striking && closeholdingtrap(&g.youmonst, &disclose)) { ; /* now stuck in web or bear trap */ } else if (striking && ttmp->ttyp == TRAPDOOR) { /* striking transforms trapdoor into hole */ @@ -2933,14 +2933,14 @@ struct obj *obj; /* wand or spell */ /* game flavor: if you're hiding under "something" * a zap upward should hit that "something". */ - if (u.uundetected && hides_under(youmonst.data)) { + if (u.uundetected && hides_under(g.youmonst.data)) { int hitit = 0; otmp = g.level.objects[u.ux][u.uy]; if (otmp) hitit = bhito(otmp, obj); if (hitit) { - (void) hideunder(&youmonst); + (void) hideunder(&g.youmonst); disclose = TRUE; } } @@ -3492,14 +3492,14 @@ int dx, dy; if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) { /* ct == 9 */ if (Fumbling || rn2(20) >= ACURR(A_DEX)) { /* we hit ourselves */ - (void) thitu(10 + obj->spe, dmgval(obj, &youmonst), &obj, + (void) thitu(10 + obj->spe, dmgval(obj, &g.youmonst), &obj, "boomerang"); endmultishot(TRUE); break; } else { /* we catch it */ tmp_at(DISP_END, 0); You("skillfully catch the boomerang."); - return &youmonst; + return &g.youmonst; } } tmp_at(g.bhitpos.x, g.bhitpos.y); @@ -3709,7 +3709,7 @@ xchar sx, sy; dam = d(nd, 6); } burn_away_slime(); - if (burnarmor(&youmonst)) { /* "body hit" */ + if (burnarmor(&g.youmonst)) { /* "body hit" */ if (!rn2(3)) destroy_item(POTION_CLASS, AD_FIRE); if (!rn2(3)) @@ -3760,7 +3760,7 @@ xchar sx, sy; (void) destroy_arm(uarmc); if (uarmu) (void) destroy_arm(uarmu); - } else if (nonliving(youmonst.data) || is_demon(youmonst.data)) { + } else if (nonliving(g.youmonst.data) || is_demon(g.youmonst.data)) { shieldeff(sx, sy); You("seem unaffected."); break; @@ -3807,7 +3807,7 @@ xchar sx, sy; if (u.twoweap && !rn2(3)) acid_damage(uswapwep); if (!rn2(6)) - erode_armor(&youmonst, ERODE_CORRODE); + erode_armor(&g.youmonst, ERODE_CORRODE); break; } @@ -4067,7 +4067,7 @@ boolean say; /* Announce out of sight hit/miss events if true */ pline("%s disintegrates.", Monnam(mon)); pline("%s body reintegrates before your %s!", s_suffix(Monnam(mon)), - (eyecount(youmonst.data) == 1) + (eyecount(g.youmonst.data) == 1) ? body_part(EYE) : makeplural(body_part(EYE))); pline("%s resurrects!", Monnam(mon)); @@ -4838,7 +4838,7 @@ int osym, dmgtyp; pline("%s %s %s!", mult, xname(obj), destroy_strings[dindx][(cnt > 1L)]); if (osym == POTION_CLASS && dmgtyp != AD_COLD) { - if (!breathless(youmonst.data) || haseyes(youmonst.data)) + if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) potionbreathe(obj); } if (obj->owornmask) { @@ -4911,9 +4911,9 @@ int osym, dmgtyp; * of o_id and quantity of what is targetted for destruction, * second pass to handle the destruction.] */ - bypass_objlist(invent, FALSE); /* clear bypass bit for invent */ + bypass_objlist(g.invent, FALSE); /* clear bypass bit for invent */ - while ((obj = nxt_unbypassed_obj(invent)) != 0) { + while ((obj = nxt_unbypassed_obj(g.invent)) != 0) { if (obj->oclass != osym) continue; /* test only objs of type osym */ if (obj->oartifact) @@ -4944,7 +4944,7 @@ int osym, dmgtyp; for (i = 0; i < deferral_indx; ++i) { /* note: obj->nobj is only referenced when obj is skipped; having obj be dropped or destroyed won't affect traversal */ - for (obj = invent; obj; obj = obj->nobj) + for (obj = g.invent; obj; obj = obj->nobj) if (obj->o_id == deferrals[i]) { destroy_one_item(obj, osym, dmgtyp); break; @@ -4964,7 +4964,7 @@ int osym, dmgtyp; int dindx; boolean vis; - if (mtmp == &youmonst) { /* this simplifies artifact_hit() */ + if (mtmp == &g.youmonst) { /* this simplifies artifact_hit() */ destroy_item(osym, dmgtyp); return 0; /* arbitrary; value doesn't matter to artifact_hit() */ } diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index 02f906ef0..dbf0ae0a1 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -160,10 +160,10 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ int fd; boolean have_syscf = FALSE; - (void) strncpy(hackdir, dir, PATHLEN - 1); - hackdir[PATHLEN - 1] = '\0'; - fqn_prefix[0] = (char *) alloc(strlen(hackdir) + 2); - Strcpy(fqn_prefix[0], hackdir); + (void) strncpy(g.hackdir, dir, PATHLEN - 1); + g.hackdir[PATHLEN - 1] = '\0'; + fqn_prefix[0] = (char *) alloc(strlen(g.hackdir) + 2); + Strcpy(fqn_prefix[0], g.hackdir); append_slash(fqn_prefix[0]); for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++) fqn_prefix[prefcnt] = fqn_prefix[0]; @@ -235,8 +235,8 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ failbuf); nethack_exit(EXIT_FAILURE); } - if (!hackdir[0]) - Strcpy(hackdir, orgdir); + if (!g.hackdir[0]) + Strcpy(g.hackdir, orgdir); process_options(argc, argv); /* @@ -414,7 +414,7 @@ char *argv[]; } if (!*dir) error("Flag -d must be followed by a directory name."); - Strcpy(hackdir, dir); + Strcpy(g.hackdir, dir); } if (argc > 1) { diff --git a/win/win32/mhmain.c b/win/win32/mhmain.c index e775f12a7..d1e53cdc6 100644 --- a/win/win32/mhmain.c +++ b/win/win32/mhmain.c @@ -933,7 +933,7 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ofn.nMaxFile = SIZE(filename); ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NH_A2W(hackdir, whackdir, MAX_PATH); + ofn.lpstrInitialDir = NH_A2W(g.hackdir, whackdir, MAX_PATH); ofn.lpstrTitle = NULL; ofn.Flags = OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; ofn.nFileOffset = 0;