killer, level and rooms move to instance globals.

This commit is contained in:
Bart House
2018-12-24 19:50:08 -08:00
parent 198e44216e
commit be5cdcf77a
74 changed files with 793 additions and 790 deletions

View File

@@ -233,13 +233,13 @@ unsigned material;
if (glyph_is_object(glyph)) {
/* there's some object shown here */
if (oclass == ALL_CLASSES) {
return (boolean) !(level.objects[x][y] /* stale if nothing here */
return (boolean) !(g.level.objects[x][y] /* stale if nothing here */
|| ((mtmp = m_at(x, y)) != 0 && mtmp->minvent));
} else {
if (material
&& objects[glyph_to_obj(glyph)].oc_material == material) {
/* object shown here is of interest because material matches */
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere)
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (o_material(otmp, GOLD))
return FALSE;
/* didn't find it; perhaps a monster is carrying it */
@@ -253,7 +253,7 @@ unsigned material;
}
if (oclass && objects[glyph_to_obj(glyph)].oc_class == oclass) {
/* obj shown here is of interest because its class matches */
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere)
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (o_in(otmp, oclass))
return FALSE;
/* didn't find it; perhaps a monster is carrying it */
@@ -627,7 +627,7 @@ int class; /* an object class, 0 for all */
do_dknown_of(obj);
}
for (obj = level.buriedobjlist; obj; obj = obj->nobj) {
for (obj = g.level.buriedobjlist; obj; obj = obj->nobj) {
if (!class || o_in(obj, class)) {
if (obj->ox == u.ux && obj->oy == u.uy)
ctu++;
@@ -676,7 +676,7 @@ int class; /* an object class, 0 for all */
/*
* Map all buried objects first.
*/
for (obj = level.buriedobjlist; obj; obj = obj->nobj)
for (obj = g.level.buriedobjlist; obj; obj = obj->nobj)
if (!class || (otmp = o_in(obj, class)) != 0) {
if (class) {
if (otmp != obj) {
@@ -697,7 +697,7 @@ int class; /* an object class, 0 for all */
*/
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
for (obj = level.objects[x][y]; obj; obj = obj->nexthere)
for (obj = g.level.objects[x][y]; obj; obj = obj->nexthere)
if ((!class && !boulder) || (otmp = o_in(obj, class)) != 0
|| (otmp = o_in(obj, boulder)) != 0) {
if (class || boulder) {
@@ -952,7 +952,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */
else
found = TRUE;
}
if ((tr = detect_obj_traps(level.buriedobjlist, FALSE, 0)) != OTRAP_NONE) {
if ((tr = detect_obj_traps(g.level.buriedobjlist, FALSE, 0)) != OTRAP_NONE) {
if (tr & OTRAP_THERE)
goto outtrapmap;
else
@@ -998,7 +998,7 @@ outtrapmap:
/* show chest traps first, so that subsequent floor trap display
will override if both types are present at the same location */
(void) detect_obj_traps(fobj, TRUE, cursed_src);
(void) detect_obj_traps(level.buriedobjlist, TRUE, cursed_src);
(void) detect_obj_traps(g.level.buriedobjlist, TRUE, cursed_src);
for (mon = fmon; mon; mon = mon->nmon) {
if (DEADMONSTER(mon))
continue;
@@ -1257,7 +1257,7 @@ register int x, y;
* opposite to how normal vision behaves.
*/
oldglyph = glyph_at(x, y);
if (level.flags.hero_memory) {
if (g.level.flags.hero_memory) {
magic_map_background(x, y, 0);
newsym(x, y); /* show it, if not blocked */
} else {
@@ -1268,7 +1268,7 @@ register int x, y;
map_trap(t, 1);
} else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) {
show_glyph(x, y, oldglyph);
if (level.flags.hero_memory)
if (g.level.flags.hero_memory)
lev->glyph = oldglyph;
}
}
@@ -1285,7 +1285,7 @@ do_mapping()
for (zy = 0; zy < ROWNO; zy++)
show_map_spot(zx, zy);
if (!level.flags.hero_memory || unconstrained) {
if (!g.level.flags.hero_memory || unconstrained) {
flush_screen(1); /* flush temp screen */
/* browse_map() instead of display_nhwindow(WIN_MAP, TRUE) */
browse_map(TER_DETECT | TER_MAP | TER_TRP | TER_OBJ,
@@ -1358,7 +1358,7 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
if (OBJ_AT(zx, zy)) {
/* not vobj_at(); this is not vision-based access;
unlike object detection, we don't notice buried items */
otmp = level.objects[zx][zy];
otmp = g.level.objects[zx][zy];
if (extended)
otmp->dknown = 1;
map_object(otmp, TRUE);
@@ -1375,7 +1375,7 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
the map and we're not doing extended/blessed clairvoyance
(hence must be swallowed or underwater), show "unseen
creature" unless map already displayed a monster here */
if ((unconstrained || !level.flags.hero_memory)
if ((unconstrained || !g.level.flags.hero_memory)
&& !extended && (zx != u.ux || zy != u.uy)
&& !glyph_is_monster(oldglyph))
map_invisible(zx, zy);
@@ -1388,7 +1388,7 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
}
}
if (!level.flags.hero_memory || unconstrained || mdetected || odetected) {
if (!g.level.flags.hero_memory || unconstrained || mdetected || odetected) {
flush_screen(1); /* flush temp screen */
/* the getpos() prompt from browse_map() is only shown when
flags.verbose is set, but make this unconditional so that
@@ -1492,7 +1492,7 @@ genericptr_t num;
int *num_p = (int *) num;
if (OBJ_AT(zx, zy)) {
for (otmp = level.objects[zx][zy]; otmp; otmp = otmp->nexthere) {
for (otmp = g.level.objects[zx][zy]; otmp; otmp = otmp->nexthere) {
if (Is_box(otmp) && otmp->olocked) {
otmp->olocked = 0;
(*num_p)++;
@@ -1813,14 +1813,14 @@ int default_glyph, which_subset;
/* for 'full', show the actual terrain for the entire level,
otherwise what the hero remembers for seen locations with
monsters, objects, and/or traps removed as caller dictates */
seenv = (full || level.flags.hero_memory)
seenv = (full || g.level.flags.hero_memory)
? levl[x][y].seenv : cansee(x, y) ? SVALL : 0;
if (full) {
levl[x][y].seenv = SVALL;
glyph = back_to_glyph(x, y);
levl[x][y].seenv = seenv;
} else {
levl_glyph = level.flags.hero_memory
levl_glyph = g.level.flags.hero_memory
? levl[x][y].glyph
: seenv ? back_to_glyph(x, y): default_glyph;
/* glyph_at() returns the displayed glyph, which might
@@ -1882,7 +1882,7 @@ dump_map()
{
int x, y, glyph, skippedrows, lastnonblank;
int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON;
int default_glyph = cmap_to_glyph(level.flags.arboreal ? S_tree : S_stone);
int default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree : S_stone);
char buf[BUFSZ];
boolean blankrow, toprow;
@@ -1951,7 +1951,7 @@ int which_subset; /* when not full, whether to suppress objs and/or traps */
if (unconstrain_map())
docrt();
default_glyph = cmap_to_glyph(level.flags.arboreal ? S_tree : S_stone);
default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree : S_stone);
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {