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