Moved decl.c globals into instance globals.

This commit is contained in:
Bart House
2018-12-22 18:44:22 -08:00
parent 6c0df43a17
commit 74edf42f1c
83 changed files with 818 additions and 824 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ struct context_info {
/* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */ /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
/* 8: travel */ /* 8: travel */
unsigned startingpet_mid; unsigned startingpet_mid;
int current_fruit; /* fruit->fid corresponding to pl_fruit[] */ int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */
int warnlevel; int warnlevel;
int rndencode; /* randomized escape sequence introducer */ int rndencode; /* randomized escape sequence introducer */
long next_attrib_check; /* next attribute check */ long next_attrib_check; /* next attribute check */
+47 -46
View File
@@ -86,35 +86,19 @@ E struct dgn_topology { /* special dungeon levels for speed */
#define sokoend_level (dungeon_topology.d_sokoend_level) #define sokoend_level (dungeon_topology.d_sokoend_level)
/* clang-format on */ /* clang-format on */
E NEARDATA stairway dnstair, upstair; /* stairs up and down */ #define xdnstair (g.dnstair.sx)
#define xdnstair (dnstair.sx) #define ydnstair (g.dnstair.sy)
#define ydnstair (dnstair.sy) #define xupstair (g.upstair.sx)
#define xupstair (upstair.sx) #define yupstair (g.upstair.sy)
#define yupstair (upstair.sy)
E NEARDATA stairway dnladder, upladder; /* ladders up and down */ #define xdnladder (g.dnladder.sx)
#define xdnladder (dnladder.sx) #define ydnladder (g.dnladder.sy)
#define ydnladder (dnladder.sy) #define xupladder (g.upladder.sx)
#define xupladder (upladder.sx) #define yupladder (g.upladder.sy)
#define yupladder (upladder.sy)
E NEARDATA stairway sstairs; #define dunlev_reached(x) (g.dungeons[(x)->dnum].dunlev_ureached)
E NEARDATA dest_area updest, dndest; /* level-change destination areas */
E NEARDATA coord inv_pos;
E NEARDATA dungeon dungeons[];
E NEARDATA s_level *sp_levchn;
#define dunlev_reached(x) (dungeons[(x)->dnum].dunlev_ureached)
#include "quest.h" #include "quest.h"
E struct q_score quest_status;
E NEARDATA char pl_character[PL_CSIZ];
E NEARDATA char pl_race; /* character's race */
E NEARDATA char pl_fruit[PL_FSIZ];
E NEARDATA struct fruit *ffruit;
E NEARDATA char tune[6]; E NEARDATA char tune[6];
@@ -140,9 +124,6 @@ E NEARDATA struct sinfo {
int wizkit_wishing; int wizkit_wishing;
} program_state; } program_state;
E boolean restoring;
E boolean ransacked;
E const char quitchars[]; E const char quitchars[];
E const char vowels[]; E const char vowels[];
E const char ynchars[]; E const char ynchars[];
@@ -153,10 +134,6 @@ E NEARDATA long yn_number;
E const char disclosure_options[]; E const char disclosure_options[];
E NEARDATA int smeq[];
E NEARDATA int doorindex;
E NEARDATA char *save_cm;
E NEARDATA struct kinfo { E NEARDATA struct kinfo {
struct kinfo *next; /* chain of delayed killers */ struct kinfo *next; /* chain of delayed killers */
int id; /* uprop keys to ID a delayed killer */ int id; /* uprop keys to ID a delayed killer */
@@ -167,36 +144,24 @@ E NEARDATA struct kinfo {
char name[BUFSZ]; /* actual killer name */ char name[BUFSZ]; /* actual killer name */
} killer; } killer;
E long done_money;
E NEARDATA char plname[PL_NSIZ];
E NEARDATA char dogname[]; E NEARDATA char dogname[];
E NEARDATA char catname[]; E NEARDATA char catname[];
E NEARDATA char horsename[]; E NEARDATA char horsename[];
E char preferred_pet; E char preferred_pet;
E const char *occtxt; /* defined when occupation != NULL */
E const char *nomovemsg;
E char lock[]; E char lock[];
E const schar xdir[], ydir[], zdir[]; E const schar xdir[], ydir[], zdir[];
E NEARDATA schar tbx, tby; /* set in mthrowu.c */ struct multishot {
E NEARDATA struct multishot {
int n, i; int n, i;
short o; short o;
boolean s; boolean s;
} m_shot; };
E NEARDATA long moves, monstermoves; E NEARDATA long moves, monstermoves;
E NEARDATA long wailmsg; E NEARDATA long wailmsg;
E NEARDATA boolean in_mklev;
E NEARDATA boolean stoned;
E NEARDATA boolean unweapon;
E NEARDATA boolean mrg_to_wielded;
E NEARDATA boolean defer_see_monsters;
E NEARDATA boolean in_steed_dismounting; E NEARDATA boolean in_steed_dismounting;
E const int shield_static[]; E const int shield_static[];
@@ -692,6 +657,38 @@ struct instance_globals {
int y_maze_max; int y_maze_max;
int otg_temp; /* used by object_to_glyph() [otg] */ int otg_temp; /* used by object_to_glyph() [otg] */
int in_doagain; int in_doagain;
stairway dnstair; /* stairs down */
stairway upstair; /* stairs up */
stairway dnladder; /* ladder down */
stairway upladder; /* ladder up */
int smeq[MAXNROFROOMS + 1];
int doorindex;
char *save_cm;
long done_money;
const char *nomovemsg;
char plname[PL_NSIZ]; /* player name */
char pl_character[PL_CSIZ];
char pl_race; /* character's race */
char pl_fruit[PL_FSIZ];
struct fruit *ffruit;
char tune[6];
const char *occtxt; /* defined when occupation != NULL */
schar tbx; /* mthrowu: target x */
schar tby; /* mthrowu: target y */
s_level * sp_levchn;
/* for xname handling of multiple shot missile volleys:
number of shots, index of current one, validity check, shoot vs throw */
struct multishot m_shot;
dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
stairway sstairs;
dest_area updest;
dest_area dndest;
coord inv_pos;
boolean defer_see_monsters;
boolean in_mklev;
boolean stoned; /* done to monsters hit by 'c' */
boolean unweapon;
boolean mrg_to_wielded; /* weapon picked is merged with wielded one */
/* dig.c */ /* dig.c */
@@ -834,6 +831,7 @@ struct instance_globals {
struct bubble *ebubbles; struct bubble *ebubbles;
struct trap *wportal; struct trap *wportal;
int xmin, ymin, xmax, ymax; /* level boundaries */ int xmin, ymin, xmax, ymax; /* level boundaries */
boolean ransacked;
/* mon.c */ /* mon.c */
boolean vamp_rise_msg; boolean vamp_rise_msg;
@@ -910,6 +908,9 @@ struct instance_globals {
int p_trouble; int p_trouble;
int p_type; /* (-1)-3: (-1)=really naughty, 3=really good */ int p_type; /* (-1)-3: (-1)=really naughty, 3=really good */
/* quest.c */
struct q_score quest_status;
/* questpgr.c */ /* questpgr.c */
char cvt_buf[CVT_BUF_SIZE]; char cvt_buf[CVT_BUF_SIZE];
struct qtlists qt_list; struct qtlists qt_list;
+1 -1
View File
@@ -238,7 +238,7 @@ struct instance_flags {
* a structure of their own elsewhere some day. * a structure of their own elsewhere some day.
*/ */
boolean debug_fuzzer; /* fuzz testing */ boolean debug_fuzzer; /* fuzz testing */
boolean defer_plname; /* X11 hack: askname() might not set plname */ boolean defer_plname; /* X11 hack: askname() might not set g.plname */
boolean herecmd_menu; /* use menu when mouseclick on yourself */ boolean herecmd_menu; /* use menu when mouseclick on yourself */
boolean invis_goldsym; /* gold symbol is ' '? */ boolean invis_goldsym; /* gold symbol is ' '? */
int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */ int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */
+1 -1
View File
@@ -534,7 +534,7 @@ struct damage {
an existing bones level; if so, most recent victim will be first in list */ an existing bones level; if so, most recent victim will be first in list */
struct cemetery { struct cemetery {
struct cemetery *next; /* next struct is previous dead character... */ struct cemetery *next; /* next struct is previous dead character... */
/* "plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */ /* "g.plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */
char who[PL_NSIZ + 4 * (1 + 3) + 1]; char who[PL_NSIZ + 4 * (1 + 3) + 1];
/* death reason, same as in score/log file */ /* death reason, same as in score/log file */
char how[100 + 1]; /* [DTHSZ+1] */ char how[100 + 1]; /* [DTHSZ+1] */
+17 -17
View File
@@ -62,8 +62,8 @@ boolean resuming;
} }
(void) encumber_msg(); /* in case they auto-picked up something */ (void) encumber_msg(); /* in case they auto-picked up something */
if (defer_see_monsters) { if (g.defer_see_monsters) {
defer_see_monsters = FALSE; g.defer_see_monsters = FALSE;
see_monsters(); see_monsters();
} }
initrack(); initrack();
@@ -411,7 +411,7 @@ boolean resuming;
domove(); domove();
} else { } else {
--g.multi; --g.multi;
rhack(save_cm); rhack(g.save_cm);
} }
} else if (g.multi == 0) { } else if (g.multi == 0) {
#ifdef MAIL #ifdef MAIL
@@ -512,7 +512,7 @@ stop_occupation()
{ {
if (g.occupation) { if (g.occupation) {
if (!maybe_finished_meal(TRUE)) if (!maybe_finished_meal(TRUE))
You("stop %s.", occtxt); You("stop %s.", g.occtxt);
g.occupation = 0; g.occupation = 0;
context.botl = 1; /* in case u.uhs changed */ context.botl = 1; /* in case u.uhs changed */
nomul(0); nomul(0);
@@ -664,7 +664,7 @@ boolean new_game; /* false => restoring an old game */
pline(new_game ? "%s %s, welcome to NetHack! You are a%s %s %s." pline(new_game ? "%s %s, welcome to NetHack! You are a%s %s %s."
: "%s %s, the%s %s %s, welcome back to NetHack!", : "%s %s, the%s %s %s, welcome back to NetHack!",
Hello((struct monst *) 0), plname, buf, urace.adj, Hello((struct monst *) 0), g.plname, buf, urace.adj,
(currentgend && urole.name.f) ? urole.name.f : urole.name.m); (currentgend && urole.name.f) ? urole.name.f : urole.name.m);
} }
@@ -685,31 +685,31 @@ do_positionbar()
*p++ = '<'; *p++ = '<';
*p++ = upstair.sx; *p++ = upstair.sx;
} }
if (sstairs.sx if (g.sstairs.sx
&& (glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) && (glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_upstair == S_upstair
|| glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) || glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_upladder)) { == S_upladder)) {
*p++ = '<'; *p++ = '<';
*p++ = sstairs.sx; *p++ = g.sstairs.sx;
} }
/* down stairway */ /* down stairway */
if (dnstair.sx if (g.dnstair.sx
&& (glyph_to_cmap(level.locations[dnstair.sx][dnstair.sy].glyph) && (glyph_to_cmap(level.locations[g.dnstair.sx][g.dnstair.sy].glyph)
== S_dnstair == S_dnstair
|| glyph_to_cmap(level.locations[dnstair.sx][dnstair.sy].glyph) || glyph_to_cmap(level.locations[g.dnstair.sx][g.dnstair.sy].glyph)
== S_dnladder)) { == S_dnladder)) {
*p++ = '>'; *p++ = '>';
*p++ = dnstair.sx; *p++ = g.dnstair.sx;
} }
if (sstairs.sx if (g.sstairs.sx
&& (glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) && (glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_dnstair == S_dnstair
|| glyph_to_cmap(level.locations[sstairs.sx][sstairs.sy].glyph) || glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_dnladder)) { == S_dnladder)) {
*p++ = '>'; *p++ = '>';
*p++ = sstairs.sx; *p++ = g.sstairs.sx;
} }
/* hero location */ /* hero location */
+4 -4
View File
@@ -843,7 +843,7 @@ struct obj *obj;
nomul(-rnd(MAXULEV + 6 - u.ulevel)); nomul(-rnd(MAXULEV + 6 - u.ulevel));
g.multi_reason = "gazing into a mirror"; g.multi_reason = "gazing into a mirror";
} }
nomovemsg = 0; /* default, "you can move again" */ g.nomovemsg = 0; /* default, "you can move again" */
} }
} else if (youmonst.data->mlet == S_VAMPIRE) } else if (youmonst.data->mlet == S_VAMPIRE)
You("don't have a reflection."); You("don't have a reflection.");
@@ -919,7 +919,7 @@ struct obj *obj;
return 1; return 1;
if (vis) if (vis)
pline("%s is turned to stone!", Monnam(mtmp)); pline("%s is turned to stone!", Monnam(mtmp));
stoned = TRUE; g.stoned = TRUE;
killed(mtmp); killed(mtmp);
} else if (monable && mtmp->data == &mons[PM_FLOATING_EYE]) { } else if (monable && mtmp->data == &mons[PM_FLOATING_EYE]) {
int tmp = d((int) mtmp->m_lev, (int) mtmp->data->mattk[0].damd); int tmp = d((int) mtmp->m_lev, (int) mtmp->data->mattk[0].damd);
@@ -1028,7 +1028,7 @@ struct obj **optr;
mon_adjust_speed(mtmp, 2, (struct obj *) 0); mon_adjust_speed(mtmp, 2, (struct obj *) 0);
break; break;
case 2: /* no explanation; it just happens... */ case 2: /* no explanation; it just happens... */
nomovemsg = ""; g.nomovemsg = "";
g.multi_reason = NULL; g.multi_reason = NULL;
nomul(-rnd(2)); nomul(-rnd(2));
break; break;
@@ -1787,7 +1787,7 @@ int magic; /* 0=Physical, otherwise skill level */
sokoban_guilt(); sokoban_guilt();
nomul(-1); nomul(-1);
g.multi_reason = "jumping around"; g.multi_reason = "jumping around";
nomovemsg = ""; g.nomovemsg = "";
morehungry(rnd(25)); morehungry(rnd(25));
return 1; return 1;
} }
+6 -6
View File
@@ -1055,7 +1055,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
} else { } else {
nomul(-3); nomul(-3);
g.multi_reason = "being scared stiff"; g.multi_reason = "being scared stiff";
nomovemsg = ""; g.nomovemsg = "";
if (magr && magr == u.ustuck && sticks(youmonst.data)) { if (magr && magr == u.ustuck && sticks(youmonst.data)) {
u.ustuck = (struct monst *) 0; u.ustuck = (struct monst *) 0;
You("release %s!", mon_nam(magr)); You("release %s!", mon_nam(magr));
@@ -1515,11 +1515,11 @@ struct obj *obj;
start_menu(tmpwin); start_menu(tmpwin);
/* use index+1 (cant use 0) as identifier */ /* use index+1 (cant use 0) as identifier */
for (i = num_ok_dungeons = 0; i < g.n_dgns; i++) { for (i = num_ok_dungeons = 0; i < g.n_dgns; i++) {
if (!dungeons[i].dunlev_ureached) if (!g.dungeons[i].dunlev_ureached)
continue; continue;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
dungeons[i].dname, MENU_UNSELECTED); g.dungeons[i].dname, MENU_UNSELECTED);
num_ok_dungeons++; num_ok_dungeons++;
last_ok_dungeon = i; last_ok_dungeon = i;
} }
@@ -1547,10 +1547,10 @@ struct obj *obj;
* The closest level is either the entry or dunlev_ureached. * The closest level is either the entry or dunlev_ureached.
*/ */
newlev.dnum = i; newlev.dnum = i;
if (dungeons[i].depth_start >= depth(&u.uz)) if (g.dungeons[i].depth_start >= depth(&u.uz))
newlev.dlevel = dungeons[i].entry_lev; newlev.dlevel = g.dungeons[i].entry_lev;
else else
newlev.dlevel = dungeons[i].dunlev_ureached; newlev.dlevel = g.dungeons[i].dunlev_ureached;
if (u.uhave.amulet || In_endgame(&u.uz) || In_endgame(&newlev) if (u.uhave.amulet || In_endgame(&u.uz) || In_endgame(&newlev)
|| newlev.dnum == u.uz.dnum || !next_to_u()) { || newlev.dnum == u.uz.dnum || !next_to_u()) {
+10 -10
View File
@@ -26,7 +26,7 @@ d_level *lev;
assign_level(lev, &g.save_dlevel); assign_level(lev, &g.save_dlevel);
return (boolean) (((sptr = Is_special(lev)) != 0 && !sptr->boneid) return (boolean) (((sptr = Is_special(lev)) != 0 && !sptr->boneid)
|| !dungeons[lev->dnum].boneid || !g.dungeons[lev->dnum].boneid
/* no bones on the last or multiway branch levels /* no bones on the last or multiway branch levels
in any dungeon (level 1 isn't multiway) */ in any dungeon (level 1 isn't multiway) */
|| Is_botlevel(lev) || Is_botlevel(lev)
@@ -384,7 +384,7 @@ make_bones:
/* mark all fruits as nonexistent; when we come to them we'll mark /* mark all fruits as nonexistent; when we come to them we'll mark
* them as existing (using goodfruit()) * them as existing (using goodfruit())
*/ */
for (f = ffruit; f; f = f->nextf) for (f = g.ffruit; f; f = f->nextf)
f->fid = -f->fid; f->fid = -f->fid;
/* check iron balls separately--maybe they're not carrying it */ /* check iron balls separately--maybe they're not carrying it */
@@ -396,7 +396,7 @@ make_bones:
struct obj *otmp; struct obj *otmp;
/* embed your possessions in your statue */ /* embed your possessions in your statue */
otmp = mk_named_object(STATUE, &mons[u.umonnum], u.ux, u.uy, plname); otmp = mk_named_object(STATUE, &mons[u.umonnum], u.ux, u.uy, g.plname);
drop_upon_death((struct monst *) 0, otmp, u.ux, u.uy); drop_upon_death((struct monst *) 0, otmp, u.ux, u.uy);
if (!otmp) if (!otmp)
@@ -408,19 +408,19 @@ make_bones:
/* trick makemon() into allowing monster creation /* trick makemon() into allowing monster creation
* on your location * on your location
*/ */
in_mklev = TRUE; g.in_mklev = TRUE;
mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, MM_NONAME); mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, MM_NONAME);
in_mklev = FALSE; g.in_mklev = FALSE;
if (!mtmp) if (!mtmp)
return; return;
mtmp = christen_monst(mtmp, plname); mtmp = christen_monst(mtmp, g.plname);
if (corpse) if (corpse)
(void) obj_attach_mid(corpse, mtmp->m_id); (void) obj_attach_mid(corpse, mtmp->m_id);
} else { } else {
/* give your possessions to the monster you become */ /* give your possessions to the monster you become */
in_mklev = TRUE; /* use <u.ux,u.uy> as-is */ g.in_mklev = TRUE; /* use <u.ux,u.uy> as-is */
mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT); mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT);
in_mklev = FALSE; g.in_mklev = FALSE;
if (!mtmp) { if (!mtmp) {
drop_upon_death((struct monst *) 0, (struct obj *) 0, u.ux, u.uy); drop_upon_death((struct monst *) 0, (struct obj *) 0, u.ux, u.uy);
u.ugrave_arise = NON_PM; /* in case caller cares */ u.ugrave_arise = NON_PM; /* in case caller cares */
@@ -430,7 +430,7 @@ make_bones:
carries one; don't bother forcing it to become worn */ carries one; don't bother forcing it to become worn */
if (mtmp->data->mlet == S_MUMMY && !carrying(MUMMY_WRAPPING)) if (mtmp->data->mlet == S_MUMMY && !carrying(MUMMY_WRAPPING))
(void) mongets(mtmp, MUMMY_WRAPPING); (void) mongets(mtmp, MUMMY_WRAPPING);
mtmp = christen_monst(mtmp, plname); mtmp = christen_monst(mtmp, g.plname);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
/* ["Your body rises from the dead as an <mname>..." used /* ["Your body rises from the dead as an <mname>..." used
to be given here, but it has been moved to done() so that to be given here, but it has been moved to done() so that
@@ -479,7 +479,7 @@ make_bones:
/* format name+role,&c, death reason, and date+time; /* format name+role,&c, death reason, and date+time;
gender and alignment reflect final values rather than what the gender and alignment reflect final values rather than what the
character started out as, same as topten and logfile entries */ character started out as, same as topten and logfile entries */
Sprintf(newbones->who, "%s-%.3s-%.3s-%.3s-%.3s", plname, urole.filecode, Sprintf(newbones->who, "%s-%.3s-%.3s-%.3s-%.3s", g.plname, urole.filecode,
urace.filecode, genders[flags.female].filecode, urace.filecode, genders[flags.female].filecode,
aligns[1 - u.ualign.type].filecode); aligns[1 - u.ualign.type].filecode);
formatkiller(newbones->how, sizeof newbones->how, how, TRUE); formatkiller(newbones->how, sizeof newbones->how, how, TRUE);
+4 -4
View File
@@ -44,7 +44,7 @@ do_statusline1()
register char *nb; register char *nb;
register int i, j; register int i, j;
Strcpy(newbot1, plname); Strcpy(newbot1, g.plname);
if ('a' <= newbot1[0] && newbot1[0] <= 'z') if ('a' <= newbot1[0] && newbot1[0] <= 'z')
newbot1[0] += 'A' - 'a'; newbot1[0] += 'A' - 'a';
newbot1[10] = 0; newbot1[10] = 0;
@@ -379,7 +379,7 @@ char *buf;
/* TODO: Add in dungeon name */ /* TODO: Add in dungeon name */
if (Is_knox(&u.uz)) if (Is_knox(&u.uz))
Sprintf(buf, "%s ", dungeons[u.uz.dnum].dname); Sprintf(buf, "%s ", g.dungeons[u.uz.dnum].dname);
else if (In_quest(&u.uz)) else if (In_quest(&u.uz))
Sprintf(buf, "Home %d ", dunlev(&u.uz)); Sprintf(buf, "Home %d ", dunlev(&u.uz));
else if (In_endgame(&u.uz)) else if (In_endgame(&u.uz))
@@ -515,7 +515,7 @@ bot_via_windowport()
/* /*
* Player name and title. * Player name and title.
*/ */
Strcpy(nb = buf, plname); Strcpy(nb = buf, g.plname);
nb[0] = highc(nb[0]); nb[0] = highc(nb[0]);
nb[10] = '\0'; nb[10] = '\0';
Sprintf(nb = eos(nb), " the "); Sprintf(nb = eos(nb), " the ");
@@ -1542,7 +1542,7 @@ int *colorptr;
txtstr = g.blstats[idx][fldidx].val; txtstr = g.blstats[idx][fldidx].val;
if (fldidx == BL_TITLE) if (fldidx == BL_TITLE)
/* "<name> the <rank-title>", skip past "<name> the " */ /* "<name> the <rank-title>", skip past "<name> the " */
txtstr += (strlen(plname) + sizeof " the " - sizeof ""); txtstr += (strlen(g.plname) + sizeof " the " - sizeof "");
if (hl->rel == TXT_VALUE && hl->textmatch[0]) { if (hl->rel == TXT_VALUE && hl->textmatch[0]) {
if (fuzzymatch(hl->textmatch, txtstr, "\" -_", TRUE)) { if (fuzzymatch(hl->textmatch, txtstr, "\" -_", TRUE)) {
merge_bestcolor(&bestcolor, hl->coloridx); merge_bestcolor(&bestcolor, hl->coloridx);
+17 -17
View File
@@ -258,7 +258,7 @@ int xtime;
timed_occ_fn = fn; timed_occ_fn = fn;
} else } else
g.occupation = fn; g.occupation = fn;
occtxt = txt; g.occtxt = txt;
g.occtime = 0; g.occtime = 0;
return; return;
} }
@@ -1190,7 +1190,7 @@ wiz_map_levltyp(VOID_ARGS)
Strcat(dsc, " endgame"); Strcat(dsc, " endgame");
else { else {
/* somebody's added a dungeon branch we're not expecting */ /* somebody's added a dungeon branch we're not expecting */
const char *brname = dungeons[u.uz.dnum].dname; const char *brname = g.dungeons[u.uz.dnum].dname;
if (!brname || !*brname) if (!brname || !*brname)
brname = "unknown"; brname = "unknown";
@@ -1700,7 +1700,7 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
if (g.en_via_menu) if (g.en_via_menu)
start_menu(g.en_win); start_menu(g.en_win);
Strcpy(tmpbuf, plname); Strcpy(tmpbuf, g.plname);
*tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */ *tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */
/* as in background_enlightenment, when poly'd we need to use the saved /* as in background_enlightenment, when poly'd we need to use the saved
gender in u.mfemale rather than the current you-as-monster gender */ gender in u.mfemale rather than the current you-as-monster gender */
@@ -1880,13 +1880,13 @@ int final;
!strncmp(tmpbuf, "Plane", 5) ? "Elemental " : "", tmpbuf); !strncmp(tmpbuf, "Plane", 5) ? "Elemental " : "", tmpbuf);
} else if (Is_knox(&u.uz)) { } else if (Is_knox(&u.uz)) {
/* this gives away the fact that the knox branch is only 1 level */ /* this gives away the fact that the knox branch is only 1 level */
Sprintf(buf, "on the %s level", dungeons[u.uz.dnum].dname); Sprintf(buf, "on the %s level", g.dungeons[u.uz.dnum].dname);
/* TODO? maybe phrase it differently when actually inside the fort, /* TODO? maybe phrase it differently when actually inside the fort,
if we're able to determine that (not trivial) */ if we're able to determine that (not trivial) */
} else { } else {
char dgnbuf[QBUFSZ]; char dgnbuf[QBUFSZ];
Strcpy(dgnbuf, dungeons[u.uz.dnum].dname); Strcpy(dgnbuf, g.dungeons[u.uz.dnum].dname);
if (!strncmpi(dgnbuf, "The ", 4)) if (!strncmpi(dgnbuf, "The ", 4))
*dgnbuf = lowc(*dgnbuf); *dgnbuf = lowc(*dgnbuf);
Sprintf(tmpbuf, "level %d", Sprintf(tmpbuf, "level %d",
@@ -2837,14 +2837,14 @@ int final;
struct fruit *f; struct fruit *f;
reorder_fruit(TRUE); /* sort by fruit index, from low to high; reorder_fruit(TRUE); /* sort by fruit index, from low to high;
* this modifies the ffruit chain, so could * this modifies the g.ffruit chain, so could
* possibly mask or even introduce a problem, * possibly mask or even introduce a problem,
* but it does useful sanity checking */ * but it does useful sanity checking */
for (f = ffruit; f; f = f->nextf) { for (f = g.ffruit; f; f = f->nextf) {
Sprintf(buf, "Fruit #%d ", f->fid); Sprintf(buf, "Fruit #%d ", f->fid);
enl_msg(buf, "is ", "was ", f->fname, ""); enl_msg(buf, "is ", "was ", f->fname, "");
} }
enl_msg("The current fruit ", "is ", "was ", pl_fruit, ""); enl_msg("The current fruit ", "is ", "was ", g.pl_fruit, "");
Sprintf(buf, "%d", flags.made_fruit); Sprintf(buf, "%d", flags.made_fruit);
enl_msg("The made fruit flag ", "is ", "was ", buf, ""); enl_msg("The made fruit flag ", "is ", "was ", buf, "");
} }
@@ -2925,7 +2925,7 @@ minimal_enlightenment()
"Starting", FALSE); "Starting", FALSE);
/* Starting name, race, role, gender */ /* Starting name, race, role, gender */
Sprintf(buf, fmtstr, "name", plname); Sprintf(buf, fmtstr, "name", g.plname);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "race", urace.noun); Sprintf(buf, fmtstr, "race", urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
@@ -5247,7 +5247,7 @@ boolean doit;
"Sit on the throne"); "Sit on the throne");
if ((u.ux == xupstair && u.uy == yupstair) if ((u.ux == xupstair && u.uy == yupstair)
|| (u.ux == sstairs.sx && u.uy == sstairs.sy && sstairs.up) || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy && g.sstairs.up)
|| (u.ux == xupladder && u.uy == yupladder)) { || (u.ux == xupladder && u.uy == yupladder)) {
Sprintf(buf, "Go up the %s", Sprintf(buf, "Go up the %s",
(u.ux == xupladder && u.uy == yupladder) (u.ux == xupladder && u.uy == yupladder)
@@ -5255,7 +5255,7 @@ boolean doit;
add_herecmd_menuitem(win, doup, buf); add_herecmd_menuitem(win, doup, buf);
} }
if ((u.ux == xdnstair && u.uy == ydnstair) if ((u.ux == xdnstair && u.uy == ydnstair)
|| (u.ux == sstairs.sx && u.uy == sstairs.sy && !sstairs.up) || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy && !g.sstairs.up)
|| (u.ux == xdnladder && u.uy == ydnladder)) { || (u.ux == xdnladder && u.uy == ydnladder)) {
Sprintf(buf, "Go down the %s", Sprintf(buf, "Go down the %s",
(u.ux == xupladder && u.uy == yupladder) (u.ux == xupladder && u.uy == yupladder)
@@ -5365,14 +5365,14 @@ int x, y, mod;
cmd[0] = cmd_from_func(dosit); cmd[0] = cmd_from_func(dosit);
return cmd; return cmd;
} else if ((u.ux == xupstair && u.uy == yupstair) } else if ((u.ux == xupstair && u.uy == yupstair)
|| (u.ux == sstairs.sx && u.uy == sstairs.sy || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy
&& sstairs.up) && g.sstairs.up)
|| (u.ux == xupladder && u.uy == yupladder)) { || (u.ux == xupladder && u.uy == yupladder)) {
cmd[0] = cmd_from_func(doup); cmd[0] = cmd_from_func(doup);
return cmd; return cmd;
} else if ((u.ux == xdnstair && u.uy == ydnstair) } else if ((u.ux == xdnstair && u.uy == ydnstair)
|| (u.ux == sstairs.sx && u.uy == sstairs.sy || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy
&& !sstairs.up) && !g.sstairs.up)
|| (u.ux == xdnladder && u.uy == ydnladder)) { || (u.ux == xdnladder && u.uy == ydnladder)) {
cmd[0] = cmd_from_func(dodown); cmd[0] = cmd_from_func(dodown);
return cmd; return cmd;
@@ -5564,9 +5564,9 @@ parse()
if (g.multi) { if (g.multi) {
g.multi--; g.multi--;
save_cm = in_line; g.save_cm = in_line;
} else { } else {
save_cm = (char *) 0; g.save_cm = (char *) 0;
} }
/* in 3.4.3 this was in rhack(), where it was too late to handle M-5 */ /* in 3.4.3 this was in rhack(), where it was too late to handle M-5 */
if (g.Cmd.pcHack_compat) { if (g.Cmd.pcHack_compat) {
+39 -46
View File
@@ -19,26 +19,8 @@ char *catmore = 0; /* default pager */
*/ */
struct dgn_topology dungeon_topology = { DUMMY }; struct dgn_topology dungeon_topology = { DUMMY };
struct q_score quest_status = DUMMY;
NEARDATA int smeq[MAXNROFROOMS + 1] = DUMMY;
NEARDATA int doorindex = 0;
NEARDATA char *save_cm = 0;
NEARDATA struct kinfo killer = DUMMY; NEARDATA struct kinfo killer = DUMMY;
NEARDATA long done_money = 0;
const char *nomovemsg = 0;
NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */
NEARDATA char pl_character[PL_CSIZ] = DUMMY;
NEARDATA char pl_race = '\0';
NEARDATA char pl_fruit[PL_FSIZ] = DUMMY;
NEARDATA struct fruit *ffruit = (struct fruit *) 0;
NEARDATA char tune[6] = DUMMY;
NEARDATA boolean ransacked = 0;
const char *occtxt = DUMMY;
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";
@@ -73,30 +55,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 schar tbx = 0, tby = 0; /* mthrowu: target */
/* for xname handling of multiple shot missile volleys:
number of shots, index of current one, validity check, shoot vs throw */
NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
NEARDATA s_level *sp_levchn;
NEARDATA stairway upstair = { 0, 0, { 0, 0 }, 0 },
dnstair = { 0, 0, { 0, 0 }, 0 };
NEARDATA stairway upladder = { 0, 0, { 0, 0 }, 0 },
dnladder = { 0, 0, { 0, 0 }, 0 };
NEARDATA stairway sstairs = { 0, 0, { 0, 0 }, 0 };
NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
NEARDATA coord inv_pos = { 0, 0 };
NEARDATA boolean defer_see_monsters = FALSE;
NEARDATA boolean in_mklev = FALSE;
NEARDATA boolean stoned = FALSE; /* done to monsters hit by 'c' */
NEARDATA boolean unweapon = FALSE;
NEARDATA boolean mrg_to_wielded = FALSE;
/* weapon picked is merged with wielded one */
NEARDATA boolean in_steed_dismounting = FALSE; NEARDATA boolean in_steed_dismounting = FALSE;
NEARDATA coord bhitpos = DUMMY; NEARDATA coord bhitpos = DUMMY;
@@ -339,7 +297,7 @@ const struct instance_globals g_init = {
UNDEFINED_VALUE, /* last_multi */ UNDEFINED_VALUE, /* last_multi */
/* dbridge.c */ /* dbridge.c */
UNDEFINED_VALUES, UNDEFINED_VALUES, /* occupants */
/* decl.c */ /* decl.c */
UNDEFINED_PTR, /* occupation */ UNDEFINED_PTR, /* occupation */
@@ -359,14 +317,45 @@ const struct instance_globals g_init = {
(ROWNO - 1) & ~1, /* y_maze_max */ (ROWNO - 1) & ~1, /* y_maze_max */
UNDEFINED_VALUE, /* otg_temp */ UNDEFINED_VALUE, /* otg_temp */
0, /* in_doagain */ 0, /* in_doagain */
DUMMY, /* dnstair */
DUMMY, /* upstair */
DUMMY, /* dnladder */
DUMMY, /* upladder */
DUMMY, /* smeq */
0, /* doorindex */
NULL, /* save_cm */
0, /* done_money */
NULL, /* nomovemsg */
DUMMY, /* plname */
DUMMY, /* pl_character */
'\0', /* pl_race */
DUMMY, /* pl_fruit */
NULL, /* ffruit */
DUMMY, /* tune */
NULL, /* occtxt */
0, /* tbx */
0, /* tby */
UNDEFINED_PTR, /* sp_levchn */
{ 0, 0, STRANGE_OBJECT, FALSE }, /* m_shot */
UNDEFINED_VALUES, /* dungeons */
{ 0, 0, { 0, 0 }, 0 }, /* sstairs */
{ 0, 0, 0, 0, 0, 0, 0, 0 }, /* updest */
{ 0, 0, 0, 0, 0, 0, 0, 0 }, /* dndest */
{ 0, 0} , /* inv_pos */
FALSE, /* defer_see_monsters */
FALSE, /* in_mklev */
FALSE, /* stoned */
FALSE, /* unweapon */
FALSE, /* mrg_to_wielded */
/* dig.c */ /* dig.c */
UNDEFINED_VALUE, /* did_dig_msg */ UNDEFINED_VALUE, /* did_dig_msg */
/* display.c */ /* display.c */
UNDEFINED_VALUES, UNDEFINED_VALUES, /* gbuf */
UNDEFINED_VALUES, UNDEFINED_VALUES, /* gbuf_start */
UNDEFINED_VALUES, UNDEFINED_VALUES, /* gbug_stop */
/* do.c */ /* do.c */
FALSE, /* at_ladder */ FALSE, /* at_ladder */
@@ -486,6 +475,7 @@ const struct instance_globals g_init = {
UNDEFINED_VALUE, /* ymin */ UNDEFINED_VALUE, /* ymin */
UNDEFINED_VALUE, /* xmax */ UNDEFINED_VALUE, /* xmax */
UNDEFINED_VALUE, /* ymax */ UNDEFINED_VALUE, /* ymax */
0, /* ransacked */
/* mon.c */ /* mon.c */
UNDEFINED_VALUE, /* vamp_rise_msg */ UNDEFINED_VALUE, /* vamp_rise_msg */
@@ -542,6 +532,9 @@ const struct instance_globals g_init = {
UNDEFINED_VALUE, /* p_trouble */ UNDEFINED_VALUE, /* p_trouble */
UNDEFINED_VALUE, /* p_type */ UNDEFINED_VALUE, /* p_type */
/* quest.c */
DUMMY, /* quest_status */
/* questpgr.c */ /* questpgr.c */
UNDEFINED_VALUES, /* cvt_buf */ UNDEFINED_VALUES, /* cvt_buf */
UNDEFINED_VALUES, /* qt_list */ UNDEFINED_VALUES, /* qt_list */
+3 -3
View File
@@ -971,7 +971,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */
if (detect_obj_traps(invent, FALSE, 0) != OTRAP_NONE) if (detect_obj_traps(invent, FALSE, 0) != OTRAP_NONE)
found = TRUE; found = TRUE;
/* door traps */ /* door traps */
for (door = 0; door < doorindex; door++) { for (door = 0; door < g.doorindex; door++) {
cc = doors[door]; cc = doors[door];
if (levl[cc.x][cc.y].doormask & D_TRAPPED) { if (levl[cc.x][cc.y].doormask & D_TRAPPED) {
if (cc.x != u.ux || cc.y != u.uy) if (cc.x != u.ux || cc.y != u.uy)
@@ -1009,7 +1009,7 @@ outtrapmap:
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
sense_trap(ttmp, 0, 0, cursed_src); sense_trap(ttmp, 0, 0, cursed_src);
for (door = 0; door < doorindex; door++) { for (door = 0; door < g.doorindex; door++) {
cc = doors[door]; cc = doors[door];
if (levl[cc.x][cc.y].doormask & D_TRAPPED) if (levl[cc.x][cc.y].doormask & D_TRAPPED)
sense_trap((struct trap *) 0, cc.x, cc.y, cursed_src); sense_trap((struct trap *) 0, cc.x, cc.y, cursed_src);
@@ -1184,7 +1184,7 @@ struct obj **optr;
You("peer into %s...", the(xname(obj))); You("peer into %s...", the(xname(obj)));
nomul(-rnd(10)); nomul(-rnd(10));
g.multi_reason = "gazing into a crystal ball"; g.multi_reason = "gazing into a crystal ball";
nomovemsg = ""; g.nomovemsg = "";
if (obj->spe <= 0) { if (obj->spe <= 0) {
pline_The("vision is unclear."); pline_The("vision is unclear.");
} else { } else {
+5 -5
View File
@@ -1064,7 +1064,7 @@ struct obj *obj;
/* (maybe `move_into_trap()' would be better) */ /* (maybe `move_into_trap()' would be better) */
nomul(-d(2, 2)); nomul(-d(2, 2));
g.multi_reason = "stuck in a spider web"; g.multi_reason = "stuck in a spider web";
nomovemsg = "You pull free."; g.nomovemsg = "You pull free.";
} else if (lev->typ == IRONBARS) { } else if (lev->typ == IRONBARS) {
pline("Clang!"); pline("Clang!");
wake_nearby(); wake_nearby();
@@ -1645,13 +1645,13 @@ char *msg;
else if (IS_ALTAR(ltyp)) else if (IS_ALTAR(ltyp))
supporting = "altar"; supporting = "altar";
else if ((cc->x == xupstair && cc->y == yupstair) else if ((cc->x == xupstair && cc->y == yupstair)
|| (cc->x == sstairs.sx && cc->y == sstairs.sy || (cc->x == g.sstairs.sx && cc->y == g.sstairs.sy
&& sstairs.up)) && g.sstairs.up))
/* "staircase up" */ /* "staircase up" */
supporting = "stairs"; supporting = "stairs";
else if ((cc->x == xdnstair && cc->y == ydnstair) else if ((cc->x == xdnstair && cc->y == ydnstair)
|| (cc->x == sstairs.sx && cc->y == sstairs.sy || (cc->x == g.sstairs.sx && cc->y == g.sstairs.sy
&& !sstairs.up)) && !g.sstairs.up))
/* "staircase down" */ /* "staircase down" */
supporting = "stairs"; supporting = "stairs";
else if (ltyp == DRAWBRIDGE_DOWN /* "lowered drawbridge" */ else if (ltyp == DRAWBRIDGE_DOWN /* "lowered drawbridge" */
+2 -2
View File
@@ -716,7 +716,7 @@ register int x, y;
register int see_it; register int see_it;
register xchar worm_tail; register xchar worm_tail;
if (in_mklev) if (g.in_mklev)
return; return;
#ifdef HANGUPHANDLING #ifdef HANGUPHANDLING
if (program_state.done_hup) if (program_state.done_hup)
@@ -1232,7 +1232,7 @@ see_monsters()
register struct monst *mon; register struct monst *mon;
int new_warn_obj_cnt = 0; int new_warn_obj_cnt = 0;
if (defer_see_monsters) if (g.defer_see_monsters)
return; return;
for (mon = fmon; mon; mon = mon->nmon) { for (mon = fmon; mon; mon = mon->nmon) {
+7 -7
View File
@@ -898,8 +898,8 @@ dodown()
{ {
struct trap *trap = 0; struct trap *trap = 0;
boolean stairs_down = ((u.ux == xdnstair && u.uy == ydnstair) boolean stairs_down = ((u.ux == xdnstair && u.uy == ydnstair)
|| (u.ux == sstairs.sx && u.uy == sstairs.sy || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy
&& !sstairs.up)), && !g.sstairs.up)),
ladder_down = (u.ux == xdnladder && u.uy == ydnladder); ladder_down = (u.ux == xdnladder && u.uy == ydnladder);
if (u_rooted()) if (u_rooted())
@@ -1044,8 +1044,8 @@ doup()
if ((u.ux != xupstair || u.uy != yupstair) if ((u.ux != xupstair || u.uy != yupstair)
&& (!xupladder || u.ux != xupladder || u.uy != yupladder) && (!xupladder || u.ux != xupladder || u.uy != yupladder)
&& (!sstairs.sx || u.ux != sstairs.sx || u.uy != sstairs.sy && (!g.sstairs.sx || u.ux != g.sstairs.sx || u.uy != g.sstairs.sy
|| !sstairs.up)) { || !g.sstairs.up)) {
You_cant("go up here."); You_cant("go up here.");
return 0; return 0;
} }
@@ -1324,8 +1324,8 @@ boolean at_stairs, falling, portal;
/* set default level change destination areas */ /* set default level change destination areas */
/* the special level code may override these */ /* the special level code may override these */
(void) memset((genericptr_t) &updest, 0, sizeof updest); (void) memset((genericptr_t) &g.updest, 0, sizeof g.updest);
(void) memset((genericptr_t) &dndest, 0, sizeof dndest); (void) memset((genericptr_t) &g.dndest, 0, sizeof g.dndest);
if (!(level_info[new_ledger].flags & LFILE_EXISTS)) { if (!(level_info[new_ledger].flags & LFILE_EXISTS)) {
/* entering this level for first time; make it now */ /* entering this level for first time; make it now */
@@ -1569,7 +1569,7 @@ boolean at_stairs, falling, portal;
/* main dungeon message from your quest leader */ /* main dungeon message from your quest leader */
if (!In_quest(&u.uz0) && at_dgn_entrance("The Quest") if (!In_quest(&u.uz0) && at_dgn_entrance("The Quest")
&& !(u.uevent.qcompleted || u.uevent.qexpelled && !(u.uevent.qcompleted || u.uevent.qexpelled
|| quest_status.leader_is_dead)) { || g.quest_status.leader_is_dead)) {
if (!u.uevent.qcalled) { if (!u.uevent.qcalled) {
u.uevent.qcalled = 1; u.uevent.qcalled = 1;
com_pager(2); /* main "leader needs help" message */ com_pager(2); /* main "leader needs help" message */
+2 -2
View File
@@ -1135,7 +1135,7 @@ do_mname()
mtmp = u.usteed; mtmp = u.usteed;
} else { } else {
pline("This %s creature is called %s and cannot be renamed.", pline("This %s creature is called %s and cannot be renamed.",
beautiful(), plname); beautiful(), g.plname);
return; return;
} }
} else } else
@@ -1572,7 +1572,7 @@ static const char *const ghostnames[] = {
const char * const char *
rndghostname() rndghostname()
{ {
return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) plname; return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) g.plname;
} }
/* /*
+6 -6
View File
@@ -1292,7 +1292,7 @@ cancel_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;
nomovemsg = (char *) 0; g.nomovemsg = (char *) 0;
g.multi = 0; g.multi = 0;
context.takeoff.delay = 0; context.takeoff.delay = 0;
context.takeoff.what = 0L; context.takeoff.what = 0L;
@@ -1530,18 +1530,18 @@ register struct obj *otmp;
g.multi_reason = "disrobing"; g.multi_reason = "disrobing";
if (is_helmet(otmp)) { if (is_helmet(otmp)) {
/* ick... */ /* ick... */
nomovemsg = !strcmp(helm_simple_name(otmp), "hat") g.nomovemsg = !strcmp(helm_simple_name(otmp), "hat")
? "You finish taking off your hat." ? "You finish taking off your hat."
: "You finish taking off your helmet."; : "You finish taking off your helmet.";
g.afternmv = Helmet_off; g.afternmv = Helmet_off;
} else if (is_gloves(otmp)) { } else if (is_gloves(otmp)) {
nomovemsg = "You finish taking off your gloves."; g.nomovemsg = "You finish taking off your gloves.";
g.afternmv = Gloves_off; g.afternmv = Gloves_off;
} else if (is_boots(otmp)) { } else if (is_boots(otmp)) {
nomovemsg = "You finish taking off your boots."; g.nomovemsg = "You finish taking off your boots.";
g.afternmv = Boots_off; g.afternmv = Boots_off;
} else { } else {
nomovemsg = "You finish taking off your suit."; g.nomovemsg = "You finish taking off your suit.";
g.afternmv = Armor_off; g.afternmv = Armor_off;
} }
} else { } else {
@@ -1915,7 +1915,7 @@ struct obj *obj;
g.afternmv = Gloves_on; g.afternmv = Gloves_on;
if (obj == uarm) if (obj == uarm)
g.afternmv = Armor_on; g.afternmv = Armor_on;
nomovemsg = "You finish your dressing maneuver."; g.nomovemsg = "You finish your dressing maneuver.";
} else { } else {
if (is_cloak(obj)) if (is_cloak(obj))
(void) Cloak_on(); (void) Cloak_on();
+4 -4
View File
@@ -393,7 +393,7 @@ boolean with_you;
xlocale = xdnladder, ylocale = ydnladder; xlocale = xdnladder, ylocale = ydnladder;
break; break;
case MIGR_SSTAIRS: case MIGR_SSTAIRS:
xlocale = sstairs.sx, ylocale = sstairs.sy; xlocale = g.sstairs.sx, ylocale = g.sstairs.sy;
break; break;
case MIGR_PORTAL: case MIGR_PORTAL:
if (In_endgame(&u.uz)) { if (In_endgame(&u.uz)) {
@@ -402,8 +402,8 @@ boolean with_you;
that we know that the current endgame levels always that we know that the current endgame levels always
build upwards and never have any exclusion subregion build upwards and never have any exclusion subregion
inside their TELEPORT_REGION settings. */ inside their TELEPORT_REGION settings. */
xlocale = rn1(updest.hx - updest.lx + 1, updest.lx); xlocale = rn1(g.updest.hx - g.updest.lx + 1, g.updest.lx);
ylocale = rn1(updest.hy - updest.ly + 1, updest.ly); ylocale = rn1(g.updest.hy - g.updest.ly + 1, g.updest.ly);
break; break;
} }
/* find the arrival portal */ /* find the arrival portal */
@@ -944,7 +944,7 @@ register struct obj *obj;
|| (obj && dogfood(mtmp, obj) >= MANFOOD)) || (obj && dogfood(mtmp, obj) >= MANFOOD))
return FALSE; return FALSE;
if (mtmp->m_id == quest_status.leader_m_id) if (mtmp->m_id == g.quest_status.leader_m_id)
return FALSE; return FALSE;
/* add the pet extension */ /* add the pet extension */
+6 -6
View File
@@ -1331,8 +1331,8 @@ schar loc;
cc->y = u.uz.dlevel + 1; cc->y = u.uz.dlevel + 1;
break; break;
case MIGR_SSTAIRS: case MIGR_SSTAIRS:
cc->x = sstairs.tolev.dnum; cc->x = g.sstairs.tolev.dnum;
cc->y = sstairs.tolev.dlevel; cc->y = g.sstairs.tolev.dlevel;
break; break;
default: default:
case MIGR_NOWHERE: case MIGR_NOWHERE:
@@ -1447,11 +1447,11 @@ xchar dlev; /* if !0 send to dlev near player */
You("removed %ld %s worth of goods!", price, currency(price)); You("removed %ld %s worth of goods!", price, currency(price));
if (cansee(shkp->mx, shkp->my)) { if (cansee(shkp->mx, shkp->my)) {
if (ESHK(shkp)->customer[0] == 0) if (ESHK(shkp)->customer[0] == 0)
(void) strncpy(ESHK(shkp)->customer, plname, PL_NSIZ); (void) strncpy(ESHK(shkp)->customer, g.plname, PL_NSIZ);
if (angry) if (angry)
pline("%s is infuriated!", Monnam(shkp)); pline("%s is infuriated!", Monnam(shkp));
else else
pline("\"%s, you are a thief!\"", plname); pline("\"%s, you are a thief!\"", g.plname);
} else } else
You_hear("a scream, \"Thief!\""); You_hear("a scream, \"Thief!\"");
hot_pursuit(shkp); hot_pursuit(shkp);
@@ -1628,7 +1628,7 @@ boolean near_hero;
nx = xupladder, ny = yupladder; nx = xupladder, ny = yupladder;
break; break;
case MIGR_SSTAIRS: case MIGR_SSTAIRS:
nx = sstairs.sx, ny = sstairs.sy; nx = g.sstairs.sx, ny = g.sstairs.sy;
break; break;
case MIGR_WITH_HERO: case MIGR_WITH_HERO:
nx = u.ux, ny = u.uy; nx = u.ux, ny = u.uy;
@@ -1762,7 +1762,7 @@ xchar x, y;
return MIGR_NOWHERE; return MIGR_NOWHERE;
if ((xdnstair == x && ydnstair == y) if ((xdnstair == x && ydnstair == y)
|| (sstairs.sx == x && sstairs.sy == y && !sstairs.up)) { || (g.sstairs.sx == x && g.sstairs.sy == y && !g.sstairs.up)) {
g.gate_str = "down the stairs"; g.gate_str = "down the stairs";
return (xdnstair == x && ydnstair == y) ? MIGR_STAIRS_UP return (xdnstair == x && ydnstair == y) ? MIGR_STAIRS_UP
: MIGR_SSTAIRS; : MIGR_SSTAIRS;
+15 -15
View File
@@ -198,20 +198,20 @@ int shotlimit;
multishot = shotlimit; multishot = shotlimit;
} }
m_shot.s = ammo_and_launcher(obj, uwep) ? TRUE : FALSE; g.m_shot.s = ammo_and_launcher(obj, uwep) ? TRUE : FALSE;
/* give a message if shooting more than one, or if player /* give a message if shooting more than one, or if player
attempted to specify a count */ attempted to specify a count */
if (multishot > 1 || shotlimit > 0) { if (multishot > 1 || shotlimit > 0) {
/* "You shoot N arrows." or "You throw N daggers." */ /* "You shoot N arrows." or "You throw N daggers." */
You("%s %d %s.", m_shot.s ? "shoot" : "throw", You("%s %d %s.", g.m_shot.s ? "shoot" : "throw",
multishot, /* (might be 1 if player gave shotlimit) */ multishot, /* (might be 1 if player gave shotlimit) */
(multishot == 1) ? singular(obj, xname) : xname(obj)); (multishot == 1) ? singular(obj, xname) : xname(obj));
} }
wep_mask = obj->owornmask; wep_mask = obj->owornmask;
m_shot.o = obj->otyp; g.m_shot.o = obj->otyp;
m_shot.n = multishot; g.m_shot.n = multishot;
for (m_shot.i = 1; m_shot.i <= m_shot.n; m_shot.i++) { for (g.m_shot.i = 1; g.m_shot.i <= g.m_shot.n; g.m_shot.i++) {
twoweap = u.twoweap; twoweap = u.twoweap;
/* split this object off from its slot if necessary */ /* split this object off from its slot if necessary */
if (obj->quan > 1L) { if (obj->quan > 1L) {
@@ -224,9 +224,9 @@ int shotlimit;
freeinv(otmp); freeinv(otmp);
throwit(otmp, wep_mask, twoweap); throwit(otmp, wep_mask, twoweap);
} }
m_shot.n = m_shot.i = 0; g.m_shot.n = g.m_shot.i = 0;
m_shot.o = STRANGE_OBJECT; g.m_shot.o = STRANGE_OBJECT;
m_shot.s = FALSE; g.m_shot.s = FALSE;
return 1; return 1;
} }
@@ -237,7 +237,7 @@ ok_to_throw(shotlimit_p)
int *shotlimit_p; /* (see dothrow()) */ int *shotlimit_p; /* (see dothrow()) */
{ {
/* kludge to work around parse()'s pre-decrement of `multi' */ /* kludge to work around parse()'s pre-decrement of `multi' */
*shotlimit_p = (g.multi || save_cm) ? g.multi + 1 : 0; *shotlimit_p = (g.multi || g.save_cm) ? g.multi + 1 : 0;
g.multi = 0; /* reset; it's been used up */ g.multi = 0; /* reset; it's been used up */
if (notake(youmonst.data)) { if (notake(youmonst.data)) {
@@ -403,13 +403,13 @@ void
endmultishot(verbose) endmultishot(verbose)
boolean verbose; boolean verbose;
{ {
if (m_shot.i < m_shot.n) { if (g.m_shot.i < g.m_shot.n) {
if (verbose && !context.mon_moving) { if (verbose && !context.mon_moving) {
You("stop %s after the %d%s %s.", You("stop %s after the %d%s %s.",
m_shot.s ? "firing" : "throwing", m_shot.i, ordin(m_shot.i), g.m_shot.s ? "firing" : "throwing", g.m_shot.i, ordin(g.m_shot.i),
m_shot.s ? "shot" : "toss"); g.m_shot.s ? "shot" : "toss");
} }
m_shot.n = m_shot.i; /* make current shot be the last */ g.m_shot.n = g.m_shot.i; /* make current shot be the last */
} }
} }
@@ -835,7 +835,7 @@ boolean verbose;
nomul(-range); nomul(-range);
g.multi_reason = "moving through the air"; g.multi_reason = "moving through the air";
nomovemsg = ""; /* it just happens */ g.nomovemsg = ""; /* it just happens */
if (verbose) if (verbose)
You("%s in the opposite direction.", range > 1 ? "hurtle" : "float"); You("%s in the opposite direction.", range > 1 ? "hurtle" : "float");
/* if we're in the midst of shooting multiple projectiles, stop */ /* if we're in the midst of shooting multiple projectiles, stop */
@@ -1492,7 +1492,7 @@ boolean maybe_wakeup;
#define quest_arti_hits_leader(obj, mon) \ #define quest_arti_hits_leader(obj, mon) \
(obj->oartifact && is_quest_artifact(obj) \ (obj->oartifact && is_quest_artifact(obj) \
&& mon->m_id == quest_status.leader_m_id) && mon->m_id == g.quest_status.leader_m_id)
/* /*
* Object thrown by player arrives at monster's location. * Object thrown by player arrives at monster's location.
+114 -114
View File
@@ -70,7 +70,7 @@ STATIC_DCL const char *FDECL(shop_string, (int));
STATIC_DCL char *FDECL(tunesuffix, (mapseen *, char *)); STATIC_DCL char *FDECL(tunesuffix, (mapseen *, char *));
#ifdef DEBUG #ifdef DEBUG
#define DD dungeons[i] #define DD g.dungeons[i]
STATIC_DCL void NDECL(dumpit); STATIC_DCL void NDECL(dumpit);
STATIC_OVL void STATIC_OVL void
@@ -96,7 +96,7 @@ dumpit()
getchar(); getchar();
} }
fprintf(stderr, "\nSpecial levels:\n"); fprintf(stderr, "\nSpecial levels:\n");
for (x = sp_levchn; x; x = x->next) { for (x = g.sp_levchn; x; x = x->next) {
fprintf(stderr, "%s (%d): ", x->proto, x->rndlevs); fprintf(stderr, "%s (%d): ", x->proto, x->rndlevs);
fprintf(stderr, "on %d, %d; ", x->dlevel.dnum, x->dlevel.dlevel); fprintf(stderr, "on %d, %d; ", x->dlevel.dnum, x->dlevel.dlevel);
fprintf(stderr, "flags:%s%s%s%s\n", fprintf(stderr, "flags:%s%s%s%s\n",
@@ -139,10 +139,10 @@ boolean perform_write, free_data;
if (perform_write) { if (perform_write) {
bwrite(fd, (genericptr_t) &g.n_dgns, sizeof g.n_dgns); bwrite(fd, (genericptr_t) &g.n_dgns, sizeof g.n_dgns);
bwrite(fd, (genericptr_t) dungeons, bwrite(fd, (genericptr_t) g.dungeons,
sizeof(dungeon) * (unsigned) g.n_dgns); sizeof(dungeon) * (unsigned) g.n_dgns);
bwrite(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology); bwrite(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology);
bwrite(fd, (genericptr_t) tune, sizeof tune); bwrite(fd, (genericptr_t) g.tune, sizeof tune);
for (count = 0, curr = g.branches; curr; curr = curr->next) for (count = 0, curr = g.branches; curr; curr = curr->next)
count++; count++;
@@ -155,7 +155,7 @@ boolean perform_write, free_data;
bwrite(fd, (genericptr_t) &count, sizeof count); bwrite(fd, (genericptr_t) &count, sizeof count);
bwrite(fd, (genericptr_t) level_info, bwrite(fd, (genericptr_t) level_info,
(unsigned) count * sizeof(struct linfo)); (unsigned) count * sizeof(struct linfo));
bwrite(fd, (genericptr_t) &inv_pos, sizeof inv_pos); bwrite(fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos);
for (count = 0, curr_ms = g.mapseenchn; curr_ms; for (count = 0, curr_ms = g.mapseenchn; curr_ms;
curr_ms = curr_ms->next) curr_ms = curr_ms->next)
@@ -192,9 +192,9 @@ int fd;
mapseen *curr_ms, *last_ms; mapseen *curr_ms, *last_ms;
mread(fd, (genericptr_t) &g.n_dgns, sizeof(g.n_dgns)); mread(fd, (genericptr_t) &g.n_dgns, sizeof(g.n_dgns));
mread(fd, (genericptr_t) dungeons, sizeof(dungeon) * (unsigned) g.n_dgns); mread(fd, (genericptr_t) g.dungeons, sizeof(dungeon) * (unsigned) g.n_dgns);
mread(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology); mread(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology);
mread(fd, (genericptr_t) tune, sizeof tune); mread(fd, (genericptr_t) g.tune, sizeof tune);
last = g.branches = (branch *) 0; last = g.branches = (branch *) 0;
@@ -216,7 +216,7 @@ int fd;
count); count);
mread(fd, (genericptr_t) level_info, mread(fd, (genericptr_t) level_info,
(unsigned) count * sizeof(struct linfo)); (unsigned) count * sizeof(struct linfo));
mread(fd, (genericptr_t) &inv_pos, sizeof inv_pos); mread(fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos);
mread(fd, (genericptr_t) &count, sizeof(count)); mread(fd, (genericptr_t) &count, sizeof(count));
last_ms = (mapseen *) 0; last_ms = (mapseen *) 0;
@@ -254,7 +254,7 @@ const char *s;
xchar i; xchar i;
for (i = 0; i < g.n_dgns; i++) for (i = 0; i < g.n_dgns; i++)
if (!strcmp(dungeons[i].dname, s)) if (!strcmp(g.dungeons[i].dname, s))
return i; return i;
panic("Couldn't resolve dungeon number for name \"%s\".", s); panic("Couldn't resolve dungeon number for name \"%s\".", s);
@@ -267,7 +267,7 @@ find_level(s)
const char *s; const char *s;
{ {
s_level *curr; s_level *curr;
for (curr = sp_levchn; curr; curr = curr->next) for (curr = g.sp_levchn; curr; curr = curr->next)
if (!strcmpi(s, curr->proto)) if (!strcmpi(s, curr->proto))
break; break;
return curr; return curr;
@@ -293,7 +293,7 @@ struct proto_dungeon *pd;
const char *dnam; const char *dnam;
for (br = g.branches; br; br = br->next) { for (br = g.branches; br; br = br->next) {
dnam = dungeons[br->end2.dnum].dname; dnam = g.dungeons[br->end2.dnum].dname;
if (!strcmpi(dnam, s) if (!strcmpi(dnam, s)
|| (!strncmpi(dnam, "The ", 4) && !strcmpi(dnam + 4, s))) || (!strncmpi(dnam, "The ", 4) && !strcmpi(dnam + 4, s)))
break; break;
@@ -346,7 +346,7 @@ int base, randc, chain;
struct proto_dungeon *pd; struct proto_dungeon *pd;
int *adjusted_base; int *adjusted_base;
{ {
int lmax = dungeons[dgn].num_dunlevs; int lmax = g.dungeons[dgn].num_dunlevs;
if (chain >= 0) { /* relative to a special level */ if (chain >= 0) { /* relative to a special level */
s_level *levtmp = pd->final_lev[chain]; s_level *levtmp = pd->final_lev[chain];
@@ -485,14 +485,14 @@ struct proto_dungeon *pd;
int branch_num; int branch_num;
branch *new_branch; branch *new_branch;
branch_num = find_branch(dungeons[dgn].dname, pd); branch_num = find_branch(g.dungeons[dgn].dname, pd);
new_branch = (branch *) alloc(sizeof(branch)); new_branch = (branch *) alloc(sizeof(branch));
(void) memset((genericptr_t)new_branch, 0, sizeof(branch)); (void) memset((genericptr_t)new_branch, 0, sizeof(branch));
new_branch->next = (branch *) 0; new_branch->next = (branch *) 0;
new_branch->id = branch_id++; new_branch->id = branch_id++;
new_branch->type = correct_branch_type(&pd->tmpbranch[branch_num]); new_branch->type = correct_branch_type(&pd->tmpbranch[branch_num]);
new_branch->end1.dnum = parent_dnum(dungeons[dgn].dname, pd); new_branch->end1.dnum = parent_dnum(g.dungeons[dgn].dname, pd);
new_branch->end1.dlevel = parent_dlevel(dungeons[dgn].dname, pd); new_branch->end1.dlevel = parent_dlevel(g.dungeons[dgn].dname, pd);
new_branch->end2.dnum = dgn; new_branch->end2.dnum = dgn;
new_branch->end2.dlevel = child_entry_level; new_branch->end2.dlevel = child_entry_level;
new_branch->end1_up = pd->tmpbranch[branch_num].up ? TRUE : FALSE; new_branch->end1_up = pd->tmpbranch[branch_num].up ? TRUE : FALSE;
@@ -514,15 +514,15 @@ s_level *new_lev;
s_level *prev, *curr; s_level *prev, *curr;
prev = (s_level *) 0; prev = (s_level *) 0;
for (curr = sp_levchn; curr; curr = curr->next) { for (curr = g.sp_levchn; curr; curr = curr->next) {
if (curr->dlevel.dnum == new_lev->dlevel.dnum if (curr->dlevel.dnum == new_lev->dlevel.dnum
&& curr->dlevel.dlevel > new_lev->dlevel.dlevel) && curr->dlevel.dlevel > new_lev->dlevel.dlevel)
break; break;
prev = curr; prev = curr;
} }
if (!prev) { if (!prev) {
new_lev->next = sp_levchn; new_lev->next = g.sp_levchn;
sp_levchn = new_lev; g.sp_levchn = new_lev;
} else { } else {
new_lev->next = curr; new_lev->next = curr;
prev->next = new_lev; prev->next = new_lev;
@@ -757,7 +757,7 @@ init_dungeons()
* Read in each dungeon and transfer the results to the internal * Read in each dungeon and transfer the results to the internal
* dungeon arrays. * dungeon arrays.
*/ */
sp_levchn = (s_level *) 0; g.sp_levchn = (s_level *) 0;
Fread((genericptr_t) &g.n_dgns, sizeof(int), 1, dgn_file); Fread((genericptr_t) &g.n_dgns, sizeof(int), 1, dgn_file);
if (g.n_dgns >= MAXDUNGEON) if (g.n_dgns >= MAXDUNGEON)
panic("init_dungeons: too many dungeons"); panic("init_dungeons: too many dungeons");
@@ -782,30 +782,30 @@ init_dungeons()
continue; continue;
} }
Strcpy(dungeons[i].dname, pd.tmpdungeon[i].name); Strcpy(g.dungeons[i].dname, pd.tmpdungeon[i].name);
Strcpy(dungeons[i].proto, pd.tmpdungeon[i].protoname); Strcpy(g.dungeons[i].proto, pd.tmpdungeon[i].protoname);
dungeons[i].boneid = pd.tmpdungeon[i].boneschar; g.dungeons[i].boneid = pd.tmpdungeon[i].boneschar;
if (pd.tmpdungeon[i].lev.rand) if (pd.tmpdungeon[i].lev.rand)
dungeons[i].num_dunlevs = (xchar) rn1(pd.tmpdungeon[i].lev.rand, g.dungeons[i].num_dunlevs = (xchar) rn1(pd.tmpdungeon[i].lev.rand,
pd.tmpdungeon[i].lev.base); pd.tmpdungeon[i].lev.base);
else else
dungeons[i].num_dunlevs = (xchar) pd.tmpdungeon[i].lev.base; g.dungeons[i].num_dunlevs = (xchar) pd.tmpdungeon[i].lev.base;
if (!i) { if (!i) {
dungeons[i].ledger_start = 0; g.dungeons[i].ledger_start = 0;
dungeons[i].depth_start = 1; g.dungeons[i].depth_start = 1;
dungeons[i].dunlev_ureached = 1; g.dungeons[i].dunlev_ureached = 1;
} else { } else {
dungeons[i].ledger_start = g.dungeons[i].ledger_start =
dungeons[i - 1].ledger_start + dungeons[i - 1].num_dunlevs; g.dungeons[i - 1].ledger_start + g.dungeons[i - 1].num_dunlevs;
dungeons[i].dunlev_ureached = 0; g.dungeons[i].dunlev_ureached = 0;
} }
dungeons[i].flags.hellish = !!(pd.tmpdungeon[i].flags & HELLISH); g.dungeons[i].flags.hellish = !!(pd.tmpdungeon[i].flags & HELLISH);
dungeons[i].flags.maze_like = !!(pd.tmpdungeon[i].flags & MAZELIKE); g.dungeons[i].flags.maze_like = !!(pd.tmpdungeon[i].flags & MAZELIKE);
dungeons[i].flags.rogue_like = !!(pd.tmpdungeon[i].flags & ROGUELIKE); g.dungeons[i].flags.rogue_like = !!(pd.tmpdungeon[i].flags & ROGUELIKE);
dungeons[i].flags.align = g.dungeons[i].flags.align =
((pd.tmpdungeon[i].flags & D_ALIGN_MASK) >> 4); ((pd.tmpdungeon[i].flags & D_ALIGN_MASK) >> 4);
/* /*
* Set the entry level for this dungeon. The pd.tmpdungeon entry * Set the entry level for this dungeon. The pd.tmpdungeon entry
@@ -818,16 +818,16 @@ init_dungeons()
* redundant. It is used only here and in print_dungeon(). * redundant. It is used only here and in print_dungeon().
*/ */
if (pd.tmpdungeon[i].entry_lev < 0) { if (pd.tmpdungeon[i].entry_lev < 0) {
dungeons[i].entry_lev = g.dungeons[i].entry_lev =
dungeons[i].num_dunlevs + pd.tmpdungeon[i].entry_lev + 1; g.dungeons[i].num_dunlevs + pd.tmpdungeon[i].entry_lev + 1;
if (dungeons[i].entry_lev <= 0) if (g.dungeons[i].entry_lev <= 0)
dungeons[i].entry_lev = 1; g.dungeons[i].entry_lev = 1;
} else if (pd.tmpdungeon[i].entry_lev > 0) { } else if (pd.tmpdungeon[i].entry_lev > 0) {
dungeons[i].entry_lev = pd.tmpdungeon[i].entry_lev; g.dungeons[i].entry_lev = pd.tmpdungeon[i].entry_lev;
if (dungeons[i].entry_lev > dungeons[i].num_dunlevs) if (g.dungeons[i].entry_lev > g.dungeons[i].num_dunlevs)
dungeons[i].entry_lev = dungeons[i].num_dunlevs; g.dungeons[i].entry_lev = g.dungeons[i].num_dunlevs;
} else { /* default */ } else { /* default */
dungeons[i].entry_lev = 1; /* defaults to top level */ g.dungeons[i].entry_lev = 1; /* defaults to top level */
} }
if (i) { /* set depth */ if (i) { /* set depth */
@@ -835,7 +835,7 @@ init_dungeons()
schar from_depth; schar from_depth;
boolean from_up; boolean from_up;
br = add_branch(i, dungeons[i].entry_lev, &pd); br = add_branch(i, g.dungeons[i].entry_lev, &pd);
/* Get the depth of the connecting end. */ /* Get the depth of the connecting end. */
if (br->end1.dnum == i) { if (br->end1.dnum == i) {
@@ -860,14 +860,14 @@ init_dungeons()
* *
* We'll say that portals stay on the same depth. * We'll say that portals stay on the same depth.
*/ */
dungeons[i].depth_start = g.dungeons[i].depth_start =
from_depth + (br->type == BR_PORTAL ? 0 : (from_up ? -1 : 1)) from_depth + (br->type == BR_PORTAL ? 0 : (from_up ? -1 : 1))
- (dungeons[i].entry_lev - 1); - (g.dungeons[i].entry_lev - 1);
} }
/* this is redundant - it should have been flagged by dgn_comp */ /* this is redundant - it should have been flagged by dgn_comp */
if (dungeons[i].num_dunlevs > MAXLEVEL) if (g.dungeons[i].num_dunlevs > MAXLEVEL)
dungeons[i].num_dunlevs = MAXLEVEL; g.dungeons[i].num_dunlevs = MAXLEVEL;
pd.start = pd.n_levs; /* save starting point */ pd.start = pd.n_levs; /* save starting point */
pd.n_levs += pd.tmpdungeon[i].levels; pd.n_levs += pd.tmpdungeon[i].levels;
@@ -908,8 +908,8 @@ init_dungeons()
(void) dlb_fclose(dgn_file); (void) dlb_fclose(dgn_file);
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
tune[i] = 'A' + rn2(7); g.tune[i] = 'A' + rn2(7);
tune[5] = 0; g.tune[5] = 0;
/* /*
* Find most of the special levels and dungeons so we can access their * Find most of the special levels and dungeons so we can access their
@@ -959,8 +959,8 @@ init_dungeons()
making the dummy level overlay level 1; but the whole reason making the dummy level overlay level 1; but the whole reason
for having the dummy level is to make earth have depth -1 for having the dummy level is to make earth have depth -1
instead of 0, so adjust the start point to shift endgame up */ instead of 0, so adjust the start point to shift endgame up */
if (dunlevs_in_dungeon(&x->dlevel) > 1 - dungeons[i].depth_start) if (dunlevs_in_dungeon(&x->dlevel) > 1 - g.dungeons[i].depth_start)
dungeons[i].depth_start -= 1; g.dungeons[i].depth_start -= 1;
/* TODO: strip "dummy" out all the way here, /* TODO: strip "dummy" out all the way here,
so that it's hidden from <ctrl/O> feedback. */ so that it's hidden from <ctrl/O> feedback. */
} }
@@ -983,7 +983,7 @@ xchar
dunlevs_in_dungeon(lev) dunlevs_in_dungeon(lev)
d_level *lev; d_level *lev;
{ {
return dungeons[lev->dnum].num_dunlevs; return g.dungeons[lev->dnum].num_dunlevs;
} }
/* return the lowest level explored in the game*/ /* return the lowest level explored in the game*/
@@ -1013,7 +1013,7 @@ boolean noquest;
for (i = 0; i < g.n_dgns; i++) { for (i = 0; i < g.n_dgns; i++) {
if (noquest && i == quest_dnum) if (noquest && i == quest_dnum)
continue; continue;
tmp.dlevel = dungeons[i].dunlev_ureached; tmp.dlevel = g.dungeons[i].dunlev_ureached;
if (tmp.dlevel == 0) if (tmp.dlevel == 0)
continue; continue;
tmp.dnum = i; tmp.dnum = i;
@@ -1029,12 +1029,12 @@ xchar
ledger_no(lev) ledger_no(lev)
d_level *lev; d_level *lev;
{ {
return (xchar) (lev->dlevel + dungeons[lev->dnum].ledger_start); return (xchar) (lev->dlevel + g.dungeons[lev->dnum].ledger_start);
} }
/* /*
* The last level in the bookkeeping list of level is the bottom of the last * The last level in the bookkeeping list of level is the bottom of the last
* dungeon in the dungeons[] array. * dungeon in the g.dungeons[] array.
* *
* Maxledgerno() -- which is the max number of levels in the bookkeeping * Maxledgerno() -- which is the max number of levels in the bookkeeping
* list, should not be confused with dunlevs_in_dungeon(lev) -- which * list, should not be confused with dunlevs_in_dungeon(lev) -- which
@@ -1045,8 +1045,8 @@ d_level *lev;
xchar xchar
maxledgerno() maxledgerno()
{ {
return (xchar) (dungeons[g.n_dgns - 1].ledger_start return (xchar) (g.dungeons[g.n_dgns - 1].ledger_start
+ dungeons[g.n_dgns - 1].num_dunlevs); + g.dungeons[g.n_dgns - 1].num_dunlevs);
} }
/* return the dungeon that this ledgerno exists in */ /* return the dungeon that this ledgerno exists in */
@@ -1058,8 +1058,8 @@ xchar ledgerno;
/* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */ /* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */
for (i = 0; i < g.n_dgns; i++) for (i = 0; i < g.n_dgns; i++)
if (dungeons[i].ledger_start < ledgerno if (g.dungeons[i].ledger_start < ledgerno
&& ledgerno <= dungeons[i].ledger_start + dungeons[i].num_dunlevs) && ledgerno <= g.dungeons[i].ledger_start + g.dungeons[i].num_dunlevs)
return (xchar) i; return (xchar) i;
panic("level number out of range [ledger_to_dnum(%d)]", (int) ledgerno); panic("level number out of range [ledger_to_dnum(%d)]", (int) ledgerno);
@@ -1073,7 +1073,7 @@ ledger_to_dlev(ledgerno)
xchar ledgerno; xchar ledgerno;
{ {
return (xchar) (ledgerno return (xchar) (ledgerno
- dungeons[ledger_to_dnum(ledgerno)].ledger_start); - g.dungeons[ledger_to_dnum(ledgerno)].ledger_start);
} }
/* returns the depth of a level, in floors below the surface /* returns the depth of a level, in floors below the surface
@@ -1082,7 +1082,7 @@ schar
depth(lev) depth(lev)
d_level *lev; d_level *lev;
{ {
return (schar) (dungeons[lev->dnum].depth_start + lev->dlevel - 1); return (schar) (g.dungeons[lev->dnum].depth_start + lev->dlevel - 1);
} }
/* are "lev1" and "lev2" actually the same? */ /* are "lev1" and "lev2" actually the same? */
@@ -1101,7 +1101,7 @@ d_level *lev;
{ {
s_level *levtmp; s_level *levtmp;
for (levtmp = sp_levchn; levtmp; levtmp = levtmp->next) for (levtmp = g.sp_levchn; levtmp; levtmp = levtmp->next)
if (on_level(lev, &levtmp->dlevel)) if (on_level(lev, &levtmp->dlevel))
return levtmp; return levtmp;
@@ -1130,7 +1130,7 @@ boolean
builds_up(lev) builds_up(lev)
d_level *lev; d_level *lev;
{ {
dungeon *dptr = &dungeons[lev->dnum]; dungeon *dptr = &g.dungeons[lev->dnum];
/* /*
* FIXME: this misclassifies a single level branch reached via stairs * FIXME: this misclassifies a single level branch reached via stairs
* from below. Saving grace is that no such branches currently exist. * from below. Saving grace is that no such branches currently exist.
@@ -1144,9 +1144,9 @@ void
next_level(at_stairs) next_level(at_stairs)
boolean at_stairs; boolean at_stairs;
{ {
if (at_stairs && u.ux == sstairs.sx && u.uy == sstairs.sy) { if (at_stairs && u.ux == g.sstairs.sx && u.uy == g.sstairs.sy) {
/* Taking a down dungeon branch. */ /* Taking a down dungeon branch. */
goto_level(&sstairs.tolev, at_stairs, FALSE, FALSE); goto_level(&g.sstairs.tolev, at_stairs, FALSE, FALSE);
} else { } else {
/* Going down a stairs or jump in a trap door. */ /* Going down a stairs or jump in a trap door. */
d_level newlevel; d_level newlevel;
@@ -1162,14 +1162,14 @@ void
prev_level(at_stairs) prev_level(at_stairs)
boolean at_stairs; boolean at_stairs;
{ {
if (at_stairs && u.ux == sstairs.sx && u.uy == sstairs.sy) { if (at_stairs && u.ux == g.sstairs.sx && u.uy == g.sstairs.sy) {
/* Taking an up dungeon branch. */ /* Taking an up dungeon branch. */
/* KMH -- Upwards branches are okay if not level 1 */ /* KMH -- Upwards branches are okay if not level 1 */
/* (Just make sure it doesn't go above depth 1) */ /* (Just make sure it doesn't go above depth 1) */
if (!u.uz.dnum && u.uz.dlevel == 1 && !u.uhave.amulet) if (!u.uz.dnum && u.uz.dlevel == 1 && !u.uhave.amulet)
done(ESCAPED); done(ESCAPED);
else else
goto_level(&sstairs.tolev, at_stairs, FALSE, FALSE); goto_level(&g.sstairs.tolev, at_stairs, FALSE, FALSE);
} else { } else {
/* Going up a stairs or rising through the ceiling. */ /* Going up a stairs or rising through the ceiling. */
d_level newlevel; d_level newlevel;
@@ -1215,15 +1215,15 @@ int upflag;
destination instead of its enclosing region. destination instead of its enclosing region.
Note: up vs down doesn't matter in this case Note: up vs down doesn't matter in this case
because both specify the same exclusion area. */ because both specify the same exclusion area. */
place_lregion(dndest.nlx, dndest.nly, dndest.nhx, dndest.nhy, place_lregion(g.dndest.nlx, g.dndest.nly, g.dndest.nhx, g.dndest.nhy,
0, 0, 0, 0, LR_DOWNTELE, (d_level *) 0); 0, 0, 0, 0, LR_DOWNTELE, (d_level *) 0);
else if (up) else if (up)
place_lregion(updest.lx, updest.ly, updest.hx, updest.hy, place_lregion(g.updest.lx, g.updest.ly, g.updest.hx, g.updest.hy,
updest.nlx, updest.nly, updest.nhx, updest.nhy, g.updest.nlx, g.updest.nly, g.updest.nhx, g.updest.nhy,
LR_UPTELE, (d_level *) 0); LR_UPTELE, (d_level *) 0);
else else
place_lregion(dndest.lx, dndest.ly, dndest.hx, dndest.hy, place_lregion(g.dndest.lx, g.dndest.ly, g.dndest.hx, g.dndest.hy,
dndest.nlx, dndest.nly, dndest.nhx, dndest.nhy, g.dndest.nlx, g.dndest.nly, g.dndest.nhx, g.dndest.nhy,
LR_DOWNTELE, (d_level *) 0); LR_DOWNTELE, (d_level *) 0);
} }
@@ -1232,8 +1232,8 @@ void
u_on_sstairs(upflag) u_on_sstairs(upflag)
int upflag; int upflag;
{ {
if (sstairs.sx) if (g.sstairs.sx)
u_on_newpos(sstairs.sx, sstairs.sy); u_on_newpos(g.sstairs.sx, g.sstairs.sy);
else else
u_on_rndspot(upflag); u_on_rndspot(upflag);
} }
@@ -1266,14 +1266,14 @@ xchar x, y;
|| (x == xdnstair && y == ydnstair) || (x == xdnstair && y == ydnstair)
|| (x == xdnladder && y == ydnladder) || (x == xdnladder && y == ydnladder)
|| (x == xupladder && y == yupladder) || (x == xupladder && y == yupladder)
|| (x == sstairs.sx && y == sstairs.sy)); || (x == g.sstairs.sx && y == g.sstairs.sy));
} }
boolean boolean
Is_botlevel(lev) Is_botlevel(lev)
d_level *lev; d_level *lev;
{ {
return (boolean) (lev->dlevel == dungeons[lev->dnum].num_dunlevs); return (boolean) (lev->dlevel == g.dungeons[lev->dnum].num_dunlevs);
} }
boolean boolean
@@ -1314,9 +1314,9 @@ d_level *lev;
|| (Is_wiz1_level(lev) && In_W_tower(x, y, lev))) || (Is_wiz1_level(lev) && In_W_tower(x, y, lev)))
return FALSE; return FALSE;
return (boolean) (lev->dlevel > 1 return (boolean) (lev->dlevel > 1
|| (dungeons[lev->dnum].entry_lev == 1 || (g.dungeons[lev->dnum].entry_lev == 1
&& ledger_no(lev) != 1 && ledger_no(lev) != 1
&& sstairs.sx && sstairs.up)); && g.sstairs.sx && g.sstairs.up));
} }
boolean boolean
@@ -1350,9 +1350,9 @@ int levnum;
/* can only currently happen in endgame */ /* can only currently happen in endgame */
levnum = u.uz.dlevel; levnum = u.uz.dlevel;
} else if (levnum } else if (levnum
> dungeons[dgn].depth_start + dungeons[dgn].num_dunlevs - 1) { > g.dungeons[dgn].depth_start + g.dungeons[dgn].num_dunlevs - 1) {
/* beyond end of dungeon, jump to last level */ /* beyond end of dungeon, jump to last level */
levnum = dungeons[dgn].num_dunlevs; levnum = g.dungeons[dgn].num_dunlevs;
} else { } else {
/* The desired level is in this dungeon or a "higher" one. */ /* The desired level is in this dungeon or a "higher" one. */
@@ -1360,7 +1360,7 @@ int levnum;
* Branch up the tree until we reach a dungeon that contains the * Branch up the tree until we reach a dungeon that contains the
* levnum. * levnum.
*/ */
if (levnum < dungeons[dgn].depth_start) { if (levnum < g.dungeons[dgn].depth_start) {
do { do {
/* /*
* Find the parent dungeon of this dungeon. * Find the parent dungeon of this dungeon.
@@ -1375,11 +1375,11 @@ int levnum;
panic("get_level: can't find parent dungeon"); panic("get_level: can't find parent dungeon");
dgn = br->end1.dnum; dgn = br->end1.dnum;
} while (levnum < dungeons[dgn].depth_start); } while (levnum < g.dungeons[dgn].depth_start);
} }
/* We're within the same dungeon; calculate the level. */ /* We're within the same dungeon; calculate the level. */
levnum = levnum - dungeons[dgn].depth_start + 1; levnum = levnum - g.dungeons[dgn].depth_start + 1;
} }
newlevel->dnum = dgn; newlevel->dnum = dgn;
@@ -1477,11 +1477,11 @@ d_level *lev;
/* /*
* Both of the exclusion regions for arriving via level teleport * Both of the exclusion regions for arriving via level teleport
* (from above or below) define the tower's boundary. * (from above or below) define the tower's boundary.
* assert( updest.nIJ == dndest.nIJ for I={l|h},J={x|y} ); * assert( g.updest.nIJ == g.dndest.nIJ for I={l|h},J={x|y} );
*/ */
if (dndest.nlx > 0) if (g.dndest.nlx > 0)
return (boolean) within_bounded_area(x, y, dndest.nlx, dndest.nly, return (boolean) within_bounded_area(x, y, g.dndest.nlx, g.dndest.nly,
dndest.nhx, dndest.nhy); g.dndest.nhx, g.dndest.nhy);
else else
impossible("No boundary for Wizard's Tower?"); impossible("No boundary for Wizard's Tower?");
return FALSE; return FALSE;
@@ -1492,7 +1492,7 @@ boolean
In_hell(lev) In_hell(lev)
d_level *lev; d_level *lev;
{ {
return (boolean) (dungeons[lev->dnum].flags.hellish); return (boolean) (g.dungeons[lev->dnum].flags.hellish);
} }
/* sets *lev to be the gateway to Gehennom... */ /* sets *lev to be the gateway to Gehennom... */
@@ -1550,9 +1550,9 @@ int pct;
if (rn2(100) < pct) if (rn2(100) < pct)
return lev->flags.align; return lev->flags.align;
if (dungeons[u.uz.dnum].flags.align) if (g.dungeons[u.uz.dnum].flags.align)
if (rn2(100) < pct) if (rn2(100) < pct)
return dungeons[u.uz.dnum].flags.align; return g.dungeons[u.uz.dnum].flags.align;
al = rn2(3) - 1; al = rn2(3) - 1;
return Align2amask(al); return Align2amask(al);
@@ -1563,7 +1563,7 @@ Invocation_lev(lev)
d_level *lev; d_level *lev;
{ {
return (boolean) (In_hell(lev) return (boolean) (In_hell(lev)
&& lev->dlevel == dungeons[lev->dnum].num_dunlevs - 1); && lev->dlevel == g.dungeons[lev->dnum].num_dunlevs - 1);
} }
/* use instead of depth() wherever a degree of difficulty is made /* use instead of depth() wherever a degree of difficulty is made
@@ -1586,7 +1586,7 @@ level_difficulty()
they were easier; adjust for the extra effort involved in they were easier; adjust for the extra effort involved in
going down to the entrance and then up to the location */ going down to the entrance and then up to the location */
if (builds_up(&u.uz)) if (builds_up(&u.uz))
res += 2 * (dungeons[u.uz.dnum].entry_lev - u.uz.dlevel + 1); res += 2 * (g.dungeons[u.uz.dnum].entry_lev - u.uz.dlevel + 1);
/* /*
* 'Proof' by example: suppose the entrance to sokoban is * 'Proof' by example: suppose the entrance to sokoban is
* on dungeon level 9, leading up to bottom sokoban level * on dungeon level 9, leading up to bottom sokoban level
@@ -1711,7 +1711,7 @@ unplaced_floater(dptr)
struct dungeon *dptr; struct dungeon *dptr;
{ {
branch *br; branch *br;
int idx = (int) (dptr - dungeons); int idx = (int) (dptr - g.dungeons);
/* if other floating branches are added, this will need to change */ /* if other floating branches are added, this will need to change */
if (idx != knox_level.dnum) if (idx != knox_level.dnum)
@@ -1817,7 +1817,7 @@ struct lchoice *lchoices_p;
Sprintf(buf, "%c %s to %s: %d", Sprintf(buf, "%c %s to %s: %d",
bymenu ? chr_u_on_lvl(&br->end1) : ' ', bymenu ? chr_u_on_lvl(&br->end1) : ' ',
br_string(br->type), br_string(br->type),
dungeons[br->end2.dnum].dname, depth(&br->end1)); g.dungeons[br->end2.dnum].dname, depth(&br->end1));
if (bymenu) if (bymenu)
tport_menu(win, buf, lchoices_p, &br->end1, tport_menu(win, buf, lchoices_p, &br->end1,
unreachable_level(&br->end1, FALSE)); unreachable_level(&br->end1, FALSE));
@@ -1851,7 +1851,7 @@ xchar *rdgn;
lchoices.menuletter = 'a'; lchoices.menuletter = 'a';
} }
for (i = 0, dptr = dungeons; i < g.n_dgns; i++, dptr++) { for (i = 0, dptr = g.dungeons; i < g.n_dgns; i++, dptr++) {
if (bymenu && In_endgame(&u.uz) && i != astral_level.dnum) if (bymenu && In_endgame(&u.uz) && i != astral_level.dnum)
continue; continue;
unplaced = unplaced_floater(dptr); unplaced = unplaced_floater(dptr);
@@ -1882,7 +1882,7 @@ xchar *rdgn;
* Circle through the special levels to find levels that are in * Circle through the special levels to find levels that are in
* this dungeon. * this dungeon.
*/ */
for (slev = sp_levchn, last_level = 0; slev; slev = slev->next) { for (slev = g.sp_levchn, last_level = 0; slev; slev = slev->next) {
if (slev->dlevel.dnum != i) if (slev->dlevel.dnum != i)
continue; continue;
@@ -1894,7 +1894,7 @@ xchar *rdgn;
chr_u_on_lvl(&slev->dlevel), chr_u_on_lvl(&slev->dlevel),
slev->proto, depth(&slev->dlevel)); slev->proto, depth(&slev->dlevel));
if (Is_stronghold(&slev->dlevel)) if (Is_stronghold(&slev->dlevel))
Sprintf(eos(buf), " (tune %s)", tune); Sprintf(eos(buf), " (tune %s)", g.tune);
if (bymenu) if (bymenu)
tport_menu(win, buf, &lchoices, &slev->dlevel, tport_menu(win, buf, &lchoices, &slev->dlevel,
unreachable_level(&slev->dlevel, unplaced)); unreachable_level(&slev->dlevel, unplaced));
@@ -1936,7 +1936,7 @@ xchar *rdgn;
first = FALSE; first = FALSE;
} }
Sprintf(buf, " %s to %s", br_string(br->type), Sprintf(buf, " %s to %s", br_string(br->type),
dungeons[br->end2.dnum].dname); g.dungeons[br->end2.dnum].dname);
putstr(win, 0, buf); putstr(win, 0, buf);
} }
} }
@@ -1945,7 +1945,7 @@ xchar *rdgn;
if (Invocation_lev(&u.uz)) { if (Invocation_lev(&u.uz)) {
putstr(win, 0, ""); putstr(win, 0, "");
Sprintf(buf, "Invocation position @ (%d,%d), hero @ (%d,%d)", Sprintf(buf, "Invocation position @ (%d,%d), hero @ (%d,%d)",
inv_pos.x, inv_pos.y, u.ux, u.uy); g.inv_pos.x, g.inv_pos.y, u.ux, u.uy);
putstr(win, 0, buf); putstr(win, 0, buf);
} else { } else {
struct trap *trap; struct trap *trap;
@@ -2118,7 +2118,7 @@ int ledger_num;
struct cemetery *bp; struct cemetery *bp;
for (mptr = g.mapseenchn; mptr; mptr = mptr->next) for (mptr = g.mapseenchn; mptr; mptr = mptr->next)
if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel if (g.dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel
== ledger_num) == ledger_num)
break; break;
@@ -2147,7 +2147,7 @@ int ledger_num;
struct cemetery *bp, *bpnext; struct cemetery *bp, *bpnext;
for (mptr = g.mapseenchn; mptr; mprev = mptr, mptr = mptr->next) for (mptr = g.mapseenchn; mptr; mprev = mptr, mptr = mptr->next)
if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel == ledger_num) if (g.dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel == ledger_num)
break; break;
if (!mptr) if (!mptr)
@@ -2380,7 +2380,7 @@ mapseen *mptr;
&& (mptr->flags.knownbones || wizard)) && (mptr->flags.knownbones || wizard))
|| mptr->custom || mptr->br || mptr->custom || mptr->br
|| (mptr->lev.dlevel || (mptr->lev.dlevel
== dungeons[mptr->lev.dnum].dunlev_ureached)); == g.dungeons[mptr->lev.dnum].dunlev_ureached));
} }
/* recalculate mapseen for the current level */ /* recalculate mapseen for the current level */
@@ -2437,9 +2437,9 @@ recalc_mapseen()
&& u.uevent.qcalled && u.uevent.qcalled
&& !(u.uevent.qcompleted && !(u.uevent.qcompleted
|| u.uevent.qexpelled || u.uevent.qexpelled
|| quest_status.leader_is_dead)); || g.quest_status.leader_is_dead));
mptr->flags.questing = (on_level(&u.uz, &qstart_level) mptr->flags.questing = (on_level(&u.uz, &qstart_level)
&& quest_status.got_quest); && g.quest_status.got_quest);
/* track rooms the hero is in */ /* track rooms the hero is in */
for (i = 0; i < SIZE(u.urooms); ++i) { for (i = 0; i < SIZE(u.urooms); ++i) {
@@ -2863,7 +2863,7 @@ char *outbuf;
char tmp[BUFSZ]; char tmp[BUFSZ];
if (u.uevent.uheard_tune == 2) if (u.uevent.uheard_tune == 2)
Sprintf(tmp, "notes \"%s\"", tune); Sprintf(tmp, "notes \"%s\"", g.tune);
else else
Strcpy(tmp, "5-note tune"); Strcpy(tmp, "5-note tune");
Sprintf(outbuf, " (play %s to open or close drawbridge)", tmp); Sprintf(outbuf, " (play %s to open or close drawbridge)", tmp);
@@ -2914,22 +2914,22 @@ boolean printdun;
if (dnum == quest_dnum || dnum == knox_level.dnum) if (dnum == quest_dnum || dnum == knox_level.dnum)
depthstart = 1; depthstart = 1;
else else
depthstart = dungeons[dnum].depth_start; depthstart = g.dungeons[dnum].depth_start;
if (printdun) { if (printdun) {
if (dungeons[dnum].dunlev_ureached == dungeons[dnum].entry_lev if (g.dungeons[dnum].dunlev_ureached == g.dungeons[dnum].entry_lev
/* suppress the negative numbers in the endgame */ /* suppress the negative numbers in the endgame */
|| In_endgame(&mptr->lev)) || In_endgame(&mptr->lev))
Sprintf(buf, "%s:", dungeons[dnum].dname); Sprintf(buf, "%s:", g.dungeons[dnum].dname);
else if (builds_up(&mptr->lev)) else if (builds_up(&mptr->lev))
Sprintf(buf, "%s: levels %d up to %d", Sprintf(buf, "%s: levels %d up to %d",
dungeons[dnum].dname, g.dungeons[dnum].dname,
depthstart + dungeons[dnum].entry_lev - 1, depthstart + g.dungeons[dnum].entry_lev - 1,
depthstart + dungeons[dnum].dunlev_ureached - 1); depthstart + g.dungeons[dnum].dunlev_ureached - 1);
else else
Sprintf(buf, "%s: levels %d to %d", Sprintf(buf, "%s: levels %d to %d",
dungeons[dnum].dname, depthstart, g.dungeons[dnum].dname, depthstart,
depthstart + dungeons[dnum].dunlev_ureached - 1); depthstart + g.dungeons[dnum].dunlev_ureached - 1);
putstr(win, !final ? ATR_INVERSE : 0, buf); putstr(win, !final ? ATR_INVERSE : 0, buf);
} }
@@ -3044,7 +3044,7 @@ boolean printdun;
/* print out branches */ /* print out branches */
if (mptr->br) { if (mptr->br) {
Sprintf(buf, "%s%s to %s", PREFIX, br_string2(mptr->br), Sprintf(buf, "%s%s to %s", PREFIX, br_string2(mptr->br),
dungeons[mptr->br->end2.dnum].dname); g.dungeons[mptr->br->end2.dnum].dname);
/* Since mapseen objects are printed out in increasing order /* Since mapseen objects are printed out in increasing order
* of dlevel, clarify which level this branch is going to * of dlevel, clarify which level this branch is going to
+18 -18
View File
@@ -150,8 +150,8 @@ eatmdone(VOID_ARGS)
{ {
/* release `eatmbuf' */ /* release `eatmbuf' */
if (g.eatmbuf) { if (g.eatmbuf) {
if (nomovemsg == g.eatmbuf) if (g.nomovemsg == g.eatmbuf)
nomovemsg = 0; g.nomovemsg = 0;
free((genericptr_t) g.eatmbuf), g.eatmbuf = 0; free((genericptr_t) g.eatmbuf), g.eatmbuf = 0;
} }
/* update display */ /* update display */
@@ -169,7 +169,7 @@ eatmupdate()
const char *altmsg = 0; const char *altmsg = 0;
int altapp = 0; /* lint suppression */ int altapp = 0; /* lint suppression */
if (!g.eatmbuf || nomovemsg != g.eatmbuf) if (!g.eatmbuf || g.nomovemsg != g.eatmbuf)
return; return;
if (is_obj_mappear(&youmonst,ORANGE) && !Hallucination) { if (is_obj_mappear(&youmonst,ORANGE) && !Hallucination) {
@@ -190,7 +190,7 @@ eatmupdate()
free((genericptr_t) g.eatmbuf); free((genericptr_t) g.eatmbuf);
g.eatmbuf = (char *) alloc(strlen(altmsg) + 1); g.eatmbuf = (char *) alloc(strlen(altmsg) + 1);
} }
nomovemsg = strcpy(g.eatmbuf, altmsg); g.nomovemsg = strcpy(g.eatmbuf, altmsg);
/* update current image */ /* update current image */
youmonst.mappearance = altapp; youmonst.mappearance = altapp;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
@@ -452,10 +452,10 @@ boolean message;
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 */
newuhs(FALSE); newuhs(FALSE);
if (nomovemsg) { if (g.nomovemsg) {
if (message) if (message)
pline1(nomovemsg); pline1(g.nomovemsg);
nomovemsg = 0; g.nomovemsg = 0;
} else if (message) } else if (message)
You("finish eating %s.", food_xname(piece, TRUE)); You("finish eating %s.", food_xname(piece, TRUE));
@@ -1032,7 +1032,7 @@ int pm;
: "You now prefer mimicking %s again.", : "You now prefer mimicking %s again.",
an(Upolyd ? youmonst.data->mname : urace.noun)); an(Upolyd ? youmonst.data->mname : urace.noun));
g.eatmbuf = dupstr(buf); g.eatmbuf = dupstr(buf);
nomovemsg = g.eatmbuf; g.nomovemsg = g.eatmbuf;
g.afternmv = eatmdone; g.afternmv = eatmdone;
/* ??? what if this was set before? */ /* ??? what if this was set before? */
youmonst.m_ap_type = M_AP_OBJECT; youmonst.m_ap_type = M_AP_OBJECT;
@@ -1575,7 +1575,7 @@ struct obj *obj;
context.botl = TRUE; context.botl = TRUE;
nomul(-duration); nomul(-duration);
g.multi_reason = "unconscious from rotten food"; g.multi_reason = "unconscious from rotten food";
nomovemsg = "You are conscious again."; g.nomovemsg = "You are conscious again.";
g.afternmv = Hear_again; g.afternmv = Hear_again;
return 1; return 1;
} }
@@ -1750,19 +1750,19 @@ struct obj *otmp;
} }
} }
old_nomovemsg = nomovemsg; old_nomovemsg = g.nomovemsg;
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 (++context.victual.usedtime >= context.victual.reqtime) {
/* don't want done_eating() to issue 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 = nomovemsg; save_nomovemsg = g.nomovemsg;
if (!old_nomovemsg) if (!old_nomovemsg)
nomovemsg = 0; g.nomovemsg = 0;
done_eating(FALSE); done_eating(FALSE);
if (!old_nomovemsg) if (!old_nomovemsg)
nomovemsg = save_nomovemsg; g.nomovemsg = save_nomovemsg;
} }
return; return;
} }
@@ -2862,7 +2862,7 @@ int num;
if (!context.victual.eating if (!context.victual.eating
|| (context.victual.eating && !context.victual.fullwarn)) { || (context.victual.eating && !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.");
nomovemsg = "You're finally finished."; g.nomovemsg = "You're finally finished.";
if (!context.victual.eating) { if (!context.victual.eating) {
g.multi = -2; g.multi = -2;
} else { } else {
@@ -2873,7 +2873,7 @@ int num;
if (yn_function("Continue eating?", ynchars, 'n') if (yn_function("Continue eating?", ynchars, 'n')
!= 'y') { != 'y') {
reset_eat(); reset_eat();
nomovemsg = (char *) 0; g.nomovemsg = (char *) 0;
} }
} }
} }
@@ -2977,7 +2977,7 @@ boolean incr;
context.botl = TRUE; context.botl = TRUE;
nomul(-duration); nomul(-duration);
g.multi_reason = "fainted from lack of food"; g.multi_reason = "fainted from lack of food";
nomovemsg = "You regain consciousness."; g.nomovemsg = "You regain consciousness.";
g.afternmv = unfaint; g.afternmv = unfaint;
newhs = FAINTED; newhs = FAINTED;
if (!Levitation) if (!Levitation)
@@ -3198,7 +3198,7 @@ vomit() /* A good idea from David Neves */
if (g.multi >= -2) { if (g.multi >= -2) {
nomul(-2); nomul(-2);
g.multi_reason = "vomiting"; g.multi_reason = "vomiting";
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
} }
} }
+7 -7
View File
@@ -715,7 +715,7 @@ time_t when; /* date+time at end of game */
putstr(0, 0, ""); putstr(0, 0, "");
/* character name and basic role info */ /* character name and basic role info */
Sprintf(pbuf, "%s, %s %s %s %s", plname, Sprintf(pbuf, "%s, %s %s %s %s", g.plname,
aligns[1 - u.ualign.type].adj, aligns[1 - u.ualign.type].adj,
genders[flags.female].adj, genders[flags.female].adj,
urace.adj, urace.adj,
@@ -846,7 +846,7 @@ int how;
} }
if (how == CHOKING) if (how == CHOKING)
init_uhunger(); init_uhunger();
nomovemsg = "You survived that attempt on your life."; g.nomovemsg = "You survived that attempt on your life.";
context.move = 0; context.move = 0;
if (g.multi > 0) if (g.multi > 0)
g.multi = 0; g.multi = 0;
@@ -1270,8 +1270,8 @@ int how;
? urace.femalenum ? urace.femalenum
: urace.malenum; : urace.malenum;
} }
corpse = mk_named_object(CORPSE, &mons[mnum], u.ux, u.uy, plname); corpse = mk_named_object(CORPSE, &mons[mnum], u.ux, u.uy, g.plname);
Sprintf(pbuf, "%s, ", plname); Sprintf(pbuf, "%s, ", g.plname);
formatkiller(eos(pbuf), sizeof pbuf - strlen(pbuf), how, TRUE); formatkiller(eos(pbuf), sizeof pbuf - strlen(pbuf), how, TRUE);
make_grave(u.ux, u.uy, pbuf); make_grave(u.ux, u.uy, pbuf);
} }
@@ -1328,7 +1328,7 @@ int how;
/* update gold for the rip output, which can't use hidden_gold() /* update gold for the rip output, which can't use hidden_gold()
(containers will be gone by then if bones just got saved...) */ (containers will be gone by then if bones just got saved...) */
done_money = umoney; g.done_money = umoney;
/* clean up unneeded windows */ /* clean up unneeded windows */
if (have_windows) { if (have_windows) {
@@ -1374,7 +1374,7 @@ int how;
/* don't bother counting to see whether it should be plural */ /* don't bother counting to see whether it should be plural */
} }
Sprintf(pbuf, "%s %s the %s...", Goodbye(), plname, Sprintf(pbuf, "%s %s the %s...", Goodbye(), g.plname,
(how != ASCENDED) (how != ASCENDED)
? (const char *) ((flags.female && urole.name.f) ? (const char *) ((flags.female && urole.name.f)
? urole.name.f ? urole.name.f
@@ -1484,7 +1484,7 @@ int how;
(u.uz.dlevel < 0) ? "passed away" : ends[how]); (u.uz.dlevel < 0) ? "passed away" : ends[how]);
} else { } else {
/* more conventional demise */ /* more conventional demise */
const char *where = dungeons[u.uz.dnum].dname; const char *where = g.dungeons[u.uz.dnum].dname;
if (Is_astralevel(&u.uz)) if (Is_astralevel(&u.uz))
where = "The Astral Plane"; where = "The Astral Plane";
+9 -9
View File
@@ -400,7 +400,7 @@ xchar e_type;
ep->engr_txt = (char *) (ep + 1); ep->engr_txt = (char *) (ep + 1);
Strcpy(ep->engr_txt, s); Strcpy(ep->engr_txt, s);
/* engraving Elbereth shows wisdom */ /* engraving Elbereth shows wisdom */
if (!in_mklev && !strcmp(s, "Elbereth")) if (!g.in_mklev && !strcmp(s, "Elbereth"))
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
ep->engr_time = e_time; ep->engr_time = e_time;
ep->engr_type = e_type > 0 ? e_type : rnd(N_ENGRAVE - 1); ep->engr_type = e_type > 0 ? e_type : rnd(N_ENGRAVE - 1);
@@ -490,7 +490,7 @@ doengrave()
char *writer; char *writer;
g.multi = 0; /* moves consumed */ g.multi = 0; /* moves consumed */
nomovemsg = (char *) 0; /* occupation end message */ g.nomovemsg = (char *) 0; /* occupation end message */
buf[0] = (char) 0; buf[0] = (char) 0;
ebuf[0] = (char) 0; ebuf[0] = (char) 0;
@@ -1066,12 +1066,12 @@ doengrave()
default: default:
g.multi = -(len / 10); g.multi = -(len / 10);
if (g.multi) if (g.multi)
nomovemsg = "You finish your weird engraving."; g.nomovemsg = "You finish your weird engraving.";
break; break;
case DUST: case DUST:
g.multi = -(len / 10); g.multi = -(len / 10);
if (g.multi) if (g.multi)
nomovemsg = "You finish writing in the dust."; g.nomovemsg = "You finish writing in the dust.";
break; break;
case HEADSTONE: case HEADSTONE:
case ENGRAVE: case ENGRAVE:
@@ -1098,12 +1098,12 @@ doengrave()
g.multi = -len; g.multi = -len;
} }
if (g.multi) if (g.multi)
nomovemsg = "You finish engraving."; g.nomovemsg = "You finish engraving.";
break; break;
case BURN: case BURN:
g.multi = -(len / 10); g.multi = -(len / 10);
if (g.multi) if (g.multi)
nomovemsg = is_ice(u.ux, u.uy) g.nomovemsg = is_ice(u.ux, u.uy)
? "You finish melting your message into the ice." ? "You finish melting your message into the ice."
: "You finish burning your message into the floor."; : "You finish burning your message into the floor.";
break; break;
@@ -1121,12 +1121,12 @@ doengrave()
otmp->spe -= 1; /* Prevent infinite graffiti */ otmp->spe -= 1; /* Prevent infinite graffiti */
} }
if (g.multi) if (g.multi)
nomovemsg = "You finish defacing the dungeon."; g.nomovemsg = "You finish defacing the dungeon.";
break; break;
case ENGR_BLOOD: case ENGR_BLOOD:
g.multi = -(len / 10); g.multi = -(len / 10);
if (g.multi) if (g.multi)
nomovemsg = "You finish scrawling."; g.nomovemsg = "You finish scrawling.";
break; break;
} }
@@ -1138,7 +1138,7 @@ doengrave()
if (!maxelen && *sp) { if (!maxelen && *sp) {
*sp = '\0'; *sp = '\0';
if (g.multi) if (g.multi)
nomovemsg = "You cannot write any more."; g.nomovemsg = "You cannot write any more.";
You("are only able to write \"%s\".", ebuf); You("are only able to write \"%s\".", ebuf);
} }
} }
+1 -1
View File
@@ -249,7 +249,7 @@ makeroguerooms()
int lowx, lowy, hix, hiy; int lowx, lowy, hix, hiy;
g.r[x][y].nroom = g.nroom; g.r[x][y].nroom = g.nroom;
smeq[g.nroom] = g.nroom; g.smeq[g.nroom] = g.nroom;
lowx = 1 + 26 * x + here.rlx; lowx = 1 + 26 * x + here.rlx;
lowy = 7 * y + here.rly; lowy = 7 * y + here.rly;
+12 -12
View File
@@ -738,7 +738,7 @@ d_level *lev;
in the quest branch, skipping the boneid character 'Q' and the in the quest branch, skipping the boneid character 'Q' and the
first letter of the role's filecode; bones loading still worked first letter of the role's filecode; bones loading still worked
because the bonesid used for validation had the same error */ because the bonesid used for validation had the same error */
Sprintf(dptr, "%c%s", dungeons[lev->dnum].boneid, Sprintf(dptr, "%c%s", g.dungeons[lev->dnum].boneid,
In_quest(lev) ? urole.filecode : "0"); In_quest(lev) ? urole.filecode : "0");
if ((sptr = Is_special(lev)) != 0) if ((sptr = Is_special(lev)) != 0)
Sprintf(eos(dptr), ".%c", sptr->boneid); Sprintf(eos(dptr), ".%c", sptr->boneid);
@@ -896,14 +896,14 @@ compress_bonesfile()
/* ---------- BEGIN SAVE FILE HANDLING ----------- */ /* ---------- BEGIN SAVE FILE HANDLING ----------- */
/* set savefile name in OS-dependent manner from pre-existing plname, /* set savefile name in OS-dependent manner from pre-existing g.plname,
* avoiding troublesome characters */ * avoiding troublesome characters */
void void
set_savefile_name(regularize_it) set_savefile_name(regularize_it)
boolean regularize_it; boolean regularize_it;
{ {
#ifdef VMS #ifdef VMS
Sprintf(SAVEF, "[.save]%d%s", getuid(), plname); Sprintf(SAVEF, "[.save]%d%s", getuid(), g.plname);
if (regularize_it) if (regularize_it)
regularize(SAVEF + 7); regularize(SAVEF + 7);
Strcat(SAVEF, ";1"); Strcat(SAVEF, ";1");
@@ -916,10 +916,10 @@ boolean regularize_it;
{ {
int i = strlen(SAVEP); int i = strlen(SAVEP);
#ifdef AMIGA #ifdef AMIGA
/* plname has to share space with SAVEP and ".sav" */ /* g.plname has to share space with SAVEP and ".sav" */
(void) strncat(SAVEF, plname, FILENAME - i - 4); (void) strncat(SAVEF, g.plname, FILENAME - i - 4);
#else #else
(void) strncat(SAVEF, plname, 8); (void) strncat(SAVEF, g.plname, 8);
#endif #endif
if (regularize_it) if (regularize_it)
regularize(SAVEF + i); regularize(SAVEF + i);
@@ -935,14 +935,14 @@ boolean regularize_it;
/* Obtain the name of the logged on user and incorporate /* Obtain the name of the logged on user and incorporate
* it into the name. */ * it into the name. */
Sprintf(fnamebuf, "%s-%s", get_username(0), plname); Sprintf(fnamebuf, "%s-%s", get_username(0), g.plname);
if (regularize_it) if (regularize_it)
++legal; /* skip '*' wildcard character */ ++legal; /* skip '*' wildcard character */
(void) fname_encode(legal, '%', fnamebuf, encodedfnamebuf, BUFSZ); (void) fname_encode(legal, '%', fnamebuf, encodedfnamebuf, BUFSZ);
Sprintf(SAVEF, "%s%s", encodedfnamebuf, SAVE_EXTENSION); Sprintf(SAVEF, "%s%s", encodedfnamebuf, SAVE_EXTENSION);
} }
#else /* not VMS or MICRO or WIN32 */ #else /* not VMS or MICRO or WIN32 */
Sprintf(SAVEF, "save/%d%s", (int) getuid(), plname); Sprintf(SAVEF, "save/%d%s", (int) getuid(), g.plname);
if (regularize_it) if (regularize_it)
regularize(SAVEF + 5); /* avoid . or / in name */ regularize(SAVEF + 5); /* avoid . or / in name */
#endif /* WIN32 */ #endif /* WIN32 */
@@ -1130,7 +1130,7 @@ get_saved_games()
char *foundfile; char *foundfile;
const char *fq_save; const char *fq_save;
Strcpy(plname, "*"); Strcpy(g.plname, "*");
set_savefile_name(FALSE); set_savefile_name(FALSE);
#if defined(ZLIB_COMP) #if defined(ZLIB_COMP)
Strcat(SAVEF, COMPRESS_EXTENSION); Strcat(SAVEF, COMPRESS_EXTENSION);
@@ -1200,7 +1200,7 @@ get_saved_games()
} }
#endif #endif
#ifdef VMS #ifdef VMS
Strcpy(plname, "*"); Strcpy(g.plname, "*");
set_savefile_name(FALSE); set_savefile_name(FALSE);
j = vms_get_saved_games(SAVEF, &result); j = vms_get_saved_games(SAVEF, &result);
#endif /* VMS */ #endif /* VMS */
@@ -2359,7 +2359,7 @@ char *origbuf;
#endif /*NOCWD_ASSUMPTIONS*/ #endif /*NOCWD_ASSUMPTIONS*/
} else if (match_varname(buf, "NAME", 4)) { } else if (match_varname(buf, "NAME", 4)) {
(void) strncpy(plname, bufp, PL_NSIZ - 1); (void) strncpy(g.plname, bufp, PL_NSIZ - 1);
} else if (match_varname(buf, "ROLE", 4) } else if (match_varname(buf, "ROLE", 4)
|| match_varname(buf, "CHARACTER", 4)) { || match_varname(buf, "CHARACTER", 4)) {
if ((len = str2role(bufp)) >= 0) if ((len = str2role(bufp)) >= 0)
@@ -3540,7 +3540,7 @@ const char *reason; /* explanation */
if (lfile) { if (lfile) {
#ifdef PANICLOG_FMT2 #ifdef PANICLOG_FMT2
(void) fprintf(lfile, "%ld %s: %s %s\n", (void) fprintf(lfile, "%ld %s: %s %s\n",
ubirthday, (plname ? plname : "(none)"), ubirthday, (g.plname ? g.plname : "(none)"),
type, reason); type, reason);
#else #else
time_t now = getnow(); time_t now = getnow();
+11 -11
View File
@@ -681,7 +681,7 @@ invocation_pos(x, y)
xchar x, y; xchar x, y;
{ {
return (boolean) (Invocation_lev(&u.uz) return (boolean) (Invocation_lev(&u.uz)
&& x == inv_pos.x && y == inv_pos.y); && x == g.inv_pos.x && y == g.inv_pos.y);
} }
/* return TRUE if (dx,dy) is an OK place to move /* return TRUE if (dx,dy) is an OK place to move
@@ -1863,7 +1863,7 @@ domove()
if (cause_delay) { if (cause_delay) {
nomul(-2); nomul(-2);
g.multi_reason = "dragging an iron ball"; g.multi_reason = "dragging an iron ball";
nomovemsg = ""; g.nomovemsg = "";
} }
if (context.run && flags.runmode != RUN_TPORT) { if (context.run && flags.runmode != RUN_TPORT) {
@@ -2418,10 +2418,10 @@ register boolean newlev;
struct monst *oracle = monstinroom(&mons[PM_ORACLE], roomno); struct monst *oracle = monstinroom(&mons[PM_ORACLE], roomno);
if (oracle) { if (oracle) {
if (!oracle->mpeaceful) if (!oracle->mpeaceful)
verbalize("You're in Delphi, %s.", plname); verbalize("You're in Delphi, %s.", g.plname);
else else
verbalize("%s, %s, welcome to Delphi!", verbalize("%s, %s, welcome to Delphi!",
Hello((struct monst *) 0), plname); Hello((struct monst *) 0), g.plname);
} else } else
msg_given = FALSE; msg_given = FALSE;
break; break;
@@ -2565,7 +2565,7 @@ dopickup(VOID_ARGS)
int count, tmpcount, ret; int count, tmpcount, ret;
/* awful kludge to work around parse()'s pre-decrement */ /* awful kludge to work around parse()'s pre-decrement */
count = (g.multi || (save_cm && *save_cm == cmd_from_func(dopickup))) ? g.multi + 1 : 0; count = (g.multi || (g.save_cm && *g.save_cm == cmd_from_func(dopickup))) ? g.multi + 1 : 0;
g.multi = 0; /* always reset */ g.multi = 0; /* always reset */
if ((ret = pickup_checks() >= 0)) if ((ret = pickup_checks() >= 0))
@@ -2824,12 +2824,12 @@ const char *msg_override;
{ {
g.multi = 0; /* caller will usually have done this already */ g.multi = 0; /* caller will usually have done this already */
if (msg_override) if (msg_override)
nomovemsg = msg_override; g.nomovemsg = msg_override;
else if (!nomovemsg) else if (!g.nomovemsg)
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
if (*nomovemsg) if (*g.nomovemsg)
pline("%s", nomovemsg); pline("%s", g.nomovemsg);
nomovemsg = 0; g.nomovemsg = 0;
u.usleep = 0; u.usleep = 0;
g.multi_reason = NULL; g.multi_reason = NULL;
if (g.afternmv) { if (g.afternmv) {
+2 -2
View File
@@ -3244,10 +3244,10 @@ char *buf;
align_str(Amask2align(lev->altarmask & ~AM_SHRINE))); align_str(Amask2align(lev->altarmask & ~AM_SHRINE)));
dfeature = altbuf; dfeature = altbuf;
} else if ((x == xupstair && y == yupstair) } else if ((x == xupstair && y == yupstair)
|| (x == sstairs.sx && y == sstairs.sy && sstairs.up)) || (x == g.sstairs.sx && y == g.sstairs.sy && g.sstairs.up))
cmap = S_upstair; /* "staircase up" */ cmap = S_upstair; /* "staircase up" */
else if ((x == xdnstair && y == ydnstair) else if ((x == xdnstair && y == ydnstair)
|| (x == sstairs.sx && y == sstairs.sy && !sstairs.up)) || (x == g.sstairs.sx && y == g.sstairs.sy && !g.sstairs.up))
cmap = S_dnstair; /* "staircase down" */ cmap = S_dnstair; /* "staircase down" */
else if (x == xupladder && y == yupladder) else if (x == xupladder && y == yupladder)
cmap = S_upladder; /* "ladder up" */ cmap = S_upladder; /* "ladder up" */
+4 -4
View File
@@ -169,9 +169,9 @@ coord *startp;
startp->y = upstair.sy; startp->y = upstair.sy;
return TRUE; return TRUE;
} }
if (couldsee(dnstair.sx, dnstair.sy)) { if (couldsee(g.dnstair.sx, g.dnstair.sy)) {
startp->x = dnstair.sx; startp->x = g.dnstair.sx;
startp->y = dnstair.sy; startp->y = g.dnstair.sy;
return TRUE; return TRUE;
} }
@@ -403,7 +403,7 @@ struct mail_info *info;
goto go_back; goto go_back;
message_seen = TRUE; message_seen = TRUE;
verbalize("%s, %s! %s.", Hello(md), plname, info->display_txt); verbalize("%s, %s! %s.", Hello(md), g.plname, info->display_txt);
if (info->message_typ) { if (info->message_typ) {
struct obj *obj = mksobj(SCR_MAIL, FALSE, FALSE); struct obj *obj = mksobj(SCR_MAIL, FALSE, FALSE);
+26 -26
View File
@@ -251,7 +251,7 @@ register struct monst *mtmp;
break; break;
} }
if (mm == PM_ELVENKING) { if (mm == PM_ELVENKING) {
if (rn2(3) || (in_mklev && Is_earthlevel(&u.uz))) if (rn2(3) || (g.in_mklev && Is_earthlevel(&u.uz)))
(void) mongets(mtmp, PICK_AXE); (void) mongets(mtmp, PICK_AXE);
if (!rn2(50)) if (!rn2(50))
(void) mongets(mtmp, CRYSTAL_BALL); (void) mongets(mtmp, CRYSTAL_BALL);
@@ -708,7 +708,7 @@ register struct monst *mtmp;
break; break;
case S_GIANT: case S_GIANT:
if (ptr == &mons[PM_MINOTAUR]) { if (ptr == &mons[PM_MINOTAUR]) {
if (!rn2(3) || (in_mklev && Is_earthlevel(&u.uz))) if (!rn2(3) || (g.in_mklev && Is_earthlevel(&u.uz)))
(void) mongets(mtmp, WAN_DIGGING); (void) mongets(mtmp, WAN_DIGGING);
} else if (is_giant(ptr)) { } else if (is_giant(ptr)) {
for (cnt = rn2((int) (mtmp->m_lev / 2)); cnt; cnt--) { for (cnt = rn2((int) (mtmp->m_lev / 2)); cnt; cnt--) {
@@ -778,7 +778,7 @@ register struct monst *mtmp;
} }
break; break;
case S_GNOME: case S_GNOME:
if (!rn2((In_mines(&u.uz) && in_mklev) ? 20 : 60)) { if (!rn2((In_mines(&u.uz) && g.in_mklev) ? 20 : 60)) {
otmp = mksobj(rn2(4) ? TALLOW_CANDLE : WAX_CANDLE, TRUE, FALSE); otmp = mksobj(rn2(4) ? TALLOW_CANDLE : WAX_CANDLE, TRUE, FALSE);
otmp->quan = 1; otmp->quan = 1;
otmp->owt = weight(otmp); otmp->owt = weight(otmp);
@@ -1039,7 +1039,7 @@ coord *cc;
do { do {
nx = rn1(COLNO - 3, 2); nx = rn1(COLNO - 3, 2);
ny = rn2(ROWNO); ny = rn2(ROWNO);
good = (!in_mklev && cansee(nx,ny)) ? FALSE good = (!g.in_mklev && cansee(nx,ny)) ? FALSE
: goodpos(nx, ny, mon, gpflags); : goodpos(nx, ny, mon, gpflags);
} while ((++tryct < 50) && !good); } while ((++tryct < 50) && !good);
@@ -1050,7 +1050,7 @@ coord *cc;
int xofs = nx; int xofs = nx;
int yofs = ny; int yofs = ny;
int dx,dy; int dx,dy;
int bl = (in_mklev || Blind) ? 1 : 0; int bl = (g.in_mklev || Blind) ? 1 : 0;
for ( ; bl < 2; bl++) { for ( ; bl < 2; bl++) {
for (dx = 0; dx < COLNO; dx++) for (dx = 0; dx < COLNO; dx++)
@@ -1065,18 +1065,18 @@ coord *cc;
if (bl == 0 && (!mon || mon->data->mmove)) { if (bl == 0 && (!mon || mon->data->mmove)) {
/* all map positions are visible (or not good), /* all map positions are visible (or not good),
try to pick something logical */ try to pick something logical */
if (dnstair.sx && !rn2(2)) { if (g.dnstair.sx && !rn2(2)) {
nx = dnstair.sx; nx = g.dnstair.sx;
ny = dnstair.sy; ny = g.dnstair.sy;
} else if (upstair.sx && !rn2(2)) { } else if (g.upstair.sx && !rn2(2)) {
nx = upstair.sx; nx = g.upstair.sx;
ny = upstair.sy; ny = g.upstair.sy;
} else if (dnladder.sx && !rn2(2)) { } else if (g.dnladder.sx && !rn2(2)) {
nx = dnladder.sx; nx = g.dnladder.sx;
ny = dnladder.sy; ny = g.dnladder.sy;
} else if (upladder.sx && !rn2(2)) { } else if (g.upladder.sx && !rn2(2)) {
nx = upladder.sx; nx = g.upladder.sx;
ny = upladder.sy; ny = g.upladder.sy;
} }
if (goodpos(nx, ny, mon, gpflags)) if (goodpos(nx, ny, mon, gpflags))
goto gotgood; goto gotgood;
@@ -1094,7 +1094,7 @@ coord *cc;
/* /*
* called with [x,y] = coordinates; * called with [x,y] = coordinates;
* [0,0] means anyplace * [0,0] means anyplace
* [u.ux,u.uy] means: near player (if !in_mklev) * [u.ux,u.uy] means: near player (if !g.in_mklev)
* *
* In case we make a monster group, only return the one at [x,y]. * In case we make a monster group, only return the one at [x,y].
*/ */
@@ -1124,7 +1124,7 @@ int mmflags;
return (struct monst *) 0; return (struct monst *) 0;
x = cc.x; x = cc.x;
y = cc.y; y = cc.y;
} else if (byyou && !in_mklev) { } else if (byyou && !g.in_mklev) {
coord bypos; coord bypos;
if (enexto_core(&bypos, u.ux, u.uy, ptr, gpflags)) { if (enexto_core(&bypos, u.ux, u.uy, ptr, gpflags)) {
@@ -1202,7 +1202,7 @@ int mmflags;
mtmp->m_id = context.ident++; /* ident overflowed */ mtmp->m_id = 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)
quest_status.leader_m_id = mtmp->m_id; g.quest_status.leader_m_id = mtmp->m_id;
mtmp->mnum = mndx; mtmp->mnum = mndx;
/* set up level and hit points */ /* set up level and hit points */
@@ -1216,9 +1216,9 @@ int mmflags;
but for ones which can be random, it has already been chosen but for ones which can be random, it has already been chosen
(in role_init(), for possible use by the quest pager code) */ (in role_init(), for possible use by the quest pager code) */
else if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx) else if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx)
mtmp->female = quest_status.ldrgend; mtmp->female = g.quest_status.ldrgend;
else if (ptr->msound == MS_NEMESIS && quest_info(MS_NEMESIS) == mndx) else if (ptr->msound == MS_NEMESIS && quest_info(MS_NEMESIS) == mndx)
mtmp->female = quest_status.nemgend; mtmp->female = g.quest_status.nemgend;
else else
mtmp->female = rn2(2); /* ignored for neuters */ mtmp->female = rn2(2); /* ignored for neuters */
@@ -1238,7 +1238,7 @@ int mmflags;
break; break;
case S_SPIDER: case S_SPIDER:
case S_SNAKE: case S_SNAKE:
if (in_mklev) if (g.in_mklev)
if (x && y) if (x && y)
(void) mkobj_at(0, x, y, TRUE); (void) mkobj_at(0, x, y, TRUE);
(void) hideunder(mtmp); (void) hideunder(mtmp);
@@ -1315,7 +1315,7 @@ int mmflags;
if (mitem && allow_minvent) if (mitem && allow_minvent)
(void) mongets(mtmp, mitem); (void) mongets(mtmp, mitem);
if (in_mklev) { if (g.in_mklev) {
if ((is_ndemon(ptr) || mndx == PM_WUMPUS if ((is_ndemon(ptr) || mndx == PM_WUMPUS
|| mndx == PM_LONG_WORM || mndx == PM_GIANT_EEL) || mndx == PM_LONG_WORM || mndx == PM_GIANT_EEL)
&& !u.uhave.amulet && rn2(5)) && !u.uhave.amulet && rn2(5))
@@ -1406,7 +1406,7 @@ int mmflags;
if (allow_minvent && migrating_objs) if (allow_minvent && migrating_objs)
deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case of waiting items */ deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case of waiting items */
if (!in_mklev) if (!g.in_mklev)
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */ newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
return mtmp; return mtmp;
@@ -1491,7 +1491,7 @@ register struct permonst *ptr;
lev = Is_special(&u.uz); lev = Is_special(&u.uz);
oldmoves = moves; oldmoves = moves;
} }
switch ((lev) ? lev->flags.align : dungeons[u.uz.dnum].flags.align) { switch ((lev) ? lev->flags.align : g.dungeons[u.uz.dnum].flags.align) {
default: /* just in case */ default: /* just in case */
case AM_NONE: case AM_NONE:
alshift = 0; alshift = 0;
+2 -2
View File
@@ -673,7 +673,7 @@ int spellnum;
nomul(-dmg); nomul(-dmg);
g.multi_reason = "paralyzed by a monster"; g.multi_reason = "paralyzed by a monster";
} }
nomovemsg = 0; g.nomovemsg = 0;
dmg = 0; dmg = 0;
break; break;
case CLC_CONFUSE_YOU: case CLC_CONFUSE_YOU:
@@ -855,7 +855,7 @@ register struct attack *mattk;
pline("%s zaps you with a %s!", Monnam(mtmp), pline("%s zaps you with a %s!", Monnam(mtmp),
flash_types[ad_to_typ(mattk->adtyp)]); flash_types[ad_to_typ(mattk->adtyp)]);
buzz(-ad_to_typ(mattk->adtyp), (int) mattk->damn, mtmp->mx, buzz(-ad_to_typ(mattk->adtyp), (int) mattk->damn, mtmp->mx,
mtmp->my, sgn(tbx), sgn(tby)); mtmp->my, sgn(g.tbx), sgn(g.tby));
} else } else
impossible("Monster spell %d cast", mattk->adtyp - 1); impossible("Monster spell %d cast", mattk->adtyp - 1);
} }
+9 -9
View File
@@ -487,11 +487,11 @@ register struct monst *mtmp;
|| u.umonnum == PM_TRAPPER) || u.umonnum == PM_TRAPPER)
pline( pline(
"Wait, %s! There's a hidden %s named %s there!", "Wait, %s! There's a hidden %s named %s there!",
m_monnam(mtmp), youmonst.data->mname, plname); m_monnam(mtmp), youmonst.data->mname, g.plname);
else else
pline( pline(
"Wait, %s! There's a %s named %s hiding under %s!", "Wait, %s! There's a %s named %s hiding under %s!",
m_monnam(mtmp), youmonst.data->mname, plname, m_monnam(mtmp), youmonst.data->mname, g.plname,
doname(level.objects[u.ux][u.uy])); doname(level.objects[u.ux][u.uy]));
if (obj) if (obj)
obj->spe = save_spe; obj->spe = save_spe;
@@ -514,7 +514,7 @@ register struct monst *mtmp;
pline("It gets stuck on you."); pline("It gets stuck on you.");
else /* see note about m_monnam() above */ else /* see note about m_monnam() above */
pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp), pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp),
youmonst.data->mname, plname); youmonst.data->mname, g.plname);
if (sticky) if (sticky)
u.ustuck = mtmp; u.ustuck = mtmp;
youmonst.m_ap_type = M_AP_NOTHING; youmonst.m_ap_type = M_AP_NOTHING;
@@ -536,7 +536,7 @@ register struct monst *mtmp;
else /* see note about m_monnam() above */ else /* see note about m_monnam() above */
pline("Wait, %s! That %s is really %s named %s!", m_monnam(mtmp), pline("Wait, %s! That %s is really %s named %s!", m_monnam(mtmp),
mimic_obj_name(&youmonst), an(mons[u.umonnum].mname), mimic_obj_name(&youmonst), an(mons[u.umonnum].mname),
plname); g.plname);
if (g.multi < 0) { /* this should always be the case */ if (g.multi < 0) { /* this should always be the case */
char buf[BUFSZ]; char buf[BUFSZ];
@@ -781,7 +781,7 @@ register struct monst *mtmp;
if (sum[i] == 1) { /* successful attack */ if (sum[i] == 1) { /* successful attack */
if (u.usleep && u.usleep < monstermoves && !rn2(10)) { if (u.usleep && u.usleep < monstermoves && !rn2(10)) {
g.multi = -1; g.multi = -1;
nomovemsg = "The combat suddenly awakens you."; g.nomovemsg = "The combat suddenly awakens you.";
} }
} }
if (sum[i] == 2) if (sum[i] == 2)
@@ -1165,7 +1165,7 @@ register struct attack *mattk;
You("are frozen!"); You("are frozen!");
else else
You("are frozen by %s!", mon_nam(mtmp)); You("are frozen by %s!", mon_nam(mtmp));
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
nomul(-rnd(10)); nomul(-rnd(10));
g.multi_reason = "paralyzed by a monster"; g.multi_reason = "paralyzed by a monster";
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
@@ -2138,7 +2138,7 @@ struct attack *mattk;
} }
if (useeit) if (useeit)
pline("%s is turned to stone!", Monnam(mtmp)); pline("%s is turned to stone!", Monnam(mtmp));
stoned = TRUE; g.stoned = TRUE;
killed(mtmp); killed(mtmp);
if (!DEADMONSTER(mtmp)) if (!DEADMONSTER(mtmp))
@@ -2775,7 +2775,7 @@ struct attack *mattk;
return 1; return 1;
} }
pline("%s turns to stone!", Monnam(mtmp)); pline("%s turns to stone!", Monnam(mtmp));
stoned = 1; g.stoned = 1;
xkilled(mtmp, XKILL_NOMSG); xkilled(mtmp, XKILL_NOMSG);
if (!DEADMONSTER(mtmp)) if (!DEADMONSTER(mtmp))
return 1; return 1;
@@ -2909,7 +2909,7 @@ cloneu()
if (!mon) if (!mon)
return NULL; return NULL;
mon->mcloned = 1; mon->mcloned = 1;
mon = christen_monst(mon, plname); mon = christen_monst(mon, g.plname);
initedog(mon); initedog(mon);
mon->m_lev = youmonst.data->mlevel; mon->m_lev = youmonst.data->mlevel;
mon->mhpmax = u.mhmax; mon->mhpmax = u.mhmax;
+29 -29
View File
@@ -144,11 +144,11 @@ boolean is_room;
croom->hy = hiy; croom->hy = hiy;
croom->rtype = rtype; croom->rtype = rtype;
croom->doorct = 0; croom->doorct = 0;
/* if we're not making a vault, doorindex will still be 0 /* if we're not making a vault, g.doorindex will still be 0
* if we are, we'll have problems adding niches to the previous room * if we are, we'll have problems adding niches to the previous room
* unless fdoor is at least doorindex * unless fdoor is at least g.doorindex
*/ */
croom->fdoor = doorindex; croom->fdoor = g.doorindex;
croom->irregular = FALSE; croom->irregular = FALSE;
croom->nsubrooms = 0; croom->nsubrooms = 0;
@@ -253,7 +253,7 @@ boolean nxcor;
/* find positions cc and tt for doors in croom and troom /* find positions cc and tt for doors in croom and troom
and direction for a corridor between them */ and direction for a corridor between them */
if (troom->hx < 0 || croom->hx < 0 || doorindex >= DOORMAX) if (troom->hx < 0 || croom->hx < 0 || g.doorindex >= DOORMAX)
return; return;
if (troom->lx > croom->hx) { if (troom->lx > croom->hx) {
dx = 1; dx = 1;
@@ -306,10 +306,10 @@ boolean nxcor;
if (okdoor(tt.x, tt.y) || !nxcor) if (okdoor(tt.x, tt.y) || !nxcor)
dodoor(tt.x, tt.y, troom); dodoor(tt.x, tt.y, troom);
if (smeq[a] < smeq[b]) if (g.smeq[a] < g.smeq[b])
smeq[b] = smeq[a]; g.smeq[b] = g.smeq[a];
else else
smeq[a] = smeq[b]; g.smeq[a] = g.smeq[b];
} }
void void
@@ -324,12 +324,12 @@ makecorridors()
break; /* allow some randomness */ break; /* allow some randomness */
} }
for (a = 0; a < g.nroom - 2; a++) for (a = 0; a < g.nroom - 2; a++)
if (smeq[a] != smeq[a + 2]) if (g.smeq[a] != g.smeq[a + 2])
join(a, a + 2, FALSE); join(a, a + 2, FALSE);
for (a = 0; any && a < g.nroom; a++) { for (a = 0; any && a < g.nroom; a++) {
any = FALSE; any = FALSE;
for (b = 0; b < g.nroom; b++) for (b = 0; b < g.nroom; b++)
if (smeq[a] != smeq[b]) { if (g.smeq[a] != g.smeq[b]) {
join(a, b, FALSE); join(a, b, FALSE);
any = TRUE; any = TRUE;
} }
@@ -354,11 +354,11 @@ register struct mkroom *aroom;
int i; int i;
if (aroom->doorct == 0) if (aroom->doorct == 0)
aroom->fdoor = doorindex; aroom->fdoor = g.doorindex;
aroom->doorct++; aroom->doorct++;
for (tmp = doorindex; tmp > aroom->fdoor; tmp--) for (tmp = g.doorindex; tmp > aroom->fdoor; tmp--)
doors[tmp] = doors[tmp - 1]; doors[tmp] = doors[tmp - 1];
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
@@ -372,7 +372,7 @@ register struct mkroom *aroom;
broom->fdoor++; broom->fdoor++;
} }
doorindex++; g.doorindex++;
doors[aroom->fdoor].x = x; doors[aroom->fdoor].x = x;
doors[aroom->fdoor].y = y; doors[aroom->fdoor].y = y;
} }
@@ -487,7 +487,7 @@ int trap_type;
int dy, xx, yy; int dy, xx, yy;
struct trap *ttmp; struct trap *ttmp;
if (doorindex < DOORMAX) { if (g.doorindex < DOORMAX) {
while (vct--) { while (vct--) {
aroom = &rooms[rn2(g.nroom)]; aroom = &rooms[rn2(g.nroom)];
if (aroom->rtype != OROOM) if (aroom->rtype != OROOM)
@@ -628,11 +628,11 @@ clear_level_structures()
rooms[0].hx = -1; rooms[0].hx = -1;
g.nsubroom = 0; g.nsubroom = 0;
subrooms[0].hx = -1; subrooms[0].hx = -1;
doorindex = 0; g.doorindex = 0;
init_rect(); init_rect();
init_vault(); init_vault();
xdnstair = ydnstair = xupstair = yupstair = 0; xdnstair = ydnstair = xupstair = yupstair = 0;
sstairs.sx = sstairs.sy = 0; g.sstairs.sx = g.sstairs.sy = 0;
xdnladder = ydnladder = xupladder = yupladder = 0; xdnladder = ydnladder = xupladder = yupladder = 0;
g.made_branch = FALSE; g.made_branch = FALSE;
clear_regions(); clear_regions();
@@ -660,7 +660,7 @@ makelevel()
if (slev && !Is_rogue_level(&u.uz)) { if (slev && !Is_rogue_level(&u.uz)) {
makemaz(slev->proto); makemaz(slev->proto);
return; return;
} else if (dungeons[u.uz.dnum].proto[0]) { } else if (g.dungeons[u.uz.dnum].proto[0]) {
makemaz(""); makemaz("");
return; return;
} else if (In_mines(&u.uz)) { } else if (In_mines(&u.uz)) {
@@ -984,11 +984,11 @@ mklev()
if (getbones()) if (getbones())
return; return;
in_mklev = TRUE; g.in_mklev = TRUE;
makelevel(); makelevel();
bound_digging(); bound_digging();
mineralize(-1, -1, -1, -1, FALSE); mineralize(-1, -1, -1, -1, FALSE);
in_mklev = FALSE; g.in_mklev = FALSE;
/* has_morgue gets cleared once morgue is entered; graveyard stays /* has_morgue gets cleared once morgue is entered; graveyard stays
set (graveyard might already be set even when has_morgue is clear set (graveyard might already be set even when has_morgue is clear
[see fixup_special()], so don't update it unconditionally) */ [see fixup_special()], so don't update it unconditionally) */
@@ -1161,14 +1161,14 @@ xchar x, y; /* location */
if (br->type == BR_PORTAL) { if (br->type == BR_PORTAL) {
mkportal(x, y, dest->dnum, dest->dlevel); mkportal(x, y, dest->dnum, dest->dlevel);
} else if (make_stairs) { } else if (make_stairs) {
sstairs.sx = x; g.sstairs.sx = x;
sstairs.sy = y; g.sstairs.sy = y;
sstairs.up = g.sstairs.up =
(char) on_level(&br->end1, &u.uz) ? br->end1_up : !br->end1_up; (char) on_level(&br->end1, &u.uz) ? br->end1_up : !br->end1_up;
assign_level(&sstairs.tolev, dest); assign_level(&g.sstairs.tolev, dest);
sstairs_room = br_room; sstairs_room = br_room;
levl[x][y].ladder = sstairs.up ? LA_UP : LA_DOWN; levl[x][y].ladder = g.sstairs.up ? LA_UP : LA_DOWN;
levl[x][y].typ = STAIRS; levl[x][y].typ = STAIRS;
} }
/* /*
@@ -1217,7 +1217,7 @@ xchar x, y;
boolean near_door = bydoor(x, y); boolean near_door = bydoor(x, y);
return ((levl[x][y].typ == HWALL || levl[x][y].typ == VWALL) return ((levl[x][y].typ == HWALL || levl[x][y].typ == VWALL)
&& doorindex < DOORMAX && !near_door); && g.doorindex < DOORMAX && !near_door);
} }
void void
@@ -1225,7 +1225,7 @@ dodoor(x, y, aroom)
int x, y; int x, y;
struct mkroom *aroom; struct mkroom *aroom;
{ {
if (doorindex >= DOORMAX) { if (g.doorindex >= DOORMAX) {
impossible("DOORMAX exceeded?"); impossible("DOORMAX exceeded?");
return; return;
} }
@@ -1661,8 +1661,8 @@ struct mkroom *croom;
/* /*
* Major level transmutation: add a set of stairs (to the Sanctum) after * Major level transmutation: add a set of stairs (to the Sanctum) after
* an earthquake that leaves behind a a new topology, centered at inv_pos. * an earthquake that leaves behind a a new topology, centered at g.inv_pos.
* Assumes there are no rooms within the invocation area and that inv_pos * Assumes there are no rooms within the invocation area and that g.inv_pos
* is not too close to the edge of the map. Also assume the hero can see, * is not too close to the edge of the map. Also assume the hero can see,
* which is guaranteed for normal play due to the fact that sight is needed * which is guaranteed for normal play due to the fact that sight is needed
* to read the Book of the Dead. * to read the Book of the Dead.
@@ -1671,8 +1671,8 @@ void
mkinvokearea() mkinvokearea()
{ {
int dist; int dist;
xchar xmin = inv_pos.x, xmax = inv_pos.x; xchar xmin = g.inv_pos.x, xmax = g.inv_pos.x;
xchar ymin = inv_pos.y, ymax = inv_pos.y; xchar ymin = g.inv_pos.y, ymax = g.inv_pos.y;
register xchar i; register xchar i;
pline_The("floor shakes violently under you!"); pline_The("floor shakes violently under you!");
+31 -31
View File
@@ -503,24 +503,24 @@ fixup_special()
case LR_DOWNTELE: case LR_DOWNTELE:
/* save the region outlines for goto_level() */ /* save the region outlines for goto_level() */
if (r->rtype == LR_TELE || r->rtype == LR_UPTELE) { if (r->rtype == LR_TELE || r->rtype == LR_UPTELE) {
updest.lx = r->inarea.x1; g.updest.lx = r->inarea.x1;
updest.ly = r->inarea.y1; g.updest.ly = r->inarea.y1;
updest.hx = r->inarea.x2; g.updest.hx = r->inarea.x2;
updest.hy = r->inarea.y2; g.updest.hy = r->inarea.y2;
updest.nlx = r->delarea.x1; g.updest.nlx = r->delarea.x1;
updest.nly = r->delarea.y1; g.updest.nly = r->delarea.y1;
updest.nhx = r->delarea.x2; g.updest.nhx = r->delarea.x2;
updest.nhy = r->delarea.y2; g.updest.nhy = r->delarea.y2;
} }
if (r->rtype == LR_TELE || r->rtype == LR_DOWNTELE) { if (r->rtype == LR_TELE || r->rtype == LR_DOWNTELE) {
dndest.lx = r->inarea.x1; g.dndest.lx = r->inarea.x1;
dndest.ly = r->inarea.y1; g.dndest.ly = r->inarea.y1;
dndest.hx = r->inarea.x2; g.dndest.hx = r->inarea.x2;
dndest.hy = r->inarea.y2; g.dndest.hy = r->inarea.y2;
dndest.nlx = r->delarea.x1; g.dndest.nlx = r->delarea.x1;
dndest.nly = r->delarea.y1; g.dndest.nly = r->delarea.y1;
dndest.nhx = r->delarea.x2; g.dndest.nhx = r->delarea.x2;
dndest.nhy = r->delarea.y2; g.dndest.nhy = r->delarea.y2;
} }
/* place_lregion gets called from goto_level() */ /* place_lregion gets called from goto_level() */
break; break;
@@ -606,7 +606,7 @@ fixup_special()
} else if (on_level(&u.uz, &baalzebub_level)) { } else if (on_level(&u.uz, &baalzebub_level)) {
/* custom wallify the "beetle" potion of the level */ /* custom wallify the "beetle" potion of the level */
baalz_fixup(); baalz_fixup();
} else if (u.uz.dnum == mines_dnum && ransacked) { } else if (u.uz.dnum == mines_dnum && g.ransacked) {
stolen_booty(); stolen_booty();
} }
@@ -620,7 +620,7 @@ check_ransacked(s)
char *s; char *s;
{ {
/* this kludge only works as long as orctown is minetn-1 */ /* this kludge only works as long as orctown is minetn-1 */
ransacked = (u.uz.dnum == mines_dnum && !strcmp(s, "minetn-1")); g.ransacked = (u.uz.dnum == mines_dnum && !strcmp(s, "minetn-1"));
} }
#define ORC_LEADER 1 #define ORC_LEADER 1
@@ -636,7 +636,7 @@ unsigned long mflags;
cur_depth = (int) depth(&u.uz); cur_depth = (int) depth(&u.uz);
max_depth = dunlevs_in_dungeon(&u.uz) max_depth = dunlevs_in_dungeon(&u.uz)
+ (dungeons[u.uz.dnum].depth_start - 1); + (g.dungeons[u.uz.dnum].depth_start - 1);
if (mflags == ORC_LEADER) { if (mflags == ORC_LEADER) {
/* Note that the orc leader will take possession of any /* Note that the orc leader will take possession of any
* remaining stuff not already delivered to other * remaining stuff not already delivered to other
@@ -797,7 +797,7 @@ stolen_booty(VOID_ARGS)
migrate_orc(mtmp, 0UL); migrate_orc(mtmp, 0UL);
} }
} }
ransacked = 0; g.ransacked = 0;
} }
#undef ORC_LEADER #undef ORC_LEADER
@@ -963,19 +963,19 @@ const char *s;
Sprintf(protofile, "%s-%d", s, rnd((int) sp->rndlevs)); Sprintf(protofile, "%s-%d", s, rnd((int) sp->rndlevs));
else else
Strcpy(protofile, s); Strcpy(protofile, s);
} else if (*(dungeons[u.uz.dnum].proto)) { } else if (*(g.dungeons[u.uz.dnum].proto)) {
if (dunlevs_in_dungeon(&u.uz) > 1) { if (dunlevs_in_dungeon(&u.uz) > 1) {
if (sp && sp->rndlevs) if (sp && sp->rndlevs)
Sprintf(protofile, "%s%d-%d", dungeons[u.uz.dnum].proto, Sprintf(protofile, "%s%d-%d", g.dungeons[u.uz.dnum].proto,
dunlev(&u.uz), rnd((int) sp->rndlevs)); dunlev(&u.uz), rnd((int) sp->rndlevs));
else else
Sprintf(protofile, "%s%d", dungeons[u.uz.dnum].proto, Sprintf(protofile, "%s%d", g.dungeons[u.uz.dnum].proto,
dunlev(&u.uz)); dunlev(&u.uz));
} else if (sp && sp->rndlevs) { } else if (sp && sp->rndlevs) {
Sprintf(protofile, "%s-%d", dungeons[u.uz.dnum].proto, Sprintf(protofile, "%s-%d", g.dungeons[u.uz.dnum].proto,
rnd((int) sp->rndlevs)); rnd((int) sp->rndlevs));
} else } else
Strcpy(protofile, dungeons[u.uz.dnum].proto); Strcpy(protofile, g.dungeons[u.uz.dnum].proto);
} else } else
Strcpy(protofile, ""); Strcpy(protofile, "");
@@ -1054,10 +1054,10 @@ const char *s;
if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN
|| (x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE)) { || (x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE)) {
debugpline2("inv_pos: maze is too small! (%d x %d)", debugpline2("g.inv_pos: maze is too small! (%d x %d)",
g.x_maze_max, g.y_maze_max); g.x_maze_max, g.y_maze_max);
} }
inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/ g.inv_pos.x = g.inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do { do {
x = rn1(x_range, x_maze_min + INVPOS_X_MARGIN + 1); x = rn1(x_range, x_maze_min + INVPOS_X_MARGIN + 1);
y = rn1(y_range, y_maze_min + INVPOS_Y_MARGIN + 1); y = rn1(y_range, y_maze_min + INVPOS_Y_MARGIN + 1);
@@ -1067,9 +1067,9 @@ const char *s;
|| abs(x - xupstair) == abs(y - yupstair) || abs(x - xupstair) == abs(y - yupstair)
|| distmin(x, y, xupstair, yupstair) <= INVPOS_DISTANCE || distmin(x, y, xupstair, yupstair) <= INVPOS_DISTANCE
|| !SPACE_POS(levl[x][y].typ) || occupied(x, y)); || !SPACE_POS(levl[x][y].typ) || occupied(x, y));
inv_pos.x = x; g.inv_pos.x = x;
inv_pos.y = y; g.inv_pos.y = y;
maketrap(inv_pos.x, inv_pos.y, VIBRATING_SQUARE); maketrap(g.inv_pos.x, g.inv_pos.y, VIBRATING_SQUARE);
#undef INVPOS_X_MARGIN #undef INVPOS_X_MARGIN
#undef INVPOS_Y_MARGIN #undef INVPOS_Y_MARGIN
#undef INVPOS_DISTANCE #undef INVPOS_DISTANCE
@@ -1335,7 +1335,7 @@ xchar x, y, todnum, todlevel;
return; return;
} }
debugpline4("mkportal: at <%d,%d>, to %s, level %d", x, y, debugpline4("mkportal: at <%d,%d>, to %s, level %d", x, y,
dungeons[todnum].dname, todlevel); g.dungeons[todnum].dname, todlevel);
ttmp->dst.dnum = todnum; ttmp->dst.dnum = todnum;
ttmp->dst.dlevel = todlevel; ttmp->dst.dlevel = todlevel;
return; return;
+2 -2
View File
@@ -292,7 +292,7 @@ struct obj *box;
case SACK: case SACK:
case OILSKIN_SACK: case OILSKIN_SACK:
/* initial inventory: sack starts out empty */ /* initial inventory: sack starts out empty */
if (moves <= 1 && !in_mklev) { if (moves <= 1 && !g.in_mklev) {
n = 0; n = 0;
break; break;
} }
@@ -1168,7 +1168,7 @@ struct obj *body;
return; return;
action = ROT_CORPSE; /* default action: rot away */ action = ROT_CORPSE; /* default action: rot away */
rot_adjust = in_mklev ? 25 : 10; /* give some variation */ rot_adjust = g.in_mklev ? 25 : 10; /* give some variation */
corpse_age = monstermoves - body->age; corpse_age = monstermoves - body->age;
if (corpse_age > ROT_AGE) if (corpse_age > ROT_AGE)
when = rot_adjust; when = rot_adjust;
+2 -2
View File
@@ -617,7 +617,7 @@ register struct mkroom *sroom;
{ {
if (sroom == dnstairs_room) if (sroom == dnstairs_room)
return TRUE; return TRUE;
if (sstairs.sx && !sstairs.up) if (g.sstairs.sx && !g.sstairs.up)
return (boolean) (sroom == sstairs_room); return (boolean) (sroom == sstairs_room);
return FALSE; return FALSE;
} }
@@ -628,7 +628,7 @@ register struct mkroom *sroom;
{ {
if (sroom == upstairs_room) if (sroom == upstairs_room)
return TRUE; return TRUE;
if (sstairs.sx && sstairs.up) if (g.sstairs.sx && g.sstairs.up)
return (boolean) (sroom == sstairs_room); return (boolean) (sroom == sstairs_room);
return FALSE; return FALSE;
} }
+10 -10
View File
@@ -279,7 +279,7 @@ int mndx;
|| is_reviver((mon)->data) \ || is_reviver((mon)->data) \
/* normally quest leader will be unique, */ \ /* normally quest leader will be unique, */ \
/* but he or she might have been polymorphed */ \ /* but he or she might have been polymorphed */ \
|| (mon)->m_id == quest_status.leader_m_id \ || (mon)->m_id == g.quest_status.leader_m_id \
/* special cancellation handling for these */ \ /* special cancellation handling for these */ \
|| (dmgtype((mon)->data, AD_SEDU) || dmgtype((mon)->data, AD_SSEX))) || (dmgtype((mon)->data, AD_SEDU) || dmgtype((mon)->data, AD_SSEX)))
@@ -2008,8 +2008,8 @@ register struct monst *mtmp;
mvitals[tmp].died++; mvitals[tmp].died++;
/* if it's a (possibly polymorphed) quest leader, mark him as dead */ /* if it's a (possibly polymorphed) quest leader, mark him as dead */
if (mtmp->m_id == quest_status.leader_m_id) if (mtmp->m_id == g.quest_status.leader_m_id)
quest_status.leader_is_dead = TRUE; g.quest_status.leader_is_dead = TRUE;
#ifdef MAIL #ifdef MAIL
/* if the mail daemon dies, no more mail delivery. -3. */ /* if the mail daemon dies, no more mail delivery. -3. */
if (tmp == PM_MAIL_DAEMON) if (tmp == PM_MAIL_DAEMON)
@@ -2351,7 +2351,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
g.vamp_rise_msg = FALSE; /* might get set in mondead(); only checked below */ g.vamp_rise_msg = FALSE; /* might get set in mondead(); only checked below */
g.disintegested = nocorpse; /* alternate vamp_rise message needed if true */ g.disintegested = nocorpse; /* alternate vamp_rise message needed if true */
/* dispose of monster and make cadaver */ /* dispose of monster and make cadaver */
if (stoned) if (g.stoned)
monstone(mtmp); monstone(mtmp);
else else
mondead(mtmp); mondead(mtmp);
@@ -2362,7 +2362,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
* lifesaved_monster() since the message appears only when _you_ * lifesaved_monster() since the message appears only when _you_
* kill it (as opposed to visible lifesaving which always appears). * kill it (as opposed to visible lifesaving which always appears).
*/ */
stoned = FALSE; g.stoned = FALSE;
if (!cansee(x, y) && !g.vamp_rise_msg) if (!cansee(x, y) && !g.vamp_rise_msg)
pline("Maybe not..."); pline("Maybe not...");
return; return;
@@ -2371,8 +2371,8 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
mdat = mtmp->data; /* note: mondead can change mtmp->data */ mdat = mtmp->data; /* note: mondead can change mtmp->data */
mndx = monsndx(mdat); mndx = monsndx(mdat);
if (stoned) { if (g.stoned) {
stoned = FALSE; g.stoned = FALSE;
goto cleanup; goto cleanup;
} }
@@ -2448,7 +2448,7 @@ cleanup:
newexplevel(); /* will decide if you go up */ newexplevel(); /* will decide if you go up */
/* adjust alignment points */ /* adjust alignment points */
if (mtmp->m_id == quest_status.leader_m_id) { /* REAL BAD! */ if (mtmp->m_id == g.quest_status.leader_m_id) { /* REAL BAD! */
adjalign(-(u.ualign.record + (int) ALIGNLIM / 2)); adjalign(-(u.ualign.record + (int) ALIGNLIM / 2));
pline("That was %sa bad idea...", pline("That was %sa bad idea...",
u.uevent.qcompleted ? "probably " : ""); u.uevent.qcompleted ? "probably " : "");
@@ -2594,7 +2594,7 @@ struct monst *mtmp;
if (!isok(mm.x, mm.y)) if (!isok(mm.x, mm.y))
return; return;
rloc_to(mtmp, mm.x, mm.y); rloc_to(mtmp, mm.x, mm.y);
if (!in_mklev && (mtmp->mstrategy & STRAT_APPEARMSG)) { if (!g.in_mklev && (mtmp->mstrategy & STRAT_APPEARMSG)) {
mtmp->mstrategy &= ~STRAT_APPEARMSG; /* one chance only */ mtmp->mstrategy &= ~STRAT_APPEARMSG; /* one chance only */
if (!couldspot && canspotmon(mtmp)) if (!couldspot && canspotmon(mtmp))
pline("%s suddenly %s!", Amonnam(mtmp), pline("%s suddenly %s!", Amonnam(mtmp),
@@ -3223,7 +3223,7 @@ isspecmon(mon)
struct monst *mon; struct monst *mon;
{ {
return (mon->isshk || mon->ispriest || mon->isgd return (mon->isshk || mon->ispriest || mon->isgd
|| mon->m_id == quest_status.leader_m_id); || mon->m_id == g.quest_status.leader_m_id);
} }
/* restrict certain special monsters (shopkeepers, aligned priests, /* restrict certain special monsters (shopkeepers, aligned priests,
+23 -23
View File
@@ -249,7 +249,7 @@ struct obj *otmp, *mwep;
mtarg ? mtarg->my : mtmp->muy), mtarg ? mtarg->my : mtmp->muy),
multishot = monmulti(mtmp, otmp, mwep); multishot = monmulti(mtmp, otmp, mwep);
/* /*
* Caller must have called linedup() to set up tbx, tby. * Caller must have called linedup() to set up g.tbx, g.tby.
*/ */
if (canseemon(mtmp)) { if (canseemon(mtmp)) {
@@ -266,33 +266,33 @@ struct obj *otmp, *mwep;
onm = singular(otmp, xname); onm = singular(otmp, xname);
onm = obj_is_pname(otmp) ? the(onm) : an(onm); onm = obj_is_pname(otmp) ? the(onm) : an(onm);
} }
m_shot.s = ammo_and_launcher(otmp, mwep) ? TRUE : FALSE; g.m_shot.s = ammo_and_launcher(otmp, mwep) ? TRUE : FALSE;
Strcpy(trgbuf, mtarg ? mon_nam(mtarg) : ""); Strcpy(trgbuf, mtarg ? mon_nam(mtarg) : "");
if (!strcmp(trgbuf, "it")) if (!strcmp(trgbuf, "it"))
Strcpy(trgbuf, humanoid(mtmp->data) ? "someone" : something); Strcpy(trgbuf, humanoid(mtmp->data) ? "someone" : something);
pline("%s %s %s%s%s!", Monnam(mtmp), pline("%s %s %s%s%s!", Monnam(mtmp),
m_shot.s ? "shoots" : "throws", onm, g.m_shot.s ? "shoots" : "throws", onm,
mtarg ? " at " : "", trgbuf); mtarg ? " at " : "", trgbuf);
m_shot.o = otmp->otyp; g.m_shot.o = otmp->otyp;
} else { } else {
m_shot.o = STRANGE_OBJECT; /* don't give multishot feedback */ g.m_shot.o = STRANGE_OBJECT; /* don't give multishot feedback */
} }
m_shot.n = multishot; g.m_shot.n = multishot;
for (m_shot.i = 1; m_shot.i <= m_shot.n; m_shot.i++) { for (g.m_shot.i = 1; g.m_shot.i <= g.m_shot.n; g.m_shot.i++) {
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), dm, otmp); m_throw(mtmp, mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby), dm, otmp);
/* conceptually all N missiles are in flight at once, but /* conceptually all N missiles are in flight at once, but
if mtmp gets killed (shot kills adjacent gas spore and if mtmp gets killed (shot kills adjacent gas spore and
triggers explosion, perhaps), inventory will be dropped triggers explosion, perhaps), inventory will be dropped
and otmp might go away via merging into another stack */ and otmp might go away via merging into another stack */
if (DEADMONSTER(mtmp) && m_shot.i < m_shot.n) if (DEADMONSTER(mtmp) && g.m_shot.i < g.m_shot.n)
/* cancel pending shots (perhaps ought to give a message here /* cancel pending shots (perhaps ought to give a message here
since we gave one above about throwing/shooting N missiles) */ since we gave one above about throwing/shooting N missiles) */
break; /* endmultishot(FALSE); */ break; /* endmultishot(FALSE); */
} }
/* reset 'm_shot' */ /* reset 'g.m_shot' */
m_shot.n = m_shot.i = 0; g.m_shot.n = g.m_shot.i = 0;
m_shot.o = STRANGE_OBJECT; g.m_shot.o = STRANGE_OBJECT;
m_shot.s = FALSE; g.m_shot.s = FALSE;
} }
/* an object launched by someone/thing other than player attacks a monster; /* an object launched by someone/thing other than player attacks a monster;
@@ -653,7 +653,7 @@ struct obj *obj; /* missile (or stack providing it) */
if (!range /* reached end of path */ if (!range /* reached end of path */
|| MT_FLIGHTCHECK(FALSE)) { || MT_FLIGHTCHECK(FALSE)) {
if (singleobj) { /* hits_bars might have destroyed it */ if (singleobj) { /* hits_bars might have destroyed it */
if (m_shot.n > 1 if (g.m_shot.n > 1
&& (!mesg_given || bhitpos.x != u.ux || bhitpos.y != u.uy) && (!mesg_given || bhitpos.x != u.ux || bhitpos.y != u.uy)
&& (cansee(bhitpos.x, bhitpos.y) && (cansee(bhitpos.x, bhitpos.y)
|| (archer && canseemon(archer)))) || (archer && canseemon(archer))))
@@ -759,7 +759,7 @@ struct attack *mattk;
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s spits venom!", Monnam(mtmp)); pline("%s spits venom!", Monnam(mtmp));
target = mtarg; target = mtarg;
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), m_throw(mtmp, mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby),
distmin(mtmp->mx,mtmp->my,mtarg->mx,mtarg->my), otmp); distmin(mtmp->mx,mtmp->my,mtarg->mx,mtarg->my), otmp);
target = (struct monst *)0; target = (struct monst *)0;
nomul(0); nomul(0);
@@ -804,7 +804,7 @@ struct attack *mattk;
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s breathes %s!", Monnam(mtmp), breathwep[typ - 1]); pline("%s breathes %s!", Monnam(mtmp), breathwep[typ - 1]);
dobuzz((int) (-20 - (typ - 1)), (int) mattk->damn, dobuzz((int) (-20 - (typ - 1)), (int) mattk->damn,
mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), FALSE); mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby), FALSE);
nomul(0); nomul(0);
/* breath runs out sometimes. Also, give monster some /* breath runs out sometimes. Also, give monster some
* cunning; don't breath if the target fell asleep. * cunning; don't breath if the target fell asleep.
@@ -960,7 +960,7 @@ struct attack *mattk;
- distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy))) { - distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy))) {
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s spits venom!", Monnam(mtmp)); pline("%s spits venom!", Monnam(mtmp));
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), m_throw(mtmp, mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby),
distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy), otmp); distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy), otmp);
nomul(0); nomul(0);
return 0; return 0;
@@ -997,7 +997,7 @@ struct attack *mattk;
pline("%s breathes %s!", Monnam(mtmp), pline("%s breathes %s!", Monnam(mtmp),
breathwep[typ - 1]); breathwep[typ - 1]);
buzz((int) (-20 - (typ - 1)), (int) mattk->damn, mtmp->mx, buzz((int) (-20 - (typ - 1)), (int) mattk->damn, mtmp->mx,
mtmp->my, sgn(tbx), sgn(tby)); mtmp->my, sgn(g.tbx), sgn(g.tby));
nomul(0); nomul(0);
/* breath runs out sometimes. Also, give monster some /* breath runs out sometimes. Also, give monster some
* cunning; don't breath if the player fell asleep. * cunning; don't breath if the player fell asleep.
@@ -1021,16 +1021,16 @@ int boulderhandling; /* 0=block, 1=ignore, 2=conditionally block */
int dx, dy, boulderspots; int dx, dy, boulderspots;
/* These two values are set for use after successful return. */ /* These two values are set for use after successful return. */
tbx = ax - bx; g.tbx = ax - bx;
tby = ay - by; g.tby = ay - by;
/* sometimes displacement makes a monster think that you're at its /* sometimes displacement makes a monster think that you're at its
own location; prevent it from throwing and zapping in that case */ own location; prevent it from throwing and zapping in that case */
if (!tbx && !tby) if (!g.tbx && !g.tby)
return FALSE; return FALSE;
if ((!tbx || !tby || abs(tbx) == abs(tby)) /* straight line or diagonal */ if ((!g.tbx || !g.tby || abs(g.tbx) == abs(g.tby)) /* straight line or diagonal */
&& distmin(tbx, tby, 0, 0) < BOLT_LIM) { && distmin(g.tbx, g.tby, 0, 0) < BOLT_LIM) {
if ((ax == u.ux && ay == u.uy) ? (boolean) couldsee(bx, by) if ((ax == u.ux && ay == u.uy) ? (boolean) couldsee(bx, by)
: clear_path(ax, ay, bx, by)) : clear_path(ax, ay, bx, by))
return TRUE; return TRUE;
+11 -11
View File
@@ -367,8 +367,8 @@ struct monst *mtmp;
g.m.has_defense = MUSE_DOWNSTAIRS; g.m.has_defense = MUSE_DOWNSTAIRS;
} else if (x == xupstair && y == yupstair) { } else if (x == xupstair && y == yupstair) {
g.m.has_defense = MUSE_UPSTAIRS; g.m.has_defense = MUSE_UPSTAIRS;
} else if (sstairs.sx && x == sstairs.sx && y == sstairs.sy) { } else if (g.sstairs.sx && x == g.sstairs.sx && y == g.sstairs.sy) {
if (sstairs.up || !is_floater(mtmp->data)) if (g.sstairs.up || !is_floater(mtmp->data))
g.m.has_defense = MUSE_SSTAIRS; g.m.has_defense = MUSE_SSTAIRS;
} }
} else if (levl[x][y].typ == LADDER) { } else if (levl[x][y].typ == LADDER) {
@@ -377,8 +377,8 @@ struct monst *mtmp;
} else if (x == xdnladder && y == ydnladder) { } else if (x == xdnladder && y == ydnladder) {
if (!is_floater(mtmp->data)) if (!is_floater(mtmp->data))
g.m.has_defense = MUSE_DN_LADDER; g.m.has_defense = MUSE_DN_LADDER;
} else if (sstairs.sx && x == sstairs.sx && y == sstairs.sy) { } else if (g.sstairs.sx && x == g.sstairs.sx && y == g.sstairs.sy) {
if (sstairs.up || !is_floater(mtmp->data)) if (g.sstairs.up || !is_floater(mtmp->data))
g.m.has_defense = MUSE_SSTAIRS; g.m.has_defense = MUSE_SSTAIRS;
} }
} else { } else {
@@ -703,8 +703,8 @@ struct monst *mtmp;
if (IS_FURNITURE(levl[mtmp->mx][mtmp->my].typ) if (IS_FURNITURE(levl[mtmp->mx][mtmp->my].typ)
|| IS_DRAWBRIDGE(levl[mtmp->mx][mtmp->my].typ) || IS_DRAWBRIDGE(levl[mtmp->mx][mtmp->my].typ)
|| (is_drawbridge_wall(mtmp->mx, mtmp->my) >= 0) || (is_drawbridge_wall(mtmp->mx, mtmp->my) >= 0)
|| (sstairs.sx && sstairs.sx == mtmp->mx || (g.sstairs.sx && g.sstairs.sx == mtmp->mx
&& sstairs.sy == mtmp->my)) { && g.sstairs.sy == mtmp->my)) {
pline_The("digging ray is ineffective."); pline_The("digging ray is ineffective.");
return 2; return 2;
} }
@@ -884,12 +884,12 @@ struct monst *mtmp;
} }
if (vismon) if (vismon)
pline("%s escapes %sstairs!", Monnam(mtmp), pline("%s escapes %sstairs!", Monnam(mtmp),
sstairs.up ? "up" : "down"); g.sstairs.up ? "up" : "down");
/* going from the Valley to Castle (Stronghold) has no sstairs /* going from the Valley to Castle (Stronghold) has no sstairs
to target, but having sstairs.<sx,sy> == <0,0> will work the to target, but having g.sstairs.<sx,sy> == <0,0> will work the
same as specifying MIGR_RANDOM when mon_arrive() eventually same as specifying MIGR_RANDOM when mon_arrive() eventually
places the monster, so we can use MIGR_SSTAIRS unconditionally */ places the monster, so we can use MIGR_SSTAIRS unconditionally */
migrate_to_level(mtmp, ledger_no(&sstairs.tolev), MIGR_SSTAIRS, migrate_to_level(mtmp, ledger_no(&g.sstairs.tolev), MIGR_SSTAIRS,
(coord *) 0); (coord *) 0);
return 2; return 2;
case MUSE_TELEPORT_TRAP: case MUSE_TELEPORT_TRAP:
@@ -1119,7 +1119,7 @@ struct monst *mtmp;
&& (onscary(u.ux, u.uy, mtmp) && (onscary(u.ux, u.uy, mtmp)
|| (u.ux == xupstair && u.uy == yupstair) || (u.ux == xupstair && u.uy == yupstair)
|| (u.ux == xdnstair && u.uy == ydnstair) || (u.ux == xdnstair && u.uy == ydnstair)
|| (u.ux == sstairs.sx && u.uy == sstairs.sy) || (u.ux == g.sstairs.sx && u.uy == g.sstairs.sy)
|| (u.ux == xupladder && u.uy == yupladder) || (u.ux == xupladder && u.uy == yupladder)
|| (u.ux == xdnladder && u.uy == ydnladder))) { || (u.ux == xdnladder && u.uy == ydnladder))) {
g.m.offensive = obj; g.m.offensive = obj;
@@ -1964,7 +1964,7 @@ struct monst *mtmp;
docrt(); docrt();
if (unconscious()) { if (unconscious()) {
g.multi = -1; g.multi = -1;
nomovemsg = "Aggravated, you are jolted into full consciousness."; g.nomovemsg = "Aggravated, you are jolted into full consciousness.";
} }
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
if (!canspotmon(mtmp)) if (!canspotmon(mtmp))
+5 -5
View File
@@ -665,7 +665,7 @@ struct obj *instr;
if (c == 'q') { if (c == 'q') {
goto nevermind; goto nevermind;
} else if (c == 'y') { } else if (c == 'y') {
Strcpy(buf, tune); Strcpy(buf, g.tune);
} else { } else {
getlin("What tune are you playing? [5 notes, A-G]", buf); getlin("What tune are you playing? [5 notes, A-G]", buf);
(void) mungspaces(buf); (void) mungspaces(buf);
@@ -719,7 +719,7 @@ struct obj *instr;
*/ */
if (Is_stronghold(&u.uz)) { if (Is_stronghold(&u.uz)) {
exercise(A_WIS, TRUE); /* just for trying */ exercise(A_WIS, TRUE); /* just for trying */
if (!strcmp(buf, tune)) { if (!strcmp(buf, g.tune)) {
/* Search for the drawbridge */ /* Search for the drawbridge */
for (y = u.uy - 1; y <= u.uy + 1; y++) for (y = u.uy - 1; y <= u.uy + 1; y++)
for (x = u.ux - 1; x <= u.ux + 1; x++) for (x = u.ux - 1; x <= u.ux + 1; x++)
@@ -756,13 +756,13 @@ struct obj *instr;
for (x = 0; x < (int) strlen(buf); x++) for (x = 0; x < (int) strlen(buf); x++)
if (x < 5) { if (x < 5) {
if (buf[x] == tune[x]) { if (buf[x] == g.tune[x]) {
gears++; gears++;
matched[x] = TRUE; matched[x] = TRUE;
} else } else
for (y = 0; y < 5; y++) for (y = 0; y < 5; y++)
if (!matched[y] && buf[x] == tune[y] if (!matched[y] && buf[x] == g.tune[y]
&& buf[y] != tune[y]) { && buf[y] != g.tune[y]) {
tumblers++; tumblers++;
matched[y] = TRUE; matched[y] = TRUE;
break; break;
+15 -15
View File
@@ -242,12 +242,12 @@ fruitname(juice)
boolean juice; /* whether or not to append " juice" to the name */ boolean juice; /* whether or not to append " juice" to the name */
{ {
char *buf = nextobuf(); char *buf = nextobuf();
const char *fruit_nam = strstri(pl_fruit, " of "); const char *fruit_nam = strstri(g.pl_fruit, " of ");
if (fruit_nam) if (fruit_nam)
fruit_nam += 4; /* skip past " of " */ fruit_nam += 4; /* skip past " of " */
else else
fruit_nam = pl_fruit; /* use it as is */ fruit_nam = g.pl_fruit; /* use it as is */
Sprintf(buf, "%s%s", makesingular(fruit_nam), juice ? " juice" : ""); Sprintf(buf, "%s%s", makesingular(fruit_nam), juice ? " juice" : "");
return buf; return buf;
@@ -260,7 +260,7 @@ int indx;
{ {
struct fruit *f; struct fruit *f;
for (f = ffruit; f; f = f->nextf) for (f = g.ffruit; f; f = f->nextf)
if (f->fid == indx) if (f->fid == indx)
break; break;
return f; return f;
@@ -283,7 +283,7 @@ int *highest_fid; /* optional output; only valid if 'fname' isn't found */
if (highest_fid) if (highest_fid)
*highest_fid = 0; *highest_fid = 0;
/* first try for an exact match */ /* first try for an exact match */
for (f = ffruit; f; f = f->nextf) for (f = g.ffruit; f; f = f->nextf)
if (!strcmp(f->fname, fname)) if (!strcmp(f->fname, fname))
return f; return f;
else if (highest_fid && f->fid > *highest_fid) else if (highest_fid && f->fid > *highest_fid)
@@ -294,7 +294,7 @@ int *highest_fid; /* optional output; only valid if 'fname' isn't found */
matches, not the first */ matches, not the first */
if (!exact) { if (!exact) {
tentativef = 0; tentativef = 0;
for (f = ffruit; f; f = f->nextf) { for (f = g.ffruit; f; f = f->nextf) {
k = strlen(f->fname); k = strlen(f->fname);
if (!strncmp(f->fname, fname, k) if (!strncmp(f->fname, fname, k)
&& (!fname[k] || fname[k] == ' ') && (!fname[k] || fname[k] == ' ')
@@ -307,7 +307,7 @@ int *highest_fid; /* optional output; only valid if 'fname' isn't found */
for exact match, that's trivial, but for prefix, it's hard */ for exact match, that's trivial, but for prefix, it's hard */
if (!f) { if (!f) {
altfname = makesingular(fname); altfname = makesingular(fname);
for (f = ffruit; f; f = f->nextf) { for (f = g.ffruit; f; f = f->nextf) {
if (!strcmp(f->fname, altfname)) if (!strcmp(f->fname, altfname))
break; break;
} }
@@ -318,7 +318,7 @@ int *highest_fid; /* optional output; only valid if 'fname' isn't found */
unsigned fname_k = strlen(fname); /* length of assumed plural fname */ unsigned fname_k = strlen(fname); /* length of assumed plural fname */
tentativef = 0; tentativef = 0;
for (f = ffruit; f; f = f->nextf) { for (f = g.ffruit; f; f = f->nextf) {
k = strlen(f->fname); k = strlen(f->fname);
/* reload fnamebuf[] each iteration in case it gets modified; /* reload fnamebuf[] each iteration in case it gets modified;
there's no need to recalculate fname_k */ there's no need to recalculate fname_k */
@@ -356,7 +356,7 @@ boolean forward;
for (i = 0; i < k; ++i) for (i = 0; i < k; ++i)
allfr[i] = (struct fruit *) 0; allfr[i] = (struct fruit *) 0;
for (f = ffruit; f; f = f->nextf) { for (f = g.ffruit; f; f = f->nextf) {
/* without sanity checking, this would reduce to 'allfr[f->fid]=f' */ /* without sanity checking, this would reduce to 'allfr[f->fid]=f' */
j = f->fid; j = f->fid;
if (j < 1 || j >= k) { if (j < 1 || j >= k) {
@@ -368,7 +368,7 @@ boolean forward;
} }
allfr[j] = f; allfr[j] = f;
} }
ffruit = 0; /* reset linked list; we're rebuilding it from scratch */ g.ffruit = 0; /* reset linked list; we're rebuilding it from scratch */
/* slot [0] will always be empty; must start 'i' at 1 to avoid /* slot [0] will always be empty; must start 'i' at 1 to avoid
[k - i] being out of bounds during first iteration */ [k - i] being out of bounds during first iteration */
for (i = 1; i < k; ++i) { for (i = 1; i < k; ++i) {
@@ -376,8 +376,8 @@ boolean forward;
for backward ordering, go from low to high */ for backward ordering, go from low to high */
j = forward ? (k - i) : i; j = forward ? (k - i) : i;
if (allfr[j]) { if (allfr[j]) {
allfr[j]->nextf = ffruit; allfr[j]->nextf = g.ffruit;
ffruit = allfr[j]; g.ffruit = allfr[j];
} }
} }
} }
@@ -767,10 +767,10 @@ struct obj *obj;
char tmpbuf[BUFSZ]; char tmpbuf[BUFSZ];
char *onm = xname(obj); char *onm = xname(obj);
if (m_shot.n > 1 && m_shot.o == obj->otyp) { if (g.m_shot.n > 1 && g.m_shot.o == obj->otyp) {
/* "the Nth arrow"; value will eventually be passed to an() or /* "the Nth arrow"; value will eventually be passed to an() or
The(), both of which correctly handle this "the " prefix */ The(), both of which correctly handle this "the " prefix */
Sprintf(tmpbuf, "the %d%s ", m_shot.i, ordin(m_shot.i)); Sprintf(tmpbuf, "the %d%s ", g.m_shot.i, ordin(g.m_shot.i));
onm = strprepend(onm, tmpbuf); onm = strprepend(onm, tmpbuf);
} }
return onm; return onm;
@@ -1139,7 +1139,7 @@ unsigned doname_flags;
break; break;
} }
if ((obj->owornmask & W_WEP) && !mrg_to_wielded) { if ((obj->owornmask & W_WEP) && !g.mrg_to_wielded) {
if (obj->quan != 1L) { if (obj->quan != 1L) {
Strcat(bp, " (wielded)"); Strcat(bp, " (wielded)");
} else { } else {
@@ -3503,7 +3503,7 @@ srch:
fp += l; fp += l;
} }
for (f = ffruit; f; f = f->nextf) { for (f = g.ffruit; f; f = f->nextf) {
/* match type: 0=none, 1=exact, 2=singular, 3=plural */ /* match type: 0=none, 1=exact, 2=singular, 3=plural */
int ftyp = 0; int ftyp = 0;
+25 -25
View File
@@ -818,7 +818,7 @@ initoptions_init()
/* since this is done before init_objects(), do partial init here */ /* since this is done before init_objects(), do partial init here */
objects[SLIME_MOLD].oc_name_idx = SLIME_MOLD; objects[SLIME_MOLD].oc_name_idx = SLIME_MOLD;
nmcpy(pl_fruit, OBJ_NAME(objects[SLIME_MOLD]), PL_FSIZ); nmcpy(g.pl_fruit, OBJ_NAME(objects[SLIME_MOLD]), PL_FSIZ);
} }
void void
@@ -858,7 +858,7 @@ initoptions_finish()
config_error_done(); config_error_done();
} }
(void) fruitadd(pl_fruit, (struct fruit *) 0); (void) fruitadd(g.pl_fruit, (struct fruit *) 0);
/* /*
* Remove "slime mold" from list of object names. This will * Remove "slime mold" from list of object names. This will
* prevent it from being wished unless it's actually present * prevent it from being wished unless it's actually present
@@ -2090,7 +2090,7 @@ boolean tinitial, tfrom_file;
config_error_add("Unknown %s '%s'", fullname, op); config_error_add("Unknown %s '%s'", fullname, op);
return FALSE; return FALSE;
} else /* Backwards compatibility */ } else /* Backwards compatibility */
nmcpy(pl_character, op, PL_NSIZ); nmcpy(g.pl_character, op, PL_NSIZ);
} else } else
return FALSE; return FALSE;
return retval; return retval;
@@ -2104,7 +2104,7 @@ boolean tinitial, tfrom_file;
config_error_add("Unknown %s '%s'", fullname, op); config_error_add("Unknown %s '%s'", fullname, op);
return FALSE; return FALSE;
} else /* Backwards compatibility */ } else /* Backwards compatibility */
pl_race = *op; g.pl_race = *op;
} else } else
return FALSE; return FALSE;
return retval; return retval;
@@ -2615,7 +2615,7 @@ boolean tinitial, tfrom_file;
f = fruit_from_name(op, FALSE, &fnum); f = fruit_from_name(op, FALSE, &fnum);
if (!f) { if (!f) {
if (!flags.made_fruit) if (!flags.made_fruit)
forig = fruit_from_name(pl_fruit, FALSE, (int *) 0); forig = fruit_from_name(g.pl_fruit, FALSE, (int *) 0);
if (!forig && fnum >= 100) { if (!forig && fnum >= 100) {
config_error_add( config_error_add(
@@ -2625,18 +2625,18 @@ boolean tinitial, tfrom_file;
} }
} }
goodfruit: goodfruit:
nmcpy(pl_fruit, op, PL_FSIZ); nmcpy(g.pl_fruit, op, PL_FSIZ);
sanitize_name(pl_fruit); sanitize_name(g.pl_fruit);
/* OBJ_NAME(objects[SLIME_MOLD]) won't work for this after /* OBJ_NAME(objects[SLIME_MOLD]) won't work for this after
initialization; it gets changed to generic "fruit" */ initialization; it gets changed to generic "fruit" */
if (!*pl_fruit) if (!*g.pl_fruit)
nmcpy(pl_fruit, "slime mold", PL_FSIZ); nmcpy(g.pl_fruit, "slime mold", PL_FSIZ);
if (!initial) { if (!initial) {
/* if 'forig' is nonNull, we replace it rather than add /* if 'forig' is nonNull, we replace it rather than add
a new fruit; it can only be nonNull if no fruits have a new fruit; it can only be nonNull if no fruits have
been created since the previous name was put in place */ been created since the previous name was put in place */
(void) fruitadd(pl_fruit, forig); (void) fruitadd(g.pl_fruit, forig);
pline("Fruit is now \"%s\".", pl_fruit); pline("Fruit is now \"%s\".", g.pl_fruit);
} }
/* If initial, then initoptions is allowed to do it instead /* If initial, then initoptions is allowed to do it instead
* of here (initoptions always has to do it even if there's * of here (initoptions always has to do it even if there's
@@ -2767,7 +2767,7 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE); bad_negation(fullname, FALSE);
return FALSE; return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) { } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
nmcpy(plname, op, PL_NSIZ); nmcpy(g.plname, op, PL_NSIZ);
} else } else
return FALSE; return FALSE;
return retval; return retval;
@@ -5485,7 +5485,7 @@ char *buf;
else else
Strcpy(buf, defopt); Strcpy(buf, defopt);
} else if (!strcmp(optname, "fruit")) } else if (!strcmp(optname, "fruit"))
Sprintf(buf, "%s", pl_fruit); Sprintf(buf, "%s", g.pl_fruit);
else if (!strcmp(optname, "gender")) else if (!strcmp(optname, "gender"))
Sprintf(buf, "%s", rolestring(flags.initgend, genders, adj)); Sprintf(buf, "%s", rolestring(flags.initgend, genders, adj));
else if (!strcmp(optname, "horsename")) else if (!strcmp(optname, "horsename"))
@@ -5544,7 +5544,7 @@ char *buf;
: "reversed"); : "reversed");
#endif #endif
} else if (!strcmp(optname, "name")) { } else if (!strcmp(optname, "name")) {
Sprintf(buf, "%s", plname); Sprintf(buf, "%s", g.plname);
} else if (!strcmp(optname, "mouse_support")) { } else if (!strcmp(optname, "mouse_support")) {
#ifdef WIN32 #ifdef WIN32
#define MOUSEFIX1 ", QuickEdit off" #define MOUSEFIX1 ", QuickEdit off"
@@ -6152,7 +6152,7 @@ struct fruit *replace_fruit;
register struct fruit *f; register struct fruit *f;
int highest_fruit_id = 0; int highest_fruit_id = 0;
char buf[PL_FSIZ], altname[PL_FSIZ]; char buf[PL_FSIZ], altname[PL_FSIZ];
boolean user_specified = (str == pl_fruit); boolean user_specified = (str == g.pl_fruit);
/* if not user-specified, then it's a fruit name for a fruit on /* if not user-specified, then it's a fruit name for a fruit on
* a bones level... * a bones level...
*/ */
@@ -6166,14 +6166,14 @@ struct fruit *replace_fruit;
/* force fruit to be singular; this handling is not /* force fruit to be singular; this handling is not
needed--or wanted--for fruits from bones because needed--or wanted--for fruits from bones because
they already received it in their original game */ they already received it in their original game */
nmcpy(pl_fruit, makesingular(str), PL_FSIZ); nmcpy(g.pl_fruit, makesingular(str), PL_FSIZ);
/* assert( str == pl_fruit ); */ /* assert( str == g.pl_fruit ); */
/* disallow naming after other foods (since it'd be impossible /* disallow naming after other foods (since it'd be impossible
* to tell the difference) * to tell the difference)
*/ */
for (i = g.bases[FOOD_CLASS]; objects[i].oc_class == FOOD_CLASS; i++) { for (i = g.bases[FOOD_CLASS]; objects[i].oc_class == FOOD_CLASS; i++) {
if (!strcmp(OBJ_NAME(objects[i]), pl_fruit)) { if (!strcmp(OBJ_NAME(objects[i]), g.pl_fruit)) {
found = TRUE; found = TRUE;
break; break;
} }
@@ -6181,7 +6181,7 @@ struct fruit *replace_fruit;
{ {
char *c; char *c;
for (c = pl_fruit; *c >= '0' && *c <= '9'; c++) for (c = g.pl_fruit; *c >= '0' && *c <= '9'; c++)
continue; continue;
if (isspace((uchar) *c) || *c == 0) if (isspace((uchar) *c) || *c == 0)
numeric = TRUE; numeric = TRUE;
@@ -6198,9 +6198,9 @@ struct fruit *replace_fruit;
|| ((str_end_is(str, " corpse") || ((str_end_is(str, " corpse")
|| str_end_is(str, " egg")) || str_end_is(str, " egg"))
&& name_to_mon(str) >= LOW_PM)) { && name_to_mon(str) >= LOW_PM)) {
Strcpy(buf, pl_fruit); Strcpy(buf, g.pl_fruit);
Strcpy(pl_fruit, "candied "); Strcpy(g.pl_fruit, "candied ");
nmcpy(pl_fruit + 8, buf, PL_FSIZ - 8); nmcpy(g.pl_fruit + 8, buf, PL_FSIZ - 8);
} }
*altname = '\0'; *altname = '\0';
/* This flag indicates that a fruit has been made since the /* This flag indicates that a fruit has been made since the
@@ -6242,8 +6242,8 @@ struct fruit *replace_fruit;
f->fid = ++highest_fruit_id; f->fid = ++highest_fruit_id;
/* we used to go out of our way to add it at the end of the list, /* we used to go out of our way to add it at the end of the list,
but the order is arbitrary so use simpler insertion at start */ but the order is arbitrary so use simpler insertion at start */
f->nextf = ffruit; f->nextf = g.ffruit;
ffruit = f; g.ffruit = f;
nonew: nonew:
if (user_specified) if (user_specified)
context.current_fruit = f->fid; context.current_fruit = f->fid;
@@ -6712,7 +6712,7 @@ set_playmode()
{ {
if (wizard) { if (wizard) {
if (authorize_wizard_mode()) if (authorize_wizard_mode())
Strcpy(plname, "wizard"); Strcpy(g.plname, "wizard");
else else
wizard = FALSE; /* not allowed or not available */ wizard = FALSE; /* not allowed or not available */
/* force explore mode if we didn't make it into wizard mode */ /* force explore mode if we didn't make it into wizard mode */
+1 -1
View File
@@ -86,7 +86,7 @@ char *outbuf;
Sprintf(outbuf, "%s%s%s called %s", Sprintf(outbuf, "%s%s%s called %s",
/* being blinded may hide invisibility from self */ /* being blinded may hide invisibility from self */
(Invis && (senseself() || !Blind)) ? "invisible " : "", race, (Invis && (senseself() || !Blind)) ? "invisible " : "", race,
mons[u.umonnum].mname, plname); mons[u.umonnum].mname, g.plname);
if (u.usteed) if (u.usteed)
Sprintf(eos(outbuf), ", mounted on %s", y_monnam(u.usteed)); Sprintf(eos(outbuf), ", mounted on %s", y_monnam(u.usteed));
if (u.uundetected || (Upolyd && youmonst.m_ap_type)) if (u.uundetected || (Upolyd && youmonst.m_ap_type))
+4 -4
View File
@@ -1497,11 +1497,11 @@ boolean telekinesis; /* not picking it up directly by hand */
obj = pick_obj(obj); obj = pick_obj(obj);
if (uwep && uwep == obj) if (uwep && uwep == obj)
mrg_to_wielded = TRUE; g.mrg_to_wielded = TRUE;
nearload = near_capacity(); nearload = near_capacity();
prinv(nearload == SLT_ENCUMBER ? moderateloadmsg : (char *) 0, obj, prinv(nearload == SLT_ENCUMBER ? moderateloadmsg : (char *) 0, obj,
count); count);
mrg_to_wielded = FALSE; g.mrg_to_wielded = FALSE;
return 1; return 1;
} }
@@ -2481,7 +2481,7 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
if (g.multi >= 0) { /* in case we didn't become paralyzed */ if (g.multi >= 0) { /* in case we didn't become paralyzed */
nomul(-1); nomul(-1);
g.multi_reason = "opening a container"; g.multi_reason = "opening a container";
nomovemsg = ""; g.nomovemsg = "";
} }
g.abort_looting = TRUE; g.abort_looting = TRUE;
return 1; return 1;
@@ -3088,7 +3088,7 @@ struct obj *box; /* or bag */
if (g.multi >= 0) { /* in case we didn't become paralyzed */ if (g.multi >= 0) { /* in case we didn't become paralyzed */
nomul(-1); nomul(-1);
g.multi_reason = "tipping a container"; g.multi_reason = "tipping a container";
nomovemsg = ""; g.nomovemsg = "";
} }
} else if (box->otyp == BAG_OF_TRICKS || box->otyp == HORN_OF_PLENTY) { } else if (box->otyp == BAG_OF_TRICKS || box->otyp == HORN_OF_PLENTY) {
boolean bag = box->otyp == BAG_OF_TRICKS; boolean bag = box->otyp == BAG_OF_TRICKS;
+3 -3
View File
@@ -251,9 +251,9 @@ change_sex()
u.mfemale = !u.mfemale; u.mfemale = !u.mfemale;
max_rank_sz(); /* [this appears to be superfluous] */ max_rank_sz(); /* [this appears to be superfluous] */
if ((already_polyd ? u.mfemale : flags.female) && urole.name.f) if ((already_polyd ? u.mfemale : flags.female) && urole.name.f)
Strcpy(pl_character, urole.name.f); Strcpy(g.pl_character, urole.name.f);
else else
Strcpy(pl_character, urole.name.m); Strcpy(g.pl_character, urole.name.m);
u.umonster = ((already_polyd ? u.mfemale : flags.female) u.umonster = ((already_polyd ? u.mfemale : flags.female)
&& urole.femalenum != NON_PM) && urole.femalenum != NON_PM)
? urole.femalenum ? urole.femalenum
@@ -1385,7 +1385,7 @@ dogaze()
(int) mtmp->data->mattk[0].damd) (int) mtmp->data->mattk[0].damd)
: -200); : -200);
g.multi_reason = "frozen by a monster's gaze"; g.multi_reason = "frozen by a monster's gaze";
nomovemsg = 0; g.nomovemsg = 0;
return 1; return 1;
} else } else
You("stiffen momentarily under %s gaze.", You("stiffen momentarily under %s gaze.",
+6 -6
View File
@@ -459,7 +459,7 @@ ghost_from_bottle()
You("are frightened to death, and unable to move."); You("are frightened to death, and unable to move.");
nomul(-3); nomul(-3);
g.multi_reason = "being frightened to death"; g.multi_reason = "being frightened to death";
nomovemsg = "You regain your composure."; g.nomovemsg = "You regain your composure.";
} }
/* "Quaffing is like drinking, except you spill more." - Terry Pratchett */ /* "Quaffing is like drinking, except you spill more." - Terry Pratchett */
@@ -686,7 +686,7 @@ register struct obj *otmp;
if (otmp->cursed) { if (otmp->cursed) {
You("pass out."); You("pass out.");
g.multi = -rnd(15); g.multi = -rnd(15);
nomovemsg = "You awake with a headache."; g.nomovemsg = "You awake with a headache.";
} }
break; break;
case POT_ENLIGHTENMENT: case POT_ENLIGHTENMENT:
@@ -780,7 +780,7 @@ register struct obj *otmp;
surface(u.ux, u.uy)); surface(u.ux, u.uy));
nomul(-(rn1(10, 25 - 12 * bcsign(otmp)))); nomul(-(rn1(10, 25 - 12 * bcsign(otmp))));
g.multi_reason = "frozen by a potion"; g.multi_reason = "frozen by a potion";
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
} }
break; break;
@@ -1026,7 +1026,7 @@ register struct obj *otmp;
if (BLevitation) { if (BLevitation) {
; /* rising via levitation is blocked */ ; /* rising via levitation is blocked */
} else if ((u.ux == xupstair && u.uy == yupstair) } else if ((u.ux == xupstair && u.uy == yupstair)
|| (sstairs.up && u.ux == sstairs.sx && u.uy == sstairs.sy) || (g.sstairs.up && u.ux == g.sstairs.sx && u.uy == g.sstairs.sy)
|| (xupladder && u.ux == xupladder && u.uy == yupladder)) { || (xupladder && u.ux == xupladder && u.uy == yupladder)) {
(void) doup(); (void) doup();
/* in case we're already Levitating, which would have /* in case we're already Levitating, which would have
@@ -1683,7 +1683,7 @@ register struct obj *obj;
pline("%s seems to be holding you.", Something); pline("%s seems to be holding you.", Something);
nomul(-rnd(5)); nomul(-rnd(5));
g.multi_reason = "frozen by a potion"; g.multi_reason = "frozen by a potion";
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
} else } else
You("stiffen momentarily."); You("stiffen momentarily.");
@@ -1694,7 +1694,7 @@ register struct obj *obj;
You_feel("rather tired."); You_feel("rather tired.");
nomul(-rnd(5)); nomul(-rnd(5));
g.multi_reason = "sleeping off a magical draught"; g.multi_reason = "sleeping off a magical draught";
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
} else } else
You("yawn."); You("yawn.");
+4 -4
View File
@@ -1047,7 +1047,7 @@ aligntyp g_align;
break; break;
} else if (u.uevent.uheard_tune < 2) { } else if (u.uevent.uheard_tune < 2) {
You_hear("a divine music..."); You_hear("a divine music...");
pline("It sounds like: \"%s\".", tune); pline("It sounds like: \"%s\".", g.tune);
u.uevent.uheard_tune++; u.uevent.uheard_tune++;
break; break;
} }
@@ -1395,7 +1395,7 @@ dosacrifice()
You("are terrified, and unable to move."); You("are terrified, and unable to move.");
nomul(-3); nomul(-3);
g.multi_reason = "being terrified of a demon"; g.multi_reason = "being terrified of a demon";
nomovemsg = 0; g.nomovemsg = 0;
} else } else
pline_The("%s.", demonless_msg); pline_The("%s.", demonless_msg);
} }
@@ -1834,7 +1834,7 @@ dopray()
} }
nomul(-3); nomul(-3);
g.multi_reason = "praying"; g.multi_reason = "praying";
nomovemsg = "You finish your prayer."; g.nomovemsg = "You finish your prayer.";
g.afternmv = prayer_done; g.afternmv = prayer_done;
if (g.p_type == 3 && !Inhell) { if (g.p_type == 3 && !Inhell) {
@@ -2004,7 +2004,7 @@ doturn()
} }
nomul(-(5 - ((u.ulevel - 1) / 6))); /* -5 .. -1 */ nomul(-(5 - ((u.ulevel - 1) / 6))); /* -5 .. -1 */
g.multi_reason = "trying to turn the monsters"; g.multi_reason = "trying to turn the monsters";
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
return 1; return 1;
} }
+4 -4
View File
@@ -508,7 +508,7 @@ int roomno;
You("are frightened to death, and unable to move."); You("are frightened to death, and unable to move.");
nomul(-3); nomul(-3);
g.multi_reason = "being terrified of a ghost"; g.multi_reason = "being terrified of a ghost";
nomovemsg = "You regain your composure."; g.nomovemsg = "You regain your composure.";
} }
} }
} }
@@ -785,8 +785,8 @@ struct monst *priest;
break; break;
} }
buzz(-10 - (AD_ELEC - 1), 6, x, y, sgn(tbx), buzz(-10 - (AD_ELEC - 1), 6, x, y, sgn(g.tbx),
sgn(tby)); /* bolt of lightning */ sgn(g.tby)); /* bolt of lightning */
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
} }
@@ -1088,7 +1088,7 @@ ustatusline()
Strcat(info, mon_nam(u.ustuck)); Strcat(info, mon_nam(u.ustuck));
} }
pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", plname, pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", g.plname,
piousness(FALSE, align_str(u.ualign.type)), piousness(FALSE, align_str(u.ualign.type)),
Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp, Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp,
Upolyd ? u.mhmax : u.uhpmax, u.uac, info); Upolyd ? u.mhmax : u.uhpmax, u.uac, info);
+1 -1
View File
@@ -10,7 +10,7 @@
#include "qtext.h" #include "qtext.h"
#define Not_firsttime (on_level(&u.uz0, &u.uz)) #define Not_firsttime (on_level(&u.uz0, &u.uz))
#define Qstat(x) (quest_status.x) #define Qstat(x) (g.quest_status.x)
STATIC_DCL void NDECL(on_start); STATIC_DCL void NDECL(on_start);
STATIC_DCL void NDECL(on_locate); STATIC_DCL void NDECL(on_locate);
+5 -5
View File
@@ -289,9 +289,9 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
: (lwhich == 'i') ? "them" : (lwhich == 'i') ? "them"
: (lwhich == 'j') ? "their" : "?"; : (lwhich == 'j') ? "their" : "?";
} else { } else {
godgend = (who == 'd') ? quest_status.godgend godgend = (who == 'd') ? g.quest_status.godgend
: (who == 'l') ? quest_status.ldrgend : (who == 'l') ? g.quest_status.ldrgend
: (who == 'n') ? quest_status.nemgend : (who == 'n') ? g.quest_status.nemgend
: 2; /* default to neuter */ : 2; /* default to neuter */
pnoun = (lwhich == 'h') ? genders[godgend].he pnoun = (lwhich == 'h') ? genders[godgend].he
: (lwhich == 'i') ? genders[godgend].him : (lwhich == 'i') ? genders[godgend].him
@@ -326,7 +326,7 @@ char c;
switch (c) { switch (c) {
case 'p': case 'p':
str = plname; str = g.plname;
break; break;
case 'c': case 'c':
str = (flags.female && urole.name.f) ? urole.name.f : urole.name.m; str = (flags.female && urole.name.f) ? urole.name.f : urole.name.m;
@@ -398,7 +398,7 @@ char c;
str = Blind ? "sense" : "see"; str = Blind ? "sense" : "see";
break; break;
case 'Z': case 'Z':
str = dungeons[0].dname; str = g.dungeons[0].dname;
break; break;
case '%': case '%':
str = "%"; str = "%";
+1 -1
View File
@@ -1579,7 +1579,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
| (!confused || scursed ? ALL_MAP : 0)); | (!confused || scursed ? ALL_MAP : 0));
if (Hallucination) /* Ommmmmm! */ if (Hallucination) /* Ommmmmm! */
Your("mind releases itself from mundane concerns."); Your("mind releases itself from mundane concerns.");
else if (!strncmpi(plname, "Maud", 4)) else if (!strncmpi(g.plname, "Maud", 4))
pline( pline(
"As your mind turns inward on itself, you forget everything else."); "As your mind turns inward on itself, you forget everything else.");
else if (rn2(2)) else if (rn2(2))
+2 -2
View File
@@ -895,7 +895,7 @@ long ttl;
tmprect.hy--; tmprect.hy--;
} }
ff->ttl = ttl; ff->ttl = ttl;
if (!in_mklev && !context.mon_moving) if (!g.in_mklev && !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 (!in_mklev && !context.mon_moving) if (!g.in_mklev && !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;
+28 -28
View File
@@ -139,15 +139,15 @@ register int fd;
int cnt; int cnt;
s_level *tmplev, *x; s_level *tmplev, *x;
sp_levchn = (s_level *) 0; g.sp_levchn = (s_level *) 0;
mread(fd, (genericptr_t) &cnt, sizeof(int)); mread(fd, (genericptr_t) &cnt, sizeof(int));
for (; cnt > 0; cnt--) { for (; cnt > 0; cnt--) {
tmplev = (s_level *) alloc(sizeof(s_level)); tmplev = (s_level *) alloc(sizeof(s_level));
mread(fd, (genericptr_t) tmplev, sizeof(s_level)); mread(fd, (genericptr_t) tmplev, sizeof(s_level));
if (!sp_levchn) if (!g.sp_levchn)
sp_levchn = tmplev; g.sp_levchn = tmplev;
else { else {
for (x = sp_levchn; x->next; x = x->next) for (x = g.sp_levchn; x->next; x = x->next)
; ;
x->next = tmplev; x->next = tmplev;
} }
@@ -658,7 +658,7 @@ unsigned int *stuckid, *steedid;
* side-effects too early in the game. * side-effects too early in the game.
* Disable see_monsters() here, re-enable it at the top of moveloop() * Disable see_monsters() here, re-enable it at the top of moveloop()
*/ */
defer_see_monsters = TRUE; g.defer_see_monsters = TRUE;
/* this comes after inventory has been loaded */ /* this comes after inventory has been loaded */
for (otmp = invent; otmp; otmp = otmp->nobj) for (otmp = invent; otmp; otmp = otmp->nobj)
@@ -672,13 +672,13 @@ unsigned int *stuckid, *steedid;
uwep = 0; /* clear it and have setuwep() reinit */ uwep = 0; /* clear it and have setuwep() reinit */
setuwep(otmp); /* (don't need any null check here) */ setuwep(otmp); /* (don't need any null check here) */
if (!uwep || uwep->otyp == PICK_AXE || uwep->otyp == GRAPPLING_HOOK) if (!uwep || uwep->otyp == PICK_AXE || uwep->otyp == GRAPPLING_HOOK)
unweapon = TRUE; g.unweapon = TRUE;
restore_dungeon(fd); restore_dungeon(fd);
restlevchn(fd); restlevchn(fd);
mread(fd, (genericptr_t) &moves, sizeof moves); mread(fd, (genericptr_t) &moves, sizeof moves);
mread(fd, (genericptr_t) &monstermoves, sizeof monstermoves); mread(fd, (genericptr_t) &monstermoves, sizeof monstermoves);
mread(fd, (genericptr_t) &quest_status, sizeof (struct q_score)); mread(fd, (genericptr_t) &g.quest_status, sizeof (struct q_score));
mread(fd, (genericptr_t) spl_book, (MAXSPELL + 1) * sizeof (struct spell)); mread(fd, (genericptr_t) spl_book, (MAXSPELL + 1) * sizeof (struct spell));
restore_artifacts(fd); restore_artifacts(fd);
restore_oracles(fd); restore_oracles(fd);
@@ -686,11 +686,11 @@ unsigned int *stuckid, *steedid;
mread(fd, (genericptr_t) stuckid, sizeof *stuckid); mread(fd, (genericptr_t) stuckid, sizeof *stuckid);
if (u.usteed) if (u.usteed)
mread(fd, (genericptr_t) steedid, sizeof *steedid); mread(fd, (genericptr_t) steedid, sizeof *steedid);
mread(fd, (genericptr_t) pl_character, sizeof pl_character); mread(fd, (genericptr_t) g.pl_character, sizeof g.pl_character);
mread(fd, (genericptr_t) pl_fruit, sizeof pl_fruit); mread(fd, (genericptr_t) g.pl_fruit, sizeof g.pl_fruit);
freefruitchn(ffruit); /* clean up fruit(s) made by initoptions() */ freefruitchn(g.ffruit); /* clean up fruit(s) made by initoptions() */
ffruit = loadfruitchn(fd); g.ffruit = loadfruitchn(fd);
restnames(fd); restnames(fd);
restore_waterlevel(fd); restore_waterlevel(fd);
@@ -799,7 +799,7 @@ register int fd;
struct obj *otmp; struct obj *otmp;
g.restoring = TRUE; g.restoring = TRUE;
get_plname_from_file(fd, plname); get_plname_from_file(fd, g.plname);
getlev(fd, 0, (xchar) 0, FALSE); getlev(fd, 0, (xchar) 0, FALSE);
if (!restgamestate(fd, &stuckid, &steedid)) { if (!restgamestate(fd, &stuckid, &steedid)) {
display_nhwindow(WIN_MESSAGE, TRUE); display_nhwindow(WIN_MESSAGE, TRUE);
@@ -839,7 +839,7 @@ register int fd;
#endif #endif
clear_nhwindow(WIN_MESSAGE); clear_nhwindow(WIN_MESSAGE);
You("return to level %d in %s%s.", depth(&u.uz), You("return to level %d in %s%s.", depth(&u.uz),
dungeons[u.uz.dnum].dname, g.dungeons[u.uz.dnum].dname,
flags.debug ? " while in debug mode" flags.debug ? " while in debug mode"
: flags.explore ? " while in explore mode" : ""); : flags.explore ? " while in explore mode" : "");
curs(WIN_MAP, 1, 1); curs(WIN_MAP, 1, 1);
@@ -877,7 +877,7 @@ register int fd;
(void) lseek(fd, (off_t) 0, 0); (void) lseek(fd, (off_t) 0, 0);
#endif #endif
(void) validate(fd, (char *) 0); /* skip version and savefile info */ (void) validate(fd, (char *) 0); /* skip version and savefile info */
get_plname_from_file(fd, plname); get_plname_from_file(fd, g.plname);
getlev(fd, 0, (xchar) 0, FALSE); getlev(fd, 0, (xchar) 0, FALSE);
(void) nhclose(fd); (void) nhclose(fd);
@@ -1058,20 +1058,20 @@ boolean ghostly;
mread(fd, (genericptr_t) lastseentyp, sizeof(lastseentyp)); mread(fd, (genericptr_t) lastseentyp, sizeof(lastseentyp));
mread(fd, (genericptr_t) &g.omoves, sizeof(g.omoves)); mread(fd, (genericptr_t) &g.omoves, sizeof(g.omoves));
elapsed = monstermoves - g.omoves; elapsed = monstermoves - g.omoves;
mread(fd, (genericptr_t) &upstair, sizeof(stairway)); mread(fd, (genericptr_t) &g.upstair, sizeof(stairway));
mread(fd, (genericptr_t) &dnstair, sizeof(stairway)); mread(fd, (genericptr_t) &g.dnstair, sizeof(stairway));
mread(fd, (genericptr_t) &upladder, sizeof(stairway)); mread(fd, (genericptr_t) &g.upladder, sizeof(stairway));
mread(fd, (genericptr_t) &dnladder, sizeof(stairway)); mread(fd, (genericptr_t) &g.dnladder, sizeof(stairway));
mread(fd, (genericptr_t) &sstairs, sizeof(stairway)); mread(fd, (genericptr_t) &g.sstairs, sizeof(stairway));
mread(fd, (genericptr_t) &updest, sizeof(dest_area)); mread(fd, (genericptr_t) &g.updest, sizeof(dest_area));
mread(fd, (genericptr_t) &dndest, sizeof(dest_area)); mread(fd, (genericptr_t) &g.dndest, sizeof(dest_area));
mread(fd, (genericptr_t) &level.flags, sizeof(level.flags)); mread(fd, (genericptr_t) &level.flags, sizeof(level.flags));
mread(fd, (genericptr_t) doors, sizeof(doors)); mread(fd, (genericptr_t) doors, sizeof(doors));
rest_rooms(fd); /* No joke :-) */ rest_rooms(fd); /* No joke :-) */
if (g.nroom) if (g.nroom)
doorindex = rooms[g.nroom - 1].fdoor + rooms[g.nroom - 1].doorct; g.doorindex = rooms[g.nroom - 1].fdoor + rooms[g.nroom - 1].doorct;
else else
doorindex = 0; g.doorindex = 0;
restore_timers(fd, RANGE_LEVEL, ghostly, elapsed); restore_timers(fd, RANGE_LEVEL, ghostly, elapsed);
restore_light_sources(fd); restore_light_sources(fd);
@@ -1157,8 +1157,8 @@ boolean ghostly;
switch (br->type) { switch (br->type) {
case BR_STAIR: case BR_STAIR:
case BR_NO_END1: case BR_NO_END1:
case BR_NO_END2: /* OK to assign to sstairs if it's not used */ case BR_NO_END2: /* OK to assign to g.sstairs if it's not used */
assign_level(&sstairs.tolev, &ltmp); assign_level(&g.sstairs.tolev, &ltmp);
break; break;
case BR_PORTAL: /* max of 1 portal per level */ case BR_PORTAL: /* max of 1 portal per level */
for (trap = ftrap; trap; trap = trap->ntrap) for (trap = ftrap; trap; trap = trap->ntrap)
@@ -1317,7 +1317,7 @@ boolean ghostly;
#ifdef SELECTSAVED #ifdef SELECTSAVED
/* put up a menu listing each character from this player's saved games; /* put up a menu listing each character from this player's saved games;
returns 1: use plname[], 0: new game, -1: quit */ returns 1: use g.plname[], 0: new game, -1: quit */
int int
restore_menu(bannerwin) restore_menu(bannerwin)
winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */ winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */
@@ -1328,7 +1328,7 @@ winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */
menu_item *chosen_game = (menu_item *) 0; menu_item *chosen_game = (menu_item *) 0;
int k, clet, ch = 0; /* ch: 0 => new game */ int k, clet, ch = 0; /* ch: 0 => new game */
*plname = '\0'; *g.plname = '\0';
saved = get_saved_games(); /* array of character names */ saved = get_saved_games(); /* array of character names */
if (saved && *saved) { if (saved && *saved) {
tmpwin = create_nhwindow(NHW_MENU); tmpwin = create_nhwindow(NHW_MENU);
@@ -1364,7 +1364,7 @@ winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */
if (select_menu(tmpwin, PICK_ONE, &chosen_game) > 0) { if (select_menu(tmpwin, PICK_ONE, &chosen_game) > 0) {
ch = chosen_game->item.a_int; ch = chosen_game->item.a_int;
if (ch > 0) if (ch > 0)
Strcpy(plname, saved[ch - 1]); Strcpy(g.plname, saved[ch - 1]);
else if (ch < 0) else if (ch < 0)
++ch; /* -1 -> 0 (new game), -2 -> -1 (quit) */ ++ch; /* -1 -> 0 (new game), -2 -> -1 (quit) */
free((genericptr_t) chosen_game); free((genericptr_t) chosen_game);
+2 -2
View File
@@ -102,12 +102,12 @@ time_t when;
dp[x] = (char *) 0; dp[x] = (char *) 0;
/* Put name on stone */ /* Put name on stone */
Sprintf(buf, "%s", plname); Sprintf(buf, "%s", g.plname);
buf[STONE_LINE_LEN] = 0; buf[STONE_LINE_LEN] = 0;
center(NAME_LINE, buf); center(NAME_LINE, buf);
/* Put $ on stone */ /* Put $ on stone */
Sprintf(buf, "%ld Au", done_money); Sprintf(buf, "%ld Au", g.done_money);
buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */ buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */
center(GOLD_LINE, buf); center(GOLD_LINE, buf);
+17 -17
View File
@@ -1704,22 +1704,22 @@ plnamesuffix()
/* some generic user names will be ignored in favor of prompting */ /* some generic user names will be ignored in favor of prompting */
if (sysopt.genericusers) { if (sysopt.genericusers) {
if (*sysopt.genericusers == '*') { if (*sysopt.genericusers == '*') {
*plname = '\0'; *g.plname = '\0';
} else { } else {
i = (int) strlen(plname); i = (int) strlen(g.plname);
if ((sptr = strstri(sysopt.genericusers, plname)) != 0 if ((sptr = strstri(sysopt.genericusers, g.plname)) != 0
&& (sptr == sysopt.genericusers || sptr[-1] == ' ') && (sptr == sysopt.genericusers || sptr[-1] == ' ')
&& (sptr[i] == ' ' || sptr[i] == '\0')) && (sptr[i] == ' ' || sptr[i] == '\0'))
*plname = '\0'; /* call askname() */ *g.plname = '\0'; /* call askname() */
} }
} }
do { do {
if (!*plname) if (!*g.plname)
askname(); /* fill plname[] if necessary, or set defer_plname */ askname(); /* fill g.plname[] if necessary, or set defer_plname */
/* Look for tokens delimited by '-' */ /* Look for tokens delimited by '-' */
if ((eptr = index(plname, '-')) != (char *) 0) if ((eptr = index(g.plname, '-')) != (char *) 0)
*eptr++ = '\0'; *eptr++ = '\0';
while (eptr) { while (eptr) {
/* Isolate the next token */ /* Isolate the next token */
@@ -1737,10 +1737,10 @@ plnamesuffix()
else if ((i = str2align(sptr)) != ROLE_NONE) else if ((i = str2align(sptr)) != ROLE_NONE)
flags.initalign = i; flags.initalign = i;
} }
} while (!*plname && !iflags.defer_plname); } while (!*g.plname && !iflags.defer_plname);
/* commas in the plname confuse the record file, convert to spaces */ /* commas in the g.plname confuse the record file, convert to spaces */
for (sptr = plname; *sptr; sptr++) { for (sptr = g.plname; *sptr; sptr++) {
if (*sptr == ',') if (*sptr == ',')
*sptr = ' '; *sptr = ' ';
} }
@@ -1794,7 +1794,7 @@ winid where;
to narrow something done to a single choice] */ to narrow something done to a single choice] */
Sprintf(buf, "%12s ", "name:"); Sprintf(buf, "%12s ", "name:");
Strcat(buf, (which == RS_NAME) ? choosing : !*plname ? not_yet : plname); Strcat(buf, (which == RS_NAME) ? choosing : !*g.plname ? not_yet : g.plname);
putstr(where, 0, buf); putstr(where, 0, buf);
Sprintf(buf, "%12s ", "role:"); Sprintf(buf, "%12s ", "role:");
Strcat(buf, (which == RS_ROLE) ? choosing : (r == ROLE_NONE) Strcat(buf, (which == RS_ROLE) ? choosing : (r == ROLE_NONE)
@@ -2011,15 +2011,15 @@ role_init()
/* Check for a valid role. Try flags.initrole first. */ /* Check for a valid role. Try flags.initrole first. */
if (!validrole(flags.initrole)) { if (!validrole(flags.initrole)) {
/* Try the player letter second */ /* Try the player letter second */
if ((flags.initrole = str2role(pl_character)) < 0) if ((flags.initrole = str2role(g.pl_character)) < 0)
/* None specified; pick a random role */ /* None specified; pick a random role */
flags.initrole = randrole_filtered(); flags.initrole = randrole_filtered();
} }
/* We now have a valid role index. Copy the role name back. */ /* We now have a valid role index. Copy the role name back. */
/* This should become OBSOLETE */ /* This should become OBSOLETE */
Strcpy(pl_character, roles[flags.initrole].name.m); Strcpy(g.pl_character, roles[flags.initrole].name.m);
pl_character[PL_CSIZ - 1] = '\0'; g.pl_character[PL_CSIZ - 1] = '\0';
/* Check for a valid race */ /* Check for a valid race */
if (!validrace(flags.initrole, flags.initrace)) if (!validrace(flags.initrole, flags.initrace))
@@ -2054,7 +2054,7 @@ role_init()
pm->maligntyp = alignmnt * 3; pm->maligntyp = alignmnt * 3;
/* if gender is random, we choose it now instead of waiting /* if gender is random, we choose it now instead of waiting
until the leader monster is created */ until the leader monster is created */
quest_status.ldrgend = g.quest_status.ldrgend =
is_neuter(pm) ? 2 : is_female(pm) ? 1 : is_male(pm) is_neuter(pm) ? 2 : is_female(pm) ? 1 : is_male(pm)
? 0 ? 0
: (rn2(100) < 50); : (rn2(100) < 50);
@@ -2077,7 +2077,7 @@ role_init()
pm->mflags3 |= M3_WANTSARTI | M3_WAITFORU; pm->mflags3 |= M3_WANTSARTI | M3_WAITFORU;
/* if gender is random, we choose it now instead of waiting /* if gender is random, we choose it now instead of waiting
until the nemesis monster is created */ until the nemesis monster is created */
quest_status.nemgend = is_neuter(pm) ? 2 : is_female(pm) ? 1 g.quest_status.nemgend = is_neuter(pm) ? 2 : is_female(pm) ? 1
: is_male(pm) ? 0 : (rn2(100) < 50); : is_male(pm) ? 0 : (rn2(100) < 50);
} }
@@ -2093,7 +2093,7 @@ role_init()
urole.cgod = roles[flags.pantheon].cgod; urole.cgod = roles[flags.pantheon].cgod;
} }
/* 0 or 1; no gods are neuter, nor is gender randomized */ /* 0 or 1; no gods are neuter, nor is gender randomized */
quest_status.godgend = !strcmpi(align_gtitle(alignmnt), "goddess"); g.quest_status.godgend = !strcmpi(align_gtitle(alignmnt), "goddess");
/* Fix up infravision */ /* Fix up infravision */
if (mons[urace.malenum].mflags3 & M3_INFRAVISION) { if (mons[urace.malenum].mflags3 & M3_INFRAVISION) {
+1 -1
View File
@@ -142,7 +142,7 @@ boolean exclude_cookie;
(void) dlb_fclose(rumors); (void) dlb_fclose(rumors);
if (count >= 50) if (count >= 50)
impossible("Can't find non-cookie rumor?"); impossible("Can't find non-cookie rumor?");
else if (!in_mklev) /* avoid exercizing wisdom for graffiti */ else if (!g.in_mklev) /* avoid exercizing wisdom for graffiti */
exercise(A_WIS, (adjtruth > 0)); exercise(A_WIS, (adjtruth > 0));
} else { } else {
couldnt_open_file(RUMORFILE); couldnt_open_file(RUMORFILE);
+16 -16
View File
@@ -328,7 +328,7 @@ register int fd, mode;
savelevchn(fd, mode); savelevchn(fd, mode);
bwrite(fd, (genericptr_t) &moves, sizeof moves); bwrite(fd, (genericptr_t) &moves, sizeof moves);
bwrite(fd, (genericptr_t) &monstermoves, sizeof monstermoves); bwrite(fd, (genericptr_t) &monstermoves, sizeof monstermoves);
bwrite(fd, (genericptr_t) &quest_status, sizeof(struct q_score)); bwrite(fd, (genericptr_t) &g.quest_status, sizeof(struct q_score));
bwrite(fd, (genericptr_t) spl_book, bwrite(fd, (genericptr_t) spl_book,
sizeof(struct spell) * (MAXSPELL + 1)); sizeof(struct spell) * (MAXSPELL + 1));
save_artifacts(fd); save_artifacts(fd);
@@ -337,8 +337,8 @@ register int fd, mode;
bwrite(fd, (genericptr_t) &g.ustuck_id, sizeof g.ustuck_id); bwrite(fd, (genericptr_t) &g.ustuck_id, sizeof g.ustuck_id);
if (g.usteed_id) if (g.usteed_id)
bwrite(fd, (genericptr_t) &g.usteed_id, sizeof g.usteed_id); bwrite(fd, (genericptr_t) &g.usteed_id, sizeof g.usteed_id);
bwrite(fd, (genericptr_t) pl_character, sizeof pl_character); bwrite(fd, (genericptr_t) g.pl_character, sizeof g.pl_character);
bwrite(fd, (genericptr_t) pl_fruit, sizeof pl_fruit); bwrite(fd, (genericptr_t) g.pl_fruit, sizeof g.pl_fruit);
savefruitchn(fd, mode); savefruitchn(fd, mode);
savenames(fd, mode); savenames(fd, mode);
save_waterlevel(fd, mode); save_waterlevel(fd, mode);
@@ -505,13 +505,13 @@ int mode;
(boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP)); (boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
bwrite(fd, (genericptr_t) lastseentyp, sizeof(lastseentyp)); bwrite(fd, (genericptr_t) lastseentyp, sizeof(lastseentyp));
bwrite(fd, (genericptr_t) &monstermoves, sizeof(monstermoves)); bwrite(fd, (genericptr_t) &monstermoves, sizeof(monstermoves));
bwrite(fd, (genericptr_t) &upstair, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.upstair, sizeof(stairway));
bwrite(fd, (genericptr_t) &dnstair, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.dnstair, sizeof(stairway));
bwrite(fd, (genericptr_t) &upladder, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.upladder, sizeof(stairway));
bwrite(fd, (genericptr_t) &dnladder, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.dnladder, sizeof(stairway));
bwrite(fd, (genericptr_t) &sstairs, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.sstairs, sizeof(stairway));
bwrite(fd, (genericptr_t) &updest, sizeof(dest_area)); bwrite(fd, (genericptr_t) &g.updest, sizeof(dest_area));
bwrite(fd, (genericptr_t) &dndest, sizeof(dest_area)); bwrite(fd, (genericptr_t) &g.dndest, sizeof(dest_area));
bwrite(fd, (genericptr_t) &level.flags, sizeof(level.flags)); bwrite(fd, (genericptr_t) &level.flags, sizeof(level.flags));
bwrite(fd, (genericptr_t) doors, sizeof(doors)); bwrite(fd, (genericptr_t) doors, sizeof(doors));
save_rooms(fd); /* no dynamic memory to reclaim */ save_rooms(fd); /* no dynamic memory to reclaim */
@@ -898,12 +898,12 @@ register int fd, mode;
s_level *tmplev, *tmplev2; s_level *tmplev, *tmplev2;
int cnt = 0; int cnt = 0;
for (tmplev = sp_levchn; tmplev; tmplev = tmplev->next) for (tmplev = g.sp_levchn; tmplev; tmplev = tmplev->next)
cnt++; cnt++;
if (perform_bwrite(mode)) if (perform_bwrite(mode))
bwrite(fd, (genericptr_t) &cnt, sizeof(int)); bwrite(fd, (genericptr_t) &cnt, sizeof(int));
for (tmplev = sp_levchn; tmplev; tmplev = tmplev2) { for (tmplev = g.sp_levchn; tmplev; tmplev = tmplev2) {
tmplev2 = tmplev->next; tmplev2 = tmplev->next;
if (perform_bwrite(mode)) if (perform_bwrite(mode))
bwrite(fd, (genericptr_t) tmplev, sizeof(s_level)); bwrite(fd, (genericptr_t) tmplev, sizeof(s_level));
@@ -911,7 +911,7 @@ register int fd, mode;
free((genericptr_t) tmplev); free((genericptr_t) tmplev);
} }
if (release_data(mode)) if (release_data(mode))
sp_levchn = 0; g.sp_levchn = 0;
} }
/* used when saving a level and also when saving dungeon overview data */ /* used when saving a level and also when saving dungeon overview data */
@@ -1193,7 +1193,7 @@ int fd, mode;
static struct fruit zerofruit; static struct fruit zerofruit;
register struct fruit *f2, *f1; register struct fruit *f2, *f1;
f1 = ffruit; f1 = g.ffruit;
while (f1) { while (f1) {
f2 = f1->nextf; f2 = f1->nextf;
if (f1->fid >= 0 && perform_bwrite(mode)) if (f1->fid >= 0 && perform_bwrite(mode))
@@ -1205,7 +1205,7 @@ int fd, mode;
if (perform_bwrite(mode)) if (perform_bwrite(mode))
bwrite(fd, (genericptr_t) &zerofruit, sizeof zerofruit); bwrite(fd, (genericptr_t) &zerofruit, sizeof zerofruit);
if (release_data(mode)) if (release_data(mode))
ffruit = 0; g.ffruit = 0;
} }
void void
@@ -1217,7 +1217,7 @@ int fd;
bufoff(fd); bufoff(fd);
/* bwrite() before bufon() uses plain write() */ /* bwrite() before bufon() uses plain write() */
bwrite(fd, (genericptr_t) &plsiztmp, sizeof(plsiztmp)); bwrite(fd, (genericptr_t) &plsiztmp, sizeof(plsiztmp));
bwrite(fd, (genericptr_t) plname, plsiztmp); bwrite(fd, (genericptr_t) g.plname, plsiztmp);
bufon(fd); bufon(fd);
return; return;
} }
+17 -17
View File
@@ -255,7 +255,7 @@ boolean ghostly;
/* savebones guarantees that non-homed shk's will be gone */ /* savebones guarantees that non-homed shk's will be gone */
if (ghostly) { if (ghostly) {
assign_level(&eshkp->shoplevel, &u.uz); assign_level(&eshkp->shoplevel, &u.uz);
if (ANGRY(shkp) && strncmpi(eshkp->customer, plname, PL_NSIZ)) if (ANGRY(shkp) && strncmpi(eshkp->customer, g.plname, PL_NSIZ))
pacify_shk(shkp); pacify_shk(shkp);
} }
} }
@@ -432,7 +432,7 @@ boolean newlev;
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize(NOTANGRY(shkp) ? "%s! Please pay before leaving." verbalize(NOTANGRY(shkp) ? "%s! Please pay before leaving."
: "%s! Don't you leave without paying!", : "%s! Don't you leave without paying!",
plname); g.plname);
else else
pline("%s %s that you need to pay before leaving%s", pline("%s %s that you need to pay before leaving%s",
Shknam(shkp), Shknam(shkp),
@@ -568,11 +568,11 @@ char *enterstring;
eshkp->bill_p = &(eshkp->bill[0]); eshkp->bill_p = &(eshkp->bill[0]);
if ((!eshkp->visitct || *eshkp->customer) if ((!eshkp->visitct || *eshkp->customer)
&& strncmpi(eshkp->customer, plname, PL_NSIZ)) { && strncmpi(eshkp->customer, g.plname, PL_NSIZ)) {
/* You seem to be new here */ /* You seem to be new here */
eshkp->visitct = 0; eshkp->visitct = 0;
eshkp->following = 0; eshkp->following = 0;
(void) strncpy(eshkp->customer, plname, PL_NSIZ); (void) strncpy(eshkp->customer, g.plname, PL_NSIZ);
pacify_shk(shkp); pacify_shk(shkp);
} }
@@ -593,7 +593,7 @@ char *enterstring;
if (ANGRY(shkp)) { if (ANGRY(shkp)) {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("So, %s, you dare return to %s %s?!", plname, verbalize("So, %s, you dare return to %s %s?!", g.plname,
s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name); s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name);
else else
pline("%s seems %s over your return to %s %s!", pline("%s seems %s over your return to %s %s!",
@@ -608,7 +608,7 @@ char *enterstring;
Shknam(shkp), noit_mhis(shkp)); Shknam(shkp), noit_mhis(shkp));
} else { } else {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("%s, %s! Welcome%s to %s %s!", Hello(shkp), plname, verbalize("%s, %s! Welcome%s to %s %s!", Hello(shkp), g.plname,
eshkp->visitct++ ? " again" : "", eshkp->visitct++ ? " again" : "",
s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name); s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name);
else else
@@ -1159,7 +1159,7 @@ register struct monst *shkp;
return; return;
rile_shk(shkp); rile_shk(shkp);
(void) strncpy(ESHK(shkp)->customer, plname, PL_NSIZ); (void) strncpy(ESHK(shkp)->customer, g.plname, PL_NSIZ);
ESHK(shkp)->following = 1; ESHK(shkp)->following = 1;
} }
@@ -1398,7 +1398,7 @@ proceed:
: shkname(shkp), : shkname(shkp),
noit_mhim(shkp)); noit_mhim(shkp));
pay(1000L, shkp); pay(1000L, shkp);
if (strncmp(eshkp->customer, plname, PL_NSIZ) || rn2(3)) if (strncmp(eshkp->customer, g.plname, PL_NSIZ) || rn2(3))
make_happy_shk(shkp, FALSE); make_happy_shk(shkp, FALSE);
else else
pline("But %s is as angry as ever.", shkname(shkp)); pline("But %s is as angry as ever.", shkname(shkp));
@@ -1835,7 +1835,7 @@ int croaked;
context.botl = 1; 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, plname, PL_NSIZ) ? "" : "you ", strncmp(eshkp->customer, g.plname, PL_NSIZ) ? "" : "you ",
noit_mhim(shkp)); noit_mhim(shkp));
/* shopkeeper has now been paid in full */ /* shopkeeper has now been paid in full */
pacify_shk(shkp); pacify_shk(shkp);
@@ -2885,7 +2885,7 @@ boolean peaceful, silent;
if (!silent) { if (!silent) {
if (canseemon(shkp)) { if (canseemon(shkp)) {
Norep("%s booms: \"%s, you are a thief!\"", Norep("%s booms: \"%s, you are a thief!\"",
Shknam(shkp), plname); Shknam(shkp), g.plname);
} else } else
Norep("You hear a scream, \"Thief!\""); Norep("You hear a scream, \"Thief!\"");
} }
@@ -3685,17 +3685,17 @@ struct monst *shkp;
return 0; return 0;
} }
if (eshkp->following) { if (eshkp->following) {
if (strncmp(eshkp->customer, plname, PL_NSIZ)) { if (strncmp(eshkp->customer, g.plname, PL_NSIZ)) {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("%s, %s! I was looking for %s.", Hello(shkp), verbalize("%s, %s! I was looking for %s.", Hello(shkp),
plname, eshkp->customer); g.plname, eshkp->customer);
eshkp->following = 0; eshkp->following = 0;
return 0; return 0;
} }
if (moves > followmsg + 4) { if (moves > followmsg + 4) {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("%s, %s! Didn't you forget to pay?", verbalize("%s, %s! Didn't you forget to pay?",
Hello(shkp), plname); Hello(shkp), g.plname);
else else
pline("%s holds out %s upturned %s.", pline("%s holds out %s upturned %s.",
Shknam(shkp), noit_mhis(shkp), Shknam(shkp), noit_mhis(shkp),
@@ -3985,7 +3985,7 @@ boolean cant_mollify;
y = appear_here->place.y; y = appear_here->place.y;
/* not the best introduction to the shk... */ /* not the best introduction to the shk... */
(void) strncpy(ESHK(shkp)->customer, plname, PL_NSIZ); (void) strncpy(ESHK(shkp)->customer, g.plname, PL_NSIZ);
/* if the shk is already on the war path, be sure it's all out */ /* if the shk is already on the war path, be sure it's all out */
if (ANGRY(shkp) || ESHK(shkp)->following) { if (ANGRY(shkp) || ESHK(shkp)->following) {
@@ -4272,15 +4272,15 @@ struct monst *shkp;
(!Deaf && !muteshk(shkp)) ? "mentions" : "indicates", (!Deaf && !muteshk(shkp)) ? "mentions" : "indicates",
noit_mhe(shkp), eshk->robbed ? "non-paying" : "rude"); noit_mhe(shkp), eshk->robbed ? "non-paying" : "rude");
} else if (eshk->following) { } else if (eshk->following) {
if (strncmp(eshk->customer, plname, PL_NSIZ)) { if (strncmp(eshk->customer, g.plname, PL_NSIZ)) {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("%s %s! I was looking for %s.", verbalize("%s %s! I was looking for %s.",
Hello(shkp), plname, eshk->customer); Hello(shkp), g.plname, eshk->customer);
eshk->following = 0; eshk->following = 0;
} else { } else {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("%s %s! Didn't you forget to pay?", verbalize("%s %s! Didn't you forget to pay?",
Hello(shkp), plname); Hello(shkp), g.plname);
else else
pline("%s taps you on the %s.", pline("%s taps you on the %s.",
Shknam(shkp), body_part(ARM)); Shknam(shkp), body_part(ARM));
+1 -1
View File
@@ -636,7 +636,7 @@ struct mkroom *sroom;
pline("Where is shopdoor?"); pline("Where is shopdoor?");
pline("Room at (%d,%d),(%d,%d).", sroom->lx, sroom->ly, sroom->hx, pline("Room at (%d,%d),(%d,%d).", sroom->lx, sroom->ly, sroom->hx,
sroom->hy); sroom->hy);
pline("doormax=%d doorct=%d fdoor=%d", doorindex, sroom->doorct, pline("doormax=%d doorct=%d fdoor=%d", g.doorindex, sroom->doorct,
sh); sh);
while (j--) { while (j--) {
pline("door [%d,%d]", doors[sh].x, doors[sh].y); pline("door [%d,%d]", doors[sh].x, doors[sh].y);
+2 -2
View File
@@ -505,7 +505,7 @@ register struct monst *mtmp;
return 0; return 0;
/* leader might be poly'd; if he can still speak, give leader speech */ /* leader might be poly'd; if he can still speak, give leader speech */
if (mtmp->m_id == quest_status.leader_m_id && msound > MS_ANIMAL) if (mtmp->m_id == g.quest_status.leader_m_id && msound > MS_ANIMAL)
msound = MS_LEADER; msound = MS_LEADER;
/* make sure it's your role's quest guardian; adjust if not */ /* make sure it's your role's quest guardian; adjust if not */
else if (msound == MS_GUARDIAN && ptr != &mons[urole.guardnum]) else if (msound == MS_GUARDIAN && ptr != &mons[urole.guardnum])
@@ -720,7 +720,7 @@ register struct monst *mtmp;
You("freeze for a moment."); You("freeze for a moment.");
nomul(-2); nomul(-2);
g.multi_reason = "scared by rattling"; g.multi_reason = "scared by rattling";
nomovemsg = 0; g.nomovemsg = 0;
break; break;
case MS_LAUGH: { case MS_LAUGH: {
static const char *const laugh_msg[4] = { static const char *const laugh_msg[4] = {
+3 -3
View File
@@ -748,7 +748,7 @@ maybe_add_door(x, y, droom)
int x, y; int x, y;
struct mkroom *droom; struct mkroom *droom;
{ {
if (droom->hx >= 0 && doorindex < DOORMAX && inside_room(droom, x, y)) if (droom->hx >= 0 && g.doorindex < DOORMAX && inside_room(droom, x, y))
add_door(x, y, droom); add_door(x, y, droom);
} }
@@ -1260,7 +1260,7 @@ xchar rtype, rlit;
split_rects(r1, &r2); split_rects(r1, &r2);
if (!vault) { if (!vault) {
smeq[g.nroom] = g.nroom; g.smeq[g.nroom] = g.nroom;
add_room(xabs, yabs, xabs + wtmp - 1, yabs + htmp - 1, rlit, rtype, add_room(xabs, yabs, xabs + wtmp - 1, yabs + htmp - 1, rlit, rtype,
FALSE); FALSE);
} else { } else {
@@ -4650,7 +4650,7 @@ struct sp_coder *coder;
if (irregular) { if (irregular) {
g.min_rx = g.max_rx = dx1; g.min_rx = g.max_rx = dx1;
g.min_ry = g.max_ry = dy1; g.min_ry = g.max_ry = dy1;
smeq[g.nroom] = g.nroom; g.smeq[g.nroom] = g.nroom;
flood_fill_rm(dx1, dy1, g.nroom + ROOMOFFSET, OV_i(rlit), TRUE); flood_fill_rm(dx1, dy1, g.nroom + ROOMOFFSET, OV_i(rlit), TRUE);
add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OV_i(rtype), add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OV_i(rtype),
TRUE); TRUE);
+3 -3
View File
@@ -354,7 +354,7 @@ learn(VOID_ARGS)
context.spbook.o_id = 0; context.spbook.o_id = 0;
nomul(context.spbook.delay); /* remaining delay is uninterrupted */ nomul(context.spbook.delay); /* remaining delay is uninterrupted */
g.multi_reason = "reading a book"; g.multi_reason = "reading a book";
nomovemsg = 0; g.nomovemsg = 0;
context.spbook.delay = 0; context.spbook.delay = 0;
return 0; return 0;
} }
@@ -557,7 +557,7 @@ register struct obj *spellbook;
nomul(context.spbook.delay); /* study time */ nomul(context.spbook.delay); /* study time */
g.multi_reason = "reading a book"; g.multi_reason = "reading a book";
nomovemsg = 0; g.nomovemsg = 0;
context.spbook.delay = 0; context.spbook.delay = 0;
if (gone || !rn2(3)) { if (gone || !rn2(3)) {
if (!gone) if (!gone)
@@ -575,7 +575,7 @@ register struct obj *spellbook;
} }
nomul(context.spbook.delay); nomul(context.spbook.delay);
g.multi_reason = "reading a book"; g.multi_reason = "reading a book";
nomovemsg = 0; g.nomovemsg = 0;
context.spbook.delay = 0; context.spbook.delay = 0;
return 1; return 1;
} }
+1 -1
View File
@@ -424,7 +424,7 @@ gotobj:
/* the following is to set multi for later on */ /* the following is to set multi for later on */
nomul(-armordelay); nomul(-armordelay);
g.multi_reason = "taking off clothes"; g.multi_reason = "taking off clothes";
nomovemsg = 0; g.nomovemsg = 0;
remove_worn_item(otmp, TRUE); remove_worn_item(otmp, TRUE);
otmp->cursed = curssv; otmp->cursed = curssv;
if (g.multi < 0) { if (g.multi < 0) {
+2 -2
View File
@@ -350,7 +350,7 @@ boolean force; /* Quietly force this animal */
} }
/* setuwep handles polearms differently when you're mounted */ /* setuwep handles polearms differently when you're mounted */
if (uwep && is_pole(uwep)) if (uwep && is_pole(uwep))
unweapon = FALSE; g.unweapon = FALSE;
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);
@@ -683,7 +683,7 @@ int reason; /* Player was thrown off etc. */
context.botl = TRUE; 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))
unweapon = TRUE; g.unweapon = TRUE;
return; return;
} }
+53 -53
View File
@@ -201,30 +201,30 @@ int x1, y1, x2, y2;
{ {
if (!isok(x2, y2)) if (!isok(x2, y2))
return FALSE; return FALSE;
if (dndest.nlx > 0) { if (g.dndest.nlx > 0) {
/* if inside a restricted region, can't teleport outside */ /* if inside a restricted region, can't teleport outside */
if (within_bounded_area(x1, y1, dndest.nlx, dndest.nly, dndest.nhx, if (within_bounded_area(x1, y1, g.dndest.nlx, g.dndest.nly, g.dndest.nhx,
dndest.nhy) g.dndest.nhy)
&& !within_bounded_area(x2, y2, dndest.nlx, dndest.nly, && !within_bounded_area(x2, y2, g.dndest.nlx, g.dndest.nly,
dndest.nhx, dndest.nhy)) g.dndest.nhx, g.dndest.nhy))
return FALSE; return FALSE;
/* and if outside, can't teleport inside */ /* and if outside, can't teleport inside */
if (!within_bounded_area(x1, y1, dndest.nlx, dndest.nly, dndest.nhx, if (!within_bounded_area(x1, y1, g.dndest.nlx, g.dndest.nly, g.dndest.nhx,
dndest.nhy) g.dndest.nhy)
&& within_bounded_area(x2, y2, dndest.nlx, dndest.nly, dndest.nhx, && within_bounded_area(x2, y2, g.dndest.nlx, g.dndest.nly, g.dndest.nhx,
dndest.nhy)) g.dndest.nhy))
return FALSE; return FALSE;
} }
if (updest.nlx > 0) { /* ditto */ if (g.updest.nlx > 0) { /* ditto */
if (within_bounded_area(x1, y1, updest.nlx, updest.nly, updest.nhx, if (within_bounded_area(x1, y1, g.updest.nlx, g.updest.nly, g.updest.nhx,
updest.nhy) g.updest.nhy)
&& !within_bounded_area(x2, y2, updest.nlx, updest.nly, && !within_bounded_area(x2, y2, g.updest.nlx, g.updest.nly,
updest.nhx, updest.nhy)) g.updest.nhx, g.updest.nhy))
return FALSE; return FALSE;
if (!within_bounded_area(x1, y1, updest.nlx, updest.nly, updest.nhx, if (!within_bounded_area(x1, y1, g.updest.nlx, g.updest.nly, g.updest.nhx,
updest.nhy) g.updest.nhy)
&& within_bounded_area(x2, y2, updest.nlx, updest.nly, updest.nhx, && within_bounded_area(x2, y2, g.updest.nlx, g.updest.nly, g.updest.nhx,
updest.nhy)) g.updest.nhy))
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@@ -725,7 +725,7 @@ level_tele()
* we let negative values requests fall into the "heaven" loop. * we let negative values requests fall into the "heaven" loop.
*/ */
if (In_quest(&u.uz) && newlev > 0) if (In_quest(&u.uz) && newlev > 0)
newlev = newlev + dungeons[u.uz.dnum].depth_start - 1; newlev = newlev + g.dungeons[u.uz.dnum].depth_start - 1;
} else { /* involuntary level tele */ } else { /* involuntary level tele */
random_levtport: random_levtport:
newlev = random_teleport_level(); newlev = random_teleport_level();
@@ -762,11 +762,11 @@ level_tele()
if (newlev < 0 && !force_dest) { if (newlev < 0 && !force_dest) {
if (*u.ushops0) { if (*u.ushops0) {
/* take unpaid inventory items off of shop bills */ /* take unpaid inventory items off of shop bills */
in_mklev = TRUE; /* suppress map update */ g.in_mklev = TRUE; /* suppress map update */
u_left_shop(u.ushops0, TRUE); u_left_shop(u.ushops0, TRUE);
/* you're now effectively out of the shop */ /* you're now effectively out of the shop */
*u.ushops0 = *u.ushops = '\0'; *u.ushops0 = *u.ushops = '\0';
in_mklev = FALSE; g.in_mklev = FALSE;
} }
if (newlev <= -10) { if (newlev <= -10) {
You("arrive in heaven."); You("arrive in heaven.");
@@ -819,7 +819,7 @@ level_tele()
teleport out of the dungeon and float or fly down to the teleport out of the dungeon and float or fly down to the
surface but then actually arrive back inside the dungeon] */ surface but then actually arrive back inside the dungeon] */
} else if (u.uz.dnum == medusa_level.dnum } else if (u.uz.dnum == medusa_level.dnum
&& newlev >= dungeons[u.uz.dnum].depth_start && newlev >= g.dungeons[u.uz.dnum].depth_start
+ dunlevs_in_dungeon(&u.uz)) { + dunlevs_in_dungeon(&u.uz)) {
if (!(wizard && force_dest)) if (!(wizard && force_dest))
find_hell(&newlevel); find_hell(&newlevel);
@@ -828,9 +828,9 @@ level_tele()
* the last level of Gehennom is forbidden. * the last level of Gehennom is forbidden.
*/ */
if (!wizard && Inhell && !u.uevent.invoked if (!wizard && Inhell && !u.uevent.invoked
&& newlev >= (dungeons[u.uz.dnum].depth_start && newlev >= (g.dungeons[u.uz.dnum].depth_start
+ dunlevs_in_dungeon(&u.uz) - 1)) { + dunlevs_in_dungeon(&u.uz) - 1)) {
newlev = dungeons[u.uz.dnum].depth_start newlev = g.dungeons[u.uz.dnum].depth_start
+ dunlevs_in_dungeon(&u.uz) - 2; + dunlevs_in_dungeon(&u.uz) - 2;
pline("Sorry..."); pline("Sorry...");
} }
@@ -957,23 +957,23 @@ struct monst *mtmp;
yy = mtmp->my; yy = mtmp->my;
if (!xx) { if (!xx) {
/* no current location (migrating monster arrival) */ /* no current location (migrating monster arrival) */
if (dndest.nlx && On_W_tower_level(&u.uz)) if (g.dndest.nlx && On_W_tower_level(&u.uz))
return (((yy & 2) != 0) return (((yy & 2) != 0)
/* inside xor not within */ /* inside xor not within */
^ !within_bounded_area(x, y, dndest.nlx, dndest.nly, ^ !within_bounded_area(x, y, g.dndest.nlx, g.dndest.nly,
dndest.nhx, dndest.nhy)); g.dndest.nhx, g.dndest.nhy));
if (updest.lx && (yy & 1) != 0) /* moving up */ if (g.updest.lx && (yy & 1) != 0) /* moving up */
return (within_bounded_area(x, y, updest.lx, updest.ly, return (within_bounded_area(x, y, g.updest.lx, g.updest.ly,
updest.hx, updest.hy) g.updest.hx, g.updest.hy)
&& (!updest.nlx && (!g.updest.nlx
|| !within_bounded_area(x, y, updest.nlx, updest.nly, || !within_bounded_area(x, y, g.updest.nlx, g.updest.nly,
updest.nhx, updest.nhy))); g.updest.nhx, g.updest.nhy)));
if (dndest.lx && (yy & 1) == 0) /* moving down */ if (g.dndest.lx && (yy & 1) == 0) /* moving down */
return (within_bounded_area(x, y, dndest.lx, dndest.ly, return (within_bounded_area(x, y, g.dndest.lx, g.dndest.ly,
dndest.hx, dndest.hy) g.dndest.hx, g.dndest.hy)
&& (!dndest.nlx && (!g.dndest.nlx
|| !within_bounded_area(x, y, dndest.nlx, dndest.nly, || !within_bounded_area(x, y, g.dndest.nlx, g.dndest.nly,
dndest.nhx, dndest.nhy))); g.dndest.nhx, g.dndest.nhy)));
} else { } else {
/* [try to] prevent a shopkeeper or temple priest from being /* [try to] prevent a shopkeeper or temple priest from being
sent out of his room (caller might resort to goodpos() if sent out of his room (caller might resort to goodpos() if
@@ -1262,7 +1262,7 @@ register struct obj *obj;
obj_extract_self(obj); obj_extract_self(obj);
otx = obj->ox; otx = obj->ox;
oty = obj->oy; oty = obj->oy;
restricted_fall = (otx == 0 && dndest.lx); restricted_fall = (otx == 0 && g.dndest.lx);
do { do {
tx = rn1(COLNO - 3, 2); tx = rn1(COLNO - 3, 2);
ty = rn2(ROWNO); ty = rn2(ROWNO);
@@ -1270,19 +1270,19 @@ register struct obj *obj;
break; break;
} while (!goodpos(tx, ty, (struct monst *) 0, 0) } while (!goodpos(tx, ty, (struct monst *) 0, 0)
|| (restricted_fall || (restricted_fall
&& (!within_bounded_area(tx, ty, dndest.lx, dndest.ly, && (!within_bounded_area(tx, ty, g.dndest.lx, g.dndest.ly,
dndest.hx, dndest.hy) g.dndest.hx, g.dndest.hy)
|| (dndest.nlx || (g.dndest.nlx
&& within_bounded_area(tx, ty, && within_bounded_area(tx, ty,
dndest.nlx, dndest.nly, g.dndest.nlx, g.dndest.nly,
dndest.nhx, dndest.nhy)))) g.dndest.nhx, g.dndest.nhy))))
/* on the Wizard Tower levels, objects inside should /* on the Wizard Tower levels, objects inside should
stay inside and objects outside should stay outside */ stay inside and objects outside should stay outside */
|| (dndest.nlx && On_W_tower_level(&u.uz) || (g.dndest.nlx && On_W_tower_level(&u.uz)
&& within_bounded_area(tx, ty, dndest.nlx, dndest.nly, && within_bounded_area(tx, ty, g.dndest.nlx, g.dndest.nly,
dndest.nhx, dndest.nhy) g.dndest.nhx, g.dndest.nhy)
!= within_bounded_area(otx, oty, dndest.nlx, dndest.nly, != within_bounded_area(otx, oty, g.dndest.nlx, g.dndest.nly,
dndest.nhx, dndest.nhy))); g.dndest.nhx, g.dndest.nhy)));
if (flooreffects(obj, tx, ty, "fall")) { if (flooreffects(obj, tx, ty, "fall")) {
return FALSE; return FALSE;
@@ -1342,12 +1342,12 @@ random_teleport_level()
no one can randomly teleport past it */ no one can randomly teleport past it */
if (dunlev_reached(&u.uz) < qlocate_depth) if (dunlev_reached(&u.uz) < qlocate_depth)
bottom = qlocate_depth; bottom = qlocate_depth;
min_depth = dungeons[u.uz.dnum].depth_start; min_depth = g.dungeons[u.uz.dnum].depth_start;
max_depth = bottom + (dungeons[u.uz.dnum].depth_start - 1); max_depth = bottom + (g.dungeons[u.uz.dnum].depth_start - 1);
} else { } else {
min_depth = 1; min_depth = 1;
max_depth = max_depth =
dunlevs_in_dungeon(&u.uz) + (dungeons[u.uz.dnum].depth_start - 1); dunlevs_in_dungeon(&u.uz) + (g.dungeons[u.uz.dnum].depth_start - 1);
/* can't reach Sanctum if the invocation hasn't been performed */ /* can't reach Sanctum if the invocation hasn't been performed */
if (Inhell && !u.uevent.invoked) if (Inhell && !u.uevent.invoked)
max_depth -= 1; max_depth -= 1;
+4 -4
View File
@@ -136,7 +136,7 @@ stoned_dialogue()
stop_occupation(); stop_occupation();
nomul(-3); /* can't move anymore */ nomul(-3); /* can't move anymore */
g.multi_reason = "getting stoned"; g.multi_reason = "getting stoned";
nomovemsg = You_can_move_again; /* not unconscious */ g.nomovemsg = You_can_move_again; /* not unconscious */
/* "your limbs have turned to stone" so terminate wounded legs */ /* "your limbs have turned to stone" so terminate wounded legs */
if (Wounded_legs && !u.usteed) if (Wounded_legs && !u.usteed)
heal_legs(2); heal_legs(2);
@@ -676,7 +676,7 @@ nh_timeout()
slip_or_trip(); slip_or_trip();
nomul(-2); nomul(-2);
g.multi_reason = "fumbling"; g.multi_reason = "fumbling";
nomovemsg = ""; g.nomovemsg = "";
/* The more you are carrying the more likely you /* The more you are carrying the more likely you
* are to make noise when you fumble. Adjustments * are to make noise when you fumble. Adjustments
* to this number must be thoroughly play tested. * to this number must be thoroughly play tested.
@@ -719,7 +719,7 @@ boolean wakeup_msg;
} }
/* early wakeup from combat won't be possible until next monster turn */ /* early wakeup from combat won't be possible until next monster turn */
u.usleep = monstermoves; u.usleep = monstermoves;
nomovemsg = wakeup_msg ? "You wake up." : You_can_move_again; g.nomovemsg = wakeup_msg ? "You wake up." : You_can_move_again;
} }
/* Attach an egg hatch timeout to the given egg. /* Attach an egg hatch timeout to the given egg.
@@ -1584,7 +1584,7 @@ do_storms()
stop_occupation(); stop_occupation();
nomul(-3); nomul(-3);
g.multi_reason = "hiding from thunderstorm"; g.multi_reason = "hiding from thunderstorm";
nomovemsg = 0; g.nomovemsg = 0;
} }
} else } else
You_hear("a rumbling noise."); You_hear("a rumbling noise.");
+5 -5
View File
@@ -333,7 +333,7 @@ struct toptenentry *tt;
#ifdef XLOGFILE #ifdef XLOGFILE
/* as tab is never used in eg. plname or death, no need to mangle those. */ /* as tab is never used in eg. g.plname or death, no need to mangle those. */
STATIC_OVL void STATIC_OVL void
writexlentry(rfile, tt, how) writexlentry(rfile, tt, how)
FILE *rfile; FILE *rfile;
@@ -361,7 +361,7 @@ int how;
formatkiller(tmpbuf, sizeof tmpbuf, how, FALSE); formatkiller(tmpbuf, sizeof tmpbuf, how, FALSE);
Fprintf(rfile, "%s%cname=%s%cdeath=%s", Fprintf(rfile, "%s%cname=%s%cdeath=%s",
buf, /* (already includes separator) */ buf, /* (already includes separator) */
XLOG_SEP, plname, XLOG_SEP, tmpbuf); XLOG_SEP, g.plname, XLOG_SEP, tmpbuf);
if (g.multi) if (g.multi)
Fprintf(rfile, "%cwhile=%s", XLOG_SEP, Fprintf(rfile, "%cwhile=%s", XLOG_SEP,
g.multi_reason ? g.multi_reason : "helpless"); g.multi_reason ? g.multi_reason : "helpless");
@@ -551,7 +551,7 @@ time_t when;
copynchars(t0->plrace, urace.filecode, ROLESZ); copynchars(t0->plrace, urace.filecode, ROLESZ);
copynchars(t0->plgend, genders[flags.female].filecode, ROLESZ); copynchars(t0->plgend, genders[flags.female].filecode, ROLESZ);
copynchars(t0->plalign, aligns[1 - u.ualign.type].filecode, ROLESZ); copynchars(t0->plalign, aligns[1 - u.ualign.type].filecode, ROLESZ);
copynchars(t0->name, plname, NAMSZ); copynchars(t0->name, g.plname, NAMSZ);
formatkiller(t0->death, sizeof t0->death, how, TRUE); formatkiller(t0->death, sizeof t0->death, how, TRUE);
t0->birthdate = yyyymmdd(ubirthday); t0->birthdate = yyyymmdd(ubirthday);
t0->deathdate = yyyymmdd(when); t0->deathdate = yyyymmdd(when);
@@ -880,7 +880,7 @@ boolean so;
} }
Sprintf(eos(linebuf), fmt, arg); Sprintf(eos(linebuf), fmt, arg);
} else { } else {
Sprintf(eos(linebuf), " in %s", dungeons[t1->deathdnum].dname); Sprintf(eos(linebuf), " in %s", g.dungeons[t1->deathdnum].dname);
if (t1->deathdnum != knox_level.dnum) if (t1->deathdnum != knox_level.dnum)
Sprintf(eos(linebuf), " on level %d", t1->deathlev); Sprintf(eos(linebuf), " on level %d", t1->deathlev);
if (t1->deathlev != t1->maxlvl) if (t1->deathlev != t1->maxlvl)
@@ -1061,7 +1061,7 @@ char **argv;
playerct = 0; playerct = 0;
players = (const char **) 0; players = (const char **) 0;
} else { } else {
player0 = plname; player0 = g.plname;
if (!*player0) if (!*player0)
#ifdef AMIGA #ifdef AMIGA
player0 = "all"; /* single user system */ player0 = "all"; /* single user system */
+8 -8
View File
@@ -2642,7 +2642,7 @@ register struct monst *mtmp;
trapkilled = TRUE; trapkilled = TRUE;
if (unconscious()) { if (unconscious()) {
g.multi = -1; g.multi = -1;
nomovemsg = "The explosion awakens you!"; g.nomovemsg = "The explosion awakens you!";
} }
break; break;
case POLY_TRAP: case POLY_TRAP:
@@ -2750,7 +2750,7 @@ boolean byplayer;
if (cansee(mon->mx, mon->my)) if (cansee(mon->mx, mon->my))
pline("%s turns to stone.", Monnam(mon)); pline("%s turns to stone.", Monnam(mon));
if (byplayer) { if (byplayer) {
stoned = TRUE; g.stoned = TRUE;
xkilled(mon, XKILL_NOMSG); xkilled(mon, XKILL_NOMSG);
} else } else
monstone(mon); monstone(mon);
@@ -4905,7 +4905,7 @@ boolean disarm;
nomul(-d(5, 6)); nomul(-d(5, 6));
g.multi_reason = "frozen by a trap"; g.multi_reason = "frozen by a trap";
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
} else } else
You("momentarily stiffen."); You("momentarily stiffen.");
break; break;
@@ -5197,10 +5197,10 @@ unconscious()
return FALSE; return FALSE;
return (boolean) (u.usleep return (boolean) (u.usleep
|| (nomovemsg || (g.nomovemsg
&& (!strncmp(nomovemsg, "You awake", 9) && (!strncmp(g.nomovemsg, "You awake", 9)
|| !strncmp(nomovemsg, "You regain con", 14) || !strncmp(g.nomovemsg, "You regain con", 14)
|| !strncmp(nomovemsg, "You are consci", 14)))); || !strncmp(g.nomovemsg, "You are consci", 14))));
} }
static const char lava_killer[] = "molten lava"; static const char lava_killer[] = "molten lava";
@@ -5395,7 +5395,7 @@ maybe_finish_sokoban()
{ {
struct trap *t; struct trap *t;
if (Sokoban && !in_mklev) { if (Sokoban && !g.in_mklev) {
/* scan all remaining traps, ignoring any created by the hero; /* scan all remaining traps, ignoring any created by the hero;
if this level has no more pits or holes, the current sokoban if this level has no more pits or holes, the current sokoban
puzzle has been solved */ puzzle has been solved */
+10 -10
View File
@@ -405,8 +405,8 @@ register struct monst *mtmp;
if (u.twoweap && !can_twoweapon()) if (u.twoweap && !can_twoweapon())
untwoweapon(); untwoweapon();
if (unweapon) { if (g.unweapon) {
unweapon = FALSE; g.unweapon = FALSE;
if (flags.verbose) { if (flags.verbose) {
if (uwep) if (uwep)
You("begin bashing monsters with %s.", yname(uwep)); You("begin bashing monsters with %s.", yname(uwep));
@@ -752,7 +752,7 @@ int dieroll;
mon_nam(mon), more_than_1 ? "one of " : "", mon_nam(mon), more_than_1 ? "one of " : "",
yname(obj)); yname(obj));
if (!more_than_1) if (!more_than_1)
uwepgone(); /* set unweapon */ uwepgone(); /* set g.unweapon */
useup(obj); useup(obj);
if (!more_than_1) if (!more_than_1)
obj = (struct obj *) 0; obj = (struct obj *) 0;
@@ -934,7 +934,7 @@ int dieroll;
/* egg is always either used up or transformed, so next /* egg is always either used up or transformed, so next
hand-to-hand attack should yield a "bashing" mesg */ hand-to-hand attack should yield a "bashing" mesg */
if (obj == uwep) if (obj == uwep)
unweapon = TRUE; g.unweapon = TRUE;
if (obj->spe && obj->corpsenm >= LOW_PM) { if (obj->spe && obj->corpsenm >= LOW_PM) {
if (obj->quan < 5L) if (obj->quan < 5L)
change_luck((schar) - (obj->quan)); change_luck((schar) - (obj->quan));
@@ -1162,7 +1162,7 @@ int dieroll;
/* (must be either primary or secondary weapon to get here) */ /* (must be either primary or secondary weapon to get here) */
u.twoweap = FALSE; /* untwoweapon() is too verbose here */ u.twoweap = FALSE; /* untwoweapon() is too verbose here */
if (obj == uwep) if (obj == uwep)
uwepgone(); /* set unweapon */ uwepgone(); /* set g.unweapon */
/* minor side-effect: broken lance won't split puddings */ /* minor side-effect: broken lance won't split puddings */
useup(obj); useup(obj);
obj = 0; obj = 0;
@@ -1234,7 +1234,7 @@ int dieroll;
if (!hittxt /*( thrown => obj exists )*/ if (!hittxt /*( thrown => obj exists )*/
&& (!destroyed && (!destroyed
|| (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) { || (thrown && g.m_shot.n > 1 && g.m_shot.o == obj->otyp))) {
if (thrown) if (thrown)
hit(mshot_xname(obj), mon, exclam(tmp)); hit(mshot_xname(obj), mon, exclam(tmp));
else if (!flags.verbose) else if (!flags.verbose)
@@ -2037,7 +2037,7 @@ register struct attack *mattk;
#ifdef LINT /* static char msgbuf[BUFSZ]; */ #ifdef LINT /* static char msgbuf[BUFSZ]; */
char msgbuf[BUFSZ]; char msgbuf[BUFSZ];
#else #else
static char msgbuf[BUFSZ]; /* for nomovemsg */ static char msgbuf[BUFSZ]; /* for g.nomovemsg */
#endif #endif
register int tmp; register int tmp;
register int dam = d((int) mattk->damn, (int) mattk->damd); register int dam = d((int) mattk->damn, (int) mattk->damd);
@@ -2145,7 +2145,7 @@ register struct attack *mattk;
tmp *= 2; tmp *= 2;
nomul(-tmp); nomul(-tmp);
g.multi_reason = "digesting something"; g.multi_reason = "digesting something";
nomovemsg = msgbuf; g.nomovemsg = msgbuf;
} else } else
pline1(msgbuf); pline1(msgbuf);
if (pd == &mons[PM_GREEN_SLIME]) { if (pd == &mons[PM_GREEN_SLIME]) {
@@ -2647,7 +2647,7 @@ boolean wep_was_destroyed;
You("are frozen by %s gaze!", s_suffix(mon_nam(mon))); You("are frozen by %s gaze!", s_suffix(mon_nam(mon)));
nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127); nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127);
g.multi_reason = "frozen by a monster's gaze"; g.multi_reason = "frozen by a monster's gaze";
nomovemsg = 0; g.nomovemsg = 0;
} }
} else { } else {
pline("%s cannot defend itself.", pline("%s cannot defend itself.",
@@ -2659,7 +2659,7 @@ boolean wep_was_destroyed;
You("momentarily stiffen."); You("momentarily stiffen.");
} else { /* gelatinous cube */ } else { /* gelatinous cube */
You("are frozen by %s!", mon_nam(mon)); You("are frozen by %s!", mon_nam(mon));
nomovemsg = You_can_move_again; g.nomovemsg = You_can_move_again;
nomul(-tmp); nomul(-tmp);
g.multi_reason = "frozen by a monster"; g.multi_reason = "frozen by a monster";
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
+2 -2
View File
@@ -420,7 +420,7 @@ invault()
if (u.ualign.type == A_LAWFUL if (u.ualign.type == A_LAWFUL
/* ignore trailing text, in case player includes rank */ /* ignore trailing text, in case player includes rank */
&& strncmpi(buf, plname, (int) strlen(plname)) != 0) { && strncmpi(buf, g.plname, (int) strlen(g.plname)) != 0) {
adjalign(-1); /* Liar! */ adjalign(-1); /* Liar! */
} }
@@ -1060,7 +1060,7 @@ paygd()
gx = rooms[EGD(grd)->vroom].lx + rn2(2); gx = rooms[EGD(grd)->vroom].lx + rn2(2);
gy = rooms[EGD(grd)->vroom].ly + rn2(2); gy = rooms[EGD(grd)->vroom].ly + rn2(2);
Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.", Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.",
plname, mons[u.umonster].mname); g.plname, mons[u.umonster].mname);
make_grave(gx, gy, buf); make_grave(gx, gy, buf);
} }
for (coins = invent; coins; coins = nextcoins) { for (coins = invent; coins; coins = nextcoins) {
+1 -1
View File
@@ -520,7 +520,7 @@ int control;
int oldseenv; /* previous seenv value */ int oldseenv; /* previous seenv value */
vision_full_recalc = 0; /* reset flag */ vision_full_recalc = 0; /* reset flag */
if (in_mklev || !iflags.vision_inited) if (g.in_mklev || !iflags.vision_inited)
return; return;
/* /*
+2 -2
View File
@@ -832,7 +832,7 @@ boolean verbose;
/* if hero is wielding this towel, don't give "you begin bashing /* if hero is wielding this towel, don't give "you begin bashing
with your wet towel" message on next attack with it */ with your wet towel" message on next attack with it */
if (obj == uwep) if (obj == uwep)
unweapon = !is_wet_towel(obj); g.unweapon = !is_wet_towel(obj);
} }
/* decrease a towel's wetness */ /* decrease a towel's wetness */
@@ -861,7 +861,7 @@ boolean verbose;
/* if hero is wielding this towel and it is now dry, give "you begin /* if hero is wielding this towel and it is now dry, give "you begin
bashing with your towel" message on next attack with it */ bashing with your towel" message on next attack with it */
if (obj == uwep) if (obj == uwep)
unweapon = !is_wet_towel(obj); g.unweapon = !is_wet_towel(obj);
} }
/* copy the skill level name into the given buffer */ /* copy the skill level name into the given buffer */
+6 -6
View File
@@ -87,7 +87,7 @@ register struct obj *obj;
struct obj *olduwep = uwep; struct obj *olduwep = uwep;
if (obj == uwep) if (obj == uwep)
return; /* necessary to not set unweapon */ return; /* necessary to not set g.unweapon */
/* This message isn't printed in the caller because it happens /* This message isn't printed in the caller because it happens
* *whenever* Sunsword is unwielded, from whatever cause. * *whenever* Sunsword is unwielded, from whatever cause.
*/ */
@@ -106,12 +106,12 @@ register struct obj *obj;
* 3.2.2: Wielding arbitrary objects will give bashing message too. * 3.2.2: Wielding arbitrary objects will give bashing message too.
*/ */
if (obj) { if (obj) {
unweapon = (obj->oclass == WEAPON_CLASS) g.unweapon = (obj->oclass == WEAPON_CLASS)
? is_launcher(obj) || is_ammo(obj) || is_missile(obj) ? is_launcher(obj) || is_ammo(obj) || is_missile(obj)
|| (is_pole(obj) && !u.usteed) || (is_pole(obj) && !u.usteed)
: !is_weptool(obj) && !is_wet_towel(obj); : !is_weptool(obj) && !is_wet_towel(obj);
} else } else
unweapon = TRUE; /* for "bare hands" message */ g.unweapon = TRUE; /* for "bare hands" message */
} }
STATIC_OVL boolean STATIC_OVL boolean
@@ -275,7 +275,7 @@ dowield()
else if (wep == uwep) { else if (wep == uwep) {
You("are already wielding that!"); You("are already wielding that!");
if (is_weptool(wep) || is_wet_towel(wep)) if (is_weptool(wep) || is_wet_towel(wep))
unweapon = FALSE; /* [see setuwep()] */ g.unweapon = FALSE; /* [see setuwep()] */
return 0; return 0;
} else if (welded(uwep)) { } else if (welded(uwep)) {
weldmsg(uwep); weldmsg(uwep);
@@ -591,7 +591,7 @@ const char *verb; /* "rub",&c */
if (u.twoweap) if (u.twoweap)
untwoweapon(); untwoweapon();
if (obj->oclass != WEAPON_CLASS) if (obj->oclass != WEAPON_CLASS)
unweapon = TRUE; g.unweapon = TRUE;
return TRUE; return TRUE;
} }
@@ -685,7 +685,7 @@ uwepgone()
pline("%s shining.", Tobjnam(uwep, "stop")); pline("%s shining.", Tobjnam(uwep, "stop"));
} }
setworn((struct obj *) 0, W_WEP); setworn((struct obj *) 0, W_WEP);
unweapon = TRUE; g.unweapon = TRUE;
update_inventory(); update_inventory();
} }
} }
+2 -2
View File
@@ -1147,10 +1147,10 @@ char *buf;
Sprintf(tmpbuf, "%ld", uid); Sprintf(tmpbuf, "%ld", uid);
break; break;
case 'n': /* player name */ case 'n': /* player name */
Sprintf(tmpbuf, "%s", *plname ? plname : "unknown"); Sprintf(tmpbuf, "%s", *g.plname ? g.plname : "unknown");
break; break;
case 'N': /* first character of player name */ case 'N': /* first character of player name */
Sprintf(tmpbuf, "%c", *plname ? *plname : 'u'); Sprintf(tmpbuf, "%c", *g.plname ? *g.plname : 'u');
break; break;
} }
+3 -3
View File
@@ -347,9 +347,9 @@ xchar *sy;
} }
} }
if (!x && sstairs.sx) { if (!x && g.sstairs.sx) {
x = sstairs.sx; x = g.sstairs.sx;
y = sstairs.sy; y = g.sstairs.sy;
} }
if (x && y) { if (x && y) {
+7 -7
View File
@@ -247,7 +247,7 @@ int adjust; /* positive => increase speed, negative => decrease */
struct obj *obj; /* item to make known if effect can be seen */ struct obj *obj; /* item to make known if effect can be seen */
{ {
struct obj *otmp; struct obj *otmp;
boolean give_msg = !in_mklev, petrify = FALSE; boolean give_msg = !g.in_mklev, petrify = FALSE;
unsigned int oldspeed = mon->mspeed; unsigned int oldspeed = mon->mspeed;
switch (adjust) { switch (adjust) {
@@ -339,11 +339,11 @@ boolean on, silently;
mon->minvis = !mon->invis_blkd; mon->minvis = !mon->invis_blkd;
break; break;
case FAST: { case FAST: {
boolean save_in_mklev = in_mklev; boolean save_in_mklev = g.in_mklev;
if (silently) if (silently)
in_mklev = TRUE; g.in_mklev = TRUE;
mon_adjust_speed(mon, 0, obj); mon_adjust_speed(mon, 0, obj);
in_mklev = save_in_mklev; g.in_mklev = save_in_mklev;
break; break;
} }
/* properties handled elsewhere */ /* properties handled elsewhere */
@@ -379,11 +379,11 @@ boolean on, silently;
mon->minvis = mon->perminvis; mon->minvis = mon->perminvis;
break; break;
case FAST: { case FAST: {
boolean save_in_mklev = in_mklev; boolean save_in_mklev = g.in_mklev;
if (silently) if (silently)
in_mklev = TRUE; g.in_mklev = TRUE;
mon_adjust_speed(mon, 0, obj); mon_adjust_speed(mon, 0, obj);
in_mklev = save_in_mklev; g.in_mklev = save_in_mklev;
break; break;
} }
case FIRE_RES: case FIRE_RES:
+1 -1
View File
@@ -301,7 +301,7 @@ found:
Strcpy(namebuf, OBJ_DESCR(objects[new_obj->otyp])); Strcpy(namebuf, OBJ_DESCR(objects[new_obj->otyp]));
wipeout_text(namebuf, (6 + MAXULEV - u.ulevel) / 6, 0); wipeout_text(namebuf, (6 + MAXULEV - u.ulevel) / 6, 0);
} else } else
Sprintf(namebuf, "%s was here!", plname); Sprintf(namebuf, "%s was here!", g.plname);
You("write \"%s\" and the scroll disappears.", namebuf); You("write \"%s\" and the scroll disappears.", namebuf);
useup(paper); useup(paper);
} }
+3 -3
View File
@@ -603,10 +603,10 @@ boolean adjacentok; /* False: at obj's spot only, True: nearby is allowed */
if (mtmp->m_id) { if (mtmp->m_id) {
mtmp2->m_id = mtmp->m_id; mtmp2->m_id = mtmp->m_id;
/* might be bringing quest leader back to life */ /* might be bringing quest leader back to life */
if (quest_status.leader_is_dead if (g.quest_status.leader_is_dead
/* leader_is_dead implies leader_m_id is valid */ /* leader_is_dead implies leader_m_id is valid */
&& mtmp2->m_id == quest_status.leader_m_id) && mtmp2->m_id == g.quest_status.leader_m_id)
quest_status.leader_is_dead = FALSE; g.quest_status.leader_is_dead = FALSE;
} }
mtmp2->mx = mtmp->mx; mtmp2->mx = mtmp->mx;
mtmp2->my = mtmp->my; mtmp2->my = mtmp->my;
+6 -6
View File
@@ -287,17 +287,17 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if (WINDOWPORT("tty")) if (WINDOWPORT("tty"))
toggle_mouse_support(); toggle_mouse_support();
/* strip role,race,&c suffix; calls askname() if plname[] is empty /* strip role,race,&c suffix; calls askname() if g.plname[] is empty
or holds a generic user name like "player" or "games" */ or holds a generic user name like "player" or "games" */
plnamesuffix(); plnamesuffix();
set_playmode(); /* sets plname to "wizard" for wizard mode */ set_playmode(); /* sets g.plname to "wizard" for wizard mode */
/* until the getlock code is resolved, override askname()'s /* until the getlock code is resolved, override askname()'s
setting of renameallowed; when False, player_selection() setting of renameallowed; when False, player_selection()
won't resent renaming as an option */ won't resent renaming as an option */
iflags.renameallowed = FALSE; iflags.renameallowed = FALSE;
/* Obtain the name of the logged on user and incorporate /* Obtain the name of the logged on user and incorporate
* it into the name. */ * it into the name. */
Sprintf(fnamebuf, "%s-%s", get_username(0), plname); Sprintf(fnamebuf, "%s-%s", get_username(0), g.plname);
(void) fname_encode( (void) fname_encode(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%', "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%',
fnamebuf, encodedfnamebuf, BUFSZ); fnamebuf, encodedfnamebuf, BUFSZ);
@@ -471,11 +471,11 @@ char *argv[];
#endif #endif
case 'u': case 'u':
if (argv[0][2]) if (argv[0][2])
(void) strncpy(plname, argv[0] + 2, sizeof(plname) - 1); (void) strncpy(g.plname, argv[0] + 2, sizeof(g.plname) - 1);
else if (argc > 1) { else if (argc > 1) {
argc--; argc--;
argv++; argv++;
(void) strncpy(plname, argv[0], sizeof(plname) - 1); (void) strncpy(g.plname, argv[0], sizeof(g.plname) - 1);
} else } else
raw_print("Player name expected after -u"); raw_print("Player name expected after -u");
break; break;
@@ -582,7 +582,7 @@ port_help()
boolean boolean
authorize_wizard_mode() authorize_wizard_mode()
{ {
if (!strcmp(plname, WIZARD_NAME)) if (!strcmp(g.plname, WIZARD_NAME))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
+8 -8
View File
@@ -890,7 +890,7 @@ makepicks:
Sprintf(plbuf, " %s", genders[GEND].adj); Sprintf(plbuf, " %s", genders[GEND].adj);
else else
*plbuf = '\0'; /* omit redundant gender */ *plbuf = '\0'; /* omit redundant gender */
Sprintf(pbuf, "%s, %s%s %s %s", plname, aligns[ALGN].adj, plbuf, Sprintf(pbuf, "%s, %s%s %s %s", g.plname, aligns[ALGN].adj, plbuf,
races[RACE].adj, races[RACE].adj,
(GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f (GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f
: roles[ROLE].name.m); : roles[ROLE].name.m);
@@ -940,8 +940,8 @@ makepicks:
GEND, ALGN; we'll override that and honor only the name */ GEND, ALGN; we'll override that and honor only the name */
saveROLE = ROLE, saveRACE = RACE, saveGEND = GEND, saveROLE = ROLE, saveRACE = RACE, saveGEND = GEND,
saveALGN = ALGN; saveALGN = ALGN;
*plname = '\0'; *g.plname = '\0';
plnamesuffix(); /* calls askname() when plname[] is empty */ plnamesuffix(); /* calls askname() when g.plname[] is empty */
ROLE = saveROLE, RACE = saveRACE, GEND = saveGEND, ROLE = saveROLE, RACE = saveRACE, GEND = saveGEND,
ALGN = saveALGN; ALGN = saveALGN;
break; /* getconfirmation is still True */ break; /* getconfirmation is still True */
@@ -1167,7 +1167,7 @@ int role, race, gend;
} }
/* /*
* plname is filled either by an option (-u Player or -uPlayer) or * g.plname is filled either by an option (-u Player or -uPlayer) or
* explicitly (by being the wizard) or by askname. * explicitly (by being the wizard) or by askname.
* It may still contain a suffix denoting the role, etc. * It may still contain a suffix denoting the role, etc.
* Always called after init_nhwindows() and before display_gamewindows(). * Always called after init_nhwindows() and before display_gamewindows().
@@ -1187,7 +1187,7 @@ tty_askname()
case 0: case 0:
break; /* no game chosen; start new game */ break; /* no game chosen; start new game */
case 1: case 1:
return; /* plname[] has been set */ return; /* g.plname[] has been set */
} }
#endif /* SELECTSAVED */ #endif /* SELECTSAVED */
@@ -1250,7 +1250,7 @@ tty_askname()
!(c >= '0' && c <= '9' && ct > 0)) !(c >= '0' && c <= '9' && ct > 0))
c = '_'; c = '_';
#endif #endif
if (ct < (int) (sizeof plname) - 1) { if (ct < (int) (sizeof g.plname) - 1) {
#if defined(MICRO) #if defined(MICRO)
#if defined(MSDOS) #if defined(MSDOS)
if (iflags.grmode) { if (iflags.grmode) {
@@ -1261,13 +1261,13 @@ tty_askname()
#else #else
(void) putchar(c); (void) putchar(c);
#endif #endif
plname[ct++] = c; g.plname[ct++] = c;
#ifdef WIN32CON #ifdef WIN32CON
ttyDisplay->curx++; ttyDisplay->curx++;
#endif #endif
} }
} }
plname[ct] = 0; g.plname[ct] = 0;
} while (ct == 0); } while (ct == 0);
/* move to next line to simulate echo of user's <return> */ /* move to next line to simulate echo of user's <return> */
+1 -1
View File
@@ -556,7 +556,7 @@ plselInitDialog(HWND hWnd)
Button_SetCheck(data->control_aligns[0], BST_CHECKED); Button_SetCheck(data->control_aligns[0], BST_CHECKED);
/* set player name */ /* set player name */
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(plname, wbuf, sizeof(wbuf))); SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(g.plname, wbuf, sizeof(wbuf)));
plselRandomize(data); plselRandomize(data);
+3 -3
View File
@@ -682,7 +682,7 @@ mswin_askname(void)
{ {
logDebug("mswin_askname()\n"); logDebug("mswin_askname()\n");
if (mswin_getlin_window("Who are you?", plname, PL_NSIZ) == IDCANCEL) { if (mswin_getlin_window("Who are you?", g.plname, PL_NSIZ) == IDCANCEL) {
bail("bye-bye"); bail("bye-bye");
/* not reached */ /* not reached */
} }
@@ -1894,12 +1894,12 @@ mswin_outrip(winid wid, int how, time_t when)
} }
/* Put name on stone */ /* Put name on stone */
Sprintf(buf, "%s", plname); Sprintf(buf, "%s", g.plname);
buf[STONE_LINE_LEN] = 0; buf[STONE_LINE_LEN] = 0;
putstr(wid, 0, buf); putstr(wid, 0, buf);
/* Put $ on stone */ /* Put $ on stone */
Sprintf(buf, "%ld Au", done_money); Sprintf(buf, "%ld Au", g.done_money);
buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */ buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */
putstr(wid, 0, buf); putstr(wid, 0, buf);
+4 -4
View File
@@ -216,19 +216,19 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
if (argc == 2) { if (argc == 2) {
TCHAR *savefile = strdup(argv[1]); TCHAR *savefile = strdup(argv[1]);
TCHAR *plname; TCHAR *name;
for (p = savefile; *p && *p != '-'; p++) for (p = savefile; *p && *p != '-'; p++)
; ;
if (*p) { if (*p) {
/* we found a '-' */ /* we found a '-' */
plname = p + 1; name = p + 1;
for (p = plname; *p && *p != '.'; p++) for (p = name; *p && *p != '.'; p++)
; ;
if (*p) { if (*p) {
if (strcmp(p + 1, "NetHack-saved-game") == 0) { if (strcmp(p + 1, "NetHack-saved-game") == 0) {
*p = '\0'; *p = '\0';
argv[1] = "-u"; argv[1] = "-u";
argv[2] = _strdup(plname); argv[2] = _strdup(name);
argc = 3; argc = 3;
} }
} }