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
+40 -35
View File
@@ -23,7 +23,7 @@ E char SAVEP[];
/* max size of a windowtype option */ /* max size of a windowtype option */
#define WINTYPELEN 16 #define WINTYPELEN 16
E struct dgn_topology { /* special dungeon levels for speed */ struct dgn_topology { /* special dungeon levels for speed */
d_level d_oracle_level; d_level d_oracle_level;
d_level d_bigroom_level; /* unused */ d_level d_bigroom_level; /* unused */
d_level d_rogue_level; d_level d_rogue_level;
@@ -51,39 +51,40 @@ E struct dgn_topology { /* special dungeon levels for speed */
d_level d_knox_level; d_level d_knox_level;
d_level d_mineend_level; d_level d_mineend_level;
d_level d_sokoend_level; d_level d_sokoend_level;
} dungeon_topology; };
/* macros for accessing the dungeon levels by their old names */ /* macros for accessing the dungeon levels by their old names */
/* clang-format off */ /* clang-format off */
#define oracle_level (dungeon_topology.d_oracle_level) #define oracle_level (g.dungeon_topology.d_oracle_level)
#define bigroom_level (dungeon_topology.d_bigroom_level) #define bigroom_level (g.dungeon_topology.d_bigroom_level)
#define rogue_level (dungeon_topology.d_rogue_level) #define rogue_level (g.dungeon_topology.d_rogue_level)
#define medusa_level (dungeon_topology.d_medusa_level) #define medusa_level (g.dungeon_topology.d_medusa_level)
#define stronghold_level (dungeon_topology.d_stronghold_level) #define stronghold_level (g.dungeon_topology.d_stronghold_level)
#define valley_level (dungeon_topology.d_valley_level) #define valley_level (g.dungeon_topology.d_valley_level)
#define wiz1_level (dungeon_topology.d_wiz1_level) #define wiz1_level (g.dungeon_topology.d_wiz1_level)
#define wiz2_level (dungeon_topology.d_wiz2_level) #define wiz2_level (g.dungeon_topology.d_wiz2_level)
#define wiz3_level (dungeon_topology.d_wiz3_level) #define wiz3_level (g.dungeon_topology.d_wiz3_level)
#define juiblex_level (dungeon_topology.d_juiblex_level) #define juiblex_level (g.dungeon_topology.d_juiblex_level)
#define orcus_level (dungeon_topology.d_orcus_level) #define orcus_level (g.dungeon_topology.d_orcus_level)
#define baalzebub_level (dungeon_topology.d_baalzebub_level) #define baalzebub_level (g.dungeon_topology.d_baalzebub_level)
#define asmodeus_level (dungeon_topology.d_asmodeus_level) #define asmodeus_level (g.dungeon_topology.d_asmodeus_level)
#define portal_level (dungeon_topology.d_portal_level) #define portal_level (g.dungeon_topology.d_portal_level)
#define sanctum_level (dungeon_topology.d_sanctum_level) #define sanctum_level (g.dungeon_topology.d_sanctum_level)
#define earth_level (dungeon_topology.d_earth_level) #define earth_level (g.dungeon_topology.d_earth_level)
#define water_level (dungeon_topology.d_water_level) #define water_level (g.dungeon_topology.d_water_level)
#define fire_level (dungeon_topology.d_fire_level) #define fire_level (g.dungeon_topology.d_fire_level)
#define air_level (dungeon_topology.d_air_level) #define air_level (g.dungeon_topology.d_air_level)
#define astral_level (dungeon_topology.d_astral_level) #define astral_level (g.dungeon_topology.d_astral_level)
#define tower_dnum (dungeon_topology.d_tower_dnum) #define tower_dnum (g.dungeon_topology.d_tower_dnum)
#define sokoban_dnum (dungeon_topology.d_sokoban_dnum) #define sokoban_dnum (g.dungeon_topology.d_sokoban_dnum)
#define mines_dnum (dungeon_topology.d_mines_dnum) #define mines_dnum (g.dungeon_topology.d_mines_dnum)
#define quest_dnum (dungeon_topology.d_quest_dnum) #define quest_dnum (g.dungeon_topology.d_quest_dnum)
#define qstart_level (dungeon_topology.d_qstart_level) #define qstart_level (g.dungeon_topology.d_qstart_level)
#define qlocate_level (dungeon_topology.d_qlocate_level) #define qlocate_level (g.dungeon_topology.d_qlocate_level)
#define nemesis_level (dungeon_topology.d_nemesis_level) #define nemesis_level (g.dungeon_topology.d_nemesis_level)
#define knox_level (dungeon_topology.d_knox_level) #define knox_level (g.dungeon_topology.d_knox_level)
#define mineend_level (dungeon_topology.d_mineend_level) #define mineend_level (g.dungeon_topology.d_mineend_level)
#define sokoend_level (dungeon_topology.d_sokoend_level) #define sokoend_level (g.dungeon_topology.d_sokoend_level)
/* clang-format on */ /* clang-format on */
#define xdnstair (g.dnstair.sx) #define xdnstair (g.dnstair.sx)
@@ -133,7 +134,7 @@ E NEARDATA long yn_number;
E const char disclosure_options[]; E const char disclosure_options[];
E NEARDATA struct kinfo { struct kinfo {
struct kinfo *next; /* chain of delayed killers */ struct kinfo *next; /* chain of delayed killers */
int id; /* uprop keys to ID a delayed killer */ int id; /* uprop keys to ID a delayed killer */
int format; /* one of the killer formats */ int format; /* one of the killer formats */
@@ -141,7 +142,7 @@ E NEARDATA struct kinfo {
#define KILLED_BY 1 #define KILLED_BY 1
#define NO_KILLER_PREFIX 2 #define NO_KILLER_PREFIX 2
char name[BUFSZ]; /* actual killer name */ char name[BUFSZ]; /* actual killer name */
} killer; };
E char lock[]; E char lock[];
@@ -688,7 +689,11 @@ struct instance_globals {
struct obj *current_wand; /* wand currently zapped/applied */ struct obj *current_wand; /* wand currently zapped/applied */
struct obj *thrownobj; /* object in flight due to throwing */ struct obj *thrownobj; /* object in flight due to throwing */
struct obj *kickedobj; /* object in flight due to kicking */ struct obj *kickedobj; /* object in flight due to kicking */
struct dgn_topology dungeon_topology;
struct kinfo killer;
struct mkroom rooms[(MAXNROFROOMS + 1) * 2];
struct mkroom *subrooms;
dlevel_t level; /* level map */
/* dig.c */ /* dig.c */
+1 -1
View File
@@ -19,7 +19,7 @@
* Returns the head of the list of objects that the player can see * Returns the head of the list of objects that the player can see
* at location (x,y). * at location (x,y).
*/ */
#define vobj_at(x, y) (level.objects[x][y]) #define vobj_at(x, y) (g.level.objects[x][y])
/* /*
* sensemon() * sensemon()
+1 -1
View File
@@ -244,7 +244,7 @@ typedef struct mapseen {
struct mapseen_rooms { struct mapseen_rooms {
Bitfield(seen, 1); Bitfield(seen, 1);
Bitfield(untended, 1); /* flag for shop without shk */ Bitfield(untended, 1); /* flag for shop without shk */
} msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as rooms[] */ } msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as g.rooms[] */
/* dead heroes; might not have graves or ghosts */ /* dead heroes; might not have graves or ghosts */
struct cemetery *final_resting_place; /* same as level.bonesinfo */ struct cemetery *final_resting_place; /* same as level.bonesinfo */
} mapseen; } mapseen;
+2 -2
View File
@@ -116,8 +116,8 @@ struct eshk {
long credit; /* amount credited to customer */ long credit; /* amount credited to customer */
long debit; /* amount of debt for using unpaid items */ long debit; /* amount of debt for using unpaid items */
long loan; /* shop-gold picked (part of debit) */ long loan; /* shop-gold picked (part of debit) */
int shoptype; /* the value of rooms[shoproom].rtype */ int shoptype; /* the value of g.rooms[shoproom].rtype */
schar shoproom; /* index in rooms; set by inshop() */ schar shoproom; /* index in g.rooms; set by inshop() */
schar unused; /* to force alignment for stupid compilers */ schar unused; /* to force alignment for stupid compilers */
boolean following; /* following customer since he owes us sth */ boolean following; /* following customer since he owes us sth */
boolean surcharge; /* angry shk inflates prices */ boolean surcharge; /* angry shk inflates prices */
+8 -10
View File
@@ -38,12 +38,10 @@ struct shclass {
const char *const *shknms; /* list of shopkeeper names for this type */ const char *const *shknms; /* list of shopkeeper names for this type */
}; };
extern NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2]; /* the normal rooms on the current level are described in g.rooms[0..n] for
extern NEARDATA struct mkroom *subrooms;
/* the normal rooms on the current level are described in rooms[0..n] for
* some n<MAXNROFROOMS * some n<MAXNROFROOMS
* the vault, if any, is described by rooms[n+1] * the vault, if any, is described by g.rooms[n+1]
* the next rooms entry has hx -1 as a flag * the next g.rooms entry has hx -1 as a flag
* there is at most one non-vault special room on a level * there is at most one non-vault special room on a level
*/ */
@@ -92,16 +90,16 @@ enum roomtype_types {
#define ROOMOFFSET \ #define ROOMOFFSET \
3 /* \ 3 /* \
* (levl[x][y].roomno - ROOMOFFSET) gives \ * (levl[x][y].roomno - ROOMOFFSET) gives \
* rooms[] index, for inside-squares and \ * g.rooms[] index, for inside-squares and \
* non-shared boundaries. \ * non-shared boundaries. \
*/ */
#define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS) #define IS_ROOM_PTR(x) ((x) >= g.rooms && (x) < g.rooms + MAXNROFROOMS)
#define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS) #define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)
#define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS) #define IS_SUBROOM_PTR(x) ((x) >= g.subrooms && (x) < g.subrooms + MAXNROFROOMS)
#define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2)) #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2))
#define ROOM_INDEX(x) ((x) -rooms) #define ROOM_INDEX(x) ((x) -g.rooms)
#define SUBROOM_INDEX(x) ((x) -subrooms) #define SUBROOM_INDEX(x) ((x) -g.subrooms)
#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == g.nroom) #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == g.nroom)
#define IS_LAST_SUBROOM_PTR(x) (!g.nsubroom || SUBROOM_INDEX(x) == g.nsubroom) #define IS_LAST_SUBROOM_PTR(x) (!g.nsubroom || SUBROOM_INDEX(x) == g.nsubroom)
+18 -20
View File
@@ -88,7 +88,7 @@ enum levl_typ_types {
#define IS_DOOR(typ) ((typ) == DOOR) #define IS_DOOR(typ) ((typ) == DOOR)
#define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS) #define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS)
#define IS_TREE(typ) \ #define IS_TREE(typ) \
((typ) == TREE || (level.flags.arboreal && (typ) == STONE)) ((typ) == TREE || (g.level.flags.arboreal && (typ) == STONE))
#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */ #define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
#define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM, STAIRS, furniture.. */ #define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM, STAIRS, furniture.. */
#define ZAP_POS(typ) ((typ) >= POOL) #define ZAP_POS(typ) ((typ) >= POOL)
@@ -596,14 +596,12 @@ typedef struct {
struct levelflags flags; struct levelflags flags;
} dlevel_t; } dlevel_t;
extern dlevel_t level; /* structure describing the current level */
/* /*
* Macros for compatibility with old code. Someday these will go away. * Macros for compatibility with old code. Someday these will go away.
*/ */
#define levl level.locations #define levl g.level.locations
#define fobj level.objlist #define fobj g.level.objlist
#define fmon level.monlist #define fmon g.level.monlist
/* /*
* Covert a trap number into the defsym graphics array. * Covert a trap number into the defsym graphics array.
@@ -613,38 +611,38 @@ extern dlevel_t level; /* structure describing the current level */
#define trap_to_defsym(t) (S_arrow_trap + (t) -1) #define trap_to_defsym(t) (S_arrow_trap + (t) -1)
#define defsym_to_trap(d) ((d) -S_arrow_trap + 1) #define defsym_to_trap(d) ((d) -S_arrow_trap + 1)
#define OBJ_AT(x, y) (level.objects[x][y] != (struct obj *) 0) #define OBJ_AT(x, y) (g.level.objects[x][y] != (struct obj *) 0)
/* /*
* Macros for encapsulation of level.monsters references. * Macros for encapsulation of level.monsters references.
*/ */
#define MON_AT(x, y) \ #define MON_AT(x, y) \
(level.monsters[x][y] != (struct monst *) 0 \ (g.level.monsters[x][y] != (struct monst *) 0 \
&& !(level.monsters[x][y])->mburied) && !(g.level.monsters[x][y])->mburied)
#define MON_BURIED_AT(x, y) \ #define MON_BURIED_AT(x, y) \
(level.monsters[x][y] != (struct monst *) 0 \ (g.level.monsters[x][y] != (struct monst *) 0 \
&& (level.monsters[x][y])->mburied) && (g.level.monsters[x][y])->mburied)
#ifdef EXTRA_SANITY_CHECKS #ifdef EXTRA_SANITY_CHECKS
#define place_worm_seg(m, x, y) \ #define place_worm_seg(m, x, y) \
do { \ do { \
if (level.monsters[x][y] && level.monsters[x][y] != m) \ if (g.level.monsters[x][y] && g.level.monsters[x][y] != m) \
impossible("place_worm_seg over mon"); \ impossible("place_worm_seg over mon"); \
level.monsters[x][y] = m; \ g.level.monsters[x][y] = m; \
} while(0) } while(0)
#define remove_monster(x, y) \ #define remove_monster(x, y) \
do { \ do { \
if (!level.monsters[x][y]) \ if (!g.level.monsters[x][y]) \
impossible("no monster to remove"); \ impossible("no monster to remove"); \
level.monsters[x][y] = (struct monst *) 0; \ g.level.monsters[x][y] = (struct monst *) 0; \
} while(0) } while(0)
#else #else
#define place_worm_seg(m, x, y) level.monsters[x][y] = m #define place_worm_seg(m, x, y) g.level.monsters[x][y] = m
#define remove_monster(x, y) level.monsters[x][y] = (struct monst *) 0 #define remove_monster(x, y) g.level.monsters[x][y] = (struct monst *) 0
#endif #endif
#define m_at(x, y) (MON_AT(x, y) ? level.monsters[x][y] : (struct monst *) 0) #define m_at(x, y) (MON_AT(x, y) ? g.level.monsters[x][y] : (struct monst *) 0)
#define m_buried_at(x, y) \ #define m_buried_at(x, y) \
(MON_BURIED_AT(x, y) ? level.monsters[x][y] : (struct monst *) 0) (MON_BURIED_AT(x, y) ? g.level.monsters[x][y] : (struct monst *) 0)
/* restricted movement, potential luck penalties */ /* restricted movement, potential luck penalties */
#define Sokoban level.flags.sokoban_rules #define Sokoban g.level.flags.sokoban_rules
#endif /* RM_H */ #endif /* RM_H */
+8 -8
View File
@@ -678,17 +678,17 @@ do_positionbar()
p = pbar; p = pbar;
/* up stairway */ /* up stairway */
if (g.upstair.sx if (g.upstair.sx
&& (glyph_to_cmap(level.locations[g.upstair.sx][g.upstair.sy].glyph) && (glyph_to_cmap(g.level.locations[g.upstair.sx][g.upstair.sy].glyph)
== S_upstair == S_upstair
|| glyph_to_cmap(level.locations[g.upstair.sx][g.upstair.sy].glyph) || glyph_to_cmap(g.level.locations[g.upstair.sx][g.upstair.sy].glyph)
== S_upladder)) { == S_upladder)) {
*p++ = '<'; *p++ = '<';
*p++ = g.upstair.sx; *p++ = g.upstair.sx;
} }
if (g.sstairs.sx if (g.sstairs.sx
&& (glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph) && (glyph_to_cmap(g.level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_upstair == S_upstair
|| glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph) || glyph_to_cmap(g.level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_upladder)) { == S_upladder)) {
*p++ = '<'; *p++ = '<';
*p++ = g.sstairs.sx; *p++ = g.sstairs.sx;
@@ -696,17 +696,17 @@ do_positionbar()
/* down stairway */ /* down stairway */
if (g.dnstair.sx if (g.dnstair.sx
&& (glyph_to_cmap(level.locations[g.dnstair.sx][g.dnstair.sy].glyph) && (glyph_to_cmap(g.level.locations[g.dnstair.sx][g.dnstair.sy].glyph)
== S_dnstair == S_dnstair
|| glyph_to_cmap(level.locations[g.dnstair.sx][g.dnstair.sy].glyph) || glyph_to_cmap(g.level.locations[g.dnstair.sx][g.dnstair.sy].glyph)
== S_dnladder)) { == S_dnladder)) {
*p++ = '>'; *p++ = '>';
*p++ = g.dnstair.sx; *p++ = g.dnstair.sx;
} }
if (g.sstairs.sx if (g.sstairs.sx
&& (glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph) && (glyph_to_cmap(g.level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_dnstair == S_dnstair
|| glyph_to_cmap(level.locations[g.sstairs.sx][g.sstairs.sy].glyph) || glyph_to_cmap(g.level.locations[g.sstairs.sx][g.sstairs.sy].glyph)
== S_dnladder)) { == S_dnladder)) {
*p++ = '>'; *p++ = '>';
*p++ = g.sstairs.sx; *p++ = g.sstairs.sx;
+5 -5
View File
@@ -2098,7 +2098,7 @@ long timeout;
mtmp = make_familiar(figurine, cc.x, cc.y, TRUE); mtmp = make_familiar(figurine, cc.x, cc.y, TRUE);
if (mtmp) { if (mtmp) {
char and_vanish[BUFSZ]; char and_vanish[BUFSZ];
struct obj *mshelter = level.objects[mtmp->mx][mtmp->my]; struct obj *mshelter = g.level.objects[mtmp->mx][mtmp->my];
/* [m_monnam() yields accurate mon type, overriding hallucination] */ /* [m_monnam() yields accurate mon type, overriding hallucination] */
Sprintf(monnambuf, "%s", an(m_monnam(mtmp))); Sprintf(monnambuf, "%s", an(m_monnam(mtmp)));
@@ -2657,7 +2657,7 @@ struct obj *obj;
} }
if (Levitation || u.usteed) { if (Levitation || u.usteed) {
/* Have a shot at snaring something on the floor */ /* Have a shot at snaring something on the floor */
otmp = level.objects[u.ux][u.uy]; otmp = g.level.objects[u.ux][u.uy];
if (otmp && otmp->otyp == CORPSE && otmp->corpsenm == PM_HORSE) { if (otmp && otmp->otyp == CORPSE && otmp->corpsenm == PM_HORSE) {
pline("Why beat a dead horse?"); pline("Why beat a dead horse?");
return 1; return 1;
@@ -3182,7 +3182,7 @@ struct obj *obj;
/* FIXME -- untrap needs to deal with non-adjacent traps */ /* FIXME -- untrap needs to deal with non-adjacent traps */
break; break;
case 1: /* Object */ case 1: /* Object */
if ((otmp = level.objects[cc.x][cc.y]) != 0) { if ((otmp = g.level.objects[cc.x][cc.y]) != 0) {
You("snag an object from the %s!", surface(cc.x, cc.y)); You("snag an object from the %s!", surface(cc.x, cc.y));
(void) pickup_object(otmp, 1L, FALSE); (void) pickup_object(otmp, 1L, FALSE);
/* If pickup fails, leave it alone */ /* If pickup fails, leave it alone */
@@ -3413,7 +3413,7 @@ struct obj *obj;
(void) bhitm(mon, obj); (void) bhitm(mon, obj);
/* if (context.botl) bot(); */ /* if (context.botl) bot(); */
} }
if (affects_objects && level.objects[x][y]) { if (affects_objects && g.level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y, 0); (void) bhitpile(obj, bhito, x, y, 0);
if (context.botl) if (context.botl)
bot(); /* potion effects */ bot(); /* potion effects */
@@ -3431,7 +3431,7 @@ struct obj *obj;
* of obj->bypass in the zap code to accomplish that last case * of obj->bypass in the zap code to accomplish that last case
* since it's also used by retouch_equipment() for polyself.) * since it's also used by retouch_equipment() for polyself.)
*/ */
if (affects_objects && level.objects[x][y]) { if (affects_objects && g.level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y, 0); (void) bhitpile(obj, bhito, x, y, 0);
if (context.botl) if (context.botl)
bot(); /* potion effects */ bot(); /* potion effects */
+1 -1
View File
@@ -2120,7 +2120,7 @@ int x, y;
++ret; ++ret;
continue; continue;
} }
for (otmp = level.objects[dx][dy]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[dx][dy]; otmp; otmp = otmp->nexthere)
if (Is_container(otmp) && otmp->otrapped) { if (Is_container(otmp) && otmp->otrapped) {
++ret; /* we're counting locations, so just */ ++ret; /* we're counting locations, so just */
break; /* count the first one in a pile */ break; /* count the first one in a pile */
+2 -2
View File
@@ -310,8 +310,8 @@ boolean thrown_weapon; /* thrown weapons are less deadly */
} }
if (u.uhp < 1) { if (u.uhp < 1) {
killer.format = kprefix; g.killer.format = kprefix;
Strcpy(killer.name, pkiller); Strcpy(g.killer.name, pkiller);
/* "Poisoned by a poisoned ___" is redundant */ /* "Poisoned by a poisoned ___" is redundant */
done(strstri(pkiller, "poison") ? DIED : POISONING); done(strstri(pkiller, "poison") ? DIED : POISONING);
} }
+1 -1
View File
@@ -174,7 +174,7 @@ bc_order()
|| u.uswallow) || u.uswallow)
return BCPOS_DIFFER; return BCPOS_DIFFER;
for (obj = level.objects[uball->ox][uball->oy]; obj; for (obj = g.level.objects[uball->ox][uball->oy]; obj;
obj = obj->nexthere) { obj = obj->nexthere) {
if (obj == uchain) if (obj == uchain)
return BCPOS_CHAIN; return BCPOS_CHAIN;
+12 -12
View File
@@ -263,7 +263,7 @@ struct monst *oracle;
oracle->mpeaceful = 1; oracle->mpeaceful = 1;
o_ridx = levl[oracle->mx][oracle->my].roomno - ROOMOFFSET; o_ridx = levl[oracle->mx][oracle->my].roomno - ROOMOFFSET;
if (o_ridx >= 0 && rooms[o_ridx].rtype == DELPHI) if (o_ridx >= 0 && g.rooms[o_ridx].rtype == DELPHI)
return TRUE; /* no fixup needed */ return TRUE; /* no fixup needed */
/* /*
@@ -274,14 +274,14 @@ struct monst *oracle;
*/ */
/* find original delphi chamber; should always succeed */ /* find original delphi chamber; should always succeed */
for (ridx = 0; ridx < SIZE(rooms); ++ridx) for (ridx = 0; ridx < SIZE(g.rooms); ++ridx)
if (rooms[ridx].orig_rtype == DELPHI) if (g.rooms[ridx].orig_rtype == DELPHI)
break; break;
if (o_ridx != ridx && ridx < SIZE(rooms)) { if (o_ridx != ridx && ridx < SIZE(g.rooms)) {
/* room found and she's not not in it, so try to move her there */ /* room found and she's not not in it, so try to move her there */
cc.x = (rooms[ridx].lx + rooms[ridx].hx) / 2; cc.x = (g.rooms[ridx].lx + g.rooms[ridx].hx) / 2;
cc.y = (rooms[ridx].ly + rooms[ridx].hy) / 2; cc.y = (g.rooms[ridx].ly + g.rooms[ridx].hy) / 2;
if (enexto(&cc, cc.x, cc.y, oracle->data)) { if (enexto(&cc, cc.x, cc.y, oracle->data)) {
rloc_to(oracle, cc.x, cc.y); rloc_to(oracle, cc.x, cc.y);
o_ridx = levl[oracle->mx][oracle->my].roomno - ROOMOFFSET; o_ridx = levl[oracle->mx][oracle->my].roomno - ROOMOFFSET;
@@ -291,7 +291,7 @@ struct monst *oracle;
same as used to happen before this fixup was introduced] */ same as used to happen before this fixup was introduced] */
} }
if (ridx == o_ridx) /* if she's in her room, mark it as such */ if (ridx == o_ridx) /* if she's in her room, mark it as such */
rooms[ridx].rtype = DELPHI; g.rooms[ridx].rtype = DELPHI;
return TRUE; /* keep oracle in new bones file */ return TRUE; /* keep oracle in new bones file */
} }
@@ -456,7 +456,7 @@ make_bones:
ttmp->tseen = (ttmp->ttyp == HOLE); ttmp->tseen = (ttmp->ttyp == HOLE);
} }
resetobjs(fobj, FALSE); resetobjs(fobj, FALSE);
resetobjs(level.buriedobjlist, FALSE); resetobjs(g.level.buriedobjlist, FALSE);
/* Hero is no longer on the map. */ /* Hero is no longer on the map. */
u.ux0 = u.ux, u.uy0 = u.uy; u.ux0 = u.ux, u.uy0 = u.uy;
@@ -489,13 +489,13 @@ make_bones:
newbones->bonesknown = FALSE; newbones->bonesknown = FALSE;
/* if current character died on a bones level, the cemetery list /* if current character died on a bones level, the cemetery list
will have multiple entries, most recent (this dead hero) first */ will have multiple entries, most recent (this dead hero) first */
newbones->next = level.bonesinfo; newbones->next = g.level.bonesinfo;
level.bonesinfo = newbones; g.level.bonesinfo = newbones;
/* flag these bones if they are being created in wizard mode; /* flag these bones if they are being created in wizard mode;
they might already be flagged as such, even when we're playing they might already be flagged as such, even when we're playing
in normal mode, if this level came from a previous bones file */ in normal mode, if this level came from a previous bones file */
if (wizard) if (wizard)
level.flags.wizard_bones = 1; g.level.flags.wizard_bones = 1;
fd = create_bonesfile(&u.uz, &bonesid, whynot); fd = create_bonesfile(&u.uz, &bonesid, whynot);
if (fd < 0) { if (fd < 0) {
@@ -632,7 +632,7 @@ getbones()
resetobjs(mtmp->minvent, TRUE); resetobjs(mtmp->minvent, TRUE);
} }
resetobjs(fobj, TRUE); resetobjs(fobj, TRUE);
resetobjs(level.buriedobjlist, TRUE); resetobjs(g.level.buriedobjlist, TRUE);
} }
} }
(void) nhclose(fd); (void) nhclose(fd);
+31 -31
View File
@@ -1120,48 +1120,48 @@ wiz_map_levltyp(VOID_ARGS)
/* alignment currently omitted to save space */ /* alignment currently omitted to save space */
} }
/* level features */ /* level features */
if (level.flags.nfountains) if (g.level.flags.nfountains)
Sprintf(eos(dsc), " %c:%d", defsyms[S_fountain].sym, Sprintf(eos(dsc), " %c:%d", defsyms[S_fountain].sym,
(int) level.flags.nfountains); (int) g.level.flags.nfountains);
if (level.flags.nsinks) if (g.level.flags.nsinks)
Sprintf(eos(dsc), " %c:%d", defsyms[S_sink].sym, Sprintf(eos(dsc), " %c:%d", defsyms[S_sink].sym,
(int) level.flags.nsinks); (int) g.level.flags.nsinks);
if (level.flags.has_vault) if (g.level.flags.has_vault)
Strcat(dsc, " vault"); Strcat(dsc, " vault");
if (level.flags.has_shop) if (g.level.flags.has_shop)
Strcat(dsc, " shop"); Strcat(dsc, " shop");
if (level.flags.has_temple) if (g.level.flags.has_temple)
Strcat(dsc, " temple"); Strcat(dsc, " temple");
if (level.flags.has_court) if (g.level.flags.has_court)
Strcat(dsc, " throne"); Strcat(dsc, " throne");
if (level.flags.has_zoo) if (g.level.flags.has_zoo)
Strcat(dsc, " zoo"); Strcat(dsc, " zoo");
if (level.flags.has_morgue) if (g.level.flags.has_morgue)
Strcat(dsc, " morgue"); Strcat(dsc, " morgue");
if (level.flags.has_barracks) if (g.level.flags.has_barracks)
Strcat(dsc, " barracks"); Strcat(dsc, " barracks");
if (level.flags.has_beehive) if (g.level.flags.has_beehive)
Strcat(dsc, " hive"); Strcat(dsc, " hive");
if (level.flags.has_swamp) if (g.level.flags.has_swamp)
Strcat(dsc, " swamp"); Strcat(dsc, " swamp");
/* level flags */ /* level flags */
if (level.flags.noteleport) if (g.level.flags.noteleport)
Strcat(dsc, " noTport"); Strcat(dsc, " noTport");
if (level.flags.hardfloor) if (g.level.flags.hardfloor)
Strcat(dsc, " noDig"); Strcat(dsc, " noDig");
if (level.flags.nommap) if (g.level.flags.nommap)
Strcat(dsc, " noMMap"); Strcat(dsc, " noMMap");
if (!level.flags.hero_memory) if (!g.level.flags.hero_memory)
Strcat(dsc, " noMem"); Strcat(dsc, " noMem");
if (level.flags.shortsighted) if (g.level.flags.shortsighted)
Strcat(dsc, " shortsight"); Strcat(dsc, " shortsight");
if (level.flags.graveyard) if (g.level.flags.graveyard)
Strcat(dsc, " graveyard"); Strcat(dsc, " graveyard");
if (level.flags.is_maze_lev) if (g.level.flags.is_maze_lev)
Strcat(dsc, " maze"); Strcat(dsc, " maze");
if (level.flags.is_cavernous_lev) if (g.level.flags.is_cavernous_lev)
Strcat(dsc, " cave"); Strcat(dsc, " cave");
if (level.flags.arboreal) if (g.level.flags.arboreal)
Strcat(dsc, " tree"); Strcat(dsc, " tree");
if (Sokoban) if (Sokoban)
Strcat(dsc, " sokoban-rules"); Strcat(dsc, " sokoban-rules");
@@ -2151,7 +2151,7 @@ int final;
/* if hero dies while dismounting, u.usteed will still /* if hero dies while dismounting, u.usteed will still
be set; we want to ignore steed in that situation */ be set; we want to ignore steed in that situation */
&& !(final == ENL_GAMEOVERDEAD && !(final == ENL_GAMEOVERDEAD
&& !strcmp(killer.name, "riding accident"))); && !strcmp(g.killer.name, "riding accident")));
const char *steedname = (!Riding ? (char *) 0 const char *steedname = (!Riding ? (char *) 0
: x_monnam(u.usteed, : x_monnam(u.usteed,
u.usteed->mtame ? ARTICLE_YOUR : ARTICLE_THE, u.usteed->mtame ? ARTICLE_YOUR : ARTICLE_THE,
@@ -3046,7 +3046,7 @@ int msgflag; /* for variant message phrasing */
if (is_pool(u.ux, u.uy)) if (is_pool(u.ux, u.uy))
Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy)); Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy));
} else if (hides_under(youmonst.data)) { } else if (hides_under(youmonst.data)) {
struct obj *o = level.objects[u.ux][u.uy]; struct obj *o = g.level.objects[u.ux][u.uy];
if (o) if (o)
Sprintf(bp, " underneath %s", ansimpleoname(o)); Sprintf(bp, " underneath %s", ansimpleoname(o));
@@ -3748,7 +3748,7 @@ long *total_size;
count_obj(invent, &count, &size, FALSE, TRUE); count_obj(invent, &count, &size, FALSE, TRUE);
count_obj(fobj, &count, &size, FALSE, TRUE); count_obj(fobj, &count, &size, FALSE, TRUE);
count_obj(level.buriedobjlist, &count, &size, FALSE, TRUE); count_obj(g.level.buriedobjlist, &count, &size, FALSE, TRUE);
count_obj(migrating_objs, &count, &size, FALSE, TRUE); count_obj(migrating_objs, &count, &size, FALSE, TRUE);
/* DEADMONSTER check not required in this loop since they have no /* DEADMONSTER check not required in this loop since they have no
* inventory */ * inventory */
@@ -3876,7 +3876,7 @@ long *total_size;
} }
count = size = 0L; count = size = 0L;
for (sd = level.damagelist; sd; sd = sd->next) { for (sd = g.level.damagelist; sd; sd = sd->next) {
++count; ++count;
size += (long) sizeof *sd; size += (long) sizeof *sd;
} }
@@ -3899,7 +3899,7 @@ long *total_size;
} }
count = size = 0L; count = size = 0L;
for (k = killer.next; k; k = k->next) { for (k = g.killer.next; k; k = k->next) {
++count; ++count;
size += (long) sizeof *k; size += (long) sizeof *k;
} }
@@ -3913,7 +3913,7 @@ long *total_size;
} }
count = size = 0L; count = size = 0L;
for (bi = level.bonesinfo; bi; bi = bi->next) { for (bi = g.level.bonesinfo; bi; bi = bi->next) {
++count; ++count;
size += (long) sizeof *bi; size += (long) sizeof *bi;
} }
@@ -3963,7 +3963,7 @@ wiz_show_stats()
putstr(win, 0, buf); putstr(win, 0, buf);
obj_chain(win, "invent", invent, TRUE, &total_obj_count, &total_obj_size); obj_chain(win, "invent", invent, TRUE, &total_obj_count, &total_obj_size);
obj_chain(win, "fobj", fobj, TRUE, &total_obj_count, &total_obj_size); obj_chain(win, "fobj", fobj, TRUE, &total_obj_count, &total_obj_size);
obj_chain(win, "buried", level.buriedobjlist, FALSE, obj_chain(win, "buried", g.level.buriedobjlist, FALSE,
&total_obj_count, &total_obj_size); &total_obj_count, &total_obj_size);
obj_chain(win, "migrating obj", migrating_objs, FALSE, obj_chain(win, "migrating obj", migrating_objs, FALSE,
&total_obj_count, &total_obj_size); &total_obj_count, &total_obj_size);
@@ -5278,7 +5278,7 @@ boolean doit;
#endif #endif
if (OBJ_AT(u.ux, u.uy)) { if (OBJ_AT(u.ux, u.uy)) {
struct obj *otmp = level.objects[u.ux][u.uy]; struct obj *otmp = g.level.objects[u.ux][u.uy];
Sprintf(buf, "Pick up %s", otmp->nexthere ? "items" : doname(otmp)); Sprintf(buf, "Pick up %s", otmp->nexthere ? "items" : doname(otmp));
add_herecmd_menuitem(win, dopickup, buf); add_herecmd_menuitem(win, dopickup, buf);
@@ -5377,7 +5377,7 @@ int x, y, mod;
cmd[0] = cmd_from_func(dodown); cmd[0] = cmd_from_func(dodown);
return cmd; return cmd;
} else if (OBJ_AT(u.ux, u.uy)) { } else if (OBJ_AT(u.ux, u.uy)) {
cmd[0] = cmd_from_func(Is_container(level.objects[u.ux][u.uy]) cmd[0] = cmd_from_func(Is_container(g.level.objects[u.ux][u.uy])
? doloot : dopickup); ? doloot : dopickup);
return cmd; return cmd;
} else { } else {
+17 -17
View File
@@ -416,18 +416,18 @@ int xkill_flags, how;
{ {
if (is_u(etmp)) { if (is_u(etmp)) {
if (how == DROWNING) { if (how == DROWNING) {
killer.name[0] = 0; /* drown() sets its own killer */ g.killer.name[0] = 0; /* drown() sets its own killer */
(void) drown(); (void) drown();
} else if (how == BURNING) { } else if (how == BURNING) {
killer.name[0] = 0; /* lava_effects() sets own killer */ g.killer.name[0] = 0; /* lava_effects() sets own killer */
(void) lava_effects(); (void) lava_effects();
} else { } else {
coord xy; coord xy;
/* use more specific killer if specified */ /* use more specific killer if specified */
if (!killer.name[0]) { if (!g.killer.name[0]) {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "falling drawbridge"); Strcpy(g.killer.name, "falling drawbridge");
} }
done(how); done(how);
/* So, you didn't die */ /* So, you didn't die */
@@ -447,7 +447,7 @@ int xkill_flags, how;
} else { } else {
int entitycnt; int entitycnt;
killer.name[0] = 0; g.killer.name[0] = 0;
/* fake "digested to death" damage-type suppresses corpse */ /* fake "digested to death" damage-type suppresses corpse */
#define mk_message(dest) (((dest & XKILL_NOMSG) != 0) ? (char *) 0 : "") #define mk_message(dest) (((dest & XKILL_NOMSG) != 0) ? (char *) 0 : "")
#define mk_corpse(dest) (((dest & XKILL_NOCORPSE) != 0) ? AD_DGST : AD_PHYS) #define mk_corpse(dest) (((dest & XKILL_NOCORPSE) != 0) ? AD_DGST : AD_PHYS)
@@ -589,8 +589,8 @@ struct entity *etmp;
} else { } else {
if (crm->typ == DRAWBRIDGE_DOWN) { if (crm->typ == DRAWBRIDGE_DOWN) {
if (is_u(etmp)) { if (is_u(etmp)) {
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, Strcpy(g.killer.name,
"crushed to death underneath a drawbridge"); "crushed to death underneath a drawbridge");
} }
pline("%s crushed underneath the drawbridge.", pline("%s crushed underneath the drawbridge.",
@@ -707,8 +707,8 @@ struct entity *etmp;
E_phrase(etmp, "disappear")); E_phrase(etmp, "disappear"));
} }
if (!e_survives_at(etmp, etmp->ex, etmp->ey)) { if (!e_survives_at(etmp, etmp->ex, etmp->ey)) {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "closing drawbridge"); Strcpy(g.killer.name, "closing drawbridge");
e_died(etmp, XKILL_NOMSG, CRUSHING); e_died(etmp, XKILL_NOMSG, CRUSHING);
return; return;
} }
@@ -738,8 +738,8 @@ struct entity *etmp;
pline("%s into the %s.", E_phrase(etmp, "fall"), pline("%s into the %s.", E_phrase(etmp, "fall"),
lava ? hliquid("lava") : "moat"); lava ? hliquid("lava") : "moat");
} }
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, "fell from a drawbridge"); Strcpy(g.killer.name, "fell from a drawbridge");
e_died(etmp, /* CRUSHING is arbitrary */ e_died(etmp, /* CRUSHING is arbitrary */
XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG), XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
is_pool(etmp->ex, etmp->ey) ? DROWNING is_pool(etmp->ex, etmp->ey) ? DROWNING
@@ -750,7 +750,7 @@ struct entity *etmp;
} }
/* clear stale reason for death before returning */ /* clear stale reason for death before returning */
#define nokiller() (killer.name[0] = '\0', killer.format = 0) #define nokiller() (g.killer.name[0] = '\0', g.killer.format = 0)
/* /*
* Close the drawbridge located at x,y * Close the drawbridge located at x,y
@@ -947,8 +947,8 @@ int x, y;
if (e_inview) if (e_inview)
pline("%s blown apart by flying debris.", pline("%s blown apart by flying debris.",
E_phrase(etmp2, "are")); E_phrase(etmp2, "are"));
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "exploding drawbridge"); Strcpy(g.killer.name, "exploding drawbridge");
e_died(etmp2, e_died(etmp2,
XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG), XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
CRUSHING); /*no corpse*/ CRUSHING); /*no corpse*/
@@ -979,8 +979,8 @@ int x, y;
debugpline1("%s from shrapnel", E_phrase(etmp1, "die")); debugpline1("%s from shrapnel", E_phrase(etmp1, "die"));
} }
} }
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "collapsing drawbridge"); Strcpy(g.killer.name, "collapsing drawbridge");
e_died(etmp1, e_died(etmp1,
XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG), XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
CRUSHING); /*no corpse*/ CRUSHING); /*no corpse*/
+8 -6
View File
@@ -17,9 +17,7 @@ char *catmore = 0; /* default pager */
* The following structure will be initialized at startup time with * The following structure will be initialized at startup time with
* the level numbers of some "important" things in the game. * the level numbers of some "important" things in the game.
*/ */
struct dgn_topology dungeon_topology = { DUMMY };
NEARDATA struct kinfo killer = DUMMY;
const char quitchars[] = " \r\n\033"; const char quitchars[] = " \r\n\033";
const char vowels[] = "aeiouAEIOU"; const char vowels[] = "aeiouAEIOU";
@@ -53,10 +51,6 @@ const schar xdir[10] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 }; const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 }; const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2] = { DUMMY };
NEARDATA struct mkroom *subrooms = &rooms[MAXNROFROOMS + 1];
dlevel_t level; /* level map */
NEARDATA struct monst youmonst = DUMMY; NEARDATA struct monst youmonst = DUMMY;
NEARDATA struct context_info context = DUMMY; NEARDATA struct context_info context = DUMMY;
NEARDATA struct flag flags = DUMMY; NEARDATA struct flag flags = DUMMY;
@@ -323,6 +317,11 @@ const struct instance_globals g_init = {
NULL, /* current_wand */ NULL, /* current_wand */
NULL, /* thrownobj */ NULL, /* thrownobj */
NULL, /* kickedobj */ NULL, /* kickedobj */
DUMMY, /* dungeon_topology */
DUMMY, /* killer */
DUMMY, /* rooms */
NULL, /* subrooms */
UNDEFINED_VALUES, /* level */
/* dig.c */ /* dig.c */
UNDEFINED_VALUE, /* did_dig_msg */ UNDEFINED_VALUE, /* did_dig_msg */
@@ -637,6 +636,9 @@ decl_globals_init()
sfcap = default_sfinfo; sfcap = default_sfinfo;
sfrestinfo = default_sfinfo; sfrestinfo = default_sfinfo;
sfsaveinfo = default_sfinfo; sfsaveinfo = default_sfinfo;
g.subrooms = &g.rooms[MAXNROFROOMS + 1];
} }
/*decl.c*/ /*decl.c*/
+19 -19
View File
@@ -233,13 +233,13 @@ unsigned material;
if (glyph_is_object(glyph)) { if (glyph_is_object(glyph)) {
/* there's some object shown here */ /* there's some object shown here */
if (oclass == ALL_CLASSES) { 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)); || ((mtmp = m_at(x, y)) != 0 && mtmp->minvent));
} else { } else {
if (material if (material
&& objects[glyph_to_obj(glyph)].oc_material == material) { && objects[glyph_to_obj(glyph)].oc_material == material) {
/* object shown here is of interest because material matches */ /* 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)) if (o_material(otmp, GOLD))
return FALSE; return FALSE;
/* didn't find it; perhaps a monster is carrying it */ /* 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) { if (oclass && objects[glyph_to_obj(glyph)].oc_class == oclass) {
/* obj shown here is of interest because its class matches */ /* 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)) if (o_in(otmp, oclass))
return FALSE; return FALSE;
/* didn't find it; perhaps a monster is carrying it */ /* 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); 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 (!class || o_in(obj, class)) {
if (obj->ox == u.ux && obj->oy == u.uy) if (obj->ox == u.ux && obj->oy == u.uy)
ctu++; ctu++;
@@ -676,7 +676,7 @@ int class; /* an object class, 0 for all */
/* /*
* Map all buried objects first. * 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 || (otmp = o_in(obj, class)) != 0) {
if (class) { if (class) {
if (otmp != obj) { if (otmp != obj) {
@@ -697,7 +697,7 @@ int class; /* an object class, 0 for all */
*/ */
for (x = 1; x < COLNO; x++) for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) 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 if ((!class && !boulder) || (otmp = o_in(obj, class)) != 0
|| (otmp = o_in(obj, boulder)) != 0) { || (otmp = o_in(obj, boulder)) != 0) {
if (class || boulder) { if (class || boulder) {
@@ -952,7 +952,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */
else else
found = TRUE; 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) if (tr & OTRAP_THERE)
goto outtrapmap; goto outtrapmap;
else else
@@ -998,7 +998,7 @@ outtrapmap:
/* show chest traps first, so that subsequent floor trap display /* show chest traps first, so that subsequent floor trap display
will override if both types are present at the same location */ will override if both types are present at the same location */
(void) detect_obj_traps(fobj, TRUE, cursed_src); (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) { for (mon = fmon; mon; mon = mon->nmon) {
if (DEADMONSTER(mon)) if (DEADMONSTER(mon))
continue; continue;
@@ -1257,7 +1257,7 @@ register int x, y;
* opposite to how normal vision behaves. * opposite to how normal vision behaves.
*/ */
oldglyph = glyph_at(x, y); oldglyph = glyph_at(x, y);
if (level.flags.hero_memory) { if (g.level.flags.hero_memory) {
magic_map_background(x, y, 0); magic_map_background(x, y, 0);
newsym(x, y); /* show it, if not blocked */ newsym(x, y); /* show it, if not blocked */
} else { } else {
@@ -1268,7 +1268,7 @@ register int x, y;
map_trap(t, 1); map_trap(t, 1);
} else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) { } else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) {
show_glyph(x, y, oldglyph); show_glyph(x, y, oldglyph);
if (level.flags.hero_memory) if (g.level.flags.hero_memory)
lev->glyph = oldglyph; lev->glyph = oldglyph;
} }
} }
@@ -1285,7 +1285,7 @@ do_mapping()
for (zy = 0; zy < ROWNO; zy++) for (zy = 0; zy < ROWNO; zy++)
show_map_spot(zx, 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 */ flush_screen(1); /* flush temp screen */
/* browse_map() instead of display_nhwindow(WIN_MAP, TRUE) */ /* browse_map() instead of display_nhwindow(WIN_MAP, TRUE) */
browse_map(TER_DETECT | TER_MAP | TER_TRP | TER_OBJ, 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)) { if (OBJ_AT(zx, zy)) {
/* not vobj_at(); this is not vision-based access; /* not vobj_at(); this is not vision-based access;
unlike object detection, we don't notice buried items */ unlike object detection, we don't notice buried items */
otmp = level.objects[zx][zy]; otmp = g.level.objects[zx][zy];
if (extended) if (extended)
otmp->dknown = 1; otmp->dknown = 1;
map_object(otmp, TRUE); 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 the map and we're not doing extended/blessed clairvoyance
(hence must be swallowed or underwater), show "unseen (hence must be swallowed or underwater), show "unseen
creature" unless map already displayed a monster here */ 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) && !extended && (zx != u.ux || zy != u.uy)
&& !glyph_is_monster(oldglyph)) && !glyph_is_monster(oldglyph))
map_invisible(zx, zy); 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 */ flush_screen(1); /* flush temp screen */
/* the getpos() prompt from browse_map() is only shown when /* the getpos() prompt from browse_map() is only shown when
flags.verbose is set, but make this unconditional so that flags.verbose is set, but make this unconditional so that
@@ -1492,7 +1492,7 @@ genericptr_t num;
int *num_p = (int *) num; int *num_p = (int *) num;
if (OBJ_AT(zx, zy)) { 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) { if (Is_box(otmp) && otmp->olocked) {
otmp->olocked = 0; otmp->olocked = 0;
(*num_p)++; (*num_p)++;
@@ -1813,14 +1813,14 @@ int default_glyph, which_subset;
/* for 'full', show the actual terrain for the entire level, /* for 'full', show the actual terrain for the entire level,
otherwise what the hero remembers for seen locations with otherwise what the hero remembers for seen locations with
monsters, objects, and/or traps removed as caller dictates */ 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; ? levl[x][y].seenv : cansee(x, y) ? SVALL : 0;
if (full) { if (full) {
levl[x][y].seenv = SVALL; levl[x][y].seenv = SVALL;
glyph = back_to_glyph(x, y); glyph = back_to_glyph(x, y);
levl[x][y].seenv = seenv; levl[x][y].seenv = seenv;
} else { } else {
levl_glyph = level.flags.hero_memory levl_glyph = g.level.flags.hero_memory
? levl[x][y].glyph ? levl[x][y].glyph
: seenv ? back_to_glyph(x, y): default_glyph; : seenv ? back_to_glyph(x, y): default_glyph;
/* glyph_at() returns the displayed glyph, which might /* glyph_at() returns the displayed glyph, which might
@@ -1882,7 +1882,7 @@ dump_map()
{ {
int x, y, glyph, skippedrows, lastnonblank; int x, y, glyph, skippedrows, lastnonblank;
int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON; 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]; char buf[BUFSZ];
boolean blankrow, toprow; boolean blankrow, toprow;
@@ -1951,7 +1951,7 @@ int which_subset; /* when not full, whether to suppress objs and/or traps */
if (unconstrain_map()) if (unconstrain_map())
docrt(); 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 (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) { for (y = 0; y < ROWNO; y++) {
+13 -13
View File
@@ -159,7 +159,7 @@ xchar x, y;
: IS_TREE(levl[x][y].typ) : IS_TREE(levl[x][y].typ)
? (ispick ? DIGTYP_UNDIGGABLE : DIGTYP_TREE) ? (ispick ? DIGTYP_UNDIGGABLE : DIGTYP_TREE)
: (ispick && IS_ROCK(levl[x][y].typ) : (ispick && IS_ROCK(levl[x][y].typ)
&& (!level.flags.arboreal && (!g.level.flags.arboreal
|| IS_WALL(levl[x][y].typ))) || IS_WALL(levl[x][y].typ)))
? DIGTYP_ROCK ? DIGTYP_ROCK
: DIGTYP_UNDIGGABLE); : DIGTYP_UNDIGGABLE);
@@ -407,9 +407,9 @@ dig(VOID_ARGS)
add_damage(dpx, dpy, SHOP_WALL_DMG); add_damage(dpx, dpy, SHOP_WALL_DMG);
dmgtxt = "damage"; dmgtxt = "damage";
} }
if (level.flags.is_maze_lev) { if (g.level.flags.is_maze_lev) {
lev->typ = ROOM, lev->flags = 0; lev->typ = ROOM, lev->flags = 0;
} else if (level.flags.is_cavernous_lev && !in_town(dpx, dpy)) { } else if (g.level.flags.is_cavernous_lev && !in_town(dpx, dpy)) {
lev->typ = CORR, lev->flags = 0; lev->typ = CORR, lev->flags = 0;
} else { } else {
lev->typ = DOOR, lev->doormask = D_NODOOR; lev->typ = DOOR, lev->doormask = D_NODOOR;
@@ -590,11 +590,11 @@ int ttyp;
else else
Strcpy(surface_type, surface(x, y)); Strcpy(surface_type, surface(x, y));
shopdoor = IS_DOOR(lev->typ) && *in_rooms(x, y, SHOPBASE); shopdoor = IS_DOOR(lev->typ) && *in_rooms(x, y, SHOPBASE);
oldobjs = level.objects[x][y]; oldobjs = g.level.objects[x][y];
ttmp = maketrap(x, y, ttyp); ttmp = maketrap(x, y, ttyp);
if (!ttmp) if (!ttmp)
return; return;
newobjs = level.objects[x][y]; newobjs = g.level.objects[x][y];
ttmp->madeby_u = madeby_u; ttmp->madeby_u = madeby_u;
ttmp->tseen = 0; ttmp->tseen = 0;
if (cansee(x, y)) if (cansee(x, y))
@@ -1295,9 +1295,9 @@ register struct monst *mtmp;
You_hear("crashing rock."); You_hear("crashing rock.");
if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE)) if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
add_damage(mtmp->mx, mtmp->my, 0L); add_damage(mtmp->mx, mtmp->my, 0L);
if (level.flags.is_maze_lev) { if (g.level.flags.is_maze_lev) {
here->typ = ROOM, here->flags = 0; here->typ = ROOM, here->flags = 0;
} else if (level.flags.is_cavernous_lev } else if (g.level.flags.is_cavernous_lev
&& !in_town(mtmp->mx, mtmp->my)) { && !in_town(mtmp->mx, mtmp->my)) {
here->typ = CORR, here->flags = 0; here->typ = CORR, here->flags = 0;
} else { } else {
@@ -1432,7 +1432,7 @@ zap_dig()
/* normal case: digging across the level */ /* normal case: digging across the level */
shopdoor = shopwall = FALSE; shopdoor = shopwall = FALSE;
maze_dig = level.flags.is_maze_lev && !Is_earthlevel(&u.uz); maze_dig = g.level.flags.is_maze_lev && !Is_earthlevel(&u.uz);
zx = u.ux + u.dx; zx = u.ux + u.dx;
zy = u.uy + u.dy; zy = u.uy + u.dy;
if (u.utrap && u.utraptype == TT_PIT if (u.utrap && u.utraptype == TT_PIT
@@ -1538,7 +1538,7 @@ zap_dig()
shopwall = TRUE; shopwall = TRUE;
} }
watch_dig((struct monst *) 0, zx, zy, TRUE); watch_dig((struct monst *) 0, zx, zy, TRUE);
if (level.flags.is_cavernous_lev && !in_town(zx, zy)) { if (g.level.flags.is_cavernous_lev && !in_town(zx, zy)) {
room->typ = CORR, room->flags = 0; room->typ = CORR, room->flags = 0;
} else { } else {
room->typ = DOOR, room->doormask = D_NODOOR; room->typ = DOOR, room->doormask = D_NODOOR;
@@ -1729,7 +1729,7 @@ coord *cc;
*/ */
if (u.utrap && u.utraptype == TT_BURIEDBALL) if (u.utrap && u.utraptype == TT_BURIEDBALL)
for (otmp = level.buriedobjlist; otmp; otmp = otmp->nobj) { for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj) {
if (otmp->otyp != HEAVY_IRON_BALL) if (otmp->otyp != HEAVY_IRON_BALL)
continue; continue;
/* if found at the target spot, we're done */ /* if found at the target spot, we're done */
@@ -1885,10 +1885,10 @@ int x, y;
costly = ((shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) costly = ((shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)))
&& costly_spot(x, y)); && costly_spot(x, y));
if (level.objects[x][y] != (struct obj *) 0) { if (g.level.objects[x][y] != (struct obj *) 0) {
debugpline2("bury_objs: at <%d,%d>", x, y); debugpline2("bury_objs: at <%d,%d>", x, y);
} }
for (otmp = level.objects[x][y]; otmp; otmp = otmp2) { for (otmp = g.level.objects[x][y]; otmp; otmp = otmp2) {
if (costly) { if (costly) {
loss += stolen_value(otmp, x, y, (boolean) shkp->mpeaceful, TRUE); loss += stolen_value(otmp, x, y, (boolean) shkp->mpeaceful, TRUE);
if (otmp->oclass != COIN_CLASS) if (otmp->oclass != COIN_CLASS)
@@ -1919,7 +1919,7 @@ int x, y;
cc.x = x; cc.x = x;
cc.y = y; cc.y = y;
bball = buried_ball(&cc); bball = buried_ball(&cc);
for (otmp = level.buriedobjlist; otmp; otmp = otmp2) { for (otmp = g.level.buriedobjlist; otmp; otmp = otmp2) {
otmp2 = otmp->nobj; otmp2 = otmp->nobj;
if (otmp->ox == x && otmp->oy == y) { if (otmp->ox == x && otmp->oy == y) {
if (bball && otmp == bball if (bball && otmp == bball
+10 -10
View File
@@ -168,7 +168,7 @@ int show;
else if (lev->typ == CORR && glyph == cmap_to_glyph(S_litcorr)) else if (lev->typ == CORR && glyph == cmap_to_glyph(S_litcorr))
glyph = cmap_to_glyph(S_corr); glyph = cmap_to_glyph(S_corr);
} }
if (level.flags.hero_memory) if (g.level.flags.hero_memory)
lev->glyph = glyph; lev->glyph = glyph;
if (show) if (show)
show_glyph(x, y, glyph); show_glyph(x, y, glyph);
@@ -204,7 +204,7 @@ register int show;
{ {
register int glyph = back_to_glyph(x, y); register int glyph = back_to_glyph(x, y);
if (level.flags.hero_memory) if (g.level.flags.hero_memory)
levl[x][y].glyph = glyph; levl[x][y].glyph = glyph;
if (show) if (show)
show_glyph(x, y, glyph); show_glyph(x, y, glyph);
@@ -224,7 +224,7 @@ register int show;
register int x = trap->tx, y = trap->ty; register int x = trap->tx, y = trap->ty;
register int glyph = trap_to_glyph(trap); register int glyph = trap_to_glyph(trap);
if (level.flags.hero_memory) if (g.level.flags.hero_memory)
levl[x][y].glyph = glyph; levl[x][y].glyph = glyph;
if (show) if (show)
show_glyph(x, y, glyph); show_glyph(x, y, glyph);
@@ -244,7 +244,7 @@ register int show;
register int x = obj->ox, y = obj->oy; register int x = obj->ox, y = obj->oy;
register int glyph = obj_to_glyph(obj); register int glyph = obj_to_glyph(obj);
if (level.flags.hero_memory) { if (g.level.flags.hero_memory) {
/* MRKR: While hallucinating, statues are seen as random monsters */ /* MRKR: While hallucinating, statues are seen as random monsters */
/* but remembered as random objects. */ /* but remembered as random objects. */
@@ -272,7 +272,7 @@ map_invisible(x, y)
register xchar x, y; register xchar x, y;
{ {
if (x != u.ux || y != u.uy) { /* don't display I at hero's location */ if (x != u.ux || y != u.uy) { /* don't display I at hero's location */
if (level.flags.hero_memory) if (g.level.flags.hero_memory)
levl[x][y].glyph = GLYPH_INVISIBLE; levl[x][y].glyph = GLYPH_INVISIBLE;
show_glyph(x, y, GLYPH_INVISIBLE); show_glyph(x, y, GLYPH_INVISIBLE);
} }
@@ -306,7 +306,7 @@ register int x, y;
{ {
register struct trap *trap; register struct trap *trap;
if (!level.flags.hero_memory) if (!g.level.flags.hero_memory)
return; return;
if ((trap = t_at(x, y)) != 0 && trap->tseen && !covers_traps(x, y)) if ((trap = t_at(x, y)) != 0 && trap->tseen && !covers_traps(x, y))
@@ -671,13 +671,13 @@ xchar x, y;
* the wrong glyph. * the wrong glyph.
*/ */
if (uchain->ox == x && uchain->oy == y) { if (uchain->ox == x && uchain->oy == y) {
if (level.objects[x][y] == uchain) if (g.level.objects[x][y] == uchain)
u.bc_felt |= BC_CHAIN; u.bc_felt |= BC_CHAIN;
else else
u.bc_felt &= ~BC_CHAIN; /* do not feel the chain */ u.bc_felt &= ~BC_CHAIN; /* do not feel the chain */
} }
if (!carried(uball) && uball->ox == x && uball->oy == y) { if (!carried(uball) && uball->ox == x && uball->oy == y) {
if (level.objects[x][y] == uball) if (g.level.objects[x][y] == uball)
u.bc_felt |= BC_BALL; u.bc_felt |= BC_BALL;
else else
u.bc_felt &= ~BC_BALL; /* do not feel the ball */ u.bc_felt &= ~BC_BALL; /* do not feel the ball */
@@ -1611,7 +1611,7 @@ xchar x, y;
switch (ptr->typ) { switch (ptr->typ) {
case SCORR: case SCORR:
case STONE: case STONE:
idx = level.flags.arboreal ? S_tree : S_stone; idx = g.level.flags.arboreal ? S_tree : S_stone;
break; break;
case ROOM: case ROOM:
idx = S_room; idx = S_room;
@@ -1807,7 +1807,7 @@ xchar x, y;
switch (lev->typ) { switch (lev->typ) {
case SCORR: case SCORR:
case STONE: case STONE:
idx = level.flags.arboreal ? S_tree : S_stone; idx = g.level.flags.arboreal ? S_tree : S_stone;
break; break;
case ROOM: case ROOM:
idx = S_room; idx = S_room;
+4 -4
View File
@@ -280,7 +280,7 @@ polymorph_sink()
return; return;
sinklooted = levl[u.ux][u.uy].looted != 0; sinklooted = levl[u.ux][u.uy].looted != 0;
level.flags.nsinks--; g.level.flags.nsinks--;
levl[u.ux][u.uy].doormask = 0; /* levl[][].flags */ levl[u.ux][u.uy].doormask = 0; /* levl[][].flags */
switch (rn2(4)) { switch (rn2(4)) {
default: default:
@@ -290,7 +290,7 @@ polymorph_sink()
levl[u.ux][u.uy].blessedftn = 0; levl[u.ux][u.uy].blessedftn = 0;
if (sinklooted) if (sinklooted)
SET_FOUNTAIN_LOOTED(u.ux, u.uy); SET_FOUNTAIN_LOOTED(u.ux, u.uy);
level.flags.nfountains++; g.level.flags.nfountains++;
break; break;
case 1: case 1:
sym = S_throne; sym = S_throne;
@@ -414,7 +414,7 @@ register struct obj *obj;
break; break;
case RIN_HUNGER: case RIN_HUNGER:
ideed = FALSE; ideed = FALSE;
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp2) { for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere; otmp2 = otmp->nexthere;
if (otmp != uball && otmp != uchain if (otmp != uball && otmp != uchain
&& !obj_resists(otmp, 1, 99)) { && !obj_resists(otmp, 1, 99)) {
@@ -711,7 +711,7 @@ boolean with_impact;
container_impact_dmg(obj, u.ux, u.uy); container_impact_dmg(obj, u.ux, u.uy);
if (obj == uball) if (obj == uball)
drop_ball(u.ux, u.uy); drop_ball(u.ux, u.uy);
else if (level.flags.has_shop) else if (g.level.flags.has_shop)
sellobj(obj, u.ux, u.uy); sellobj(obj, u.ux, u.uy);
stackobj(obj); stackobj(obj);
if (Blind && Levitation) if (Blind && Levitation)
+1 -1
View File
@@ -903,7 +903,7 @@ const char *goal;
goto foundc; goto foundc;
/* next, try glyph that's remembered here /* next, try glyph that's remembered here
(might be trap or object) */ (might be trap or object) */
if (level.flags.hero_memory if (g.level.flags.hero_memory
/* !terrainmode: don't move to remembered /* !terrainmode: don't move to remembered
trap or object if not currently shown */ trap or object if not currently shown */
&& !iflags.terrainmode) { && !iflags.terrainmode) {
+2 -2
View File
@@ -10,7 +10,7 @@ STATIC_DCL int NDECL(pet_type);
/* cloned from mon.c; used here if mon_arrive() can't place mon */ /* cloned from mon.c; used here if mon_arrive() can't place mon */
#define LEVEL_SPECIFIC_NOCORPSE(mdat) \ #define LEVEL_SPECIFIC_NOCORPSE(mdat) \
(Is_rogue_level(&u.uz) \ (Is_rogue_level(&u.uz) \
|| (level.flags.graveyard && is_undead(mdat) && rn2(3))) || (g.level.flags.graveyard && is_undead(mdat) && rn2(3)))
void void
newedog(mtmp) newedog(mtmp)
@@ -437,7 +437,7 @@ boolean with_you;
coord c; coord c;
/* somexy() handles irregular rooms */ /* somexy() handles irregular rooms */
if (somexy(&rooms[*r - ROOMOFFSET], &c)) if (somexy(&g.rooms[*r - ROOMOFFSET], &c))
xlocale = c.x, ylocale = c.y; xlocale = c.x, ylocale = c.y;
else else
xlocale = ylocale = 0; xlocale = ylocale = 0;
+4 -4
View File
@@ -129,7 +129,7 @@ int x, y;
{ {
struct obj *otmp; struct obj *otmp;
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (otmp->cursed) if (otmp->cursed)
return TRUE; return TRUE;
return FALSE; return FALSE;
@@ -430,7 +430,7 @@ int udist;
edog->droptime = monstermoves; edog->droptime = monstermoves;
} }
} else { } else {
if ((obj = level.objects[omx][omy]) != 0 if ((obj = g.level.objects[omx][omy]) != 0
&& !index(nofetch, obj->oclass) && !index(nofetch, obj->oclass)
#ifdef MAIL #ifdef MAIL
&& obj->otyp != SCR_MAIL && obj->otyp != SCR_MAIL
@@ -1082,7 +1082,7 @@ int after; /* this is extra fast monster movement */
/* dog eschews cursed objects, but likes dog food */ /* dog eschews cursed objects, but likes dog food */
/* (minion isn't interested; `cursemsg' stays FALSE) */ /* (minion isn't interested; `cursemsg' stays FALSE) */
if (has_edog) if (has_edog)
for (obj = level.objects[nx][ny]; obj; obj = obj->nexthere) { for (obj = g.level.objects[nx][ny]; obj; obj = obj->nexthere) {
if (obj->cursed) { if (obj->cursed) {
cursemsg[i] = TRUE; cursemsg[i] = TRUE;
} else if ((otyp = dogfood(mtmp, obj)) < MANFOOD } else if ((otyp = dogfood(mtmp, obj)) < MANFOOD
@@ -1213,7 +1213,7 @@ int after; /* this is extra fast monster movement */
/* describe top item of pile, not necessarily cursed item itself; /* describe top item of pile, not necessarily cursed item itself;
don't use glyph_at() here--it would return the pet but we want don't use glyph_at() here--it would return the pet but we want
to know whether an object is remembered at this map location */ to know whether an object is remembered at this map location */
struct obj *o = (!Hallucination && level.flags.hero_memory struct obj *o = (!Hallucination && g.level.flags.hero_memory
&& glyph_is_object(levl[nix][niy].glyph)) && glyph_is_object(levl[nix][niy].glyph))
? vobj_at(nix, niy) : 0; ? vobj_at(nix, niy) : 0;
const char *what = o ? distant_name(o, doname) : something; const char *what = o ? distant_name(o, doname) : something;
+6 -6
View File
@@ -259,7 +259,7 @@ doit:
if (mon->mx != x || mon->my != y) { if (mon->mx != x || mon->my != y) {
(void) unmap_invisible(x, y); (void) unmap_invisible(x, y);
pline("%s %s, %s evading your %skick.", Monnam(mon), pline("%s %s, %s evading your %skick.", Monnam(mon),
(!level.flags.noteleport && can_teleport(mon->data)) (!g.level.flags.noteleport && can_teleport(mon->data))
? "teleports" ? "teleports"
: is_floater(mon->data) : is_floater(mon->data)
? "floats" ? "floats"
@@ -463,7 +463,7 @@ char *kickobjnam;
*kickobjnam = '\0'; *kickobjnam = '\0';
/* if a pile, the "top" object gets kicked */ /* if a pile, the "top" object gets kicked */
g.kickedobj = level.objects[x][y]; g.kickedobj = g.level.objects[x][y];
if (g.kickedobj) { if (g.kickedobj) {
/* kick object; if doing is fatal, done() will clean up g.kickedobj */ /* kick object; if doing is fatal, done() will clean up g.kickedobj */
Strcpy(kickobjnam, killer_xname(g.kickedobj)); /* matters iff res==0 */ Strcpy(kickobjnam, killer_xname(g.kickedobj)); /* matters iff res==0 */
@@ -519,9 +519,9 @@ xchar x, y;
; /* hero has been transformed but kick continues */ ; /* hero has been transformed but kick continues */
} else { } else {
/* normalize body shape here; foot, not body_part(FOOT) */ /* normalize body shape here; foot, not body_part(FOOT) */
Sprintf(killer.name, "kicking %s barefoot", Sprintf(g.killer.name, "kicking %s barefoot",
killer_xname(g.kickedobj)); killer_xname(g.kickedobj));
instapetrify(killer.name); instapetrify(g.killer.name);
} }
} }
@@ -1392,7 +1392,7 @@ xchar dlev; /* if !0 send to dlev near player */
isrock = (missile && missile->otyp == ROCK); isrock = (missile && missile->otyp == ROCK);
oct = dct = 0L; oct = dct = 0L;
for (obj = level.objects[x][y]; obj; obj = obj2) { for (obj = g.level.objects[x][y]; obj; obj = obj2) {
obj2 = obj->nexthere; obj2 = obj->nexthere;
if (obj == missile) if (obj == missile)
continue; continue;
@@ -1501,7 +1501,7 @@ boolean shop_floor_obj;
unpaid = is_unpaid(otmp); unpaid = is_unpaid(otmp);
if (OBJ_AT(x, y)) { if (OBJ_AT(x, y)) {
for (obj = level.objects[x][y]; obj; obj = obj->nexthere) for (obj = g.level.objects[x][y]; obj; obj = obj->nexthere)
if (obj != otmp) if (obj != otmp)
n += obj->quan; n += obj->quan;
if (n) if (n)
+4 -4
View File
@@ -89,8 +89,8 @@ int shotlimit;
/* throwing with one hand, but pluralize since the /* throwing with one hand, but pluralize since the
expression "with your bare hands" sounds better */ expression "with your bare hands" sounds better */
makeplural(body_part(HAND))); makeplural(body_part(HAND)));
Sprintf(killer.name, "throwing %s bare-handed", killer_xname(obj)); Sprintf(g.killer.name, "throwing %s bare-handed", killer_xname(obj));
instapetrify(killer.name); instapetrify(g.killer.name);
} }
if (welded(obj)) { if (welded(obj)) {
weldmsg(obj); weldmsg(obj);
@@ -1036,8 +1036,8 @@ boolean hitsroof;
&& !(poly_when_stoned(youmonst.data) && !(poly_when_stoned(youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
petrify: petrify:
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "elementary physics"); /* "what goes up..." */ Strcpy(g.killer.name, "elementary physics"); /* "what goes up..." */
You("turn to stone."); You("turn to stone.");
if (obj) if (obj)
dropy(obj); /* bypass most of hitfloor() */ dropy(obj); /* bypass most of hitfloor() */
+12 -12
View File
@@ -141,7 +141,7 @@ boolean perform_write, free_data;
bwrite(fd, (genericptr_t) &g.n_dgns, sizeof g.n_dgns); bwrite(fd, (genericptr_t) &g.n_dgns, sizeof g.n_dgns);
bwrite(fd, (genericptr_t) g.dungeons, bwrite(fd, (genericptr_t) g.dungeons,
sizeof(dungeon) * (unsigned) g.n_dgns); sizeof(dungeon) * (unsigned) g.n_dgns);
bwrite(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology); bwrite(fd, (genericptr_t) &g.dungeon_topology, sizeof g.dungeon_topology);
bwrite(fd, (genericptr_t) g.tune, sizeof tune); bwrite(fd, (genericptr_t) g.tune, sizeof tune);
for (count = 0, curr = g.branches; curr; curr = curr->next) for (count = 0, curr = g.branches; curr; curr = curr->next)
@@ -193,7 +193,7 @@ int fd;
mread(fd, (genericptr_t) &g.n_dgns, sizeof(g.n_dgns)); mread(fd, (genericptr_t) &g.n_dgns, sizeof(g.n_dgns));
mread(fd, (genericptr_t) g.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) &g.dungeon_topology, sizeof g.dungeon_topology);
mread(fd, (genericptr_t) g.tune, sizeof tune); mread(fd, (genericptr_t) g.tune, sizeof tune);
last = g.branches = (branch *) 0; last = g.branches = (branch *) 0;
@@ -1280,7 +1280,7 @@ boolean
Can_dig_down(lev) Can_dig_down(lev)
d_level *lev; d_level *lev;
{ {
return (boolean) (!level.flags.hardfloor return (boolean) (!g.level.flags.hardfloor
&& !Is_botlevel(lev) && !Is_botlevel(lev)
&& !Invocation_lev(lev)); && !Invocation_lev(lev));
} }
@@ -2449,9 +2449,9 @@ recalc_mapseen()
ridx = u.urooms[i] - ROOMOFFSET; ridx = u.urooms[i] - ROOMOFFSET;
mptr->msrooms[ridx].seen = 1; mptr->msrooms[ridx].seen = 1;
mptr->msrooms[ridx].untended = mptr->msrooms[ridx].untended =
(rooms[ridx].rtype >= SHOPBASE) (g.rooms[ridx].rtype >= SHOPBASE)
? (!(mtmp = shop_keeper(u.urooms[i])) || !inhishop(mtmp)) ? (!(mtmp = shop_keeper(u.urooms[i])) || !inhishop(mtmp))
: (rooms[ridx].rtype == TEMPLE) : (g.rooms[ridx].rtype == TEMPLE)
? (!(mtmp = findpriest(u.urooms[i])) ? (!(mtmp = findpriest(u.urooms[i]))
|| !inhistemple(mtmp)) || !inhistemple(mtmp))
: 0; : 0;
@@ -2462,22 +2462,22 @@ recalc_mapseen()
*/ */
for (i = 0; i < SIZE(mptr->msrooms); ++i) { for (i = 0; i < SIZE(mptr->msrooms); ++i) {
if (mptr->msrooms[i].seen) { if (mptr->msrooms[i].seen) {
if (rooms[i].rtype >= SHOPBASE) { if (g.rooms[i].rtype >= SHOPBASE) {
if (mptr->msrooms[i].untended) if (mptr->msrooms[i].untended)
mptr->feat.shoptype = SHOPBASE - 1; mptr->feat.shoptype = SHOPBASE - 1;
else if (!mptr->feat.nshop) else if (!mptr->feat.nshop)
mptr->feat.shoptype = rooms[i].rtype; mptr->feat.shoptype = g.rooms[i].rtype;
else if (mptr->feat.shoptype != (unsigned) rooms[i].rtype) else if (mptr->feat.shoptype != (unsigned) g.rooms[i].rtype)
mptr->feat.shoptype = 0; mptr->feat.shoptype = 0;
count = mptr->feat.nshop + 1; count = mptr->feat.nshop + 1;
if (count <= 3) if (count <= 3)
mptr->feat.nshop = count; mptr->feat.nshop = count;
} else if (rooms[i].rtype == TEMPLE) { } else if (g.rooms[i].rtype == TEMPLE) {
/* altar and temple alignment handled below */ /* altar and temple alignment handled below */
count = mptr->feat.ntemple + 1; count = mptr->feat.ntemple + 1;
if (count <= 3) if (count <= 3)
mptr->feat.ntemple = count; mptr->feat.ntemple = count;
} else if (rooms[i].orig_rtype == DELPHI) { } else if (g.rooms[i].orig_rtype == DELPHI) {
mptr->flags.oracle = 1; mptr->flags.oracle = 1;
} }
} }
@@ -2620,11 +2620,11 @@ recalc_mapseen()
} }
} }
if (level.bonesinfo && !mptr->final_resting_place) { if (g.level.bonesinfo && !mptr->final_resting_place) {
/* clone the bonesinfo so we aren't dependent upon this /* clone the bonesinfo so we aren't dependent upon this
level being in memory */ level being in memory */
bonesaddr = &mptr->final_resting_place; bonesaddr = &mptr->final_resting_place;
bp = level.bonesinfo; bp = g.level.bonesinfo;
do { do {
*bonesaddr = (struct cemetery *) alloc(sizeof **bonesaddr); *bonesaddr = (struct cemetery *) alloc(sizeof **bonesaddr);
**bonesaddr = *bp; **bonesaddr = *bp;
+24 -24
View File
@@ -253,7 +253,7 @@ struct obj *food;
morehungry(1000); /* you just got *very* sick! */ morehungry(1000); /* you just got *very* sick! */
vomit(); vomit();
} else { } else {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
/* /*
* Note all "killer"s below read "Choked on %s" on the * Note all "killer"s below read "Choked on %s" on the
* high score list & tombstone. So plan accordingly. * high score list & tombstone. So plan accordingly.
@@ -261,14 +261,14 @@ struct obj *food;
if (food) { if (food) {
You("choke over your %s.", foodword(food)); You("choke over your %s.", foodword(food));
if (food->oclass == COIN_CLASS) { if (food->oclass == COIN_CLASS) {
Strcpy(killer.name, "very rich meal"); Strcpy(g.killer.name, "very rich meal");
} else { } else {
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, killer_xname(food)); Strcpy(g.killer.name, killer_xname(food));
} }
} else { } else {
You("choke over it."); You("choke over it.");
Strcpy(killer.name, "quick snack"); Strcpy(g.killer.name, "quick snack");
} }
You("die..."); You("die...");
done(CHOKING); done(CHOKING);
@@ -546,8 +546,8 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
return MM_MISS; return MM_MISS;
} else if (is_rider(pd)) { } else if (is_rider(pd)) {
pline("Ingesting that is fatal."); pline("Ingesting that is fatal.");
Sprintf(killer.name, "unwisely ate the brain of %s", pd->mname); Sprintf(g.killer.name, "unwisely ate the brain of %s", pd->mname);
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
done(DIED); done(DIED);
/* life-saving needed to reach here */ /* life-saving needed to reach here */
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
@@ -577,8 +577,8 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
static NEARDATA const char brainlessness[] = "brainlessness"; static NEARDATA const char brainlessness[] = "brainlessness";
if (Lifesaved) { if (Lifesaved) {
Strcpy(killer.name, brainlessness); Strcpy(g.killer.name, brainlessness);
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
done(DIED); done(DIED);
/* amulet of life saving has now been used up */ /* amulet of life saving has now been used up */
pline("Unfortunately your brain is still gone."); pline("Unfortunately your brain is still gone.");
@@ -588,8 +588,8 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
} else { } else {
Your("last thought fades away."); Your("last thought fades away.");
} }
Strcpy(killer.name, brainlessness); Strcpy(g.killer.name, brainlessness);
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
done(DIED); done(DIED);
/* can only get here when in wizard or explore mode and user has /* can only get here when in wizard or explore mode and user has
explicitly chosen not to die; arbitrarily boost intelligence */ explicitly chosen not to die; arbitrarily boost intelligence */
@@ -676,8 +676,8 @@ register int pm;
if (!Stone_resistance if (!Stone_resistance
&& !(poly_when_stoned(youmonst.data) && !(poly_when_stoned(youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
Sprintf(killer.name, "tasting %s meat", mons[pm].mname); Sprintf(g.killer.name, "tasting %s meat", mons[pm].mname);
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
You("turn to stone."); You("turn to stone.");
done(STONING); done(STONING);
if (context.victual.piece) if (context.victual.piece)
@@ -707,8 +707,8 @@ register int pm;
case PM_PESTILENCE: case PM_PESTILENCE:
case PM_FAMINE: { case PM_FAMINE: {
pline("Eating that is instantly fatal."); pline("Eating that is instantly fatal.");
Sprintf(killer.name, "unwisely ate the body of %s", mons[pm].mname); Sprintf(g.killer.name, "unwisely ate the body of %s", mons[pm].mname);
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
done(DIED); done(DIED);
/* life-saving needed to reach here */ /* life-saving needed to reach here */
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
@@ -2213,8 +2213,8 @@ struct obj *otmp;
u.uhpmax++; u.uhpmax++;
u.uhp = u.uhpmax; u.uhp = u.uhpmax;
} else if (u.uhp <= 0) { } else if (u.uhp <= 0) {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "rotten lump of royal jelly"); Strcpy(g.killer.name, "rotten lump of royal jelly");
done(POISONING); done(POISONING);
} }
} }
@@ -2227,9 +2227,9 @@ struct obj *otmp;
&& !(poly_when_stoned(youmonst.data) && !(poly_when_stoned(youmonst.data)
&& polymon(PM_STONE_GOLEM))) { && polymon(PM_STONE_GOLEM))) {
if (!Stoned) { if (!Stoned) {
Sprintf(killer.name, "%s egg", Sprintf(g.killer.name, "%s egg",
mons[otmp->corpsenm].mname); mons[otmp->corpsenm].mname);
make_stoned(5L, (char *) 0, KILLED_BY_AN, killer.name); make_stoned(5L, (char *) 0, KILLED_BY_AN, g.killer.name);
} }
} }
/* note: no "tastes like chicken" message for eggs */ /* note: no "tastes like chicken" message for eggs */
@@ -2992,8 +2992,8 @@ boolean incr;
context.botl = 1; context.botl = 1;
bot(); bot();
You("die from starvation."); You("die from starvation.");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "starvation"); Strcpy(g.killer.name, "starvation");
done(STARVING); done(STARVING);
/* if we return, we lifesaved, and that calls newuhs */ /* if we return, we lifesaved, and that calls newuhs */
return; return;
@@ -3059,8 +3059,8 @@ boolean incr;
bot(); bot();
if ((Upolyd ? u.mh : u.uhp) < 1) { if ((Upolyd ? u.mh : u.uhp) < 1) {
You("die from hunger and exhaustion."); You("die from hunger and exhaustion.");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "exhaustion"); Strcpy(g.killer.name, "exhaustion");
done(STARVING); done(STARVING);
return; return;
} }
@@ -3127,7 +3127,7 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
} }
/* Is there some food (probably a heavy corpse) here on the ground? */ /* Is there some food (probably a heavy corpse) here on the ground? */
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) { for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
if (corpsecheck if (corpsecheck
? (otmp->otyp == CORPSE ? (otmp->otyp == CORPSE
&& (corpsecheck == 1 || tinnable(otmp))) && (corpsecheck == 1 || tinnable(otmp)))
+37 -37
View File
@@ -405,19 +405,19 @@ int how;
You((how == STONING) ? "turn to stone..." : "die..."); You((how == STONING) ? "turn to stone..." : "die...");
mark_synch(); /* flush buffered screen output */ mark_synch(); /* flush buffered screen output */
buf[0] = '\0'; buf[0] = '\0';
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
/* "killed by the high priest of Crom" is okay, /* "killed by the high priest of Crom" is okay,
"killed by the high priest" alone isn't */ "killed by the high priest" alone isn't */
if ((mptr->geno & G_UNIQ) != 0 && !(imitator && !mimicker) if ((mptr->geno & G_UNIQ) != 0 && !(imitator && !mimicker)
&& !(mptr == &mons[PM_HIGH_PRIEST] && !mtmp->ispriest)) { && !(mptr == &mons[PM_HIGH_PRIEST] && !mtmp->ispriest)) {
if (!type_is_pname(mptr)) if (!type_is_pname(mptr))
Strcat(buf, "the "); Strcat(buf, "the ");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
} }
/* _the_ <invisible> <distorted> ghost of Dudley */ /* _the_ <invisible> <distorted> ghost of Dudley */
if (mptr == &mons[PM_GHOST] && has_mname(mtmp)) { if (mptr == &mons[PM_GHOST] && has_mname(mtmp)) {
Strcat(buf, "the "); Strcat(buf, "the ");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
} }
if (mtmp->minvis) if (mtmp->minvis)
Strcat(buf, "invisible "); Strcat(buf, "invisible ");
@@ -466,7 +466,7 @@ int how;
: mtmp->female ? "Ms. " : "Mr. "; : mtmp->female ? "Ms. " : "Mr. ";
Sprintf(eos(buf), "%s%s, the shopkeeper", honorific, shknm); Sprintf(eos(buf), "%s%s, the shopkeeper", honorific, shknm);
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
} else if (mtmp->ispriest || mtmp->isminion) { } else if (mtmp->ispriest || mtmp->isminion) {
/* m_monnam() suppresses "the" prefix plus "invisible", and /* m_monnam() suppresses "the" prefix plus "invisible", and
it overrides the effect of Hallucination on priestname() */ it overrides the effect of Hallucination on priestname() */
@@ -477,7 +477,7 @@ int how;
Sprintf(eos(buf), " called %s", MNAME(mtmp)); Sprintf(eos(buf), " called %s", MNAME(mtmp));
} }
Strcpy(killer.name, buf); Strcpy(g.killer.name, buf);
if (mptr->mlet == S_WRAITH) if (mptr->mlet == S_WRAITH)
u.ugrave_arise = PM_WRAITH; u.ugrave_arise = PM_WRAITH;
else if (mptr->mlet == S_MUMMY && urace.mummynum != NON_PM) else if (mptr->mlet == S_MUMMY && urace.mummynum != NON_PM)
@@ -1008,13 +1008,13 @@ int how;
boolean survive = FALSE; boolean survive = FALSE;
if (how == TRICKED) { if (how == TRICKED) {
if (killer.name[0]) { if (g.killer.name[0]) {
paniclog("trickery", killer.name); paniclog("trickery", g.killer.name);
killer.name[0] = '\0'; g.killer.name[0] = '\0';
} }
if (wizard) { if (wizard) {
You("are a very tricky wizard, it seems."); You("are a very tricky wizard, it seems.");
killer.format = KILLED_BY_AN; /* reset to 0 */ g.killer.format = KILLED_BY_AN; /* reset to 0 */
return; return;
} }
} }
@@ -1046,18 +1046,18 @@ int how;
/* not useup(); we haven't put this potion into inventory */ /* not useup(); we haven't put this potion into inventory */
obfree(potion, (struct obj *) 0); obfree(potion, (struct obj *) 0);
} }
killer.name[0] = '\0'; g.killer.name[0] = '\0';
killer.format = 0; g.killer.format = 0;
return; return;
} }
} else } else
if (how == ASCENDED || (!killer.name[0] && how == GENOCIDED)) if (how == ASCENDED || (!g.killer.name[0] && how == GENOCIDED))
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
/* Avoid killed by "a" burning or "a" starvation */ /* Avoid killed by "a" burning or "a" starvation */
if (!killer.name[0] && (how == STARVING || how == BURNING)) if (!g.killer.name[0] && (how == STARVING || how == BURNING))
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
if (!killer.name[0] || how >= PANICKED) if (!g.killer.name[0] || how >= PANICKED)
Strcpy(killer.name, deaths[how]); Strcpy(g.killer.name, deaths[how]);
if (how < PANICKED) { if (how < PANICKED) {
u.umortality++; u.umortality++;
@@ -1098,8 +1098,8 @@ int how;
} }
if (survive) { if (survive) {
killer.name[0] = '\0'; g.killer.name[0] = '\0';
killer.format = KILLED_BY_AN; /* reset to 0 */ g.killer.format = KILLED_BY_AN; /* reset to 0 */
return; return;
} }
really_done(how); really_done(how);
@@ -1184,15 +1184,15 @@ int how;
u.ugrave_arise = PM_GREEN_SLIME; u.ugrave_arise = PM_GREEN_SLIME;
if (how == QUIT) { if (how == QUIT) {
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
if (u.uhp < 1) { if (u.uhp < 1) {
how = DIED; how = DIED;
u.umortality++; /* skipped above when how==QUIT */ u.umortality++; /* skipped above when how==QUIT */
Strcpy(killer.name, "quit while already on Charon's boat"); Strcpy(g.killer.name, "quit while already on Charon's boat");
} }
} }
if (how == ESCAPED || how == PANICKED) if (how == ESCAPED || how == PANICKED)
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
fixup_death(how); /* actually, fixup g.multi_reason */ fixup_death(how); /* actually, fixup g.multi_reason */
@@ -1365,12 +1365,12 @@ int how;
} }
#endif #endif
if (u.uhave.amulet) { if (u.uhave.amulet) {
Strcat(killer.name, " (with the Amulet)"); Strcat(g.killer.name, " (with the Amulet)");
} else if (how == ESCAPED) { } else if (how == ESCAPED) {
if (Is_astralevel(&u.uz)) /* offered Amulet to wrong deity */ if (Is_astralevel(&u.uz)) /* offered Amulet to wrong deity */
Strcat(killer.name, " (in celestial disgrace)"); Strcat(g.killer.name, " (in celestial disgrace)");
else if (carrying(FAKE_AMULET_OF_YENDOR)) else if (carrying(FAKE_AMULET_OF_YENDOR))
Strcat(killer.name, " (with a fake Amulet)"); Strcat(g.killer.name, " (with a fake Amulet)");
/* don't bother counting to see whether it should be plural */ /* don't bother counting to see whether it should be plural */
} }
@@ -2026,13 +2026,13 @@ const char *killername;
k = (struct kinfo *) alloc(sizeof (struct kinfo)); k = (struct kinfo *) alloc(sizeof (struct kinfo));
(void) memset((genericptr_t) k, 0, sizeof (struct kinfo)); (void) memset((genericptr_t) k, 0, sizeof (struct kinfo));
k->id = id; k->id = id;
k->next = killer.next; k->next = g.killer.next;
killer.next = k; g.killer.next = k;
} }
k->format = format; k->format = format;
Strcpy(k->name, killername ? killername : ""); Strcpy(k->name, killername ? killername : "");
killer.name[0] = 0; g.killer.name[0] = 0;
} }
struct kinfo * struct kinfo *
@@ -2041,7 +2041,7 @@ int id;
{ {
struct kinfo *k; struct kinfo *k;
for (k = killer.next; k != (struct kinfo *) 0; k = k->next) { for (k = g.killer.next; k != (struct kinfo *) 0; k = k->next) {
if (k->id == id) if (k->id == id)
break; break;
} }
@@ -2052,11 +2052,11 @@ void
dealloc_killer(kptr) dealloc_killer(kptr)
struct kinfo *kptr; struct kinfo *kptr;
{ {
struct kinfo *prev = &killer, *k; struct kinfo *prev = &g.killer, *k;
if (kptr == (struct kinfo *) 0) if (kptr == (struct kinfo *) 0)
return; return;
for (k = killer.next; k != (struct kinfo *) 0; k = k->next) { for (k = g.killer.next; k != (struct kinfo *) 0; k = k->next) {
if (k == kptr) if (k == kptr)
break; break;
prev = k; prev = k;
@@ -2079,15 +2079,15 @@ int mode;
struct kinfo *kptr; struct kinfo *kptr;
if (perform_bwrite(mode)) { if (perform_bwrite(mode)) {
for (kptr = &killer; kptr != (struct kinfo *) 0; kptr = kptr->next) { for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) {
bwrite(fd, (genericptr_t) kptr, sizeof (struct kinfo)); bwrite(fd, (genericptr_t) kptr, sizeof (struct kinfo));
} }
} }
if (release_data(mode)) { if (release_data(mode)) {
while (killer.next) { while (g.killer.next) {
kptr = killer.next->next; kptr = g.killer.next->next;
free((genericptr_t) killer.next); free((genericptr_t) g.killer.next);
killer.next = kptr; g.killer.next = kptr;
} }
} }
} }
@@ -2098,7 +2098,7 @@ int fd;
{ {
struct kinfo *kptr; struct kinfo *kptr;
for (kptr = &killer; kptr != (struct kinfo *) 0; kptr = kptr->next) { for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) {
mread(fd, (genericptr_t) kptr, sizeof (struct kinfo)); mread(fd, (genericptr_t) kptr, sizeof (struct kinfo));
if (kptr->next) { if (kptr->next) {
kptr->next = (struct kinfo *) alloc(sizeof (struct kinfo)); kptr->next = (struct kinfo *) alloc(sizeof (struct kinfo));
+1 -1
View File
@@ -757,7 +757,7 @@ doengrave()
? "Chips fly out from the headstone." ? "Chips fly out from the headstone."
: is_ice(u.ux, u.uy) : is_ice(u.ux, u.uy)
? "Ice chips fly up from the ice surface!" ? "Ice chips fly up from the ice surface!"
: (level.locations[u.ux][u.uy].typ : (g.level.locations[u.ux][u.uy].typ
== DRAWBRIDGE_DOWN) == DRAWBRIDGE_DOWN)
? "Splinters fly up from the bridge." ? "Splinters fly up from the bridge."
: "Gravel flies up from the floor."); : "Gravel flies up from the floor.");
+3 -3
View File
@@ -204,9 +204,9 @@ const char *drainer; /* cause of death, if drain should be fatal */
reset_rndmonst(NON_PM); /* new monster selection */ reset_rndmonst(NON_PM); /* new monster selection */
} else { } else {
if (drainer) { if (drainer) {
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
if (killer.name != drainer) if (g.killer.name != drainer)
Strcpy(killer.name, drainer); Strcpy(g.killer.name, drainer);
done(DIED); done(DIED);
} }
/* no drainer or lifesaved */ /* no drainer or lifesaved */
+11 -11
View File
@@ -114,9 +114,9 @@ int expltype;
*/ */
if (olet == MON_EXPLODE) { if (olet == MON_EXPLODE) {
/* when explode() is called recursively, killer.name might change so /* when explode() is called recursively, g.killer.name might change so
we need to retain a copy of the current value for this explosion */ we need to retain a copy of the current value for this explosion */
str = strcpy(killr_buf, killer.name); str = strcpy(killr_buf, g.killer.name);
do_hallu = (Hallucination do_hallu = (Hallucination
&& (strstri(str, "'s explosion") && (strstri(str, "'s explosion")
|| strstri(str, "s' explosion"))); || strstri(str, "s' explosion")));
@@ -530,20 +530,20 @@ int expltype;
} else { } else {
if (olet == MON_EXPLODE) { if (olet == MON_EXPLODE) {
if (generic) /* explosion was unseen; str=="explosion", */ if (generic) /* explosion was unseen; str=="explosion", */
; /* killer.name=="gas spore's explosion" */ ; /* g.killer.name=="gas spore's explosion" */
else if (str != killer.name && str != hallu_buf) else if (str != g.killer.name && str != hallu_buf)
Strcpy(killer.name, str); Strcpy(g.killer.name, str);
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
} else if (type >= 0 && olet != SCROLL_CLASS) { } else if (type >= 0 && olet != SCROLL_CLASS) {
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Sprintf(killer.name, "caught %sself in %s own %s", uhim(), Sprintf(g.killer.name, "caught %sself in %s own %s", uhim(),
uhis(), str); uhis(), str);
} else { } else {
killer.format = (!strcmpi(str, "tower of flame") g.killer.format = (!strcmpi(str, "tower of flame")
|| !strcmpi(str, "fireball")) || !strcmpi(str, "fireball"))
? KILLED_BY_AN ? KILLED_BY_AN
: KILLED_BY; : KILLED_BY;
Strcpy(killer.name, str); Strcpy(g.killer.name, str);
} }
if (iflags.last_msg == PLNMSG_CAUGHT_IN_EXPLOSION if (iflags.last_msg == PLNMSG_CAUGHT_IN_EXPLOSION
|| iflags.last_msg == PLNMSG_TOWER_OF_FLAME) /*seffects()*/ || iflags.last_msg == PLNMSG_TOWER_OF_FLAME) /*seffects()*/
@@ -620,7 +620,7 @@ struct obj *obj; /* only scatter this obj */
impossible("scattered object <%d,%d> not at scatter site <%d,%d>", impossible("scattered object <%d,%d> not at scatter site <%d,%d>",
obj->ox, obj->oy, sx, sy); obj->ox, obj->oy, sx, sy);
while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) { while ((otmp = (individual_object ? obj : g.level.objects[sx][sy])) != 0) {
if (otmp->quan > 1L) { if (otmp->quan > 1L) {
qtmp = otmp->quan - 1L; qtmp = otmp->quan - 1L;
if (qtmp > LARGEST_INT) if (qtmp > LARGEST_INT)
+5 -5
View File
@@ -64,7 +64,7 @@ int x, y, dir;
fromy += 7 * y; fromy += 7 * y;
if (!IS_WALL(levl[fromx][fromy].typ)) if (!IS_WALL(levl[fromx][fromy].typ))
impossible("down: no wall at %d,%d?", fromx, fromy); impossible("down: no wall at %d,%d?", fromx, fromy);
dodoor(fromx, fromy, &rooms[g.r[x][y].nroom]); dodoor(fromx, fromy, &g.rooms[g.r[x][y].nroom]);
levl[fromx][fromy].doormask = D_NODOOR; levl[fromx][fromy].doormask = D_NODOOR;
fromy++; fromy++;
} }
@@ -86,7 +86,7 @@ int x, y, dir;
toy += 7 * y; toy += 7 * y;
if (!IS_WALL(levl[tox][toy].typ)) if (!IS_WALL(levl[tox][toy].typ))
impossible("up: no wall at %d,%d?", tox, toy); impossible("up: no wall at %d,%d?", tox, toy);
dodoor(tox, toy, &rooms[g.r[x][y].nroom]); dodoor(tox, toy, &g.rooms[g.r[x][y].nroom]);
levl[tox][toy].doormask = D_NODOOR; levl[tox][toy].doormask = D_NODOOR;
toy--; toy--;
} }
@@ -106,7 +106,7 @@ int x, y, dir;
fromy += 7 * y; fromy += 7 * y;
if (!IS_WALL(levl[fromx][fromy].typ)) if (!IS_WALL(levl[fromx][fromy].typ))
impossible("down: no wall at %d,%d?", fromx, fromy); impossible("down: no wall at %d,%d?", fromx, fromy);
dodoor(fromx, fromy, &rooms[g.r[x][y].nroom]); dodoor(fromx, fromy, &g.rooms[g.r[x][y].nroom]);
levl[fromx][fromy].doormask = D_NODOOR; levl[fromx][fromy].doormask = D_NODOOR;
fromx++; fromx++;
} }
@@ -128,7 +128,7 @@ int x, y, dir;
toy += 7 * y; toy += 7 * y;
if (!IS_WALL(levl[tox][toy].typ)) if (!IS_WALL(levl[tox][toy].typ))
impossible("left: no wall at %d,%d?", tox, toy); impossible("left: no wall at %d,%d?", tox, toy);
dodoor(tox, toy, &rooms[g.r[x][y].nroom]); dodoor(tox, toy, &g.rooms[g.r[x][y].nroom]);
levl[tox][toy].doormask = D_NODOOR; levl[tox][toy].doormask = D_NODOOR;
tox--; tox--;
} }
@@ -299,7 +299,7 @@ makerogueghost()
if (!g.nroom) if (!g.nroom)
return; /* Should never happen */ return; /* Should never happen */
croom = &rooms[rn2(g.nroom)]; croom = &g.rooms[rn2(g.nroom)];
x = somex(croom); x = somex(croom);
y = somey(croom); y = somey(croom);
if (!(ghost = makemon(&mons[PM_GHOST], x, y, NO_MM_FLAGS))) if (!(ghost = makemon(&mons[PM_GHOST], x, y, NO_MM_FLAGS)))
+5 -5
View File
@@ -140,7 +140,7 @@ genericptr_t poolcnt;
levl[x][y].typ = POOL, levl[x][y].flags = 0; levl[x][y].typ = POOL, levl[x][y].flags = 0;
/* No kelp! */ /* No kelp! */
del_engr_at(x, y); del_engr_at(x, y);
water_damage_chain(level.objects[x][y], TRUE); water_damage_chain(g.level.objects[x][y], TRUE);
if ((mtmp = m_at(x, y)) != 0) if ((mtmp = m_at(x, y)) != 0)
(void) minliquid(mtmp); (void) minliquid(mtmp);
@@ -212,7 +212,7 @@ boolean isyou;
/* The location is seen if the hero/monster is invisible /* The location is seen if the hero/monster is invisible
or felt if the hero is blind. */ or felt if the hero is blind. */
newsym(x, y); newsym(x, y);
level.flags.nfountains--; g.level.flags.nfountains--;
if (isyou && in_town(x, y)) if (isyou && in_town(x, y))
(void) angry_guards(FALSE); (void) angry_guards(FALSE);
} }
@@ -398,7 +398,7 @@ register struct obj *obj;
update_inventory(); update_inventory();
levl[u.ux][u.uy].typ = ROOM, levl[u.ux][u.uy].flags = 0; levl[u.ux][u.uy].typ = ROOM, levl[u.ux][u.uy].flags = 0;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
level.flags.nfountains--; g.level.flags.nfountains--;
if (in_town(u.ux, u.uy)) if (in_town(u.ux, u.uy))
(void) angry_guards(FALSE); (void) angry_guards(FALSE);
return; return;
@@ -508,11 +508,11 @@ int x, y;
{ {
if (cansee(x, y) || (x == u.ux && y == u.uy)) if (cansee(x, y) || (x == u.ux && y == u.uy))
pline_The("pipes break! Water spurts out!"); pline_The("pipes break! Water spurts out!");
level.flags.nsinks--; g.level.flags.nsinks--;
levl[x][y].typ = FOUNTAIN, levl[x][y].looted = 0; levl[x][y].typ = FOUNTAIN, levl[x][y].looted = 0;
levl[x][y].blessedftn = 0; levl[x][y].blessedftn = 0;
SET_FOUNTAIN_LOOTED(x, y); SET_FOUNTAIN_LOOTED(x, y);
level.flags.nfountains++; g.level.flags.nfountains++;
newsym(x, y); newsym(x, y);
} }
+20 -20
View File
@@ -17,7 +17,7 @@ STATIC_DCL struct monst *FDECL(monstinroom, (struct permonst *, int));
STATIC_DCL boolean FDECL(doorless_door, (int, int)); STATIC_DCL boolean FDECL(doorless_door, (int, int));
STATIC_DCL void FDECL(move_update, (BOOLEAN_P)); STATIC_DCL void FDECL(move_update, (BOOLEAN_P));
#define IS_SHOP(x) (rooms[x].rtype >= SHOPBASE) #define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE)
/* mode values for findtravelpath() */ /* mode values for findtravelpath() */
#define TRAVP_TRAVEL 0 #define TRAVP_TRAVEL 0
@@ -70,7 +70,7 @@ const char *msg;
coord cc; coord cc;
boolean revived = FALSE; boolean revived = FALSE;
for (otmp = level.objects[x][y]; otmp; otmp = otmp2) { for (otmp = g.level.objects[x][y]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere; otmp2 = otmp->nexthere;
if (otmp->otyp == CORPSE if (otmp->otyp == CORPSE
&& (is_rider(&mons[otmp->corpsenm]) && (is_rider(&mons[otmp->corpsenm])
@@ -108,7 +108,7 @@ moverock()
sx = u.ux + u.dx, sy = u.uy + u.dy; /* boulder starting position */ sx = u.ux + u.dx, sy = u.uy + u.dy; /* boulder starting position */
while ((otmp = sobj_at(BOULDER, sx, sy)) != 0) { while ((otmp = sobj_at(BOULDER, sx, sy)) != 0) {
/* make sure that this boulder is visible as the top object */ /* make sure that this boulder is visible as the top object */
if (otmp != level.objects[sx][sy]) if (otmp != g.level.objects[sx][sy])
movobj(otmp, sx, sy); movobj(otmp, sx, sy);
rx = u.ux + 2 * u.dx; /* boulder destination position */ rx = u.ux + 2 * u.dx; /* boulder destination position */
@@ -462,9 +462,9 @@ xchar x, y;
dmgtxt = "damage"; dmgtxt = "damage";
} }
digtxt = "chew a hole in the wall."; digtxt = "chew a hole in the wall.";
if (level.flags.is_maze_lev) { if (g.level.flags.is_maze_lev) {
lev->typ = ROOM; lev->typ = ROOM;
} else if (level.flags.is_cavernous_lev && !in_town(x, y)) { } else if (g.level.flags.is_cavernous_lev && !in_town(x, y)) {
lev->typ = CORR; lev->typ = CORR;
} else { } else {
lev->typ = DOOR; lev->typ = DOOR;
@@ -560,7 +560,7 @@ dosinkfall()
losehp(Maybe_Half_Phys(dmg), fell_on_sink, NO_KILLER_PREFIX); losehp(Maybe_Half_Phys(dmg), fell_on_sink, NO_KILLER_PREFIX);
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
selftouch("Falling, you"); selftouch("Falling, you");
for (obj = level.objects[u.ux][u.uy]; obj; obj = obj->nexthere) for (obj = g.level.objects[u.ux][u.uy]; obj; obj = obj->nexthere)
if (obj->oclass == WEAPON_CLASS || is_weptool(obj)) { if (obj->oclass == WEAPON_CLASS || is_weptool(obj)) {
You("fell on %s.", doname(obj)); You("fell on %s.", doname(obj));
losehp(Maybe_Half_Phys(rnd(3)), fell_on_sink, losehp(Maybe_Half_Phys(rnd(3)), fell_on_sink,
@@ -2239,7 +2239,7 @@ register int typewanted;
#define goodtype(rno) \ #define goodtype(rno) \
(!typewanted \ (!typewanted \
|| (typefound = rooms[rno - ROOMOFFSET].rtype) == typewanted \ || (typefound = g.rooms[rno - ROOMOFFSET].rtype) == typewanted \
|| (typewanted == SHOPBASE && typefound > SHOPBASE)) || (typewanted == SHOPBASE && typefound > SHOPBASE))
switch (rno = levl[x][y].roomno) { switch (rno = levl[x][y].roomno) {
@@ -2310,7 +2310,7 @@ register int x, y;
* See if (x,y) is in a room with subrooms, if so, assume it's the * See if (x,y) is in a room with subrooms, if so, assume it's the
* town. If there are no subrooms, the whole level is in town. * town. If there are no subrooms, the whole level is in town.
*/ */
for (sroom = &rooms[0]; sroom->hx > 0; sroom++) { for (sroom = &g.rooms[0]; sroom->hx > 0; sroom++) {
if (sroom->nsubrooms > 0) { if (sroom->nsubrooms > 0) {
has_subrooms = TRUE; has_subrooms = TRUE;
if (inside_room(sroom, x, y)) if (inside_room(sroom, x, y))
@@ -2382,7 +2382,7 @@ register boolean newlev;
u_entered_shop(u.ushops_entered); u_entered_shop(u.ushops_entered);
for (ptr = &u.uentered[0]; *ptr; ptr++) { for (ptr = &u.uentered[0]; *ptr; ptr++) {
int roomno = *ptr - ROOMOFFSET, rt = rooms[roomno].rtype; int roomno = *ptr - ROOMOFFSET, rt = g.rooms[roomno].rtype;
boolean msg_given = TRUE; boolean msg_given = TRUE;
/* Did we just enter some other special room? */ /* Did we just enter some other special room? */
@@ -2452,30 +2452,30 @@ register boolean newlev;
room_discovered(roomno); room_discovered(roomno);
if (rt != 0) { if (rt != 0) {
rooms[roomno].rtype = OROOM; g.rooms[roomno].rtype = OROOM;
if (!search_special(rt)) { if (!search_special(rt)) {
/* No more room of that type */ /* No more room of that type */
switch (rt) { switch (rt) {
case COURT: case COURT:
level.flags.has_court = 0; g.level.flags.has_court = 0;
break; break;
case SWAMP: case SWAMP:
level.flags.has_swamp = 0; g.level.flags.has_swamp = 0;
break; break;
case MORGUE: case MORGUE:
level.flags.has_morgue = 0; g.level.flags.has_morgue = 0;
break; break;
case ZOO: case ZOO:
level.flags.has_zoo = 0; g.level.flags.has_zoo = 0;
break; break;
case BARRACKS: case BARRACKS:
level.flags.has_barracks = 0; g.level.flags.has_barracks = 0;
break; break;
case TEMPLE: case TEMPLE:
level.flags.has_temple = 0; g.level.flags.has_temple = 0;
break; break;
case BEEHIVE: case BEEHIVE:
level.flags.has_beehive = 0; g.level.flags.has_beehive = 0;
break; break;
} }
} }
@@ -2915,9 +2915,9 @@ boolean k_format;
context.travel = context.travel1 = context.mv = context.run = 0; context.travel = context.travel1 = context.mv = context.run = 0;
context.botl = 1; context.botl = 1;
if (u.uhp < 1) { if (u.uhp < 1) {
killer.format = k_format; g.killer.format = k_format;
if (killer.name != knam) /* the thing that killed you */ if (g.killer.name != knam) /* the thing that killed you */
Strcpy(killer.name, knam ? knam : ""); Strcpy(g.killer.name, knam ? knam : "");
You("die..."); You("die...");
done(DIED); done(DIED);
} else if (n > 0 && u.uhp * 10 < u.uhpmax) { } else if (n > 0 && u.uhp * 10 < u.uhpmax) {
+8 -8
View File
@@ -1121,7 +1121,7 @@ int x, y;
{ {
struct obj *otmp, *otmp2; struct obj *otmp, *otmp2;
for (otmp = level.objects[x][y]; otmp; otmp = otmp2) { for (otmp = g.level.objects[x][y]; otmp; otmp = otmp2) {
if (otmp == uball) if (otmp == uball)
unpunish(); unpunish();
/* after unpunish(), or might get deallocated chain */ /* after unpunish(), or might get deallocated chain */
@@ -1165,7 +1165,7 @@ int x, y;
{ {
register struct obj *otmp; register struct obj *otmp;
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (otmp->otyp == otyp) if (otmp->otyp == otyp)
break; break;
@@ -1289,7 +1289,7 @@ int x, y;
{ {
register struct obj *otmp; register struct obj *otmp;
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (obj == otmp) if (obj == otmp)
return TRUE; return TRUE;
return FALSE; return FALSE;
@@ -1299,7 +1299,7 @@ struct obj *
g_at(x, y) g_at(x, y)
register int x, y; register int x, y;
{ {
register struct obj *obj = level.objects[x][y]; register struct obj *obj = g.level.objects[x][y];
while (obj) { while (obj) {
if (obj->oclass == COIN_CLASS) if (obj->oclass == COIN_CLASS)
@@ -3328,7 +3328,7 @@ boolean picked_some;
There("is %s here.", There("is %s here.",
an(defsyms[trap_to_defsym(trap->ttyp)].explanation)); an(defsyms[trap_to_defsym(trap->ttyp)].explanation));
otmp = level.objects[u.ux][u.uy]; otmp = g.level.objects[u.ux][u.uy];
dfeature = dfeature_at(u.ux, u.uy, fbuf2); dfeature = dfeature_at(u.ux, u.uy, fbuf2);
if (dfeature && !strcmp(dfeature, "pool of water") && Underwater) if (dfeature && !strcmp(dfeature, "pool of water") && Underwater)
dfeature = 0; dfeature = 0;
@@ -3497,7 +3497,7 @@ struct obj *obj;
{ {
struct obj *otmp; struct obj *otmp;
for (otmp = level.objects[obj->ox][obj->oy]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[obj->ox][obj->oy]; otmp; otmp = otmp->nexthere)
if (otmp != obj && merged(&obj, &otmp)) if (otmp != obj && merged(&obj, &otmp))
break; break;
return; return;
@@ -4316,7 +4316,7 @@ boolean as_if_seen;
int n; int n;
/* count # of objects here */ /* count # of objects here */
for (n = 0, obj = level.buriedobjlist; obj; obj = obj->nobj) for (n = 0, obj = g.level.buriedobjlist; obj; obj = obj->nobj)
if (obj->ox == x && obj->oy == y) { if (obj->ox == x && obj->oy == y) {
if (as_if_seen) if (as_if_seen)
obj->dknown = 1; obj->dknown = 1;
@@ -4327,7 +4327,7 @@ boolean as_if_seen;
g.only.x = x; g.only.x = x;
g.only.y = y; g.only.y = y;
if (query_objlist("Things that are buried here:", if (query_objlist("Things that are buried here:",
&level.buriedobjlist, INVORDER_SORT, &g.level.buriedobjlist, INVORDER_SORT,
&selected, PICK_NONE, only_here) > 0) &selected, PICK_NONE, only_here) > 0)
free((genericptr_t) selected); free((genericptr_t) selected);
g.only.x = g.only.y = 0; g.only.x = g.only.y = 0;
+2 -2
View File
@@ -353,7 +353,7 @@ struct obj *pick;
count = 0; count = 0;
c = 'n'; /* in case there are no boxes here */ c = 'n'; /* in case there are no boxes here */
for (otmp = level.objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) { if (Is_box(otmp)) {
++count; ++count;
if (!can_reach_floor(TRUE)) { if (!can_reach_floor(TRUE)) {
@@ -538,7 +538,7 @@ doforce()
/* A lock is made only for the honest man, the thief will break it. */ /* A lock is made only for the honest man, the thief will break it. */
g.xlock.box = (struct obj *) 0; g.xlock.box = (struct obj *) 0;
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) { if (Is_box(otmp)) {
if (otmp->obroken || !otmp->olocked) { if (otmp->obroken || !otmp->olocked) {
/* force doname() to omit known "broken" or "unlocked" /* force doname() to omit known "broken" or "unlocked"
+4 -4
View File
@@ -1697,7 +1697,7 @@ aligntyp atyp;
against picking the next demon resulted in incubus against picking the next demon resulted in incubus
being picked nearly twice as often as sucubus); being picked nearly twice as often as sucubus);
we need the '+1' in case the entire set is too high we need the '+1' in case the entire set is too high
level (really low level hero) */ level (really low g.level hero) */
nums[last] = k + 1 - (adj_lev(&mons[last]) > (u.ulevel * 2)); nums[last] = k + 1 - (adj_lev(&mons[last]) > (u.ulevel * 2));
num += nums[last]; num += nums[last];
} }
@@ -2139,7 +2139,7 @@ register struct monst *mtmp;
/* only valid for INSIDE of room */ /* only valid for INSIDE of room */
roomno = levl[mx][my].roomno - ROOMOFFSET; roomno = levl[mx][my].roomno - ROOMOFFSET;
if (roomno >= 0) if (roomno >= 0)
rt = rooms[roomno].rtype; rt = g.rooms[roomno].rtype;
#ifdef SPECIALIZATION #ifdef SPECIALIZATION
else if (IS_ROOM(typ)) else if (IS_ROOM(typ))
rt = OROOM, roomno = 0; rt = OROOM, roomno = 0;
@@ -2149,7 +2149,7 @@ register struct monst *mtmp;
if (OBJ_AT(mx, my)) { if (OBJ_AT(mx, my)) {
ap_type = M_AP_OBJECT; ap_type = M_AP_OBJECT;
appear = level.objects[mx][my]->otyp; appear = g.level.objects[mx][my]->otyp;
} else if (IS_DOOR(typ) || IS_WALL(typ) || typ == SDOOR || typ == SCORR) { } else if (IS_DOOR(typ) || IS_WALL(typ) || typ == SDOOR || typ == SCORR) {
ap_type = M_AP_FURNITURE; ap_type = M_AP_FURNITURE;
/* /*
@@ -2169,7 +2169,7 @@ register struct monst *mtmp;
appear = Is_rogue_level(&u.uz) ? S_hwall : S_hcdoor; appear = Is_rogue_level(&u.uz) ? S_hwall : S_hcdoor;
else else
appear = Is_rogue_level(&u.uz) ? S_vwall : S_vcdoor; appear = Is_rogue_level(&u.uz) ? S_vwall : S_vcdoor;
} else if (level.flags.is_maze_lev && !In_sokoban(&u.uz) && rn2(2)) { } else if (g.level.flags.is_maze_lev && !In_sokoban(&u.uz) && rn2(2)) {
ap_type = M_AP_OBJECT; ap_type = M_AP_OBJECT;
appear = STATUE; appear = STATUE;
} else if (roomno < 0 && !t_at(mx, my)) { } else if (roomno < 0 && !t_at(mx, my)) {
+2 -2
View File
@@ -54,8 +54,8 @@ static const int explcolors[] = {
(g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM)) (g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM))
#endif #endif
#define is_objpile(x,y) (!Hallucination && level.objects[(x)][(y)] \ #define is_objpile(x,y) (!Hallucination && g.level.objects[(x)][(y)] \
&& level.objects[(x)][(y)]->nexthere) && g.level.objects[(x)][(y)]->nexthere)
/*ARGSUSED*/ /*ARGSUSED*/
int int
+2 -2
View File
@@ -366,8 +366,8 @@ int spellnum;
if (Hallucination) { if (Hallucination) {
You("have an out of body experience."); You("have an out of body experience.");
} else { } else {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "touch of death"); Strcpy(g.killer.name, "touch of death");
done(DIED); done(DIED);
} }
} else { } else {
+9 -9
View File
@@ -469,7 +469,7 @@ register struct monst *mtmp;
* parallelism to work, we can't rephrase it, so we * parallelism to work, we can't rephrase it, so we
* zap the "laid by you" momentarily instead. * zap the "laid by you" momentarily instead.
*/ */
struct obj *obj = level.objects[u.ux][u.uy]; struct obj *obj = g.level.objects[u.ux][u.uy];
if (obj || u.umonnum == PM_TRAPPER if (obj || u.umonnum == PM_TRAPPER
|| (youmonst.data->mlet == S_EEL || (youmonst.data->mlet == S_EEL
@@ -492,7 +492,7 @@ register struct monst *mtmp;
pline( pline(
"Wait, %s! There's a %s named %s hiding under %s!", "Wait, %s! There's a %s named %s hiding under %s!",
m_monnam(mtmp), youmonst.data->mname, g.plname, m_monnam(mtmp), youmonst.data->mname, g.plname,
doname(level.objects[u.ux][u.uy])); doname(g.level.objects[u.ux][u.uy]));
if (obj) if (obj)
obj->spe = save_spe; obj->spe = save_spe;
} else } else
@@ -921,7 +921,7 @@ register struct attack *mattk;
struct obj *obj; struct obj *obj;
const char *what; const char *what;
if ((obj = level.objects[mtmp->mx][mtmp->my]) != 0) { if ((obj = g.level.objects[mtmp->mx][mtmp->my]) != 0) {
if (Blind && !obj->dknown) if (Blind && !obj->dknown)
what = something; what = something;
else if (is_pool(mtmp->mx, mtmp->my) && !Underwater) else if (is_pool(mtmp->mx, mtmp->my) && !Underwater)
@@ -1272,8 +1272,8 @@ register struct attack *mattk;
&& !Is_waterlevel(&u.uz); && !Is_waterlevel(&u.uz);
pline("%s drowns you...", Monnam(mtmp)); pline("%s drowns you...", Monnam(mtmp));
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Sprintf(killer.name, "%s by %s", Sprintf(g.killer.name, "%s by %s",
moat ? "moat" : "pool of water", moat ? "moat" : "pool of water",
an(mtmp->data->mname)); an(mtmp->data->mname));
done(DROWNING); done(DROWNING);
@@ -1546,8 +1546,8 @@ register struct attack *mattk;
case 18: case 18:
case 17: case 17:
if (!Antimagic) { if (!Antimagic) {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "touch of death"); Strcpy(g.killer.name, "touch of death");
done(DIED); done(DIED);
dmg = 0; dmg = 0;
break; break;
@@ -2152,8 +2152,8 @@ struct attack *mattk;
if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
break; break;
You("turn to stone..."); You("turn to stone...");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, mtmp->data->mname); Strcpy(g.killer.name, mtmp->data->mname);
done(STONING); done(STONING);
} }
break; break;
+75 -75
View File
@@ -97,10 +97,10 @@ void
sort_rooms() sort_rooms()
{ {
#if defined(SYSV) || defined(DGUX) #if defined(SYSV) || defined(DGUX)
qsort((genericptr_t) rooms, (unsigned) g.nroom, sizeof(struct mkroom), qsort((genericptr_t) g.rooms, (unsigned) g.nroom, sizeof(struct mkroom),
do_comp); do_comp);
#else #else
qsort((genericptr_t) rooms, g.nroom, sizeof(struct mkroom), do_comp); qsort((genericptr_t) g.rooms, g.nroom, sizeof(struct mkroom), do_comp);
#endif #endif
} }
@@ -189,7 +189,7 @@ boolean special;
{ {
register struct mkroom *croom; register struct mkroom *croom;
croom = &rooms[g.nroom]; croom = &g.rooms[g.nroom];
do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special, do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special,
(boolean) TRUE); (boolean) TRUE);
croom++; croom++;
@@ -207,7 +207,7 @@ boolean special;
{ {
register struct mkroom *croom; register struct mkroom *croom;
croom = &subrooms[g.nsubroom]; croom = &g.subrooms[g.nsubroom];
do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special, do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special,
(boolean) FALSE); (boolean) FALSE);
proom->sbrooms[proom->nsubrooms++] = croom; proom->sbrooms[proom->nsubrooms++] = croom;
@@ -227,9 +227,9 @@ makerooms()
if (g.nroom >= (MAXNROFROOMS / 6) && rn2(2) && !tried_vault) { if (g.nroom >= (MAXNROFROOMS / 6) && rn2(2) && !tried_vault) {
tried_vault = TRUE; tried_vault = TRUE;
if (create_vault()) { if (create_vault()) {
g.vault_x = rooms[g.nroom].lx; g.vault_x = g.rooms[g.nroom].lx;
g.vault_y = rooms[g.nroom].ly; g.vault_y = g.rooms[g.nroom].ly;
rooms[g.nroom].hx = -1; g.rooms[g.nroom].hx = -1;
} }
} else if (!create_room(-1, -1, -1, -1, -1, -1, OROOM, -1)) } else if (!create_room(-1, -1, -1, -1, -1, -1, OROOM, -1))
return; return;
@@ -247,8 +247,8 @@ boolean nxcor;
register struct mkroom *croom, *troom; register struct mkroom *croom, *troom;
register int dx, dy; register int dx, dy;
croom = &rooms[a]; croom = &g.rooms[a];
troom = &rooms[b]; troom = &g.rooms[b];
/* find positions cc and tt for doors in croom and troom /* find positions cc and tt for doors in croom and troom
and direction for a corridor between them */ and direction for a corridor between them */
@@ -298,7 +298,7 @@ boolean nxcor;
dest.x = tx; dest.x = tx;
dest.y = ty; dest.y = ty;
if (!dig_corridor(&org, &dest, nxcor, level.flags.arboreal ? ROOM : CORR, if (!dig_corridor(&org, &dest, nxcor, g.level.flags.arboreal ? ROOM : CORR,
STONE)) STONE))
return; return;
@@ -362,12 +362,12 @@ register struct mkroom *aroom;
g.doors[tmp] = g.doors[tmp - 1]; g.doors[tmp] = g.doors[tmp - 1];
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
broom = &rooms[i]; broom = &g.rooms[i];
if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor) if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor)
broom->fdoor++; broom->fdoor++;
} }
for (i = 0; i < g.nsubroom; i++) { for (i = 0; i < g.nsubroom; i++) {
broom = &subrooms[i]; broom = &g.subrooms[i];
if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor) if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor)
broom->fdoor++; broom->fdoor++;
} }
@@ -412,7 +412,7 @@ int type;
} }
/* also done in roguecorr(); doing it here first prevents /* also done in roguecorr(); doing it here first prevents
making mimics in place of trapped doors on rogue level */ making mimics in place of trapped doors on rogue g.level */
if (Is_rogue_level(&u.uz)) if (Is_rogue_level(&u.uz))
levl[x][y].doormask = D_NODOOR; levl[x][y].doormask = D_NODOOR;
@@ -489,7 +489,7 @@ int trap_type;
if (g.doorindex < DOORMAX) { if (g.doorindex < DOORMAX) {
while (vct--) { while (vct--) {
aroom = &rooms[rn2(g.nroom)]; aroom = &g.rooms[rn2(g.nroom)];
if (aroom->rtype != OROOM) if (aroom->rtype != OROOM)
continue; /* not an ordinary room */ continue; /* not an ordinary room */
if (aroom->doorct == 1 && rn2(5)) if (aroom->doorct == 1 && rn2(5))
@@ -530,7 +530,7 @@ int trap_type;
mkclass(S_HUMAN, 0), xx, mkclass(S_HUMAN, 0), xx,
yy + dy, TRUE); yy + dy, TRUE);
} }
if (!level.flags.noteleport) if (!g.level.flags.noteleport)
(void) mksobj_at(SCR_TELEPORTATION, xx, yy + dy, TRUE, (void) mksobj_at(SCR_TELEPORTATION, xx, yy + dy, TRUE,
FALSE); FALSE);
if (!rn2(3)) if (!rn2(3))
@@ -546,7 +546,7 @@ STATIC_OVL void
make_niches() make_niches()
{ {
int ct = rnd((g.nroom >> 1) + 1), dep = depth(&u.uz); int ct = rnd((g.nroom >> 1) + 1), dep = depth(&u.uz);
boolean ltptr = (!level.flags.noteleport && dep > 15), boolean ltptr = (!g.level.flags.noteleport && dep > 15),
vamp = (dep > 5 && dep < 25); vamp = (dep > 5 && dep < 25);
while (ct--) { while (ct--) {
@@ -588,46 +588,46 @@ clear_level_structures()
* These used to be '#if MICROPORT_BUG', * These used to be '#if MICROPORT_BUG',
* with use of memset(0) for '#if !MICROPORT_BUG' below, * with use of memset(0) for '#if !MICROPORT_BUG' below,
* but memset is not appropriate for initializing pointers, * but memset is not appropriate for initializing pointers,
* so do these level.objects[][] and level.monsters[][] * so do these g.level.objects[][] and level.monsters[][]
* initializations unconditionally. * initializations unconditionally.
*/ */
level.objects[x][y] = (struct obj *) 0; g.level.objects[x][y] = (struct obj *) 0;
level.monsters[x][y] = (struct monst *) 0; g.level.monsters[x][y] = (struct monst *) 0;
} }
} }
level.objlist = (struct obj *) 0; g.level.objlist = (struct obj *) 0;
level.buriedobjlist = (struct obj *) 0; g.level.buriedobjlist = (struct obj *) 0;
level.monlist = (struct monst *) 0; g.level.monlist = (struct monst *) 0;
level.damagelist = (struct damage *) 0; g.level.damagelist = (struct damage *) 0;
level.bonesinfo = (struct cemetery *) 0; g.level.bonesinfo = (struct cemetery *) 0;
level.flags.nfountains = 0; g.level.flags.nfountains = 0;
level.flags.nsinks = 0; g.level.flags.nsinks = 0;
level.flags.has_shop = 0; g.level.flags.has_shop = 0;
level.flags.has_vault = 0; g.level.flags.has_vault = 0;
level.flags.has_zoo = 0; g.level.flags.has_zoo = 0;
level.flags.has_court = 0; g.level.flags.has_court = 0;
level.flags.has_morgue = level.flags.graveyard = 0; g.level.flags.has_morgue = g.level.flags.graveyard = 0;
level.flags.has_beehive = 0; g.level.flags.has_beehive = 0;
level.flags.has_barracks = 0; g.level.flags.has_barracks = 0;
level.flags.has_temple = 0; g.level.flags.has_temple = 0;
level.flags.has_swamp = 0; g.level.flags.has_swamp = 0;
level.flags.noteleport = 0; g.level.flags.noteleport = 0;
level.flags.hardfloor = 0; g.level.flags.hardfloor = 0;
level.flags.nommap = 0; g.level.flags.nommap = 0;
level.flags.hero_memory = 1; g.level.flags.hero_memory = 1;
level.flags.shortsighted = 0; g.level.flags.shortsighted = 0;
level.flags.sokoban_rules = 0; g.level.flags.sokoban_rules = 0;
level.flags.is_maze_lev = 0; g.level.flags.is_maze_lev = 0;
level.flags.is_cavernous_lev = 0; g.level.flags.is_cavernous_lev = 0;
level.flags.arboreal = 0; g.level.flags.arboreal = 0;
level.flags.wizard_bones = 0; g.level.flags.wizard_bones = 0;
level.flags.corrmaze = 0; g.level.flags.corrmaze = 0;
g.nroom = 0; g.nroom = 0;
rooms[0].hx = -1; g.rooms[0].hx = -1;
g.nsubroom = 0; g.nsubroom = 0;
subrooms[0].hx = -1; g.subrooms[0].hx = -1;
g.doorindex = 0; g.doorindex = 0;
init_rect(); init_rect();
init_vault(); init_vault();
@@ -696,12 +696,12 @@ makelevel()
sort_rooms(); sort_rooms();
/* construct stairs (up and down in different rooms if possible) */ /* construct stairs (up and down in different rooms if possible) */
croom = &rooms[rn2(g.nroom)]; croom = &g.rooms[rn2(g.nroom)];
if (!Is_botlevel(&u.uz)) if (!Is_botlevel(&u.uz))
mkstairs(somex(croom), somey(croom), 0, croom); /* down */ mkstairs(somex(croom), somey(croom), 0, croom); /* down */
if (g.nroom > 1) { if (g.nroom > 1) {
troom = croom; troom = croom;
croom = &rooms[rn2(g.nroom - 1)]; croom = &g.rooms[rn2(g.nroom - 1)];
if (croom == troom) if (croom == troom)
croom++; croom++;
} }
@@ -733,19 +733,19 @@ makelevel()
fill_vault: fill_vault:
add_room(g.vault_x, g.vault_y, g.vault_x + w, g.vault_y + h, TRUE, VAULT, add_room(g.vault_x, g.vault_y, g.vault_x + w, g.vault_y + h, TRUE, VAULT,
FALSE); FALSE);
level.flags.has_vault = 1; g.level.flags.has_vault = 1;
++room_threshold; ++room_threshold;
fill_room(&rooms[g.nroom - 1], FALSE); fill_room(&g.rooms[g.nroom - 1], FALSE);
mk_knox_portal(g.vault_x + w, g.vault_y + h); mk_knox_portal(g.vault_x + w, g.vault_y + h);
if (!level.flags.noteleport && !rn2(3)) if (!g.level.flags.noteleport && !rn2(3))
makevtele(); makevtele();
} else if (rnd_rect() && create_vault()) { } else if (rnd_rect() && create_vault()) {
g.vault_x = rooms[g.nroom].lx; g.vault_x = g.rooms[g.nroom].lx;
g.vault_y = rooms[g.nroom].ly; g.vault_y = g.rooms[g.nroom].ly;
if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE)) if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE))
goto fill_vault; goto fill_vault;
else else
rooms[g.nroom].hx = -1; g.rooms[g.nroom].hx = -1;
} }
} }
@@ -788,7 +788,7 @@ skip0:
place_branch(branchp, 0, 0); place_branch(branchp, 0, 0);
/* for each room: put things inside */ /* for each room: put things inside */
for (croom = rooms; croom->hx > 0; croom++) { for (croom = g.rooms; croom->hx > 0; croom++) {
if (croom->rtype != OROOM) if (croom->rtype != OROOM)
continue; continue;
@@ -905,7 +905,7 @@ boolean skip_lvl_checks;
almost all special levels are excluded */ almost all special levels are excluded */
if (!skip_lvl_checks if (!skip_lvl_checks
&& (In_hell(&u.uz) || In_V_tower(&u.uz) || Is_rogue_level(&u.uz) && (In_hell(&u.uz) || In_V_tower(&u.uz) || Is_rogue_level(&u.uz)
|| level.flags.arboreal || g.level.flags.arboreal
|| ((sp = Is_special(&u.uz)) != 0 && !Is_oracle_level(&u.uz) || ((sp = Is_special(&u.uz)) != 0 && !Is_oracle_level(&u.uz)
&& (!In_mines(&u.uz) || sp->flags.town)))) && (!In_mines(&u.uz) || sp->flags.town))))
return; return;
@@ -992,10 +992,10 @@ mklev()
/* has_morgue gets cleared once morgue is entered; graveyard stays /* has_morgue gets cleared once morgue is entered; graveyard stays
set (graveyard might already be set even when has_morgue is clear set (graveyard might already be set even when has_morgue is clear
[see fixup_special()], so don't update it unconditionally) */ [see fixup_special()], so don't update it unconditionally) */
if (level.flags.has_morgue) if (g.level.flags.has_morgue)
level.flags.graveyard = 1; g.level.flags.graveyard = 1;
if (!level.flags.is_maze_lev) { if (!g.level.flags.is_maze_lev) {
for (croom = &rooms[0]; croom != &rooms[g.nroom]; croom++) for (croom = &g.rooms[0]; croom != &g.rooms[g.nroom]; croom++)
#ifdef SPECIALIZATION #ifdef SPECIALIZATION
topologize(croom, FALSE); topologize(croom, FALSE);
#else #else
@@ -1003,10 +1003,10 @@ mklev()
#endif #endif
} }
set_wall_state(); set_wall_state();
/* for many room types, rooms[].rtype is zeroed once the room has been /* for many room types, g.rooms[].rtype is zeroed once the room has been
entered; rooms[].orig_rtype always retains original rtype value */ entered; g.rooms[].orig_rtype always retains original rtype value */
for (ridx = 0; ridx < SIZE(rooms); ridx++) for (ridx = 0; ridx < SIZE(g.rooms); ridx++)
rooms[ridx].orig_rtype = rooms[ridx].rtype; g.rooms[ridx].orig_rtype = g.rooms[ridx].rtype;
} }
void void
@@ -1019,7 +1019,7 @@ topologize(croom)
struct mkroom *croom; struct mkroom *croom;
#endif #endif
{ {
register int x, y, roomno = (int) ((croom - rooms) + ROOMOFFSET); register int x, y, roomno = (int) ((croom - g.rooms) + ROOMOFFSET);
int lowx = croom->lx, lowy = croom->ly; int lowx = croom->lx, lowy = croom->ly;
int hix = croom->hx, hiy = croom->hy; int hix = croom->hx, hiy = croom->hy;
#ifdef SPECIALIZATION #ifdef SPECIALIZATION
@@ -1065,7 +1065,7 @@ struct mkroom *croom;
levl[x][y].roomno = roomno; levl[x][y].roomno = roomno;
} }
} }
/* subrooms */ /* g.subrooms */
for (subindex = 0; subindex < nsubrooms; subindex++) for (subindex = 0; subindex < nsubrooms; subindex++)
#ifdef SPECIALIZATION #ifdef SPECIALIZATION
topologize(croom->sbrooms[subindex], (boolean) (rtype != OROOM)); topologize(croom->sbrooms[subindex], (boolean) (rtype != OROOM));
@@ -1089,11 +1089,11 @@ coord *mp;
int tryct = 0; int tryct = 0;
do do
croom = &rooms[rn2(g.nroom)]; croom = &g.rooms[rn2(g.nroom)];
while ((croom == g.dnstairs_room || croom == g.upstairs_room while ((croom == g.dnstairs_room || croom == g.upstairs_room
|| croom->rtype != OROOM) && (++tryct < 100)); || croom->rtype != OROOM) && (++tryct < 100));
} else } else
croom = &rooms[rn2(g.nroom)]; croom = &g.rooms[rn2(g.nroom)];
do { do {
if (!somexy(croom, mp)) if (!somexy(croom, mp))
@@ -1113,7 +1113,7 @@ xchar x, y;
int i; int i;
struct mkroom *curr; struct mkroom *curr;
for (curr = rooms, i = 0; i < g.nroom; curr++, i++) for (curr = g.rooms, i = 0; i < g.nroom; curr++, i++)
if (inside_room(curr, x, y)) if (inside_room(curr, x, y))
return curr; return curr;
; ;
@@ -1302,7 +1302,7 @@ coord *tm;
kind = NO_TRAP; kind = NO_TRAP;
break; break;
case LEVEL_TELEP: case LEVEL_TELEP:
if (lvl < 5 || level.flags.noteleport) if (lvl < 5 || g.level.flags.noteleport)
kind = NO_TRAP; kind = NO_TRAP;
break; break;
case SPIKED_PIT: case SPIKED_PIT:
@@ -1327,7 +1327,7 @@ coord *tm;
kind = NO_TRAP; kind = NO_TRAP;
break; break;
case TELEP_TRAP: case TELEP_TRAP:
if (level.flags.noteleport) if (g.level.flags.noteleport)
kind = NO_TRAP; kind = NO_TRAP;
break; break;
case HOLE: case HOLE:
@@ -1554,7 +1554,7 @@ struct mkroom *croom;
if (!rn2(7)) if (!rn2(7))
levl[m.x][m.y].blessedftn = 1; levl[m.x][m.y].blessedftn = 1;
level.flags.nfountains++; g.level.flags.nfountains++;
} }
STATIC_OVL void STATIC_OVL void
@@ -1574,7 +1574,7 @@ struct mkroom *croom;
/* Put a sink at m.x, m.y */ /* Put a sink at m.x, m.y */
levl[m.x][m.y].typ = SINK; levl[m.x][m.y].typ = SINK;
level.flags.nsinks++; g.level.flags.nsinks++;
} }
STATIC_OVL void STATIC_OVL void
+8 -8
View File
@@ -287,7 +287,7 @@ schar bg_typ, fg_typ;
if (g.n_loc_filled > 3) { if (g.n_loc_filled > 3) {
add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OROOM, add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OROOM,
TRUE); TRUE);
rooms[g.nroom - 1].irregular = TRUE; g.rooms[g.nroom - 1].irregular = TRUE;
if (g.nroom >= (MAXNROFROOMS * 2)) if (g.nroom >= (MAXNROFROOMS * 2))
goto joinm; goto joinm;
} else { } else {
@@ -313,7 +313,7 @@ joinm:
* so don't call sort_rooms(), which can screw up the roomno's * so don't call sort_rooms(), which can screw up the roomno's
* validity in the levl structure. * validity in the levl structure.
*/ */
for (croom = &rooms[0], croom2 = croom + 1; croom2 < &rooms[g.nroom];) { for (croom = &g.rooms[0], croom2 = croom + 1; croom2 < &g.rooms[g.nroom];) {
/* pick random starting and end locations for "corridor" */ /* pick random starting and end locations for "corridor" */
if (!somexy(croom, &sm) || !somexy(croom2, &em)) { if (!somexy(croom, &sm) || !somexy(croom2, &em)) {
/* ack! -- the level is going to be busted */ /* ack! -- the level is going to be busted */
@@ -357,7 +357,7 @@ boolean lit, walled, icedpools;
|| (walled && IS_WALL(levl[i][j].typ))) || (walled && IS_WALL(levl[i][j].typ)))
levl[i][j].lit = TRUE; levl[i][j].lit = TRUE;
for (i = 0; i < g.nroom; i++) for (i = 0; i < g.nroom; i++)
rooms[i].rlit = 1; g.rooms[i].rlit = 1;
} }
/* light lava even if everything's otherwise unlit; /* light lava even if everything's otherwise unlit;
ice might be frozen pool rather than frozen moat */ ice might be frozen pool rather than frozen moat */
@@ -387,7 +387,7 @@ int lx, ly, hx, hy;
struct mkroom *croom; struct mkroom *croom;
for (i = g.nroom - 1; i >= 0; --i) { for (i = g.nroom - 1; i >= 0; --i) {
croom = &rooms[i]; croom = &g.rooms[i];
if (croom->hx < lx || croom->lx >= hx || croom->hy < ly if (croom->hx < lx || croom->lx >= hx || croom->hy < ly
|| croom->ly >= hy) || croom->ly >= hy)
continue; /* no overlap */ continue; /* no overlap */
@@ -415,8 +415,8 @@ STATIC_OVL void
remove_room(roomno) remove_room(roomno)
unsigned roomno; unsigned roomno;
{ {
struct mkroom *croom = &rooms[roomno]; struct mkroom *croom = &g.rooms[roomno];
struct mkroom *maxroom = &rooms[--g.nroom]; struct mkroom *maxroom = &g.rooms[--g.nroom];
int i, j; int i, j;
unsigned oroomno; unsigned oroomno;
@@ -478,8 +478,8 @@ lev_init *init_lev;
init_lev->icedpools); init_lev->icedpools);
/* a walled, joined level is cavernous, not mazelike -dlc */ /* a walled, joined level is cavernous, not mazelike -dlc */
if (walled && join) { if (walled && join) {
level.flags.is_maze_lev = FALSE; g.level.flags.is_maze_lev = FALSE;
level.flags.is_cavernous_lev = TRUE; g.level.flags.is_cavernous_lev = TRUE;
} }
free(g.new_locations); free(g.new_locations);
} }
+20 -20
View File
@@ -258,7 +258,7 @@ xchar lx, ly, hx, hy;
{ {
return (boolean) (occupied(x, y) return (boolean) (occupied(x, y)
|| within_bounded_area(x, y, lx, ly, hx, hy) || within_bounded_area(x, y, lx, ly, hx, hy)
|| !((levl[x][y].typ == CORR && level.flags.is_maze_lev) || !((levl[x][y].typ == CORR && g.level.flags.is_maze_lev)
|| levl[x][y].typ == ROOM || levl[x][y].typ == ROOM
|| levl[x][y].typ == AIR)); || levl[x][y].typ == AIR));
} }
@@ -467,7 +467,7 @@ fixup_special()
unsetup_waterlevel(); unsetup_waterlevel();
} }
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) { if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) {
level.flags.hero_memory = 0; g.level.flags.hero_memory = 0;
g.was_waterlevel = TRUE; g.was_waterlevel = TRUE;
/* water level is an odd beast - it has to be set up /* water level is an odd beast - it has to be set up
before calling place_lregions etc. */ before calling place_lregions etc. */
@@ -540,7 +540,7 @@ fixup_special()
struct obj *otmp; struct obj *otmp;
int tryct; int tryct;
croom = &rooms[0]; /* only one room on the medusa level */ croom = &g.rooms[0]; /* only one room on the medusa level */
for (tryct = rnd(4); tryct; tryct--) { for (tryct = rnd(4); tryct; tryct--) {
x = somex(croom); x = somex(croom);
y = somey(croom); y = somey(croom);
@@ -576,7 +576,7 @@ fixup_special()
/* using an unfilled morgue for rm id */ /* using an unfilled morgue for rm id */
croom = search_special(MORGUE); croom = search_special(MORGUE);
/* avoid inappropriate morgue-related messages */ /* avoid inappropriate morgue-related messages */
level.flags.graveyard = level.flags.has_morgue = 0; g.level.flags.graveyard = g.level.flags.has_morgue = 0;
croom->rtype = OROOM; /* perhaps it should be set to VAULT? */ croom->rtype = OROOM; /* perhaps it should be set to VAULT? */
/* stock the main vault */ /* stock the main vault */
for (x = croom->lx; x <= croom->hx; x++) for (x = croom->lx; x <= croom->hx; x++)
@@ -587,9 +587,9 @@ fixup_special()
} }
} else if (Role_if(PM_PRIEST) && In_quest(&u.uz)) { } else if (Role_if(PM_PRIEST) && In_quest(&u.uz)) {
/* less chance for undead corpses (lured from lower morgues) */ /* less chance for undead corpses (lured from lower morgues) */
level.flags.graveyard = 1; g.level.flags.graveyard = 1;
} else if (Is_stronghold(&u.uz)) { } else if (Is_stronghold(&u.uz)) {
level.flags.graveyard = 1; g.level.flags.graveyard = 1;
} else if (Is_sanctum(&u.uz)) { } else if (Is_sanctum(&u.uz)) {
croom = search_special(TEMPLE); croom = search_special(TEMPLE);
@@ -884,7 +884,7 @@ int wallthick;
rdx = (g.x_maze_max / scale); rdx = (g.x_maze_max / scale);
rdy = (g.y_maze_max / scale); rdy = (g.y_maze_max / scale);
if (level.flags.corrmaze) if (g.level.flags.corrmaze)
for (x = 2; x < (rdx * 2); x++) for (x = 2; x < (rdx * 2); x++)
for (y = 2; y < (rdy * 2); y++) for (y = 2; y < (rdy * 2); y++)
levl[x][y].typ = STONE; levl[x][y].typ = STONE;
@@ -902,7 +902,7 @@ int wallthick;
walkfrom((int) mm.x, (int) mm.y, 0); walkfrom((int) mm.x, (int) mm.y, 0);
if (!rn2(5)) if (!rn2(5))
maze_remove_deadends((level.flags.corrmaze) ? CORR : ROOM); maze_remove_deadends((g.level.flags.corrmaze) ? CORR : ROOM);
/* restore bounds */ /* restore bounds */
g.x_maze_max = tmp_xmax; g.x_maze_max = tmp_xmax;
@@ -1015,8 +1015,8 @@ const char *s;
impossible("Couldn't load \"%s\" - making a maze.", protofile); impossible("Couldn't load \"%s\" - making a maze.", protofile);
} }
level.flags.is_maze_lev = TRUE; g.level.flags.is_maze_lev = TRUE;
level.flags.corrmaze = !rn2(3); g.level.flags.corrmaze = !rn2(3);
if (!Invocation_lev(&u.uz) && rn2(2)) { if (!Invocation_lev(&u.uz) && rn2(2)) {
int corrscale = rnd(4); int corrscale = rnd(4);
@@ -1025,7 +1025,7 @@ const char *s;
create_maze(1,1); create_maze(1,1);
} }
if (!level.flags.corrmaze) if (!g.level.flags.corrmaze)
wallification(2, 2, g.x_maze_max, g.y_maze_max); wallification(2, 2, g.x_maze_max, g.y_maze_max);
mazexy(&mm); mazexy(&mm);
@@ -1121,7 +1121,7 @@ schar typ;
int dirs[4]; int dirs[4];
if (!typ) { if (!typ) {
if (level.flags.corrmaze) if (g.level.flags.corrmaze)
typ = CORR; typ = CORR;
else else
typ = ROOM; typ = ROOM;
@@ -1168,7 +1168,7 @@ schar typ;
int dirs[4]; int dirs[4];
if (!typ) { if (!typ) {
if (level.flags.corrmaze) if (g.level.flags.corrmaze)
typ = CORR; typ = CORR;
else else
typ = ROOM; typ = ROOM;
@@ -1210,7 +1210,7 @@ coord *cc;
cpt++; cpt++;
} while (cpt < 100 } while (cpt < 100
&& levl[cc->x][cc->y].typ && levl[cc->x][cc->y].typ
!= (level.flags.corrmaze ? CORR : ROOM)); != (g.level.flags.corrmaze ? CORR : ROOM));
if (cpt >= 100) { if (cpt >= 100) {
int x, y; int x, y;
@@ -1220,7 +1220,7 @@ coord *cc;
cc->x = x; cc->x = x;
cc->y = y; cc->y = y;
if (levl[cc->x][cc->y].typ if (levl[cc->x][cc->y].typ
== (level.flags.corrmaze ? CORR : ROOM)) == (g.level.flags.corrmaze ? CORR : ROOM))
return; return;
} }
panic("mazexy: can't find a place!"); panic("mazexy: can't find a place!");
@@ -1262,7 +1262,7 @@ bound_digging()
} }
} }
} }
xmin -= (nonwall || !level.flags.is_maze_lev) ? 2 : 1; xmin -= (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
if (xmin < 0) if (xmin < 0)
xmin = 0; xmin = 0;
@@ -1278,7 +1278,7 @@ bound_digging()
} }
} }
} }
xmax += (nonwall || !level.flags.is_maze_lev) ? 2 : 1; xmax += (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
if (xmax >= COLNO) if (xmax >= COLNO)
xmax = COLNO - 1; xmax = COLNO - 1;
@@ -1294,7 +1294,7 @@ bound_digging()
} }
} }
} }
ymin -= (nonwall || !level.flags.is_maze_lev) ? 2 : 1; ymin -= (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
found = nonwall = FALSE; found = nonwall = FALSE;
for (ymax = ROWNO - 1; !found && ymax >= 0; ymax--) { for (ymax = ROWNO - 1; !found && ymax >= 0; ymax--) {
@@ -1308,7 +1308,7 @@ bound_digging()
} }
} }
} }
ymax += (nonwall || !level.flags.is_maze_lev) ? 2 : 1; ymax += (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) for (y = 0; y < ROWNO; y++)
@@ -1426,7 +1426,7 @@ movebubbles()
(struct container *) alloc( (struct container *) alloc(
sizeof(struct container)); sizeof(struct container));
while ((otmp = level.objects[x][y]) != 0) { while ((otmp = g.level.objects[x][y]) != 0) {
remove_object(otmp); remove_object(otmp);
otmp->ox = otmp->oy = 0; otmp->ox = otmp->oy = 0;
otmp->nexthere = olist; otmp->nexthere = olist;
+13 -13
View File
@@ -589,7 +589,7 @@ struct obj *otmp;
obj->nobj = otmp; obj->nobj = otmp;
obj->nexthere = otmp; obj->nexthere = otmp;
extract_nobj(obj, &fobj); extract_nobj(obj, &fobj);
extract_nexthere(obj, &level.objects[obj->ox][obj->oy]); extract_nexthere(obj, &g.level.objects[obj->ox][obj->oy]);
break; break;
default: default:
panic("replace_object: obj position"); panic("replace_object: obj position");
@@ -810,7 +810,7 @@ boolean artif;
&& (--tryct > 0)); && (--tryct > 0));
if (tryct == 0) { if (tryct == 0) {
/* perhaps rndmonnum() only wants to make G_NOCORPSE /* perhaps rndmonnum() only wants to make G_NOCORPSE
monsters on this level; create an adventurer's monsters on this g.level; create an adventurer's
corpse instead, then */ corpse instead, then */
otmp->corpsenm = PM_HUMAN; otmp->corpsenm = PM_HUMAN;
} }
@@ -1691,7 +1691,7 @@ register struct obj *otmp;
} }
/* /*
* These routines maintain the single-linked lists headed in level.objects[][] * These routines maintain the single-linked lists headed in g.level.objects[][]
* and threaded through the nexthere fields in the object-instance structure. * and threaded through the nexthere fields in the object-instance structure.
*/ */
@@ -1701,7 +1701,7 @@ place_object(otmp, x, y)
register struct obj *otmp; register struct obj *otmp;
int x, y; int x, y;
{ {
register struct obj *otmp2 = level.objects[x][y]; register struct obj *otmp2 = g.level.objects[x][y];
if (otmp->where != OBJ_FREE) if (otmp->where != OBJ_FREE)
panic("place_object: obj not free"); panic("place_object: obj not free");
@@ -1717,7 +1717,7 @@ int x, y;
otmp2->nexthere = otmp; otmp2->nexthere = otmp;
} else { } else {
otmp->nexthere = otmp2; otmp->nexthere = otmp2;
level.objects[x][y] = otmp; g.level.objects[x][y] = otmp;
} }
/* set the new object's location */ /* set the new object's location */
@@ -1745,12 +1745,12 @@ boolean do_buried;
{ {
struct obj *otmp; struct obj *otmp;
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) { for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere) {
if (otmp->timed) if (otmp->timed)
obj_timer_checks(otmp, x, y, 0); obj_timer_checks(otmp, x, y, 0);
} }
if (do_buried) { if (do_buried) {
for (otmp = level.buriedobjlist; otmp; otmp = otmp->nobj) { for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj) {
if (otmp->ox == x && otmp->oy == y) { if (otmp->ox == x && otmp->oy == y) {
if (otmp->timed) if (otmp->timed)
obj_timer_checks(otmp, x, y, 0); obj_timer_checks(otmp, x, y, 0);
@@ -1861,7 +1861,7 @@ register struct obj *otmp;
if (otmp->where != OBJ_FLOOR) if (otmp->where != OBJ_FLOOR)
panic("remove_object: obj not on floor"); panic("remove_object: obj not on floor");
extract_nexthere(otmp, &level.objects[x][y]); extract_nexthere(otmp, &g.level.objects[x][y]);
extract_nobj(otmp, &fobj); extract_nobj(otmp, &fobj);
/* update vision iff this was the only boulder at its spot */ /* update vision iff this was the only boulder at its spot */
if (otmp->otyp == BOULDER && !sobj_at(BOULDER, x, y)) if (otmp->otyp == BOULDER && !sobj_at(BOULDER, x, y))
@@ -1933,7 +1933,7 @@ struct obj *obj;
extract_nobj(obj, &migrating_objs); extract_nobj(obj, &migrating_objs);
break; break;
case OBJ_BURIED: case OBJ_BURIED:
extract_nobj(obj, &level.buriedobjlist); extract_nobj(obj, &g.level.buriedobjlist);
break; break;
case OBJ_ONBILL: case OBJ_ONBILL:
extract_nobj(obj, &billobjs); extract_nobj(obj, &billobjs);
@@ -2067,8 +2067,8 @@ struct obj *obj;
panic("add_to_buried: obj not free"); panic("add_to_buried: obj not free");
obj->where = OBJ_BURIED; obj->where = OBJ_BURIED;
obj->nobj = level.buriedobjlist; obj->nobj = g.level.buriedobjlist;
level.buriedobjlist = obj; g.level.buriedobjlist = obj;
} }
/* Recalculate the weight of this container and all of _its_ containers. */ /* Recalculate the weight of this container and all of _its_ containers. */
@@ -2229,7 +2229,7 @@ obj_sanity_check()
the floor list so container contents are skipped here */ the floor list so container contents are skipped here */
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) 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) {
/* <ox,oy> should match <x,y>; <0,*> should always be empty */ /* <ox,oy> should match <x,y>; <0,*> should always be empty */
if (obj->where != OBJ_FLOOR || x == 0 if (obj->where != OBJ_FLOOR || x == 0
|| obj->ox != x || obj->oy != y) { || obj->ox != x || obj->oy != y) {
@@ -2244,7 +2244,7 @@ obj_sanity_check()
objlist_sanity(invent, OBJ_INVENT, "invent sanity"); objlist_sanity(invent, OBJ_INVENT, "invent sanity");
objlist_sanity(migrating_objs, OBJ_MIGRATING, "migrating sanity"); objlist_sanity(migrating_objs, OBJ_MIGRATING, "migrating sanity");
objlist_sanity(level.buriedobjlist, OBJ_BURIED, "buried sanity"); objlist_sanity(g.level.buriedobjlist, OBJ_BURIED, "buried sanity");
objlist_sanity(billobjs, OBJ_ONBILL, "bill sanity"); objlist_sanity(billobjs, OBJ_ONBILL, "bill sanity");
mon_obj_sanity(fmon, "minvent sanity"); mon_obj_sanity(fmon, "minvent sanity");
+32 -32
View File
@@ -152,11 +152,11 @@ mkshop()
#ifndef MAC #ifndef MAC
gottype: gottype:
#endif #endif
for (sroom = &rooms[0];; sroom++) { for (sroom = &g.rooms[0];; sroom++) {
if (sroom->hx < 0) if (sroom->hx < 0)
return; return;
if (sroom - rooms >= g.nroom) { if (sroom - g.rooms >= g.nroom) {
pline("rooms not closed by -1?"); pline("g.rooms not closed by -1?");
return; return;
} }
if (sroom->rtype != OROOM) if (sroom->rtype != OROOM)
@@ -210,9 +210,9 @@ register boolean strict;
register struct mkroom *sroom; register struct mkroom *sroom;
register int i = g.nroom; register int i = g.nroom;
for (sroom = &rooms[rn2(g.nroom)]; i--; sroom++) { for (sroom = &g.rooms[rn2(g.nroom)]; i--; sroom++) {
if (sroom == &rooms[g.nroom]) if (sroom == &g.rooms[g.nroom])
sroom = &rooms[0]; sroom = &g.rooms[0];
if (sroom->hx < 0) if (sroom->hx < 0)
return (struct mkroom *) 0; return (struct mkroom *) 0;
if (sroom->rtype != OROOM) if (sroom->rtype != OROOM)
@@ -267,13 +267,13 @@ struct mkroom *sroom;
struct monst *mon; struct monst *mon;
register int sx, sy, i; register int sx, sy, i;
int sh, tx = 0, ty = 0, goldlim = 0, type = sroom->rtype; int sh, tx = 0, ty = 0, goldlim = 0, type = sroom->rtype;
int rmno = (int) ((sroom - rooms) + ROOMOFFSET); int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET);
coord mm; coord mm;
sh = sroom->fdoor; sh = sroom->fdoor;
switch (type) { switch (type) {
case COURT: case COURT:
if (level.flags.is_maze_lev) { if (g.level.flags.is_maze_lev) {
for (tx = sroom->lx; tx <= sroom->hx; tx++) for (tx = sroom->lx; tx <= sroom->hx; tx++)
for (ty = sroom->ly; ty <= sroom->hy; ty++) for (ty = sroom->ly; ty <= sroom->hy; ty++)
if (IS_THRONE(levl[tx][ty].typ)) if (IS_THRONE(levl[tx][ty].typ))
@@ -412,23 +412,23 @@ struct mkroom *sroom;
add_to_container(chest, gold); add_to_container(chest, gold);
chest->owt = weight(chest); chest->owt = weight(chest);
chest->spe = 2; /* so it can be found later */ chest->spe = 2; /* so it can be found later */
level.flags.has_court = 1; g.level.flags.has_court = 1;
break; break;
} }
case BARRACKS: case BARRACKS:
level.flags.has_barracks = 1; g.level.flags.has_barracks = 1;
break; break;
case ZOO: case ZOO:
level.flags.has_zoo = 1; g.level.flags.has_zoo = 1;
break; break;
case MORGUE: case MORGUE:
level.flags.has_morgue = 1; g.level.flags.has_morgue = 1;
break; break;
case SWAMP: case SWAMP:
level.flags.has_swamp = 1; g.level.flags.has_swamp = 1;
break; break;
case BEEHIVE: case BEEHIVE:
level.flags.has_beehive = 1; g.level.flags.has_beehive = 1;
break; break;
} }
} }
@@ -453,7 +453,7 @@ int mm_flags;
|| !revive(otmp, FALSE))) || !revive(otmp, FALSE)))
(void) makemon(mdat, cc.x, cc.y, mm_flags); (void) makemon(mdat, cc.x, cc.y, mm_flags);
} }
level.flags.graveyard = TRUE; /* reduced chance for undead corpse */ g.level.flags.graveyard = TRUE; /* reduced chance for undead corpse */
} }
STATIC_OVL struct permonst * STATIC_OVL struct permonst *
@@ -515,7 +515,7 @@ mkswamp() /* Michiel Huisjes & Fred de Wilde */
register int sx, sy, i, eelct = 0; register int sx, sy, i, eelct = 0;
for (i = 0; i < 5; i++) { /* turn up to 5 rooms swampy */ for (i = 0; i < 5; i++) { /* turn up to 5 rooms swampy */
sroom = &rooms[rn2(g.nroom)]; sroom = &g.rooms[rn2(g.nroom)];
if (sroom->hx < 0 || sroom->rtype != OROOM || has_upstairs(sroom) if (sroom->hx < 0 || sroom->rtype != OROOM || has_upstairs(sroom)
|| has_dnstairs(sroom)) || has_dnstairs(sroom))
continue; continue;
@@ -542,7 +542,7 @@ mkswamp() /* Michiel Huisjes & Fred de Wilde */
(void) makemon(mkclass(S_FUNGUS, 0), sx, sy, (void) makemon(mkclass(S_FUNGUS, 0), sx, sy,
NO_MM_FLAGS); NO_MM_FLAGS);
} }
level.flags.has_swamp = 1; g.level.flags.has_swamp = 1;
} }
} }
@@ -552,7 +552,7 @@ int roomno;
{ {
static coord buf; static coord buf;
int delta; int delta;
struct mkroom *troom = &rooms[roomno - ROOMOFFSET]; struct mkroom *troom = &g.rooms[roomno - ROOMOFFSET];
/* if width and height are odd, placement will be the exact center; /* if width and height are odd, placement will be the exact center;
if either or both are even, center point is a hypothetical spot if either or both are even, center point is a hypothetical spot
@@ -584,13 +584,13 @@ mktemple()
* In temples, shrines are blessed altars * In temples, shrines are blessed altars
* located in the center of the room * located in the center of the room
*/ */
shrine_spot = shrine_pos((int) ((sroom - rooms) + ROOMOFFSET)); shrine_spot = shrine_pos((int) ((sroom - g.rooms) + ROOMOFFSET));
lev = &levl[shrine_spot->x][shrine_spot->y]; lev = &levl[shrine_spot->x][shrine_spot->y];
lev->typ = ALTAR; lev->typ = ALTAR;
lev->altarmask = induced_align(80); lev->altarmask = induced_align(80);
priestini(&u.uz, sroom, shrine_spot->x, shrine_spot->y, FALSE); priestini(&u.uz, sroom, shrine_spot->x, shrine_spot->y, FALSE);
lev->altarmask |= AM_SHRINE; lev->altarmask |= AM_SHRINE;
level.flags.has_temple = 1; g.level.flags.has_temple = 1;
} }
boolean boolean
@@ -665,7 +665,7 @@ coord *c;
int i; int i;
if (croom->irregular) { if (croom->irregular) {
i = (int) ((croom - rooms) + ROOMOFFSET); i = (int) ((croom - g.rooms) + ROOMOFFSET);
while (try_cnt++ < 100) { while (try_cnt++ < 100) {
c->x = somex(croom); c->x = somex(croom);
@@ -719,12 +719,12 @@ schar type;
{ {
register struct mkroom *croom; register struct mkroom *croom;
for (croom = &rooms[0]; croom->hx >= 0; croom++) for (croom = &g.rooms[0]; croom->hx >= 0; croom++)
if ((type == ANY_TYPE && croom->rtype != OROOM) if ((type == ANY_TYPE && croom->rtype != OROOM)
|| (type == ANY_SHOP && croom->rtype >= SHOPBASE) || (type == ANY_SHOP && croom->rtype >= SHOPBASE)
|| croom->rtype == type) || croom->rtype == type)
return croom; return croom;
for (croom = &subrooms[0]; croom->hx >= 0; croom++) for (croom = &g.subrooms[0]; croom->hx >= 0; croom++)
if ((type == ANY_TYPE && croom->rtype != OROOM) if ((type == ANY_TYPE && croom->rtype != OROOM)
|| (type == ANY_SHOP && croom->rtype >= SHOPBASE) || (type == ANY_SHOP && croom->rtype >= SHOPBASE)
|| croom->rtype == type) || croom->rtype == type)
@@ -805,7 +805,7 @@ struct mkroom *r;
/* /*
* Well, I really should write only useful information instead * Well, I really should write only useful information instead
* of writing the whole structure. That is I should not write * of writing the whole structure. That is I should not write
* the subrooms pointers, but who cares ? * the g.subrooms pointers, but who cares ?
*/ */
bwrite(fd, (genericptr_t) r, sizeof (struct mkroom)); bwrite(fd, (genericptr_t) r, sizeof (struct mkroom));
for (i = 0; i < r->nsubrooms; i++) for (i = 0; i < r->nsubrooms; i++)
@@ -824,7 +824,7 @@ int fd;
/* First, write the number of rooms */ /* First, write the number of rooms */
bwrite(fd, (genericptr_t) &g.nroom, sizeof(g.nroom)); bwrite(fd, (genericptr_t) &g.nroom, sizeof(g.nroom));
for (i = 0; i < g.nroom; i++) for (i = 0; i < g.nroom; i++)
save_room(fd, &rooms[i]); save_room(fd, &g.rooms[i]);
} }
STATIC_OVL void STATIC_OVL void
@@ -836,9 +836,9 @@ struct mkroom *r;
mread(fd, (genericptr_t) r, sizeof(struct mkroom)); mread(fd, (genericptr_t) r, sizeof(struct mkroom));
for (i = 0; i < r->nsubrooms; i++) { for (i = 0; i < r->nsubrooms; i++) {
r->sbrooms[i] = &subrooms[g.nsubroom]; r->sbrooms[i] = &g.subrooms[g.nsubroom];
rest_room(fd, &subrooms[g.nsubroom]); rest_room(fd, &g.subrooms[g.nsubroom]);
subrooms[g.nsubroom++].resident = (struct monst *) 0; g.subrooms[g.nsubroom++].resident = (struct monst *) 0;
} }
} }
@@ -855,11 +855,11 @@ int fd;
mread(fd, (genericptr_t) &g.nroom, sizeof(g.nroom)); mread(fd, (genericptr_t) &g.nroom, sizeof(g.nroom));
g.nsubroom = 0; g.nsubroom = 0;
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
rest_room(fd, &rooms[i]); rest_room(fd, &g.rooms[i]);
rooms[i].resident = (struct monst *) 0; g.rooms[i].resident = (struct monst *) 0;
} }
rooms[g.nroom].hx = -1; /* restore ending flags */ g.rooms[g.nroom].hx = -1; /* restore ending flags */
subrooms[g.nsubroom].hx = -1; g.subrooms[g.nsubroom].hx = -1;
} }
/* convert a display symbol for terrain into topology type; /* convert a display symbol for terrain into topology type;
+16 -16
View File
@@ -30,7 +30,7 @@ STATIC_DCL void FDECL(lifesaved_monster, (struct monst *));
/* note: duplicated in dog.c */ /* note: duplicated in dog.c */
#define LEVEL_SPECIFIC_NOCORPSE(mdat) \ #define LEVEL_SPECIFIC_NOCORPSE(mdat) \
(Is_rogue_level(&u.uz) \ (Is_rogue_level(&u.uz) \
|| (level.flags.graveyard && is_undead(mdat) && rn2(3))) || (g.level.flags.graveyard && is_undead(mdat) && rn2(3)))
#if 0 #if 0
/* part of the original warning code which was replaced in 3.3.1 */ /* part of the original warning code which was replaced in 3.3.1 */
@@ -104,7 +104,7 @@ mon_sanity_check()
if (x != u.ux || y != u.uy) if (x != u.ux || y != u.uy)
impossible("steed (%s) claims to be at <%d,%d>?", impossible("steed (%s) claims to be at <%d,%d>?",
fmt_ptr((genericptr_t) mtmp), x, y); fmt_ptr((genericptr_t) mtmp), x, y);
} else if (level.monsters[x][y] != mtmp) { } else if (g.level.monsters[x][y] != mtmp) {
impossible("mon (%s) at <%d,%d> is not there!", impossible("mon (%s) at <%d,%d> is not there!",
fmt_ptr((genericptr_t) mtmp), x, y); fmt_ptr((genericptr_t) mtmp), x, y);
} else if (mtmp->wormno) { } else if (mtmp->wormno) {
@@ -114,7 +114,7 @@ mon_sanity_check()
for (x = 1; x < COLNO; x++) for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) for (y = 0; y < ROWNO; y++)
if ((mtmp = level.monsters[x][y]) != 0) { if ((mtmp = g.level.monsters[x][y]) != 0) {
for (m = fmon; m; m = m->nmon) for (m = fmon; m; m = m->nmon)
if (m == mtmp) if (m == mtmp)
break; break;
@@ -874,7 +874,7 @@ register struct monst *mtmp;
return 0; return 0;
/* Eats topmost metal object if it is there */ /* Eats topmost metal object if it is there */
for (otmp = level.objects[mtmp->mx][mtmp->my]; otmp; for (otmp = g.level.objects[mtmp->mx][mtmp->my]; otmp;
otmp = otmp->nexthere) { otmp = otmp->nexthere) {
/* Don't eat indigestible/choking/inappropriate objects */ /* Don't eat indigestible/choking/inappropriate objects */
if ((mtmp->data == &mons[PM_RUST_MONSTER] && !is_rustprone(otmp)) if ((mtmp->data == &mons[PM_RUST_MONSTER] && !is_rustprone(otmp))
@@ -970,7 +970,7 @@ struct monst *mtmp;
/* eat organic objects, including cloth and wood, if present; /* eat organic objects, including cloth and wood, if present;
engulf others, except huge rocks and metal attached to player engulf others, except huge rocks and metal attached to player
[despite comment at top, doesn't assume that eater is a g-cube] */ [despite comment at top, doesn't assume that eater is a g-cube] */
for (otmp = level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) { for (otmp = g.level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere; otmp2 = otmp->nexthere;
/* touch sensitive items */ /* touch sensitive items */
@@ -1122,7 +1122,7 @@ register const char *str;
if (mtmp->isshk && inhishop(mtmp)) if (mtmp->isshk && inhishop(mtmp))
return FALSE; return FALSE;
for (otmp = level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) { for (otmp = g.level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere; otmp2 = otmp->nexthere;
/* Nymphs take everything. Most monsters don't pick up corpses. */ /* Nymphs take everything. Most monsters don't pick up corpses. */
if (!str ? searches_for_item(mtmp, otmp) if (!str ? searches_for_item(mtmp, otmp)
@@ -1458,7 +1458,7 @@ nexttry: /* eels prefer the water, but if there is no water nearby,
} }
/* Note: ALLOW_SANCT only prevents movement, not /* Note: ALLOW_SANCT only prevents movement, not
attack, into a temple. */ attack, into a temple. */
if (level.flags.has_temple && *in_rooms(nx, ny, TEMPLE) if (g.level.flags.has_temple && *in_rooms(nx, ny, TEMPLE)
&& !*in_rooms(x, y, TEMPLE) && !*in_rooms(x, y, TEMPLE)
&& in_your_sanctuary((struct monst *) 0, nx, ny)) { && in_your_sanctuary((struct monst *) 0, nx, ny)) {
if (!(flag & ALLOW_SANCT)) if (!(flag & ALLOW_SANCT))
@@ -1810,7 +1810,7 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */ mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */
relobj(mtmp, 0, FALSE); relobj(mtmp, 0, FALSE);
if (onmap || mtmp == level.monsters[0][0]) { if (onmap || mtmp == g.level.monsters[0][0]) {
if (mtmp->wormno) if (mtmp->wormno)
remove_worm(mtmp); remove_worm(mtmp);
else else
@@ -2068,9 +2068,9 @@ boolean was_swallowed; /* digestion */
if (was_swallowed && magr) { if (was_swallowed && magr) {
if (magr == &youmonst) { if (magr == &youmonst) {
There("is an explosion in your %s!", body_part(STOMACH)); There("is an explosion in your %s!", body_part(STOMACH));
Sprintf(killer.name, "%s explosion", Sprintf(g.killer.name, "%s explosion",
s_suffix(mdat->mname)); s_suffix(mdat->mname));
losehp(Maybe_Half_Phys(tmp), killer.name, KILLED_BY_AN); losehp(Maybe_Half_Phys(tmp), g.killer.name, KILLED_BY_AN);
} else { } else {
You_hear("an explosion."); You_hear("an explosion.");
magr->mhp -= tmp; magr->mhp -= tmp;
@@ -2086,11 +2086,11 @@ boolean was_swallowed; /* digestion */
return FALSE; return FALSE;
} }
Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname)); Sprintf(g.killer.name, "%s explosion", s_suffix(mdat->mname));
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS); explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS);
killer.name[0] = '\0'; g.killer.name[0] = '\0';
killer.format = 0; g.killer.format = 0;
return FALSE; return FALSE;
} }
} }
@@ -3042,7 +3042,7 @@ struct monst *mtmp;
} else if (mtmp->data->mlet == S_EEL) { } else if (mtmp->data->mlet == S_EEL) {
undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz)); undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz));
} else if (hides_under(mtmp->data) && OBJ_AT(x, y)) { } else if (hides_under(mtmp->data) && OBJ_AT(x, y)) {
struct obj *otmp = level.objects[x][y]; struct obj *otmp = g.level.objects[x][y];
/* most monsters won't hide under cockatrice corpse */ /* most monsters won't hide under cockatrice corpse */
if (otmp->nexthere || otmp->otyp != CORPSE if (otmp->nexthere || otmp->otyp != CORPSE
@@ -3824,7 +3824,7 @@ kill_genocided_monsters()
kill_eggs(invent); kill_eggs(invent);
kill_eggs(fobj); kill_eggs(fobj);
kill_eggs(migrating_objs); kill_eggs(migrating_objs);
kill_eggs(level.buriedobjlist); kill_eggs(g.level.buriedobjlist);
} }
void void
+4 -4
View File
@@ -461,7 +461,7 @@ register struct monst *mtmp;
/* some monsters teleport */ /* some monsters teleport */
if (mtmp->mflee && !rn2(40) && can_teleport(mdat) && !mtmp->iswiz if (mtmp->mflee && !rn2(40) && can_teleport(mdat) && !mtmp->iswiz
&& !level.flags.noteleport) { && !g.level.flags.noteleport) {
(void) rloc(mtmp, TRUE); (void) rloc(mtmp, TRUE);
return 0; return 0;
} }
@@ -1134,7 +1134,7 @@ register int after;
if (is_minion(ptr) || is_rider(ptr)) if (is_minion(ptr) || is_rider(ptr))
flag |= ALLOW_SANCT; flag |= ALLOW_SANCT;
/* unicorn may not be able to avoid hero on a noteleport level */ /* unicorn may not be able to avoid hero on a noteleport level */
if (is_unicorn(ptr) && !level.flags.noteleport) if (is_unicorn(ptr) && !g.level.flags.noteleport)
flag |= NOTONL; flag |= NOTONL;
if (passes_walls(ptr)) if (passes_walls(ptr))
flag |= (ALLOW_WALL | ALLOW_ROCK); flag |= (ALLOW_WALL | ALLOW_ROCK);
@@ -1167,10 +1167,10 @@ register int after;
chi = -1; chi = -1;
nidist = dist2(nix, niy, gx, gy); nidist = dist2(nix, niy, gx, gy);
/* allow monsters be shortsighted on some levels for balance */ /* allow monsters be shortsighted on some levels for balance */
if (!mtmp->mpeaceful && level.flags.shortsighted if (!mtmp->mpeaceful && g.level.flags.shortsighted
&& nidist > (couldsee(nix, niy) ? 144 : 36) && appr == 1) && nidist > (couldsee(nix, niy) ? 144 : 36) && appr == 1)
appr = 0; appr = 0;
if (is_unicorn(ptr) && level.flags.noteleport) { if (is_unicorn(ptr) && g.level.flags.noteleport) {
/* on noteleport levels, perhaps we cannot avoid hero */ /* on noteleport levels, perhaps we cannot avoid hero */
for (i = 0; i < cnt; i++) for (i = 0; i < cnt; i++)
if (!(info[i] & NOTONL)) if (!(info[i] & NOTONL))
+8 -8
View File
@@ -410,7 +410,7 @@ struct monst *mtmp;
or some other monster is there */ or some other monster is there */
if ((xx == u.ux && yy == u.uy) if ((xx == u.ux && yy == u.uy)
|| (xx != x && yy != y && !diag_ok) || (xx != x && yy != y && !diag_ok)
|| (level.monsters[xx][yy] && !(xx == x && yy == y))) || (g.level.monsters[xx][yy] && !(xx == x && yy == y)))
continue; continue;
/* skip if there's no trap or can't/won't move onto trap */ /* skip if there's no trap or can't/won't move onto trap */
if ((t = t_at(xx, yy)) == 0 if ((t = t_at(xx, yy)) == 0
@@ -506,7 +506,7 @@ struct monst *mtmp;
* mean if the monster leaves the level, they'll know * mean if the monster leaves the level, they'll know
* about teleport traps. * about teleport traps.
*/ */
if (!level.flags.noteleport if (!g.level.flags.noteleport
|| !(mtmp->mtrapseen & (1 << (TELEP_TRAP - 1)))) { || !(mtmp->mtrapseen & (1 << (TELEP_TRAP - 1)))) {
g.m.defensive = obj; g.m.defensive = obj;
g.m.has_defense = (mon_has_amulet(mtmp)) g.m.has_defense = (mon_has_amulet(mtmp))
@@ -520,7 +520,7 @@ struct monst *mtmp;
&& (!obj->cursed || (!(mtmp->isshk && inhishop(mtmp)) && (!obj->cursed || (!(mtmp->isshk && inhishop(mtmp))
&& !mtmp->isgd && !mtmp->ispriest))) { && !mtmp->isgd && !mtmp->ispriest))) {
/* see WAN_TELEPORTATION case above */ /* see WAN_TELEPORTATION case above */
if (!level.flags.noteleport if (!g.level.flags.noteleport
|| !(mtmp->mtrapseen & (1 << (TELEP_TRAP - 1)))) { || !(mtmp->mtrapseen & (1 << (TELEP_TRAP - 1)))) {
g.m.defensive = obj; g.m.defensive = obj;
g.m.has_defense = MUSE_SCR_TELEPORTATION; g.m.has_defense = MUSE_SCR_TELEPORTATION;
@@ -634,7 +634,7 @@ struct monst *mtmp;
if (vismon && how) /* mentions 'teleport' */ if (vismon && how) /* mentions 'teleport' */
makeknown(how); makeknown(how);
/* monster learns that teleportation isn't useful here */ /* monster learns that teleportation isn't useful here */
if (level.flags.noteleport) if (g.level.flags.noteleport)
mtmp->mtrapseen |= (1 << (TELEP_TRAP - 1)); mtmp->mtrapseen |= (1 << (TELEP_TRAP - 1));
return 2; return 2;
} }
@@ -654,7 +654,7 @@ struct monst *mtmp;
g.m_using = TRUE; g.m_using = TRUE;
mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp); mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
/* monster learns that teleportation isn't useful here */ /* monster learns that teleportation isn't useful here */
if (level.flags.noteleport) if (g.level.flags.noteleport)
mtmp->mtrapseen |= (1 << (TELEP_TRAP - 1)); mtmp->mtrapseen |= (1 << (TELEP_TRAP - 1));
g.m_using = FALSE; g.m_using = FALSE;
return 2; return 2;
@@ -980,7 +980,7 @@ try_again:
switch (rn2(8 + (difficulty > 3) + (difficulty > 6) + (difficulty > 8))) { switch (rn2(8 + (difficulty > 3) + (difficulty > 6) + (difficulty > 8))) {
case 6: case 6:
case 9: case 9:
if (level.flags.noteleport && ++trycnt < 2) if (g.level.flags.noteleport && ++trycnt < 2)
goto try_again; goto try_again;
if (!rn2(3)) if (!rn2(3))
return WAN_TELEPORTATION; return WAN_TELEPORTATION;
@@ -1314,7 +1314,7 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */
int hitanything = 0; int hitanything = 0;
register struct obj *next_obj; register struct obj *next_obj;
for (otmp = level.objects[g.bhitpos.x][g.bhitpos.y]; otmp; for (otmp = g.level.objects[g.bhitpos.x][g.bhitpos.y]; otmp;
otmp = next_obj) { otmp = next_obj) {
/* Fix for polymorph bug, Tim Wright */ /* Fix for polymorph bug, Tim Wright */
next_obj = otmp->nexthere; next_obj = otmp->nexthere;
@@ -1624,7 +1624,7 @@ struct monst *mtmp;
for (yy = y - 1; yy <= y + 1; yy++) for (yy = y - 1; yy <= y + 1; yy++)
if (isok(xx, yy) && (xx != u.ux || yy != u.uy) if (isok(xx, yy) && (xx != u.ux || yy != u.uy)
&& (diag_ok || xx == x || yy == y) && (diag_ok || xx == x || yy == y)
&& ((xx == x && yy == y) || !level.monsters[xx][yy])) && ((xx == x && yy == y) || !g.level.monsters[xx][yy]))
if ((t = t_at(xx, yy)) != 0 if ((t = t_at(xx, yy)) != 0
&& (ignore_boulders || !sobj_at(BOULDER, xx, yy)) && (ignore_boulders || !sobj_at(BOULDER, xx, yy))
&& !onscary(xx, yy, mtmp)) { && !onscary(xx, yy, mtmp)) {
+3 -3
View File
@@ -3579,7 +3579,7 @@ wiztrap:
p = eos(bp); p = eos(bp);
if (!BSTRCMPI(bp, p - 8, "fountain")) { if (!BSTRCMPI(bp, p - 8, "fountain")) {
lev->typ = FOUNTAIN; lev->typ = FOUNTAIN;
level.flags.nfountains++; g.level.flags.nfountains++;
if (!strncmpi(bp, "magic ", 6)) if (!strncmpi(bp, "magic ", 6))
lev->blessedftn = 1; lev->blessedftn = 1;
pline("A %sfountain.", lev->blessedftn ? "magic " : ""); pline("A %sfountain.", lev->blessedftn ? "magic " : "");
@@ -3594,7 +3594,7 @@ wiztrap:
} }
if (!BSTRCMPI(bp, p - 4, "sink")) { if (!BSTRCMPI(bp, p - 4, "sink")) {
lev->typ = SINK; lev->typ = SINK;
level.flags.nsinks++; g.level.flags.nsinks++;
pline("A sink."); pline("A sink.");
newsym(x, y); newsym(x, y);
return &zeroobj; return &zeroobj;
@@ -3605,7 +3605,7 @@ wiztrap:
del_engr_at(x, y); del_engr_at(x, y);
pline("A %s.", (lev->typ == POOL) ? "pool" : "moat"); pline("A %s.", (lev->typ == POOL) ? "pool" : "moat");
/* Must manually make kelp! */ /* Must manually make kelp! */
water_damage_chain(level.objects[x][y], TRUE); water_damage_chain(g.level.objects[x][y], TRUE);
newsym(x, y); newsym(x, y);
return &zeroobj; return &zeroobj;
} }
+2 -2
View File
@@ -105,7 +105,7 @@ char *outbuf;
struct obj *otmp; struct obj *otmp;
boolean fakeobj, isyou = (mon == &youmonst); boolean fakeobj, isyou = (mon == &youmonst);
int x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my, int x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my,
glyph = (level.flags.hero_memory && !isyou) ? levl[x][y].glyph glyph = (g.level.flags.hero_memory && !isyou) ? levl[x][y].glyph
: glyph_at(x, y); : glyph_at(x, y);
*outbuf = '\0'; *outbuf = '\0';
@@ -166,7 +166,7 @@ struct obj **obj_p;
*obj_p = (struct obj *) 0; *obj_p = (struct obj *) 0;
/* TODO: check inside containers in case glyph came from detection */ /* TODO: check inside containers in case glyph came from detection */
if ((otmp = sobj_at(glyphotyp, x, y)) == 0) if ((otmp = sobj_at(glyphotyp, x, y)) == 0)
for (otmp = level.buriedobjlist; otmp; otmp = otmp->nobj) for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj)
if (otmp->ox == x && otmp->oy == y && otmp->otyp == glyphotyp) if (otmp->ox == x && otmp->oy == y && otmp->otyp == glyphotyp)
break; break;
+7 -7
View File
@@ -294,7 +294,7 @@ boolean picked_some;
register int ct = 0; register int ct = 0;
/* count the objects here */ /* count the objects here */
for (obj = level.objects[u.ux][u.uy]; obj; obj = obj->nexthere) { for (obj = g.level.objects[u.ux][u.uy]; obj; obj = obj->nexthere) {
if (obj != uchain) if (obj != uchain)
ct++; ct++;
} }
@@ -537,7 +537,7 @@ int what; /* should be a long */
add_valid_menu_class(0); /* reset */ add_valid_menu_class(0); /* reset */
if (!u.uswallow) { if (!u.uswallow) {
objchain_p = &level.objects[u.ux][u.uy]; objchain_p = &g.level.objects[u.ux][u.uy];
traverse_how = BY_NEXTHERE; traverse_how = BY_NEXTHERE;
} else { } else {
objchain_p = &u.ustuck->minvent; objchain_p = &u.ustuck->minvent;
@@ -1613,7 +1613,7 @@ boolean countem;
struct obj *cobj, *nobj; struct obj *cobj, *nobj;
int container_count = 0; int container_count = 0;
for (cobj = level.objects[x][y]; cobj; cobj = nobj) { for (cobj = g.level.objects[x][y]; cobj; cobj = nobj) {
nobj = cobj->nexthere; nobj = cobj->nexthere;
if (Is_container(cobj)) { if (Is_container(cobj)) {
container_count++; container_count++;
@@ -1781,7 +1781,7 @@ doloot()
win = create_nhwindow(NHW_MENU); win = create_nhwindow(NHW_MENU);
start_menu(win); start_menu(win);
for (cobj = level.objects[cc.x][cc.y]; cobj; for (cobj = g.level.objects[cc.x][cc.y]; cobj;
cobj = cobj->nexthere) cobj = cobj->nexthere)
if (Is_container(cobj)) { if (Is_container(cobj)) {
any.a_obj = cobj; any.a_obj = cobj;
@@ -1807,7 +1807,7 @@ doloot()
if (n != 0) if (n != 0)
c = 'y'; c = 'y';
} else { } else {
for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = nobj) { for (cobj = g.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
nobj = cobj->nexthere; nobj = cobj->nexthere;
if (Is_container(cobj)) { if (Is_container(cobj)) {
@@ -2934,7 +2934,7 @@ dotip()
win = create_nhwindow(NHW_MENU); win = create_nhwindow(NHW_MENU);
start_menu(win); start_menu(win);
for (cobj = level.objects[cc.x][cc.y], i = 0; cobj; for (cobj = g.level.objects[cc.x][cc.y], i = 0; cobj;
cobj = cobj->nexthere) cobj = cobj->nexthere)
if (Is_container(cobj)) { if (Is_container(cobj)) {
++i; ++i;
@@ -2976,7 +2976,7 @@ dotip()
return 0; return 0;
/* else pick-from-invent below */ /* else pick-from-invent below */
} else { } else {
for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = nobj) { for (cobj = g.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
nobj = cobj->nexthere; nobj = cobj->nexthere;
if (!Is_container(cobj)) if (!Is_container(cobj))
continue; continue;
+13 -13
View File
@@ -202,11 +202,11 @@ const char *fmt, *arg;
struct kinfo *kptr = find_delayed_killer(POLYMORPH); struct kinfo *kptr = find_delayed_killer(POLYMORPH);
if (kptr != (struct kinfo *) 0 && kptr->name[0]) { if (kptr != (struct kinfo *) 0 && kptr->name[0]) {
killer.format = kptr->format; g.killer.format = kptr->format;
Strcpy(killer.name, kptr->name); Strcpy(g.killer.name, kptr->name);
} else { } else {
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "self-genocide"); Strcpy(g.killer.name, "self-genocide");
} }
dealloc_killer(kptr); dealloc_killer(kptr);
done(GENOCIDED); done(GENOCIDED);
@@ -359,8 +359,8 @@ newman()
dead: /* we come directly here if their experience level went to 0 or dead: /* we come directly here if their experience level went to 0 or
less */ less */
Your("new form doesn't seem healthy enough to survive."); Your("new form doesn't seem healthy enough to survive.");
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "unsuccessful polymorph"); Strcpy(g.killer.name, "unsuccessful polymorph");
done(DIED); done(DIED);
newuhs(FALSE); newuhs(FALSE);
return; /* lifesaved */ return; /* lifesaved */
@@ -1031,8 +1031,8 @@ rehumanize()
/* You can't revert back while unchanging */ /* You can't revert back while unchanging */
if (Unchanging) { if (Unchanging) {
if (u.mh < 1) { if (u.mh < 1) {
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, "killed while stuck in creature form"); Strcpy(g.killer.name, "killed while stuck in creature form");
done(DIED); done(DIED);
} else if (uamul && uamul->otyp == AMULET_OF_UNCHANGING) { } else if (uamul && uamul->otyp == AMULET_OF_UNCHANGING) {
Your("%s %s!", simpleonames(uamul), otense(uamul, "fail")); Your("%s %s!", simpleonames(uamul), otense(uamul, "fail"));
@@ -1049,8 +1049,8 @@ rehumanize()
/* can only happen if some bit of code reduces u.uhp /* can only happen if some bit of code reduces u.uhp
instead of u.mh while poly'd */ instead of u.mh while poly'd */
Your("old form was not healthy enough to survive."); Your("old form was not healthy enough to survive.");
Sprintf(killer.name, "reverting to unhealthy %s form", urace.adj); Sprintf(g.killer.name, "reverting to unhealthy %s form", urace.adj);
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
done(DIED); done(DIED);
} }
nomul(0); nomul(0);
@@ -1401,8 +1401,8 @@ dogaze()
l_monnam(mtmp)); l_monnam(mtmp));
/* as if gazing at a sleeping anything is fruitful... */ /* as if gazing at a sleeping anything is fruitful... */
You("turn to stone..."); You("turn to stone...");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "deliberately meeting Medusa's gaze"); Strcpy(g.killer.name, "deliberately meeting Medusa's gaze");
done(STONING); done(STONING);
} }
} }
@@ -1447,7 +1447,7 @@ dohide()
u.uundetected = 0; u.uundetected = 0;
return 0; return 0;
} }
if (hides_under(youmonst.data) && !level.objects[u.ux][u.uy]) { if (hides_under(youmonst.data) && !g.level.objects[u.ux][u.uy]) {
There("is nothing to hide under here."); There("is nothing to hide under here.");
u.uundetected = 0; u.uundetected = 0;
return 0; return 0;
+6 -6
View File
@@ -632,8 +632,8 @@ boolean via_disintegration;
{ {
You("%s!", !via_disintegration ? "fry to a crisp" You("%s!", !via_disintegration ? "fry to a crisp"
: "disintegrate into a pile of dust"); : "disintegrate into a pile of dust");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Sprintf(killer.name, "the wrath of %s", align_gname(resp_god)); Sprintf(g.killer.name, "the wrath of %s", align_gname(resp_god));
done(DIED); done(DIED);
} }
@@ -1205,7 +1205,7 @@ boolean bless_water;
register long changed = 0; register long changed = 0;
boolean other = FALSE, bc_known = !(Blind || Hallucination); boolean other = FALSE, bc_known = !(Blind || Hallucination);
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) { for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
/* turn water into (un)holy water */ /* turn water into (un)holy water */
if (otmp->otyp == POT_WATER if (otmp->otyp == POT_WATER
&& (bless_water ? !otmp->blessed : !otmp->cursed)) { && (bless_water ? !otmp->blessed : !otmp->cursed)) {
@@ -1499,8 +1499,8 @@ dosacrifice()
pline("%s shrugs and retains dominion over %s,", Moloch, pline("%s shrugs and retains dominion over %s,", Moloch,
u_gname()); u_gname());
pline("then mercilessly snuffs out your life."); pline("then mercilessly snuffs out your life.");
Sprintf(killer.name, "%s indifference", s_suffix(Moloch)); Sprintf(g.killer.name, "%s indifference", s_suffix(Moloch));
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
done(DIED); done(DIED);
/* life-saved (or declined to die in wizard/explore mode) */ /* life-saved (or declined to die in wizard/explore mode) */
pline("%s snarls and tries again...", Moloch); pline("%s snarls and tries again...", Moloch);
@@ -2179,7 +2179,7 @@ int dx, dy;
int nx, ny; int nx, ny;
long count = 0L; long count = 0L;
for (otmp = level.objects[u.ux + dx][u.uy + dy]; otmp; for (otmp = g.level.objects[u.ux + dx][u.uy + dy]; otmp;
otmp = otmp->nexthere) { otmp = otmp->nexthere) {
if (otmp->otyp == BOULDER) if (otmp->otyp == BOULDER)
count += otmp->quan; count += otmp->quan;
+3 -3
View File
@@ -144,7 +144,7 @@ register char *array;
register char *ptr; register char *ptr;
for (ptr = array; *ptr; ptr++) for (ptr = array; *ptr; ptr++)
if (rooms[*ptr - ROOMOFFSET].rtype == TEMPLE) if (g.rooms[*ptr - ROOMOFFSET].rtype == TEMPLE)
return *ptr; return *ptr;
return '\0'; return '\0';
} }
@@ -237,7 +237,7 @@ boolean sanctum; /* is it the seat of the high priest? */
priest = makemon(&mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST], priest = makemon(&mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST],
sx + 1, sy, MM_EPRI); sx + 1, sy, MM_EPRI);
if (priest) { if (priest) {
EPRI(priest)->shroom = (schar) ((sroom - rooms) + ROOMOFFSET); EPRI(priest)->shroom = (schar) ((sroom - g.rooms) + ROOMOFFSET);
EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask); EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask);
EPRI(priest)->shrpos.x = sx; EPRI(priest)->shrpos.x = sx;
EPRI(priest)->shrpos.y = sy; EPRI(priest)->shrpos.y = sy;
@@ -729,7 +729,7 @@ struct monst *priest;
ax = x = EPRI(priest)->shrpos.x; ax = x = EPRI(priest)->shrpos.x;
ay = y = EPRI(priest)->shrpos.y; ay = y = EPRI(priest)->shrpos.y;
troom = &rooms[roomno - ROOMOFFSET]; troom = &g.rooms[roomno - ROOMOFFSET];
if ((u.ux == x && u.uy == y) || !linedup(u.ux, u.uy, x, y, 1)) { if ((u.ux == x && u.uy == y) || !linedup(u.ux, u.uy, x, y, 1)) {
if (IS_DOOR(levl[u.ux][u.uy].typ)) { if (IS_DOOR(levl[u.ux][u.uy].typ)) {
+1 -1
View File
@@ -235,7 +235,7 @@ unsigned whichchains;
qarti = find_qarti(migrating_objs); qarti = find_qarti(migrating_objs);
} }
if (!qarti && (whichchains & (1 << OBJ_BURIED)) != 0) if (!qarti && (whichchains & (1 << OBJ_BURIED)) != 0)
qarti = find_qarti(level.buriedobjlist); qarti = find_qarti(g.level.buriedobjlist);
return qarti; return qarti;
} }
+14 -14
View File
@@ -1536,7 +1536,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
recharge(otmp, scursed ? -1 : sblessed ? 1 : 0); recharge(otmp, scursed ? -1 : sblessed ? 1 : 0);
break; break;
case SCR_MAGIC_MAPPING: case SCR_MAGIC_MAPPING:
if (level.flags.nommap) { if (g.level.flags.nommap) {
Your("mind is filled with crazy lines!"); Your("mind is filled with crazy lines!");
if (Hallucination) if (Hallucination)
pline("Wow! Modern art."); pline("Wow! Modern art.");
@@ -1557,7 +1557,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
g.known = TRUE; g.known = TRUE;
/*FALLTHRU*/ /*FALLTHRU*/
case SPE_MAGIC_MAPPING: case SPE_MAGIC_MAPPING:
if (level.flags.nommap) { if (g.level.flags.nommap) {
Your("%s spins as %s blocks the spell!", body_part(HEAD), Your("%s spins as %s blocks the spell!", body_part(HEAD),
something); something);
make_confused(HConfusion + rnd(30), FALSE); make_confused(HConfusion + rnd(30), FALSE);
@@ -1981,11 +1981,11 @@ struct obj *obj;
int rx, ry; int rx, ry;
if (rnum >= 0) { if (rnum >= 0) {
for (rx = rooms[rnum].lx - 1; rx <= rooms[rnum].hx + 1; rx++) for (rx = g.rooms[rnum].lx - 1; rx <= g.rooms[rnum].hx + 1; rx++)
for (ry = rooms[rnum].ly - 1; ry <= rooms[rnum].hy + 1; ry++) for (ry = g.rooms[rnum].ly - 1; ry <= g.rooms[rnum].hy + 1; ry++)
set_lit(rx, ry, set_lit(rx, ry,
(genericptr_t) (on ? &is_lit : (char *) 0)); (genericptr_t) (on ? &is_lit : (char *) 0));
rooms[rnum].rlit = on; g.rooms[rnum].rlit = on;
} }
/* hallways remain dark on the rogue level */ /* hallways remain dark on the rogue level */
} else } else
@@ -2161,8 +2161,8 @@ do_class_genocide()
} }
} }
if (gameover || u.uhp == -1) { if (gameover || u.uhp == -1) {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "scroll of genocide"); Strcpy(g.killer.name, "scroll of genocide");
if (gameover) if (gameover)
done(GENOCIDED); done(GENOCIDED);
} }
@@ -2287,22 +2287,22 @@ int how;
u.uhp = -1; u.uhp = -1;
if (how & PLAYER) { if (how & PLAYER) {
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "genocidal confusion"); Strcpy(g.killer.name, "genocidal confusion");
} else if (how & ONTHRONE) { } else if (how & ONTHRONE) {
/* player selected while on a throne */ /* player selected while on a throne */
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "imperious order"); Strcpy(g.killer.name, "imperious order");
} else { /* selected player deliberately, not confused */ } else { /* selected player deliberately, not confused */
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, "scroll of genocide"); Strcpy(g.killer.name, "scroll of genocide");
} }
/* Polymorphed characters will die as soon as they're rehumanized. /* Polymorphed characters will die as soon as they're rehumanized.
*/ */
/* KMH -- Unchanging prevents rehumanization */ /* KMH -- Unchanging prevents rehumanization */
if (Upolyd && ptr != youmonst.data) { if (Upolyd && ptr != youmonst.data) {
delayed_killer(POLYMORPH, killer.format, killer.name); delayed_killer(POLYMORPH, g.killer.format, g.killer.name);
You_feel("%s inside.", udeadinside()); You_feel("%s inside.", udeadinside());
} else } else
done(GENOCIDED); done(GENOCIDED);
+1 -1
View File
@@ -314,7 +314,7 @@ NhRegion *reg;
if (!isok(i, j)) if (!isok(i, j))
continue; continue;
if (MON_AT(i, j) && inside_region(reg, i, j)) if (MON_AT(i, j) && inside_region(reg, i, j))
add_mon_to_reg(reg, level.monsters[i][j]); add_mon_to_reg(reg, g.level.monsters[i][j]);
if (reg->visible && cansee(i, j)) if (reg->visible && cansee(i, j))
newsym(i, j); newsym(i, j);
} }
+11 -11
View File
@@ -81,7 +81,7 @@ extern int amii_numcolors;
#define Is_IceBox(o) ((o)->otyp == ICE_BOX ? TRUE : FALSE) #define Is_IceBox(o) ((o)->otyp == ICE_BOX ? TRUE : FALSE)
/* Recalculate level.objects[x][y], since this info was not saved. */ /* Recalculate g.level.objects[x][y], since this info was not saved. */
STATIC_OVL void STATIC_OVL void
find_lev_obj() find_lev_obj()
{ {
@@ -91,7 +91,7 @@ find_lev_obj()
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) for (y = 0; y < ROWNO; y++)
level.objects[x][y] = (struct obj *) 0; g.level.objects[x][y] = (struct obj *) 0;
/* /*
* Reverse the entire fobj chain, which is necessary so that we can * Reverse the entire fobj chain, which is necessary so that we can
@@ -106,7 +106,7 @@ find_lev_obj()
} }
/* fobj should now be empty */ /* fobj should now be empty */
/* Set level.objects (as well as reversing the chain back again) */ /* Set g.level.objects (as well as reversing the chain back again) */
while ((otmp = fobjtmp) != 0) { while ((otmp = fobjtmp) != 0) {
fobjtmp = otmp->nobj; fobjtmp = otmp->nobj;
place_object(otmp, otmp->ox, otmp->oy); place_object(otmp, otmp->ox, otmp->oy);
@@ -190,8 +190,8 @@ boolean ghostly;
} }
} }
if (!shp || !*shp) { if (!shp || !*shp) {
tmp_dam->next = level.damagelist; tmp_dam->next = g.level.damagelist;
level.damagelist = tmp_dam; g.level.damagelist = tmp_dam;
tmp_dam = (struct damage *) alloc(sizeof(*tmp_dam)); tmp_dam = (struct damage *) alloc(sizeof(*tmp_dam));
} }
} }
@@ -998,7 +998,7 @@ char *reason;
pline("Strange, this map is not as I remember it."); pline("Strange, this map is not as I remember it.");
pline("Somebody is trying some trickery here..."); pline("Somebody is trying some trickery here...");
pline("This game is void."); pline("This game is void.");
Strcpy(killer.name, reason ? reason : ""); Strcpy(g.killer.name, reason ? reason : "");
done(TRICKED); done(TRICKED);
} }
@@ -1052,7 +1052,7 @@ boolean ghostly;
pline1(trickbuf); pline1(trickbuf);
trickery(trickbuf); trickery(trickbuf);
} }
restcemetery(fd, &level.bonesinfo); restcemetery(fd, &g.level.bonesinfo);
rest_levl(fd, rest_levl(fd,
(boolean) ((sfrestinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP)); (boolean) ((sfrestinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
mread(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp)); mread(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp));
@@ -1065,11 +1065,11 @@ boolean ghostly;
mread(fd, (genericptr_t) &g.sstairs, sizeof(stairway)); mread(fd, (genericptr_t) &g.sstairs, sizeof(stairway));
mread(fd, (genericptr_t) &g.updest, sizeof(dest_area)); mread(fd, (genericptr_t) &g.updest, sizeof(dest_area));
mread(fd, (genericptr_t) &g.dndest, sizeof(dest_area)); mread(fd, (genericptr_t) &g.dndest, sizeof(dest_area));
mread(fd, (genericptr_t) &level.flags, sizeof(level.flags)); mread(fd, (genericptr_t) &g.level.flags, sizeof(g.level.flags));
mread(fd, (genericptr_t) g.doors, sizeof(g.doors)); mread(fd, (genericptr_t) g.doors, sizeof(g.doors));
rest_rooms(fd); /* No joke :-) */ rest_rooms(fd); /* No joke :-) */
if (g.nroom) if (g.nroom)
g.doorindex = rooms[g.nroom - 1].fdoor + rooms[g.nroom - 1].doorct; g.doorindex = g.rooms[g.nroom - 1].fdoor + g.rooms[g.nroom - 1].doorct;
else else
g.doorindex = 0; g.doorindex = 0;
@@ -1090,14 +1090,14 @@ boolean ghostly;
find_lev_obj(); find_lev_obj();
/* restobjchn()'s `frozen' argument probably ought to be a callback /* restobjchn()'s `frozen' argument probably ought to be a callback
routine so that we can check for objects being buried under ice */ routine so that we can check for objects being buried under ice */
level.buriedobjlist = restobjchn(fd, ghostly, FALSE); g.level.buriedobjlist = restobjchn(fd, ghostly, FALSE);
billobjs = restobjchn(fd, ghostly, FALSE); billobjs = restobjchn(fd, ghostly, FALSE);
rest_engravings(fd); rest_engravings(fd);
/* reset level.monsters for new level */ /* reset level.monsters for new level */
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) for (y = 0; y < ROWNO; y++)
level.monsters[x][y] = (struct monst *) 0; g.level.monsters[x][y] = (struct monst *) 0;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (mtmp->isshk) if (mtmp->isshk)
set_residency(mtmp, FALSE); set_residency(mtmp, FALSE);
+13 -13
View File
@@ -249,7 +249,7 @@ dosave0()
HUP pline1(whynot); HUP pline1(whynot);
(void) nhclose(fd); (void) nhclose(fd);
(void) delete_savefile(); (void) delete_savefile();
HUP Strcpy(killer.name, whynot); HUP Strcpy(g.killer.name, whynot);
HUP done(TRICKED); HUP done(TRICKED);
return 0; return 0;
} }
@@ -354,7 +354,7 @@ char *whynot;
if (fd < 0) { if (fd < 0) {
pline1(whynot); pline1(whynot);
pline("Probably someone removed it."); pline("Probably someone removed it.");
Strcpy(killer.name, whynot); Strcpy(g.killer.name, whynot);
done(TRICKED); done(TRICKED);
return TRUE; return TRUE;
} }
@@ -395,7 +395,7 @@ savestateinlock()
Sprintf(whynot, "Level #0 pid (%d) doesn't match ours (%d)!", Sprintf(whynot, "Level #0 pid (%d) doesn't match ours (%d)!",
hpid, g.hackpid); hpid, g.hackpid);
pline1(whynot); pline1(whynot);
Strcpy(killer.name, whynot); Strcpy(g.killer.name, whynot);
done(TRICKED); done(TRICKED);
} }
(void) nhclose(fd); (void) nhclose(fd);
@@ -403,7 +403,7 @@ savestateinlock()
fd = create_levelfile(0, whynot); fd = create_levelfile(0, whynot);
if (fd < 0) { if (fd < 0) {
pline1(whynot); pline1(whynot);
Strcpy(killer.name, whynot); Strcpy(g.killer.name, whynot);
done(TRICKED); done(TRICKED);
return; return;
} }
@@ -500,7 +500,7 @@ int mode;
#else #else
bwrite(fd, (genericptr_t) &lev, sizeof(lev)); bwrite(fd, (genericptr_t) &lev, sizeof(lev));
#endif #endif
savecemetery(fd, mode, &level.bonesinfo); savecemetery(fd, mode, &g.level.bonesinfo);
savelevl(fd, savelevl(fd,
(boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP)); (boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
bwrite(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp)); bwrite(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp));
@@ -512,7 +512,7 @@ int mode;
bwrite(fd, (genericptr_t) &g.sstairs, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.sstairs, sizeof(stairway));
bwrite(fd, (genericptr_t) &g.updest, sizeof(dest_area)); bwrite(fd, (genericptr_t) &g.updest, sizeof(dest_area));
bwrite(fd, (genericptr_t) &g.dndest, sizeof(dest_area)); bwrite(fd, (genericptr_t) &g.dndest, sizeof(dest_area));
bwrite(fd, (genericptr_t) &level.flags, sizeof(level.flags)); bwrite(fd, (genericptr_t) &g.level.flags, sizeof(g.level.flags));
bwrite(fd, (genericptr_t) g.doors, sizeof(g.doors)); bwrite(fd, (genericptr_t) g.doors, sizeof(g.doors));
save_rooms(fd); /* no dynamic memory to reclaim */ save_rooms(fd); /* no dynamic memory to reclaim */
@@ -520,7 +520,7 @@ int mode;
skip_lots: skip_lots:
/* this comes before the map, so need cleanup here if we skipped */ /* this comes before the map, so need cleanup here if we skipped */
if (mode == FREE_SAVE) if (mode == FREE_SAVE)
savecemetery(fd, mode, &level.bonesinfo); savecemetery(fd, mode, &g.level.bonesinfo);
/* must be saved before mons, objs, and buried objs */ /* must be saved before mons, objs, and buried objs */
save_timers(fd, mode, RANGE_LEVEL); save_timers(fd, mode, RANGE_LEVEL);
save_light_sources(fd, mode, RANGE_LEVEL); save_light_sources(fd, mode, RANGE_LEVEL);
@@ -529,18 +529,18 @@ skip_lots:
save_worm(fd, mode); /* save worm information */ save_worm(fd, mode); /* save worm information */
savetrapchn(fd, g.ftrap, mode); savetrapchn(fd, g.ftrap, mode);
saveobjchn(fd, fobj, mode); saveobjchn(fd, fobj, mode);
saveobjchn(fd, level.buriedobjlist, mode); saveobjchn(fd, g.level.buriedobjlist, mode);
saveobjchn(fd, billobjs, mode); saveobjchn(fd, billobjs, mode);
if (release_data(mode)) { if (release_data(mode)) {
int x,y; int x,y;
for (y = 0; y < ROWNO; y++) for (y = 0; y < ROWNO; y++)
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
level.monsters[x][y] = 0; g.level.monsters[x][y] = 0;
fmon = 0; fmon = 0;
g.ftrap = 0; g.ftrap = 0;
fobj = 0; fobj = 0;
level.buriedobjlist = 0; g.level.buriedobjlist = 0;
billobjs = 0; billobjs = 0;
/* level.bonesinfo = 0; -- handled by savecemetery() */ /* level.bonesinfo = 0; -- handled by savecemetery() */
} }
@@ -946,7 +946,7 @@ register int fd, mode;
register struct damage *damageptr, *tmp_dam; register struct damage *damageptr, *tmp_dam;
unsigned int xl = 0; unsigned int xl = 0;
damageptr = level.damagelist; damageptr = g.level.damagelist;
for (tmp_dam = damageptr; tmp_dam; tmp_dam = tmp_dam->next) for (tmp_dam = damageptr; tmp_dam; tmp_dam = tmp_dam->next)
xl++; xl++;
if (perform_bwrite(mode)) if (perform_bwrite(mode))
@@ -961,7 +961,7 @@ register int fd, mode;
free((genericptr_t) tmp_dam); free((genericptr_t) tmp_dam);
} }
if (release_data(mode)) if (release_data(mode))
level.damagelist = 0; g.level.damagelist = 0;
} }
STATIC_OVL void STATIC_OVL void
@@ -1359,7 +1359,7 @@ freedynamicdata()
free_worm(); /* release worm segment information */ free_worm(); /* release worm segment information */
freetrapchn(g.ftrap); freetrapchn(g.ftrap);
freeobjchn(fobj); freeobjchn(fobj);
freeobjchn(level.buriedobjlist); freeobjchn(g.level.buriedobjlist);
freeobjchn(billobjs); freeobjchn(billobjs);
free_engravings(); free_engravings();
freedamage(); freedamage();
+26 -26
View File
@@ -17,7 +17,7 @@ STATIC_DCL void FDECL(kops_gone, (BOOLEAN_P));
#define NOTANGRY(mon) ((mon)->mpeaceful) #define NOTANGRY(mon) ((mon)->mpeaceful)
#define ANGRY(mon) (!NOTANGRY(mon)) #define ANGRY(mon) (!NOTANGRY(mon))
#define IS_SHOP(x) (rooms[x].rtype >= SHOPBASE) #define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE)
#define muteshk(shkp) \ #define muteshk(shkp) \
((shkp)->msleeping || !(shkp)->mcanmove \ ((shkp)->msleeping || !(shkp)->mcanmove \
@@ -187,7 +187,7 @@ shkgone(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
struct eshk *eshk = ESHK(mtmp); struct eshk *eshk = ESHK(mtmp);
struct mkroom *sroom = &rooms[eshk->shoproom - ROOMOFFSET]; struct mkroom *sroom = &g.rooms[eshk->shoproom - ROOMOFFSET];
struct obj *otmp; struct obj *otmp;
char *p; char *p;
int sx, sy; int sx, sy;
@@ -198,12 +198,12 @@ struct monst *mtmp;
remove_damage(mtmp, TRUE); remove_damage(mtmp, TRUE);
sroom->resident = (struct monst *) 0; sroom->resident = (struct monst *) 0;
if (!search_special(ANY_SHOP)) if (!search_special(ANY_SHOP))
level.flags.has_shop = 0; g.level.flags.has_shop = 0;
/* items on shop floor revert to ordinary objects */ /* items on shop floor revert to ordinary objects */
for (sx = sroom->lx; sx <= sroom->hx; sx++) for (sx = sroom->lx; sx <= sroom->hx; sx++)
for (sy = sroom->ly; sy <= sroom->hy; sy++) for (sy = sroom->ly; sy <= sroom->hy; sy++)
for (otmp = level.objects[sx][sy]; otmp; for (otmp = g.level.objects[sx][sy]; otmp;
otmp = otmp->nexthere) otmp = otmp->nexthere)
otmp->no_charge = 0; otmp->no_charge = 0;
@@ -226,7 +226,7 @@ register struct monst *shkp;
register boolean zero_out; register boolean zero_out;
{ {
if (on_level(&(ESHK(shkp)->shoplevel), &u.uz)) if (on_level(&(ESHK(shkp)->shoplevel), &u.uz))
rooms[ESHK(shkp)->shoproom - ROOMOFFSET].resident = g.rooms[ESHK(shkp)->shoproom - ROOMOFFSET].resident =
(zero_out) ? (struct monst *) 0 : shkp; (zero_out) ? (struct monst *) 0 : shkp;
} }
@@ -234,7 +234,7 @@ void
replshk(mtmp, mtmp2) replshk(mtmp, mtmp2)
register struct monst *mtmp, *mtmp2; register struct monst *mtmp, *mtmp2;
{ {
rooms[ESHK(mtmp2)->shoproom - ROOMOFFSET].resident = mtmp2; g.rooms[ESHK(mtmp2)->shoproom - ROOMOFFSET].resident = mtmp2;
if (inhishop(mtmp) && *u.ushops == ESHK(mtmp)->shoproom) { if (inhishop(mtmp) && *u.ushops == ESHK(mtmp)->shoproom) {
ESHK(mtmp2)->bill_p = &(ESHK(mtmp2)->bill[0]); ESHK(mtmp2)->bill_p = &(ESHK(mtmp2)->bill[0]);
} }
@@ -295,7 +295,7 @@ register struct monst *shkp;
clear_unpaid(shkp, invent); clear_unpaid(shkp, invent);
clear_unpaid(shkp, fobj); clear_unpaid(shkp, fobj);
clear_unpaid(shkp, level.buriedobjlist); clear_unpaid(shkp, g.level.buriedobjlist);
if (g.thrownobj) if (g.thrownobj)
clear_unpaid_obj(shkp, g.thrownobj); clear_unpaid_obj(shkp, g.thrownobj);
if (g.kickedobj) if (g.kickedobj)
@@ -508,7 +508,7 @@ deserted_shop(enterstring)
/*const*/ char *enterstring; /*const*/ char *enterstring;
{ {
struct monst *mtmp; struct monst *mtmp;
struct mkroom *r = &rooms[(int) *enterstring - ROOMOFFSET]; struct mkroom *r = &g.rooms[(int) *enterstring - ROOMOFFSET];
int x, y, m = 0, n = 0; int x, y, m = 0, n = 0;
for (x = r->lx; x <= r->hx; ++x) for (x = r->lx; x <= r->hx; ++x)
@@ -589,7 +589,7 @@ char *enterstring;
return; return;
} }
rt = rooms[*enterstring - ROOMOFFSET].rtype; rt = g.rooms[*enterstring - ROOMOFFSET].rtype;
if (ANGRY(shkp)) { if (ANGRY(shkp)) {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
@@ -813,7 +813,7 @@ char rmno;
{ {
struct monst *shkp; struct monst *shkp;
shkp = (rmno >= ROOMOFFSET) ? rooms[rmno - ROOMOFFSET].resident : 0; shkp = (rmno >= ROOMOFFSET) ? g.rooms[rmno - ROOMOFFSET].resident : 0;
if (shkp) { if (shkp) {
if (has_eshk(shkp)) { if (has_eshk(shkp)) {
if (NOTANGRY(shkp)) { if (NOTANGRY(shkp)) {
@@ -829,12 +829,12 @@ char rmno;
shkp->isshk ? "shopkeeper career change" shkp->isshk ? "shopkeeper career change"
: "shop resident not shopkeeper", : "shop resident not shopkeeper",
(int) rmno, (int) rmno,
(int) rooms[rmno - ROOMOFFSET].rtype, (int) g.rooms[rmno - ROOMOFFSET].rtype,
shkp->mnum, shkp->mnum,
/* [real shopkeeper name is kept in ESHK, not MNAME] */ /* [real shopkeeper name is kept in ESHK, not MNAME] */
has_mname(shkp) ? MNAME(shkp) : "anonymous"); has_mname(shkp) ? MNAME(shkp) : "anonymous");
/* not sure if this is appropriate, because it does nothing to /* not sure if this is appropriate, because it does nothing to
correct the underlying rooms[].resident issue but... */ correct the underlying g.rooms[].resident issue but... */
return (struct monst *) 0; return (struct monst *) 0;
} }
} }
@@ -1021,7 +1021,7 @@ register boolean killkops;
register xchar x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y; register xchar x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y;
(void) mnearto(shkp, x, y, TRUE); (void) mnearto(shkp, x, y, TRUE);
level.flags.has_shop = 1; g.level.flags.has_shop = 1;
if (killkops) { if (killkops) {
kops_gone(TRUE); kops_gone(TRUE);
pacify_guards(); pacify_guards();
@@ -1939,7 +1939,7 @@ unsigned id;
return obj; return obj;
if ((obj = o_on(id, fobj)) != 0) if ((obj = o_on(id, fobj)) != 0)
return obj; return obj;
if ((obj = o_on(id, level.buriedobjlist)) != 0) if ((obj = o_on(id, g.level.buriedobjlist)) != 0)
return obj; return obj;
if ((obj = o_on(id, migrating_objs)) != 0) if ((obj = o_on(id, migrating_objs)) != 0)
return obj; return obj;
@@ -3357,7 +3357,7 @@ long cost;
if (!*shops) if (!*shops)
return; return;
} }
for (tmp_dam = level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) for (tmp_dam = g.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next)
if (tmp_dam->place.x == x && tmp_dam->place.y == y) { if (tmp_dam->place.x == x && tmp_dam->place.y == y) {
tmp_dam->cost += cost; tmp_dam->cost += cost;
tmp_dam->when = monstermoves; /* needed by pay_for_damage() */ tmp_dam->when = monstermoves; /* needed by pay_for_damage() */
@@ -3370,8 +3370,8 @@ long cost;
tmp_dam->place.y = y; tmp_dam->place.y = y;
tmp_dam->cost = cost; tmp_dam->cost = cost;
tmp_dam->typ = levl[x][y].typ; tmp_dam->typ = levl[x][y].typ;
tmp_dam->next = level.damagelist; tmp_dam->next = g.level.damagelist;
level.damagelist = tmp_dam; g.level.damagelist = tmp_dam;
/* If player saw damage, display as a wall forever */ /* If player saw damage, display as a wall forever */
if (cansee(x, y)) if (cansee(x, y))
levl[x][y].seenv = SVALL; levl[x][y].seenv = SVALL;
@@ -3397,7 +3397,7 @@ boolean croaked;
int saw_walls = 0, saw_untrap = 0; int saw_walls = 0, saw_untrap = 0;
char trapmsg[BUFSZ]; char trapmsg[BUFSZ];
tmp_dam = level.damagelist; tmp_dam = g.level.damagelist;
tmp2_dam = 0; tmp2_dam = 0;
while (tmp_dam) { while (tmp_dam) {
register xchar x = tmp_dam->place.x, y = tmp_dam->place.y; register xchar x = tmp_dam->place.x, y = tmp_dam->place.y;
@@ -3452,8 +3452,8 @@ boolean croaked;
tmp_dam = tmp_dam->next; tmp_dam = tmp_dam->next;
if (!tmp2_dam) { if (!tmp2_dam) {
free((genericptr_t) level.damagelist); free((genericptr_t) g.level.damagelist);
level.damagelist = tmp_dam; g.level.damagelist = tmp_dam;
} else { } else {
free((genericptr_t) tmp2_dam->next); free((genericptr_t) tmp2_dam->next);
tmp2_dam->next = tmp_dam; tmp2_dam->next = tmp_dam;
@@ -3569,7 +3569,7 @@ boolean catchup; /* restoring a level */
#define horiz(i) ((i % 3) - 1) #define horiz(i) ((i % 3) - 1)
#define vert(i) ((i / 3) - 1) #define vert(i) ((i / 3) - 1)
k = 0; /* number of adjacent shop spots */ k = 0; /* number of adjacent shop spots */
if (level.objects[x][y] && !IS_ROOM(levl[x][y].typ)) { if (g.level.objects[x][y] && !IS_ROOM(levl[x][y].typ)) {
for (i = 0; i < 9; i++) { for (i = 0; i < 9; i++) {
ix = x + horiz(i); ix = x + horiz(i);
iy = y + vert(i); iy = y + vert(i);
@@ -3605,7 +3605,7 @@ boolean catchup; /* restoring a level */
unplacebc(); /* pick 'em up */ unplacebc(); /* pick 'em up */
placebc(); /* put 'em down */ placebc(); /* put 'em down */
} }
while ((otmp = level.objects[x][y]) != 0) while ((otmp = g.level.objects[x][y]) != 0)
/* Don't mess w/ boulders -- just merge into wall */ /* Don't mess w/ boulders -- just merge into wall */
if (otmp->otyp == BOULDER || otmp->otyp == ROCK) { if (otmp->otyp == BOULDER || otmp->otyp == ROCK) {
obj_extract_self(otmp); obj_extract_self(otmp);
@@ -3613,7 +3613,7 @@ boolean catchup; /* restoring a level */
} else { } else {
int trylimit = 50; int trylimit = 50;
/* otmp must be moved otherwise level.objects[x][y] will /* otmp must be moved otherwise g.level.objects[x][y] will
never become Null and while-loop won't terminate */ never become Null and while-loop won't terminate */
do { do {
i = rn2(9); i = rn2(9);
@@ -3935,7 +3935,7 @@ boolean cant_mollify;
nearest_damage = nearest_shk; nearest_damage = nearest_shk;
int picks = 0; int picks = 0;
for (tmp_dam = level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) { for (tmp_dam = g.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) {
char *shp; char *shp;
if (tmp_dam->when != monstermoves || !tmp_dam->cost) if (tmp_dam->when != monstermoves || !tmp_dam->cost)
@@ -4105,7 +4105,7 @@ register xchar x, y;
struct monst *shkp; struct monst *shkp;
struct eshk *eshkp; struct eshk *eshkp;
if (!level.flags.has_shop) if (!g.level.flags.has_shop)
return FALSE; return FALSE;
shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)); shkp = shop_keeper(*in_rooms(x, y, SHOPBASE));
if (!shkp || !inhishop(shkp)) if (!shkp || !inhishop(shkp))
@@ -4127,7 +4127,7 @@ register xchar x, y;
if (!(shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) || !inhishop(shkp)) if (!(shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) || !inhishop(shkp))
return (struct obj *) 0; return (struct obj *) 0;
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (otmp->oclass != COIN_CLASS) if (otmp->oclass != COIN_CLASS)
break; break;
/* note: otmp might have ->no_charge set, but that's ok */ /* note: otmp might have ->no_charge set, but that's ok */
+4 -4
View File
@@ -601,7 +601,7 @@ struct mkroom *sroom;
/* check that the shopkeeper placement is sane */ /* check that the shopkeeper placement is sane */
if (sroom->irregular) { if (sroom->irregular) {
int rmno = (int) ((sroom - rooms) + ROOMOFFSET); int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET);
if (isok(sx - 1, sy) && !levl[sx - 1][sy].edge if (isok(sx - 1, sy) && !levl[sx - 1][sy].edge
&& (int) levl[sx - 1][sy].roomno == rmno) && (int) levl[sx - 1][sy].roomno == rmno)
@@ -659,7 +659,7 @@ struct mkroom *sroom;
set_malign(shk); set_malign(shk);
shk->msleeping = 0; shk->msleeping = 0;
shk->mtrapseen = ~0; /* we know all the traps already */ shk->mtrapseen = ~0; /* we know all the traps already */
eshkp->shoproom = (schar) ((sroom - rooms) + ROOMOFFSET); eshkp->shoproom = (schar) ((sroom - g.rooms) + ROOMOFFSET);
sroom->resident = shk; sroom->resident = shk;
eshkp->shoptype = sroom->rtype; eshkp->shoptype = sroom->rtype;
assign_level(&eshkp->shoplevel, &u.uz); assign_level(&eshkp->shoplevel, &u.uz);
@@ -712,7 +712,7 @@ register struct mkroom *sroom;
int sx, sy, sh; int sx, sy, sh;
int stockcount = 0, specialspot = 0; int stockcount = 0, specialspot = 0;
char buf[BUFSZ]; char buf[BUFSZ];
int rmno = (int) ((sroom - rooms) + ROOMOFFSET); int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET);
const struct shclass *shp = &shtypes[shp_indx]; const struct shclass *shp = &shtypes[shp_indx];
/* first, try to place a shopkeeper in the room */ /* first, try to place a shopkeeper in the room */
@@ -774,7 +774,7 @@ register struct mkroom *sroom;
* monsters will sit on top of objects and not the other way around. * monsters will sit on top of objects and not the other way around.
*/ */
level.flags.has_shop = TRUE; g.level.flags.has_shop = TRUE;
} }
/* does shkp's shop stock this item type? */ /* does shkp's shop stock this item type? */
+2 -2
View File
@@ -70,7 +70,7 @@ dosit()
&& !uteetering_at_seen_pit(trap)) { && !uteetering_at_seen_pit(trap)) {
register struct obj *obj; register struct obj *obj;
obj = level.objects[u.ux][u.uy]; obj = g.level.objects[u.ux][u.uy];
if (youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { if (youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) {
You("coil up around your %shoard.", You("coil up around your %shoard.",
(obj->quan + money_cnt(invent) < u.ulevel * 1000) ? "meager " (obj->quan + money_cnt(invent) < u.ulevel * 1000) ? "meager "
@@ -233,7 +233,7 @@ dosit()
break; break;
case 10: case 10:
if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (Luck < 0 || (HSee_invisible & INTRINSIC)) {
if (level.flags.nommap) { if (g.level.flags.nommap) {
pline("A terrible drone fills your head!"); pline("A terrible drone fills your head!");
make_confused((HConfusion & TIMEOUT) + (long) rnd(30), make_confused((HConfusion & TIMEOUT) + (long) rnd(30),
FALSE); FALSE);
+14 -14
View File
@@ -17,7 +17,7 @@ int rmtyp;
{ {
int rno = levl[mon->mx][mon->my].roomno; int rno = levl[mon->mx][mon->my].roomno;
if (rno >= ROOMOFFSET) if (rno >= ROOMOFFSET)
return rooms[rno - ROOMOFFSET].rtype == rmtyp; return g.rooms[rno - ROOMOFFSET].rtype == rmtyp;
return FALSE; return FALSE;
} }
@@ -36,20 +36,20 @@ dosounds()
hallu = Hallucination ? 1 : 0; hallu = Hallucination ? 1 : 0;
if (level.flags.nfountains && !rn2(400)) { if (g.level.flags.nfountains && !rn2(400)) {
static const char *const fountain_msg[4] = { static const char *const fountain_msg[4] = {
"bubbling water.", "water falling on coins.", "bubbling water.", "water falling on coins.",
"the splashing of a naiad.", "a soda fountain!", "the splashing of a naiad.", "a soda fountain!",
}; };
You_hear1(fountain_msg[rn2(3) + hallu]); You_hear1(fountain_msg[rn2(3) + hallu]);
} }
if (level.flags.nsinks && !rn2(300)) { if (g.level.flags.nsinks && !rn2(300)) {
static const char *const sink_msg[3] = { static const char *const sink_msg[3] = {
"a slow drip.", "a gurgling noise.", "dishes being washed!", "a slow drip.", "a gurgling noise.", "dishes being washed!",
}; };
You_hear1(sink_msg[rn2(2) + hallu]); You_hear1(sink_msg[rn2(2) + hallu]);
} }
if (level.flags.has_court && !rn2(200)) { if (g.level.flags.has_court && !rn2(200)) {
static const char *const throne_msg[4] = { static const char *const throne_msg[4] = {
"the tones of courtly conversation.", "the tones of courtly conversation.",
"a sceptre pounded in judgment.", "a sceptre pounded in judgment.",
@@ -72,7 +72,7 @@ dosounds()
} }
} }
} }
if (level.flags.has_swamp && !rn2(200)) { if (g.level.flags.has_swamp && !rn2(200)) {
static const char *const swamp_msg[3] = { static const char *const swamp_msg[3] = {
"hear mosquitoes!", "smell marsh gas!", /* so it's a smell...*/ "hear mosquitoes!", "smell marsh gas!", /* so it's a smell...*/
"hear Donald Duck!", "hear Donald Duck!",
@@ -80,10 +80,10 @@ dosounds()
You1(swamp_msg[rn2(2) + hallu]); You1(swamp_msg[rn2(2) + hallu]);
return; return;
} }
if (level.flags.has_vault && !rn2(200)) { if (g.level.flags.has_vault && !rn2(200)) {
if (!(sroom = search_special(VAULT))) { if (!(sroom = search_special(VAULT))) {
/* strange ... */ /* strange ... */
level.flags.has_vault = 0; g.level.flags.has_vault = 0;
return; return;
} }
if (gd_sound()) if (gd_sound())
@@ -124,7 +124,7 @@ dosounds()
} }
return; return;
} }
if (level.flags.has_beehive && !rn2(200)) { if (g.level.flags.has_beehive && !rn2(200)) {
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
@@ -146,7 +146,7 @@ dosounds()
} }
} }
} }
if (level.flags.has_morgue && !rn2(200)) { if (g.level.flags.has_morgue && !rn2(200)) {
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
@@ -171,7 +171,7 @@ dosounds()
} }
} }
} }
if (level.flags.has_barracks && !rn2(200)) { if (g.level.flags.has_barracks && !rn2(200)) {
static const char *const barracks_msg[4] = { static const char *const barracks_msg[4] = {
"blades being honed.", "loud snoring.", "dice being thrown.", "blades being honed.", "loud snoring.", "dice being thrown.",
"General MacArthur!", "General MacArthur!",
@@ -194,7 +194,7 @@ dosounds()
} }
} }
} }
if (level.flags.has_zoo && !rn2(200)) { if (g.level.flags.has_zoo && !rn2(200)) {
static const char *const zoo_msg[3] = { static const char *const zoo_msg[3] = {
"a sound reminiscent of an elephant stepping on a peanut.", "a sound reminiscent of an elephant stepping on a peanut.",
"a sound reminiscent of a seal barking.", "Doctor Dolittle!", "a sound reminiscent of a seal barking.", "Doctor Dolittle!",
@@ -209,10 +209,10 @@ dosounds()
} }
} }
} }
if (level.flags.has_shop && !rn2(200)) { if (g.level.flags.has_shop && !rn2(200)) {
if (!(sroom = search_special(ANY_SHOP))) { if (!(sroom = search_special(ANY_SHOP))) {
/* strange... */ /* strange... */
level.flags.has_shop = 0; g.level.flags.has_shop = 0;
return; return;
} }
if (tended_shop(sroom) if (tended_shop(sroom)
@@ -225,7 +225,7 @@ dosounds()
} }
return; return;
} }
if (level.flags.has_temple && !rn2(200) if (g.level.flags.has_temple && !rn2(200)
&& !(Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) { && !(Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) {
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
+45 -45
View File
@@ -586,7 +586,7 @@ schar filling;
for (x = x1; x <= x2; x++) for (x = x1; x <= x2; x++)
for (y = y1; y <= y2; y++) { for (y = y1; y <= y2; y++) {
if (level.flags.corrmaze) if (g.level.flags.corrmaze)
levl[x][y].typ = STONE; levl[x][y].typ = STONE;
else else
levl[x][y].typ = (y < 2 || ((x % 2) && (y % 2))) ? STONE levl[x][y].typ = (y < 2 || ((x % 2) && (y % 2))) ? STONE
@@ -659,14 +659,14 @@ count_features()
{ {
xchar x, y; xchar x, y;
level.flags.nfountains = level.flags.nsinks = 0; g.level.flags.nfountains = g.level.flags.nsinks = 0;
for (y = 0; y < ROWNO; y++) for (y = 0; y < ROWNO; y++)
for (x = 0; x < COLNO; x++) { for (x = 0; x < COLNO; x++) {
int typ = levl[x][y].typ; int typ = levl[x][y].typ;
if (typ == FOUNTAIN) if (typ == FOUNTAIN)
level.flags.nfountains++; g.level.flags.nfountains++;
else if (typ == SINK) else if (typ == SINK)
level.flags.nsinks++; g.level.flags.nsinks++;
} }
} }
@@ -767,9 +767,9 @@ link_doors_rooms()
set_door_orientation(x, y); set_door_orientation(x, y);
for (tmpi = 0; tmpi < g.nroom; tmpi++) { for (tmpi = 0; tmpi < g.nroom; tmpi++) {
maybe_add_door(x, y, &rooms[tmpi]); maybe_add_door(x, y, &g.rooms[tmpi]);
for (m = 0; m < rooms[tmpi].nsubrooms; m++) { for (m = 0; m < g.rooms[tmpi].nsubrooms; m++) {
maybe_add_door(x, y, rooms[tmpi].sbrooms[m]); maybe_add_door(x, y, g.rooms[tmpi].sbrooms[m]);
} }
} }
} }
@@ -781,11 +781,11 @@ fill_rooms()
int tmpi, m; int tmpi, m;
for (tmpi = 0; tmpi < g.nroom; tmpi++) { for (tmpi = 0; tmpi < g.nroom; tmpi++) {
if (rooms[tmpi].needfill) if (g.rooms[tmpi].needfill)
fill_room(&rooms[tmpi], (rooms[tmpi].needfill == 2)); fill_room(&g.rooms[tmpi], (g.rooms[tmpi].needfill == 2));
for (m = 0; m < rooms[tmpi].nsubrooms; m++) for (m = 0; m < g.rooms[tmpi].nsubrooms; m++)
if (rooms[tmpi].sbrooms[m]->needfill) if (g.rooms[tmpi].sbrooms[m]->needfill)
fill_room(rooms[tmpi].sbrooms[m], FALSE); fill_room(g.rooms[tmpi].sbrooms[m], FALSE);
} }
} }
@@ -823,7 +823,7 @@ rndtrap()
break; break;
case LEVEL_TELEP: case LEVEL_TELEP:
case TELEP_TRAP: case TELEP_TRAP:
if (level.flags.noteleport) if (g.level.flags.noteleport)
rtrap = NO_TRAP; rtrap = NO_TRAP;
break; break;
case ROLLING_BOULDER_TRAP: case ROLLING_BOULDER_TRAP:
@@ -1264,8 +1264,8 @@ xchar rtype, rlit;
add_room(xabs, yabs, xabs + wtmp - 1, yabs + htmp - 1, rlit, rtype, add_room(xabs, yabs, xabs + wtmp - 1, yabs + htmp - 1, rlit, rtype,
FALSE); FALSE);
} else { } else {
rooms[g.nroom].lx = xabs; g.rooms[g.nroom].lx = xabs;
rooms[g.nroom].ly = yabs; g.rooms[g.nroom].ly = yabs;
} }
return TRUE; return TRUE;
} }
@@ -2076,7 +2076,7 @@ struct mkroom *croom;
} else { } else {
get_location_coord(&x, &y, DRY, croom, a->coord); get_location_coord(&x, &y, DRY, croom, a->coord);
if ((sproom = (schar) *in_rooms(x, y, TEMPLE)) != 0) if ((sproom = (schar) *in_rooms(x, y, TEMPLE)) != 0)
croom = &rooms[sproom - ROOMOFFSET]; croom = &g.rooms[sproom - ROOMOFFSET];
else else
croom_is_temple = FALSE; croom_is_temple = FALSE;
} }
@@ -2113,7 +2113,7 @@ struct mkroom *croom;
if (a->shrine) { /* Is it a shrine or sanctum? */ if (a->shrine) { /* Is it a shrine or sanctum? */
priestini(&u.uz, croom, x, y, (a->shrine > 1)); priestini(&u.uz, croom, x, y, (a->shrine > 1));
levl[x][y].altarmask |= AM_SHRINE; levl[x][y].altarmask |= AM_SHRINE;
level.flags.has_temple = TRUE; g.level.flags.has_temple = TRUE;
} }
} }
@@ -2328,7 +2328,7 @@ fix_stair_rooms()
&& (g.dnstairs_room->ly <= ydnstair && (g.dnstairs_room->ly <= ydnstair
&& ydnstair <= g.dnstairs_room->hy))) { && ydnstair <= g.dnstairs_room->hy))) {
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
croom = &rooms[i]; croom = &g.rooms[i];
if ((croom->lx <= xdnstair && xdnstair <= croom->hx) if ((croom->lx <= xdnstair && xdnstair <= croom->hx)
&& (croom->ly <= ydnstair && ydnstair <= croom->hy)) { && (croom->ly <= ydnstair && ydnstair <= croom->hy)) {
g.dnstairs_room = croom; g.dnstairs_room = croom;
@@ -2343,7 +2343,7 @@ fix_stair_rooms()
&& (g.upstairs_room->ly <= yupstair && (g.upstairs_room->ly <= yupstair
&& yupstair <= g.upstairs_room->hy))) { && yupstair <= g.upstairs_room->hy))) {
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
croom = &rooms[i]; croom = &g.rooms[i];
if ((croom->lx <= xupstair && xupstair <= croom->hx) if ((croom->lx <= xupstair && xupstair <= croom->hx)
&& (croom->ly <= yupstair && yupstair <= croom->hy)) { && (croom->ly <= yupstair && yupstair <= croom->hy)) {
g.upstairs_room = croom; g.upstairs_room = croom;
@@ -2372,12 +2372,12 @@ corridor *c;
return; return;
} }
if (!search_door(&rooms[c->src.room], &org.x, &org.y, c->src.wall, if (!search_door(&g.rooms[c->src.room], &org.x, &org.y, c->src.wall,
c->src.door)) c->src.door))
return; return;
if (c->dest.room != -1) { if (c->dest.room != -1) {
if (!search_door(&rooms[c->dest.room], &dest.x, &dest.y, c->dest.wall, if (!search_door(&g.rooms[c->dest.room], &dest.x, &dest.y, c->dest.wall,
c->dest.door)) c->dest.door))
return; return;
switch (c->src.wall) { switch (c->src.wall) {
@@ -2429,7 +2429,7 @@ boolean prefilled;
/* Shop ? */ /* Shop ? */
if (croom->rtype >= SHOPBASE) { if (croom->rtype >= SHOPBASE) {
stock_room(croom->rtype - SHOPBASE, croom); stock_room(croom->rtype - SHOPBASE, croom);
level.flags.has_shop = TRUE; g.level.flags.has_shop = TRUE;
return; return;
} }
@@ -2454,28 +2454,28 @@ boolean prefilled;
} }
switch (croom->rtype) { switch (croom->rtype) {
case VAULT: case VAULT:
level.flags.has_vault = TRUE; g.level.flags.has_vault = TRUE;
break; break;
case ZOO: case ZOO:
level.flags.has_zoo = TRUE; g.level.flags.has_zoo = TRUE;
break; break;
case COURT: case COURT:
level.flags.has_court = TRUE; g.level.flags.has_court = TRUE;
break; break;
case MORGUE: case MORGUE:
level.flags.has_morgue = TRUE; g.level.flags.has_morgue = TRUE;
break; break;
case BEEHIVE: case BEEHIVE:
level.flags.has_beehive = TRUE; g.level.flags.has_beehive = TRUE;
break; break;
case BARRACKS: case BARRACKS:
level.flags.has_barracks = TRUE; g.level.flags.has_barracks = TRUE;
break; break;
case TEMPLE: case TEMPLE:
level.flags.has_temple = TRUE; g.level.flags.has_temple = TRUE;
break; break;
case SWAMP: case SWAMP:
level.flags.has_swamp = TRUE; g.level.flags.has_swamp = TRUE;
break; break;
} }
} }
@@ -2490,10 +2490,10 @@ struct mkroom *mkr;
xchar rtype = (!r->chance || rn2(100) < r->chance) ? r->rtype : OROOM; xchar rtype = (!r->chance || rn2(100) < r->chance) ? r->rtype : OROOM;
if (mkr) { if (mkr) {
aroom = &subrooms[g.nsubroom]; aroom = &g.subrooms[g.nsubroom];
okroom = create_subroom(mkr, r->x, r->y, r->w, r->h, rtype, r->rlit); okroom = create_subroom(mkr, r->x, r->y, r->w, r->h, rtype, r->rlit);
} else { } else {
aroom = &rooms[g.nroom]; aroom = &g.rooms[g.nroom];
okroom = create_room(r->x, r->y, r->w, r->h, r->xalign, r->yalign, okroom = create_room(r->x, r->y, r->w, r->h, r->xalign, r->yalign,
rtype, r->rlit); rtype, r->rlit);
} }
@@ -3270,29 +3270,29 @@ struct sp_coder *coder;
lflags = OV_i(flagdata); lflags = OV_i(flagdata);
if (lflags & NOTELEPORT) if (lflags & NOTELEPORT)
level.flags.noteleport = 1; g.level.flags.noteleport = 1;
if (lflags & HARDFLOOR) if (lflags & HARDFLOOR)
level.flags.hardfloor = 1; g.level.flags.hardfloor = 1;
if (lflags & NOMMAP) if (lflags & NOMMAP)
level.flags.nommap = 1; g.level.flags.nommap = 1;
if (lflags & SHORTSIGHTED) if (lflags & SHORTSIGHTED)
level.flags.shortsighted = 1; g.level.flags.shortsighted = 1;
if (lflags & ARBOREAL) if (lflags & ARBOREAL)
level.flags.arboreal = 1; g.level.flags.arboreal = 1;
if (lflags & MAZELEVEL) if (lflags & MAZELEVEL)
level.flags.is_maze_lev = 1; g.level.flags.is_maze_lev = 1;
if (lflags & PREMAPPED) if (lflags & PREMAPPED)
coder->premapped = TRUE; coder->premapped = TRUE;
if (lflags & SHROUD) if (lflags & SHROUD)
level.flags.hero_memory = 0; g.level.flags.hero_memory = 0;
if (lflags & GRAVEYARD) if (lflags & GRAVEYARD)
level.flags.graveyard = 1; g.level.flags.graveyard = 1;
if (lflags & ICEDPOOLS) if (lflags & ICEDPOOLS)
g.icedpools = TRUE; g.icedpools = TRUE;
if (lflags & SOLIDIFY) if (lflags & SOLIDIFY)
coder->solidify = TRUE; coder->solidify = TRUE;
if (lflags & CORRMAZE) if (lflags & CORRMAZE)
level.flags.corrmaze = TRUE; g.level.flags.corrmaze = TRUE;
if (lflags & CHECK_INACCESSIBLES) if (lflags & CHECK_INACCESSIBLES)
coder->check_inaccessibles = TRUE; coder->check_inaccessibles = TRUE;
@@ -4639,7 +4639,7 @@ struct sp_coder *coder;
return; return;
} }
troom = &rooms[g.nroom]; troom = &g.rooms[g.nroom];
/* mark rooms that must be filled, but do it later */ /* mark rooms that must be filled, but do it later */
if (OV_i(rtype) != OROOM) if (OV_i(rtype) != OROOM)
@@ -4722,7 +4722,7 @@ struct sp_coder *coder;
return; return;
if (OV_i(ftyp) < 1) { if (OV_i(ftyp) < 1) {
OV_i(ftyp) = level.flags.corrmaze ? CORR : ROOM; OV_i(ftyp) = g.level.flags.corrmaze ? CORR : ROOM;
} }
/* don't use move() - it doesn't use W_NORTH, etc. */ /* don't use move() - it doesn't use W_NORTH, etc. */
@@ -5330,7 +5330,7 @@ sp_lev *lvl;
(void) memset((genericptr_t) &g.SpLev_Map[0][0], 0, sizeof g.SpLev_Map); (void) memset((genericptr_t) &g.SpLev_Map[0][0], 0, sizeof g.SpLev_Map);
level.flags.is_maze_lev = 0; g.level.flags.is_maze_lev = 0;
g.xstart = 1; g.xstart = 1;
g.ystart = 0; g.ystart = 0;
@@ -5979,7 +5979,7 @@ sp_lev *lvl;
* is currently not possible, we overload the corrmaze flag for this * is currently not possible, we overload the corrmaze flag for this
* purpose. * purpose.
*/ */
if (!level.flags.corrmaze) if (!g.level.flags.corrmaze)
wallification(1, 0, COLNO - 1, ROWNO - 1); wallification(1, 0, COLNO - 1, ROWNO - 1);
count_features(); count_features();
+2 -2
View File
@@ -755,10 +755,10 @@ int x, y;
(mon == u.usteed) ? "steed" : "defunct monster"); (mon == u.usteed) ? "steed" : "defunct monster");
return; return;
} }
if (level.monsters[x][y]) if (g.level.monsters[x][y])
impossible("placing monster over another at <%d,%d>?", x, y); impossible("placing monster over another at <%d,%d>?", x, y);
mon->mx = x, mon->my = y; mon->mx = x, mon->my = y;
level.monsters[x][y] = mon; g.level.monsters[x][y] = mon;
} }
/*steed.c*/ /*steed.c*/
+12 -12
View File
@@ -437,7 +437,7 @@ struct obj *scroll;
boolean result = FALSE; /* don't learn scroll */ boolean result = FALSE; /* don't learn scroll */
/* Disable teleportation in stronghold && Vlad's Tower */ /* Disable teleportation in stronghold && Vlad's Tower */
if (level.flags.noteleport) { if (g.level.flags.noteleport) {
if (!wizard) { if (!wizard) {
pline("A mysterious force prevents you from teleporting!"); pline("A mysterious force prevents you from teleporting!");
return TRUE; return TRUE;
@@ -700,8 +700,8 @@ level_tele()
if (invent) if (invent)
Your("possessions land on the %s with a thud.", Your("possessions land on the %s with a thud.",
surface(u.ux, u.uy)); surface(u.ux, u.uy));
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, "committed suicide"); Strcpy(g.killer.name, "committed suicide");
done(DIED); done(DIED);
pline("An energized cloud of dust begins to coalesce."); pline("An energized cloud of dust begins to coalesce.");
Your("body rematerializes%s.", Your("body rematerializes%s.",
@@ -755,7 +755,7 @@ level_tele()
return; return;
} }
killer.name[0] = 0; /* still alive, so far... */ g.killer.name[0] = 0; /* still alive, so far... */
if (iflags.debug_fuzzer && newlev < 0) if (iflags.debug_fuzzer && newlev < 0)
goto random_levtport; goto random_levtport;
@@ -771,8 +771,8 @@ level_tele()
if (newlev <= -10) { if (newlev <= -10) {
You("arrive in heaven."); You("arrive in heaven.");
verbalize("Thou art early, but we'll admit thee."); verbalize("Thou art early, but we'll admit thee.");
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, "went to heaven prematurely"); Strcpy(g.killer.name, "went to heaven prematurely");
} else if (newlev == -9) { } else if (newlev == -9) {
You_feel("deliriously happy."); You_feel("deliriously happy.");
pline("(In fact, you're on Cloud 9!)"); pline("(In fact, you're on Cloud 9!)");
@@ -780,7 +780,7 @@ level_tele()
} else } else
You("are now high above the clouds..."); You("are now high above the clouds...");
if (killer.name[0]) { if (g.killer.name[0]) {
; /* arrival in heaven is pending */ ; /* arrival in heaven is pending */
} else if (Levitation) { } else if (Levitation) {
escape_by_flying = "float gently down to earth"; escape_by_flying = "float gently down to earth";
@@ -789,14 +789,14 @@ level_tele()
} else { } else {
pline("Unfortunately, you don't know how to fly."); pline("Unfortunately, you don't know how to fly.");
You("plummet a few thousand feet to your death."); You("plummet a few thousand feet to your death.");
Sprintf(killer.name, Sprintf(g.killer.name,
"teleported out of the dungeon and fell to %s death", "teleported out of the dungeon and fell to %s death",
uhis()); uhis());
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
} }
} }
if (killer.name[0]) { /* the chosen destination was not survivable */ if (g.killer.name[0]) { /* the chosen destination was not survivable */
d_level lsav; d_level lsav;
/* set specific death location; this also suppresses bones */ /* set specific death location; this also suppresses bones */
@@ -1119,7 +1119,7 @@ boolean
tele_restrict(mon) tele_restrict(mon)
struct monst *mon; struct monst *mon;
{ {
if (level.flags.noteleport) { if (g.level.flags.noteleport) {
if (canseemon(mon)) if (canseemon(mon))
pline("A mysterious force prevents %s from teleporting!", pline("A mysterious force prevents %s from teleporting!",
mon_nam(mon)); mon_nam(mon));
@@ -1389,7 +1389,7 @@ boolean give_feedback;
if (give_feedback) if (give_feedback)
pline("%s resists your magic!", Monnam(mtmp)); pline("%s resists your magic!", Monnam(mtmp));
return FALSE; return FALSE;
} else if (level.flags.noteleport && u.uswallow && mtmp == u.ustuck) { } else if (g.level.flags.noteleport && u.uswallow && mtmp == u.ustuck) {
if (give_feedback) if (give_feedback)
You("are no longer inside %s!", mon_nam(mtmp)); You("are no longer inside %s!", mon_nam(mtmp));
unstuck(mtmp); unstuck(mtmp);
+22 -22
View File
@@ -379,11 +379,11 @@ struct kinfo *kptr;
} }
/* more sure killer reason is set up */ /* more sure killer reason is set up */
if (kptr && kptr->name[0]) { if (kptr && kptr->name[0]) {
killer.format = kptr->format; g.killer.format = kptr->format;
Strcpy(killer.name, kptr->name); Strcpy(g.killer.name, kptr->name);
} else { } else {
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, "turned into green slime"); Strcpy(g.killer.name, "turned into green slime");
} }
dealloc_killer(kptr); dealloc_killer(kptr);
@@ -410,8 +410,8 @@ struct kinfo *kptr;
/* life-saved; even so, hero still has turned into green slime; /* life-saved; even so, hero still has turned into green slime;
player may have genocided green slimes after being infected */ player may have genocided green slimes after being infected */
if ((g.mvitals[PM_GREEN_SLIME].mvflags & G_GENOD) != 0) { if ((g.mvitals[PM_GREEN_SLIME].mvflags & G_GENOD) != 0) {
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "slimicide"); Strcpy(g.killer.name, "slimicide");
/* immediately follows "OK, so you don't die." */ /* immediately follows "OK, so you don't die." */
pline("Yes, you do. Green slime has been genocided..."); pline("Yes, you do. Green slime has been genocided...");
done(GENOCIDED); done(GENOCIDED);
@@ -522,11 +522,11 @@ nh_timeout()
switch (upp - u.uprops) { switch (upp - u.uprops) {
case STONED: case STONED:
if (kptr && kptr->name[0]) { if (kptr && kptr->name[0]) {
killer.format = kptr->format; g.killer.format = kptr->format;
Strcpy(killer.name, kptr->name); Strcpy(g.killer.name, kptr->name);
} else { } else {
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, "killed by petrification"); Strcpy(g.killer.name, "killed by petrification");
} }
dealloc_killer(kptr); dealloc_killer(kptr);
/* (unlike sliming, you aren't changing form here) */ /* (unlike sliming, you aren't changing form here) */
@@ -541,20 +541,20 @@ nh_timeout()
case SICK: case SICK:
You("die from your illness."); You("die from your illness.");
if (kptr && kptr->name[0]) { if (kptr && kptr->name[0]) {
killer.format = kptr->format; g.killer.format = kptr->format;
Strcpy(killer.name, kptr->name); Strcpy(g.killer.name, kptr->name);
} else { } else {
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
killer.name[0] = 0; /* take the default */ g.killer.name[0] = 0; /* take the default */
} }
dealloc_killer(kptr); dealloc_killer(kptr);
if ((m_idx = name_to_mon(killer.name)) >= LOW_PM) { if ((m_idx = name_to_mon(g.killer.name)) >= LOW_PM) {
if (type_is_pname(&mons[m_idx])) { if (type_is_pname(&mons[m_idx])) {
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
} else if (mons[m_idx].geno & G_UNIQ) { } else if (mons[m_idx].geno & G_UNIQ) {
Strcpy(killer.name, the(killer.name)); Strcpy(g.killer.name, the(g.killer.name));
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
} }
} }
u.usick_type = 0; u.usick_type = 0;
@@ -658,8 +658,8 @@ nh_timeout()
} }
break; break;
case STRANGLED: case STRANGLED:
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, Strcpy(g.killer.name,
(u.uburied) ? "suffocation" : "strangulation"); (u.uburied) ? "suffocation" : "strangulation");
done(DIED); done(DIED);
/* must be declining to die in explore|wizard mode; /* must be declining to die in explore|wizard mode;
@@ -1000,9 +1000,9 @@ slip_or_trip()
} }
if (!uarmf && otmp->otyp == CORPSE if (!uarmf && otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm]) && !Stone_resistance) { && touch_petrifies(&mons[otmp->corpsenm]) && !Stone_resistance) {
Sprintf(killer.name, "tripping over %s corpse", Sprintf(g.killer.name, "tripping over %s corpse",
an(mons[otmp->corpsenm].mname)); an(mons[otmp->corpsenm].mname));
instapetrify(killer.name); instapetrify(g.killer.name);
} }
} else if (rn2(3) && is_ice(u.ux, u.uy)) { } else if (rn2(3) && is_ice(u.ux, u.uy)) {
pline("%s %s%s on the ice.", pline("%s %s%s on the ice.",
+4 -4
View File
@@ -82,7 +82,7 @@ STATIC_DCL void FDECL(nsb_mung_line, (char *));
STATIC_DCL void FDECL(nsb_unmung_line, (char *)); STATIC_DCL void FDECL(nsb_unmung_line, (char *));
#endif #endif
/* "killed by",&c ["an"] 'killer.name' */ /* "killed by",&c ["an"] 'g.killer.name' */
void void
formatkiller(buf, siz, how, incl_helpless) formatkiller(buf, siz, how, incl_helpless)
char *buf; char *buf;
@@ -101,12 +101,12 @@ boolean incl_helpless;
"", "", "", "", "" "", "", "", "", ""
}; };
unsigned l; unsigned l;
char c, *kname = killer.name; char c, *kname = g.killer.name;
buf[0] = '\0'; /* lint suppression */ buf[0] = '\0'; /* lint suppression */
switch (killer.format) { switch (g.killer.format) {
default: default:
impossible("bad killer format? (%d)", killer.format); impossible("bad killer format? (%d)", g.killer.format);
/*FALLTHRU*/ /*FALLTHRU*/
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
break; break;
+16 -16
View File
@@ -418,9 +418,9 @@ int x, y, typ;
else if (lev->typ == STONE || lev->typ == SCORR) else if (lev->typ == STONE || lev->typ == SCORR)
lev->typ = CORR; lev->typ = CORR;
else if (IS_WALL(lev->typ) || lev->typ == SDOOR) else if (IS_WALL(lev->typ) || lev->typ == SDOOR)
lev->typ = level.flags.is_maze_lev lev->typ = g.level.flags.is_maze_lev
? ROOM ? ROOM
: level.flags.is_cavernous_lev ? CORR : DOOR; : g.level.flags.is_cavernous_lev ? CORR : DOOR;
unearth_objs(x, y); unearth_objs(x, y);
break; break;
@@ -2723,9 +2723,9 @@ const char *str;
if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
return; return;
You("turn to stone..."); You("turn to stone...");
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
if (str != killer.name) if (str != g.killer.name)
Strcpy(killer.name, str ? str : ""); Strcpy(g.killer.name, str ? str : "");
done(STONING); done(STONING);
} }
@@ -3770,7 +3770,7 @@ drown()
if ((Teleportation || can_teleport(youmonst.data)) && !Unaware if ((Teleportation || can_teleport(youmonst.data)) && !Unaware
&& (Teleport_control || rn2(3) < Luck + 2)) { && (Teleport_control || rn2(3) < Luck + 2)) {
You("attempt a teleport spell."); /* utcsri!carroll */ You("attempt a teleport spell."); /* utcsri!carroll */
if (!level.flags.noteleport) { if (!g.level.flags.noteleport) {
(void) dotele(FALSE); (void) dotele(FALSE);
if (!is_pool(u.ux, u.uy)) if (!is_pool(u.ux, u.uy))
return TRUE; return TRUE;
@@ -3834,11 +3834,11 @@ crawl:
/* killer format and name are reconstructed every iteration /* killer format and name are reconstructed every iteration
because lifesaving resets them */ because lifesaving resets them */
pool_of_water = waterbody_name(u.ux, u.uy); pool_of_water = waterbody_name(u.ux, u.uy);
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
/* avoid "drowned in [a] water" */ /* avoid "drowned in [a] water" */
if (!strcmp(pool_of_water, "water")) if (!strcmp(pool_of_water, "water"))
pool_of_water = "deep water", killer.format = KILLED_BY; pool_of_water = "deep water", g.killer.format = KILLED_BY;
Strcpy(killer.name, pool_of_water); Strcpy(g.killer.name, pool_of_water);
done(DROWNING); done(DROWNING);
/* oops, we're still alive. better get out of the water. */ /* oops, we're still alive. better get out of the water. */
if (safe_teleds(TRUE)) if (safe_teleds(TRUE))
@@ -4366,7 +4366,7 @@ boolean force;
here = (x == u.ux && y == u.uy); /* !u.dx && !u.dy */ here = (x == u.ux && y == u.uy); /* !u.dx && !u.dy */
if (here) /* are there are one or more containers here? */ if (here) /* are there are one or more containers here? */
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) { if (Is_box(otmp)) {
if (++boxcnt > 1) if (++boxcnt > 1)
break; break;
@@ -4459,7 +4459,7 @@ boolean force;
} /* end if */ } /* end if */
if (boxcnt) { if (boxcnt) {
for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere) for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) { if (Is_box(otmp)) {
(void) safe_qbuf(qbuf, "There is ", (void) safe_qbuf(qbuf, "There is ",
" here. Check it for traps?", otmp, " here. Check it for traps?", otmp,
@@ -4835,7 +4835,7 @@ boolean disarm;
&& uball->ox == u.ux && uball->oy == u.uy))) && uball->ox == u.ux && uball->oy == u.uy)))
unpunish(); unpunish();
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp2) { for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere; otmp2 = otmp->nexthere;
if (costly) if (costly)
loss += stolen_value(otmp, otmp->ox, otmp->oy, loss += stolen_value(otmp, otmp->ox, otmp->oy,
@@ -5297,8 +5297,8 @@ lava_effects()
u.uhp = -1; u.uhp = -1;
/* killer format and name are reconstructed every iteration /* killer format and name are reconstructed every iteration
because lifesaving resets them */ because lifesaving resets them */
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, lava_killer); Strcpy(g.killer.name, lava_killer);
You("%s...", boil_away ? "boil away" : "burn to a crisp"); You("%s...", boil_away ? "boil away" : "burn to a crisp");
done(BURNING); done(BURNING);
if (safe_teleds(TRUE)) if (safe_teleds(TRUE))
@@ -5349,8 +5349,8 @@ sink_into_lava()
u.utrap -= (1 << 8); u.utrap -= (1 << 8);
if (u.utrap < (1 << 8)) { if (u.utrap < (1 << 8)) {
killer.format = KILLED_BY; g.killer.format = KILLED_BY;
Strcpy(killer.name, "molten lava"); Strcpy(g.killer.name, "molten lava");
You("sink below the surface and die."); You("sink below the surface and die.");
burn_away_slime(); /* add insult to injury? */ burn_away_slime(); /* add insult to injury? */
done(DISSOLVED); done(DISSOLVED);
+4 -4
View File
@@ -188,7 +188,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
mtmp->mtame ? "tame" : "wild", l_monnam(mtmp)); mtmp->mtame ? "tame" : "wild", l_monnam(mtmp));
else if (Blind || (is_pool(mtmp->mx, mtmp->my) && !Underwater)) else if (Blind || (is_pool(mtmp->mx, mtmp->my) && !Underwater))
pline("Wait! There's a hidden monster there!"); pline("Wait! There's a hidden monster there!");
else if ((obj = level.objects[mtmp->mx][mtmp->my]) != 0) else if ((obj = g.level.objects[mtmp->mx][mtmp->my]) != 0)
pline("Wait! There's %s hiding under %s!", pline("Wait! There's %s hiding under %s!",
an(l_monnam(mtmp)), doname(obj)); an(l_monnam(mtmp)), doname(obj));
return TRUE; return TRUE;
@@ -353,7 +353,7 @@ register struct monst *mtmp;
/* only check for in-shop if don't already have reason to stop */ /* only check for in-shop if don't already have reason to stop */
if (!foo) { if (!foo) {
for (p = in_rooms(mtmp->mx, mtmp->my, SHOPBASE); *p; p++) for (p = in_rooms(mtmp->mx, mtmp->my, SHOPBASE); *p; p++)
if (tended_shop(&rooms[*p - ROOMOFFSET])) { if (tended_shop(&g.rooms[*p - ROOMOFFSET])) {
inshop = TRUE; inshop = TRUE;
break; break;
} }
@@ -2099,9 +2099,9 @@ register struct attack *mattk;
if (is_rider(pd)) { if (is_rider(pd)) {
pline("Unfortunately, digesting any of it is fatal."); pline("Unfortunately, digesting any of it is fatal.");
end_engulf(); end_engulf();
Sprintf(killer.name, "unwisely tried to eat %s", Sprintf(g.killer.name, "unwisely tried to eat %s",
pd->mname); pd->mname);
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
done(DIED); done(DIED);
return 0; /* lifesaved */ return 0; /* lifesaved */
} }
+9 -9
View File
@@ -228,7 +228,7 @@ char *array;
register char *ptr; register char *ptr;
for (ptr = array; *ptr; ptr++) for (ptr = array; *ptr; ptr++)
if (rooms[*ptr - ROOMOFFSET].rtype == VAULT) if (g.rooms[*ptr - ROOMOFFSET].rtype == VAULT)
return *ptr; return *ptr;
return '\0'; return '\0';
} }
@@ -496,8 +496,8 @@ invault()
EGD(guard)->fakecorr[0].ftyp = levl[x][y].typ; EGD(guard)->fakecorr[0].ftyp = levl[x][y].typ;
} else { /* the initial guard location is a dug door */ } else { /* the initial guard location is a dug door */
int vlt = EGD(guard)->vroom; int vlt = EGD(guard)->vroom;
xchar lowx = rooms[vlt].lx, hix = rooms[vlt].hx; xchar lowx = g.rooms[vlt].lx, hix = g.rooms[vlt].hx;
xchar lowy = rooms[vlt].ly, hiy = rooms[vlt].hy; xchar lowy = g.rooms[vlt].ly, hiy = g.rooms[vlt].hy;
if (x == lowx - 1 && y == lowy - 1) if (x == lowx - 1 && y == lowy - 1)
EGD(guard)->fakecorr[0].ftyp = TLCORNER; EGD(guard)->fakecorr[0].ftyp = TLCORNER;
@@ -529,8 +529,8 @@ int vroom;
remove_object(gold); remove_object(gold);
newsym(gold->ox, gold->oy); newsym(gold->ox, gold->oy);
nx = rooms[vroom].lx + rn2(2); nx = g.rooms[vroom].lx + rn2(2);
ny = rooms[vroom].ly + rn2(2); ny = g.rooms[vroom].ly + rn2(2);
place_object(gold, nx, ny); place_object(gold, nx, ny);
stackobj(gold); stackobj(gold);
newsym(nx, ny); newsym(nx, ny);
@@ -543,8 +543,8 @@ struct monst *grd;
int x, y, typ; int x, y, typ;
int vlt = EGD(grd)->vroom; int vlt = EGD(grd)->vroom;
char tmp_viz; char tmp_viz;
xchar lox = rooms[vlt].lx - 1, hix = rooms[vlt].hx + 1, xchar lox = g.rooms[vlt].lx - 1, hix = g.rooms[vlt].hx + 1,
loy = rooms[vlt].ly - 1, hiy = rooms[vlt].hy + 1; loy = g.rooms[vlt].ly - 1, hiy = g.rooms[vlt].hy + 1;
struct monst *mon; struct monst *mon;
struct obj *gold; struct obj *gold;
struct trap *trap; struct trap *trap;
@@ -1057,8 +1057,8 @@ paygd()
} }
mnexto(grd); mnexto(grd);
pline("%s remits your gold to the vault.", Monnam(grd)); pline("%s remits your gold to the vault.", Monnam(grd));
gx = rooms[EGD(grd)->vroom].lx + rn2(2); gx = g.rooms[EGD(grd)->vroom].lx + rn2(2);
gy = rooms[EGD(grd)->vroom].ly + rn2(2); gy = g.rooms[EGD(grd)->vroom].ly + rn2(2);
Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.", Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.",
g.plname, mons[u.umonster].mname); g.plname, mons[u.umonster].mname);
make_grave(gx, gy, buf); make_grave(gx, gy, buf);
+5 -5
View File
@@ -160,7 +160,7 @@ register struct rm *lev;
return 1; return 1;
/* Boulders block light. */ /* Boulders block light. */
for (obj = level.objects[x][y]; obj; obj = obj->nexthere) for (obj = g.level.objects[x][y]; obj; obj = obj->nexthere)
if (obj->otyp == BOULDER) if (obj->otyp == BOULDER)
return 1; return 1;
@@ -295,12 +295,12 @@ char *rmin, *rmax;
/* If in a lit room, we are able to see to its boundaries. */ /* If in a lit room, we are able to see to its boundaries. */
/* If dark, set COULD_SEE so various spells work -dlc */ /* If dark, set COULD_SEE so various spells work -dlc */
if (rnum >= 0) { if (rnum >= 0) {
for (zy = rooms[rnum].ly - 1; zy <= rooms[rnum].hy + 1; zy++) { for (zy = g.rooms[rnum].ly - 1; zy <= g.rooms[rnum].hy + 1; zy++) {
rmin[zy] = start = rooms[rnum].lx - 1; rmin[zy] = start = g.rooms[rnum].lx - 1;
rmax[zy] = stop = rooms[rnum].hx + 1; rmax[zy] = stop = g.rooms[rnum].hx + 1;
for (zx = start; zx <= stop; zx++) { for (zx = start; zx <= stop; zx++) {
if (rooms[rnum].rlit) { if (g.rooms[rnum].rlit) {
next[zy][zx] = COULD_SEE | IN_SIGHT; next[zy][zx] = COULD_SEE | IN_SIGHT;
levl[zx][zy].seenv = SVALL; /* see the walls */ levl[zx][zy].seenv = SVALL; /* see the walls */
} else } else
+1 -1
View File
@@ -598,7 +598,7 @@ struct monst *worm;
if (curr->wx) { if (curr->wx) {
if (!isok(curr->wx, curr->wy)) if (!isok(curr->wx, curr->wy))
panic("worm seg not isok"); panic("worm seg not isok");
if (level.monsters[curr->wx][curr->wy] != worm) if (g.level.monsters[curr->wx][curr->wy] != worm)
panic("worm not at seg location"); panic("worm not at seg location");
} }
curr = curr->nseg; curr = curr->nseg;
+10 -10
View File
@@ -1892,7 +1892,7 @@ struct obj *obj, *otmp;
if (obj_shudders(obj)) { if (obj_shudders(obj)) {
boolean cover = boolean cover =
((obj == level.objects[u.ux][u.uy]) && u.uundetected ((obj == g.level.objects[u.ux][u.uy]) && u.uundetected
&& hides_under(youmonst.data)); && hides_under(youmonst.data));
if (cansee(obj->ox, obj->oy)) if (cansee(obj->ox, obj->oy))
@@ -2069,17 +2069,17 @@ schar zz;
} }
g.poly_zapped = -1; g.poly_zapped = -1;
for (otmp = level.objects[tx][ty]; otmp; otmp = next_obj) { for (otmp = g.level.objects[tx][ty]; otmp; otmp = next_obj) {
next_obj = otmp->nexthere; next_obj = otmp->nexthere;
/* for zap downwards, don't hit object poly'd hero is hiding under */ /* for zap downwards, don't hit object poly'd hero is hiding under */
if (zz > 0 && u.uundetected && otmp == level.objects[u.ux][u.uy] if (zz > 0 && u.uundetected && otmp == g.level.objects[u.ux][u.uy]
&& hides_under(youmonst.data)) && hides_under(youmonst.data))
continue; continue;
hitanything += (*fhito)(otmp, obj); hitanything += (*fhito)(otmp, obj);
} }
if (g.poly_zapped >= 0) if (g.poly_zapped >= 0)
create_polymon(level.objects[tx][ty], g.poly_zapped); create_polymon(g.level.objects[tx][ty], g.poly_zapped);
return hitanything; return hitanything;
} }
@@ -2412,8 +2412,8 @@ boolean ordinary;
break; break;
} }
learn_it = TRUE; learn_it = TRUE;
Sprintf(killer.name, "shot %sself with a death ray", uhim()); Sprintf(g.killer.name, "shot %sself with a death ray", uhim());
killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
You("irradiate yourself with pure energy!"); You("irradiate yourself with pure energy!");
You("die."); You("die.");
/* They might survive with an amulet of life saving */ /* They might survive with an amulet of life saving */
@@ -2935,7 +2935,7 @@ struct obj *obj; /* wand or spell */
*/ */
if (u.uundetected && hides_under(youmonst.data)) { if (u.uundetected && hides_under(youmonst.data)) {
int hitit = 0; int hitit = 0;
otmp = level.objects[u.ux][u.uy]; otmp = g.level.objects[u.ux][u.uy];
if (otmp) if (otmp)
hitit = bhito(otmp, obj); hitit = bhito(otmp, obj);
@@ -3769,8 +3769,8 @@ xchar sx, sy;
You("aren't affected."); You("aren't affected.");
break; break;
} }
killer.format = KILLED_BY_AN; g.killer.format = KILLED_BY_AN;
Strcpy(killer.name, fltxt ? fltxt : ""); Strcpy(g.killer.name, fltxt ? fltxt : "");
/* when killed by disintegration breath, don't leave corpse */ /* when killed by disintegration breath, don't leave corpse */
u.ugrave_arise = (type == -ZT_BREATH(ZT_DEATH)) ? -3 : NON_PM; u.ugrave_arise = (type == -ZT_BREATH(ZT_DEATH)) ? -3 : NON_PM;
done(DIED); done(DIED);
@@ -3834,7 +3834,7 @@ boolean u_caused;
char buf1[BUFSZ], buf2[BUFSZ]; char buf1[BUFSZ], buf2[BUFSZ];
int cnt = 0; int cnt = 0;
for (obj = level.objects[x][y]; obj; obj = obj2) { for (obj = g.level.objects[x][y]; obj; obj = obj2) {
obj2 = obj->nexthere; obj2 = obj->nexthere;
if (obj->oclass == SCROLL_CLASS || obj->oclass == SPBOOK_CLASS if (obj->oclass == SCROLL_CLASS || obj->oclass == SPBOOK_CLASS
|| (obj->oclass == FOOD_CLASS || (obj->oclass == FOOD_CLASS
+4 -4
View File
@@ -925,12 +925,12 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
if (data->bUnicodeFont) { if (data->bUnicodeFont) {
wch = winos_ascii_to_wide(ch); wch = winos_ascii_to_wide(ch);
if (wch == 0x2591 || wch == 0x2592) { if (wch == 0x2591 || wch == 0x2592) {
int level = 80; int intensity = 80;
HBRUSH brush = CreateSolidBrush(RGB(level, level, level)); HBRUSH brush = CreateSolidBrush(RGB(intensity, intensity, intensity));
FillRect(data->backBufferDC, rect, brush); FillRect(data->backBufferDC, rect, brush);
DeleteObject(brush); DeleteObject(brush);
level = (wch == 0x2591 ? 100 : 200); intensity = (wch == 0x2591 ? 100 : 200);
brush = CreateSolidBrush(RGB(level, level, level)); brush = CreateSolidBrush(RGB(intensity, intensity, intensity));
RECT smallRect = { rect->left + 1, rect->top + 1, RECT smallRect = { rect->left + 1, rect->top + 1,
rect->right - 1, rect->bottom - 1 }; rect->right - 1, rect->bottom - 1 };
FillRect(data->backBufferDC, &smallRect, brush); FillRect(data->backBufferDC, &smallRect, brush);