context to g.context

This commit is contained in:
Bart House
2018-12-25 07:29:38 -08:00
parent 9069615861
commit 1c65e6afe0
70 changed files with 837 additions and 844 deletions
+36 -36
View File
@@ -51,11 +51,11 @@ boolean resuming;
}
if (!resuming) { /* new game */
context.rndencode = rnd(9000);
g.context.rndencode = rnd(9000);
set_wear((struct obj *) 0); /* for side-effects of starting gear */
(void) pickup(1); /* autopickup at initial location */
}
context.botlx = TRUE; /* for STATUS_HILITES */
g.context.botlx = TRUE; /* for STATUS_HILITES */
update_inventory(); /* for perm_invent */
if (resuming) { /* restoring old game */
read_engr_at(u.ux, u.uy); /* subset of pickup() */
@@ -70,7 +70,7 @@ boolean resuming;
u.uz0.dlevel = u.uz.dlevel;
g.youmonst.movement = NORMAL_SPEED; /* give the hero some movement points */
context.move = 0;
g.context.move = 0;
program_state.in_moveloop = 1;
for (;;) {
@@ -83,20 +83,20 @@ boolean resuming;
do_positionbar();
#endif
if (context.move) {
if (g.context.move) {
/* actual time passed */
g.youmonst.movement -= NORMAL_SPEED;
do { /* hero can't move this turn loop */
wtcap = encumber_msg();
context.mon_moving = TRUE;
g.context.mon_moving = TRUE;
do {
monscanmove = movemon();
if (g.youmonst.movement >= NORMAL_SPEED)
break; /* it's now your turn */
} while (monscanmove);
context.mon_moving = FALSE;
g.context.mon_moving = FALSE;
if (!monscanmove && g.youmonst.movement < NORMAL_SPEED) {
/* both you and the monsters are out of steam this round
@@ -173,8 +173,8 @@ boolean resuming;
if (u.ublesscnt)
u.ublesscnt--;
if (flags.time && !context.run)
context.botl = 1;
if (flags.time && !g.context.run)
g.context.botl = 1;
/* One possible result of prayer is healing. Whether or
* not you get healed depends on your current hit points.
@@ -219,7 +219,7 @@ boolean resuming;
(int) (ACURR(A_WIS) + ACURR(A_INT)) / 15 + 1, 1);
if (u.uen > u.uenmax)
u.uen = u.uenmax;
context.botl = 1;
g.context.botl = 1;
if (u.uen == u.uenmax)
interrupt_multi("You feel full of energy.");
}
@@ -314,7 +314,7 @@ boolean resuming;
/******************************************/
status_eval_next_unhilite();
if (context.bypasses)
if (g.context.bypasses)
clear_bypasses();
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)
&& !BClairvoyant && !(g.moves % 15) && !rn2(2))
@@ -333,7 +333,7 @@ boolean resuming;
clear_splitobjs();
find_ac();
if (!context.mv || Blind) {
if (!g.context.mv || Blind) {
/* redo monsters if hallu or wearing a helm of telepathy */
if (Hallucination) { /* update screen randomly */
see_monsters();
@@ -349,12 +349,12 @@ boolean resuming;
if (g.vision_full_recalc)
vision_recalc(0); /* vision! */
}
if (context.botl || context.botlx) {
if (g.context.botl || g.context.botlx) {
bot();
curs_on_u();
}
context.move = 1;
g.context.move = 1;
if (g.multi >= 0 && g.occupation) {
#if defined(MICRO) || defined(WIN32)
@@ -399,15 +399,15 @@ boolean resuming;
lookaround();
if (!g.multi) {
/* lookaround may clear multi */
context.move = 0;
g.context.move = 0;
if (flags.time)
context.botl = 1;
g.context.botl = 1;
continue;
}
if (context.mv) {
if (g.context.mv) {
if (g.multi < COLNO && !--g.multi)
context.travel = context.travel1 = context.mv =
context.run = 0;
g.context.travel = g.context.travel1 = g.context.mv =
g.context.run = 0;
domove();
} else {
--g.multi;
@@ -421,17 +421,17 @@ boolean resuming;
}
if (u.utotype) /* change dungeon level */
deferred_goto(); /* after rhack() */
/* !context.move here: multiple movement command stopped */
else if (flags.time && (!context.move || !context.mv))
context.botl = 1;
/* !g.context.move here: multiple movement command stopped */
else if (flags.time && (!g.context.move || !g.context.mv))
g.context.botl = 1;
if (g.vision_full_recalc)
vision_recalc(0); /* vision! */
/* when running in non-tport mode, this gets done through domove() */
if ((!context.run || flags.runmode == RUN_TPORT)
&& (g.multi && (!context.travel ? !(g.multi % 7) : !(g.moves % 7L)))) {
if (flags.time && context.run)
context.botl = 1;
if ((!g.context.run || flags.runmode == RUN_TPORT)
&& (g.multi && (!g.context.travel ? !(g.multi % 7) : !(g.moves % 7L)))) {
if (flags.time && g.context.run)
g.context.botl = 1;
display_nhwindow(WIN_MAP, FALSE);
}
}
@@ -461,7 +461,7 @@ int wtcap;
heal = 1;
}
if (heal) {
context.botl = 1;
g.context.botl = 1;
u.mh += heal;
reached_full = (u.mh == u.mhmax);
}
@@ -493,7 +493,7 @@ int wtcap;
heal = 1;
if (heal) {
context.botl = 1;
g.context.botl = 1;
u.uhp += heal;
if (u.uhp > u.uhpmax)
u.uhp = u.uhpmax;
@@ -514,7 +514,7 @@ stop_occupation()
if (!maybe_finished_meal(TRUE))
You("stop %s.", g.occtxt);
g.occupation = 0;
context.botl = 1; /* in case u.uhs changed */
g.context.botl = 1; /* in case u.uhs changed */
nomul(0);
pushch(0);
} else if (g.multi >= 0) {
@@ -567,13 +567,13 @@ newgame()
gameDiskPrompt();
#endif
context.botlx = 1;
context.ident = 1;
context.stethoscope_move = -1L;
context.warnlevel = 1;
context.next_attrib_check = 600L; /* arbitrary first setting */
context.tribute.enabled = TRUE; /* turn on 3.6 tributes */
context.tribute.tributesz = sizeof(struct tribute_info);
g.context.botlx = 1;
g.context.ident = 1;
g.context.stethoscope_move = -1L;
g.context.warnlevel = 1;
g.context.next_attrib_check = 600L; /* arbitrary first setting */
g.context.tribute.enabled = TRUE; /* turn on 3.6 tributes */
g.context.tribute.tributesz = sizeof(struct tribute_info);
for (i = LOW_PM; i < NUMMONS; i++)
g.mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
@@ -728,7 +728,7 @@ STATIC_DCL void
interrupt_multi(msg)
const char *msg;
{
if (g.multi > 0 && !context.travel && !context.run) {
if (g.multi > 0 && !g.context.travel && !g.context.run) {
nomul(0);
if (flags.verbose && msg)
Norep("%s", msg);
+15 -15
View File
@@ -317,10 +317,10 @@ register struct obj *obj;
if (!getdir((char *) 0))
return 0;
res = (g.moves == context.stethoscope_move)
&& (g.youmonst.movement == context.stethoscope_movement);
context.stethoscope_move = g.moves;
context.stethoscope_movement = g.youmonst.movement;
res = (g.moves == g.context.stethoscope_move)
&& (g.youmonst.movement == g.context.stethoscope_movement);
g.context.stethoscope_move = g.moves;
g.context.stethoscope_movement = g.youmonst.movement;
g.bhitpos.x = u.ux, g.bhitpos.y = u.uy; /* tentative, reset below */
g.notonhead = u.uswallow;
@@ -1918,7 +1918,7 @@ struct obj *obj;
if (Deaf) /* make_deaf() won't give feedback when already deaf */
pline("Nothing seems to happen.");
make_deaf((HDeaf & TIMEOUT) + lcount, TRUE);
context.botl = TRUE;
g.context.botl = TRUE;
break;
}
return;
@@ -2053,7 +2053,7 @@ struct obj *obj;
else if (!did_prop)
pline("Nothing seems to happen.");
context.botl = (did_attr || did_prop);
g.context.botl = (did_attr || did_prop);
#undef PROP_COUNT
#undef ATTR_COUNT
#undef prop2trbl
@@ -2230,7 +2230,7 @@ struct obj **optr;
return;
}
if (!getdir((char *) 0)) {
context.move = g.multi = 0;
g.context.move = g.multi = 0;
return;
}
x = u.ux + u.dx;
@@ -2676,7 +2676,7 @@ struct obj *obj;
You("hit your %s with your bullwhip.", body_part(FOOT));
Sprintf(buf, "killed %sself with %s bullwhip", uhim(), uhis());
losehp(Maybe_Half_Phys(dam), buf, NO_KILLER_PREFIX);
context.botl = 1;
g.context.botl = 1;
return 1;
} else if ((Fumbling || Glib) && !rn2(5)) {
@@ -2943,7 +2943,7 @@ struct obj *obj;
int res = 0, typ, max_range, min_range, glyph;
coord cc;
struct monst *mtmp;
struct monst *hitm = context.polearm.hitmon;
struct monst *hitm = g.context.polearm.hitmon;
/* Are you allowed to use the pole? */
if (u.uswallow) {
@@ -3016,7 +3016,7 @@ struct obj *obj;
return res;
}
context.polearm.hitmon = (struct monst *) 0;
g.context.polearm.hitmon = (struct monst *) 0;
/* Attack the monster there */
g.bhitpos = cc;
if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != (struct monst *) 0) {
@@ -3024,7 +3024,7 @@ struct obj *obj;
return res;
if (overexertion())
return 1; /* burn nutrition; maybe pass out */
context.polearm.hitmon = mtmp;
g.context.polearm.hitmon = mtmp;
check_caitiff(mtmp);
g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
(void) thitmonst(mtmp, uwep);
@@ -3411,11 +3411,11 @@ struct obj *obj;
*/
if ((mon = m_at(x, y)) != 0) {
(void) bhitm(mon, obj);
/* if (context.botl) bot(); */
/* if (g.context.botl) bot(); */
}
if (affects_objects && g.level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y, 0);
if (context.botl)
if (g.context.botl)
bot(); /* potion effects */
}
} else {
@@ -3433,7 +3433,7 @@ struct obj *obj;
*/
if (affects_objects && g.level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y, 0);
if (context.botl)
if (g.context.botl)
bot(); /* potion effects */
}
damage = zapyourself(obj, FALSE);
@@ -3441,7 +3441,7 @@ struct obj *obj;
Sprintf(buf, "killed %sself by breaking a wand", uhim());
losehp(Maybe_Half_Phys(damage), buf, NO_KILLER_PREFIX);
}
if (context.botl)
if (g.context.botl)
bot(); /* blindness */
}
}
+7 -7
View File
@@ -562,10 +562,10 @@ long wp_mask;
if (spec_m2(otmp)) {
if (on) {
EWarn_of_mon |= wp_mask;
context.warntype.obj |= spec_m2(otmp);
g.context.warntype.obj |= spec_m2(otmp);
} else {
EWarn_of_mon &= ~wp_mask;
context.warntype.obj &= ~spec_m2(otmp);
g.context.warntype.obj &= ~spec_m2(otmp);
}
see_monsters();
} else {
@@ -1033,7 +1033,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
u.uenmax--;
if (u.uen > 0)
u.uen--;
context.botl = 1;
g.context.botl = 1;
}
} else {
if (mdef->data == &mons[PM_CLAY_GOLEM])
@@ -1042,7 +1042,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
You("absorb magical energy!");
u.uenmax++;
u.uen++;
context.botl = 1;
g.context.botl = 1;
}
}
}
@@ -1464,7 +1464,7 @@ struct obj *obj;
make_slimed(0L, (char *) 0);
if (Blinded > creamed)
make_blinded(creamed, FALSE);
context.botl = 1;
g.context.botl = 1;
break;
}
case ENERGY_BOOST: {
@@ -1477,7 +1477,7 @@ struct obj *obj;
if (epboost) {
You_feel("re-energized.");
u.uen += epboost;
context.botl = 1;
g.context.botl = 1;
} else
goto nothing_special;
break;
@@ -1807,7 +1807,7 @@ long *abil;
for (obj = g.invent; obj; obj = obj->nobj) {
if (obj->oartifact
&& (abil != &EWarn_of_mon || context.warntype.obj)) {
&& (abil != &EWarn_of_mon || g.context.warntype.obj)) {
const struct artifact *art = get_artifact(obj);
if (art) {
+9 -9
View File
@@ -167,7 +167,7 @@ int msgflg; /* positive => no message, zero => message, and */
if (msgflg <= 0)
You_feel("%s%s!", (incr > 1 || incr < -1) ? "very " : "", attrstr);
context.botl = 1;
g.context.botl = 1;
if (g.moves > 1 && (ndx == A_STR || ndx == A_CON))
(void) encumber_msg();
return TRUE;
@@ -294,7 +294,7 @@ boolean thrown_weapon; /* thrown weapons are less deadly */
if (i == 0 && typ != A_CHA) {
/* instant kill */
u.uhp = -1;
context.botl = TRUE;
g.context.botl = TRUE;
pline_The("poison was deadly...");
} else if (i > 5) {
/* HP damage; more likely--but less severe--with missiles */
@@ -379,13 +379,13 @@ restore_attrib()
if (ATEMP(i) != equilibrium && ATIME(i) != 0) {
if (!(--(ATIME(i)))) { /* countdown for change */
ATEMP(i) += (ATEMP(i) > 0) ? -1 : 1;
context.botl = 1;
g.context.botl = 1;
if (ATEMP(i)) /* reset timer */
ATIME(i) = 100 / ACURR(A_CON);
}
}
}
if (context.botl)
if (g.context.botl)
(void) encumber_msg();
}
@@ -513,11 +513,11 @@ exerchk()
/* Check out the periodic accumulations */
exerper();
if (g.moves >= context.next_attrib_check) {
if (g.moves >= g.context.next_attrib_check) {
debugpline1("exerchk: ready to test. multi = %d.", g.multi);
}
/* Are we ready for a test? */
if (g.moves >= context.next_attrib_check && !g.multi) {
if (g.moves >= g.context.next_attrib_check && !g.multi) {
debugpline0("exerchk: testing.");
/*
* Law of diminishing returns (Part II):
@@ -587,8 +587,8 @@ exerchk()
platform-dependent rounding/truncation for negative vals */
AEXE(i) = (abs(ax) / 2) * mod_val;
}
context.next_attrib_check += rn1(200, 800);
debugpline1("exerchk: next check at %ld.", context.next_attrib_check);
g.context.next_attrib_check += rn1(200, 800);
debugpline1("exerchk: next check at %ld.", g.context.next_attrib_check);
}
}
@@ -1124,7 +1124,7 @@ int reason; /* 0==conversion, 1==helm-of-OA on, 2==helm-of-OA off */
aligntyp oldalign = u.ualign.type;
u.ublessed = 0; /* lose divine protection */
context.botl = 1; /* status line needs updating */
g.context.botl = 1; /* status line needs updating */
if (reason == 0) {
/* conversion via altar */
u.ualignbase[A_CURRENT] = (aligntyp) newalign;
+12 -12
View File
@@ -246,7 +246,7 @@ bot()
putmixed(WIN_STATUS, 0, do_statusline2());
#endif
}
context.botl = context.botlx = 0;
g.context.botl = g.context.botlx = 0;
}
/* convert experience level (1..30) to rank index (0..8) */
@@ -683,18 +683,18 @@ boolean *valsetlist;
chg = g.update_all ? 0 : compare_blstats(prev, curr);
/* Temporary? hack: moveloop()'s prolog for a new game sets
* context.rndencode after the status window has been init'd,
* g.context.rndencode after the status window has been init'd,
* so $:0 has already been encoded and cached by the window
* port. Without this hack, gold's \G sequence won't be
* recognized and ends up being displayed as-is for 'g.update_all'.
*
* Also, even if context.rndencode hasn't changed and the
* Also, even if g.context.rndencode hasn't changed and the
* gold amount itself hasn't changed, the glyph portion of the
* encoding may have changed if a new symset was put into
* effect.
*
* \GXXXXNNNN:25
* XXXX = the context.rndencode portion
* XXXX = the g.context.rndencode portion
* NNNN = the glyph portion
* 25 = the gold amount
*
@@ -702,10 +702,10 @@ boolean *valsetlist;
* not to honor an initial highlight, so force 'update_all = TRUE'.
*/
if (fld == BL_GOLD
&& (context.rndencode != oldrndencode
&& (g.context.rndencode != oldrndencode
|| g.showsyms[COIN_CLASS + SYM_OFF_O] != oldgoldsym)) {
g.update_all = TRUE; /* chg = 2; */
oldrndencode = context.rndencode;
oldrndencode = g.context.rndencode;
oldgoldsym = g.showsyms[COIN_CLASS + SYM_OFF_O];
}
@@ -780,9 +780,9 @@ boolean *valsetlist;
* fields that have changed since the previous update.
*
* In both of those situations, we need to force updates to
* all of the fields when context.botlx is set. The tty port in
* all of the fields when g.context.botlx is set. The tty port in
* particular has a problem if that isn't done, since the core sets
* context.botlx when a menu or text display obliterates the status
* g.context.botlx when a menu or text display obliterates the status
* line.
*
* For those situations, to trigger the full update of every field
@@ -794,14 +794,14 @@ boolean *valsetlist;
* the display, call status_update() with BL_FLUSH.
*
*/
if (context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L)
if (g.context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L)
status_update(BL_RESET, (genericptr_t) 0, 0, 0,
NO_COLOR, &g.cond_hilites[0]);
else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
NO_COLOR, &g.cond_hilites[0]);
context.botl = context.botlx = 0;
g.context.botl = g.context.botlx = 0;
g.update_all = FALSE;
}
@@ -837,7 +837,7 @@ status_eval_next_unhilite()
next_unhilite = this_unhilite;
}
if (next_unhilite > 0L && next_unhilite < g.bl_hilite_moves)
context.botl = TRUE;
g.context.botl = TRUE;
}
void
@@ -1317,7 +1317,7 @@ reset_status_hilites()
g.blstats[0][i].time = g.blstats[1][i].time = 0L;
g.update_all = TRUE;
}
context.botlx = TRUE;
g.context.botlx = TRUE;
}
/* test whether the text from a title rule matches the string for
+46 -46
View File
@@ -1409,9 +1409,9 @@ wiz_intrinsic(VOID_ARGS)
break;
case WARN_OF_MON:
if (!Warn_of_mon) {
context.warntype.speciesidx = PM_GRID_BUG;
context.warntype.species
= &mons[context.warntype.speciesidx];
g.context.warntype.speciesidx = PM_GRID_BUG;
g.context.warntype.species
= &mons[g.context.warntype.speciesidx];
}
goto def_feedback;
case LEVITATION:
@@ -1425,7 +1425,7 @@ wiz_intrinsic(VOID_ARGS)
incr_itimeout(&u.uprops[p].intrinsic, amt);
break;
}
context.botl = 1; /* probably not necessary... */
g.context.botl = 1; /* probably not necessary... */
}
if (n >= 1)
free((genericptr_t) pick_list);
@@ -2530,32 +2530,32 @@ int final;
you_are("telepathic", from_what(TELEPAT));
if (Warning)
you_are("warned", from_what(WARNING));
if (Warn_of_mon && context.warntype.obj) {
if (Warn_of_mon && g.context.warntype.obj) {
Sprintf(buf, "aware of the presence of %s",
(context.warntype.obj & M2_ORC) ? "orcs"
: (context.warntype.obj & M2_ELF) ? "elves"
: (context.warntype.obj & M2_DEMON) ? "demons" : something);
(g.context.warntype.obj & M2_ORC) ? "orcs"
: (g.context.warntype.obj & M2_ELF) ? "elves"
: (g.context.warntype.obj & M2_DEMON) ? "demons" : something);
you_are(buf, from_what(WARN_OF_MON));
}
if (Warn_of_mon && context.warntype.polyd) {
if (Warn_of_mon && g.context.warntype.polyd) {
Sprintf(buf, "aware of the presence of %s",
((context.warntype.polyd & (M2_HUMAN | M2_ELF))
((g.context.warntype.polyd & (M2_HUMAN | M2_ELF))
== (M2_HUMAN | M2_ELF))
? "humans and elves"
: (context.warntype.polyd & M2_HUMAN)
: (g.context.warntype.polyd & M2_HUMAN)
? "humans"
: (context.warntype.polyd & M2_ELF)
: (g.context.warntype.polyd & M2_ELF)
? "elves"
: (context.warntype.polyd & M2_ORC)
: (g.context.warntype.polyd & M2_ORC)
? "orcs"
: (context.warntype.polyd & M2_DEMON)
: (g.context.warntype.polyd & M2_DEMON)
? "demons"
: "certain monsters");
you_are(buf, "");
}
if (Warn_of_mon && context.warntype.speciesidx >= LOW_PM) {
if (Warn_of_mon && g.context.warntype.speciesidx >= LOW_PM) {
Sprintf(buf, "aware of the presence of %s",
makeplural(mons[context.warntype.speciesidx].mname));
makeplural(mons[g.context.warntype.speciesidx].mname));
you_are(buf, from_what(WARN_OF_MON));
}
if (Undead_warning)
@@ -4479,11 +4479,11 @@ register char *cmd;
end_of_input();
#endif
if (firsttime) {
context.nopick = 0;
g.context.nopick = 0;
cmd = parse();
}
if (*cmd == g.Cmd.spkeys[NHKF_ESC]) {
context.move = FALSE;
g.context.move = FALSE;
return;
}
if (*cmd == DOAGAIN && !g.in_doagain && g.saveq[0]) {
@@ -4496,19 +4496,19 @@ register char *cmd;
/* Special case of *cmd == ' ' handled better below */
if (!*cmd || *cmd == (char) 0377) {
nhbell();
context.move = FALSE;
g.context.move = FALSE;
return; /* probably we just had an interrupt */
}
/* handle most movement commands */
do_walk = do_rush = prefix_seen = FALSE;
context.travel = context.travel1 = 0;
g.context.travel = g.context.travel1 = 0;
spkey = ch2spkeys(*cmd, NHKF_RUN, NHKF_CLICKLOOK);
switch (spkey) {
case NHKF_RUSH:
if (movecmd(cmd[1])) {
context.run = 2;
g.context.run = 2;
do_rush = TRUE;
} else
prefix_seen = TRUE;
@@ -4519,7 +4519,7 @@ register char *cmd;
/*FALLTHRU*/
case NHKF_RUN:
if (movecmd(lowc(cmd[1]))) {
context.run = 3;
g.context.run = 3;
do_rush = TRUE;
} else
prefix_seen = TRUE;
@@ -4535,15 +4535,15 @@ register char *cmd;
*/
case NHKF_FIGHT:
if (movecmd(cmd[1])) {
context.forcefight = 1;
g.context.forcefight = 1;
do_walk = TRUE;
} else
prefix_seen = TRUE;
break;
case NHKF_NOPICKUP:
if (movecmd(cmd[1]) || u.dz) {
context.run = 0;
context.nopick = 1;
g.context.run = 0;
g.context.nopick = 1;
if (!u.dz)
do_walk = TRUE;
else
@@ -4553,8 +4553,8 @@ register char *cmd;
break;
case NHKF_RUN_NOPICKUP:
if (movecmd(lowc(cmd[1]))) {
context.run = 1;
context.nopick = 1;
g.context.run = 1;
g.context.nopick = 1;
do_rush = TRUE;
} else
prefix_seen = TRUE;
@@ -4563,34 +4563,34 @@ register char *cmd;
if (!g.Cmd.num_pad)
break;
(void) ddoinv(); /* a convenience borrowed from the PC */
context.move = FALSE;
g.context.move = FALSE;
g.multi = 0;
return;
case NHKF_CLICKLOOK:
if (iflags.clicklook) {
context.move = FALSE;
g.context.move = FALSE;
do_look(2, &g.clicklook_cc);
}
return;
case NHKF_TRAVEL:
if (flags.travelcmd) {
context.travel = 1;
context.travel1 = 1;
context.run = 8;
context.nopick = 1;
g.context.travel = 1;
g.context.travel1 = 1;
g.context.run = 8;
g.context.nopick = 1;
do_rush = TRUE;
break;
}
/*FALLTHRU*/
default:
if (movecmd(*cmd)) { /* ordinary movement */
context.run = 0; /* only matters here if it was 8 */
g.context.run = 0; /* only matters here if it was 8 */
do_walk = TRUE;
} else if (movecmd(g.Cmd.num_pad ? unmeta(*cmd) : lowc(*cmd))) {
context.run = 1;
g.context.run = 1;
do_rush = TRUE;
} else if (movecmd(unctrl(*cmd))) {
context.run = 3;
g.context.run = 3;
do_rush = TRUE;
}
break;
@@ -4609,25 +4609,25 @@ register char *cmd;
}
}
if ((do_walk || do_rush) && !context.travel && !dxdy_moveok()) {
if ((do_walk || do_rush) && !g.context.travel && !dxdy_moveok()) {
/* trying to move diagonally as a grid bug;
this used to be treated by movecmd() as not being
a movement attempt, but that didn't provide for any
feedback and led to strangeness if the key pressed
('u' in particular) was overloaded for num_pad use */
You_cant("get there from here...");
context.run = 0;
context.nopick = context.forcefight = FALSE;
context.move = context.mv = FALSE;
g.context.run = 0;
g.context.nopick = g.context.forcefight = FALSE;
g.context.move = g.context.mv = FALSE;
g.multi = 0;
return;
}
if (do_walk) {
if (g.multi)
context.mv = TRUE;
g.context.mv = TRUE;
domove();
context.forcefight = 0;
g.context.forcefight = 0;
return;
} else if (do_rush) {
if (firsttime) {
@@ -4635,7 +4635,7 @@ register char *cmd;
g.multi = max(COLNO, ROWNO);
u.last_str_turn = 0;
}
context.mv = TRUE;
g.context.mv = TRUE;
domove();
return;
} else if (prefix_seen && cmd[1] == g.Cmd.spkeys[NHKF_ESC]) {
@@ -4667,7 +4667,7 @@ register char *cmd;
res = (*func)(); /* perform the command */
}
if (!res) {
context.move = FALSE;
g.context.move = FALSE;
g.multi = 0;
}
return;
@@ -4688,7 +4688,7 @@ register char *cmd;
Norep("Unknown command '%s'.", expcmd);
}
/* didn't move */
context.move = FALSE;
g.context.move = FALSE;
g.multi = 0;
return;
}
@@ -5529,7 +5529,7 @@ parse()
iflags.in_parse = TRUE;
g.multi = 0;
context.move = 1;
g.context.move = 1;
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
#ifdef ALTMETA
+1 -1
View File
@@ -452,7 +452,7 @@ int xkill_flags, how;
#define mk_message(dest) (((dest & XKILL_NOMSG) != 0) ? (char *) 0 : "")
#define mk_corpse(dest) (((dest & XKILL_NOCORPSE) != 0) ? AD_DGST : AD_PHYS)
/* if monsters are moving, one of them caused the destruction */
if (context.mon_moving)
if (g.context.mon_moving)
monkilled(etmp->emon,
mk_message(xkill_flags), mk_corpse(xkill_flags));
else /* you caused it */
+1 -7
View File
@@ -13,12 +13,6 @@ int locknum = 0; /* max num of simultaneous users */
char *catmore = 0; /* default pager */
#endif
/*
* The following structure will be initialized at startup time with
* the level numbers of some "important" things in the game.
*/
const char quitchars[] = " \r\n\033";
const char vowels[] = "aeiouAEIOU";
const char ynchars[] = "yn";
@@ -48,7 +42,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 context_info context = DUMMY;
NEARDATA struct flag flags = DUMMY;
#ifdef SYSFLAGS
NEARDATA struct sysflag sysflags = DUMMY;
@@ -318,6 +311,7 @@ const struct instance_globals g_init = {
#endif /* MICRO || WIN32 */
DUMMY, /* youmonst */
NULL, /* invent */
DUMMY, /* context */
/* dig.c */
UNDEFINED_VALUE, /* did_dig_msg */
+57 -57
View File
@@ -239,7 +239,7 @@ STATIC_OVL int
dig(VOID_ARGS)
{
register struct rm *lev;
register xchar dpx = context.digging.pos.x, dpy = context.digging.pos.y;
register xchar dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y;
register boolean ispick = uwep && is_pick(uwep);
const char *verb = (!uwep || is_pick(uwep)) ? "dig into" : "chop through";
@@ -247,15 +247,15 @@ dig(VOID_ARGS)
/* perhaps a nymph stole your pick-axe while you were busy digging */
/* or perhaps you teleported away */
if (u.uswallow || !uwep || (!ispick && !is_axe(uwep))
|| !on_level(&context.digging.level, &u.uz)
|| ((context.digging.down ? (dpx != u.ux || dpy != u.uy)
|| !on_level(&g.context.digging.level, &u.uz)
|| ((g.context.digging.down ? (dpx != u.ux || dpy != u.uy)
: (distu(dpx, dpy) > 2))))
return 0;
if (context.digging.down) {
if (g.context.digging.down) {
if (!dig_check(BY_YOU, TRUE, u.ux, u.uy))
return 0;
} else { /* !context.digging.down */
} else { /* !g.context.digging.down */
if (IS_TREE(lev->typ) && !may_dig(dpx, dpy)
&& dig_typ(uwep, dpx, dpy) == DIGTYP_TREE) {
pline("This tree seems to be petrified.");
@@ -295,21 +295,21 @@ dig(VOID_ARGS)
return 0;
}
context.digging.effort +=
g.context.digging.effort +=
10 + rn2(5) + abon() + uwep->spe - greatest_erosion(uwep) + u.udaminc;
if (Race_if(PM_DWARF))
context.digging.effort *= 2;
if (context.digging.down) {
g.context.digging.effort *= 2;
if (g.context.digging.down) {
struct trap *ttmp = t_at(dpx, dpy);
if (context.digging.effort > 250 || (ttmp && ttmp->ttyp == HOLE)) {
if (g.context.digging.effort > 250 || (ttmp && ttmp->ttyp == HOLE)) {
(void) dighole(FALSE, FALSE, (coord *) 0);
(void) memset((genericptr_t) &context.digging, 0,
sizeof context.digging);
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof g.context.digging);
return 0; /* done with digging */
}
if (context.digging.effort <= 50
if (g.context.digging.effort <= 50
|| (ttmp && (ttmp->ttyp == TRAPDOOR || is_pit(ttmp->ttyp)))) {
return 1;
} else if (ttmp && (ttmp->ttyp == LANDMINE
@@ -318,8 +318,8 @@ dig(VOID_ARGS)
hero should have used #untrap first */
dotrap(ttmp, FORCETRAP);
/* restart completely from scratch if we resume digging */
(void) memset((genericptr_t) &context.digging, 0,
sizeof context.digging);
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof g.context.digging);
return 0;
} else if (ttmp && ttmp->ttyp == BEAR_TRAP && u.utrap) {
if (rnl(7) > (Fumbling ? 1 : 4)) {
@@ -341,7 +341,7 @@ dig(VOID_ARGS)
reset_utrap(TRUE); /* release from trap, maybe Lev or Fly */
}
/* we haven't made any progress toward a pit yet */
context.digging.effort = 0;
g.context.digging.effort = 0;
return 0;
}
@@ -352,13 +352,13 @@ dig(VOID_ARGS)
/* make pit at <u.ux,u.uy> */
if (dighole(TRUE, FALSE, (coord *) 0)) {
context.digging.level.dnum = 0;
context.digging.level.dlevel = -1;
g.context.digging.level.dnum = 0;
g.context.digging.level.dlevel = -1;
}
return 0;
}
if (context.digging.effort > 100) {
if (g.context.digging.effort > 100) {
const char *digtxt, *dmgtxt = (const char *) 0;
struct obj *obj;
boolean shopedge = *in_rooms(dpx, dpy, SHOPBASE);
@@ -434,7 +434,7 @@ dig(VOID_ARGS)
if (!does_block(dpx, dpy, &levl[dpx][dpy]))
unblock_point(dpx, dpy); /* vision: can see through */
feel_newsym(dpx, dpy);
if (digtxt && !context.digging.quiet)
if (digtxt && !g.context.digging.quiet)
pline1(digtxt); /* after newsym */
if (dmgtxt)
pay_for_damage(dmgtxt, FALSE);
@@ -460,10 +460,10 @@ dig(VOID_ARGS)
newsym(dpx, dpy);
}
cleanup:
context.digging.lastdigtime = g.moves;
context.digging.quiet = FALSE;
context.digging.level.dnum = 0;
context.digging.level.dlevel = -1;
g.context.digging.lastdigtime = g.moves;
g.context.digging.quiet = FALSE;
g.context.digging.level.dnum = 0;
g.context.digging.level.dlevel = -1;
return 0;
} else { /* not enough effort has been spent yet */
static const char *const d_target[6] = { "", "rock", "statue",
@@ -494,7 +494,7 @@ holetime()
{
if (g.occupation != dig || !*u.ushops)
return -1;
return ((250 - context.digging.effort) / 20);
return ((250 - g.context.digging.effort) / 20);
}
/* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */
@@ -1036,7 +1036,7 @@ struct obj *obj;
You("hit yourself with %s.", yname(uwep));
Sprintf(buf, "%s own %s", uhis(), OBJ_NAME(objects[obj->otyp]));
losehp(Maybe_Half_Phys(dam), buf, KILLED_BY);
context.botl = 1;
g.context.botl = 1;
return 1;
} else if (u.dz == 0) {
if (Stunned || (Confusion && !rn2(5)))
@@ -1115,32 +1115,32 @@ struct obj *obj;
"cutting the tree" };
g.did_dig_msg = FALSE;
context.digging.quiet = FALSE;
if (context.digging.pos.x != rx || context.digging.pos.y != ry
|| !on_level(&context.digging.level, &u.uz)
|| context.digging.down) {
g.context.digging.quiet = FALSE;
if (g.context.digging.pos.x != rx || g.context.digging.pos.y != ry
|| !on_level(&g.context.digging.level, &u.uz)
|| g.context.digging.down) {
if (flags.autodig && dig_target == DIGTYP_ROCK
&& !context.digging.down
&& context.digging.pos.x == u.ux
&& context.digging.pos.y == u.uy
&& (g.moves <= context.digging.lastdigtime + 2
&& g.moves >= context.digging.lastdigtime)) {
&& !g.context.digging.down
&& g.context.digging.pos.x == u.ux
&& g.context.digging.pos.y == u.uy
&& (g.moves <= g.context.digging.lastdigtime + 2
&& g.moves >= g.context.digging.lastdigtime)) {
/* avoid messages if repeated autodigging */
g.did_dig_msg = TRUE;
context.digging.quiet = TRUE;
g.context.digging.quiet = TRUE;
}
context.digging.down = context.digging.chew = FALSE;
context.digging.warned = FALSE;
context.digging.pos.x = rx;
context.digging.pos.y = ry;
assign_level(&context.digging.level, &u.uz);
context.digging.effort = 0;
if (!context.digging.quiet)
g.context.digging.down = g.context.digging.chew = FALSE;
g.context.digging.warned = FALSE;
g.context.digging.pos.x = rx;
g.context.digging.pos.y = ry;
assign_level(&g.context.digging.level, &u.uz);
g.context.digging.effort = 0;
if (!g.context.digging.quiet)
You("start %s.", d_action[dig_target]);
} else {
You("%s %s.", context.digging.chew ? "begin" : "continue",
You("%s %s.", g.context.digging.chew ? "begin" : "continue",
d_action[dig_target]);
context.digging.chew = FALSE;
g.context.digging.chew = FALSE;
}
set_occupation(dig, verbing, 0);
}
@@ -1168,16 +1168,16 @@ struct obj *obj;
surface(u.ux, u.uy));
u_wipe_engr(3);
} else {
if (context.digging.pos.x != u.ux || context.digging.pos.y != u.uy
|| !on_level(&context.digging.level, &u.uz)
|| !context.digging.down) {
context.digging.chew = FALSE;
context.digging.down = TRUE;
context.digging.warned = FALSE;
context.digging.pos.x = u.ux;
context.digging.pos.y = u.uy;
assign_level(&context.digging.level, &u.uz);
context.digging.effort = 0;
if (g.context.digging.pos.x != u.ux || g.context.digging.pos.y != u.uy
|| !on_level(&g.context.digging.level, &u.uz)
|| !g.context.digging.down) {
g.context.digging.chew = FALSE;
g.context.digging.down = TRUE;
g.context.digging.warned = FALSE;
g.context.digging.pos.x = u.ux;
g.context.digging.pos.y = u.uy;
assign_level(&g.context.digging.level, &u.uz);
g.context.digging.effort = 0;
You("start %s downward.", verbing);
if (*u.ushops)
shopdig(0);
@@ -1217,7 +1217,7 @@ boolean zap;
}
if (mtmp) {
if (zap || context.digging.warned) {
if (zap || g.context.digging.warned) {
verbalize("Halt, vandal! You're under arrest!");
(void) angry_guards(!!Deaf);
} else {
@@ -1232,7 +1232,7 @@ boolean zap;
else
str = "fountain";
verbalize("Hey, stop damaging that %s!", str);
context.digging.warned = TRUE;
g.context.digging.warned = TRUE;
}
if (is_digging())
stop_occupation();
@@ -1720,7 +1720,7 @@ coord *cc;
* criterium (within 2 steps of tethered hero's present location)
* it will find an arbitrary one rather than the one which used
* to be uball. Once 3.6.{0,1} save file compatibility is broken,
* we should add context.buriedball_oid and then we can find the
* we should add g.context.buriedball_oid and then we can find the
* actual former uball, which might be extra heavy or christened
* or not the one buried directly underneath the target spot.
*
+4 -4
View File
@@ -1241,7 +1241,7 @@ see_monsters()
newsym(mon->mx, mon->my);
if (mon->wormno)
see_wsegs(mon);
if (Warn_of_mon && (context.warntype.obj & mon->data->mflags2) != 0L)
if (Warn_of_mon && (g.context.warntype.obj & mon->data->mflags2) != 0L)
new_warn_obj_cnt++;
}
/*
@@ -1370,7 +1370,7 @@ docrt()
/* overlay with monsters */
see_monsters();
context.botlx = 1; /* force a redraw of the bottom line */
g.context.botlx = 1; /* force a redraw of the bottom line */
}
/* =========================================================================
@@ -1532,7 +1532,7 @@ cls()
return;
in_cls = TRUE;
display_nhwindow(WIN_MESSAGE, FALSE); /* flush messages */
context.botlx = 1; /* force update of botl window */
g.context.botlx = 1; /* force update of botl window */
clear_nhwindow(WIN_MAP); /* clear physical screen */
clear_glyph_buffer(); /* this is sort of an extra effort, but OK */
@@ -1579,7 +1579,7 @@ int cursor_on_u;
display_nhwindow(WIN_MAP, FALSE);
reset_glyph_bbox();
flushing = 0;
if (context.botl || context.botlx)
if (g.context.botl || g.context.botlx)
bot();
}
+7 -7
View File
@@ -608,7 +608,7 @@ register struct obj *obj;
You("drop %s.", doname(obj));
/* Ensure update when we drop gold objects */
if (obj->oclass == COIN_CLASS)
context.botl = 1;
g.context.botl = 1;
freeinv(obj);
hitfloor(obj, TRUE);
if (levhack)
@@ -631,7 +631,7 @@ register struct obj *obj;
{
/* Ensure update when we drop gold objects */
if (obj->oclass == COIN_CLASS)
context.botl = 1;
g.context.botl = 1;
freeinv(obj);
if (!u.uswallow) {
if (ship_object(obj, u.ux, u.uy, FALSE))
@@ -744,7 +744,7 @@ struct obj *obj;
*/
if (!obj->oerodeproof || !rn2(10)) {
/* if monsters aren't moving, assume player is responsible */
if (!context.mon_moving && !program_state.gameover)
if (!g.context.mon_moving && !program_state.gameover)
costly_alteration(obj, COST_DEGRD);
obj->otyp = WORM_TOOTH;
obj->oerodeproof = 0;
@@ -964,7 +964,7 @@ dodown()
return 1;
} else if (!trap || !is_hole(trap->ttyp)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
if (flags.autodig && !context.nopick && uwep && is_pick(uwep)) {
if (flags.autodig && !g.context.nopick && uwep && is_pick(uwep)) {
return use_pick_axe2(uwep);
} else {
You_cant("go down here.");
@@ -1247,7 +1247,7 @@ boolean at_stairs, falling, portal;
maybe_reset_pick();
reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */
iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination cache */
context.polearm.hitmon = (struct monst *) 0; /* polearm target */
g.context.polearm.hitmon = (struct monst *) 0; /* polearm target */
/* digging context is level-aware and can actually be resumed if
hero returns to the previous level without any intervening dig */
@@ -1874,7 +1874,7 @@ register int timex;
if (!Wounded_legs) {
ATEMP(A_DEX)--;
context.botl = 1;
g.context.botl = 1;
}
if (!Wounded_legs || (HWounded_legs & TIMEOUT))
@@ -1890,7 +1890,7 @@ int how; /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */
if (Wounded_legs) {
if (ATEMP(A_DEX) < 0) {
ATEMP(A_DEX)++;
context.botl = 1;
g.context.botl = 1;
}
/* when mounted, wounded legs applies to the steed;
+78 -78
View File
@@ -80,7 +80,7 @@ struct obj *obj;
long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
boolean on;
{
if (on ? g.initial_don : context.takeoff.cancelled_don)
if (on ? g.initial_don : g.context.takeoff.cancelled_don)
return;
if (!oldprop /* extrinsic stealth from something else */
@@ -114,7 +114,7 @@ struct obj *obj;
long oldprop; /* prop[].extrinsic, with obj->owornmask stripped by caller */
boolean on;
{
if (on ? g.initial_don : context.takeoff.cancelled_don)
if (on ? g.initial_don : g.context.takeoff.cancelled_don)
return;
if (!oldprop /* extrinsic displacement from something else */
@@ -203,14 +203,14 @@ Boots_off(VOID_ARGS)
int otyp = otmp->otyp;
long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
context.takeoff.mask &= ~W_ARMF;
g.context.takeoff.mask &= ~W_ARMF;
/* For levitation, float_down() returns if Levitation, so we
* must do a setworn() _before_ the levitation case.
*/
setworn((struct obj *) 0, W_ARMF);
switch (otyp) {
case SPEED_BOOTS:
if (!Very_fast && !context.takeoff.cancelled_don) {
if (!Very_fast && !g.context.takeoff.cancelled_don) {
makeknown(otyp);
You_feel("yourself slow down%s.", Fast ? " a bit" : "");
}
@@ -219,7 +219,7 @@ Boots_off(VOID_ARGS)
/* 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(g.youmonst.data)
&& !context.takeoff.cancelled_don
&& !g.context.takeoff.cancelled_don
/* avoid recursive call to lava_effects() */
&& !iflags.in_lava_effects) {
/* make boots known in case you survive the drowning */
@@ -236,7 +236,7 @@ Boots_off(VOID_ARGS)
break;
case LEVITATION_BOOTS:
if (!oldprop && !HLevitation && !(BLevitation & FROMOUTSIDE)
&& !context.takeoff.cancelled_don) {
&& !g.context.takeoff.cancelled_don) {
(void) float_down(0L, 0L);
makeknown(otyp);
} else {
@@ -252,7 +252,7 @@ Boots_off(VOID_ARGS)
default:
impossible(unknown_type, c_boots, otyp);
}
context.takeoff.cancelled_don = FALSE;
g.context.takeoff.cancelled_don = FALSE;
return 0;
}
@@ -316,7 +316,7 @@ Cloak_off(VOID_ARGS)
int otyp = otmp->otyp;
long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
context.takeoff.mask &= ~W_ARMC;
g.context.takeoff.mask &= ~W_ARMC;
/* For mummy wrapping, taking it off first resets `Invisible'. */
setworn((struct obj *) 0, W_ARMC);
switch (otyp) {
@@ -382,7 +382,7 @@ Helmet_on(VOID_ARGS)
* and the actual enchantment of the hat is irrelevant.
*/
ABON(A_CHA) += (Role_if(PM_WIZARD) ? 1 : -1);
context.botl = 1;
g.context.botl = 1;
makeknown(uarmh->otyp);
break;
case HELM_OF_OPPOSITE_ALIGNMENT:
@@ -404,7 +404,7 @@ Helmet_on(VOID_ARGS)
hcolor(NH_BLACK));
curse(uarmh);
}
context.botl = 1; /* reveal new alignment or INT & WIS */
g.context.botl = 1; /* reveal new alignment or INT & WIS */
if (Hallucination) {
pline("My brain hurts!"); /* Monty Python's Flying Circus */
} else if (uarmh && uarmh->otyp == DUNCE_CAP) {
@@ -427,7 +427,7 @@ Helmet_on(VOID_ARGS)
int
Helmet_off(VOID_ARGS)
{
context.takeoff.mask &= ~W_ARMH;
g.context.takeoff.mask &= ~W_ARMH;
switch (uarmh->otyp) {
case FEDORA:
@@ -438,12 +438,12 @@ Helmet_off(VOID_ARGS)
case ORCISH_HELM:
break;
case DUNCE_CAP:
context.botl = 1;
g.context.botl = 1;
break;
case CORNUTHAUM:
if (!context.takeoff.cancelled_don) {
if (!g.context.takeoff.cancelled_don) {
ABON(A_CHA) += (Role_if(PM_WIZARD) ? -1 : 1);
context.botl = 1;
g.context.botl = 1;
}
break;
case HELM_OF_TELEPATHY:
@@ -452,7 +452,7 @@ Helmet_off(VOID_ARGS)
see_monsters();
return 0;
case HELM_OF_BRILLIANCE:
if (!context.takeoff.cancelled_don)
if (!g.context.takeoff.cancelled_don)
adj_abon(uarmh, -uarmh->spe);
break;
case HELM_OF_OPPOSITE_ALIGNMENT:
@@ -465,7 +465,7 @@ Helmet_off(VOID_ARGS)
impossible(unknown_type, c_helmet, uarmh->otyp);
}
setworn((struct obj *) 0, W_ARMH);
context.takeoff.cancelled_don = FALSE;
g.context.takeoff.cancelled_don = FALSE;
return 0;
}
@@ -485,7 +485,7 @@ Gloves_on(VOID_ARGS)
break;
case GAUNTLETS_OF_POWER:
makeknown(uarmg->otyp);
context.botl = 1; /* taken care of in attrib.c */
g.context.botl = 1; /* taken care of in attrib.c */
break;
case GAUNTLETS_OF_DEXTERITY:
adj_abon(uarmg, uarmg->spe);
@@ -525,9 +525,9 @@ Gloves_off(VOID_ARGS)
{
long oldprop =
u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
boolean on_purpose = !context.mon_moving && !uarmg->in_use;
boolean on_purpose = !g.context.mon_moving && !uarmg->in_use;
context.takeoff.mask &= ~W_ARMG;
g.context.takeoff.mask &= ~W_ARMG;
switch (uarmg->otyp) {
case LEATHER_GLOVES:
@@ -538,17 +538,17 @@ Gloves_off(VOID_ARGS)
break;
case GAUNTLETS_OF_POWER:
makeknown(uarmg->otyp);
context.botl = 1; /* taken care of in attrib.c */
g.context.botl = 1; /* taken care of in attrib.c */
break;
case GAUNTLETS_OF_DEXTERITY:
if (!context.takeoff.cancelled_don)
if (!g.context.takeoff.cancelled_don)
adj_abon(uarmg, -uarmg->spe);
break;
default:
impossible(unknown_type, c_gloves, uarmg->otyp);
}
setworn((struct obj *) 0, W_ARMG);
context.takeoff.cancelled_don = FALSE;
g.context.takeoff.cancelled_don = FALSE;
(void) encumber_msg(); /* immediate feedback for GoP */
/* prevent wielding cockatrice when not wearing gloves */
@@ -588,7 +588,7 @@ Shield_on(VOID_ARGS)
int
Shield_off(VOID_ARGS)
{
context.takeoff.mask &= ~W_ARMS;
g.context.takeoff.mask &= ~W_ARMS;
/* no shield currently requires special handling when taken off, but we
keep this uncommented in case somebody adds a new one which does */
@@ -628,7 +628,7 @@ Shirt_on(VOID_ARGS)
int
Shirt_off(VOID_ARGS)
{
context.takeoff.mask &= ~W_ARMU;
g.context.takeoff.mask &= ~W_ARMU;
/* no shirt currently requires special handling when taken off, but we
keep this uncommented in case somebody adds a new one which does */
@@ -658,9 +658,9 @@ Armor_on(VOID_ARGS)
int
Armor_off(VOID_ARGS)
{
context.takeoff.mask &= ~W_ARM;
g.context.takeoff.mask &= ~W_ARM;
setworn((struct obj *) 0, W_ARM);
context.takeoff.cancelled_don = FALSE;
g.context.takeoff.cancelled_don = FALSE;
return 0;
}
@@ -670,9 +670,9 @@ Armor_off(VOID_ARGS)
int
Armor_gone()
{
context.takeoff.mask &= ~W_ARM;
g.context.takeoff.mask &= ~W_ARM;
setnotworn(uarm);
context.takeoff.cancelled_don = FALSE;
g.context.takeoff.cancelled_don = FALSE;
return 0;
}
@@ -711,7 +711,7 @@ Amulet_on()
makeknown(AMULET_OF_CHANGE);
You("are suddenly very %s!",
flags.female ? "feminine" : "masculine");
context.botl = 1;
g.context.botl = 1;
} else
/* already polymorphed into single-gender monster; only
changed the character's base sex */
@@ -728,7 +728,7 @@ Amulet_on()
if (can_be_strangled(&g.youmonst)) {
makeknown(AMULET_OF_STRANGULATION);
Strangled = 6L;
context.botl = TRUE;
g.context.botl = TRUE;
pline("It constricts your throat!");
}
break;
@@ -748,7 +748,7 @@ Amulet_on()
void
Amulet_off()
{
context.takeoff.mask &= ~W_AMUL;
g.context.takeoff.mask &= ~W_AMUL;
switch (uamul->otyp) {
case AMULET_OF_ESP:
@@ -780,7 +780,7 @@ Amulet_off()
case AMULET_OF_STRANGULATION:
if (Strangled) {
Strangled = 0L;
context.botl = TRUE;
g.context.botl = TRUE;
if (Breathless)
Your("%s is no longer constricted!", body_part(NECK));
else
@@ -927,7 +927,7 @@ register struct obj *obj;
already discovered, both handled by learnring()] */
if (observable || !extremeattr(which))
learnring(obj, observable);
context.botl = 1;
g.context.botl = 1;
break;
case RIN_INCREASE_ACCURACY: /* KMH */
u.uhitinc += obj->spe;
@@ -959,7 +959,7 @@ boolean gone;
int old_attrib, which;
boolean observable;
context.takeoff.mask &= ~mask;
g.context.takeoff.mask &= ~mask;
if (!(u.uprops[objects[obj->otyp].oc_oprop].extrinsic & mask))
impossible("Strange... I didn't know you had that ring.");
if (gone)
@@ -1037,7 +1037,7 @@ boolean gone;
/* same criteria as Ring_on() */
if (observable || !extremeattr(which))
learnring(obj, observable);
context.botl = 1;
g.context.botl = 1;
break;
case RIN_INCREASE_ACCURACY: /* KMH */
u.uhitinc -= obj->spe;
@@ -1122,7 +1122,7 @@ register struct obj *otmp;
impossible("Blindf_off without otmp");
return;
}
context.takeoff.mask &= ~W_TOOL;
g.context.takeoff.mask &= ~W_TOOL;
setworn((struct obj *) 0, otmp->owornmask);
off_msg(otmp);
@@ -1221,7 +1221,7 @@ boolean
doffing(otmp)
struct obj *otmp;
{
long what = context.takeoff.what;
long what = g.context.takeoff.what;
boolean result = FALSE;
/* 'T' (or 'R' used for armor) sets afternmv, 'A' sets takeoff.what */
@@ -1274,9 +1274,9 @@ long slotmask;
* matter whether cancel_don() gets called here--the item has already
* been removed by now.]
*/
if (!(context.takeoff.mask & I_SPECIAL) && donning(obj))
if (!(g.context.takeoff.mask & I_SPECIAL) && donning(obj))
cancel_don(); /* applies to doffing too */
context.takeoff.mask &= ~slotmask;
g.context.takeoff.mask &= ~slotmask;
}
/* despite their names, cancel_don() and cancel_doff() both apply to both
@@ -1288,14 +1288,14 @@ cancel_don()
* wasting time on it (and don't dereference it when donning would
* otherwise finish)
*/
context.takeoff.cancelled_don =
g.context.takeoff.cancelled_don =
(g.afternmv == Boots_on || g.afternmv == Helmet_on
|| g.afternmv == Gloves_on || g.afternmv == Armor_on);
g.afternmv = (int NDECL((*))) 0;
g.nomovemsg = (char *) 0;
g.multi = 0;
context.takeoff.delay = 0;
context.takeoff.what = 0L;
g.context.takeoff.delay = 0;
g.context.takeoff.what = 0L;
}
/* called by steal() during theft from hero; interrupt donning/doffing */
@@ -1420,11 +1420,11 @@ struct obj *obj;
return 0;
}
reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
reset_remarm(); /* clear g.context.takeoff.mask and g.context.takeoff.what */
(void) select_off(obj);
if (!context.takeoff.mask)
if (!g.context.takeoff.mask)
return 0;
/* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */
/* none of armoroff()/Ring_/Amulet/Blindf_off() use g.context.takeoff.mask */
reset_remarm();
if (obj->owornmask & W_ARMOR) {
@@ -1570,7 +1570,7 @@ register struct obj *otmp;
setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
off_msg(otmp);
}
context.takeoff.mask = context.takeoff.what = 0L;
g.context.takeoff.mask = g.context.takeoff.what = 0L;
return 1;
}
@@ -1798,7 +1798,7 @@ struct obj *obj;
You("are suddenly overcome with shame and change your mind.");
u.ublessed = 0; /* lose your god's protection */
makeknown(obj->otyp);
context.botl = 1; /*for AC after zeroing u.ublessed */
g.context.botl = 1; /*for AC after zeroing u.ublessed */
return 1;
}
} else {
@@ -1925,7 +1925,7 @@ struct obj *obj;
(void) Shirt_on();
on_msg(obj);
}
context.takeoff.mask = context.takeoff.what = 0L;
g.context.takeoff.mask = g.context.takeoff.what = 0L;
} else { /* not armor */
boolean give_feedback = FALSE;
@@ -2035,7 +2035,7 @@ find_ac()
if (uac != u.uac) {
u.uac = uac;
context.botl = 1;
g.context.botl = 1;
}
}
@@ -2279,33 +2279,33 @@ register struct obj *otmp;
}
if (otmp == uarm)
context.takeoff.mask |= WORN_ARMOR;
g.context.takeoff.mask |= WORN_ARMOR;
else if (otmp == uarmc)
context.takeoff.mask |= WORN_CLOAK;
g.context.takeoff.mask |= WORN_CLOAK;
else if (otmp == uarmf)
context.takeoff.mask |= WORN_BOOTS;
g.context.takeoff.mask |= WORN_BOOTS;
else if (otmp == uarmg)
context.takeoff.mask |= WORN_GLOVES;
g.context.takeoff.mask |= WORN_GLOVES;
else if (otmp == uarmh)
context.takeoff.mask |= WORN_HELMET;
g.context.takeoff.mask |= WORN_HELMET;
else if (otmp == uarms)
context.takeoff.mask |= WORN_SHIELD;
g.context.takeoff.mask |= WORN_SHIELD;
else if (otmp == uarmu)
context.takeoff.mask |= WORN_SHIRT;
g.context.takeoff.mask |= WORN_SHIRT;
else if (otmp == uleft)
context.takeoff.mask |= LEFT_RING;
g.context.takeoff.mask |= LEFT_RING;
else if (otmp == uright)
context.takeoff.mask |= RIGHT_RING;
g.context.takeoff.mask |= RIGHT_RING;
else if (otmp == uamul)
context.takeoff.mask |= WORN_AMUL;
g.context.takeoff.mask |= WORN_AMUL;
else if (otmp == ublindf)
context.takeoff.mask |= WORN_BLINDF;
g.context.takeoff.mask |= WORN_BLINDF;
else if (otmp == uwep)
context.takeoff.mask |= W_WEP;
g.context.takeoff.mask |= W_WEP;
else if (otmp == uswapwep)
context.takeoff.mask |= W_SWAPWEP;
g.context.takeoff.mask |= W_SWAPWEP;
else if (otmp == uquiver)
context.takeoff.mask |= W_QUIVER;
g.context.takeoff.mask |= W_QUIVER;
else
impossible("select_off: %s???", doname(otmp));
@@ -2317,9 +2317,9 @@ STATIC_OVL struct obj *
do_takeoff()
{
struct obj *otmp = (struct obj *) 0;
struct takeoff_info *doff = &context.takeoff;
struct takeoff_info *doff = &g.context.takeoff;
context.takeoff.mask |= I_SPECIAL; /* set flag for cancel_doff() */
g.context.takeoff.mask |= I_SPECIAL; /* set flag for cancel_doff() */
if (doff->what == W_WEP) {
if (!cursed(uwep)) {
setuwep((struct obj *) 0);
@@ -2379,7 +2379,7 @@ do_takeoff()
} else {
impossible("do_takeoff: taking off %lx", doff->what);
}
context.takeoff.mask &= ~I_SPECIAL; /* clear cancel_doff() flag */
g.context.takeoff.mask &= ~I_SPECIAL; /* clear cancel_doff() flag */
return otmp;
}
@@ -2391,7 +2391,7 @@ take_off(VOID_ARGS)
{
register int i;
register struct obj *otmp;
struct takeoff_info *doff = &context.takeoff;
struct takeoff_info *doff = &g.context.takeoff;
if (doff->what) {
if (doff->delay > 0) {
@@ -2480,8 +2480,8 @@ take_off(VOID_ARGS)
void
reset_remarm()
{
context.takeoff.what = context.takeoff.mask = 0L;
context.takeoff.disrobing[0] = '\0';
g.context.takeoff.what = g.context.takeoff.mask = 0L;
g.context.takeoff.disrobing[0] = '\0';
}
/* the 'A' command -- remove multiple worn items */
@@ -2490,9 +2490,9 @@ doddoremarm()
{
int result = 0;
if (context.takeoff.what || context.takeoff.mask) {
You("continue %s.", context.takeoff.disrobing);
set_occupation(take_off, context.takeoff.disrobing, 0);
if (g.context.takeoff.what || g.context.takeoff.mask) {
You("continue %s.", g.context.takeoff.disrobing);
set_occupation(take_off, g.context.takeoff.disrobing, 0);
return 0;
} else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf && !uleft
&& !uright && !wearing_armor()) {
@@ -2506,13 +2506,13 @@ doddoremarm()
(unsigned *) 0)) < -1)
result = menu_remarm(result);
if (context.takeoff.mask) {
if (g.context.takeoff.mask) {
/* default activity for armor and/or accessories,
possibly combined with weapons */
(void) strncpy(context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ);
(void) strncpy(g.context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ);
/* specific activity when handling weapons only */
if (!(context.takeoff.mask & ~W_WEAPON))
(void) strncpy(context.takeoff.disrobing, "disarming",
if (!(g.context.takeoff.mask & ~W_WEAPON))
(void) strncpy(g.context.takeoff.disrobing, "disarming",
CONTEXTVERBSZ);
(void) take_off();
}
@@ -2649,7 +2649,7 @@ register schar delta;
makeknown(uarmg->otyp);
ABON(A_DEX) += (delta);
}
context.botl = 1;
g.context.botl = 1;
}
if (uarmh && uarmh == otmp && otmp->otyp == HELM_OF_BRILLIANCE) {
if (delta) {
@@ -2657,7 +2657,7 @@ register schar delta;
ABON(A_INT) += (delta);
ABON(A_WIS) += (delta);
}
context.botl = 1;
g.context.botl = 1;
}
}
+3 -3
View File
@@ -190,7 +190,7 @@ makedog()
if (!mtmp)
return ((struct monst *) 0); /* pets were genocided */
context.startingpet_mid = mtmp->m_id;
g.context.startingpet_mid = mtmp->m_id;
/* Horses already wear a saddle */
if (pettype == PM_PONY && !!(otmp = mksobj(SADDLE, TRUE, FALSE))) {
otmp->dknown = otmp->bknown = otmp->rknown = 1;
@@ -728,8 +728,8 @@ coord *cc; /* optional destination coordinates */
mtmp->mux = new_lev.dnum;
mtmp->muy = new_lev.dlevel;
mtmp->mx = mtmp->my = 0; /* this implies migration */
if (mtmp == context.polearm.hitmon)
context.polearm.hitmon = (struct monst *) 0;
if (mtmp == g.context.polearm.hitmon)
g.context.polearm.hitmon = (struct monst *) 0;
}
/* return quality of food; the lower the better */
+6 -6
View File
@@ -126,18 +126,18 @@ struct monst *mon;
xchar x, y;
{
if (mon) {
boolean save_forcefight = context.forcefight;
boolean save_forcefight = g.context.forcefight;
g.bhitpos.x = x;
g.bhitpos.y = y;
if (!mon->mpeaceful || !canspotmon(mon))
context.forcefight = TRUE; /* attack even if invisible */
g.context.forcefight = TRUE; /* attack even if invisible */
/* kicking might be halted by discovery of hidden monster,
by player declining to attack peaceful monster,
or by passing out due to encumbrance */
if (attack_checks(mon, (struct obj *) 0) || overexertion())
mon = 0; /* don't kick after all */
context.forcefight = save_forcefight;
g.context.forcefight = save_forcefight;
}
return (boolean) (mon != 0);
}
@@ -872,12 +872,12 @@ dokick()
mtmp = isok(x, y) ? m_at(x, y) : 0;
/* might not kick monster if it is hidden and becomes revealed,
if it is peaceful and player declines to attack, or if the
hero passes out due to encumbrance with low hp; context.move
hero passes out due to encumbrance with low hp; g.context.move
will be 1 unless player declines to kick peaceful monster */
if (mtmp) {
oldglyph = glyph_at(x, y);
if (!maybe_kick_monster(mtmp, x, y))
return context.move;
return g.context.move;
}
wake_nearby();
@@ -924,7 +924,7 @@ dokick()
map_invisible(x, y);
}
/* recoil if floating */
if ((Is_airlevel(&u.uz) || Levitation) && context.move) {
if ((Is_airlevel(&u.uz) || Levitation) && g.context.move) {
int range;
range =
+3 -3
View File
@@ -49,8 +49,8 @@ int shotlimit;
* been split from there (possibly triggering a panic in addinv),
* and freeinv+addinv potentially has other side-effects.
*/
if (obj->o_id == context.objsplit.parent_oid
|| obj->o_id == context.objsplit.child_oid)
if (obj->o_id == g.context.objsplit.parent_oid
|| obj->o_id == g.context.objsplit.child_oid)
(void) unsplitobj(obj);
return 0; /* no time passes */
}
@@ -404,7 +404,7 @@ endmultishot(verbose)
boolean verbose;
{
if (g.m_shot.i < g.m_shot.n) {
if (verbose && !context.mon_moving) {
if (verbose && !g.context.mon_moving) {
You("stop %s after the %d%s %s.",
g.m_shot.s ? "firing" : "throwing", g.m_shot.i, ordin(g.m_shot.i),
g.m_shot.s ? "shot" : "toss");
+151 -151
View File
@@ -111,7 +111,7 @@ register struct obj *obj;
void
init_uhunger()
{
context.botl = (u.uhs != NOT_HUNGRY || ATEMP(A_STR) < 0);
g.context.botl = (u.uhs != NOT_HUNGRY || ATEMP(A_STR) < 0);
u.uhunger = 900;
u.uhs = NOT_HUNGRY;
if (ATEMP(A_STR) < 0) {
@@ -279,14 +279,14 @@ struct obj *food;
STATIC_OVL void
recalc_wt()
{
struct obj *piece = context.victual.piece;
struct obj *piece = g.context.victual.piece;
if (!piece) {
impossible("recalc_wt without piece");
return;
}
debugpline1("Old weight = %d", piece->owt);
debugpline2("Used time = %d, Req'd time = %d", context.victual.usedtime,
context.victual.reqtime);
debugpline2("Used time = %d, Req'd time = %d", g.context.victual.usedtime,
g.context.victual.reqtime);
piece->owt = weight(piece);
debugpline1("New weight = %d", piece->owt);
}
@@ -298,9 +298,9 @@ reset_eat()
/* we only set a flag here - the actual reset process is done after
* the round is spent eating.
*/
if (context.victual.eating && !context.victual.doreset) {
if (g.context.victual.eating && !g.context.victual.doreset) {
debugpline0("reset_eat...");
context.victual.doreset = TRUE;
g.context.victual.doreset = TRUE;
}
return;
}
@@ -372,9 +372,9 @@ void
food_disappears(obj)
struct obj *obj;
{
if (obj == context.victual.piece) {
context.victual.piece = (struct obj *) 0;
context.victual.o_id = 0;
if (obj == g.context.victual.piece) {
g.context.victual.piece = (struct obj *) 0;
g.context.victual.o_id = 0;
}
if (obj->timed)
obj_stop_timers(obj);
@@ -387,13 +387,13 @@ void
food_substitution(old_obj, new_obj)
struct obj *old_obj, *new_obj;
{
if (old_obj == context.victual.piece) {
context.victual.piece = new_obj;
context.victual.o_id = new_obj->o_id;
if (old_obj == g.context.victual.piece) {
g.context.victual.piece = new_obj;
g.context.victual.o_id = new_obj->o_id;
}
if (old_obj == context.tin.tin) {
context.tin.tin = new_obj;
context.tin.o_id = new_obj->o_id;
if (old_obj == g.context.tin.tin) {
g.context.tin.tin = new_obj;
g.context.tin.o_id = new_obj->o_id;
}
}
@@ -401,15 +401,15 @@ STATIC_OVL void
do_reset_eat()
{
debugpline0("do_reset_eat...");
if (context.victual.piece) {
context.victual.o_id = 0;
context.victual.piece = touchfood(context.victual.piece);
if (context.victual.piece)
context.victual.o_id = context.victual.piece->o_id;
if (g.context.victual.piece) {
g.context.victual.o_id = 0;
g.context.victual.piece = touchfood(g.context.victual.piece);
if (g.context.victual.piece)
g.context.victual.o_id = g.context.victual.piece->o_id;
recalc_wt();
}
context.victual.fullwarn = context.victual.eating =
context.victual.doreset = FALSE;
g.context.victual.fullwarn = g.context.victual.eating =
g.context.victual.doreset = FALSE;
/* Do not set canchoke to FALSE; if we continue eating the same object
* we need to know if canchoke was set when they started eating it the
* previous time. And if we don't continue eating the same object
@@ -423,17 +423,17 @@ do_reset_eat()
STATIC_PTR int
eatfood(VOID_ARGS)
{
if (!context.victual.piece
|| (!carried(context.victual.piece)
&& !obj_here(context.victual.piece, u.ux, u.uy))) {
if (!g.context.victual.piece
|| (!carried(g.context.victual.piece)
&& !obj_here(g.context.victual.piece, u.ux, u.uy))) {
/* maybe it was stolen? */
do_reset_eat();
return 0;
}
if (!context.victual.eating)
if (!g.context.victual.eating)
return 0;
if (++context.victual.usedtime <= context.victual.reqtime) {
if (++g.context.victual.usedtime <= g.context.victual.reqtime) {
if (bite())
return 0;
return 1; /* still busy */
@@ -447,7 +447,7 @@ STATIC_OVL void
done_eating(message)
boolean message;
{
struct obj *piece = context.victual.piece;
struct obj *piece = g.context.victual.piece;
piece->in_use = TRUE;
g.occupation = 0; /* do this early, so newuhs() knows we're done */
@@ -468,10 +468,10 @@ boolean message;
useup(piece);
else
useupf(piece, 1L);
context.victual.piece = (struct obj *) 0;
context.victual.o_id = 0;
context.victual.fullwarn = context.victual.eating =
context.victual.doreset = FALSE;
g.context.victual.piece = (struct obj *) 0;
g.context.victual.o_id = 0;
g.context.victual.fullwarn = g.context.victual.eating =
g.context.victual.doreset = FALSE;
}
void
@@ -559,7 +559,7 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
ABASE(A_INT) += rnd(4);
if (ABASE(A_INT) > AMAX(A_INT))
ABASE(A_INT) = AMAX(A_INT);
context.botl = 1;
g.context.botl = 1;
}
exercise(A_WIS, TRUE);
*dmg_p += xtra_dmg;
@@ -680,8 +680,8 @@ register int pm;
g.killer.format = KILLED_BY;
You("turn to stone.");
done(STONING);
if (context.victual.piece)
context.victual.eating = FALSE;
if (g.context.victual.piece)
g.context.victual.eating = FALSE;
return; /* lifesaved */
}
}
@@ -713,11 +713,11 @@ register int pm;
/* life-saving needed to reach here */
exercise(A_WIS, FALSE);
/* It so happens that since we know these monsters */
/* cannot appear in tins, context.victual.piece will always */
/* cannot appear in tins, g.context.victual.piece will always */
/* be what we want, which is not generally true. */
if (revive_corpse(context.victual.piece)) {
context.victual.piece = (struct obj *) 0;
context.victual.o_id = 0;
if (revive_corpse(g.context.victual.piece)) {
g.context.victual.piece = (struct obj *) 0;
g.context.victual.o_id = 0;
}
return;
}
@@ -962,7 +962,7 @@ int pm;
}
if (old_uen != u.uen) {
You_feel("a mild buzz.");
context.botl = 1;
g.context.botl = 1;
}
}
break;
@@ -984,7 +984,7 @@ int pm;
else
u.uhp = u.uhpmax;
make_blinded(0L, !u.ucreamed);
context.botl = 1;
g.context.botl = 1;
check_intrinsics = TRUE; /* might also convey poison resistance */
break;
case PM_STALKER:
@@ -1160,19 +1160,19 @@ violated_vegetarian()
return;
}
/* common code to check and possibly charge for 1 context.tin.tin,
* will split() context.tin.tin if necessary */
/* common code to check and possibly charge for 1 g.context.tin.tin,
* will split() g.context.tin.tin if necessary */
STATIC_PTR struct obj *
costly_tin(alter_type)
int alter_type; /* COST_xxx */
{
struct obj *tin = context.tin.tin;
struct obj *tin = g.context.tin.tin;
if (carried(tin) ? tin->unpaid
: (costly_spot(tin->ox, tin->oy) && !tin->no_charge)) {
if (tin->quan > 1L) {
tin = context.tin.tin = splitobj(tin, 1L);
context.tin.o_id = tin->o_id;
tin = g.context.tin.tin = splitobj(tin, 1L);
g.context.tin.o_id = tin->o_id;
}
costly_alteration(tin, alter_type);
}
@@ -1299,7 +1299,7 @@ const char *mesg;
{
const char *what;
int which, mnum, r;
struct obj *tin = context.tin.tin;
struct obj *tin = g.context.tin.tin;
r = tin_variety(tin, FALSE);
if (tin->otrapped || (tin->cursed && r != HOMEMADE_TIN && !rn2(8))) {
@@ -1349,10 +1349,10 @@ const char *mesg;
}
/* in case stop_occupation() was called on previous meal */
context.victual.piece = (struct obj *) 0;
context.victual.o_id = 0;
context.victual.fullwarn = context.victual.eating =
context.victual.doreset = FALSE;
g.context.victual.piece = (struct obj *) 0;
g.context.victual.o_id = 0;
g.context.victual.fullwarn = g.context.victual.eating =
g.context.victual.doreset = FALSE;
You("consume %s %s.", tintxts[r].txt, mons[mnum].mname);
@@ -1426,8 +1426,8 @@ use_up_tin:
useup(tin);
else
useupf(tin, 1L);
context.tin.tin = (struct obj *) 0;
context.tin.o_id = 0;
g.context.tin.tin = (struct obj *) 0;
g.context.tin.o_id = 0;
}
/* called during each move whilst opening a tin */
@@ -1435,14 +1435,14 @@ STATIC_PTR int
opentin(VOID_ARGS)
{
/* perhaps it was stolen (although that should cause interruption) */
if (!carried(context.tin.tin)
&& (!obj_here(context.tin.tin, u.ux, u.uy) || !can_reach_floor(TRUE)))
if (!carried(g.context.tin.tin)
&& (!obj_here(g.context.tin.tin, u.ux, u.uy) || !can_reach_floor(TRUE)))
return 0; /* %% probably we should use tinoid */
if (context.tin.usedtime++ >= 50) {
if (g.context.tin.usedtime++ >= 50) {
You("give up your attempt to open the tin.");
return 0;
}
if (context.tin.usedtime < context.tin.reqtime)
if (g.context.tin.usedtime < g.context.tin.reqtime)
return 1; /* still busy */
consume_tin("You succeed in opening the tin.");
@@ -1516,13 +1516,13 @@ struct obj *otmp;
tmp = rn1(1 + 500 / ((int) (ACURR(A_DEX) + ACURRSTR)), 10);
}
context.tin.tin = otmp;
context.tin.o_id = otmp->o_id;
g.context.tin.tin = otmp;
g.context.tin.o_id = otmp->o_id;
if (!tmp) {
consume_tin(mesg); /* begin immediately */
} else {
context.tin.reqtime = tmp;
context.tin.usedtime = 0;
g.context.tin.reqtime = tmp;
g.context.tin.usedtime = 0;
set_occupation(opentin, "opening the tin", 0);
}
return;
@@ -1535,7 +1535,7 @@ Hear_again(VOID_ARGS)
/* Chance of deafness going away while fainted/sleeping/etc. */
if (!rn2(2)) {
make_deaf(0L, FALSE);
context.botl = TRUE;
g.context.botl = TRUE;
}
return 0;
}
@@ -1572,7 +1572,7 @@ struct obj *obj;
where = (u.usteed) ? "saddle" : surface(u.ux, u.uy);
pline_The("world spins and %s %s.", what, where);
incr_itimeout(&HDeaf, duration);
context.botl = TRUE;
g.context.botl = TRUE;
nomul(-duration);
g.multi_reason = "unconscious from rotten food";
g.nomovemsg = "You are conscious again.";
@@ -1661,7 +1661,7 @@ struct obj *otmp;
}
/* delay is weight dependent */
context.victual.reqtime = 3 + ((!glob ? mons[mnum].cwt : otmp->owt) >> 6);
g.context.victual.reqtime = 3 + ((!glob ? mons[mnum].cwt : otmp->owt) >> 6);
if (!tp && !nonrotting_corpse(mnum) && (otmp->orotten || !rn2(7))) {
if (rottenfood(otmp)) {
@@ -1734,17 +1734,17 @@ struct obj *otmp;
several such so we don't need to copy the first result
before calling it a second time */
fmt_ptr((genericptr_t) otmp),
fmt_ptr((genericptr_t) context.victual.piece));
debugpline1("reqtime = %d", context.victual.reqtime);
fmt_ptr((genericptr_t) g.context.victual.piece));
debugpline1("reqtime = %d", g.context.victual.reqtime);
debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
debugpline1("nmod = %d", context.victual.nmod);
debugpline1("nmod = %d", g.context.victual.nmod);
debugpline1("oeaten = %d", otmp->oeaten);
context.victual.fullwarn = context.victual.doreset = FALSE;
context.victual.eating = TRUE;
g.context.victual.fullwarn = g.context.victual.doreset = FALSE;
g.context.victual.eating = TRUE;
if (otmp->otyp == CORPSE || otmp->globby) {
cprefx(context.victual.piece->corpsenm);
if (!context.victual.piece || !context.victual.eating) {
cprefx(g.context.victual.piece->corpsenm);
if (!g.context.victual.piece || !g.context.victual.eating) {
/* rider revived, or died and lifesaved */
return;
}
@@ -1754,7 +1754,7 @@ struct obj *otmp;
if (bite()) {
/* survived choking, finish off food that's nearly done;
need this to handle cockatrice eggs, fortune cookies, etc */
if (++context.victual.usedtime >= context.victual.reqtime) {
if (++g.context.victual.usedtime >= g.context.victual.reqtime) {
/* don't want done_eating() to issue g.nomovemsg if it
is due to vomit() called by bite() */
save_nomovemsg = g.nomovemsg;
@@ -1767,9 +1767,9 @@ struct obj *otmp;
return;
}
if (++context.victual.usedtime >= context.victual.reqtime) {
if (++g.context.victual.usedtime >= g.context.victual.reqtime) {
/* print "finish eating" message if they just resumed -dlc */
done_eating(context.victual.reqtime > 1 ? TRUE : FALSE);
done_eating(g.context.victual.reqtime > 1 ? TRUE : FALSE);
return;
}
@@ -1806,7 +1806,7 @@ struct obj *otmp;
/* not cannibalism, but we use similar criteria
for deciding whether to be sickened by this meal */
if (rn2(2) && !CANNIBAL_ALLOWED())
make_vomiting((long) rn1(context.victual.reqtime, 14), FALSE);
make_vomiting((long) rn1(g.context.victual.reqtime, 14), FALSE);
}
break;
case LEMBAS_WAFER:
@@ -1825,13 +1825,13 @@ struct obj *otmp;
goto give_feedback;
case CLOVE_OF_GARLIC:
if (is_undead(g.youmonst.data)) {
make_vomiting((long) rn1(context.victual.reqtime, 5), FALSE);
make_vomiting((long) rn1(g.context.victual.reqtime, 5), FALSE);
break;
}
/*FALLTHRU*/
default:
if (otmp->otyp == SLIME_MOLD && !otmp->cursed
&& otmp->spe == context.current_fruit) {
&& otmp->spe == g.context.current_fruit) {
pline("My, that was a %s %s!",
Hallucination ? "primo" : "yummy",
singular(otmp, xname));
@@ -2024,7 +2024,7 @@ struct obj *otmp;
HProtection |= FROMOUTSIDE;
u.ublessed = bounded_increase(u.ublessed, otmp->spe,
RIN_PROTECTION);
context.botl = 1;
g.context.botl = 1;
break;
case RIN_FREE_ACTION:
/* Give sleep resistance instead */
@@ -2040,7 +2040,7 @@ struct obj *otmp;
change_sex();
You("are suddenly very %s!",
flags.female ? "feminine" : "masculine");
context.botl = 1;
g.context.botl = 1;
break;
case AMULET_OF_UNCHANGING:
/* un-change: it's a pun */
@@ -2080,15 +2080,15 @@ struct obj *otmp;
STATIC_OVL void
eatspecial()
{
struct obj *otmp = context.victual.piece;
struct obj *otmp = g.context.victual.piece;
/* lesshungry wants an occupation to handle choke messages correctly */
set_occupation(eatfood, "eating non-food", 0);
lesshungry(context.victual.nmod);
lesshungry(g.context.victual.nmod);
g.occupation = 0;
context.victual.piece = (struct obj *) 0;
context.victual.o_id = 0;
context.victual.eating = 0;
g.context.victual.piece = (struct obj *) 0;
g.context.victual.o_id = 0;
g.context.victual.eating = 0;
if (otmp->oclass == COIN_CLASS) {
if (carried(otmp))
useupall(otmp);
@@ -2526,12 +2526,12 @@ doeat()
if (otmp->oclass != FOOD_CLASS) {
int material;
context.victual.reqtime = 1;
context.victual.piece = otmp;
context.victual.o_id = otmp->o_id;
g.context.victual.reqtime = 1;
g.context.victual.piece = otmp;
g.context.victual.o_id = otmp->o_id;
/* Don't split it, we don't need to if it's 1 move */
context.victual.usedtime = 0;
context.victual.canchoke = (u.uhs == SATIATED);
g.context.victual.usedtime = 0;
g.context.victual.canchoke = (u.uhs == SATIATED);
/* Note: gold weighs 1 pt. for each 1000 pieces (see
pickup.c) so gold and non-gold is consistent. */
if (otmp->oclass == COIN_CLASS)
@@ -2549,8 +2549,8 @@ doeat()
nodelicious = TRUE;
}
#endif
context.victual.nmod = basenutrit;
context.victual.eating = TRUE; /* needed for lesshungry() */
g.context.victual.nmod = basenutrit;
g.context.victual.eating = TRUE; /* needed for lesshungry() */
material = objects[otmp->otyp].oc_material;
if (material == LEATHER || material == BONE
@@ -2588,20 +2588,20 @@ doeat()
return 1;
}
if (otmp == context.victual.piece) {
if (otmp == g.context.victual.piece) {
/* If they weren't able to choke, they don't suddenly become able to
* choke just because they were interrupted. On the other hand, if
* they were able to choke before, if they lost food it's possible
* they shouldn't be able to choke now.
*/
if (u.uhs != SATIATED)
context.victual.canchoke = FALSE;
context.victual.o_id = 0;
context.victual.piece = touchfood(otmp);
if (context.victual.piece)
context.victual.o_id = context.victual.piece->o_id;
g.context.victual.canchoke = FALSE;
g.context.victual.o_id = 0;
g.context.victual.piece = touchfood(otmp);
if (g.context.victual.piece)
g.context.victual.o_id = g.context.victual.piece->o_id;
You("resume your meal.");
start_eating(context.victual.piece);
start_eating(g.context.victual.piece);
return 1;
}
@@ -2616,11 +2616,11 @@ doeat()
/* KMH, conduct */
u.uconduct.food++;
context.victual.o_id = 0;
context.victual.piece = otmp = touchfood(otmp);
if (context.victual.piece)
context.victual.o_id = context.victual.piece->o_id;
context.victual.usedtime = 0;
g.context.victual.o_id = 0;
g.context.victual.piece = otmp = touchfood(otmp);
if (g.context.victual.piece)
g.context.victual.o_id = g.context.victual.piece->o_id;
g.context.victual.usedtime = 0;
/* Now we need to calculate delay and nutritional info.
* The base nutrition calculated here and in eatcorpse() accounts
@@ -2632,8 +2632,8 @@ doeat()
if (tmp == 2) {
/* used up */
context.victual.piece = (struct obj *) 0;
context.victual.o_id = 0;
g.context.victual.piece = (struct obj *) 0;
g.context.victual.o_id = 0;
return 1;
} else if (tmp)
dont_start = TRUE;
@@ -2658,7 +2658,7 @@ doeat()
break;
}
context.victual.reqtime = objects[otmp->otyp].oc_delay;
g.context.victual.reqtime = objects[otmp->otyp].oc_delay;
if (otmp->otyp != FORTUNE_COOKIE
&& (otmp->cursed || (!nonrotting_food(otmp->otyp)
&& (g.monstermoves - otmp->age)
@@ -2678,28 +2678,28 @@ doeat()
debugpline3(
"before rounddiv: victual.reqtime == %d, oeaten == %d, basenutrit == %d",
context.victual.reqtime, otmp->oeaten, basenutrit);
g.context.victual.reqtime, otmp->oeaten, basenutrit);
context.victual.reqtime = (basenutrit == 0) ? 0
: rounddiv(context.victual.reqtime * (long) otmp->oeaten, basenutrit);
g.context.victual.reqtime = (basenutrit == 0) ? 0
: rounddiv(g.context.victual.reqtime * (long) otmp->oeaten, basenutrit);
debugpline1("after rounddiv: victual.reqtime == %d",
context.victual.reqtime);
g.context.victual.reqtime);
/*
* calculate the modulo value (nutrit. units per round eating)
* note: this isn't exact - you actually lose a little nutrition due
* to this method.
* TODO: add in a "remainder" value to be given at the end of the meal.
*/
if (context.victual.reqtime == 0 || otmp->oeaten == 0)
if (g.context.victual.reqtime == 0 || otmp->oeaten == 0)
/* possible if most has been eaten before */
context.victual.nmod = 0;
else if ((int) otmp->oeaten >= context.victual.reqtime)
context.victual.nmod = -((int) otmp->oeaten
/ context.victual.reqtime);
g.context.victual.nmod = 0;
else if ((int) otmp->oeaten >= g.context.victual.reqtime)
g.context.victual.nmod = -((int) otmp->oeaten
/ g.context.victual.reqtime);
else
context.victual.nmod = context.victual.reqtime % otmp->oeaten;
context.victual.canchoke = (u.uhs == SATIATED);
g.context.victual.nmod = g.context.victual.reqtime % otmp->oeaten;
g.context.victual.canchoke = (u.uhs == SATIATED);
if (!dont_start)
start_eating(otmp);
@@ -2745,23 +2745,23 @@ struct obj *obj;
STATIC_OVL int
bite()
{
if (context.victual.canchoke && u.uhunger >= 2000) {
choke(context.victual.piece);
if (g.context.victual.canchoke && u.uhunger >= 2000) {
choke(g.context.victual.piece);
return 1;
}
if (context.victual.doreset) {
if (g.context.victual.doreset) {
do_reset_eat();
return 0;
}
g.force_save_hs = TRUE;
if (context.victual.nmod < 0) {
lesshungry(-context.victual.nmod);
consume_oeaten(context.victual.piece,
context.victual.nmod); /* -= -nmod */
} else if (context.victual.nmod > 0
&& (context.victual.usedtime % context.victual.nmod)) {
if (g.context.victual.nmod < 0) {
lesshungry(-g.context.victual.nmod);
consume_oeaten(g.context.victual.piece,
g.context.victual.nmod); /* -= -nmod */
} else if (g.context.victual.nmod > 0
&& (g.context.victual.usedtime % g.context.victual.nmod)) {
lesshungry(1);
consume_oeaten(context.victual.piece, -1); /* -= 1 */
consume_oeaten(g.context.victual.piece, -1); /* -= 1 */
}
g.force_save_hs = FALSE;
recalc_wt();
@@ -2845,12 +2845,12 @@ int num;
debugpline1("lesshungry(%d)", num);
u.uhunger += num;
if (u.uhunger >= 2000) {
if (!iseating || context.victual.canchoke) {
if (!iseating || g.context.victual.canchoke) {
if (iseating) {
choke(context.victual.piece);
choke(g.context.victual.piece);
reset_eat();
} else
choke(g.occupation == opentin ? context.tin.tin
choke(g.occupation == opentin ? g.context.tin.tin
: (struct obj *) 0);
/* no reset_eat() */
}
@@ -2859,16 +2859,16 @@ int num;
* warns when you're about to choke.
*/
if (u.uhunger >= 1500) {
if (!context.victual.eating
|| (context.victual.eating && !context.victual.fullwarn)) {
if (!g.context.victual.eating
|| (g.context.victual.eating && !g.context.victual.fullwarn)) {
pline("You're having a hard time getting all of it down.");
g.nomovemsg = "You're finally finished.";
if (!context.victual.eating) {
if (!g.context.victual.eating) {
g.multi = -2;
} else {
context.victual.fullwarn = TRUE;
if (context.victual.canchoke
&& context.victual.reqtime > 1) {
g.context.victual.fullwarn = TRUE;
if (g.context.victual.canchoke
&& g.context.victual.reqtime > 1) {
/* a one-gulp food will not survive a stop */
if (yn_function("Continue eating?", ynchars, 'n')
!= 'y') {
@@ -2891,7 +2891,7 @@ unfaint(VOID_ARGS)
if (u.uhs > FAINTING)
u.uhs = FAINTING;
stop_occupation();
context.botl = 1;
g.context.botl = 1;
return 0;
}
@@ -2974,7 +2974,7 @@ boolean incr;
stop_occupation();
You("faint from lack of food.");
incr_itimeout(&HDeaf, duration);
context.botl = TRUE;
g.context.botl = TRUE;
nomul(-duration);
g.multi_reason = "fainted from lack of food";
g.nomovemsg = "You regain consciousness.";
@@ -2989,7 +2989,7 @@ boolean incr;
now uhunger becomes more negative at a slower rate */
} else if (u.uhunger < -(100 + 10 * (int) ACURR(A_CON))) {
u.uhs = STARVED;
context.botl = 1;
g.context.botl = 1;
bot();
You("die from starvation.");
g.killer.format = KILLED_BY;
@@ -3006,7 +3006,7 @@ boolean incr;
be fatal (still handled below) by reducing HP if it
tried to take base strength below minimum of 3 */
ATEMP(A_STR) = -1; /* temporary loss overrides Fixed_abil */
/* defer context.botl status update until after hunger message */
/* defer g.context.botl status update until after hunger message */
} else if (newhs < WEAK && u.uhs >= WEAK) {
/* this used to be losestr(-1) which could be abused by
becoming weak while wearing ring of sustain ability,
@@ -3015,7 +3015,7 @@ boolean incr;
substituting "while polymorphed" for sustain ability and
"rehumanize" for ring removal might have done that too */
ATEMP(A_STR) = 0; /* repair of loss also overrides Fixed_abil */
/* defer context.botl status update until after hunger message */
/* defer g.context.botl status update until after hunger message */
}
switch (newhs) {
@@ -3031,7 +3031,7 @@ boolean incr;
if (incr && g.occupation
&& (g.occupation != eatfood && g.occupation != opentin))
stop_occupation();
context.travel = context.travel1 = context.mv = context.run = 0;
g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
break;
case WEAK:
if (Hallucination)
@@ -3051,11 +3051,11 @@ boolean incr;
if (incr && g.occupation
&& (g.occupation != eatfood && g.occupation != opentin))
stop_occupation();
context.travel = context.travel1 = context.mv = context.run = 0;
g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
break;
}
u.uhs = newhs;
context.botl = 1;
g.context.botl = 1;
bot();
if ((Upolyd ? u.mh : u.uhp) < 1) {
You("die from hunger and exhaustion.");
@@ -3235,7 +3235,7 @@ int amt;
* victual handling mechanism from scratch using a less complex
* model. Alternatively, this routine could call done_eating()
* or food_disappears() but its callers would need revisions to
* cope with context.victual.piece unexpectedly going away.
* cope with g.context.victual.piece unexpectedly going away.
*
* Multi-turn eating operates by setting the food's oeaten field
* to its full nutritional value and then running a counter which
@@ -3267,9 +3267,9 @@ int amt;
}
if (obj->oeaten == 0) {
if (obj == context.victual.piece) /* always true unless wishing... */
context.victual.reqtime =
context.victual.usedtime; /* no bites left */
if (obj == g.context.victual.piece) /* always true unless wishing... */
g.context.victual.reqtime =
g.context.victual.usedtime; /* no bites left */
obj->oeaten = 1; /* smallest possible positive value */
}
}
@@ -3282,11 +3282,11 @@ boolean stopping;
{
/* in case consume_oeaten() has decided that the food is all gone */
if (g.occupation == eatfood
&& context.victual.usedtime >= context.victual.reqtime) {
&& g.context.victual.usedtime >= g.context.victual.reqtime) {
if (stopping)
g.occupation = 0; /* for do_reset_eat */
(void) eatfood(); /* calls done_eating() to use up
context.victual.piece */
g.context.victual.piece */
return TRUE;
}
return FALSE;
@@ -3306,7 +3306,7 @@ int threat;
if (g.occupation != opentin)
return FALSE;
otin = context.tin.tin;
otin = g.context.tin.tin;
/* make sure hero still has access to tin */
if (!carried(otin)
&& (!obj_here(otin, u.ux, u.uy) || !can_reach_floor(TRUE)))
+6 -6
View File
@@ -844,18 +844,18 @@ int how;
make_sick(0L, (char *) 0, FALSE, SICK_ALL);
}
g.nomovemsg = "You survived that attempt on your life.";
context.move = 0;
g.context.move = 0;
if (g.multi > 0)
g.multi = 0;
else
g.multi = -1;
if (u.utrap && u.utraptype == TT_LAVA)
reset_utrap(FALSE);
context.botl = 1;
g.context.botl = 1;
u.ugrave_arise = NON_PM;
HUnchanging = 0L;
curs_on_u();
if (!context.mon_moving)
if (!g.context.mon_moving)
endmultishot(FALSE);
if (u.uswallow) {
/* might drop hero onto a trap that kills her all over again */
@@ -1024,10 +1024,10 @@ int how;
#endif
) {
/* skip status update if panicking or disconnected */
context.botl = context.botlx = FALSE;
g.context.botl = g.context.botlx = FALSE;
} else {
/* otherwise force full status update */
context.botlx = TRUE;
g.context.botlx = TRUE;
bot();
}
@@ -1067,7 +1067,7 @@ int how;
current HP to zero (0 HP when turning into green slime
is iffy but we don't have much choice--that is fatal) */
u.uhp = u.mh = 0;
context.botl = 1;
g.context.botl = 1;
}
}
if (Lifesaved && (how <= GENOCIDED)) {
+1 -1
View File
@@ -373,7 +373,7 @@ int x, y;
} else
et = ep->engr_txt;
You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et);
if (context.run > 1)
if (g.context.run > 1)
nomul(0);
}
}
+3 -3
View File
@@ -178,7 +178,7 @@ register int exper, rexp;
|| flags.showscore
#endif
)
context.botl = 1;
g.context.botl = 1;
if (u.urexp >= (Role_if(PM_WIZARD) ? 1000 : 2000))
flags.beginner = 0;
}
@@ -243,7 +243,7 @@ const char *drainer; /* cause of death, if drain should be fatal */
rehumanize();
}
context.botl = 1;
g.context.botl = 1;
}
/*
@@ -303,7 +303,7 @@ boolean incr; /* true iff via incremental experience growth */
adjabil(u.ulevel - 1, u.ulevel); /* give new intrinsics */
reset_rndmonst(NON_PM); /* new monster selection */
}
context.botl = 1;
g.context.botl = 1;
}
/* compute a random amount of experience points suitable for the hero's
+3 -3
View File
@@ -449,7 +449,7 @@ int expltype;
&& completelyburns(mtmp->data))
? XKILL_NOCORPSE : 0);
if (!context.mon_moving) {
if (!g.context.mon_moving) {
xkilled(mtmp, XKILL_GIVEMSG | xkflg);
} else if (mdef && mtmp == mdef) {
/* 'mdef' killed self trying to cure being turned
@@ -471,7 +471,7 @@ int expltype;
adtyp = AD_RBRE; /* no corpse */
monkilled(mtmp, "", (int) adtyp);
}
} else if (!context.mon_moving) {
} else if (!g.context.mon_moving) {
/* all affected monsters, even if mdef is set */
setmangry(mtmp, TRUE);
}
@@ -521,7 +521,7 @@ int expltype;
u.mh -= damu;
else
u.uhp -= damu;
context.botl = 1;
g.context.botl = 1;
}
if (u.uhp <= 0 || (Upolyd && u.mh <= 0)) {
+10 -10
View File
@@ -3910,7 +3910,7 @@ boolean wildcards;
#define TITLESCOPE 2
#define PASSAGESCOPE 3
#define MAXPASSAGES SIZE(context.novel.pasg) /* 20 */
#define MAXPASSAGES SIZE(g.context.novel.pasg) /* 20 */
static int FDECL(choose_passage, (int, unsigned));
@@ -3928,32 +3928,32 @@ unsigned oid; /* book.o_id, used to determine whether re-reading same book */
/* if a different book or we've used up all the passages already,
reset in order to have all 'passagecnt' passages available */
if (oid != context.novel.id || context.novel.count == 0) {
if (oid != g.context.novel.id || g.context.novel.count == 0) {
int i, range = passagecnt, limit = MAXPASSAGES;
context.novel.id = oid;
g.context.novel.id = oid;
if (range <= limit) {
/* collect all of the N indices */
context.novel.count = passagecnt;
g.context.novel.count = passagecnt;
for (idx = 0; idx < MAXPASSAGES; idx++)
context.novel.pasg[idx] = (xchar) ((idx < passagecnt)
g.context.novel.pasg[idx] = (xchar) ((idx < passagecnt)
? idx + 1 : 0);
} else {
/* collect MAXPASSAGES of the N indices */
context.novel.count = MAXPASSAGES;
g.context.novel.count = MAXPASSAGES;
for (idx = i = 0; i < passagecnt; ++i, --range)
if (range > 0 && rn2(range) < limit) {
context.novel.pasg[idx++] = (xchar) (i + 1);
g.context.novel.pasg[idx++] = (xchar) (i + 1);
--limit;
}
}
}
idx = rn2(context.novel.count);
res = (int) context.novel.pasg[idx];
idx = rn2(g.context.novel.count);
res = (int) g.context.novel.pasg[idx];
/* move the last slot's passage index into the slot just used
and reduce the number of passages available */
context.novel.pasg[idx] = context.novel.pasg[--context.novel.count];
g.context.novel.pasg[idx] = g.context.novel.pasg[--g.context.novel.count];
return res;
}
+1 -1
View File
@@ -238,7 +238,7 @@ drinkfountain()
for (ii = 0; ii < A_MAX; ii++)
if (ABASE(ii) < AMAX(ii)) {
ABASE(ii) = AMAX(ii);
context.botl = 1;
g.context.botl = 1;
}
/* gain ability, blessed if "natural" luck is high */
i = rn2(A_MAX); /* start at a random attribute */
+61 -61
View File
@@ -372,8 +372,8 @@ xchar x, y;
struct obj *boulder = sobj_at(BOULDER, x, y);
const char *digtxt = (char *) 0, *dmgtxt = (char *) 0;
if (context.digging.down) /* not continuing previous dig (w/ pick-axe) */
(void) memset((genericptr_t) &context.digging, 0,
if (g.context.digging.down) /* not continuing previous dig (w/ pick-axe) */
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof (struct dig_info));
if (!boulder
@@ -388,16 +388,16 @@ xchar x, y;
: "hard stone");
nomul(0);
return 1;
} else if (context.digging.pos.x != x || context.digging.pos.y != y
|| !on_level(&context.digging.level, &u.uz)) {
context.digging.down = FALSE;
context.digging.chew = TRUE;
context.digging.warned = FALSE;
context.digging.pos.x = x;
context.digging.pos.y = y;
assign_level(&context.digging.level, &u.uz);
} else if (g.context.digging.pos.x != x || g.context.digging.pos.y != y
|| !on_level(&g.context.digging.level, &u.uz)) {
g.context.digging.down = FALSE;
g.context.digging.chew = TRUE;
g.context.digging.warned = FALSE;
g.context.digging.pos.x = x;
g.context.digging.pos.y = y;
assign_level(&g.context.digging.level, &u.uz);
/* solid rock takes more work & time to dig through */
context.digging.effort =
g.context.digging.effort =
(IS_ROCK(lev->typ) && !IS_TREE(lev->typ) ? 30 : 60) + u.udaminc;
You("start chewing %s %s.",
(boulder || IS_TREE(lev->typ) || lev->typ == IRONBARS)
@@ -414,10 +414,10 @@ xchar x, y;
: "door");
watch_dig((struct monst *) 0, x, y, FALSE);
return 1;
} else if ((context.digging.effort += (30 + u.udaminc)) <= 100) {
} else if ((g.context.digging.effort += (30 + u.udaminc)) <= 100) {
if (flags.verbose)
You("%s chewing on the %s.",
context.digging.chew ? "continue" : "begin",
g.context.digging.chew ? "continue" : "begin",
boulder
? "boulder"
: IS_TREE(lev->typ)
@@ -427,7 +427,7 @@ xchar x, y;
: (lev->typ == IRONBARS)
? "bars"
: "door");
context.digging.chew = TRUE;
g.context.digging.chew = TRUE;
watch_dig((struct monst *) 0, x, y, FALSE);
return 1;
}
@@ -451,7 +451,7 @@ xchar x, y;
|| sobj_at(BOULDER, x, y)) {
block_point(x, y); /* delobj will unblock the point */
/* reset dig state */
(void) memset((genericptr_t) &context.digging, 0,
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof (struct dig_info));
return 1;
}
@@ -510,7 +510,7 @@ xchar x, y;
You1(digtxt); /* after newsym */
if (dmgtxt)
pay_for_damage(dmgtxt, FALSE);
(void) memset((genericptr_t) &context.digging, 0,
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof (struct dig_info));
return 0;
}
@@ -697,7 +697,7 @@ int mode;
register struct rm *tmpr = &levl[x][y];
register struct rm *ust;
context.door_opened = FALSE;
g.context.door_opened = FALSE;
/*
* Check for physical obstacles. First, the place we are going.
*/
@@ -729,7 +729,7 @@ int mode;
/* Eat the rock. */
if (mode == DO_MOVE && still_chewing(x, y))
return FALSE;
} else if (flags.autodig && !context.run && !context.nopick && uwep
} else if (flags.autodig && !g.context.run && !g.context.nopick && uwep
&& is_pick(uwep)) {
/* MRKR: Automatic digging when wielding the appropriate tool */
if (mode == DO_MOVE)
@@ -773,9 +773,9 @@ int mode;
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
if (flags.autoopen && !g.context.run && !Confusion
&& !Stunned && !Fumbling) {
context.door_opened = context.move =
g.context.door_opened = g.context.move =
doopen_indir(x, y);
} else if (x == ux || y == uy) {
if (Blind || Stunned || ACURR(A_DEX) < 10
@@ -837,7 +837,7 @@ int mode;
/* Pick travel path that does not require crossing a trap.
* Avoid water and lava using the usual running rules.
* (but not u.ux/u.uy because findtravelpath walks toward u.ux/u.uy) */
if (context.run == 8 && (mode != DO_MOVE)
if (g.context.run == 8 && (mode != DO_MOVE)
&& (x != u.ux || y != u.uy)) {
struct trap *t = t_at(x, y);
@@ -862,7 +862,7 @@ int mode;
}
if (sobj_at(BOULDER, x, y) && (Sokoban || !Passes_walls)) {
if (!(Blind || Hallucination) && (context.run >= 2)
if (!(Blind || Hallucination) && (g.context.run >= 2)
&& mode != TEST_TRAV) {
if (mode == DO_MOVE && iflags.mention_walls)
pline("A boulder blocks your path.");
@@ -911,10 +911,10 @@ findtravelpath(mode)
int mode;
{
/* if travel to adjacent, reachable location, use normal movement rules */
if ((mode == TRAVP_TRAVEL || mode == TRAVP_VALID) && context.travel1
if ((mode == TRAVP_TRAVEL || mode == TRAVP_VALID) && g.context.travel1
&& distmin(u.ux, u.uy, u.tx, u.ty) == 1
&& !(u.ux != u.tx && u.uy != u.ty && NODIAG(u.umonnum))) {
context.run = 0;
g.context.run = 0;
if (test_move(u.ux, u.uy, u.tx - u.ux, u.ty - u.uy, TEST_MOVE)) {
if (mode == TRAVP_TRAVEL) {
u.dx = u.tx - u.ux;
@@ -925,7 +925,7 @@ int mode;
return TRUE;
}
if (mode == TRAVP_TRAVEL)
context.run = 8;
g.context.run = 8;
}
if (u.tx != u.ux || u.ty != u.uy) {
xchar travel[COLNO][ROWNO];
@@ -1041,7 +1041,7 @@ int mode;
&& x == u.tx && y == u.ty) {
nomul(0);
/* reset run so domove run checks work */
context.run = 8;
g.context.run = 8;
iflags.travelcc.x = iflags.travelcc.y = 0;
}
return TRUE;
@@ -1341,10 +1341,10 @@ domove()
u_wipe_engr(rnd(5));
if (context.travel) {
if (g.context.travel) {
if (!findtravelpath(FALSE))
(void) findtravelpath(TRUE);
context.travel1 = 0;
g.context.travel1 = 0;
}
if (((wtcap = near_capacity()) >= OVERLOADED
@@ -1448,7 +1448,7 @@ domove()
if (((trap = t_at(x, y)) && trap->tseen)
|| (Blind && !Levitation && !Flying && !is_clinger(g.youmonst.data)
&& is_pool_or_lava(x, y) && levl[x][y].seenv)) {
if (context.run >= 2) {
if (g.context.run >= 2) {
if (iflags.mention_walls) {
if (trap && trap->tseen) {
int tt = what_trap(trap->ttyp);
@@ -1461,7 +1461,7 @@ domove()
}
}
nomul(0);
context.move = 0;
g.context.move = 0;
return;
} else
nomul(0);
@@ -1517,13 +1517,13 @@ domove()
/* Don't attack if you're running, and can see it */
/* It's fine to displace pets, though */
/* We should never get here if forcefight */
if (context.run && ((!Blind && mon_visible(mtmp)
if (g.context.run && ((!Blind && mon_visible(mtmp)
&& ((mtmp->m_ap_type != M_AP_FURNITURE
&& mtmp->m_ap_type != M_AP_OBJECT)
|| Protection_from_shape_changers))
|| sensemon(mtmp))) {
nomul(0);
context.move = 0;
g.context.move = 0;
return;
}
}
@@ -1540,7 +1540,7 @@ domove()
/* don't stop travel when displacing pets; if the
displace fails for some reason, attack() in uhitm.c
will stop travel rather than domove */
if (!is_safepet(mtmp) || context.forcefight)
if (!is_safepet(mtmp) || g.context.forcefight)
nomul(0);
/* only attack if we know it's there */
/* or if we used the 'F' command to fight blindly */
@@ -1557,7 +1557,7 @@ domove()
* attack_check(), which still wastes a turn, but prints a
* different message and makes the player remember the monster.
*/
if (context.nopick && !context.travel
if (g.context.nopick && !g.context.travel
&& (canspotmon(mtmp) || glyph_is_invisible(levl[x][y].glyph))) {
if (mtmp->m_ap_type && !Protection_from_shape_changers
&& !sensemon(mtmp))
@@ -1569,7 +1569,7 @@ domove()
You("move right into %s.", mon_nam(mtmp));
return;
}
if (context.forcefight || !mtmp->mundetected || sensemon(mtmp)
if (g.context.forcefight || !mtmp->mundetected || sensemon(mtmp)
|| ((hides_under(mtmp->data) || mtmp->data->mlet == S_EEL)
&& !is_safepet(mtmp))) {
/* try to attack; note that it might evade */
@@ -1579,7 +1579,7 @@ domove()
}
}
if (context.forcefight && levl[x][y].typ == IRONBARS && uwep) {
if (g.context.forcefight && levl[x][y].typ == IRONBARS && uwep) {
struct obj *obj = uwep;
if (breaktest(obj)) {
@@ -1594,9 +1594,9 @@ domove()
}
/* specifying 'F' with no monster wastes a turn */
if (context.forcefight
if (g.context.forcefight
/* remembered an 'I' && didn't use a move command */
|| (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
|| (glyph_is_invisible(levl[x][y].glyph) && !g.context.nopick)) {
struct obj *boulder = 0;
boolean explo = (Upolyd && attacktype(g.youmonst.data, AT_EXPL)),
solid = !accessible(x, y);
@@ -1614,7 +1614,7 @@ domove()
/* force fight at boulder/statue or wall/door while wielding
pick: start digging to break the boulder or wall */
if (context.forcefight
if (g.context.forcefight
/* can we dig? */
&& uwep && dig_typ(uwep, x, y)
/* should we dig? */
@@ -1688,8 +1688,8 @@ domove()
}
if (!test_move(u.ux, u.uy, x - u.ux, y - u.uy, DO_MOVE)) {
if (!context.door_opened) {
context.move = 0;
if (!g.context.door_opened) {
g.context.move = 0;
nomul(0);
}
return;
@@ -1835,8 +1835,8 @@ domove()
}
reset_occupations();
if (context.run) {
if (context.run < 8)
if (g.context.run) {
if (g.context.run < 8)
if (IS_DOOR(tmpr->typ) || IS_ROCK(tmpr->typ)
|| IS_FURNITURE(tmpr->typ))
nomul(0);
@@ -1880,11 +1880,11 @@ domove()
g.nomovemsg = "";
}
if (context.run && flags.runmode != RUN_TPORT) {
if (g.context.run && flags.runmode != RUN_TPORT) {
/* display every step or every 7th step depending upon mode */
if (flags.runmode != RUN_LEAP || !(g.moves % 7L)) {
if (flags.time)
context.botl = 1;
g.context.botl = 1;
curs_on_u();
delay_output();
if (flags.runmode == RUN_CRAWL) {
@@ -1981,7 +1981,7 @@ switch_terrain()
You("start flying.");
}
if ((!Levitation ^ was_levitating) || (!Flying ^ was_flying))
context.botl = TRUE; /* update Lev/Fly status condition */
g.context.botl = TRUE; /* update Lev/Fly status condition */
}
/* extracted from spoteffects; called by spoteffects to check for entering or
@@ -2612,7 +2612,7 @@ lookaround()
return;
}
if (Blind || context.run == 0)
if (Blind || g.context.run == 0)
return;
for (x = u.ux - 1; x <= u.ux + 1; x++)
for (y = u.uy - 1; y <= u.uy + 1; y++) {
@@ -2625,9 +2625,9 @@ lookaround()
&& mtmp->m_ap_type != M_AP_FURNITURE
&& mtmp->m_ap_type != M_AP_OBJECT
&& (!mtmp->minvis || See_invisible) && !mtmp->mundetected) {
if ((context.run != 1 && !mtmp->mtame)
if ((g.context.run != 1 && !mtmp->mtame)
|| (x == u.ux + u.dx && y == u.uy + u.dy
&& !context.travel)) {
&& !g.context.travel)) {
if (iflags.mention_walls)
pline("%s blocks your path.", upstart(a_monnam(mtmp)));
goto stop;
@@ -2645,7 +2645,7 @@ lookaround()
} else if (closed_door(x, y) || (mtmp && is_door_mappear(mtmp))) {
if (x != u.ux && y != u.uy)
continue;
if (context.run != 1) {
if (g.context.run != 1) {
if (iflags.mention_walls)
You("stop in front of the door.");
goto stop;
@@ -2654,8 +2654,8 @@ lookaround()
} else if (levl[x][y].typ == CORR) {
bcorr:
if (levl[u.ux][u.uy].typ != ROOM) {
if (context.run == 1 || context.run == 3
|| context.run == 8) {
if (g.context.run == 1 || g.context.run == 3
|| g.context.run == 8) {
i = dist2(x, y, u.ux + u.dx, u.uy + u.dy);
if (i > 2)
continue;
@@ -2672,7 +2672,7 @@ lookaround()
}
continue;
} else if ((trap = t_at(x, y)) && trap->tseen) {
if (context.run == 1)
if (g.context.run == 1)
goto bcorr; /* if you must */
if (x == u.ux + u.dx && y == u.uy + u.dy) {
if (iflags.mention_walls) {
@@ -2700,9 +2700,9 @@ lookaround()
}
continue;
} else { /* e.g. objects or trap or stairs */
if (context.run == 1)
if (g.context.run == 1)
goto bcorr;
if (context.run == 8)
if (g.context.run == 8)
continue;
if (mtmp)
continue; /* d */
@@ -2715,12 +2715,12 @@ lookaround()
return;
} /* end for loops */
if (corrct > 1 && context.run == 2) {
if (corrct > 1 && g.context.run == 2) {
if (iflags.mention_walls)
pline_The("corridor widens here.");
goto stop;
}
if ((context.run == 1 || context.run == 3 || context.run == 8) && !noturn
if ((g.context.run == 1 || g.context.run == 3 || g.context.run == 8) && !noturn
&& !m0 && i0 && (corrct == 1 || (corrct == 2 && i0 == 1))) {
/* make sure that we do not turn too far */
if (i0 == 2) {
@@ -2828,7 +2828,7 @@ register int nval;
g.multi = nval;
if (nval == 0)
g.multi_reason = NULL;
context.travel = context.travel1 = context.mv = context.run = 0;
g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
}
/* called when a non-movement, multi-turn action has completed */
@@ -2900,7 +2900,7 @@ boolean k_format;
u.mh -= n;
if (u.mhmax < u.mh)
u.mhmax = u.mh;
context.botl = 1;
g.context.botl = 1;
if (u.mh < 1)
rehumanize();
else if (n > 0 && u.mh * 10 < u.mhmax && Unchanging)
@@ -2912,8 +2912,8 @@ boolean k_format;
if (u.uhp > u.uhpmax)
u.uhpmax = u.uhp; /* perhaps n was negative */
else
context.travel = context.travel1 = context.mv = context.run = 0;
context.botl = 1;
g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
g.context.botl = 1;
if (u.uhp < 1) {
g.killer.format = k_format;
if (g.killer.name != knam) /* the thing that killed you */
+5 -5
View File
@@ -769,7 +769,7 @@ addinv_core1(obj)
struct obj *obj;
{
if (obj->oclass == COIN_CLASS) {
context.botl = 1;
g.context.botl = 1;
} else if (obj->otyp == AMULET_OF_YENDOR) {
if (u.uhave.amulet)
impossible("already have amulet?");
@@ -1068,7 +1068,7 @@ freeinv_core(obj)
struct obj *obj;
{
if (obj->oclass == COIN_CLASS) {
context.botl = 1;
g.context.botl = 1;
return;
} else if (obj->otyp == AMULET_OF_YENDOR) {
if (!u.uhave.amulet)
@@ -1099,7 +1099,7 @@ struct obj *obj;
curse(obj);
} else if (confers_luck(obj)) {
set_moreluck();
context.botl = 1;
g.context.botl = 1;
} else if (obj->otyp == FIGURINE && obj->timed) {
(void) stop_timer(FIG_TRANSFORM, obj_to_any(obj));
}
@@ -1749,7 +1749,7 @@ redo_menu:
continue;
}
}
context.botl = 1; /* May have changed the amount of money */
g.context.botl = 1; /* May have changed the amount of money */
savech(ilet);
/* [we used to set otmp (by finding ilet in invent) here, but
that's been moved above so that otmp can be checked earlier] */
@@ -2009,7 +2009,7 @@ unsigned *resultflags;
}
if (oc_of_sym == COIN_CLASS && !combo) {
context.botl = 1;
g.context.botl = 1;
} else if (sym == 'a') {
allflag = TRUE;
} else if (sym == 'A') {
+1 -1
View File
@@ -490,7 +490,7 @@ struct obj *pick;
g.xlock.box = 0;
}
}
context.move = 0;
g.context.move = 0;
g.xlock.chance = ch;
g.xlock.picktyp = picktyp;
g.xlock.magic_key = is_magic_key(&g.youmonst, pick);
+7 -7
View File
@@ -836,9 +836,9 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */
m2->mextra = (struct mextra *) 0;
m2->nmon = fmon;
fmon = m2;
m2->m_id = context.ident++;
m2->m_id = g.context.ident++;
if (!m2->m_id)
m2->m_id = context.ident++; /* ident overflowed */
m2->m_id = g.context.ident++; /* ident overflowed */
m2->mx = mm.x;
m2->my = mm.y;
@@ -876,7 +876,7 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */
}
/* not all clones caused by player are tame or peaceful */
if (!context.mon_moving) {
if (!g.context.mon_moving) {
if (mon->mtame)
m2->mtame = rn2(max(2 + u.uluck, 2)) ? mon->mtame : 0;
else if (mon->mpeaceful)
@@ -1197,9 +1197,9 @@ int mmflags;
mtmp->msleeping = 1;
mtmp->nmon = fmon;
fmon = mtmp;
mtmp->m_id = context.ident++;
mtmp->m_id = g.context.ident++;
if (!mtmp->m_id)
mtmp->m_id = context.ident++; /* ident overflowed */
mtmp->m_id = g.context.ident++; /* ident overflowed */
set_mon_data(mtmp, ptr, 0);
if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx)
g.quest_status.leader_m_id = mtmp->m_id;
@@ -1300,8 +1300,8 @@ int mmflags;
}
} else if (mndx == PM_WIZARD_OF_YENDOR) {
mtmp->iswiz = TRUE;
context.no_of_wizards++;
if (context.no_of_wizards == 1 && Is_earthlevel(&u.uz))
g.context.no_of_wizards++;
if (g.context.no_of_wizards == 1 && Is_earthlevel(&u.uz))
mitem = SPE_DIG;
} else if (mndx == PM_GHOST && !(mmflags & MM_NONAME)) {
mtmp = christen_monst(mtmp, rndghostname());
+3 -3
View File
@@ -245,7 +245,7 @@ int glyph;
{
static char encbuf[20]; /* 10+1 would suffice */
Sprintf(encbuf, "\\G%04X%04X", context.rndencode, glyph);
Sprintf(encbuf, "\\G%04X%04X", g.context.rndencode, glyph);
return encbuf;
}
@@ -275,7 +275,7 @@ const char *str;
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
else
break;
if (rndchk == context.rndencode) {
if (rndchk == g.context.rndencode) {
gv = dcount = 0;
for (; *str && ++dcount <= 4; ++str)
if ((dp = index(hex, *str)) != 0)
@@ -300,7 +300,7 @@ const char *str;
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
else
break;
if (rndchk == context.rndencode) {
if (rndchk == g.context.rndencode) {
dcount = 0;
for (; *str && ++dcount <= 2; ++str)
if ((dp = index(hex, *str)) != 0)
+2 -2
View File
@@ -378,7 +378,7 @@ int spellnum;
dmg = 0;
break;
case MGC_CLONE_WIZ:
if (mtmp->iswiz && context.no_of_wizards == 1) {
if (mtmp->iswiz && g.context.no_of_wizards == 1) {
pline("Double Trouble...");
clonewiz();
dmg = 0;
@@ -800,7 +800,7 @@ int spellnum;
if (!mcouldseeu && (spellnum == MGC_SUMMON_MONS
|| (!mtmp->iswiz && spellnum == MGC_CLONE_WIZ)))
return TRUE;
if ((!mtmp->iswiz || context.no_of_wizards > 1)
if ((!mtmp->iswiz || g.context.no_of_wizards > 1)
&& spellnum == MGC_CLONE_WIZ)
return TRUE;
/* aggravation (global wakeup) when everyone is already active */
+12 -12
View File
@@ -775,7 +775,7 @@ register struct monst *mtmp;
default: /* no attack */
break;
}
if (context.botl)
if (g.context.botl)
bot();
/* give player a chance of waking up before dying -kaa */
if (sum[i] == 1) { /* successful attack */
@@ -1014,7 +1014,7 @@ register struct attack *mattk;
exercise(A_STR, FALSE);
/* inflict damage now; we know it can't be fatal */
u.mh -= tmp;
context.botl = 1;
g.context.botl = 1;
dmg = 0; /* don't inflict more damage below */
if (cloneu())
You("divide as %s hits you!", mon_nam(mtmp));
@@ -1450,7 +1450,7 @@ register struct attack *mattk;
exercise(A_CON, TRUE);
if (Sick)
make_sick(0L, (char *) 0, FALSE, SICK_ALL);
context.botl = 1;
g.context.botl = 1;
if (goaway) {
mongone(mtmp);
return 2;
@@ -1690,7 +1690,7 @@ register struct attack *mattk;
*hpmax_p = lowerlimit;
/* else unlikely...
* already at or below minimum threshold; do nothing */
context.botl = 1;
g.context.botl = 1;
}
mdamageu(mtmp, dmg);
@@ -2300,7 +2300,7 @@ mdamageu(mtmp, n)
struct monst *mtmp;
int n;
{
context.botl = 1;
g.context.botl = 1;
if (Upolyd) {
u.mh -= n;
if (u.mh < 1)
@@ -2552,13 +2552,13 @@ struct monst *mon;
You("are down in the dumps.");
(void) adjattrib(A_CON, -1, TRUE);
exercise(A_CON, FALSE);
context.botl = 1;
g.context.botl = 1;
break;
case 2:
Your("senses are dulled.");
(void) adjattrib(A_WIS, -1, TRUE);
exercise(A_WIS, FALSE);
context.botl = 1;
g.context.botl = 1;
break;
case 3:
if (!resists_drli(&g.youmonst)) {
@@ -2594,13 +2594,13 @@ struct monst *mon;
You_feel("good enough to do it again.");
(void) adjattrib(A_CON, 1, TRUE);
exercise(A_CON, TRUE);
context.botl = 1;
g.context.botl = 1;
break;
case 2:
You("will always remember %s...", noit_mon_nam(mon));
(void) adjattrib(A_WIS, 1, TRUE);
exercise(A_WIS, TRUE);
context.botl = 1;
g.context.botl = 1;
break;
case 3:
pline("That was a very educational experience.");
@@ -2613,7 +2613,7 @@ struct monst *mon;
if (Upolyd)
u.mh = u.mhmax;
exercise(A_STR, TRUE);
context.botl = 1;
g.context.botl = 1;
break;
}
}
@@ -2646,7 +2646,7 @@ struct monst *mon;
pline("%s takes %ld %s for services rendered!", noit_Monnam(mon),
cost, currency(cost));
money2mon(mon, cost);
context.botl = 1;
g.context.botl = 1;
}
}
if (!rn2(25))
@@ -2915,7 +2915,7 @@ cloneu()
mon->mhpmax = u.mhmax;
mon->mhp = u.mh / 2;
u.mh -= mon->mhp;
context.botl = 1;
g.context.botl = 1;
return mon;
}
+1 -1
View File
@@ -322,7 +322,7 @@ struct monst *mtmp;
You("give %s %ld %s.", mon_nam(mtmp), offer, currency(offer));
}
(void) money2mon(mtmp, offer);
context.botl = 1;
g.context.botl = 1;
return offer;
}
+17 -17
View File
@@ -394,9 +394,9 @@ struct obj *obj2, *obj1;
OMONST(obj2)->mextra = (struct mextra *) 0;
OMONST(obj2)->nmon = (struct monst *) 0;
#if 0
OMONST(obj2)->m_id = context.ident++;
OMONST(obj2)->m_id = g.context.ident++;
if (OMONST(obj2)->m_id) /* ident overflowed */
OMONST(obj2)->m_id = context.ident++;
OMONST(obj2)->m_id = g.context.ident++;
#endif
if (OMONST(obj1)->mextra)
copy_mextra(OMONST(obj2), OMONST(obj1));
@@ -436,9 +436,9 @@ long num;
otmp = newobj();
*otmp = *obj; /* copies whole structure */
otmp->oextra = (struct oextra *) 0;
otmp->o_id = context.ident++;
otmp->o_id = g.context.ident++;
if (!otmp->o_id)
otmp->o_id = context.ident++; /* ident overflowed */
otmp->o_id = g.context.ident++; /* ident overflowed */
otmp->timed = 0; /* not timed, yet */
otmp->lamplit = 0; /* ditto */
otmp->owornmask = 0L; /* new object isn't worn */
@@ -447,8 +447,8 @@ long num;
otmp->quan = num;
otmp->owt = weight(otmp); /* -= obj->owt ? */
context.objsplit.parent_oid = obj->o_id;
context.objsplit.child_oid = otmp->o_id;
g.context.objsplit.parent_oid = obj->o_id;
g.context.objsplit.child_oid = otmp->o_id;
obj->nobj = otmp;
/* Only set nexthere when on the floor, nexthere is also used */
/* as a back pointer to the container object when contained. */
@@ -503,17 +503,17 @@ struct obj *obj;
}
/* first try the expected case; obj is split from another stack */
if (obj->o_id == context.objsplit.child_oid) {
if (obj->o_id == g.context.objsplit.child_oid) {
/* parent probably precedes child and will require list traversal */
ochild = obj;
target_oid = context.objsplit.parent_oid;
target_oid = g.context.objsplit.parent_oid;
if (obj->nobj && obj->nobj->o_id == target_oid)
oparent = obj->nobj;
} else if (obj->o_id == context.objsplit.parent_oid) {
} else if (obj->o_id == g.context.objsplit.parent_oid) {
/* alternate scenario: another stack was split from obj;
child probably follows parent and will be found here */
oparent = obj;
target_oid = context.objsplit.child_oid;
target_oid = g.context.objsplit.child_oid;
if (obj->nobj && obj->nobj->o_id == target_oid)
ochild = obj->nobj;
}
@@ -542,7 +542,7 @@ struct obj *obj;
void
clear_splitobjs()
{
context.objsplit.parent_oid = context.objsplit.child_oid = 0;
g.context.objsplit.parent_oid = g.context.objsplit.child_oid = 0;
}
/*
@@ -643,9 +643,9 @@ register struct obj *otmp;
*dummy = *otmp;
dummy->oextra = (struct oextra *) 0;
dummy->where = OBJ_FREE;
dummy->o_id = context.ident++;
dummy->o_id = g.context.ident++;
if (!dummy->o_id)
dummy->o_id = context.ident++; /* ident overflowed */
dummy->o_id = g.context.ident++; /* ident overflowed */
dummy->timed = 0;
copy_oextra(dummy, otmp);
if (has_omid(dummy))
@@ -762,9 +762,9 @@ boolean artif;
otmp = newobj();
*otmp = zeroobj;
otmp->age = g.monstermoves;
otmp->o_id = context.ident++;
otmp->o_id = g.context.ident++;
if (!otmp->o_id)
otmp->o_id = context.ident++; /* ident overflowed */
otmp->o_id = g.context.ident++; /* ident overflowed */
otmp->quan = 1L;
otmp->oclass = let;
otmp->otyp = otyp;
@@ -845,7 +845,7 @@ boolean artif;
blessorcurse(otmp, 10);
break;
case SLIME_MOLD:
otmp->spe = context.current_fruit;
otmp->spe = g.context.current_fruit;
flags.made_fruit = TRUE;
break;
case KELP_FROND:
@@ -947,7 +947,7 @@ boolean artif;
break;
case AMULET_CLASS:
if (otmp->otyp == AMULET_OF_YENDOR)
context.made_amulet = TRUE;
g.context.made_amulet = TRUE;
if (rn2(10) && (otmp->otyp == AMULET_OF_STRANGULATION
|| otmp->otyp == AMULET_OF_CHANGE
|| otmp->otyp == AMULET_OF_RESTFUL_SLEEP)) {
+14 -14
View File
@@ -459,7 +459,7 @@ unsigned corpseflags;
/* if polymorph or undead turning has killed this monster,
prevent the same attack beam from hitting its corpse */
if (context.bypasses)
if (g.context.bypasses)
bypass_obj(obj);
if (has_mname(mtmp))
@@ -559,7 +559,7 @@ register struct monst *mtmp;
hero to create lava beneath a monster, so the !mon_moving
case is not expected to happen (and we haven't made a
player-against-monster variation of the message above) */
if (context.mon_moving)
if (g.context.mon_moving)
mondead(mtmp);
else
xkilled(mtmp, XKILL_NOMSG);
@@ -594,7 +594,7 @@ register struct monst *mtmp;
return 0;
}
if (cansee(mtmp->mx, mtmp->my)) {
if (context.mon_moving)
if (g.context.mon_moving)
pline("%s drowns.", Monnam(mtmp));
else
/* hero used fire to melt ice that monster was on */
@@ -606,7 +606,7 @@ register struct monst *mtmp;
pline("%s sinks as %s rushes in and flushes you out.",
Monnam(mtmp), hliquid("water"));
}
if (context.mon_moving)
if (g.context.mon_moving)
mondead(mtmp);
else
xkilled(mtmp, XKILL_NOMSG);
@@ -645,7 +645,7 @@ struct monst *mon;
else if (mon->mspeed == MFAST)
mmove = (4 * mmove + 2) / 3;
if (mon == u.usteed && u.ugallop && context.mv) {
if (mon == u.usteed && u.ugallop && g.context.mv) {
/* increase movement by a factor of 1.5; also increase variance of
movement speed (if it's naturally 24, we don't want it to always
become 36) */
@@ -775,7 +775,7 @@ movemon()
vision_recalc(0); /* vision! */
/* reset obj bypasses before next monster moves */
if (context.bypasses)
if (g.context.bypasses)
clear_bypasses();
clear_splitobjs();
if (minliquid(mtmp))
@@ -833,7 +833,7 @@ movemon()
if (any_light_source())
g.vision_full_recalc = 1; /* in case a mon moved with a light source */
/* reset obj bypasses after last monster has moved */
if (context.bypasses)
if (g.context.bypasses)
clear_bypasses();
clear_splitobjs();
/* remove dead monsters; dead vault guard will be left at <0,0>
@@ -1802,8 +1802,8 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
{
boolean onmap = (mtmp->mx > 0);
if (mtmp == context.polearm.hitmon)
context.polearm.hitmon = 0;
if (mtmp == g.context.polearm.hitmon)
g.context.polearm.hitmon = 0;
if (mtmp->mleashed)
m_unleash(mtmp, FALSE);
/* to prevent an infinite relobj-flooreffects-hmon-killed loop */
@@ -2765,7 +2765,7 @@ boolean via_attack;
}
/* attacking your own quest leader will anger his or her guardians */
if (!context.mon_moving /* should always be the case here */
if (!g.context.mon_moving /* should always be the case here */
&& mtmp->data == &mons[quest_info(MS_LEADER)]) {
struct monst *mon;
struct permonst *q_guardian = &mons[quest_info(MS_GUARDIAN)];
@@ -2792,7 +2792,7 @@ boolean via_attack;
}
/* make other peaceful monsters react */
if (!context.mon_moving) {
if (!g.context.mon_moving) {
static const char *const Exclam[] = {
"Gasp!", "Uh-oh.", "Oh my!", "What?", "Why?",
};
@@ -2862,7 +2862,7 @@ boolean via_attack;
mtmp->msleeping = 0;
if (mtmp->m_ap_type) {
seemimic(mtmp);
} else if (context.forcefight && !context.mon_moving
} else if (g.context.forcefight && !g.context.mon_moving
&& mtmp->mundetected) {
mtmp->mundetected = 0;
newsym(mtmp->mx, mtmp->my);
@@ -2895,7 +2895,7 @@ int x, y, distance;
mtmp->msleeping = 0; /* wake indeterminate sleep */
if (!(mtmp->data->geno & G_UNIQ))
mtmp->mstrategy &= ~STRAT_WAITMASK; /* wake 'meditation' */
if (context.mon_moving)
if (g.context.mon_moving)
continue;
if (mtmp->mtame) {
if (!mtmp->isminion)
@@ -3653,7 +3653,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
mon_break_armor(mtmp, polyspot);
if (!(mtmp->misc_worn_check & W_ARMG))
mselftouch(mtmp, "No longer petrify-resistant, ",
!context.mon_moving);
!g.context.mon_moving);
m_dowear(mtmp, FALSE);
/* This ought to re-test can_carry() on each item in the inventory
+1 -1
View File
@@ -98,7 +98,7 @@ register struct monst *mtmp;
}
} else if (is_digging()) {
/* chewing, wand/spell of digging are checked elsewhere */
watch_dig(mtmp, context.digging.pos.x, context.digging.pos.y,
watch_dig(mtmp, g.context.digging.pos.x, g.context.digging.pos.y,
FALSE);
}
}
+1 -1
View File
@@ -411,7 +411,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */
(nonliving(mtmp->data) || is_vampshifter(mtmp)
|| !canspotmon(mtmp)) ? "destroyed" : "killed");
/* don't blame hero for unknown rolling boulder trap */
if (!context.mon_moving && (otmp->otyp != BOULDER
if (!g.context.mon_moving && (otmp->otyp != BOULDER
|| range >= 0 || otmp->otrapped))
xkilled(mtmp, XKILL_NOMSG);
else
+1 -1
View File
@@ -621,7 +621,7 @@ struct obj *instr;
rn2(2) ? "butcher" : rn2(2) ? "manage" : "pull off",
an(beats[rn2(SIZE(beats))]));
awaken_monsters(u.ulevel * (mundane ? 5 : 40));
context.botl = TRUE;
g.context.botl = TRUE;
break;
default:
impossible("What a weird instrument (%d)!", instr->otyp);
+2 -2
View File
@@ -2825,7 +2825,7 @@ struct obj *no_wish;
int tmp, tinv, tvariety;
int wetness, gsize = 0;
struct fruit *f;
int ftype = context.current_fruit;
int ftype = g.context.current_fruit;
char fruitbuf[BUFSZ], globbuf[BUFSZ];
/* Fruits may not mess up the ability to wish for real objects (since
* you can leave a fruit in a bones file and it will be added to
@@ -3275,7 +3275,7 @@ struct obj *no_wish;
otmp = mksobj(GOLD_PIECE, FALSE, FALSE);
otmp->quan = (long) cnt;
otmp->owt = weight(otmp);
context.botl = 1;
g.context.botl = 1;
return otmp;
}
+2 -2
View File
@@ -3958,7 +3958,7 @@ boolean tinitial, tfrom_file;
#ifdef STATUS_HILITES
status_initialize(REASSESS_ONLY);
#endif
context.botl = TRUE;
g.context.botl = TRUE;
} else if (boolopt[i].addr == &flags.invlet_constant) {
if (flags.invlet_constant)
reassign();
@@ -6244,7 +6244,7 @@ struct fruit *replace_fruit;
g.ffruit = f;
nonew:
if (user_specified)
context.current_fruit = f->fid;
g.context.current_fruit = f->fid;
return f->fid;
}
+3 -3
View File
@@ -186,7 +186,7 @@ struct obj **obj_p;
if (otmp->oclass == COIN_CLASS)
otmp->quan = 2L; /* to force pluralization */
else if (otmp->otyp == SLIME_MOLD)
otmp->spe = context.current_fruit; /* give it a type */
otmp->spe = g.context.current_fruit; /* give it a type */
else if (otmp->otyp == LEASH)
otmp->leashmon = 0;
if (mtmp && has_mcorpsenm(mtmp)) /* mimic as corpse/statue */
@@ -340,8 +340,8 @@ int x, y;
if (Hallucination) {
Strcat(monbuf, "paranoid delusion");
} else {
unsigned long mW = (context.warntype.obj
| context.warntype.polyd),
unsigned long mW = (g.context.warntype.obj
| g.context.warntype.polyd),
m2 = mtmp->data->mflags2;
const char *whom = ((mW & M2_HUMAN & m2) ? "human"
: (mW & M2_ELF & m2) ? "elf"
+10 -10
View File
@@ -301,7 +301,7 @@ boolean picked_some;
/* If there are objects here, take a look. */
if (ct) {
if (context.run)
if (g.context.run)
nomul(0);
flush_screen(1);
(void) look_here(ct, picked_some);
@@ -499,7 +499,7 @@ int what; /* should be a long */
struct trap *ttmp;
/* no auto-pick if no-pick move, nothing there, or in a pool */
if (autopickup && (context.nopick || !OBJ_AT(u.ux, u.uy)
if (autopickup && (g.context.nopick || !OBJ_AT(u.ux, u.uy)
|| (is_pool(u.ux, u.uy) && !Underwater)
|| is_lava(u.ux, u.uy))) {
read_engr_at(u.ux, u.uy);
@@ -507,17 +507,17 @@ int what; /* should be a long */
}
/* no pickup if levitating & not on air or water level */
if (!can_reach_floor(TRUE)) {
if ((g.multi && !context.run) || (autopickup && !flags.pickup)
if ((g.multi && !g.context.run) || (autopickup && !flags.pickup)
|| ((ttmp = t_at(u.ux, u.uy)) != 0
&& uteetering_at_seen_pit(ttmp)))
read_engr_at(u.ux, u.uy);
return 0;
}
/* multi && !context.run means they are in the middle of some other
/* multi && !g.context.run means they are in the middle of some other
* action, or possibly paralyzed, sleeping, etc.... and they just
* teleported onto the object. They shouldn't pick it up.
*/
if ((g.multi && !context.run) || (autopickup && !flags.pickup)) {
if ((g.multi && !g.context.run) || (autopickup && !flags.pickup)) {
check_here(FALSE);
return 0;
}
@@ -530,8 +530,8 @@ int what; /* should be a long */
}
/* if there's anything here, stop running */
if (OBJ_AT(u.ux, u.uy) && context.run && context.run != 8
&& !context.nopick)
if (OBJ_AT(u.ux, u.uy) && g.context.run && g.context.run != 8
&& !g.context.nopick)
nomul(0);
}
@@ -1490,7 +1490,7 @@ boolean telekinesis; /* not picking it up directly by hand */
/* Whats left of the special case for gold :-) */
if (obj->oclass == COIN_CLASS)
context.botl = 1;
g.context.botl = 1;
if (obj->quan != count && obj->otyp != LOADSTONE)
obj = splitobj(obj, count);
@@ -1580,7 +1580,7 @@ encumber_msg()
newcap == 4 ? "can barely" : "can't even");
break;
}
context.botl = 1;
g.context.botl = 1;
} else if (g.oldcap > newcap) {
switch (newcap) {
case 0:
@@ -1597,7 +1597,7 @@ encumber_msg()
stagger(g.youmonst.data, "stagger"));
break;
}
context.botl = 1;
g.context.botl = 1;
}
g.oldcap = newcap;
+18 -18
View File
@@ -130,7 +130,7 @@ float_vs_flight()
BLevitation |= I_SPECIAL;
else
BLevitation &= ~I_SPECIAL;
context.botl = TRUE;
g.context.botl = TRUE;
}
/* for changing into form that's immune to strangulation */
@@ -145,7 +145,7 @@ boolean on;
if (uamul && uamul->otyp == AMULET_OF_STRANGULATION
&& can_be_strangled(&g.youmonst)) {
Strangled = 6L;
context.botl = TRUE;
g.context.botl = TRUE;
Your("%s %s your %s!", simpleonames(uamul),
Strangled ? "still constricts" : "begins constricting",
body_part(NECK)); /* "throat" */
@@ -156,7 +156,7 @@ boolean on;
} else {
if (Strangled && !can_be_strangled(&g.youmonst)) {
Strangled = 0L;
context.botl = TRUE;
g.context.botl = TRUE;
You("are no longer being strangled.");
}
}
@@ -379,7 +379,7 @@ newman()
make_slimed(10L, (const char *) 0);
}
context.botl = 1;
g.context.botl = 1;
see_monsters();
(void) encumber_msg();
@@ -520,7 +520,7 @@ int psflags;
of evaporation due to over enchanting */
uarm->otyp += GRAY_DRAGON_SCALES - GRAY_DRAGON_SCALE_MAIL;
uarm->dknown = 1;
context.botl = 1; /* AC is changing */
g.context.botl = 1; /* AC is changing */
}
uskin = uarm;
uarm = (struct obj *) 0;
@@ -839,7 +839,7 @@ int mntmp;
}
check_strangling(TRUE); /* maybe start strangling */
context.botl = 1;
g.context.botl = 1;
g.vision_full_recalc = 1;
see_monsters();
(void) encumber_msg();
@@ -1055,7 +1055,7 @@ rehumanize()
}
nomul(0);
context.botl = 1;
g.context.botl = 1;
g.vision_full_recalc = 1;
(void) encumber_msg();
if (was_flying && !Flying && u.usteed)
@@ -1080,7 +1080,7 @@ dobreathe()
return 0;
}
u.uen -= 15;
context.botl = 1;
g.context.botl = 1;
if (!getdir((char *) 0))
return 0;
@@ -1269,7 +1269,7 @@ dosummon()
return 0;
}
u.uen -= 10;
context.botl = 1;
g.context.botl = 1;
You("call upon your brethren for help!");
exercise(A_WIS, TRUE);
@@ -1310,7 +1310,7 @@ dogaze()
return 0;
}
u.uen -= 15;
context.botl = 1;
g.context.botl = 1;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
@@ -1509,7 +1509,7 @@ domindblast()
return 0;
}
u.uen -= 10;
context.botl = 1;
g.context.botl = 1;
You("concentrate.");
pline("A wave of psychic energy pours out.");
@@ -1759,7 +1759,7 @@ int damtype, dam;
u.mh += heal;
if (u.mh > u.mhmax)
u.mh = u.mhmax;
context.botl = 1;
g.context.botl = 1;
pline("Strangely, you feel better than before.");
exercise(A_STR, TRUE);
}
@@ -1813,9 +1813,9 @@ polysense()
{
short warnidx = NON_PM;
context.warntype.speciesidx = NON_PM;
context.warntype.species = 0;
context.warntype.polyd = 0;
g.context.warntype.speciesidx = NON_PM;
g.context.warntype.species = 0;
g.context.warntype.polyd = 0;
HWarn_of_mon &= ~FROMRACE;
switch (u.umonnum) {
@@ -1824,13 +1824,13 @@ polysense()
break;
case PM_VAMPIRE:
case PM_VAMPIRE_LORD:
context.warntype.polyd = M2_HUMAN | M2_ELF;
g.context.warntype.polyd = M2_HUMAN | M2_ELF;
HWarn_of_mon |= FROMRACE;
return;
}
if (warnidx >= LOW_PM) {
context.warntype.speciesidx = warnidx;
context.warntype.species = &mons[warnidx];
g.context.warntype.speciesidx = warnidx;
g.context.warntype.species = &mons[warnidx];
HWarn_of_mon |= FROMRACE;
}
}
+23 -23
View File
@@ -69,7 +69,7 @@ boolean talk;
You_feel("less %s now.", Hallucination ? "trippy" : "confused");
}
if ((xtime && !old) || (!xtime && old))
context.botl = TRUE;
g.context.botl = TRUE;
set_itimeout(&HConfusion, xtime);
}
@@ -98,7 +98,7 @@ boolean talk;
}
}
if ((!xtime && old) || (xtime && !old))
context.botl = TRUE;
g.context.botl = TRUE;
set_itimeout(&HStun, xtime);
}
@@ -133,7 +133,7 @@ int type;
}
set_itimeout(&Sick, xtime);
u.usick_type |= type;
context.botl = TRUE;
g.context.botl = TRUE;
} else if (old && (type & u.usick_type)) {
/* was sick, now not */
u.usick_type &= ~type;
@@ -146,7 +146,7 @@ int type;
You_feel("cured. What a relief!");
Sick = 0L; /* set_itimeout(&Sick, 0L) */
}
context.botl = TRUE;
g.context.botl = TRUE;
}
kptr = find_delayed_killer(SICK);
@@ -178,7 +178,7 @@ const char *msg;
#endif
set_itimeout(&Slimed, xtime);
if ((xtime != 0L) ^ (old != 0L)) {
context.botl = TRUE;
g.context.botl = TRUE;
if (msg)
pline("%s", msg);
}
@@ -202,7 +202,7 @@ const char *killername;
#endif
set_itimeout(&Stoned, xtime);
if ((xtime != 0L) ^ (old != 0L)) {
context.botl = TRUE;
g.context.botl = TRUE;
if (msg)
pline("%s", msg);
}
@@ -223,7 +223,7 @@ boolean talk;
talk = FALSE;
set_itimeout(&Vomiting, xtime);
context.botl = TRUE;
g.context.botl = TRUE;
if (!xtime && old)
if (talk)
You_feel("much less nauseated now.");
@@ -315,7 +315,7 @@ toggle_blindness()
boolean Stinging = (uwep && (EWarn_of_mon & W_WEP) != 0L);
/* blindness has just been toggled */
context.botl = TRUE; /* status conditions need update */
g.context.botl = TRUE; /* status conditions need update */
g.vision_full_recalc = 1; /* vision has changed */
/* this vision recalculation used to be deferred until moveloop(),
but that made it possible for vision irregularities to occur
@@ -405,7 +405,7 @@ long mask; /* nonzero if resistance status should change by mask */
(eg. Qt windowport's equipped items display) */
update_inventory();
context.botl = TRUE;
g.context.botl = TRUE;
if (talk)
pline(message, verb);
}
@@ -424,7 +424,7 @@ boolean talk;
set_itimeout(&HDeaf, xtime);
if ((xtime != 0L) ^ (old != 0L)) {
context.botl = TRUE;
g.context.botl = TRUE;
if (talk)
You(old ? "can hear again." : "are unable to hear anything.");
}
@@ -591,7 +591,7 @@ register struct obj *otmp;
WEAK or worse, but that's handled via ATEMP(A_STR) now */
if (ABASE(i) < lim) {
ABASE(i) = lim;
context.botl = 1;
g.context.botl = 1;
/* only first found if not blessed */
if (!otmp->blessed)
break;
@@ -1083,7 +1083,7 @@ register struct obj *otmp;
u.uen = u.uenmax;
else if (u.uen <= 0)
u.uen = 0;
context.botl = 1;
g.context.botl = 1;
exercise(A_WIS, TRUE);
break;
}
@@ -1163,7 +1163,7 @@ register boolean curesick, cureblind;
make_vomiting(0L, TRUE);
make_sick(0L, (char *) 0, TRUE, SICK_ALL);
}
context.botl = 1;
g.context.botl = 1;
return;
}
@@ -1567,7 +1567,7 @@ int how;
when inside a tended shop */
if (!shkp) /* if shkp was killed, unpaid ought to cleared already */
obj->unpaid = 0;
else if (context.mon_moving) /* obj thrown by monster */
else if (g.context.mon_moving) /* obj thrown by monster */
subfrombill(obj, shkp);
else /* obj thrown by hero */
(void) stolen_value(obj, u.ux, u.uy, (boolean) shkp->mpeaceful,
@@ -1610,7 +1610,7 @@ register struct obj *obj;
ABASE(i)++;
/* only first found if not blessed */
isdone = !(obj->blessed);
context.botl = 1;
g.context.botl = 1;
}
if (++i >= A_MAX)
i = 0;
@@ -1619,24 +1619,24 @@ register struct obj *obj;
break;
case POT_FULL_HEALING:
if (Upolyd && u.mh < u.mhmax)
u.mh++, context.botl = 1;
u.mh++, g.context.botl = 1;
if (u.uhp < u.uhpmax)
u.uhp++, context.botl = 1;
u.uhp++, g.context.botl = 1;
cureblind = TRUE;
/*FALLTHRU*/
case POT_EXTRA_HEALING:
if (Upolyd && u.mh < u.mhmax)
u.mh++, context.botl = 1;
u.mh++, g.context.botl = 1;
if (u.uhp < u.uhpmax)
u.uhp++, context.botl = 1;
u.uhp++, g.context.botl = 1;
if (!obj->cursed)
cureblind = TRUE;
/*FALLTHRU*/
case POT_HEALING:
if (Upolyd && u.mh < u.mhmax)
u.mh++, context.botl = 1;
u.mh++, g.context.botl = 1;
if (u.uhp < u.uhpmax)
u.uhp++, context.botl = 1;
u.uhp++, g.context.botl = 1;
if (obj->blessed)
cureblind = TRUE;
if (cureblind)
@@ -1656,7 +1656,7 @@ register struct obj *obj;
else
u.uhp -= 5;
}
context.botl = 1;
g.context.botl = 1;
exercise(A_CON, FALSE);
}
break;
@@ -2348,7 +2348,7 @@ struct monst *mon, /* monster being split */
if (mtmp2) {
mtmp2->mhpmax = u.mhmax / 2;
u.mhmax -= mtmp2->mhpmax;
context.botl = 1;
g.context.botl = 1;
You("multiply%s!", reason);
}
} else {
+7 -7
View File
@@ -344,7 +344,7 @@ int trouble;
}
You("can breathe again.");
Strangled = 0;
context.botl = 1;
g.context.botl = 1;
break;
case TROUBLE_LAVA:
You("are back on solid ground.");
@@ -358,7 +358,7 @@ int trouble;
case TROUBLE_HUNGRY:
Your("%s feels content.", body_part(STOMACH));
init_uhunger();
context.botl = 1;
g.context.botl = 1;
break;
case TROUBLE_SICK:
You_feel("better.");
@@ -384,14 +384,14 @@ int trouble;
if (u.uhpmax <= 5)
u.uhpmax = 5 + 1;
u.uhp = u.uhpmax;
context.botl = 1;
g.context.botl = 1;
break;
case TROUBLE_COLLAPSING:
/* override Fixed_abil; uncurse that if feasible */
You_feel("%sstronger.",
(AMAX(A_STR) - ABASE(A_STR) > 6) ? "much " : "");
ABASE(A_STR) = AMAX(A_STR);
context.botl = 1;
g.context.botl = 1;
if (Fixed_abil) {
if ((otmp = stuck_ring(uleft, RIN_SUSTAIN_ABILITY)) != 0) {
if (otmp == uleft)
@@ -503,7 +503,7 @@ int trouble;
for (i = 0; i < A_MAX; i++) {
if (ABASE(i) < AMAX(i)) {
ABASE(i) = AMAX(i);
context.botl = 1;
g.context.botl = 1;
}
}
(void) encumber_msg();
@@ -1071,7 +1071,7 @@ aligntyp g_align;
u.mh = u.mhmax;
if (ABASE(A_STR) < AMAX(A_STR)) {
ABASE(A_STR) = AMAX(A_STR);
context.botl = 1; /* before potential message */
g.context.botl = 1; /* before potential message */
(void) encumber_msg();
}
if (u.uhunger < 900)
@@ -1086,7 +1086,7 @@ aligntyp g_align;
rather than issuing a pat-on-head */
u.ucreamed = 0;
make_blinded(0L, TRUE);
context.botl = 1;
g.context.botl = 1;
break;
case 4: {
register struct obj *otmp;
+1 -1
View File
@@ -1518,7 +1518,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
else
u.uen = u.uenmax; /* otherwise restore current to max */
}
context.botl = 1;
g.context.botl = 1;
break;
}
/* known = TRUE; -- handled inline here */
+2 -2
View File
@@ -895,7 +895,7 @@ long ttl;
tmprect.hy--;
}
ff->ttl = ttl;
if (!g.in_mklev && !context.mon_moving)
if (!g.in_mklev && !g.context.mon_moving)
set_heros_fault(ff); /* assume player has created it */
/* ff->can_enter_f = enter_force_field; */
/* ff->can_leave_f = enter_force_field; */
@@ -1038,7 +1038,7 @@ int damage;
tmprect.hy--;
}
cloud->ttl = rn1(3, 4);
if (!g.in_mklev && !context.mon_moving)
if (!g.in_mklev && !g.context.mon_moving)
set_heros_fault(cloud); /* assume player has created it */
cloud->inside_f = INSIDE_GAS_CLOUD;
cloud->expire_f = EXPIRE_GAS_CLOUD;
+16 -16
View File
@@ -275,7 +275,7 @@ boolean ghostly, frozen;
otmp2->nobj = otmp;
if (ghostly) {
unsigned nid = context.ident++;
unsigned nid = g.context.ident++;
add_id_mapping(otmp->o_id, nid);
otmp->o_id = nid;
}
@@ -322,12 +322,12 @@ boolean ghostly, frozen;
otmp->bypass = 0;
if (!ghostly) {
/* fix the pointers */
if (otmp->o_id == context.victual.o_id)
context.victual.piece = otmp;
if (otmp->o_id == context.tin.o_id)
context.tin.tin = otmp;
if (otmp->o_id == context.spbook.o_id)
context.spbook.book = otmp;
if (otmp->o_id == g.context.victual.o_id)
g.context.victual.piece = otmp;
if (otmp->o_id == g.context.tin.o_id)
g.context.tin.tin = otmp;
if (otmp->o_id == g.context.spbook.o_id)
g.context.spbook.book = otmp;
}
otmp2 = otmp;
}
@@ -419,7 +419,7 @@ boolean ghostly;
mtmp2->nmon = mtmp;
if (ghostly) {
unsigned nid = context.ident++;
unsigned nid = g.context.ident++;
add_id_mapping(mtmp->m_id, nid);
mtmp->m_id = nid;
}
@@ -459,8 +459,8 @@ boolean ghostly;
restpriest(mtmp, ghostly);
if (!ghostly) {
if (mtmp->m_id == context.polearm.m_id)
context.polearm.hitmon = mtmp;
if (mtmp->m_id == g.context.polearm.m_id)
g.context.polearm.hitmon = mtmp;
}
mtmp2 = mtmp;
}
@@ -548,12 +548,12 @@ unsigned int *stuckid, *steedid;
return FALSE;
}
newgamecontext = context; /* copy statically init'd context */
mread(fd, (genericptr_t) &context, sizeof (struct context_info));
context.warntype.species = (context.warntype.speciesidx >= LOW_PM)
? &mons[context.warntype.speciesidx]
newgamecontext = g.context; /* copy statically init'd context */
mread(fd, (genericptr_t) &g.context, sizeof (struct context_info));
g.context.warntype.species = (g.context.warntype.speciesidx >= LOW_PM)
? &mons[g.context.warntype.speciesidx]
: (struct permonst *) 0;
/* context.victual.piece, .tin.tin, .spellbook.book, and .polearm.hitmon
/* g.context.victual.piece, .tin.tin, .spellbook.book, and .polearm.hitmon
are pointers which get set to Null during save and will be recovered
via corresponding o_id or m_id while objs or mons are being restored */
@@ -625,7 +625,7 @@ unsigned int *stuckid, *steedid;
#ifdef SYSFLAGS
sysflags = newgamesysflags;
#endif
context = newgamecontext;
g.context = newgamecontext;
return FALSE;
}
/* in case hangup save occurred in midst of level change */
+1 -1
View File
@@ -515,7 +515,7 @@ struct monst *oracl;
break;
}
money2mon(oracl, (long) u_pay);
context.botl = 1;
g.context.botl = 1;
add_xpts = 0; /* first oracle of each type gives experience points */
if (u_pay == minor_cost) {
outrumor(1, BY_ORACLE);
+13 -13
View File
@@ -284,7 +284,7 @@ register int fd, mode;
#endif
uid = (unsigned long) getuid();
bwrite(fd, (genericptr_t) &uid, sizeof uid);
bwrite(fd, (genericptr_t) &context, sizeof(struct context_info));
bwrite(fd, (genericptr_t) &g.context, sizeof(struct context_info));
bwrite(fd, (genericptr_t) &flags, sizeof(struct flag));
#ifdef SYSFLAGS
bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag));
@@ -1037,17 +1037,17 @@ register struct obj *otmp;
* Always invalidate the pointer, but ensure that we have
* the o_id in order to restore the pointer on reload.
*/
if (otmp == context.victual.piece) {
context.victual.o_id = otmp->o_id;
context.victual.piece = (struct obj *) 0;
if (otmp == g.context.victual.piece) {
g.context.victual.o_id = otmp->o_id;
g.context.victual.piece = (struct obj *) 0;
}
if (otmp == context.tin.tin) {
context.tin.o_id = otmp->o_id;
context.tin.tin = (struct obj *) 0;
if (otmp == g.context.tin.tin) {
g.context.tin.o_id = otmp->o_id;
g.context.tin.tin = (struct obj *) 0;
}
if (otmp == context.spbook.book) {
context.spbook.o_id = otmp->o_id;
context.spbook.book = (struct obj *) 0;
if (otmp == g.context.spbook.book) {
g.context.spbook.o_id = otmp->o_id;
g.context.spbook.book = (struct obj *) 0;
}
otmp->where = OBJ_FREE; /* set to free so dealloc will work */
otmp->nobj = NULL; /* nobj saved into otmp2 */
@@ -1146,9 +1146,9 @@ register struct monst *mtmp;
if (mtmp->minvent)
saveobjchn(fd, mtmp->minvent, mode);
if (release_data(mode)) {
if (mtmp == context.polearm.hitmon) {
context.polearm.m_id = mtmp->m_id;
context.polearm.hitmon = NULL;
if (mtmp == g.context.polearm.hitmon) {
g.context.polearm.m_id = mtmp->m_id;
g.context.polearm.hitmon = NULL;
}
mtmp->nmon = NULL; /* nmon saved into mtmp2 */
dealloc_monst(mtmp);
+9 -9
View File
@@ -118,7 +118,7 @@ long amount;
remove_worn_item(ygold, FALSE); /* quiver */
freeinv(ygold);
add_to_minv(mon, ygold);
context.botl = 1;
g.context.botl = 1;
return amount;
}
@@ -153,7 +153,7 @@ long amount;
dropy(mongold);
} else {
addinv(mongold);
context.botl = 1;
g.context.botl = 1;
}
}
@@ -1003,7 +1003,7 @@ register struct monst *shkp;
money2mon(shkp, balance);
else if (balance < 0)
money2u(shkp, -balance);
context.botl = 1;
g.context.botl = 1;
if (robbed) {
robbed -= tmp;
if (robbed < 0)
@@ -1445,7 +1445,7 @@ proceed:
eshkp->debit = 0L;
eshkp->loan = 0L;
You("pay that debt.");
context.botl = 1;
g.context.botl = 1;
} else {
dtmp -= eshkp->credit;
eshkp->credit = 0L;
@@ -1454,7 +1454,7 @@ proceed:
eshkp->loan = 0L;
pline("That debt is partially offset by your credit.");
You("pay the remainder.");
context.botl = 1;
g.context.botl = 1;
}
paid = TRUE;
}
@@ -1824,7 +1824,7 @@ int croaked;
eshkp->robbed = 0L;
if (umoney > 0L) {
money2mon(shkp, umoney);
context.botl = 1;
g.context.botl = 1;
}
pline("%s %s all your possessions.", Shknam(shkp), takes);
taken = TRUE;
@@ -1832,7 +1832,7 @@ int croaked;
set_repo_loc(shkp);
} else {
money2mon(shkp, loss);
context.botl = 1;
g.context.botl = 1;
pline("%s %s the %ld %s %sowed %s.", Shknam(shkp),
takes, loss, currency(loss),
strncmp(eshkp->customer, g.plname, PL_NSIZ) ? "" : "you ",
@@ -2699,7 +2699,7 @@ register struct monst *shkp;
otmp = newobj();
*otmp = *obj;
otmp->oextra = (struct oextra *) 0;
bp->bo_id = otmp->o_id = context.ident++;
bp->bo_id = otmp->o_id = g.context.ident++;
otmp->where = OBJ_FREE;
otmp->quan = (bp->bquan -= obj->quan);
otmp->owt = 0; /* superfluous */
@@ -4076,7 +4076,7 @@ boolean cant_mollify;
cost_of_damage = check_credit(cost_of_damage, shkp);
if (cost_of_damage > 0L) {
money2mon(shkp, cost_of_damage);
context.botl = 1;
g.context.botl = 1;
}
pline("Mollified, %s accepts your restitution.", shkname(shkp));
/* move shk back to his home loc */
+2 -2
View File
@@ -463,7 +463,7 @@ boolean mkspecl;
struct obj *novel = mksobj_at(SPE_NOVEL, sx, sy, FALSE, FALSE);
if (novel)
context.tribute.bookstock = TRUE;
g.context.tribute.bookstock = TRUE;
return;
}
@@ -748,7 +748,7 @@ register struct mkroom *sroom;
make_engr_at(m, n, buf, 0L, DUST);
}
if (context.tribute.enabled && !context.tribute.bookstock) {
if (g.context.tribute.enabled && !g.context.tribute.bookstock) {
/*
* Out of the number of spots where we're actually
* going to put stuff, randomly single out one in particular.
+2 -2
View File
@@ -26,7 +26,7 @@ take_gold()
You_feel("a strange sensation.");
} else {
You("notice you have no money!");
context.botl = 1;
g.context.botl = 1;
}
}
@@ -189,7 +189,7 @@ dosit()
make_blinded(0L, TRUE);
make_sick(0L, (char *) 0, FALSE, SICK_ALL);
heal_legs(0);
context.botl = 1;
g.context.botl = 1;
break;
case 5:
take_gold();
+5 -5
View File
@@ -365,7 +365,7 @@ register struct monst *mtmp;
growl_verb = growl_sound(mtmp);
if (growl_verb) {
pline("%s %s!", Monnam(mtmp), vtense((char *) 0, growl_verb));
if (context.run)
if (g.context.run)
nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 18);
}
@@ -408,7 +408,7 @@ register struct monst *mtmp;
}
if (yelp_verb) {
pline("%s %s!", Monnam(mtmp), vtense((char *) 0, yelp_verb));
if (context.run)
if (g.context.run)
nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 12);
}
@@ -442,7 +442,7 @@ register struct monst *mtmp;
}
if (whimper_verb) {
pline("%s %s.", Monnam(mtmp), vtense((char *) 0, whimper_verb));
if (context.run)
if (g.context.run)
nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6);
}
@@ -915,7 +915,7 @@ register struct monst *mtmp;
boolean ms_Death = (ptr == &mons[PM_DEATH]);
/* 3.6 tribute */
if (ms_Death && !context.tribute.Deathnotice
if (ms_Death && !g.context.tribute.Deathnotice
&& (book = u_have_novel()) != 0) {
if ((tribtitle = noveltitle(&book->novelidx)) != 0) {
Sprintf(verbuf, "Ah, so you have a copy of /%s/.", tribtitle);
@@ -925,7 +925,7 @@ register struct monst *mtmp;
Strcat(verbuf, " I may have been misquoted there.");
verbl_msg = verbuf;
}
context.tribute.Deathnotice = 1;
g.context.tribute.Deathnotice = 1;
} else if (ms_Death && rn2(3) && Death_quote(verbuf, sizeof verbuf)) {
verbl_msg = verbuf;
/* end of tribute addition */
+42 -42
View File
@@ -196,7 +196,7 @@ struct obj *spellbook;
gone = TRUE;
} else {
You("find yourself reading the %s line over and over again.",
spellbook == context.spbook.book ? "next" : "first");
spellbook == g.context.spbook.book ? "next" : "first");
}
return gone;
}
@@ -331,7 +331,7 @@ void
book_cursed(book)
struct obj *book;
{
if (g.occupation == learn && context.spbook.book == book
if (g.occupation == learn && g.context.spbook.book == book
&& book->cursed && book->bknown && g.multi >= 0)
stop_occupation();
}
@@ -343,24 +343,24 @@ learn(VOID_ARGS)
short booktype;
char splname[BUFSZ];
boolean costly = TRUE;
struct obj *book = context.spbook.book;
struct obj *book = g.context.spbook.book;
/* JDS: lenses give 50% faster reading; 33% smaller read time */
if (context.spbook.delay && ublindf && ublindf->otyp == LENSES && rn2(2))
context.spbook.delay++;
if (g.context.spbook.delay && ublindf && ublindf->otyp == LENSES && rn2(2))
g.context.spbook.delay++;
if (Confusion) { /* became confused while learning */
(void) confused_book(book);
context.spbook.book = 0; /* no longer studying */
context.spbook.o_id = 0;
nomul(context.spbook.delay); /* remaining delay is uninterrupted */
g.context.spbook.book = 0; /* no longer studying */
g.context.spbook.o_id = 0;
nomul(g.context.spbook.delay); /* remaining delay is uninterrupted */
g.multi_reason = "reading a book";
g.nomovemsg = 0;
context.spbook.delay = 0;
g.context.spbook.delay = 0;
return 0;
}
if (context.spbook.delay) {
/* not if (context.spbook.delay++), so at end delay == 0 */
context.spbook.delay++;
if (g.context.spbook.delay) {
/* not if (g.context.spbook.delay++), so at end delay == 0 */
g.context.spbook.delay++;
return 1; /* still busy */
}
exercise(A_WIS, TRUE); /* you're studying. */
@@ -422,15 +422,15 @@ learn(VOID_ARGS)
if (book->cursed) { /* maybe a demon cursed it */
if (cursed_book(book)) {
useup(book);
context.spbook.book = 0;
context.spbook.o_id = 0;
g.context.spbook.book = 0;
g.context.spbook.o_id = 0;
return 0;
}
}
if (costly)
check_unpaid(book);
context.spbook.book = 0;
context.spbook.o_id = 0;
g.context.spbook.book = 0;
g.context.spbook.o_id = 0;
return 0;
}
@@ -449,7 +449,7 @@ register struct obj *spellbook;
int dullbook = rnd(25) - ACURR(A_WIS);
/* adjust chance if hero stayed awake, got interrupted, retries */
if (context.spbook.delay && spellbook == context.spbook.book)
if (g.context.spbook.delay && spellbook == g.context.spbook.book)
dullbook -= rnd(objects[booktype].oc_level);
if (dullbook > 0) {
@@ -464,9 +464,9 @@ register struct obj *spellbook;
}
}
if (context.spbook.delay && !confused && spellbook == context.spbook.book
if (g.context.spbook.delay && !confused && spellbook == g.context.spbook.book
/* handle the sequence: start reading, get interrupted, have
context.spbook.book become erased somehow, resume reading it */
g.context.spbook.book become erased somehow, resume reading it */
&& booktype != SPE_BLANK_PAPER) {
You("continue your efforts to %s.",
(booktype == SPE_NOVEL) ? "read the novel" : "memorize the spell");
@@ -501,20 +501,20 @@ register struct obj *spellbook;
switch (objects[booktype].oc_level) {
case 1:
case 2:
context.spbook.delay = -objects[booktype].oc_delay;
g.context.spbook.delay = -objects[booktype].oc_delay;
break;
case 3:
case 4:
context.spbook.delay = -(objects[booktype].oc_level - 1)
g.context.spbook.delay = -(objects[booktype].oc_level - 1)
* objects[booktype].oc_delay;
break;
case 5:
case 6:
context.spbook.delay =
g.context.spbook.delay =
-objects[booktype].oc_level * objects[booktype].oc_delay;
break;
case 7:
context.spbook.delay = -8 * objects[booktype].oc_delay;
g.context.spbook.delay = -8 * objects[booktype].oc_delay;
break;
default:
impossible("Unknown spellbook level %d, book %d;",
@@ -555,10 +555,10 @@ register struct obj *spellbook;
if (too_hard) {
boolean gone = cursed_book(spellbook);
nomul(context.spbook.delay); /* study time */
nomul(g.context.spbook.delay); /* study time */
g.multi_reason = "reading a book";
g.nomovemsg = 0;
context.spbook.delay = 0;
g.context.spbook.delay = 0;
if (gone || !rn2(3)) {
if (!gone)
pline_The("spellbook crumbles to dust!");
@@ -573,10 +573,10 @@ register struct obj *spellbook;
if (!confused_book(spellbook)) {
spellbook->in_use = FALSE;
}
nomul(context.spbook.delay);
nomul(g.context.spbook.delay);
g.multi_reason = "reading a book";
g.nomovemsg = 0;
context.spbook.delay = 0;
g.context.spbook.delay = 0;
return 1;
}
spellbook->in_use = FALSE;
@@ -585,9 +585,9 @@ register struct obj *spellbook;
spellbook->otyp == SPE_BOOK_OF_THE_DEAD ? "recite" : "memorize");
}
context.spbook.book = spellbook;
if (context.spbook.book)
context.spbook.o_id = context.spbook.book->o_id;
g.context.spbook.book = spellbook;
if (g.context.spbook.book)
g.context.spbook.o_id = g.context.spbook.book->o_id;
set_occupation(learn, "studying", 0);
return 1;
}
@@ -598,9 +598,9 @@ void
book_disappears(obj)
struct obj *obj;
{
if (obj == context.spbook.book) {
context.spbook.book = (struct obj *) 0;
context.spbook.o_id = 0;
if (obj == g.context.spbook.book) {
g.context.spbook.book = (struct obj *) 0;
g.context.spbook.o_id = 0;
}
}
@@ -611,10 +611,10 @@ void
book_substitution(old_obj, new_obj)
struct obj *old_obj, *new_obj;
{
if (old_obj == context.spbook.book) {
context.spbook.book = new_obj;
if (context.spbook.book)
context.spbook.o_id = context.spbook.book->o_id;
if (old_obj == g.context.spbook.book) {
g.context.spbook.book = new_obj;
if (g.context.spbook.book)
g.context.spbook.o_id = g.context.spbook.book->o_id;
}
}
@@ -952,7 +952,7 @@ boolean atme;
u.uen -= rnd(2 * energy);
if (u.uen < 0)
u.uen = 0;
context.botl = 1;
g.context.botl = 1;
res = 1; /* time is going to elapse even if spell doesn't get cast */
}
@@ -1014,12 +1014,12 @@ boolean atme;
if (confused || (rnd(100) > chance)) {
You("fail to cast the spell correctly.");
u.uen -= energy / 2;
context.botl = 1;
g.context.botl = 1;
return 1;
}
u.uen -= energy;
context.botl = 1;
g.context.botl = 1;
exercise(A_WIS, TRUE);
/* pseudo is a temporary "false" object containing the spell stats */
pseudo = mksobj(spellid(spell), FALSE, FALSE);
@@ -1278,8 +1278,8 @@ losespells()
int n, nzap, i;
/* in case reading has been interrupted earlier, discard context */
context.spbook.book = 0;
context.spbook.o_id = 0;
g.context.spbook.book = 0;
g.context.spbook.o_id = 0;
/* count the number of known spells */
for (n = 0; n < MAXSPELL; ++n)
if (spellid(n) == NO_SPELL)
+1 -1
View File
@@ -135,7 +135,7 @@ register struct monst *mtmp;
if (!tele_restrict(mtmp))
(void) rloc(mtmp, TRUE);
monflee(mtmp, 0, FALSE, FALSE);
context.botl = 1;
g.context.botl = 1;
}
}
+3 -3
View File
@@ -354,7 +354,7 @@ boolean force; /* Quietly force this animal */
u.usteed = mtmp;
remove_monster(mtmp->mx, mtmp->my);
teleds(mtmp->mx, mtmp->my, TRUE);
context.botl = TRUE;
g.context.botl = TRUE;
return TRUE;
}
@@ -676,11 +676,11 @@ int reason; /* Player was thrown off etc. */
g.in_steed_dismounting = TRUE;
(void) float_down(0L, W_SADDLE);
g.in_steed_dismounting = FALSE;
context.botl = TRUE;
g.context.botl = TRUE;
(void) encumber_msg();
g.vision_full_recalc = 1;
} else
context.botl = TRUE;
g.context.botl = TRUE;
/* polearms behave differently when not mounted */
if (uwep && is_pole(uwep))
g.unweapon = TRUE;
+2 -2
View File
@@ -584,7 +584,7 @@ boolean break_the_rules;
} else {
if (!break_the_rules) {
u.uen -= energy;
context.botl = 1;
g.context.botl = 1;
}
}
}
@@ -847,7 +847,7 @@ level_tele()
schedule_goto(&newlevel, FALSE, FALSE, 0, (char *) 0, (char *) 0);
/* in case player just read a scroll and is about to be asked to
call it something, we can't defer until the end of the turn */
if (u.utotype && !context.mon_moving)
if (u.utotype && !g.context.mon_moving)
deferred_goto();
}
+8 -8
View File
@@ -587,7 +587,7 @@ nh_timeout()
case DEAF:
set_itimeout(&HDeaf, 1L);
make_deaf(0L, TRUE);
context.botl = TRUE;
g.context.botl = TRUE;
if (!Deaf)
stop_occupation();
break;
@@ -632,7 +632,7 @@ nh_timeout()
case FLYING:
/* timed Flying is via #wizintrinsic only */
if (was_flying && !Flying) {
context.botl = 1;
g.context.botl = 1;
You("land.");
spoteffects(TRUE);
}
@@ -640,11 +640,11 @@ nh_timeout()
case WARN_OF_MON:
/* timed Warn_of_mon is via #wizintrinsic only */
if (!Warn_of_mon) {
context.warntype.speciesidx = NON_PM;
if (context.warntype.species) {
g.context.warntype.speciesidx = NON_PM;
if (g.context.warntype.species) {
You("are no longer warned about %s.",
makeplural(context.warntype.species->mname));
context.warntype.species = (struct permonst *) 0;
makeplural(g.context.warntype.species->mname));
g.context.warntype.species = (struct permonst *) 0;
}
}
break;
@@ -714,7 +714,7 @@ boolean wakeup_msg;
/* caller can follow with a direct call to Hear_again() if
there's a need to override this when wakeup_msg is true */
incr_itimeout(&HDeaf, how_long);
context.botl = TRUE;
g.context.botl = TRUE;
g.afternmv = Hear_again; /* this won't give any messages */
}
/* early wakeup from combat won't be possible until next monster turn */
@@ -1579,7 +1579,7 @@ do_storms()
/* Even if already deaf, we sense the thunder's vibrations. */
pline("Kaboom!!! Boom!! Boom!!");
incr_itimeout(&HDeaf, rn1(20, 30));
context.botl = TRUE;
g.context.botl = TRUE;
if (!u.uinvulnerable) {
stop_occupation();
nomul(-3);
+13 -13
View File
@@ -405,7 +405,7 @@ int x, y, typ;
&& (is_hole(typ) || IS_DOOR(lev->typ) || IS_WALL(lev->typ)))
add_damage(x, y, /* schedule repair */
((IS_DOOR(lev->typ) || IS_WALL(lev->typ))
&& !context.mon_moving)
&& !g.context.mon_moving)
? SHOP_HOLE_COST
: 0L);
lev->doormask = 0; /* subsumes altarmask, icedpool... */
@@ -681,7 +681,7 @@ int *fail_reason;
/* if this isn't caused by a monster using a wand of striking,
there might be consequences for the hero */
if (!context.mon_moving) {
if (!g.context.mon_moving) {
/* if statue is owned by a shop, hero will have to pay for it;
stolen_value gives a message (about debt or use of credit)
which refers to "it" so needs to follow a message describing
@@ -1766,12 +1766,12 @@ int style;
}
newsym(x1, y1);
/* in case you're using a pick-axe to chop the boulder that's being
launched (perhaps a monster triggered it), destroy context so that
launched (perhaps a monster triggered it), destroy g.context so that
next dig attempt never thinks you're resuming previous effort */
if ((otyp == BOULDER || otyp == STATUE)
&& singleobj->ox == context.digging.pos.x
&& singleobj->oy == context.digging.pos.y)
(void) memset((genericptr_t) &context.digging, 0,
&& singleobj->ox == g.context.digging.pos.x
&& singleobj->oy == g.context.digging.pos.y)
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof(struct dig_info));
dist = distmin(x1, y1, x2, y2);
@@ -2810,7 +2810,7 @@ boolean byplayer;
void
float_up()
{
context.botl = TRUE;
g.context.botl = TRUE;
if (u.utrap) {
if (u.utraptype == TT_PIT) {
reset_utrap(FALSE);
@@ -2921,7 +2921,7 @@ long hmask, emask; /* might cancel timeout */
(void) encumber_msg(); /* carrying capacity might have changed */
return 0;
}
context.botl = TRUE;
g.context.botl = TRUE;
nomul(0); /* stop running or resting */
if (BFlying) {
/* controlled flight no longer overridden by levitation */
@@ -3137,11 +3137,11 @@ struct obj *box; /* null for floor trap */
if (alt > num)
num = alt;
if (u.mhmax > mons[u.umonnum].mlevel)
u.mhmax -= rn2(min(u.mhmax, num + 1)), context.botl = 1;
u.mhmax -= rn2(min(u.mhmax, num + 1)), g.context.botl = 1;
} else {
num = d(2, 4);
if (u.uhpmax > u.ulevel)
u.uhpmax -= rn2(min(u.uhpmax, num + 1)), context.botl = 1;
u.uhpmax -= rn2(min(u.uhpmax, num + 1)), g.context.botl = 1;
}
if (!num)
You("are uninjured.");
@@ -3185,12 +3185,12 @@ domagictrap()
if (!Deaf) {
You_hear("a deafening roar!");
incr_itimeout(&HDeaf, rn1(20, 30));
context.botl = TRUE;
g.context.botl = TRUE;
} else {
/* magic vibrations still hit you */
You_feel("rankled.");
incr_itimeout(&HDeaf, rn1(5, 15));
context.botl = TRUE;
g.context.botl = TRUE;
}
while (cnt--)
(void) makemon((struct permonst *) 0, u.ux, u.uy, NO_MM_FLAGS);
@@ -3874,7 +3874,7 @@ int n;
u.uenmax = 0;
u.uen = 0;
}
context.botl = 1;
g.context.botl = 1;
}
}
+8 -8
View File
@@ -104,7 +104,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
if (u.uswallow && mtmp == u.ustuck)
return FALSE;
if (context.forcefight) {
if (g.context.forcefight) {
/* Do this in the caller, after we checked that the monster
* didn't die from the blow. Reason: putting the 'I' there
* causes the hero to forget the square's contents since
@@ -216,7 +216,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp));
if (!paranoid_query(ParanoidHit, qbuf)) {
context.move = 0;
g.context.move = 0;
return TRUE;
}
}
@@ -336,7 +336,7 @@ register struct monst *mtmp;
* you'll usually just swap places if this is a movement command
*/
/* Intelligent chaotic weapons (Stormbringer) want blood */
if (is_safepet(mtmp) && !context.forcefight) {
if (is_safepet(mtmp) && !g.context.forcefight) {
if (!uwep || uwep->oartifact != ART_STORMBRINGER) {
/* There are some additional considerations: this won't work
* if in a shop or Punished or you miss a random roll or
@@ -366,13 +366,13 @@ register struct monst *mtmp;
Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf);
context.travel = context.travel1 = context.mv = context.run
g.context.travel = g.context.travel1 = g.context.mv = g.context.run
= 0;
return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp));
context.travel = context.travel1 = context.mv = context.run
g.context.travel = g.context.travel1 = g.context.mv = g.context.run
= 0;
return TRUE;
} else
@@ -443,7 +443,7 @@ register struct monst *mtmp;
* and it returned 0 (it's okay to attack), and the monster didn't
* evade.
*/
if (context.forcefight && !DEADMONSTER(mtmp) && !canspotmon(mtmp)
if (g.context.forcefight && !DEADMONSTER(mtmp) && !canspotmon(mtmp)
&& !glyph_is_invisible(levl[u.ux + u.dx][u.uy + u.dy].glyph)
&& !(u.uswallow && mtmp == u.ustuck))
map_invisible(u.ux + u.dx, u.uy + u.dy);
@@ -2882,7 +2882,7 @@ struct obj *otmp; /* source of flash */
light_hits_gremlin(mtmp, amt);
}
if (!DEADMONSTER(mtmp)) {
if (!context.mon_moving)
if (!g.context.mon_moving)
setmangry(mtmp, TRUE);
if (tmp < 9 && !mtmp->isshk && rn2(4))
monflee(mtmp, rn2(4) ? rnd(100) : 0, FALSE, TRUE);
@@ -2904,7 +2904,7 @@ int dmg;
mon->mhp -= dmg;
wake_nearto(mon->mx, mon->my, 30);
if (DEADMONSTER(mon)) {
if (context.mon_moving)
if (g.context.mon_moving)
monkilled(mon, (char *) 0, AD_BLND);
else
killed(mon);
+2 -2
View File
@@ -153,8 +153,8 @@ struct monst *grd;
{
/* either guard is dead or will now be treated as if so;
monster traversal loops should skip it */
if (grd == context.polearm.hitmon)
context.polearm.hitmon = 0;
if (grd == g.context.polearm.hitmon)
g.context.polearm.hitmon = 0;
if (grd->mx) {
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
+4 -4
View File
@@ -100,7 +100,7 @@ register struct obj *obj;
if (uwep == obj
&& ((uwep && uwep->oartifact == ART_OGRESMASHER)
|| (olduwep && olduwep->oartifact == ART_OGRESMASHER)))
context.botl = 1;
g.context.botl = 1;
/* Note: Explicitly wielding a pick-axe will not give a "bashing"
* message. Wielding one via 'a'pplying it will.
* 3.2.2: Wielding arbitrary objects will give bashing message too.
@@ -363,7 +363,7 @@ dowieldquiver()
/* will_weld(), touch_petrifies(), etc. */
g.multi = 0;
/* forget last splitobj() before calling getobj() with ALLOW_COUNT */
context.objsplit.child_oid = context.objsplit.parent_oid = 0;
g.context.objsplit.child_oid = g.context.objsplit.parent_oid = 0;
/* Prompt for a new quiver: "What do you want to ready?"
(Include gems/stones as likely candidates if either primary
@@ -388,11 +388,11 @@ dowieldquiver()
You("already have no ammunition readied!");
}
return 0;
} else if (newquiver->o_id == context.objsplit.child_oid) {
} else if (newquiver->o_id == g.context.objsplit.child_oid) {
/* if newquiver is the result of supplying a count to getobj()
we don't want to split something already in the quiver;
for any other item, we need to give it its own inventory slot */
if (uquiver && uquiver->o_id == context.objsplit.parent_oid) {
if (uquiver && uquiver->o_id == g.context.objsplit.parent_oid) {
unsplitobj(newquiver);
goto already_quivered;
}
+4 -4
View File
@@ -83,7 +83,7 @@ amulet()
}
}
if (!context.no_of_wizards)
if (!g.context.no_of_wizards)
return;
/* find Wizard, and wake him if necessary */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
@@ -296,7 +296,7 @@ register struct monst *mtmp;
break;
}
if (context.made_amulet)
if (g.context.made_amulet)
if ((strat = target_on(M3_WANTSAMUL, mtmp)) != STRAT_NONE)
return strat;
@@ -627,7 +627,7 @@ resurrect()
long elapsed;
const char *verb;
if (!context.no_of_wizards) {
if (!g.context.no_of_wizards) {
/* make a new Wizard */
verb = "kill";
mtmp = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, MM_NOWAIT);
@@ -705,7 +705,7 @@ intervene()
void
wizdead()
{
context.no_of_wizards--;
g.context.no_of_wizards--;
if (!u.uevent.udemigod) {
u.uevent.udemigod = TRUE;
u.udg_cnt = rn1(250, 50);
+2 -2
View File
@@ -382,7 +382,7 @@ boolean cuttier; /* hit is by wielded blade or axe or by thrown axe */
/* Sometimes the tail end dies. */
if (!new_worm) {
place_worm_seg(worm, x, y); /* place the "head" segment back */
if (context.mon_moving) {
if (g.context.mon_moving) {
if (canspotmon(worm))
pline("Part of %s tail has been cut off.",
s_suffix(mon_nam(worm)));
@@ -416,7 +416,7 @@ boolean cuttier; /* hit is by wielded blade or axe or by thrown axe */
/* Place the new monster at all the segment locations. */
place_wsegs(new_worm, worm);
if (context.mon_moving)
if (g.context.mon_moving)
pline("%s is cut in half.", Monnam(worm));
else
You("cut %s in half.", mon_nam(worm));
+4 -4
View File
@@ -713,7 +713,7 @@ clear_bypasses()
/*
* 'Object' bypass is also used for one monster function:
* polymorph control of long worms. Activated via setting
* context.bypasses even if no specific object has been
* g.context.bypasses even if no specific object has been
* bypassed.
*/
@@ -763,7 +763,7 @@ clear_bypasses()
be just created by polymorph and migrating at the same time */
}
/* g.billobjs and g.mydogs chains don't matter here */
context.bypasses = FALSE;
g.context.bypasses = FALSE;
}
void
@@ -771,7 +771,7 @@ bypass_obj(obj)
struct obj *obj;
{
obj->bypass = 1;
context.bypasses = TRUE;
g.context.bypasses = TRUE;
}
/* set or clear the bypass bit in a list of objects */
@@ -781,7 +781,7 @@ struct obj *objchain;
boolean on; /* TRUE => set, FALSE => clear */
{
if (on && objchain)
context.bypasses = TRUE;
g.context.bypasses = TRUE;
while (objchain) {
objchain->bypass = on ? 1 : 0;
objchain = objchain->nobj;
+29 -29
View File
@@ -205,7 +205,7 @@ struct obj *otmp;
dmg *= 2;
if (otyp == SPE_TURN_UNDEAD)
dmg = spell_damage_bonus(dmg);
context.bypasses = TRUE; /* for make_corpse() */
g.context.bypasses = TRUE; /* for make_corpse() */
if (!resist(mtmp, otmp->oclass, dmg, NOTELL)) {
if (!DEADMONSTER(mtmp))
monflee(mtmp, 0, FALSE, TRUE);
@@ -244,7 +244,7 @@ struct obj *otmp;
pline("%s shudders!", Monnam(mtmp));
learn_it = TRUE;
}
/* context.bypasses = TRUE; ## for make_corpse() */
/* g.context.bypasses = TRUE; ## for make_corpse() */
/* no corpse after system shock */
xkilled(mtmp, XKILL_GIVEMSG | XKILL_NOCORPSE);
} else if (newcham(mtmp, (struct permonst *) 0,
@@ -273,7 +273,7 @@ struct obj *otmp;
/* flag to indicate that cleanup is needed; object
bypass cleanup also clears mon->mextra->mcorpsenm
for all long worms on the level */
context.bypasses = TRUE;
g.context.bypasses = TRUE;
}
}
break;
@@ -975,7 +975,7 @@ struct monst *mon;
}
/* for a stack, only one is revived */
if ((mtmp2 = revive(otmp, !context.mon_moving)) != 0) {
if ((mtmp2 = revive(otmp, !g.context.mon_moving)) != 0) {
++res;
if (youseeit)
pline("%s%s suddenly comes alive!", owner, corpse);
@@ -998,19 +998,19 @@ register struct obj *obj;
case RIN_GAIN_STRENGTH:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_STR) -= obj->spe;
context.botl = 1;
g.context.botl = 1;
}
break;
case RIN_GAIN_CONSTITUTION:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CON) -= obj->spe;
context.botl = 1;
g.context.botl = 1;
}
break;
case RIN_ADORNMENT:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CHA) -= obj->spe;
context.botl = 1;
g.context.botl = 1;
}
break;
case RIN_INCREASE_ACCURACY:
@@ -1024,14 +1024,14 @@ register struct obj *obj;
case GAUNTLETS_OF_DEXTERITY:
if ((obj->owornmask & W_ARMG) && (obj == uarmg)) {
ABON(A_DEX) -= obj->spe;
context.botl = 1;
g.context.botl = 1;
}
break;
case HELM_OF_BRILLIANCE:
if ((obj->owornmask & W_ARMH) && (obj == uarmh)) {
ABON(A_INT) -= obj->spe;
ABON(A_WIS) -= obj->spe;
context.botl = 1;
g.context.botl = 1;
}
break;
/* case RIN_PROTECTION: not needed */
@@ -1116,19 +1116,19 @@ boolean by_you;
case RIN_GAIN_STRENGTH:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_STR)--;
context.botl = 1;
g.context.botl = 1;
}
break;
case RIN_GAIN_CONSTITUTION:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CON)--;
context.botl = 1;
g.context.botl = 1;
}
break;
case RIN_ADORNMENT:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CHA)--;
context.botl = 1;
g.context.botl = 1;
}
break;
case RIN_INCREASE_ACCURACY:
@@ -1141,25 +1141,25 @@ boolean by_you;
break;
case RIN_PROTECTION:
if (u_ring)
context.botl = 1; /* bot() will recalc u.uac */
g.context.botl = 1; /* bot() will recalc u.uac */
break;
case HELM_OF_BRILLIANCE:
if ((obj->owornmask & W_ARMH) && (obj == uarmh)) {
ABON(A_INT)--;
ABON(A_WIS)--;
context.botl = 1;
g.context.botl = 1;
}
break;
case GAUNTLETS_OF_DEXTERITY:
if ((obj->owornmask & W_ARMG) && (obj == uarmg)) {
ABON(A_DEX)--;
context.botl = 1;
g.context.botl = 1;
}
break;
default:
break;
}
if (context.botl)
if (g.context.botl)
bot();
if (carried(obj))
update_inventory();
@@ -1190,7 +1190,7 @@ struct obj *obj;
{
int zap_odds;
if (context.bypasses && obj->bypass)
if (g.context.bypasses && obj->bypass)
return FALSE;
if (obj->oclass == WAND_CLASS)
@@ -1223,7 +1223,7 @@ int mat, minwt;
for (otmp = objhdr; minwt > 0 && otmp; otmp = otmp2) {
otmp2 = otmp->nexthere;
if (context.bypasses && otmp->bypass)
if (g.context.bypasses && otmp->bypass)
continue;
if (otmp == uball || otmp == uchain)
continue;
@@ -1267,7 +1267,7 @@ int okind;
const char *material;
int pm_index;
if (context.bypasses) {
if (g.context.bypasses) {
/* this is approximate because the "no golems" !obj->nexthere
check below doesn't understand bypassed objects; but it
should suffice since bypassed objects always end up as a
@@ -1845,13 +1845,13 @@ struct obj *obj, *otmp;
* chain, possibly recursively.
*
* The bypass bit on all objects is reset each turn, whenever
* context.bypasses is set.
* g.context.bypasses is set.
*
* We check the obj->bypass bit above AND context.bypasses
* We check the obj->bypass bit above AND g.context.bypasses
* as a safeguard against any stray occurrence left in an obj
* struct someplace, although that should never happen.
*/
if (context.bypasses) {
if (g.context.bypasses) {
return 0;
} else {
debugpline1("%s for a moment.", Tobjnam(obj, "pulsate"));
@@ -1960,7 +1960,7 @@ struct obj *obj, *otmp;
} else {
int oox = obj->ox;
int ooy = obj->oy;
if (context.mon_moving
if (g.context.mon_moving
? !breaks(obj, obj->ox, obj->oy)
: !hero_breaks(obj, obj->ox, obj->oy, FALSE))
maybelearnit = FALSE; /* nothing broke */
@@ -2689,7 +2689,7 @@ boolean youattack, allow_cancel_kill, self_cancel;
otmp = otmp->nobj)
cancel_item(otmp);
if (youdefend) {
context.botl = 1; /* potential AC change */
g.context.botl = 1; /* potential AC change */
find_ac();
}
}
@@ -4326,15 +4326,15 @@ long timeout UNUSED;
{
xchar x, y;
long where = arg->a_long;
boolean save_mon_moving = context.mon_moving; /* will be False */
boolean save_mon_moving = g.context.mon_moving; /* will be False */
/* melt_ice -> minliquid -> mondead|xkilled shouldn't credit/blame hero */
context.mon_moving = TRUE; /* hero isn't causing this ice to melt */
g.context.mon_moving = TRUE; /* hero isn't causing this ice to melt */
y = (xchar) (where & 0xFFFF);
x = (xchar) ((where >> 16) & 0xFFFF);
/* melt_ice does newsym when appropriate */
melt_ice(x, y, "Some ice melts away.");
context.mon_moving = save_mon_moving;
g.context.mon_moving = save_mon_moving;
}
/* Burn floor scrolls, evaporate pools, etc... in a single square.
@@ -4638,7 +4638,7 @@ fracture_rock(obj)
register struct obj *obj; /* no texts here! */
{
xchar x, y;
boolean by_you = !context.mon_moving;
boolean by_you = !g.context.mon_moving;
if (by_you && get_obj_location(obj, &x, &y, 0) && costly_spot(x, y)) {
struct monst *shkp = 0;
@@ -4680,7 +4680,7 @@ register struct obj *obj;
/* [obj is assumed to be on floor, so no get_obj_location() needed] */
struct trap *trap = t_at(obj->ox, obj->oy);
struct obj *item;
boolean by_you = !context.mon_moving;
boolean by_you = !g.context.mon_moving;
if (trap && trap->ttyp == STATUE_TRAP
&& activate_statue_trap(trap, obj->ox, obj->oy, TRUE))