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