split g into multiple structures

The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.

It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.

Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.

To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.

A global variable named 'amulets', would be found in ga.
    ga.amulets
     ^ ^
A global varable named 'move', would be found in gm.
    gm.moves
     ^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
    gv.val_for_n_or_more
     ^ ^
A global variable named 'youmonst' would be found in gy.
    gy.youmonst
     ^ ^
This commit is contained in:
nhmall
2022-11-29 21:53:21 -05:00
parent e64ed2859d
commit 02a48aa8cf
193 changed files with 10764 additions and 10148 deletions
+4 -3
View File
@@ -46,9 +46,10 @@ process. Among them:
* Add support to make the game restartable without exit (a.k.a. "play again"
support). Toward that end, many previously scattered and separate variables
have been gathered into a central 'g' structure in decl.h/decl.c. That
will benefit the porting effort to some platforms that are under
consideration.
have been gathered into central 'ga' through 'gv' structures in
decl.h/decl.c. That central ability to reinitialize the variables will
benefit the porting effort to some platforms that are under consideration
where "play again" is typical.
Here are some other general notes on the changes in NetHack 3.7 that were not
considered spoilers:
+1 -1
View File
@@ -13,7 +13,7 @@ typedef struct align { /* alignment & record */
} align;
/* bounds for "record" -- respect initial alignments of 10 */
#define ALIGNLIM (10L + (g.moves / 200L))
#define ALIGNLIM (10L + (gm.moves / 200L))
#define A_NONE (-128) /* the value range of type */
+2 -2
View File
@@ -41,7 +41,7 @@ struct attribs {
};
#define ATTRMAX(x) \
((x == A_STR && Upolyd) ? uasmon_maxStr() : g.urace.attrmax[x])
#define ATTRMIN(x) (g.urace.attrmin[x])
((x == A_STR && Upolyd) ? uasmon_maxStr() : gu.urace.attrmax[x])
#define ATTRMIN(x) (gu.urace.attrmin[x])
#endif /* ATTRIB_H */
+1 -1
View File
@@ -133,7 +133,7 @@ struct context_info {
/* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
/* 8: travel */
unsigned startingpet_mid; /* monster id number for initial pet */
int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */
int current_fruit; /* fruit->fid corresponding to gp.pl_fruit[] */
int mysteryforce; /* adjusts how often "mysterious force" kicks in */
int rndencode; /* randomized escape sequence introducer */
int warnlevel; /* threshold (digit) to warn about unseen mons */
+840 -445
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -19,7 +19,7 @@
* Returns the head of the list of objects that the player can see
* at location (x,y). [Vestige of unimplemented invisible objects.]
*/
#define vobj_at(x, y) (g.level.objects[x][y])
#define vobj_at(x, y) (gl.level.objects[x][y])
/*
* sensemon()
@@ -63,7 +63,7 @@
*/
#define _mon_warning(mon) \
(Warning && !(mon)->mpeaceful && (mdistu(mon) < 100) \
&& (((int) ((mon)->m_lev / 4)) >= g.context.warnlevel))
&& (((int) ((mon)->m_lev / 4)) >= gc.context.warnlevel))
/*
* mon_visible()
@@ -250,11 +250,11 @@
((int) U_AP_TYPE == M_AP_NOTHING) \
? hero_glyph \
: ((int) U_AP_TYPE == M_AP_FURNITURE) \
? cmap_to_glyph((int) g.youmonst.mappearance) \
? cmap_to_glyph((int) gy.youmonst.mappearance) \
: ((int) U_AP_TYPE == M_AP_OBJECT) \
? objnum_to_glyph((int) g.youmonst.mappearance) \
? objnum_to_glyph((int) gy.youmonst.mappearance) \
/* else U_AP_TYPE == M_AP_MONSTER */ \
: monnum_to_glyph((int) g.youmonst.mappearance, Ugender)))
: monnum_to_glyph((int) gy.youmonst.mappearance, Ugender)))
/*
* NetHack glyphs
@@ -637,7 +637,7 @@ enum glyph_offsets {
/* The hero's glyph when seen as a monster.
*/
#define hero_glyph \
monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : g.urace.mnum, \
monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : gu.urace.mnum, \
(Ugender))
/*
@@ -801,8 +801,8 @@ enum glyph_offsets {
#define obj_is_piletop(obj) \
((obj)->where == OBJ_FLOOR \
/*&& g.level.objects[(obj)->ox][(obj)->oy]*/ \
&& g.level.objects[(obj)->ox][(obj)->oy]->nexthere)
/*&& gl.level.objects[(obj)->ox][(obj)->oy]*/ \
&& gl.level.objects[(obj)->ox][(obj)->oy]->nexthere)
#define glyph_is_body_piletop(glyph) \
(((glyph) >= GLYPH_BODY_PILETOP_OFF) \
@@ -906,9 +906,9 @@ enum glyph_offsets {
/* These have the unfortunate side effect of needing a global variable */
/* to store a result. 'otg_temp' is defined and declared in decl.{ch}. */
#define random_obj_to_glyph(rng) \
((g.otg_temp = random_object(rng)) == CORPSE \
((go.otg_temp = random_object(rng)) == CORPSE \
? (random_monster(rng) + GLYPH_BODY_OFF) \
: (g.otg_temp + GLYPH_OBJ_OFF))
: (go.otg_temp + GLYPH_OBJ_OFF))
#define corpse_to_glyph(obj) \
((int) ((obj)->corpsenm + (obj_is_piletop(obj) \
? GLYPH_BODY_PILETOP_OFF \
+1 -1
View File
@@ -246,7 +246,7 @@ typedef struct mapseen {
struct mapseen_rooms {
Bitfield(seen, 1);
Bitfield(untended, 1); /* flag for shop without shk */
} msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as g.rooms[] */
} msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as gr.rooms[] */
/* dead heroes; might not have graves or ghosts */
struct cemetery *final_resting_place; /* same as level.bonesinfo */
} mapseen;
+1 -1
View File
@@ -189,7 +189,7 @@ struct debug_flags {
*/
struct instance_flags {
boolean debug_fuzzer; /* fuzz testing */
boolean defer_plname; /* X11 hack: askname() might not set g.plname */
boolean defer_plname; /* X11 hack: askname() might not set gp.plname */
boolean herecmd_menu; /* use menu when mouseclick on yourself */
boolean invis_goldsym; /* gold symbol is ' '? */
boolean in_lua; /* executing a lua script */
+1 -1
View File
@@ -405,7 +405,7 @@ extern struct nomakedefs_s nomakedefs;
#define BUFSZ 256 /* for getlin buffers */
#define QBUFSZ 128 /* for building question text */
#define TBUFSZ 300 /* g.toplines[] buffer max msg: 3 81char names */
#define TBUFSZ 300 /* gt.toplines[] buffer max msg: 3 81char names */
/* plus longest prefix plus a few extra words */
/* COLBUFSZ is the larger of BUFSZ and COLNO */
+5 -5
View File
@@ -275,10 +275,10 @@ typedef struct sortloot_item Loot;
#define MATCH_WARN_OF_MON(mon) \
(Warn_of_mon \
&& ((g.context.warntype.obj & (mon)->data->mflags2) != 0 \
|| (g.context.warntype.polyd & (mon)->data->mflags2) != 0 \
|| (g.context.warntype.species \
&& (g.context.warntype.species == (mon)->data))))
&& ((gc.context.warntype.obj & (mon)->data->mflags2) != 0 \
|| (gc.context.warntype.polyd & (mon)->data->mflags2) != 0 \
|| (gc.context.warntype.species \
&& (gc.context.warntype.species == (mon)->data))))
typedef uint32_t mmflags_nht; /* makemon MM_ flags */
@@ -415,7 +415,7 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
/* Flags to control find_mid() */
#define FM_FMON 0x01 /* search the fmon chain */
#define FM_MIGRATE 0x02 /* search the migrating monster chain */
#define FM_MYDOGS 0x04 /* search g.mydogs */
#define FM_MYDOGS 0x04 /* search gm.mydogs */
#define FM_EVERYWHERE (FM_FMON | FM_MIGRATE | FM_MYDOGS)
/* Flags to control pick_[race,role,gend,align] routines in role.c */
+2 -2
View File
@@ -122,8 +122,8 @@ struct eshk {
long credit; /* amount credited to customer */
long debit; /* amount of debt for using unpaid items */
long loan; /* shop-gold picked (part of debit) */
int shoptype; /* the value of g.rooms[shoproom].rtype */
schar shoproom; /* index in g.rooms; set by inshop() */
int shoptype; /* the value of gr.rooms[shoproom].rtype */
schar shoproom; /* index in gr.rooms; set by inshop() */
schar unused; /* to force alignment for stupid compilers */
boolean following; /* following customer since he owes us sth */
boolean surcharge; /* angry shk inflates prices */
+10 -10
View File
@@ -39,10 +39,10 @@ struct shclass {
const char *const *shknms; /* list of shopkeeper names for this type */
};
/* the normal rooms on the current level are described in g.rooms[0..n] for
/* the normal rooms on the current level are described in gr.rooms[0..n] for
* some n<MAXNROFROOMS
* the vault, if any, is described by g.rooms[n+1]
* the next g.rooms entry has hx -1 as a flag
* the vault, if any, is described by gr.rooms[n+1]
* the next gr.rooms entry has hx -1 as a flag
* there is at most one non-vault special room on a level
*/
@@ -87,7 +87,7 @@ enum roomtype_types {
#define SHARED 1 /* indicates normal shared boundary */
#define SHARED_PLUS 2 /* indicates shared boundary - extra adjacent-square
* searching required */
#define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives g.rooms[] index,
#define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives gr.rooms[] index,
* for inside-squares and non-shared boundaries */
/* Values for needfill */
@@ -98,14 +98,14 @@ enum roomtype_types {
#define FILL_LVFLAGS 2 /* special rooms only; set the room's rtype and level
flags as appropriate, but do not put anything in it */
#define IS_ROOM_PTR(x) ((x) >= g.rooms && (x) < g.rooms + MAXNROFROOMS)
#define IS_ROOM_PTR(x) ((x) >= gr.rooms && (x) < gr.rooms + MAXNROFROOMS)
#define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)
#define IS_SUBROOM_PTR(x) \
((x) >= g.subrooms && (x) < g.subrooms + MAXNROFROOMS)
((x) >= gs.subrooms && (x) < gs.subrooms + MAXNROFROOMS)
#define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) <= (MAXNROFROOMS * 2))
#define ROOM_INDEX(x) ((x) - g.rooms)
#define SUBROOM_INDEX(x) ((x) - g.subrooms)
#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 ROOM_INDEX(x) ((x) - gr.rooms)
#define SUBROOM_INDEX(x) ((x) - gs.subrooms)
#define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == gn.nroom)
#define IS_LAST_SUBROOM_PTR(x) (!gn.nsubroom || SUBROOM_INDEX(x) == gn.nsubroom)
#endif /* MKROOM_H */
+3 -3
View File
@@ -117,7 +117,7 @@
#define is_gnome(ptr) (((ptr)->mflags2 & M2_GNOME) != 0L)
#define is_orc(ptr) (((ptr)->mflags2 & M2_ORC) != 0L)
#define is_human(ptr) (((ptr)->mflags2 & M2_HUMAN) != 0L)
#define your_race(ptr) (((ptr)->mflags2 & g.urace.selfmask) != 0L)
#define your_race(ptr) (((ptr)->mflags2 & gu.urace.selfmask) != 0L)
#define is_bat(ptr) \
((ptr) == &mons[PM_BAT] || (ptr) == &mons[PM_GIANT_BAT] \
|| (ptr) == &mons[PM_VAMPIRE_BAT])
@@ -133,8 +133,8 @@
#define is_wanderer(ptr) (((ptr)->mflags2 & M2_WANDER) != 0L)
#define always_hostile(ptr) (((ptr)->mflags2 & M2_HOSTILE) != 0L)
#define always_peaceful(ptr) (((ptr)->mflags2 & M2_PEACEFUL) != 0L)
#define race_hostile(ptr) (((ptr)->mflags2 & g.urace.hatemask) != 0L)
#define race_peaceful(ptr) (((ptr)->mflags2 & g.urace.lovemask) != 0L)
#define race_hostile(ptr) (((ptr)->mflags2 & gu.urace.hatemask) != 0L)
#define race_peaceful(ptr) (((ptr)->mflags2 & gu.urace.lovemask) != 0L)
#define extra_nasty(ptr) (((ptr)->mflags2 & M2_NASTY) != 0L)
#define strongmonst(ptr) (((ptr)->mflags2 & M2_STRONG) != 0L)
#define can_breathe(ptr) attacktype(ptr, AT_BREA)
+1 -1
View File
@@ -199,7 +199,7 @@ enum ms_sounds {
passed to mkclass() as if it dealt with mons[].geno bits */
#define G_IGNORE 0x8000 /* for mkclass(), ignore G_GENOD|G_EXTINCT */
/* for g.mvitals[].mvflags (variant during game), along with G_NOCORPSE */
/* for gm.mvitals[].mvflags (variant during game), along with G_NOCORPSE */
#define G_KNOWN 0x04 /* have been encountered */
#define G_GENOD 0x02 /* have been genocided */
#define G_EXTINCT 0x01 /* population control; create no more */
+4 -4
View File
@@ -68,8 +68,8 @@ enum m_ap_types {
#define M_AP_TYPMASK 0x7
#define M_AP_F_DKNOWN 0x8
#define U_AP_TYPE (g.youmonst.m_ap_type & M_AP_TYPMASK)
#define U_AP_FLAG (g.youmonst.m_ap_type & ~M_AP_TYPMASK)
#define U_AP_TYPE (gy.youmonst.m_ap_type & M_AP_TYPMASK)
#define U_AP_FLAG (gy.youmonst.m_ap_type & ~M_AP_TYPMASK)
#define M_AP_TYPE(m) ((m)->m_ap_type & M_AP_TYPMASK)
#define M_AP_FLAG(m) ((m)->m_ap_type & ~M_AP_TYPMASK)
@@ -206,7 +206,7 @@ struct monst {
#define MON_NOWEP(mon) ((mon)->mw = (struct obj *) 0)
#define DEADMONSTER(mon) ((mon)->mhp < 1)
#define is_starting_pet(mon) ((mon)->m_id == g.context.startingpet_mid)
#define is_starting_pet(mon) ((mon)->m_id == gc.context.startingpet_mid)
#define is_vampshifter(mon) \
((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LEADER \
|| (mon)->cham == PM_VLAD_THE_IMPALER)
@@ -218,7 +218,7 @@ struct monst {
|| (mon)->isshk \
|| (mon)->isgd \
|| (mon)->data == &mons[PM_ORACLE] \
|| (mon)->m_id == g.quest_status.leader_m_id)
|| (mon)->m_id == gq.quest_status.leader_m_id)
/* mimic appearances that block vision/light */
#define is_lightblocker_mappear(mon) \
+3 -3
View File
@@ -298,7 +298,7 @@ struct obj {
/* Eggs and other food */
#define MAX_EGG_HATCH_TIME 200 /* longest an egg can remain unhatched */
#define stale_egg(egg) \
((g.moves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME))
((gm.moves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME))
#define ofood(o) ((o)->otyp == CORPSE || (o)->otyp == EGG || (o)->otyp == TIN)
/* note: sometimes eggs and tins have special corpsenm values that
shouldn't be used as an index into mons[] */
@@ -415,8 +415,8 @@ struct obj {
|| (o)->otyp == POT_POLYMORPH)
/* achievement tracking; 3.6.x did this differently */
#define is_mines_prize(o) ((o)->o_id == g.context.achieveo.mines_prize_oid)
#define is_soko_prize(o) ((o)->o_id == g.context.achieveo.soko_prize_oid)
#define is_mines_prize(o) ((o)->o_id == gc.context.achieveo.mines_prize_oid)
#define is_soko_prize(o) ((o)->o_id == gc.context.achieveo.soko_prize_oid)
#define is_art(o,art) ((o) && (o)->oartifact == (art))
#define u_wield_art(art) is_art(uwep, art)
+20 -20
View File
@@ -89,7 +89,7 @@ enum levl_typ_types {
#define IS_DOOR(typ) ((typ) == DOOR)
#define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS)
#define IS_TREE(typ) \
((typ) == TREE || (g.level.flags.arboreal && (typ) == STONE))
((typ) == TREE || (gl.level.flags.arboreal && (typ) == STONE))
#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
#define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM, STAIRS, furniture.. */
#define ZAP_POS(typ) ((typ) >= POOL)
@@ -345,7 +345,7 @@ struct damage {
an existing bones level; if so, most recent victim will be first in list */
struct cemetery {
struct cemetery *next; /* next struct is previous dead character... */
/* "g.plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */
/* "gp.plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */
char who[PL_NSIZ + 4 * (1 + 3) + 1];
/* death reason, same as in score/log file */
char how[100 + 1]; /* [DTHSZ+1] */
@@ -403,9 +403,9 @@ typedef struct {
/*
* Macros for compatibility with old code. Someday these will go away.
*/
#define levl g.level.locations
#define fobj g.level.objlist
#define fmon g.level.monlist
#define levl gl.level.locations
#define fobj gl.level.objlist
#define fmon gl.level.monlist
/*
* Covert a trap number into the defsym graphics array.
@@ -415,43 +415,43 @@ typedef struct {
#define trap_to_defsym(t) (S_arrow_trap + (t) - 1)
#define defsym_to_trap(d) ((d) - S_arrow_trap + 1)
#define OBJ_AT(x, y) (g.level.objects[x][y] != (struct obj *) 0)
#define OBJ_AT(x, y) (gl.level.objects[x][y] != (struct obj *) 0)
/*
* Macros for encapsulation of level.monsters references.
*/
#if 0
#define MON_AT(x, y) \
(g.level.monsters[x][y] != (struct monst *) 0 \
&& !(g.level.monsters[x][y])->mburied)
(gl.level.monsters[x][y] != (struct monst *) 0 \
&& !(gl.level.monsters[x][y])->mburied)
#define MON_BURIED_AT(x, y) \
(g.level.monsters[x][y] != (struct monst *) 0 \
&& (g.level.monsters[x][y])->mburied)
(gl.level.monsters[x][y] != (struct monst *) 0 \
&& (gl.level.monsters[x][y])->mburied)
#else /* without 'mburied' */
#define MON_AT(x, y) (g.level.monsters[x][y] != (struct monst *) 0)
#define MON_AT(x, y) (gl.level.monsters[x][y] != (struct monst *) 0)
#endif
#ifdef EXTRA_SANITY_CHECKS
#define place_worm_seg(m, x, y) \
do { \
if (g.level.monsters[x][y] && g.level.monsters[x][y] != m) \
if (gl.level.monsters[x][y] && gl.level.monsters[x][y] != m) \
impossible("place_worm_seg over mon"); \
g.level.monsters[x][y] = m; \
gl.level.monsters[x][y] = m; \
} while(0)
#define remove_monster(x, y) \
do { \
if (!g.level.monsters[x][y]) \
if (!gl.level.monsters[x][y]) \
impossible("no monster to remove"); \
g.level.monsters[x][y] = (struct monst *) 0; \
gl.level.monsters[x][y] = (struct monst *) 0; \
} while(0)
#else
#define place_worm_seg(m, x, y) g.level.monsters[x][y] = m
#define remove_monster(x, y) g.level.monsters[x][y] = (struct monst *) 0
#define place_worm_seg(m, x, y) gl.level.monsters[x][y] = m
#define remove_monster(x, y) gl.level.monsters[x][y] = (struct monst *) 0
#endif
#define m_at(x, y) (MON_AT(x, y) ? g.level.monsters[x][y] : (struct monst *) 0)
#define m_at(x, y) (MON_AT(x, y) ? gl.level.monsters[x][y] : (struct monst *) 0)
#define m_buried_at(x, y) \
(MON_BURIED_AT(x, y) ? g.level.monsters[x][y] : (struct monst *) 0)
(MON_BURIED_AT(x, y) ? gl.level.monsters[x][y] : (struct monst *) 0)
/* restricted movement, potential luck penalties */
#define Sokoban g.level.flags.sokoban_rules
#define Sokoban gl.level.flags.sokoban_rules
/*
* These prototypes are in extern.h but some of the code which uses them
+3 -3
View File
@@ -28,9 +28,9 @@ enum spellknowledge {
#define ALL_MAP 0x1
#define ALL_SPELLS 0x2
#define decrnknow(spell) g.spl_book[spell].sp_know--
#define spellid(spell) g.spl_book[spell].sp_id
#define spellknow(spell) g.spl_book[spell].sp_know
#define decrnknow(spell) gs.spl_book[spell].sp_know--
#define spellid(spell) gs.spl_book[spell].sp_id
#define spellknow(spell) gs.spl_book[spell].sp_know
/* how much Pw a spell of level lvl costs to cast? */
#define SPELL_LEV_PW(lvl) ((lvl) * 5)
+1 -1
View File
@@ -163,7 +163,7 @@ struct symset_customization {
extern const struct symdef defsyms[MAXPCHARS + 1]; /* defaults */
#define WARNCOUNT 6 /* number of different warning levels */
extern const struct symdef def_warnsyms[WARNCOUNT];
#define SYMHANDLING(ht) (g.symset[g.currentgraphics].handling == (ht))
#define SYMHANDLING(ht) (gs.symset[gc.currentgraphics].handling == (ht))
#endif /* !MAKEDEFS_C */
#endif /* SYM_H */
+3 -3
View File
@@ -21,9 +21,9 @@
* couldsee() - Returns true if the hero has a clear line of sight to
* the location.
*/
#define cansee(x, y) ((g.viz_array[y][x] & IN_SIGHT) != 0)
#define couldsee(x, y) ((g.viz_array[y][x] & COULD_SEE) != 0)
#define templit(x, y) ((g.viz_array[y][x] & TEMP_LIT) != 0)
#define cansee(x, y) ((gv.viz_array[y][x] & IN_SIGHT) != 0)
#define couldsee(x, y) ((gv.viz_array[y][x] & COULD_SEE) != 0)
#define templit(x, y) ((gv.viz_array[y][x] & TEMP_LIT) != 0)
/*
* The following assume the monster is not blind.
+6 -6
View File
@@ -23,8 +23,8 @@ struct RoleName {
struct RoleAdvance {
/* "fix" is the fixed amount, "rnd" is the random amount */
xint16 infix, inrnd; /* at character initialization */
xint16 lofix, lornd; /* gained per level < g.urole.xlev */
xint16 hifix, hirnd; /* gained per level >= g.urole.xlev */
xint16 lofix, lornd; /* gained per level < gu.urole.xlev */
xint16 hifix, hirnd; /* gained per level >= gu.urole.xlev */
};
struct u_have {
@@ -228,8 +228,8 @@ struct Role {
};
extern const struct Role roles[]; /* table of available roles */
#define Role_if(X) (g.urole.mnum == (X))
#define Role_switch (g.urole.mnum)
#define Role_if(X) (gu.urole.mnum == (X))
#define Role_switch (gu.urole.mnum)
/* used during initialization for race, gender, and alignment
as well as for character class */
@@ -278,8 +278,8 @@ struct Race {
};
extern const struct Race races[]; /* Table of available races */
#define Race_if(X) (g.urace.mnum == (X))
#define Race_switch (g.urace.mnum)
#define Race_if(X) (gu.urace.mnum == (X))
#define Race_switch (gu.urace.mnum)
/*** Unified structure specifying gender information ***/
struct Gender {
+7 -7
View File
@@ -67,7 +67,7 @@
#define HSick_resistance u.uprops[SICK_RES].intrinsic
#define ESick_resistance u.uprops[SICK_RES].extrinsic
#define Sick_resistance (HSick_resistance || ESick_resistance \
|| defended(&g.youmonst, AD_DISE))
|| defended(&gy.youmonst, AD_DISE))
/* Intrinsics only */
#define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */
@@ -88,13 +88,13 @@
/* ...means blind because of a cover */
#define Blind \
((u.uroleplay.blind || Blinded || Blindfolded \
|| !haseyes(g.youmonst.data)) \
|| !haseyes(gy.youmonst.data)) \
&& !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD))
/* ...the Eyes operate even when you really are blind
or don't have any eyes */
#define Blindfolded_only \
(Blindfolded && ublindf->oartifact != ART_EYES_OF_THE_OVERWORLD \
&& !u.uroleplay.blind && !Blinded && haseyes(g.youmonst.data))
&& !u.uroleplay.blind && !Blinded && haseyes(gy.youmonst.data))
/* ...blind because of a blindfold, and *only* that */
#define Sick u.uprops[SICK].intrinsic
@@ -255,11 +255,11 @@
#define HMagical_breathing u.uprops[MAGICAL_BREATHING].intrinsic
#define EMagical_breathing u.uprops[MAGICAL_BREATHING].extrinsic
#define Amphibious \
(HMagical_breathing || EMagical_breathing || amphibious(g.youmonst.data))
(HMagical_breathing || EMagical_breathing || amphibious(gy.youmonst.data))
/* Get wet, may go under surface */
#define Breathless \
(HMagical_breathing || EMagical_breathing || breathless(g.youmonst.data))
(HMagical_breathing || EMagical_breathing || breathless(gy.youmonst.data))
#define Underwater (u.uinwater)
/* Note that Underwater and u.uinwater are both used in code.
@@ -377,9 +377,9 @@
/* unconscious() includes u.usleep but not is_fainted(); the multi test is
redundant but allows the function calls to be skipped most of the time */
#define Unaware (g.multi < 0 && (unconscious() || is_fainted()))
#define Unaware (gm.multi < 0 && (unconscious() || is_fainted()))
#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(g.youmonst.data))
#define Hate_silver (u.ulycn >= LOW_PM || hates_silver(gy.youmonst.data))
/* _Hitchhikers_Guide_to_the_Galaxy_ on uses for 'towel': "wrap it round
your head to ward off noxious fumes" [we require it to be damp or wet] */
+5 -5
View File
@@ -288,7 +288,7 @@ saveDiskPrompt(start)
BPTR fileLock;
if (sysflags.asksavedisk) {
/* Don't prompt if you can find the save file */
if (fileLock = Lock(g.SAVEF, SHARED_LOCK)) {
if (fileLock = Lock(gs.SAVEF, SHARED_LOCK)) {
UnLock(fileLock);
#if defined(TTY_GRAPHICS)
if (windowprocs.win_init_nhwindows
@@ -303,7 +303,7 @@ saveDiskPrompt(start)
return 1;
}
pline("If save file is on a SAVE disk, put that disk in now.");
if (strlen(g.SAVEF) > QBUFSZ - 25 - 22)
if (strlen(gs.SAVEF) > QBUFSZ - 25 - 22)
panic("not enough buffer space for prompt");
/* THIS IS A HACK */
#if defined(TTY_GRAPHICS)
@@ -314,7 +314,7 @@ saveDiskPrompt(start)
#endif
#if defined(AMII_GRAPHICS)
if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) {
getlind("File name ?", buf, g.SAVEF);
getlind("File name ?", buf, gs.SAVEF);
clear_nhwindow(WIN_BASE);
}
#endif
@@ -323,11 +323,11 @@ saveDiskPrompt(start)
return 0;
/* Strip any whitespace. Also, if nothing was entered except
* whitespace, do not change the value of g.SAVEF.
* whitespace, do not change the value of gs.SAVEF.
*/
for (bp = buf; *bp; bp++) {
if (!isspace(*bp)) {
strncpy(g.SAVEF, bp, PATHLEN);
strncpy(gs.SAVEF, bp, PATHLEN);
break;
}
}
+2 -2
View File
@@ -185,12 +185,12 @@ time_t when;
SetDrMd(rp, JAM1);
/* Put name on stone */
Sprintf(buf, "%s", g.plname);
Sprintf(buf, "%s", gp.plname);
buf[STONE_LINE_LEN] = 0;
tomb_text(buf);
/* Put $ on stone */
Sprintf(buf, "%ld Au", g.done_money);
Sprintf(buf, "%ld Au", gd.done_money);
buf[STONE_LINE_LEN] = 0; /* It could be a *lot* of gold :-) */
tomb_text(buf);
+1 -1
View File
@@ -357,7 +357,7 @@ menu_item **retmip;
nw->Screen = HackScreen;
if (win == WIN_INVEN) {
sprintf(title, "%s the %s's Inventory", g.plname, g.pl_character);
sprintf(title, "%s the %s's Inventory", gp.plname, gp.pl_character);
nw->Title = title;
if (lastinvent.MaxX != 0) {
nw->LeftEdge = lastinvent.MinX;
+12 -12
View File
@@ -437,10 +437,10 @@ amii_askname()
amii_getlin("Who are you?", plnametmp);
} while (strlen(plnametmp) == 0);
strncpy(g.plname, plnametmp, PL_NSIZ - 1); /* Avoid overflowing plname[] */
g.plname[PL_NSIZ - 1] = 0;
strncpy(gp.plname, plnametmp, PL_NSIZ - 1); /* Avoid overflowing plname[] */
gp.plname[PL_NSIZ - 1] = 0;
if (*g.plname == '\33') {
if (*gp.plname == '\33') {
clearlocks();
exit_nhwindows(NULL);
nh_terminate(0);
@@ -474,9 +474,9 @@ amii_player_selection()
#if 0 /* Don't query the user ... instead give random character -jhsa */
#if 0 /* OBSOLETE */
if( *g.pl_character ){
g.pl_character[ 0 ] = toupper( g.pl_character[ 0 ] );
if( strchr( pl_classes, g.pl_character[ 0 ] ) )
if( *gp.pl_character ){
gp.pl_character[ 0 ] = toupper( gp.pl_character[ 0 ] );
if( strchr( pl_classes, gp.pl_character[ 0 ] ) )
return;
}
#endif
@@ -530,19 +530,19 @@ amii_player_selection()
case VANILLAKEY:
if( strchr( pl_classes, toupper( code ) ) )
{
g.pl_character[0] = toupper( code );
gp.pl_character[0] = toupper( code );
aredone = 1;
}
else if( code == ' ' || code == '\n' || code == '\r' )
{
flags.initrole = randrole(FALSE);
#if 0 /* OBSOLETE */
strcpy( g.pl_character, roles[ rnd( 11 ) ] );
strcpy( gp.pl_character, roles[ rnd( 11 ) ] );
#endif
aredone = 1;
amii_clear_nhwindow( WIN_BASE );
CloseShWindow( cwin );
RandomWindow( g.pl_character );
RandomWindow( gp.pl_character );
return;
}
else if( code == 'q' || code == 'Q' )
@@ -562,15 +562,15 @@ amii_player_selection()
case 1: /* Random Character */
flags.initrole = randrole(FALSE);
#if 0 /* OBSOLETE */
strcpy( g.pl_character, roles[ rnd( 11 ) ] );
strcpy( gp.pl_character, roles[ rnd( 11 ) ] );
#endif
amii_clear_nhwindow( WIN_BASE );
CloseShWindow( cwin );
RandomWindow( g.pl_character );
RandomWindow( gp.pl_character );
return;
default:
g.pl_character[0] = gd->GadgetID;
gp.pl_character[0] = gd->GadgetID;
break;
}
aredone = 1;
+8 -8
View File
@@ -81,8 +81,8 @@ const char *str;
while (isspace(*str))
str++;
strncpy(g.toplines, str, TBUFSZ);
g.toplines[TBUFSZ - 1] = 0;
strncpy(gt.toplines, str, TBUFSZ);
gt.toplines[TBUFSZ - 1] = 0;
/* For initial message to be visible, we need to explicitly position
* the
@@ -101,15 +101,15 @@ const char *str;
memcpy(cw->data, &cw->data[1],
(iflags.msg_history - 1) * sizeof(char *));
cw->data[iflags.msg_history - 1] =
(char *) alloc(strlen(g.toplines) + 5);
(char *) alloc(strlen(gt.toplines) + 5);
strcpy(cw->data[i = iflags.msg_history - 1] + SOFF
+ (scrollmsg != 0),
g.toplines);
gt.toplines);
} else {
/* Otherwise, allocate a new one and copy the line in */
cw->data[cw->maxrow] = (char *) alloc(strlen(g.toplines) + 5);
cw->data[cw->maxrow] = (char *) alloc(strlen(gt.toplines) + 5);
strcpy(cw->data[i = cw->maxrow++] + SOFF + (scrollmsg != 0),
g.toplines);
gt.toplines);
}
cw->data[i][SEL_ITEM] = 1;
cw->data[i][VATTR] = attr + 1;
@@ -182,7 +182,7 @@ const char *str;
/ w->RPort->TxHeight,
totalvis, totalvis);
}
i = strlen(g.toplines + SOFF);
i = strlen(gt.toplines + SOFF);
cw->maxcol = max(cw->maxcol, i);
cw->vwy = cw->maxrow;
break;
@@ -191,7 +191,7 @@ const char *str;
if (cw->data[cw->cury] == NULL)
panic("NULL pointer for status window");
ob = &cw->data[cw->cury][j = cw->curx];
if (g.context.botlx)
if (gc.context.botlx)
*ob = 0;
/* Display when beam at top to avoid flicker... */
+12 -12
View File
@@ -88,7 +88,7 @@ attempt_restore:
if (yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
nh_compress(fqname(g.SAVEF, SAVEPREFIX, 0));
nh_compress(fqname(gs.SAVEF, SAVEPREFIX, 0));
}
}
}
@@ -132,14 +132,14 @@ whoami(void)
*/
char *s;
if (*g.plname)
if (*gp.plname)
return;
if (s = nh_getenv("USER")) {
(void) strncpy(g.plname, s, sizeof(g.plname) - 1);
(void) strncpy(gp.plname, s, sizeof(gp.plname) - 1);
return;
}
if (s = nh_getenv("LOGNAME")) {
(void) strncpy(g.plname, s, sizeof(g.plname) - 1);
(void) strncpy(gp.plname, s, sizeof(gp.plname) - 1);
return;
}
}
@@ -177,11 +177,11 @@ process_options(int argc, char **argv)
#endif
case 'u':
if (argv[0][2])
(void) strncpy(g.plname, argv[0] + 2, sizeof(g.plname) - 1);
(void) strncpy(gp.plname, argv[0] + 2, sizeof(gp.plname) - 1);
else if (argc > 1) {
argc--;
argv++;
(void) strncpy(g.plname, argv[0], sizeof(g.plname) - 1);
(void) strncpy(gp.plname, argv[0], sizeof(gp.plname) - 1);
} else
raw_print("Player name expected after -u");
break;
@@ -236,15 +236,15 @@ getlock(void)
{
int fd;
Sprintf(g.lock, "%d%s", getuid(), g.plname);
regularize(g.lock);
set_levelfile_name(g.lock, 0);
fd = creat(g.lock, FCMASK);
Sprintf(gl.lock, "%d%s", getuid(), gp.plname);
regularize(gl.lock);
set_levelfile_name(gl.lock, 0);
fd = creat(gl.lock, FCMASK);
if (fd == -1) {
error("cannot creat lock file.");
} else {
if (write(fd, (genericptr_t) &g.hackpid, sizeof(g.hackpid))
!= sizeof(g.hackpid)) {
if (write(fd, (genericptr_t) &gh.hackpid, sizeof(gh.hackpid))
!= sizeof(gh.hackpid)) {
error("cannot write lock");
}
if (close(fd) == -1) {
+1 -1
View File
@@ -228,7 +228,7 @@ macopen(const char *name, int flags, long fileType)
Handle name;
Str255 plnamep;
C2P(g.plname, plnamep);
C2P(gp.plname, plnamep);
name = (Handle)NewString(plnamep);
if (name)
replace_resource(name, 'STR ', PLAYER_NAME_RES_ID,
+5 -5
View File
@@ -43,12 +43,12 @@ main(void)
windowprocs = mac_procs;
InitMac();
g.hname = "Mac Hack";
gh.hname = "Mac Hack";
hackpid = getpid();
setrandom();
initoptions();
init_nhwindows(&argc, (char **) &g.hname);
init_nhwindows(&argc, (char **) &gh.hname);
/*
* It seems you really want to play.
@@ -102,7 +102,7 @@ attempt_restore:
if (yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
nh_compress(fqname(g.SAVEF, SAVEPREFIX, 0));
nh_compress(fqname(gs.SAVEF, SAVEPREFIX, 0));
}
}
}
@@ -225,9 +225,9 @@ process_openfile(short src_vol, long src_dir, Str255 fName, OSType ftype)
Handle name = Get1Resource('STR ', PLAYER_NAME_RES_ID);
if (name) {
Str255 save_f_p;
P2C(*(StringHandle) name, g.plname);
P2C(*(StringHandle) name, gp.plname);
set_savefile_name(TRUE);
C2P(fqname(g.SAVEF, SAVEPREFIX, 0), save_f_p);
C2P(fqname(gs.SAVEF, SAVEPREFIX, 0), save_f_p);
force_hdelete(theDirs.dataRefNum, theDirs.dataDirID,
save_f_p);
+9 -9
View File
@@ -493,8 +493,8 @@ mac_askname()
SetPortDialogPort(askdialog);
/* Initialize the name text item */
ask_restring(g.plname, str);
if (g.plname[0]) {
ask_restring(gp.plname, str);
if (gp.plname[0]) {
GetDialogItem(askdialog, RSRC_ASK_NAME, &type, &handle, &rect);
SetDialogItemText(handle, str);
}
@@ -502,8 +502,8 @@ mac_askname()
{
Str32 pName;
pName [0] = 0;
if (g.plname && g.plname [0]) {
strcpy ((char *) pName, g.plname);
if (gp.plname && gp.plname [0]) {
strcpy ((char *) pName, gp.plname);
c2pstr ((char *) pName);
} else {
Handle h;
@@ -548,7 +548,7 @@ mac_askname()
if (flags.initrole >= 0)
currrole = flags.initrole;
/* Check for backward compatibility */
else if ((currrole = str2role(g.pl_character)) < 0)
else if ((currrole = str2role(gp.pl_character)) < 0)
currrole = randrole(FALSE);
/* Initialize the race popup menu */
@@ -735,8 +735,8 @@ mac_askname()
GetDialogItemText(handle, str);
if (str[0] > PL_NSIZ - 1)
str[0] = PL_NSIZ - 1;
BlockMove(&str[1], g.plname, str[0]);
g.plname[str[0]] = '\0';
BlockMove(&str[1], gp.plname, str[0]);
gp.plname[str[0]] = '\0';
/* Destroy the dialog */
for (i = RSRC_ASK_ROLE; i <= RSRC_ASK_MODE; i++) {
@@ -758,14 +758,14 @@ mac_askname()
break;
case 2: /* Debug */
wizard = 1;
strcpy(g.plname, WIZARD_NAME);
strcpy(gp.plname, WIZARD_NAME);
break;
default: /* Quit */
ExitToShell();
}
/* Process the role */
strcpy(g.pl_character, roles[currrole].name.m);
strcpy(gp.pl_character, roles[currrole].name.m);
flags.initrole = currrole;
/* Process the race */
+5 -5
View File
@@ -24,16 +24,16 @@ getlock(void)
int fd;
int pid = getpid(); /* Process ID */
Sprintf(g.lock, "%d%s", getuid(), g.plname);
set_levelfile_name(g.lock, 0);
Sprintf(gl.lock, "%d%s", getuid(), gp.plname);
set_levelfile_name(gl.lock, 0);
if ((fd = open(g.lock, O_RDWR | O_EXCL | O_CREAT, LEVL_TYPE)) == -1) {
raw_printf("Could not lock the game %s.", g.lock);
if ((fd = open(gl.lock, O_RDWR | O_EXCL | O_CREAT, LEVL_TYPE)) == -1) {
raw_printf("Could not lock the game %s.", gl.lock);
panic("Another game in progress?");
}
if (write(fd, (char *) &pid, sizeof(pid)) != sizeof(pid)) {
raw_printf("Could not lock the game %s.", g.lock);
raw_printf("Could not lock the game %s.", gl.lock);
panic("Disk locked?");
}
close(fd);
+2 -2
View File
@@ -581,10 +581,10 @@ SanePositions(void)
rmsg.top = rbase.bottom + 2;
rmsg.bottom = rmsg.top + height;
rmsg.left = rbase.left;
rmsg.right = rbase.right;
rmsgr.right = rbase.right;
RetrievePosition(kMessageWindow, &rmsg.top, &rmsg.left);
if (RetrieveSize(kMessageWindow, rmsg.top, rmsg.left, &height, &width)) {
rmsg.right = rmsg.left + width;
rmsgr.right = rmsg.left + width;
rmsg.bottom = rmsg.top + height;
}
SetWindowBounds(theWindows[NHW_MESSAGE].its_window, kWindowContentRgn,
-43
View File
@@ -1,43 +0,0 @@
/* NetHack 3.7 nhlan.c $NHDT-Date: 1596498282 2020/08/03 23:44:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $ */
/* Copyright (c) Michael Allison, 1997 */
/* NetHack may be freely redistributed. See license for details. */
/*
* Currently shared by the following ports:
* WIN32
*
* The code in here is used to take advantage of added features
* that might be available in a Local Area Network environment.
*
* Network Username of player
*/
#include "hack.h"
#include <ctype.h>
#ifdef LAN_FEATURES
void
init_lan_features(void)
{
lan_username();
}
/*
* The get_lan_username() call is a required call, since some of
* the other LAN features depend on a unique username being available.
*
*/
char *
lan_username(void)
{
char *lu;
lu = get_username(&g.lusername_size);
if (lu) {
Strcpy(g.lusername, lu);
return g.lusername;
} else
return (char *) 0;
}
#endif /*LAN_FEATURES*/
/*nhlan.c*/
+1 -1
View File
@@ -459,7 +459,7 @@ plselInitDialog(HWND hWnd)
TCHAR wbuf[BUFSZ];
/* set player name */
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(g.plname, wbuf, sizeof(wbuf)));
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(gp.plname, wbuf, sizeof(wbuf)));
/* check flags for consistency */
if (flags.initrole >= 0) {
+3 -3
View File
@@ -39,7 +39,7 @@ mswin_have_input()
return
#ifdef SAFERHANGUP
/* we always have input (ESC) if hangup was requested */
g.program_state.done_hup ||
gp.program_state.done_hup ||
#endif
(nhi_read_pos != nhi_write_pos);
}
@@ -69,7 +69,7 @@ mswin_input_pop()
#ifdef SAFERHANGUP
/* always return ESC when hangup was requested */
if (g.program_state.done_hup) {
if (gp.program_state.done_hup) {
static MSNHEvent hangup_event;
hangup_event.type = NHEVENT_CHAR;
hangup_event.kbd.ch = '\033';
@@ -98,7 +98,7 @@ mswin_input_peek()
#ifdef SAFERHANGUP
/* always return ESC when hangup was requested */
if (g.program_state.done_hup) {
if (gp.program_state.done_hup) {
static MSNHEvent hangup_event;
hangup_event.type = NHEVENT_CHAR;
hangup_event.kbd.ch = '\033';
+1 -1
View File
@@ -826,7 +826,7 @@ mswin_layout_main_window(HWND changed_child)
/* show command window only if it exists and
the game is ready (plname is set) */
if (GetNHApp()->bCmdPad && cmd_size.cx > 0 && cmd_size.cy > 0
&& *g.plname) {
&& *gp.plname) {
MoveWindow(GetNHApp()->hCmdWnd, cmd_org.x, cmd_org.y, cmd_size.cx,
cmd_size.cy, TRUE);
ShowWindow(GetNHApp()->hCmdWnd, SW_SHOW);
+1 -1
View File
@@ -533,7 +533,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
if (!data->text.text) {
data->text.text = mswin_init_text_buffer(
g.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
gp.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
if (!data->text.text)
break;
}
+3 -3
View File
@@ -182,7 +182,7 @@ FormatStatusString(char *text, int format)
int hp, hpmax;
int cap = near_capacity();
Strcpy(text, g.plname);
Strcpy(text, gp.plname);
if ('a' <= text[0] && text[0] <= 'z')
text[0] += 'A' - 'a';
text[10] = 0;
@@ -237,7 +237,7 @@ FormatStatusString(char *text, int format)
hp = 0;
(void) describe_level(nb = eos(nb));
Sprintf(nb = eos(nb), "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d",
showsyms[COIN_CLASS + SYM_OFF_O], money_cnt(g.invent), hp, hpmax,
showsyms[COIN_CLASS + SYM_OFF_O], money_cnt(gi.invent), hp, hpmax,
u.uen, u.uenmax, u.uac);
if (Upolyd)
@@ -253,7 +253,7 @@ FormatStatusString(char *text, int format)
/* forth line */
if (flags.time)
Sprintf(nb = eos(nb), "T:%ld ", g.moves);
Sprintf(nb = eos(nb), "T:%ld ", gm.moves);
if (strcmp(hu_stat[u.uhs], " ")) {
Strcat(text, hu_stat[u.uhs]);
+1 -1
View File
@@ -39,7 +39,7 @@ mswin_init_text_window()
ZeroMemory(data, sizeof(NHTextWindow));
data->window_text = mswin_init_text_buffer(
g.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
gp.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
SetWindowLong(ret, GWL_USERDATA, (LONG) data);
return ret;
}
+2 -2
View File
@@ -646,7 +646,7 @@ mswin_askname(void)
{
logDebug("mswin_askname()\n");
if (mswin_getlin_window("who are you?", g.plname, PL_NSIZ) == IDCANCEL) {
if (mswin_getlin_window("who are you?", gp.plname, PL_NSIZ) == IDCANCEL) {
bail("bye-bye");
/* not reached */
}
@@ -1927,7 +1927,7 @@ NHSPhoneDialogSetup(HWND hDlg, UINT nToolBarId, BOOL is_edit,
rtDlg.bottom -= rtOK.bottom - rtOK.top;
ShowWindow(hOK, SW_HIDE);
SetWindowPos(hDlg, HWND_TOP, 0, 0, rtDlg.right - rtDlg.left,
SetWindowPos(hDlg, HWND_TOP, 0, 0, rtDlgr.right - rtDlg.left,
rtDlg.bottom - rtDlg.top,
SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOZORDER);
}
+9 -9
View File
@@ -167,11 +167,11 @@ eraseoldlocks()
*/
for (i = 1; i <= MAXDUNGEON * MAXLEVEL + 1; i++) {
/* try to remove all */
set_levelfile_name(g.lock, i);
(void) unlink(fqname(g.lock, LEVELPREFIX, 0));
set_levelfile_name(gl.lock, i);
(void) unlink(fqname(gl.lock, LEVELPREFIX, 0));
}
set_levelfile_name(g.lock, 0);
if (unlink(fqname(g.lock, LEVELPREFIX, 0)))
set_levelfile_name(gl.lock, 0);
if (unlink(fqname(gl.lock, LEVELPREFIX, 0)))
return 0; /* cannot remove it */
return (1); /* success! */
}
@@ -187,9 +187,9 @@ getlock()
int choice;
/* regularize(lock); */ /* already done in pcmain */
Sprintf(tbuf, "%s", fqname(g.lock, LEVELPREFIX, 0));
set_levelfile_name(g.lock, 0);
fq_lock = fqname(g.lock, LEVELPREFIX, 1);
Sprintf(tbuf, "%s", fqname(gl.lock, LEVELPREFIX, 0));
set_levelfile_name(gl.lock, 0);
fq_lock = fqname(gl.lock, LEVELPREFIX, 1);
f = CreateFile(NH_A2W(fq_lock, wbuf, BUFSZ), GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -226,8 +226,8 @@ gotlock:
if (fd == -1) {
error("cannot creat lock file (%s.)", fq_lock);
} else {
if (write(fd, (char *) &g.hackpid, sizeof(g.hackpid))
!= sizeof(g.hackpid)) {
if (write(fd, (char *) &gh.hackpid, sizeof(gh.hackpid))
!= sizeof(gh.hackpid)) {
error("cannot write lock (%s)", fq_lock);
}
if (close(fd) == -1) {
+16 -16
View File
@@ -1032,9 +1032,9 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
QButtonGroup* namebox = new QButtonGroup(1,Horizontal,"Name",this);
QLineEdit* name = new QLineEdit(namebox);
name->setMaxLength(sizeof(g.plname)-1);
if ( strncmp(g.plname,"player",6) && strncmp(g.plname,"games",5) )
name->setText(g.plname);
name->setMaxLength(sizeof(gp.plname)-1);
if ( strncmp(gp.plname,"player",6) && strncmp(gp.plname,"games",5) )
name->setText(gp.plname);
connect(name, SIGNAL(textChanged(const QString&)),
this, SLOT(selectName(const QString&)) );
name->setFocus();
@@ -1190,7 +1190,7 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
void NetHackQtPlayerSelector::selectName(const QString& n)
{
strncpy(g.plname,n.latin1(),sizeof(g.plname)-1);
strncpy(gp.plname,n.latin1(),sizeof(gp.plname)-1);
}
void NetHackQtPlayerSelector::selectRole()
@@ -2550,7 +2550,7 @@ void NetHackQtStatusWindow::updateStats()
encumber.setLabel(enc);
encumber.show();
}
Strcpy(buf, g.plname);
Strcpy(buf, gp.plname);
if ('a' <= buf[0] && buf[0] <= 'z') buf[0] += 'A'-'a';
Strcat(buf, " the ");
if (u.mtimedone) {
@@ -2579,7 +2579,7 @@ void NetHackQtStatusWindow::updateStats()
dlevel.setLabel(buf,(long)depth(&u.uz));
}
gold.setLabel("Au:", money_cnt(g.invent));
gold.setLabel("Au:", money_cnt(gi.invent));
if (u.mtimedone) {
// You're a monster!
@@ -2613,7 +2613,7 @@ void NetHackQtStatusWindow::updateStats()
align.setLabel("Lawful");
}
if (::flags.time) time.setLabel("Time:",(long)g.moves);
if (::flags.time) time.setLabel("Time:",(long)gm.moves);
else time.setLabel("");
#ifdef SCORE_ON_BOTL
if (::flags.showscore) {
@@ -3325,7 +3325,7 @@ static char** rip_line=0;
long year;
/* Put name on stone */
Sprintf(rip_line[NAME_LINE], "%s", g.plname);
Sprintf(rip_line[NAME_LINE], "%s", gp.plname);
/* Put $ on stone */
Sprintf(rip_line[GOLD_LINE], "%ld Au", done_money);
@@ -4052,7 +4052,7 @@ void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event)
void NetHackQtMainWindow::closeEvent(QCloseEvent* e)
{
if ( g.program_state.something_worth_saving ) {
if ( gp.program_state.something_worth_saving ) {
switch ( QMessageBox::information( this, "NetHack",
"This will end your NetHack session",
"&Save", "&Cancel", 0, 1 ) )
@@ -4644,7 +4644,7 @@ void NetHackQtBind::qt_askname()
NetHackQtSavedGameSelector sgsel((const char**)saved);
ch = sgsel.choose();
if ( ch >= 0 )
strcpy(g.plname,saved[ch]);
strcpy(gp.plname,saved[ch]);
}
free_saved_games(saved);
@@ -4864,7 +4864,7 @@ void NetHackQtBind::qt_update_inventory()
if (main)
main->updateInventory();
/* doesn't work yet
if (g.program_state.something_worth_saving && iflags.perm_invent)
if (gp.program_state.something_worth_saving && iflags.perm_invent)
display_inventory(NULL, FALSE);
*/
}
@@ -4918,14 +4918,14 @@ int NetHackQtBind::qt_nhgetch()
//
while (keybuffer.Empty()
#ifdef SAFERHANGUP
&& !g.program_state.done_hup
&& !gp.program_state.done_hup
#endif
) {
qApp->enter_loop();
}
#ifdef SAFERHANGUP
if (g.program_state.done_hup && keybuffer.Empty()) return '\033';
if (gp.program_state.done_hup && keybuffer.Empty()) return '\033';
#endif
return keybuffer.GetAscii();
}
@@ -4939,13 +4939,13 @@ int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod)
//
while (keybuffer.Empty() && clickbuffer.Empty()
#ifdef SAFERHANGUP
&& !g.program_state.done_hup
&& !gp.program_state.done_hup
#endif
) {
qApp->enter_loop();
}
#ifdef SAFERHANGUP
if (g.program_state.done_hup && keybuffer.Empty()) return '\033';
if (gp.program_state.done_hup && keybuffer.Empty()) return '\033';
#endif
if (!keybuffer.Empty()) {
return keybuffer.GetAscii();
@@ -5194,7 +5194,7 @@ bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
bool result=QApplication::notify(receiver,event);
#ifdef SAFERHANGUP
if (g.program_state.done_hup) {
if (gp.program_state.done_hup) {
keybuffer.Put('\033');
qApp->exit_loop();
return TRUE;
+2 -2
View File
@@ -501,7 +501,7 @@ Gem_player_selection()
void
Gem_askname()
{
strncpy(g.plname, mar_ask_name(), PL_NSIZ);
strncpy(gp.plname, mar_ask_name(), PL_NSIZ);
}
void
@@ -1078,7 +1078,7 @@ time_t when;
}
/* Follows same algorithm as genl_outrip() */
/* Put name on stone */
Sprintf(rip_line[NAME_LINE], "%s", g.plname);
Sprintf(rip_line[NAME_LINE], "%s", gp.plname);
/* Put $ on stone */
Sprintf(rip_line[GOLD_LINE], "%ld Au", done_money);
/* Put together death description */
+6 -6
View File
@@ -1647,13 +1647,13 @@ const char *str;
}
message_line[mesg_hist - 1] = tmp;
}
strcpy(g.toplines, str);
strcpy(gt.toplines, str);
messages_pro_zug++;
msg_max++;
if ((int) strlen(g.toplines) >= msg_width) {
if ((int) strlen(gt.toplines) >= msg_width) {
int pos = msg_width;
tmp = g.toplines + msg_width;
tmp = gt.toplines + msg_width;
while (*tmp != ' ' && pos >= 0) {
tmp--;
pos--;
@@ -1661,12 +1661,12 @@ const char *str;
if (pos <= 0)
pos = msg_width; /* Mar -- Oops, what a word :-) */
message_age[msg_max] = TRUE;
strncpy(message_line[msg_max], g.toplines, pos);
strncpy(message_line[msg_max], gt.toplines, pos);
message_line[msg_max][pos] = 0;
rest = strcpy(buf, g.toplines + pos);
rest = strcpy(buf, gt.toplines + pos);
} else {
message_age[msg_max] = TRUE;
strncpy(message_line[msg_max], g.toplines, msg_width);
strncpy(message_line[msg_max], gt.toplines, msg_width);
rest = 0;
}
+4 -4
View File
@@ -354,7 +354,7 @@ gnome_askname()
/* Ask for a name and stuff the response into plname, a nethack global */
ret = ghack_ask_string_dialog("What is your name?", "gandalf",
"GnomeHack", g.plname);
"GnomeHack", gp.plname);
/* Quit if they want to quit... */
if (ret == -1) {
@@ -907,7 +907,7 @@ gnome_nhgetch()
g_askingQuestion = 1;
/* Process events until a key press event arrives. */
while (g_numKeys == 0) {
if (g.program_state.done_hup)
if (gp.program_state.done_hup)
return '\033';
gtk_main_iteration();
}
@@ -945,7 +945,7 @@ gnome_nh_poskey(int *x, int *y, int *mod)
g_askingQuestion = 0;
/* Process events until a key or map-click arrives. */
while (g_numKeys == 0 && g_numClicks == 0) {
if (g.program_state.done_hup)
if (gp.program_state.done_hup)
return '\033';
gtk_main_iteration();
}
@@ -1169,7 +1169,7 @@ gnome_outrip(winid wid, int how, time_t when)
long year;
/* Put name on stone */
Sprintf(buf, "%s\n", g.plname);
Sprintf(buf, "%s\n", gp.plname);
Strcat(ripString, buf);
/* Put $ on stone */
+3 -3
View File
@@ -440,7 +440,7 @@ ghack_status_window_update_stats()
long umoney;
/* First, fill in the player name and the dungeon level */
strcpy(buf, g.plname);
strcpy(buf, gp.plname);
if ('a' <= buf[0] && buf[0] <= 'z')
buf[0] += 'A' - 'a';
strcat(buf, " the ");
@@ -558,7 +558,7 @@ ghack_status_window_update_stats()
gtk_label_set(GTK_LABEL(chaLabel), buf);
/* Now do the non-pixmaped stats (gold and such) */
umoney = money_cnt(g.invent);
umoney = money_cnt(gi.invent);
sprintf(buf, "Au:%ld", umoney);
if (lastAu < umoney && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
@@ -662,7 +662,7 @@ ghack_status_window_update_stats()
}
if (flags.time) {
sprintf(buf, "Time:%ld", g.moves);
sprintf(buf, "Time:%ld", gm.moves);
gtk_label_set(GTK_LABEL(timeLabel), buf);
} else
gtk_label_set(GTK_LABEL(timeLabel), "");
+90 -90
View File
@@ -59,33 +59,33 @@ moveloop_preamble(boolean resuming)
}
if (!resuming) { /* new game */
g.context.rndencode = rnd(9000);
gc.context.rndencode = rnd(9000);
set_wear((struct obj *) 0); /* for side-effects of starting gear */
reset_justpicked(g.invent);
reset_justpicked(gi.invent);
(void) pickup(1); /* autopickup at initial location */
/* only matters if someday a character is able to start with
clairvoyance (wizard with cornuthaum perhaps?); without this,
first "random" occurrence would always kick in on turn 1 */
g.context.seer_turn = (long) rnd(30);
gc.context.seer_turn = (long) rnd(30);
}
g.context.botlx = TRUE; /* for STATUS_HILITES */
gc.context.botlx = TRUE; /* for STATUS_HILITES */
if (resuming) { /* restoring old game */
read_engr_at(u.ux, u.uy); /* subset of pickup() */
fix_shop_damage();
}
(void) encumber_msg(); /* in case they auto-picked up something */
if (g.defer_see_monsters) {
g.defer_see_monsters = FALSE;
if (gd.defer_see_monsters) {
gd.defer_see_monsters = FALSE;
see_monsters();
}
initrack();
u.uz0.dlevel = u.uz.dlevel;
g.youmonst.movement = NORMAL_SPEED; /* give hero some movement points */
g.context.move = 0;
gy.youmonst.movement = NORMAL_SPEED; /* give hero some movement points */
gc.context.move = 0;
g.program_state.in_moveloop = 1;
gp.program_state.in_moveloop = 1;
/* for perm_invent preset at startup, display persistent inventory after
invent is fully populated and the in_moveloop flag has been set */
if (iflags.perm_invent)
@@ -102,7 +102,7 @@ u_calc_moveamt(int wtcap)
/* your speed doesn't augment steed's speed */
moveamt = mcalcmove(u.usteed, TRUE);
} else {
moveamt = g.youmonst.data->mmove;
moveamt = gy.youmonst.data->mmove;
if (Very_fast) { /* speed boots, potion, or spell */
/* gain a free action on 2/3 of turns */
@@ -134,9 +134,9 @@ u_calc_moveamt(int wtcap)
break;
}
g.youmonst.movement += moveamt;
if (g.youmonst.movement < 0)
g.youmonst.movement = 0;
gy.youmonst.movement += moveamt;
if (gy.youmonst.movement < 0)
gy.youmonst.movement = 0;
}
#if defined(MICRO) || defined(WIN32)
@@ -151,7 +151,7 @@ moveloop_core(void)
boolean monscanmove = FALSE;
#ifdef SAFERHANGUP
if (g.program_state.done_hup)
if (gp.program_state.done_hup)
end_of_input();
#endif
get_nh_event();
@@ -159,28 +159,28 @@ moveloop_core(void)
do_positionbar();
#endif
if (g.context.bypasses)
if (gc.context.bypasses)
clear_bypasses();
if (iflags.sanity_check || iflags.debug_fuzzer)
sanity_check();
if (g.context.move) {
if (gc.context.move) {
/* actual time passed */
g.youmonst.movement -= NORMAL_SPEED;
gy.youmonst.movement -= NORMAL_SPEED;
do { /* hero can't move this turn loop */
mvl_wtcap = encumber_msg();
g.context.mon_moving = TRUE;
gc.context.mon_moving = TRUE;
do {
monscanmove = movemon();
if (g.youmonst.movement >= NORMAL_SPEED)
if (gy.youmonst.movement >= NORMAL_SPEED)
break; /* it's now your turn */
} while (monscanmove);
g.context.mon_moving = FALSE;
gc.context.mon_moving = FALSE;
if (!monscanmove && g.youmonst.movement < NORMAL_SPEED) {
if (!monscanmove && gy.youmonst.movement < NORMAL_SPEED) {
/* both hero and monsters are out of steam this round */
struct monst *mtmp;
@@ -205,7 +205,7 @@ moveloop_core(void)
u_calc_moveamt(mvl_wtcap);
settrack();
g.moves++;
gm.moves++;
/*
* Never allow 'moves' to grow big enough to wrap.
* We don't care what the maximum possible 'long int'
@@ -214,16 +214,16 @@ moveloop_core(void)
* When imposing the limit, use a mystic decimal value
* instead of a magic binary one such as 0x7fffffffL.
*/
if (g.moves >= 1000000000L) {
if (gm.moves >= 1000000000L) {
display_nhwindow(WIN_MESSAGE, TRUE);
urgent_pline("The dungeon capitulates.");
done(ESCAPED);
}
/* 'moves' is misnamed; it represents turns; hero_seq is
a value that is distinct every time the hero moves */
g.hero_seq = g.moves << 3;
gh.hero_seq = gm.moves << 3;
if (flags.time && !g.context.run)
if (flags.time && !gc.context.run)
iflags.time_botl = TRUE; /* 'moves' just changed */
/********************************/
@@ -253,15 +253,15 @@ moveloop_core(void)
mvl_wtcap = UNENCUMBERED;
} else if (!Upolyd ? (u.uhp < u.uhpmax)
: (u.mh < u.mhmax
|| g.youmonst.data->mlet == S_EEL)) {
|| gy.youmonst.data->mlet == S_EEL)) {
/* maybe heal */
regen_hp(mvl_wtcap);
}
/* moving around while encumbered is hard work */
if (mvl_wtcap > MOD_ENCUMBER && u.umoved) {
if (!(mvl_wtcap < EXT_ENCUMBER ? g.moves % 30
: g.moves % 10)) {
if (!(mvl_wtcap < EXT_ENCUMBER ? gm.moves % 30
: gm.moves % 10)) {
overexert_hp();
}
}
@@ -292,7 +292,7 @@ moveloop_core(void)
&& !rn2(80 - (20 * night())))
mvl_change = 2;
if (mvl_change && !Unchanging) {
if (g.multi >= 0) {
if (gm.multi >= 0) {
stop_occupation();
if (mvl_change == 1)
polyself(POLY_NOFLAGS);
@@ -303,7 +303,7 @@ moveloop_core(void)
}
}
if (Searching && g.multi >= 0)
if (Searching && gm.multi >= 0)
(void) dosearch0(1);
if (Warning)
warnreveal();
@@ -341,9 +341,9 @@ moveloop_core(void)
under_ground(0);
/* when immobile, count is in turns */
if (g.multi < 0) {
if (gm.multi < 0) {
runmode_delay_output();
if (++g.multi == 0) { /* finished yet? */
if (++gm.multi == 0) { /* finished yet? */
unmul((char *) 0);
/* if unmul caused a level change, take it now */
if (u.utotype)
@@ -351,13 +351,13 @@ moveloop_core(void)
}
}
}
} while (g.youmonst.movement < NORMAL_SPEED); /* hero can't move */
} while (gy.youmonst.movement < NORMAL_SPEED); /* hero can't move */
/******************************************/
/* once-per-hero-took-time things go here */
/******************************************/
g.hero_seq++; /* moves*8 + n for n == 1..7 */
gh.hero_seq++; /* moves*8 + n for n == 1..7 */
/* although we checked for encumberance above, we need to
check again for message purposes, as the weight of
@@ -370,13 +370,13 @@ moveloop_core(void)
if (iflags.hilite_delta)
status_eval_next_unhilite();
#endif
if (g.moves >= g.context.seer_turn) {
if (gm.moves >= gc.context.seer_turn) {
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)
&& !BClairvoyant)
do_vicinity_map((struct obj *) 0);
/* we maintain this counter even when clairvoyance isn't
taking place; on average, go again 30 turns from now */
g.context.seer_turn = g.moves + (long) rn1(31, 15); /*15..45*/
gc.context.seer_turn = gm.moves + (long) rn1(31, 15); /*15..45*/
/* [it used to be that on every 15th turn, there was a 50%
chance of farsight, so it could happen as often as every
15 turns or theoretically never happen at all; but when
@@ -399,7 +399,7 @@ moveloop_core(void)
clear_splitobjs();
find_ac();
if (!g.context.mv || Blind) {
if (!gc.context.mv || Blind) {
/* redo monsters if hallu or wearing a helm of telepathy */
if (Hallucination) { /* update screen randomly */
see_monsters();
@@ -412,10 +412,10 @@ moveloop_core(void)
} else if (Warning || Warn_of_mon)
see_monsters();
if (g.vision_full_recalc)
if (gv.vision_full_recalc)
vision_recalc(0); /* vision! */
}
if (g.context.botl || g.context.botlx) {
if (gc.context.botl || gc.context.botlx) {
bot();
curs_on_u();
} else if (iflags.time_botl) {
@@ -423,9 +423,9 @@ moveloop_core(void)
curs_on_u();
}
g.context.move = 1;
gc.context.move = 1;
if (g.multi >= 0 && g.occupation) {
if (gm.multi >= 0 && go.occupation) {
#if defined(MICRO) || defined(WIN32)
mvl_abort_lev = 0;
if (kbhit()) {
@@ -436,11 +436,11 @@ moveloop_core(void)
else
cmdq_add_key(CQ_CANNED, ch);
}
if (!mvl_abort_lev && (*g.occupation)() == 0)
if (!mvl_abort_lev && (*go.occupation)() == 0)
#else
if ((*g.occupation)() == 0)
if ((*go.occupation)() == 0)
#endif
g.occupation = 0;
go.occupation = 0;
if (
#if defined(MICRO) || defined(WIN32)
mvl_abort_lev ||
@@ -460,24 +460,24 @@ moveloop_core(void)
u.umoved = FALSE;
if (g.multi > 0) {
if (gm.multi > 0) {
lookaround();
runmode_delay_output();
if (!g.multi) {
if (!gm.multi) {
/* lookaround may clear multi */
g.context.move = 0;
gc.context.move = 0;
return;
}
if (g.context.mv) {
if (g.multi < COLNO && !--g.multi)
if (gc.context.mv) {
if (gm.multi < COLNO && !--gm.multi)
end_running(TRUE);
domove();
} else {
--g.multi;
nhassert(g.command_count != 0);
rhack(g.command_line);
--gm.multi;
nhassert(gc.command_count != 0);
rhack(gc.command_line);
}
} else if (g.multi == 0) {
} else if (gm.multi == 0) {
#ifdef MAIL
ckmailstatus();
#endif
@@ -486,14 +486,14 @@ moveloop_core(void)
if (u.utotype) /* change dungeon level */
deferred_goto(); /* after rhack() */
if (g.vision_full_recalc)
if (gv.vision_full_recalc)
vision_recalc(0); /* vision! */
/* when running in non-tport mode, this gets done through domove() */
if ((!g.context.run || flags.runmode == RUN_TPORT)
&& (g.multi && (!g.context.travel ? !(g.multi % 7)
: !(g.moves % 7L)))) {
if (flags.time && g.context.run)
g.context.botl = TRUE;
if ((!gc.context.run || flags.runmode == RUN_TPORT)
&& (gm.multi && (!gc.context.travel ? !(gm.multi % 7)
: !(gm.moves % 7L)))) {
if (flags.time && gc.context.run)
gc.context.botl = TRUE;
/* [should this be flush_screen() instead?] */
display_nhwindow(WIN_MAP, FALSE);
}
@@ -513,7 +513,7 @@ regen_pw(int wtcap)
{
if (u.uen < u.uenmax
&& ((wtcap < MOD_ENCUMBER
&& (!(g.moves % ((MAXULEV + 8 - u.ulevel)
&& (!(gm.moves % ((MAXULEV + 8 - u.ulevel)
* (Role_if(PM_WIZARD) ? 3 : 4)
/ 6)))) || Energy_regeneration)) {
int upper = (int) (ACURR(A_WIS) + ACURR(A_INT)) / 15 + 1;
@@ -521,7 +521,7 @@ regen_pw(int wtcap)
u.uen += rn1(upper, 1);
if (u.uen > u.uenmax)
u.uen = u.uenmax;
g.context.botl = TRUE;
gc.context.botl = TRUE;
if (u.uen == u.uenmax)
interrupt_multi("You feel full of energy.");
}
@@ -540,20 +540,20 @@ regen_hp(int wtcap)
if (Upolyd) {
if (u.mh < 1) { /* shouldn't happen... */
rehumanize();
} else if (g.youmonst.data->mlet == S_EEL
} else if (gy.youmonst.data->mlet == S_EEL
&& !is_pool(u.ux, u.uy) && !Is_waterlevel(&u.uz)
&& !Breathless) {
/* eel out of water loses hp, similar to monster eels;
as hp gets lower, rate of further loss slows down */
if (u.mh > 1 && !Regeneration && rn2(u.mh) > rn2(8)
&& (!Half_physical_damage || !(g.moves % 2L)))
&& (!Half_physical_damage || !(gm.moves % 2L)))
heal = -1;
} else if (u.mh < u.mhmax) {
if (U_CAN_REGEN() || (encumbrance_ok && !(g.moves % 20L)))
if (U_CAN_REGEN() || (encumbrance_ok && !(gm.moves % 20L)))
heal = 1;
}
if (heal) {
g.context.botl = TRUE;
gc.context.botl = TRUE;
u.mh += heal;
reached_full = (u.mh == u.mhmax);
}
@@ -566,7 +566,7 @@ regen_hp(int wtcap)
for the player, but it didn't make sense for gameplay...] */
if (u.uhp < u.uhpmax && (encumbrance_ok || U_CAN_REGEN())) {
if (u.ulevel > 9) {
if (!(g.moves % 3L)) {
if (!(gm.moves % 3L)) {
int Con = (int) ACURR(A_CON);
if (Con <= 12) {
@@ -578,7 +578,7 @@ regen_hp(int wtcap)
}
}
} else { /* u.ulevel <= 9 */
if (!(g.moves % (long) ((MAXULEV + 12) / (u.ulevel + 2) + 1)))
if (!(gm.moves % (long) ((MAXULEV + 12) / (u.ulevel + 2) + 1)))
heal = 1;
}
if (U_CAN_REGEN() && !heal)
@@ -587,7 +587,7 @@ regen_hp(int wtcap)
heal++;
if (heal) {
g.context.botl = TRUE;
gc.context.botl = TRUE;
u.uhp += heal;
if (u.uhp > u.uhpmax)
u.uhp = u.uhpmax;
@@ -606,13 +606,13 @@ regen_hp(int wtcap)
void
stop_occupation(void)
{
if (g.occupation) {
if (go.occupation) {
if (!maybe_finished_meal(TRUE))
You("stop %s.", g.occtxt);
g.occupation = 0;
g.context.botl = TRUE; /* in case u.uhs changed */
You("stop %s.", go.occtxt);
go.occupation = 0;
gc.context.botl = TRUE; /* in case u.uhs changed */
nomul(0);
} else if (g.multi >= 0) {
} else if (gm.multi >= 0) {
nomul(0);
}
cmdq_clear(CQ_CANNED);
@@ -667,15 +667,15 @@ newgame(void)
{
int i;
g.context.botlx = TRUE;
g.context.ident = 1;
g.context.warnlevel = 1;
g.context.next_attrib_check = 600L; /* arbitrary first setting */
g.context.tribute.enabled = TRUE; /* turn on 3.6 tributes */
g.context.tribute.tributesz = sizeof(struct tribute_info);
gc.context.botlx = TRUE;
gc.context.ident = 1;
gc.context.warnlevel = 1;
gc.context.next_attrib_check = 600L; /* arbitrary first setting */
gc.context.tribute.enabled = TRUE; /* turn on 3.6 tributes */
gc.context.tribute.tributesz = sizeof(struct tribute_info);
for (i = LOW_PM; i < NUMMONS; i++)
g.mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
gm.mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
init_objects(); /* must be before u_init() */
@@ -723,7 +723,7 @@ newgame(void)
#ifdef INSURANCE
save_currentstate();
#endif
g.program_state.something_worth_saving++; /* useful data now exists */
gp.program_state.something_worth_saving++; /* useful data now exists */
/* Success! */
welcome(TRUE);
@@ -760,22 +760,22 @@ welcome(boolean new_game) /* false => restoring an old game */
*buf = '\0';
if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT])
Sprintf(eos(buf), " %s", align_str(u.ualignbase[A_ORIGINAL]));
if (!g.urole.name.f
if (!gu.urole.name.f
&& (new_game
? (g.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
? (gu.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
: currentgend != flags.initgend))
Sprintf(eos(buf), " %s", genders[currentgend].adj);
Sprintf(eos(buf), " %s %s", g.urace.adj,
(currentgend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m);
Sprintf(eos(buf), " %s %s", gu.urace.adj,
(currentgend && gu.urole.name.f) ? gu.urole.name.f : gu.urole.name.m);
pline(new_game ? "%s %s, welcome to NetHack! You are a%s."
: "%s %s, the%s, welcome back to NetHack!",
Hello((struct monst *) 0), g.plname, buf);
Hello((struct monst *) 0), gp.plname, buf);
if (new_game) {
/* guarantee that 'major' event category is never empty */
livelog_printf(LL_ACHIEVE, "%s the%s entered the dungeon",
g.plname, buf);
gp.plname, buf);
} else {
/* if restroing in Gehennom, give same hot/smoky message as when
first entering it */
@@ -789,14 +789,14 @@ do_positionbar(void)
{
static char pbar[COLNO];
char *p;
stairway *stway = g.stairs;
stairway *stway = gs.stairs;
p = pbar;
/* TODO: use the same method as getpos() so objects don't cover stairs */
while (stway) {
int x = stway->sx;
int y = stway->sy;
int glyph = glyph_to_cmap(g.level.locations[x][y].glyph);
int glyph = glyph_to_cmap(gl.level.locations[x][y].glyph);
if (is_cmap_stairs(glyph)) {
*p++ = (stway->up ? '<' : '>');
@@ -820,7 +820,7 @@ do_positionbar(void)
static void
interrupt_multi(const char *msg)
{
if (g.multi > 0 && !g.context.travel && !g.context.run) {
if (gm.multi > 0 && !gc.context.travel && !gc.context.run) {
nomul(0);
if (Verbose(0,interrupt_multi) && msg)
Norep("%s", msg);
+103 -103
View File
@@ -310,7 +310,7 @@ use_stethoscope(struct obj *obj)
boolean interference = (u.uswallow && is_whirly(u.ustuck->data)
&& !rn2(Role_if(PM_HEALER) ? 10 : 3));
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
You("have no hands!"); /* not `body_part(HAND)' */
return ECMD_OK;
} else if (Deaf) {
@@ -323,11 +323,11 @@ use_stethoscope(struct obj *obj)
if (!getdir((char *) 0))
return ECMD_CANCEL;
res = (g.hero_seq == g.context.stethoscope_seq) ? ECMD_TIME : ECMD_OK;
g.context.stethoscope_seq = g.hero_seq;
res = (gh.hero_seq == gc.context.stethoscope_seq) ? ECMD_TIME : ECMD_OK;
gc.context.stethoscope_seq = gh.hero_seq;
g.bhitpos.x = u.ux, g.bhitpos.y = u.uy; /* tentative, reset below */
g.notonhead = u.uswallow;
gb.bhitpos.x = u.ux, gb.bhitpos.y = u.uy; /* tentative, reset below */
gn.notonhead = u.uswallow;
if (u.usteed && u.dz > 0) {
if (interference) {
pline("%s interferes.", Monnam(u.ustuck));
@@ -373,9 +373,9 @@ use_stethoscope(struct obj *obj)
const char *mnm = x_monnam(mtmp, ARTICLE_A, (const char *) 0,
SUPPRESS_IT | SUPPRESS_INVISIBLE, FALSE);
/* g.bhitpos needed by mstatusline() iff mtmp is a long worm */
g.bhitpos.x = rx, g.bhitpos.y = ry;
g.notonhead = (mtmp->mx != rx || mtmp->my != ry);
/* gb.bhitpos needed by mstatusline() iff mtmp is a long worm */
gb.bhitpos.x = rx, gb.bhitpos.y = ry;
gn.notonhead = (mtmp->mx != rx || mtmp->my != ry);
if (mtmp->mundetected) {
if (!canspotmon(mtmp))
@@ -454,7 +454,7 @@ static const char whistle_str[] = "produce a %s whistling sound.",
static void
use_whistle(struct obj *obj)
{
if (!can_blow(&g.youmonst)) {
if (!can_blow(&gy.youmonst)) {
You("are incapable of using the whistle.");
} else if (Underwater) {
You("blow bubbles through %s.", yname(obj));
@@ -472,7 +472,7 @@ use_whistle(struct obj *obj)
static void
use_magic_whistle(struct obj *obj)
{
if (!can_blow(&g.youmonst)) {
if (!can_blow(&gy.youmonst)) {
You("are incapable of using the whistle.");
} else if (obj->cursed && !rn2(2)) {
You("produce a %shigh-%s.", Underwater ? "very " : "",
@@ -667,7 +667,7 @@ number_leashed(void)
int i = 0;
struct obj *obj;
for (obj = g.invent; obj; obj = obj->nobj)
for (obj = gi.invent; obj; obj = obj->nobj)
if (obj->otyp == LEASH && obj->leashmon != 0)
i++;
return i;
@@ -714,7 +714,7 @@ unleash_all(void)
register struct obj *otmp;
register struct monst *mtmp;
for (otmp = g.invent; otmp; otmp = otmp->nobj)
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (otmp->otyp == LEASH)
otmp->leashmon = 0;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
@@ -846,7 +846,7 @@ get_mleash(struct monst *mtmp)
{
struct obj *otmp;
for (otmp = g.invent; otmp; otmp = otmp->nobj)
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (otmp->otyp == LEASH && (unsigned) otmp->leashmon == mtmp->m_id)
break;
return otmp;
@@ -896,7 +896,7 @@ check_leash(coordxy x, coordxy y)
register struct obj *otmp;
register struct monst *mtmp;
for (otmp = g.invent; otmp; otmp = otmp->nobj) {
for (otmp = gi.invent; otmp; otmp = otmp->nobj) {
if (otmp->otyp != LEASH || otmp->leashmon == 0)
continue;
mtmp = find_mid(otmp->leashmon, FM_FMON);
@@ -1012,12 +1012,12 @@ use_mirror(struct obj *obj)
pline("Yikes! You've frozen yourself!");
if (!Hallucination || !rn2(4)) {
nomul(-rnd(MAXULEV + 6 - u.ulevel));
g.multi_reason = "gazing into a mirror";
gm.multi_reason = "gazing into a mirror";
}
g.nomovemsg = 0; /* default, "you can move again" */
gn.nomovemsg = 0; /* default, "you can move again" */
}
} else if (is_vampire(g.youmonst.data)
|| is_vampshifter(&g.youmonst)) {
} else if (is_vampire(gy.youmonst.data)
|| is_vampshifter(&gy.youmonst)) {
You("don't have a reflection.");
} else if (u.umonnum == PM_UMBER_HULK) {
pline("Huh? That doesn't look like you!");
@@ -1057,7 +1057,7 @@ use_mirror(struct obj *obj)
mtmp = bhit(u.dx, u.dy, COLNO, INVIS_BEAM,
(int (*) (MONST_P, OBJ_P)) 0,
(int (*) (OBJ_P, OBJ_P)) 0, &obj);
if (!mtmp || !haseyes(mtmp->data) || g.notonhead)
if (!mtmp || !haseyes(mtmp->data) || gn.notonhead)
return ECMD_TIME;
/* couldsee(mtmp->mx, mtmp->my) is implied by the fact that bhit()
@@ -1095,7 +1095,7 @@ use_mirror(struct obj *obj)
return ECMD_TIME;
if (vis)
pline("%s is turned to stone!", Monnam(mtmp));
g.stoned = TRUE;
gs.stoned = TRUE;
killed(mtmp);
} else if (monable && mtmp->data == &mons[PM_FLOATING_EYE]) {
int tmp = d((int) mtmp->m_lev, (int) mtmp->data->mattk[0].damd);
@@ -1148,7 +1148,7 @@ use_mirror(struct obj *obj)
;
else if ((mtmp->minvis && !perceives(mtmp->data))
/* redundant: can't get here if these are true */
|| !haseyes(mtmp->data) || g.notonhead || !mtmp->mcansee)
|| !haseyes(mtmp->data) || gn.notonhead || !mtmp->mcansee)
pline("%s doesn't seem to notice %s reflection.", Monnam(mtmp),
mhis(mtmp));
else
@@ -1181,9 +1181,9 @@ use_bell(struct obj **optr)
} else if (ordinary) {
if (obj->cursed && !rn2(4)
/* note: once any of them are gone, we stop all of them */
&& !(g.mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
&& !(g.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
&& !(g.mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE)
&& !(gm.mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
&& !(gm.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
&& !(gm.mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE)
&& (mtmp = makemon(mkclass(S_NYMPH, 0), u.ux, u.uy, NO_MINVENT|MM_NOMSG))
!= 0) {
You("summon %s!", a_monnam(mtmp));
@@ -1199,8 +1199,8 @@ use_bell(struct obj **optr)
mon_adjust_speed(mtmp, 2, (struct obj *) 0);
break;
case 2: /* no explanation; it just happens... */
g.nomovemsg = "";
g.multi_reason = NULL;
gn.nomovemsg = "";
gm.multi_reason = NULL;
nomul(-rnd(2));
break;
}
@@ -1227,7 +1227,7 @@ use_bell(struct obj **optr)
} else if (invoking) {
pline("%s an unsettling shrill sound...", Tobjnam(obj, "issue"));
obj->age = g.moves;
obj->age = gm.moves;
learno = TRUE;
wakem = TRUE;
@@ -1288,7 +1288,7 @@ use_candelabrum(struct obj *obj)
pline("This %s has no %s.", xname(obj), s);
/* only output tip if candles are in inventory */
for (otmp = g.invent; otmp; otmp = otmp->nobj)
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (Is_candle(otmp))
break;
if (otmp)
@@ -1718,7 +1718,7 @@ dorub(void)
{
struct obj *obj;
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
You("aren't able to rub anything without hands.");
return ECMD_OK;
}
@@ -1816,7 +1816,7 @@ check_jump(genericptr arg, coordxy x, coordxy y)
/* let giants jump over boulders (what about Flying?
and is there really enough head room for giants to jump
at all, let alone over something tall?) */
if (sobj_at(BOULDER, x, y) && !throws_rocks(g.youmonst.data))
if (sobj_at(BOULDER, x, y) && !throws_rocks(gy.youmonst.data))
return FALSE;
return TRUE;
}
@@ -1892,7 +1892,7 @@ get_valid_jump_position(coordxy x, coordxy y)
{
return (isok(x, y)
&& (ACCESSIBLE(levl[x][y].typ) || Passes_walls)
&& is_valid_jump_pos(x, y, g.jumping_is_magic, FALSE));
&& is_valid_jump_pos(x, y, gj.jumping_is_magic, FALSE));
}
static void
@@ -1924,7 +1924,7 @@ jump(int magic) /* 0=Physical, otherwise skill level */
if (!magic && !Jumping && known_spell(SPE_JUMPING) >= spe_Fresh)
return spelleffects(SPE_JUMPING, FALSE, FALSE);
if (!magic && (nolimbs(g.youmonst.data) || slithy(g.youmonst.data))) {
if (!magic && (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data))) {
/* normally (nolimbs || slithy) implies !Jumping,
but that isn't necessarily the case for knights */
You_cant("jump; you have no legs!");
@@ -1989,7 +1989,7 @@ jump(int magic) /* 0=Physical, otherwise skill level */
pline("Where do you want to jump?");
cc.x = u.ux;
cc.y = u.uy;
g.jumping_is_magic = magic;
gj.jumping_is_magic = magic;
getpos_sethilite(display_jump_positions, get_valid_jump_position);
if (getpos(&cc, TRUE, "the desired position") < 0)
return ECMD_CANCEL; /* user pressed ESC */
@@ -2056,8 +2056,8 @@ jump(int magic) /* 0=Physical, otherwise skill level */
*/
teleds(cc.x, cc.y, TELEDS_NO_FLAGS);
nomul(-1);
g.multi_reason = "jumping around";
g.nomovemsg = "";
gm.multi_reason = "jumping around";
gn.nomovemsg = "";
morehungry(rnd(25));
return ECMD_TIME;
}
@@ -2097,7 +2097,7 @@ use_tinning_kit(struct obj *obj)
char kbuf[BUFSZ];
const char *corpse_name = an(cxname(corpse));
if (poly_when_stoned(g.youmonst.data)) {
if (poly_when_stoned(gy.youmonst.data)) {
You("tin %s without wearing gloves.", corpse_name);
kbuf[0] = '\0';
} else {
@@ -2275,7 +2275,7 @@ use_unicorn_horn(struct obj **optr)
}
if (did_prop)
g.context.botl = TRUE;
gc.context.botl = TRUE;
else
pline("%s", Nothing_seems_to_happen);
@@ -2302,7 +2302,7 @@ fig_transform(anything *arg, long timeout)
impossible("null figurine in fig_transform()");
return;
}
silent = (timeout != g.moves); /* happened while away */
silent = (timeout != gm.moves); /* happened while away */
okay_spot = get_obj_location(figurine, &cc.x, &cc.y, 0);
if (figurine->where == OBJ_INVENT || figurine->where == OBJ_MINVENT)
okay_spot = enexto(&cc, cc.x, cc.y, &mons[figurine->corpsenm]);
@@ -2317,7 +2317,7 @@ fig_transform(anything *arg, long timeout)
mtmp = make_familiar(figurine, cc.x, cc.y, TRUE);
if (mtmp) {
char and_vanish[BUFSZ];
struct obj *mshelter = g.level.objects[mtmp->mx][mtmp->my];
struct obj *mshelter = gl.level.objects[mtmp->mx][mtmp->my];
/* [m_monnam() yields accurate mon type, overriding hallucination] */
Sprintf(monnambuf, "%s", an(m_monnam(mtmp)));
@@ -2445,7 +2445,7 @@ use_figurine(struct obj **optr)
return ECMD_OK;
}
if (!getdir((char *) 0)) {
g.context.move = g.multi = 0;
gc.context.move = gm.multi = 0;
return ECMD_CANCEL;
}
x = u.ux + u.dx;
@@ -2524,7 +2524,7 @@ use_grease(struct obj *obj)
if (otmp != &cg.zeroobj) {
You("cover %s with a thick layer of grease.", yname(otmp));
otmp->greased = 1;
if (obj->cursed && !nohands(g.youmonst.data)) {
if (obj->cursed && !nohands(gy.youmonst.data)) {
make_glib(oldglib + rn1(6, 10)); /* + 10..15 */
pline("Some of the grease gets all over your %s.",
fingers_or_gloves(TRUE));
@@ -2702,8 +2702,8 @@ use_stone(struct obj *tstone)
void
reset_trapset(void)
{
g.trapinfo.tobj = 0;
g.trapinfo.force_bungle = 0;
gt.trapinfo.tobj = 0;
gt.trapinfo.force_bungle = 0;
}
/* Place a landmine/bear trap. Helge Hafting */
@@ -2716,7 +2716,7 @@ use_trap(struct obj *otmp)
int levtyp = levl[u.ux][u.uy].typ;
const char *occutext = "setting the trap";
if (nohands(g.youmonst.data))
if (nohands(gy.youmonst.data))
what = "without hands";
else if (Stunned)
what = "while stunned";
@@ -2748,22 +2748,22 @@ use_trap(struct obj *otmp)
return;
}
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
if (otmp == g.trapinfo.tobj && u_at(g.trapinfo.tx, g.trapinfo.ty)) {
if (otmp == gt.trapinfo.tobj && u_at(gt.trapinfo.tx, gt.trapinfo.ty)) {
You("resume setting %s%s.", shk_your(buf, otmp),
trapname(ttyp, FALSE));
set_occupation(set_trap, occutext, 0);
return;
}
g.trapinfo.tobj = otmp;
g.trapinfo.tx = u.ux, g.trapinfo.ty = u.uy;
gt.trapinfo.tobj = otmp;
gt.trapinfo.tx = u.ux, gt.trapinfo.ty = u.uy;
tmp = ACURR(A_DEX);
g.trapinfo.time_needed =
gt.trapinfo.time_needed =
(tmp > 17) ? 2 : (tmp > 12) ? 3 : (tmp > 7) ? 4 : 5;
if (Blind)
g.trapinfo.time_needed *= 2;
gt.trapinfo.time_needed *= 2;
tmp = ACURR(A_STR);
if (ttyp == BEAR_TRAP && tmp < 18)
g.trapinfo.time_needed += (tmp > 12) ? 1 : (tmp > 7) ? 2 : 4;
gt.trapinfo.time_needed += (tmp > 12) ? 1 : (tmp > 7) ? 2 : 4;
/*[fumbling and/or confusion and/or cursed object check(s)
should be incorporated here instead of in set_trap]*/
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) {
@@ -2780,8 +2780,8 @@ use_trap(struct obj *otmp)
if (chance) {
switch (ttyp) {
case LANDMINE: /* set it off */
g.trapinfo.time_needed = 0;
g.trapinfo.force_bungle = TRUE;
gt.trapinfo.time_needed = 0;
gt.trapinfo.force_bungle = TRUE;
break;
case BEAR_TRAP: /* drop it without arming it */
reset_trapset();
@@ -2803,18 +2803,18 @@ use_trap(struct obj *otmp)
static int
set_trap(void)
{
struct obj *otmp = g.trapinfo.tobj;
struct obj *otmp = gt.trapinfo.tobj;
struct trap *ttmp;
int ttyp;
if (!otmp || !carried(otmp) || u.ux != g.trapinfo.tx
|| u.uy != g.trapinfo.ty) {
if (!otmp || !carried(otmp) || u.ux != gt.trapinfo.tx
|| u.uy != gt.trapinfo.ty) {
/* ?? */
reset_trapset();
return 0;
}
if (--g.trapinfo.time_needed > 0)
if (--gt.trapinfo.time_needed > 0)
return 1; /* still busy */
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
@@ -2825,12 +2825,12 @@ set_trap(void)
if (*in_rooms(u.ux, u.uy, SHOPBASE)) {
add_damage(u.ux, u.uy, 0L); /* schedule removal */
}
if (!g.trapinfo.force_bungle)
if (!gt.trapinfo.force_bungle)
You("finish arming %s.", the(trapname(ttyp, FALSE)));
if (((otmp->cursed || Fumbling) && (rnl(10) > 5))
|| g.trapinfo.force_bungle)
|| gt.trapinfo.force_bungle)
dotrap(ttmp,
(unsigned) (g.trapinfo.force_bungle ? FORCEBUNGLE : 0));
(unsigned) (gt.trapinfo.force_bungle ? FORCEBUNGLE : 0));
} else {
/* this shouldn't happen */
Your("trap setting attempt fails.");
@@ -2919,7 +2919,7 @@ use_whip(struct obj *obj)
/* Have a shot at snaring something on the floor. A flyer
can reach the floor so could just pick an item up, but
allow snagging by whip too. */
otmp = g.level.objects[u.ux][u.uy];
otmp = gl.level.objects[u.ux][u.uy];
if (otmp && otmp->otyp == CORPSE && otmp->corpsenm == PM_HORSE) {
pline("Why beat a dead horse?");
return ECMD_TIME;
@@ -2986,13 +2986,13 @@ use_whip(struct obj *obj)
cc.y = ry;
You("wrap your bullwhip around %s.", wrapped_what);
if (proficient && rn2(proficient + 2)) {
if (!mtmp || enexto(&cc, rx, ry, g.youmonst.data)) {
if (!mtmp || enexto(&cc, rx, ry, gy.youmonst.data)) {
You("yank yourself out of the pit!");
reset_utrap(TRUE); /* [was after teleds(); do this before
* in case it has no alternative other
* than to put hero in another trap] */
teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG);
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
}
} else {
pline1(msg_slipsfree);
@@ -3071,7 +3071,7 @@ use_whip(struct obj *obj)
int hitu, hitvalu;
hitvalu = 8 + otmp->spe;
hitu = thitu(hitvalu, dmgval(otmp, &g.youmonst),
hitu = thitu(hitvalu, dmgval(otmp, &gy.youmonst),
&otmp, (char *)0);
if (hitu) {
pline_The("%s hits you as you try to snatch it!",
@@ -3087,7 +3087,7 @@ use_whip(struct obj *obj)
if (otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm]) && !uarmg
&& !Stone_resistance
&& !(poly_when_stoned(g.youmonst.data)
&& !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) {
char kbuf[BUFSZ];
@@ -3202,8 +3202,8 @@ get_valid_polearm_position(coordxy x, coordxy y)
glyph = glyph_at(x, y);
return (isok(x, y) && distu(x, y) >= g.polearm_range_min
&& distu(x, y) <= g.polearm_range_max
return (isok(x, y) && distu(x, y) >= gp.polearm_range_min
&& distu(x, y) <= gp.polearm_range_max
&& (cansee(x, y) || (couldsee(x, y)
&& glyph_is_poleable(glyph))));
}
@@ -3237,7 +3237,7 @@ use_pole(struct obj *obj, boolean autohit)
int res = ECMD_OK, typ, max_range, min_range, glyph;
coord cc;
struct monst *mtmp;
struct monst *hitm = g.context.polearm.hitmon;
struct monst *hitm = gc.context.polearm.hitmon;
/* Are you allowed to use the pole? */
if (u.uswallow) {
@@ -3278,8 +3278,8 @@ use_pole(struct obj *obj, boolean autohit)
else
max_range = 8; /* (P_SKILL(typ) >= P_EXPERT) */
g.polearm_range_min = min_range;
g.polearm_range_max = max_range;
gp.polearm_range_min = min_range;
gp.polearm_range_max = max_range;
/* Prompt for a location */
if (!autohit)
@@ -3318,25 +3318,25 @@ use_pole(struct obj *obj, boolean autohit)
return ECMD_FAIL;
}
g.context.polearm.hitmon = (struct monst *) 0;
gc.context.polearm.hitmon = (struct monst *) 0;
/* Attack the monster there */
g.bhitpos = cc;
if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != (struct monst *) 0) {
gb.bhitpos = cc;
if ((mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y)) != (struct monst *) 0) {
if (attack_checks(mtmp, uwep)) /* can attack proceed? */
/* no, abort the attack attempt; result depends on
res: 1 => polearm became wielded, 0 => already wielded;
g.context.move: 1 => discovered hidden monster at target spot,
gc.context.move: 1 => discovered hidden monster at target spot,
0 => answered 'n' to "Really attack?" prompt */
return res | (g.context.move ? ECMD_TIME : ECMD_OK);
return res | (gc.context.move ? ECMD_TIME : ECMD_OK);
if (overexertion())
return ECMD_TIME; /* burn nutrition; maybe pass out */
g.context.polearm.hitmon = mtmp;
gc.context.polearm.hitmon = mtmp;
check_caitiff(mtmp);
g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
gn.notonhead = (gb.bhitpos.x != mtmp->mx || gb.bhitpos.y != mtmp->my);
(void) thitmonst(mtmp, uwep);
} else if (glyph_is_statue(glyph) /* might be hallucinatory */
&& sobj_at(STATUE, g.bhitpos.x, g.bhitpos.y)) {
struct trap *t = t_at(g.bhitpos.x, g.bhitpos.y);
&& sobj_at(STATUE, gb.bhitpos.x, gb.bhitpos.y)) {
struct trap *t = t_at(gb.bhitpos.x, gb.bhitpos.y);
if (t && t->ttyp == STATUE_TRAP
&& activate_statue_trap(t, t->tx, t->ty, FALSE)) {
@@ -3348,23 +3348,23 @@ use_pole(struct obj *obj, boolean autohit)
because the player is probably attempting to attack it;
other statues obscured by anything are just ignored. */
pline(thump, "statue");
wake_nearto(g.bhitpos.x, g.bhitpos.y, 25);
wake_nearto(gb.bhitpos.x, gb.bhitpos.y, 25);
}
} else {
/* no monster here and no statue seen or remembered here */
(void) unmap_invisible(g.bhitpos.x, g.bhitpos.y);
(void) unmap_invisible(gb.bhitpos.x, gb.bhitpos.y);
if (glyph_to_obj(glyph) == BOULDER
&& sobj_at(BOULDER, g.bhitpos.x, g.bhitpos.y)) {
&& sobj_at(BOULDER, gb.bhitpos.x, gb.bhitpos.y)) {
pline(thump, "boulder");
wake_nearto(g.bhitpos.x, g.bhitpos.y, 25);
} else if (!accessible(g.bhitpos.x, g.bhitpos.y)
|| IS_FURNITURE(levl[g.bhitpos.x][g.bhitpos.y].typ)) {
wake_nearto(gb.bhitpos.x, gb.bhitpos.y, 25);
} else if (!accessible(gb.bhitpos.x, gb.bhitpos.y)
|| IS_FURNITURE(levl[gb.bhitpos.x][gb.bhitpos.y].typ)) {
/* similar to 'F'orcefight with a melee weapon; we know that
the spot can be seen or we wouldn't have gotten this far */
You("uselessly attack %s.",
(levl[g.bhitpos.x][g.bhitpos.y].typ == STONE
|| levl[g.bhitpos.x][g.bhitpos.y].typ == SCORR)
(levl[gb.bhitpos.x][gb.bhitpos.y].typ == STONE
|| levl[gb.bhitpos.x][gb.bhitpos.y].typ == SCORR)
? "stone"
: glyph_is_cmap(glyph)
? the(defsyms[glyph_to_cmap(glyph)].explanation)
@@ -3394,7 +3394,7 @@ use_cream_pie(struct obj *obj)
pline("You immerse your %s in %s%s.", body_part(FACE),
several ? "one of " : "",
several ? makeplural(the(xname(obj))) : the(xname(obj)));
if (can_blnd((struct monst *) 0, &g.youmonst, AT_WEAP, obj)) {
if (can_blnd((struct monst *) 0, &gy.youmonst, AT_WEAP, obj)) {
int blindinc = rnd(25);
u.ucreamed += blindinc;
make_blinded(Blinded + (long) blindinc, FALSE);
@@ -3597,7 +3597,7 @@ use_grapple(struct obj *obj)
/* FIXME -- untrap needs to deal with non-adjacent traps */
break;
case 1: /* Object */
if ((otmp = g.level.objects[cc.x][cc.y]) != 0) {
if ((otmp = gl.level.objects[cc.x][cc.y]) != 0) {
You("snag an object from the %s!", surface(cc.x, cc.y));
(void) pickup_object(otmp, 1L, FALSE);
/* If pickup fails, leave it alone */
@@ -3606,10 +3606,10 @@ use_grapple(struct obj *obj)
}
break;
case 2: /* Monster */
g.bhitpos = cc;
gb.bhitpos = cc;
if ((mtmp = m_at(cc.x, cc.y)) == (struct monst *) 0)
break;
g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
gn.notonhead = (gb.bhitpos.x != mtmp->mx || gb.bhitpos.y != mtmp->my);
save_confirm = flags.confirm;
if (verysmall(mtmp->data) && !rn2(4)
&& enexto(&cc, u.ux, u.uy, (struct permonst *) 0)) {
@@ -3672,7 +3672,7 @@ do_break_wand(struct obj *obj)
boolean is_fragile = (objdescr_is(obj, "balsa")
|| objdescr_is(obj, "glass"));
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
You_cant("break %s without hands!", yname(obj));
return ECMD_OK;
} else if (!freehand()) {
@@ -3698,7 +3698,7 @@ do_break_wand(struct obj *obj)
costly_alteration(obj, COST_DSTROY);
}
g.current_wand = obj; /* destroy_item might reset this */
gc.current_wand = obj; /* destroy_item might reset this */
freeinv(obj); /* hide it from destroy_item instead... */
setnotworn(obj); /* so we need to do this ourselves */
@@ -3783,8 +3783,8 @@ do_break_wand(struct obj *obj)
/* this makes it hit us last, so that we can see the action first */
for (i = 0; i <= N_DIRS; i++) {
g.bhitpos.x = x = obj->ox + xdir[i];
g.bhitpos.y = y = obj->oy + ydir[i];
gb.bhitpos.x = x = obj->ox + xdir[i];
gb.bhitpos.y = y = obj->oy + ydir[i];
if (!isok(x, y))
continue;
@@ -3836,11 +3836,11 @@ do_break_wand(struct obj *obj)
*/
if ((mon = m_at(x, y)) != 0) {
(void) bhitm(mon, obj);
/* if (g.context.botl) bot(); */
/* if (gc.context.botl) bot(); */
}
if (affects_objects && g.level.objects[x][y]) {
if (affects_objects && gl.level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y, 0);
if (g.context.botl)
if (gc.context.botl)
bot(); /* potion effects */
}
} else {
@@ -3856,9 +3856,9 @@ do_break_wand(struct obj *obj)
* of obj->bypass in the zap code to accomplish that last case
* since it's also used by retouch_equipment() for polyself.)
*/
if (affects_objects && g.level.objects[x][y]) {
if (affects_objects && gl.level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y, 0);
if (g.context.botl)
if (gc.context.botl)
bot(); /* potion effects */
}
damage = zapyourself(obj, FALSE);
@@ -3866,7 +3866,7 @@ do_break_wand(struct obj *obj)
Sprintf(buf, "killed %sself by breaking a wand", uhim());
losehp(Maybe_Half_Phys(damage), buf, NO_KILLER_PREFIX);
}
if (g.context.botl)
if (gc.context.botl)
bot(); /* blindness */
}
}
@@ -3883,8 +3883,8 @@ do_break_wand(struct obj *obj)
litroom(TRUE, obj); /* only needs to be done once */
discard_broken_wand:
obj = g.current_wand; /* [see dozap() and destroy_item()] */
g.current_wand = 0;
obj = gc.current_wand; /* [see dozap() and destroy_item()] */
gc.current_wand = 0;
if (obj)
delobj(obj);
nomul(0);
@@ -3954,7 +3954,7 @@ doapply(void)
struct obj *obj;
register int res = ECMD_TIME;
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
You("aren't able to use or apply tools in your current form.");
return ECMD_OK;
}
+78 -78
View File
@@ -85,9 +85,9 @@ hack_artifacts(void)
artilist[ART_EXCALIBUR].role = NON_PM;
/* Fix up the quest artifact */
if (g.urole.questarti) {
artilist[g.urole.questarti].alignment = alignmnt;
artilist[g.urole.questarti].role = Role_switch;
if (gu.urole.questarti) {
artilist[gu.urole.questarti].alignment = alignmnt;
artilist[gu.urole.questarti].role = Role_switch;
}
return;
}
@@ -500,7 +500,7 @@ restrict_name(struct obj *otmp, const char *name)
if (!objects[otyp].oc_name_known
&& (odesc = OBJ_DESCR(objects[otyp])) != 0) {
obj_shuffle_range(otyp, &lo, &hi);
for (i = g.bases[ocls]; i < NUM_OBJECTS; i++) {
for (i = gb.bases[ocls]; i < NUM_OBJECTS; i++) {
if (objects[i].oc_class != ocls)
break;
if (!objects[i].oc_name_known
@@ -651,7 +651,7 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
if (mask && wp_mask == W_ART && !on) {
/* find out if some other artifact also confers this intrinsic;
if so, leave the mask alone */
for (obj = g.invent; obj; obj = obj->nobj) {
for (obj = gi.invent; obj; obj = obj->nobj) {
if (obj != otmp && obj->oartifact) {
art = get_artifact(obj);
if (art && art->cary.adtyp == dtyp) {
@@ -672,7 +672,7 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
spfx = (wp_mask != W_ART) ? oart->spfx : oart->cspfx;
if (spfx && wp_mask == W_ART && !on) {
/* don't change any spfx also conferred by other artifacts */
for (obj = g.invent; obj; obj = obj->nobj)
for (obj = gi.invent; obj; obj = obj->nobj)
if (obj != otmp && obj->oartifact) {
art = get_artifact(obj);
if (art)
@@ -694,7 +694,7 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
* when restoring a game
*/
(void) make_hallucinated((long) !on,
g.program_state.restoring ? FALSE : TRUE,
gp.program_state.restoring ? FALSE : TRUE,
wp_mask);
}
if (spfx & SPFX_ESP) {
@@ -726,10 +726,10 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
if (spec_m2(otmp)) {
if (on) {
EWarn_of_mon |= wp_mask;
g.context.warntype.obj |= spec_m2(otmp);
gc.context.warntype.obj |= spec_m2(otmp);
} else {
EWarn_of_mon &= ~wp_mask;
g.context.warntype.obj &= ~spec_m2(otmp);
gc.context.warntype.obj &= ~spec_m2(otmp);
}
see_monsters();
} else {
@@ -763,7 +763,7 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
u.xray_range = 3;
else
u.xray_range = -1;
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
}
if ((spfx & SPFX_REFLECT) && (wp_mask & W_WEP)) {
if (on)
@@ -808,7 +808,7 @@ touch_artifact(struct obj *obj, struct monst *mon)
if (!oart)
return 1;
yours = (mon == &g.youmonst);
yours = (mon == &gy.youmonst);
/* all quest artifacts are self-willed; if this ever changes, `badclass'
will have to be extended to explicitly include quest artifacts */
self_willed = ((oart->spfx & SPFX_INTEL) != 0);
@@ -907,7 +907,7 @@ spec_applies(const struct artifact *weap, struct monst *mtmp)
if (!(weap->spfx & (SPFX_DBONUS | SPFX_ATTK)))
return (weap->attk.adtyp == AD_PHYS);
yours = (mtmp == &g.youmonst);
yours = (mtmp == &gy.youmonst);
ptr = mtmp->data;
if (weap->spfx & SPFX_DMONS) {
@@ -919,7 +919,7 @@ spec_applies(const struct artifact *weap, struct monst *mtmp)
} else if (weap->spfx & SPFX_DFLAG2) {
return ((ptr->mflags2 & weap->mtype)
|| (yours
&& ((!Upolyd && (g.urace.selfmask & weap->mtype))
&& ((!Upolyd && (gu.urace.selfmask & weap->mtype))
|| ((weap->mtype & M2_WERE) && u.ulycn >= LOW_PM))));
} else if (weap->spfx & SPFX_DALIGN) {
return yours ? (u.ualign.type != weap->alignment)
@@ -986,15 +986,15 @@ spec_dbon(struct obj *otmp, struct monst *mon, int tmp)
if (!weap || (weap->attk.adtyp == AD_PHYS /* check for `NO_ATTK' */
&& weap->attk.damn == 0 && weap->attk.damd == 0))
g.spec_dbon_applies = FALSE;
gs.spec_dbon_applies = FALSE;
else if (is_art(otmp, ART_GRIMTOOTH))
/* Grimtooth has SPFX settings to warn against elves but we want its
damage bonus to apply to all targets, so bypass spec_applies() */
g.spec_dbon_applies = TRUE;
gs.spec_dbon_applies = TRUE;
else
g.spec_dbon_applies = spec_applies(weap, mon);
gs.spec_dbon_applies = spec_applies(weap, mon);
if (g.spec_dbon_applies)
if (gs.spec_dbon_applies)
return weap->attk.damd ? rnd((int) weap->attk.damd) : max(tmp, 1);
return 0;
}
@@ -1145,8 +1145,8 @@ Mb_hit(struct monst *magr, /* attacker */
{
struct permonst *old_uasmon;
const char *verb;
boolean youattack = (magr == &g.youmonst),
youdefend = (mdef == &g.youmonst),
boolean youattack = (magr == &gy.youmonst),
youdefend = (mdef == &gy.youmonst),
resisted = FALSE, do_stun, do_confuse, result;
int attack_indx, fakeidx, scare_dieroll = MB_MAX_DIEROLL / 2;
@@ -1156,14 +1156,14 @@ Mb_hit(struct monst *magr, /* attacker */
scare_dieroll /= (1 << (mb->spe / 3));
/* if target successfully resisted the artifact damage bonus,
reduce overall likelihood of the assorted special effects */
if (!g.spec_dbon_applies)
if (!gs.spec_dbon_applies)
dieroll += 1;
/* might stun even when attempting a more severe effect, but
in that case it will only happen if the other effect fails;
extra damage will apply regardless; 3.4.1: sometimes might
just probe even when it hasn't been enchanted */
do_stun = (max(mb->spe, 0) < rn2(g.spec_dbon_applies ? 11 : 7));
do_stun = (max(mb->spe, 0) < rn2(gs.spec_dbon_applies ? 11 : 7));
/* the special effects also boost physical damage; increments are
generally cumulative, but since the stun effect is based on a
@@ -1202,7 +1202,7 @@ Mb_hit(struct monst *magr, /* attacker */
/* now perform special effects */
switch (attack_indx) {
case MB_INDEX_CANCEL:
old_uasmon = g.youmonst.data;
old_uasmon = gy.youmonst.data;
/* No mdef->mcan check: even a cancelled monster can be polymorphed
* into a golem, and the "cancel" effect acts as if some magical
* energy remains in spellcasting defenders to be absorbed later.
@@ -1212,13 +1212,13 @@ Mb_hit(struct monst *magr, /* attacker */
} else {
do_stun = FALSE;
if (youdefend) {
if (g.youmonst.data != old_uasmon)
if (gy.youmonst.data != old_uasmon)
*dmgptr = 0; /* rehumanized, so no more damage */
if (u.uenmax > 0) {
u.uenmax--;
if (u.uen > 0)
u.uen--;
g.context.botl = TRUE;
gc.context.botl = TRUE;
You("lose magical energy!");
}
} else {
@@ -1229,7 +1229,7 @@ Mb_hit(struct monst *magr, /* attacker */
if (u.uenmax > u.uenpeak)
u.uenpeak = u.uenmax;
u.uen++;
g.context.botl = TRUE;
gc.context.botl = TRUE;
You("absorb magical energy!");
}
}
@@ -1242,9 +1242,9 @@ Mb_hit(struct monst *magr, /* attacker */
resisted = TRUE;
} else {
nomul(-3);
g.multi_reason = "being scared stiff";
g.nomovemsg = "";
if (magr && magr == u.ustuck && sticks(g.youmonst.data)) {
gm.multi_reason = "being scared stiff";
gn.nomovemsg = "";
if (magr && magr == u.ustuck && sticks(gy.youmonst.data)) {
set_ustuck((struct monst *) 0);
You("release %s!", mon_nam(magr));
}
@@ -1336,8 +1336,8 @@ artifact_hit(
int *dmgptr, /* output */
int dieroll) /* needed for Magicbane and vorpal blades */
{
boolean youattack = (magr == &g.youmonst);
boolean youdefend = (mdef == &g.youmonst);
boolean youattack = (magr == &gy.youmonst);
boolean youdefend = (mdef == &gy.youmonst);
boolean vis = (!youattack && magr && cansee(magr->mx, magr->my))
|| (!youdefend && cansee(mdef->mx, mdef->my))
|| (youattack && engulfing_u(mdef) && !Blind);
@@ -1367,12 +1367,12 @@ artifact_hit(
if (attacks(AD_FIRE, otmp)) {
if (realizes_damage)
pline_The("fiery blade %s %s%c",
!g.spec_dbon_applies
!gs.spec_dbon_applies
? "hits"
: (mdef->data == &mons[PM_WATER_ELEMENTAL])
? "vaporizes part of"
: "burns",
hittee, !g.spec_dbon_applies ? '.' : '!');
hittee, !gs.spec_dbon_applies ? '.' : '!');
if (!rn2(4))
(void) destroy_mitem(mdef, POTION_CLASS, AD_FIRE);
if (!rn2(4))
@@ -1388,8 +1388,8 @@ artifact_hit(
if (attacks(AD_COLD, otmp)) {
if (realizes_damage)
pline_The("ice-cold blade %s %s%c",
!g.spec_dbon_applies ? "hits" : "freezes", hittee,
!g.spec_dbon_applies ? '.' : '!');
!gs.spec_dbon_applies ? "hits" : "freezes", hittee,
!gs.spec_dbon_applies ? '.' : '!');
if (!rn2(4))
(void) destroy_mitem(mdef, POTION_CLASS, AD_COLD);
return realizes_damage;
@@ -1397,9 +1397,9 @@ artifact_hit(
if (attacks(AD_ELEC, otmp)) {
if (realizes_damage)
pline_The("massive hammer hits%s %s%c",
!g.spec_dbon_applies ? "" : "! Lightning strikes",
hittee, !g.spec_dbon_applies ? '.' : '!');
if (g.spec_dbon_applies)
!gs.spec_dbon_applies ? "" : "! Lightning strikes",
hittee, !gs.spec_dbon_applies ? '.' : '!');
if (gs.spec_dbon_applies)
wake_nearto(mdef->mx, mdef->my, 4 * 4);
if (!rn2(5))
(void) destroy_mitem(mdef, RING_CLASS, AD_ELEC);
@@ -1410,10 +1410,10 @@ artifact_hit(
if (attacks(AD_MAGM, otmp)) {
if (realizes_damage)
pline_The("imaginary widget hits%s %s%c",
!g.spec_dbon_applies
!gs.spec_dbon_applies
? ""
: "! A hail of magic missiles strikes",
hittee, !g.spec_dbon_applies ? '.' : '!');
hittee, !gs.spec_dbon_applies ? '.' : '!');
return realizes_damage;
}
@@ -1422,7 +1422,7 @@ artifact_hit(
return Mb_hit(magr, mdef, otmp, dmgptr, dieroll, vis, hittee);
}
if (!g.spec_dbon_applies) {
if (!gs.spec_dbon_applies) {
/* since damage bonus didn't apply, nothing more to do;
no further attacks have side-effects on inventory */
return FALSE;
@@ -1441,7 +1441,7 @@ artifact_hit(
}
if (!youdefend) {
/* allow normal cutworm() call to add extra damage */
if (g.notonhead)
if (gn.notonhead)
return FALSE;
if (bigmonst(mdef->data)) {
@@ -1458,7 +1458,7 @@ artifact_hit(
otmp->dknown = TRUE;
return TRUE;
} else {
if (bigmonst(g.youmonst.data)) {
if (bigmonst(gy.youmonst.data)) {
pline("%s cuts deeply into you!",
magr ? Monnam(magr) : wepdesc);
*dmgptr *= 2;
@@ -1484,7 +1484,7 @@ artifact_hit(
return FALSE;
wepdesc = artilist[ART_VORPAL_BLADE].name;
if (!youdefend) {
if (!has_head(mdef->data) || g.notonhead || u.uswallow) {
if (!has_head(mdef->data) || gn.notonhead || u.uswallow) {
if (youattack)
pline("Somehow, you miss %s wildly.", mon_nam(mdef));
else if (vis)
@@ -1505,14 +1505,14 @@ artifact_hit(
otmp->dknown = TRUE;
return TRUE;
} else {
if (!has_head(g.youmonst.data)) {
if (!has_head(gy.youmonst.data)) {
pline("Somehow, %s misses you wildly.",
magr ? mon_nam(magr) : wepdesc);
*dmgptr = 0;
return TRUE;
}
if (noncorporeal(g.youmonst.data)
|| amorphous(g.youmonst.data)) {
if (noncorporeal(gy.youmonst.data)
|| amorphous(gy.youmonst.data)) {
pline("%s slices through your %s.", wepdesc,
body_part(NECK));
return TRUE;
@@ -1662,7 +1662,7 @@ arti_invoke(struct obj *obj)
if (oart->inv_prop > LAST_PROP) {
/* It's a special power, not "just" a property */
if (obj->age > g.moves) {
if (obj->age > gm.moves) {
/* the artifact is tired :-) */
You_feel("that %s %s ignoring you.", the(xname(obj)),
otense(obj, "are"));
@@ -1670,7 +1670,7 @@ arti_invoke(struct obj *obj)
obj->age += (long) d(3, 10);
return ECMD_TIME;
}
obj->age = g.moves + rnz(100);
obj->age = gm.moves + rnz(100);
switch (oart->inv_prop) {
case TAMING: {
@@ -1704,7 +1704,7 @@ arti_invoke(struct obj *obj)
make_slimed(0L, (char *) 0);
if (Blinded > creamed)
make_blinded(creamed, FALSE);
g.context.botl = TRUE;
gc.context.botl = TRUE;
break;
}
case ENERGY_BOOST: {
@@ -1716,7 +1716,7 @@ arti_invoke(struct obj *obj)
epboost = u.uenmax - u.uen;
if (epboost) {
u.uen += epboost;
g.context.botl = TRUE;
gc.context.botl = TRUE;
You_feel("re-energized.");
} else
goto nothing_special;
@@ -1757,13 +1757,13 @@ arti_invoke(struct obj *obj)
any = cg.zeroany; /* set all bits to zero */
start_menu(tmpwin, MENU_BEHAVE_STANDARD);
/* use index+1 (cant use 0) as identifier */
for (i = num_ok_dungeons = 0; i < g.n_dgns; i++) {
if (!g.dungeons[i].dunlev_ureached)
for (i = num_ok_dungeons = 0; i < gn.n_dgns; i++) {
if (!gd.dungeons[i].dunlev_ureached)
continue;
any.a_int = i + 1;
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, clr,
g.dungeons[i].dname, MENU_ITEMFLAGS_NONE);
gd.dungeons[i].dname, MENU_ITEMFLAGS_NONE);
num_ok_dungeons++;
last_ok_dungeon = i;
}
@@ -1791,10 +1791,10 @@ arti_invoke(struct obj *obj)
* The closest level is either the entry or dunlev_ureached.
*/
newlev.dnum = i;
if (g.dungeons[i].depth_start >= depth(&u.uz))
newlev.dlevel = g.dungeons[i].entry_lev;
if (gd.dungeons[i].depth_start >= depth(&u.uz))
newlev.dlevel = gd.dungeons[i].entry_lev;
else
newlev.dlevel = g.dungeons[i].dunlev_ureached;
newlev.dlevel = gd.dungeons[i].dunlev_ureached;
if (u.uhave.amulet || In_endgame(&u.uz) || In_endgame(&newlev)
|| newlev.dnum == u.uz.dnum || !next_to_u()) {
@@ -1854,7 +1854,7 @@ arti_invoke(struct obj *obj)
if (mtmp->data->msound == MS_NEMESIS)
continue;
if (In_quest(&u.uz) && !g.quest_status.killed_nemesis)
if (In_quest(&u.uz) && !gq.quest_status.killed_nemesis)
chance += 10;
if (is_dprince(mtmp->data))
chance += 2;
@@ -1890,7 +1890,7 @@ arti_invoke(struct obj *obj)
iprop = u.uprops[oart->inv_prop].intrinsic;
boolean on = (eprop & W_ARTI) != 0; /* true if prop just set */
if (on && obj->age > g.moves) {
if (on && obj->age > gm.moves) {
/* the artifact is tired :-) */
u.uprops[oart->inv_prop].extrinsic ^= W_ARTI;
You_feel("that %s %s ignoring you.", the(xname(obj)),
@@ -1901,7 +1901,7 @@ arti_invoke(struct obj *obj)
} else if (!on) {
/* when turning off property, determine downtime */
/* arbitrary for now until we can tune this -dlc */
obj->age = g.moves + rnz(100);
obj->age = gm.moves + rnz(100);
}
if ((eprop & ~W_ARTI) || iprop) {
@@ -2096,9 +2096,9 @@ what_gives(long *abil)
spfx = abil_to_spfx(abil);
wornbits = (wornmask & *abil);
for (obj = g.invent; obj; obj = obj->nobj) {
for (obj = gi.invent; obj; obj = obj->nobj) {
if (obj->oartifact
&& (abil != &EWarn_of_mon || g.context.warntype.obj)) {
&& (abil != &EWarn_of_mon || gc.context.warntype.obj)) {
const struct artifact *art = get_artifact(obj);
if (art) {
@@ -2170,14 +2170,14 @@ Sting_effects(int orc_count) /* new count (warn_obj_cnt is old count); -1 is a f
if (u_wield_art(ART_STING)
|| u_wield_art(ART_ORCRIST)
|| u_wield_art(ART_GRIMTOOTH)) {
int oldstr = glow_strength(g.warn_obj_cnt),
int oldstr = glow_strength(gw.warn_obj_cnt),
newstr = glow_strength(orc_count);
if (orc_count == -1 && g.warn_obj_cnt > 0) {
if (orc_count == -1 && gw.warn_obj_cnt > 0) {
/* -1 means that blindness has just been toggled; give a
'continue' message that eventual 'stop' message will match */
pline("%s is %s.", bare_artifactname(uwep),
glow_verb(Blind ? 0 : g.warn_obj_cnt, TRUE));
glow_verb(Blind ? 0 : gw.warn_obj_cnt, TRUE));
} else if (newstr > 0 && newstr != oldstr) {
/* goto_level() -> docrt() -> see_monsters() -> Sting_effects();
if "you materialize on a different level" is pending, give
@@ -2193,10 +2193,10 @@ Sting_effects(int orc_count) /* new count (warn_obj_cnt is old count); -1 is a f
else if (oldstr == 0) /* quivers */
pline("%s %s slightly.", bare_artifactname(uwep),
otense(uwep, glow_verb(0, FALSE)));
} else if (orc_count == 0 && g.warn_obj_cnt > 0) {
} else if (orc_count == 0 && gw.warn_obj_cnt > 0) {
/* 'stop' message */
pline("%s stops %s.", bare_artifactname(uwep),
glow_verb(Blind ? 0 : g.warn_obj_cnt, TRUE));
glow_verb(Blind ? 0 : gw.warn_obj_cnt, TRUE));
}
}
}
@@ -2217,11 +2217,11 @@ retouch_object(
return 1;
}
if (touch_artifact(obj, &g.youmonst)) {
if (touch_artifact(obj, &gy.youmonst)) {
char buf[BUFSZ];
int dmg = 0, tmp;
boolean ag = (objects[obj->otyp].oc_material == SILVER && Hate_silver),
bane = bane_applies(get_artifact(obj), &g.youmonst);
bane = bane_applies(get_artifact(obj), &gy.youmonst);
/* nothing else to do if hero can successfully handle this object */
if (!ag && !bane)
@@ -2265,7 +2265,7 @@ retouch_object(
struct obj *otmp;
remove_worn_item(obj, FALSE);
for (otmp = g.invent; otmp; otmp = otmp->nobj)
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (otmp == obj)
break;
if (!otmp)
@@ -2384,9 +2384,9 @@ retouch_equipment(int dropflag) /* 0==don't drop, 1==drop all, 2==drop weapon */
/* loss of levitation (silver ring, or Heart of Ahriman invocation)
might cause hero to lose inventory items (by dropping into lava,
for instance), so inventory traversal needs to rescan the whole
g.invent chain each time it moves on to another object; we use bypass
gi.invent chain each time it moves on to another object; we use bypass
handling to keep track of which items have already been processed */
while ((obj = nxt_unbypassed_obj(g.invent)) != 0)
while ((obj = nxt_unbypassed_obj(gi.invent)) != 0)
(void) untouchable(obj, dropit);
if (had_rings != (!!uleft + !!uright) && uarmg && uarmg->cursed)
@@ -2428,7 +2428,7 @@ count_surround_traps(coordxy x, coordxy y)
++ret;
continue;
}
for (otmp = g.level.objects[dx][dy]; otmp; otmp = otmp->nexthere)
for (otmp = gl.level.objects[dx][dy]; otmp; otmp = otmp->nexthere)
if (Is_container(otmp) && otmp->otrapped) {
++ret; /* we're counting locations, so just */
break; /* count the first one in a pile */
@@ -2455,13 +2455,13 @@ mkot_trap_warn(void)
if (!uarmg && u_wield_art(ART_MASTER_KEY_OF_THIEVERY)) {
int idx, ntraps = count_surround_traps(u.ux, u.uy);
if (ntraps != g.mkot_trap_warn_count) {
if (ntraps != gm.mkot_trap_warn_count) {
idx = min(ntraps, SIZE(heat) - 1);
pline_The("Key feels %s%c", heat[idx], (ntraps > 3) ? '!' : '.');
}
g.mkot_trap_warn_count = ntraps;
gm.mkot_trap_warn_count = ntraps;
} else
g.mkot_trap_warn_count = 0;
gm.mkot_trap_warn_count = 0;
}
/* Master Key is magic key if its bless/curse state meets our criteria:
@@ -2471,7 +2471,7 @@ is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */
struct obj *obj)
{
if (is_art(obj, ART_MASTER_KEY_OF_THIEVERY)) {
if ((mon == &g.youmonst) ? Role_if(PM_ROGUE)
if ((mon == &gy.youmonst) ? Role_if(PM_ROGUE)
: (mon && mon->data == &mons[PM_ROGUE]))
return !obj->cursed; /* a rogue; non-cursed suffices for magic */
/* not a rogue; key must be blessed to behave as a magic one */
@@ -2488,8 +2488,8 @@ has_magic_key(struct monst *mon) /* if null, hero assumed */
short key = artilist[ART_MASTER_KEY_OF_THIEVERY].otyp;
if (!mon)
mon = &g.youmonst;
for (o = ((mon == &g.youmonst) ? g.invent : mon->minvent); o;
mon = &gy.youmonst;
for (o = ((mon == &gy.youmonst) ? gi.invent : mon->minvent); o;
o = nxtobj(o, key, FALSE)) {
if (is_magic_key(mon, o))
return o;
+44 -44
View File
@@ -184,10 +184,10 @@ adjattrib(
return FALSE;
}
g.context.botl = TRUE;
gc.context.botl = TRUE;
if (msgflg <= 0)
You_feel("%s%s!", (incr > 1 || incr < -1) ? "very " : "", attrstr);
if (g.program_state.in_moveloop && (ndx == A_STR || ndx == A_CON))
if (gp.program_state.in_moveloop && (ndx == A_STR || ndx == A_CON))
(void) encumber_msg();
return TRUE;
}
@@ -246,7 +246,7 @@ losestr(int num, const char *knam, schar k_format)
if (u.uhpmax > uhpmin)
setuhpmax(max(u.uhpmax - dmg, uhpmin));
}
g.context.botl = TRUE;
gc.context.botl = TRUE;
}
#if 0 /* only possible if uhpmax was already less than uhpmin */
if (!Upolyd && u.uhpmax < uhpmin) {
@@ -354,7 +354,7 @@ poisoned(
loss = 6 + d(4, 6);
if (u.uhp <= loss) {
u.uhp = -1;
g.context.botl = TRUE;
gc.context.botl = TRUE;
pline_The("poison was deadly...");
} else {
/* survived, but with severe reaction */
@@ -383,8 +383,8 @@ poisoned(
}
if (u.uhp < 1) {
g.killer.format = kprefix;
Strcpy(g.killer.name, pkiller);
gk.killer.format = kprefix;
Strcpy(gk.killer.name, pkiller);
/* "Poisoned by a poisoned ___" is redundant */
done(strstri(pkiller, "poison") ? DIED : POISONING);
}
@@ -407,7 +407,7 @@ stone_luck(boolean parameter) /* So I can't think up of a good name. So sue me.
register struct obj *otmp;
register long bonchance = 0;
for (otmp = g.invent; otmp; otmp = otmp->nobj)
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (confers_luck(otmp)) {
if (otmp->cursed)
bonchance -= otmp->quan;
@@ -457,13 +457,13 @@ restore_attrib(void)
if (ATEMP(i) != equilibrium && ATIME(i) != 0) {
if (!(--(ATIME(i)))) { /* countdown for change */
ATEMP(i) += (ATEMP(i) > 0) ? -1 : 1;
g.context.botl = TRUE;
gc.context.botl = TRUE;
if (ATEMP(i)) /* reset timer */
ATIME(i) = 100 / ACURR(A_CON);
}
}
}
if (g.context.botl)
if (gc.context.botl)
(void) encumber_msg();
}
@@ -497,14 +497,14 @@ exercise(int i, boolean inc_or_dec)
: "Con",
(inc_or_dec) ? "inc" : "dec", AEXE(i));
}
if (g.moves > 0 && (i == A_STR || i == A_CON))
if (gm.moves > 0 && (i == A_STR || i == A_CON))
(void) encumber_msg();
}
static void
exerper(void)
{
if (!(g.moves % 10)) {
if (!(gm.moves % 10)) {
/* Hunger Checks */
int hs = (u.uhunger > 1000) ? SATIATED
: (u.uhunger > 150) ? NOT_HUNGRY
@@ -551,7 +551,7 @@ exerper(void)
}
/* status checks */
if (!(g.moves % 5)) {
if (!(gm.moves % 5)) {
debugpline0("exerper: Status checks");
if ((HClairvoyant & (INTRINSIC | TIMEOUT)) && !BClairvoyant)
exercise(A_WIS, TRUE);
@@ -586,11 +586,11 @@ exerchk(void)
/* Check out the periodic accumulations */
exerper();
if (g.moves >= g.context.next_attrib_check) {
debugpline1("exerchk: ready to test. multi = %ld.", g.multi);
if (gm.moves >= gc.context.next_attrib_check) {
debugpline1("exerchk: ready to test. multi = %ld.", gm.multi);
}
/* Are we ready for a test? */
if (g.moves >= g.context.next_attrib_check && !g.multi) {
if (gm.moves >= gc.context.next_attrib_check && !gm.multi) {
debugpline0("exerchk: testing.");
/*
* Law of diminishing returns (Part II):
@@ -654,9 +654,9 @@ exerchk(void)
platform-dependent rounding/truncation for negative vals */
AEXE(i) = (abs(ax) / 2) * mod_val;
}
g.context.next_attrib_check += rn1(200, 800);
gc.context.next_attrib_check += rn1(200, 800);
debugpline1("exerchk: next check at %ld.",
g.context.next_attrib_check);
gc.context.next_attrib_check);
}
}
@@ -667,9 +667,9 @@ init_attr(int np)
register int i, x, tryct;
for (i = 0; i < A_MAX; i++) {
ABASE(i) = AMAX(i) = g.urole.attrbase[i];
ABASE(i) = AMAX(i) = gu.urole.attrbase[i];
ATEMP(i) = ATIME(i) = 0;
np -= g.urole.attrbase[i];
np -= gu.urole.attrbase[i];
}
/* 3.7: the x -= ... calculation used to have an off by 1 error that
@@ -678,7 +678,7 @@ init_attr(int np)
while (np > 0 && tryct < 100) {
x = rn2(100);
for (i = 0; i < A_MAX; ++i)
if ((x -= g.urole.attrdist[i]) < 0)
if ((x -= gu.urole.attrdist[i]) < 0)
break;
if (i >= A_MAX || ABASE(i) >= ATTRMAX(i)) {
tryct++;
@@ -694,7 +694,7 @@ init_attr(int np)
while (np < 0 && tryct < 100) { /* for redistribution */
x = rn2(100);
for (i = 0; i < A_MAX; ++i)
if ((x -= g.urole.attrdist[i]) < 0)
if ((x -= gu.urole.attrdist[i]) < 0)
break;
if (i >= A_MAX || ABASE(i) <= ATTRMIN(i)) {
tryct++;
@@ -848,7 +848,7 @@ is_innate(int propidx)
ignore innateness if equipment is going to claim responsibility */
&& !u.uprops[propidx].extrinsic)
return FROM_ROLE;
if (propidx == BLINDED && !haseyes(g.youmonst.data))
if (propidx == BLINDED && !haseyes(gy.youmonst.data))
return FROM_FORM;
return FROM_NONE;
}
@@ -1026,30 +1026,30 @@ newhp(void)
if (u.ulevel == 0) {
/* Initialize hit points */
hp = g.urole.hpadv.infix + g.urace.hpadv.infix;
if (g.urole.hpadv.inrnd > 0)
hp += rnd(g.urole.hpadv.inrnd);
if (g.urace.hpadv.inrnd > 0)
hp += rnd(g.urace.hpadv.inrnd);
if (g.moves <= 1L) { /* initial hero; skip for polyself to new man */
hp = gu.urole.hpadv.infix + gu.urace.hpadv.infix;
if (gu.urole.hpadv.inrnd > 0)
hp += rnd(gu.urole.hpadv.inrnd);
if (gu.urace.hpadv.inrnd > 0)
hp += rnd(gu.urace.hpadv.inrnd);
if (gm.moves <= 1L) { /* initial hero; skip for polyself to new man */
/* Initialize alignment stuff */
u.ualign.type = aligns[flags.initalign].value;
u.ualign.record = g.urole.initrecord;
u.ualign.record = gu.urole.initrecord;
}
/* no Con adjustment for initial hit points */
} else {
if (u.ulevel < g.urole.xlev) {
hp = g.urole.hpadv.lofix + g.urace.hpadv.lofix;
if (g.urole.hpadv.lornd > 0)
hp += rnd(g.urole.hpadv.lornd);
if (g.urace.hpadv.lornd > 0)
hp += rnd(g.urace.hpadv.lornd);
if (u.ulevel < gu.urole.xlev) {
hp = gu.urole.hpadv.lofix + gu.urace.hpadv.lofix;
if (gu.urole.hpadv.lornd > 0)
hp += rnd(gu.urole.hpadv.lornd);
if (gu.urace.hpadv.lornd > 0)
hp += rnd(gu.urace.hpadv.lornd);
} else {
hp = g.urole.hpadv.hifix + g.urace.hpadv.hifix;
if (g.urole.hpadv.hirnd > 0)
hp += rnd(g.urole.hpadv.hirnd);
if (g.urace.hpadv.hirnd > 0)
hp += rnd(g.urace.hpadv.hirnd);
hp = gu.urole.hpadv.hifix + gu.urace.hpadv.hifix;
if (gu.urole.hpadv.hirnd > 0)
hp += rnd(gu.urole.hpadv.hirnd);
if (gu.urace.hpadv.hirnd > 0)
hp += rnd(gu.urace.hpadv.hirnd);
}
if (ACURR(A_CON) <= 3)
conplus = -2;
@@ -1102,10 +1102,10 @@ setuhpmax(int newmax)
u.uhpmax = newmax;
if (u.uhpmax > u.uhppeak)
u.uhppeak = u.uhpmax;
g.context.botl = TRUE;
gc.context.botl = TRUE;
}
if (u.uhp > u.uhpmax)
u.uhp = u.uhpmax, g.context.botl = TRUE;
u.uhp = u.uhpmax, gc.context.botl = TRUE;
}
schar
@@ -1124,7 +1124,7 @@ acurr(int x)
#endif
} else if (x == A_CHA) {
if (tmp < 18
&& (g.youmonst.data->mlet == S_NYMPH
&& (gy.youmonst.data->mlet == S_NYMPH
|| u.umonnum == PM_AMOROUS_DEMON))
return (schar) 18;
} else if (x == A_CON) {
@@ -1216,7 +1216,7 @@ uchangealign(int newalign,
u.ublessed = 0; /* lose divine protection */
/* You/Your/pline message with call flush_screen(), triggering bot(),
so the actual data change needs to come before the message */
g.context.botl = TRUE; /* status line needs updating */
gc.context.botl = TRUE; /* status line needs updating */
if (reason == 0) {
/* conversion via altar */
livelog_printf(LL_ALIGNMENT, "permanently converted to %s",
+4 -4
View File
@@ -356,7 +356,7 @@ bc_order(void)
|| u.uswallow)
return BCPOS_DIFFER;
for (obj = g.level.objects[uball->ox][uball->oy]; obj;
for (obj = gl.level.objects[uball->ox][uball->oy]; obj;
obj = obj->nexthere) {
if (obj == uchain)
return BCPOS_CHAIN;
@@ -771,7 +771,7 @@ drag_ball(coordxy x, coordxy y, int *bc_control,
if (near_capacity() > SLT_ENCUMBER && dist2(x, y, u.ux, u.uy) <= 2) {
You("cannot %sdrag the heavy iron ball.",
g.invent ? "carry all that and also " : "");
gi.invent ? "carry all that and also " : "");
nomul(0);
return FALSE;
}
@@ -936,7 +936,7 @@ drop_ball(coordxy x, coordxy y)
u.ux = x - u.dx;
u.uy = y - u.dy;
}
g.vision_full_recalc = 1; /* hero has moved, recalculate vision later */
gv.vision_full_recalc = 1; /* hero has moved, recalculate vision later */
if (Blind) {
/* drop glyph under the chain */
@@ -966,7 +966,7 @@ litter(void)
struct obj *otmp, *nextobj = 0;
int capacity = weight_cap();
for (otmp = g.invent; otmp; otmp = nextobj) {
for (otmp = gi.invent; otmp; otmp = nextobj) {
nextobj = otmp->nobj;
if (otmp != uball && rnd(capacity) <= (int) otmp->owt) {
if (canletgo(otmp, "")) {
+32 -32
View File
@@ -17,11 +17,11 @@ no_bones_level(d_level *lev)
{
s_level *sptr;
if (ledger_no(&g.save_dlevel))
assign_level(lev, &g.save_dlevel);
if (ledger_no(&gs.save_dlevel))
assign_level(lev, &gs.save_dlevel);
return (boolean) (((sptr = Is_special(lev)) != 0 && !sptr->boneid)
|| !g.dungeons[lev->dnum].boneid
|| !gd.dungeons[lev->dnum].boneid
/* no bones on the last or multiway branch levels
in any dungeon (level 1 isn't multiway) */
|| Is_botlevel(lev)
@@ -93,7 +93,7 @@ resetobjs(struct obj *ochain, boolean restore)
result depends upon hero's location */
&& inside_shop(ox, oy)
&& *(p = in_rooms(ox, oy, SHOPBASE))
&& tended_shop(&g.rooms[*p - ROOMOFFSET]));
&& tended_shop(&gr.rooms[*p - ROOMOFFSET]));
}
} else { /* saving */
/* do not zero out o_ids for ghost levels anymore */
@@ -268,7 +268,7 @@ drop_upon_death(
/* all inventory is dropped (for the normal case), even non-droppable
things like worn armor and accessories, welded weapon, or cursed
loadstones */
while ((otmp = g.invent) != 0) {
while ((otmp = gi.invent) != 0) {
obj_extract_self(otmp);
/* when turning into green slime, all gear remains held;
other types "arise from the dead" do aren't holding
@@ -316,7 +316,7 @@ fixuporacle(struct monst *oracle)
oracle->mpeaceful = 1; /* for behavior toward next character */
o_ridx = levl[oracle->mx][oracle->my].roomno - ROOMOFFSET;
if (o_ridx >= 0 && g.rooms[o_ridx].rtype == DELPHI)
if (o_ridx >= 0 && gr.rooms[o_ridx].rtype == DELPHI)
return TRUE; /* no fixup needed */
/*
@@ -327,14 +327,14 @@ fixuporacle(struct monst *oracle)
*/
/* find original delphi chamber; should always succeed */
for (ridx = 0; ridx < SIZE(g.rooms); ++ridx)
if (g.rooms[ridx].orig_rtype == DELPHI)
for (ridx = 0; ridx < SIZE(gr.rooms); ++ridx)
if (gr.rooms[ridx].orig_rtype == DELPHI)
break;
if (o_ridx != ridx && ridx < SIZE(g.rooms)) {
if (o_ridx != ridx && ridx < SIZE(gr.rooms)) {
/* room found and she's not not in it, so try to move her there */
cc.x = (g.rooms[ridx].lx + g.rooms[ridx].hx) / 2;
cc.y = (g.rooms[ridx].ly + g.rooms[ridx].hy) / 2;
cc.x = (gr.rooms[ridx].lx + gr.rooms[ridx].hx) / 2;
cc.y = (gr.rooms[ridx].ly + gr.rooms[ridx].hy) / 2;
if (enexto(&cc, cc.x, cc.y, oracle->data)) {
rloc_to(oracle, cc.x, cc.y);
o_ridx = levl[oracle->mx][oracle->my].roomno - ROOMOFFSET;
@@ -344,7 +344,7 @@ fixuporacle(struct monst *oracle)
same as used to happen before this fixup was introduced] */
}
if (ridx == o_ridx) /* if she's in her room, mark it as such */
g.rooms[ridx].rtype = DELPHI;
gr.rooms[ridx].rtype = DELPHI;
return TRUE; /* keep oracle in new bones file */
}
@@ -365,7 +365,7 @@ can_make_bones(void)
}
if (!Is_branchlev(&u.uz)) {
/* no bones on non-branches with portals */
for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap)
for (ttmp = gf.ftrap; ttmp; ttmp = ttmp->ntrap)
if (ttmp->ttyp == MAGIC_PORTAL)
return FALSE;
}
@@ -445,7 +445,7 @@ savebones(int how, time_t when, struct obj *corpse)
/* mark all named fruits as nonexistent; if/when we come to instances
of any of them we'll mark those as existing (using goodfruit()) */
for (f = g.ffruit; f; f = f->nextf)
for (f = gf.ffruit; f; f = f->nextf)
f->fid = -f->fid;
/* dispose of your possessions, usually cursed */
@@ -453,7 +453,7 @@ savebones(int how, time_t when, struct obj *corpse)
struct obj *otmp;
/* embed your possessions in your statue */
otmp = mk_named_object(STATUE, &mons[u.umonnum], u.ux, u.uy, g.plname);
otmp = mk_named_object(STATUE, &mons[u.umonnum], u.ux, u.uy, gp.plname);
drop_upon_death((struct monst *) 0, otmp, u.ux, u.uy);
if (!otmp)
@@ -465,25 +465,25 @@ savebones(int how, time_t when, struct obj *corpse)
/* trick makemon() into allowing monster creation
* on your location
*/
g.in_mklev = TRUE;
gi.in_mklev = TRUE;
mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, MM_NONAME);
g.in_mklev = FALSE;
gi.in_mklev = FALSE;
if (!mtmp)
return;
mtmp = christen_monst(mtmp, g.plname);
mtmp = christen_monst(mtmp, gp.plname);
if (corpse)
(void) obj_attach_mid(corpse, mtmp->m_id);
} else {
/* give your possessions to the monster you become */
g.in_mklev = TRUE; /* use <u.ux,u.uy> as-is */
gi.in_mklev = TRUE; /* use <u.ux,u.uy> as-is */
mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT);
g.in_mklev = FALSE;
gi.in_mklev = FALSE;
if (!mtmp) { /* arise-type might have been genocided */
drop_upon_death((struct monst *) 0, (struct obj *) 0, u.ux, u.uy);
u.ugrave_arise = NON_PM; /* in case caller cares */
return;
}
mtmp = christen_monst(mtmp, g.plname);
mtmp = christen_monst(mtmp, gp.plname);
newsym(u.ux, u.uy);
/* ["Your body rises from the dead as an <mname>..." used
to be given here, but it has been moved to done() so that
@@ -508,12 +508,12 @@ savebones(int how, time_t when, struct obj *corpse)
if (mtmp->mtame)
mtmp->mtame = mtmp->mpeaceful = 0;
}
for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) {
for (ttmp = gf.ftrap; ttmp; ttmp = ttmp->ntrap) {
ttmp->madeby_u = 0;
ttmp->tseen = unhideable_trap(ttmp->ttyp);
}
resetobjs(fobj, FALSE);
resetobjs(g.level.buriedobjlist, FALSE);
resetobjs(gl.level.buriedobjlist, FALSE);
/* Hero is no longer on the map. */
u.ux0 = u.ux, u.uy0 = u.uy;
@@ -525,7 +525,7 @@ savebones(int how, time_t when, struct obj *corpse)
levl[x][y].seenv = 0;
levl[x][y].waslit = 0;
levl[x][y].glyph = GLYPH_UNEXPLORED;
g.lastseentyp[x][y] = 0;
gl.lastseentyp[x][y] = 0;
}
/* Attach bones info to the current level before saving. */
@@ -537,8 +537,8 @@ savebones(int how, time_t when, struct obj *corpse)
gender and alignment reflect final values rather than what the
character started out as, same as topten and logfile entries */
Sprintf(newbones->who, "%s-%.3s-%.3s-%.3s-%.3s",
g.plname, g.urole.filecode,
g.urace.filecode, genders[flags.female].filecode,
gp.plname, gu.urole.filecode,
gu.urace.filecode, genders[flags.female].filecode,
aligns[1 - u.ualign.type].filecode);
formatkiller(newbones->how, sizeof newbones->how, how, TRUE);
Strcpy(newbones->when, yyyymmddhhmmss(when));
@@ -547,13 +547,13 @@ savebones(int how, time_t when, struct obj *corpse)
newbones->bonesknown = FALSE;
/* if current character died on a bones level, the cemetery list
will have multiple entries, most recent (this dead hero) first */
newbones->next = g.level.bonesinfo;
g.level.bonesinfo = newbones;
newbones->next = gl.level.bonesinfo;
gl.level.bonesinfo = newbones;
/* flag these bones if they are being created in wizard mode;
they might already be flagged as such, even when we're playing
in normal mode, if this level came from a previous bones file */
if (wizard)
g.level.flags.wizard_bones = 1;
gl.level.flags.wizard_bones = 1;
nhfp = create_bonesfile(&u.uz, &bonesid, whynot);
if (!nhfp) {
@@ -613,7 +613,7 @@ getbones(void)
return 0;
}
if (validate(nhfp, g.bones) != 0) {
if (validate(nhfp, gb.bones) != 0) {
if (!wizard)
pline("Discarding unusable bones; no need to panic...");
ok = FALSE;
@@ -670,7 +670,7 @@ getbones(void)
resetobjs(mtmp->minvent, TRUE);
}
resetobjs(fobj, TRUE);
resetobjs(g.level.buriedobjlist, TRUE);
resetobjs(gl.level.buriedobjlist, TRUE);
fix_shop_damage();
}
}
@@ -711,7 +711,7 @@ bones_include_name(const char *name)
Strcat(buf, "-");
len = strlen(buf);
for (bp = g.level.bonesinfo; bp; bp = bp->next) {
for (bp = gl.level.bonesinfo; bp; bp = bp->next) {
if (!strncmp(bp->who, buf, len))
return TRUE;
}
+211 -211
View File
File diff suppressed because it is too large Load Diff
+325 -325
View File
File diff suppressed because it is too large Load Diff
+38 -38
View File
@@ -284,15 +284,15 @@ e_at(coordxy x, coordxy y)
int entitycnt;
for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++)
if ((g.occupants[entitycnt].edata) && (g.occupants[entitycnt].ex == x)
&& (g.occupants[entitycnt].ey == y))
if ((go.occupants[entitycnt].edata) && (go.occupants[entitycnt].ex == x)
&& (go.occupants[entitycnt].ey == y))
break;
debugpline1("entitycnt = %d", entitycnt);
#ifdef D_DEBUG
wait_synch();
#endif
return (entitycnt == ENTITIES) ? (struct entity *) 0
: &(g.occupants[entitycnt]);
: &(go.occupants[entitycnt]);
}
static void
@@ -313,10 +313,10 @@ m_to_e(struct monst *mtmp, coordxy x, coordxy y, struct entity *etmp)
static void
u_to_e(struct entity *etmp)
{
etmp->emon = &g.youmonst;
etmp->emon = &gy.youmonst;
etmp->ex = u.ux;
etmp->ey = u.uy;
etmp->edata = g.youmonst.data;
etmp->edata = gy.youmonst.data;
}
static void
@@ -330,7 +330,7 @@ set_entity(coordxy x, coordxy y, struct entity *etmp)
etmp->edata = (struct permonst *) 0;
}
#define is_u(etmp) (etmp->emon == &g.youmonst)
#define is_u(etmp) (etmp->emon == &gy.youmonst)
#define e_canseemon(etmp) \
(is_u(etmp) ? (boolean) TRUE : canseemon(etmp->emon))
@@ -397,18 +397,18 @@ e_died(struct entity *etmp, int xkill_flags, int how)
{
if (is_u(etmp)) {
if (how == DROWNING) {
g.killer.name[0] = 0; /* drown() sets its own killer */
gk.killer.name[0] = 0; /* drown() sets its own killer */
(void) drown();
} else if (how == BURNING) {
g.killer.name[0] = 0; /* lava_effects() sets own killer */
gk.killer.name[0] = 0; /* lava_effects() sets own killer */
(void) lava_effects();
} else {
coord xy;
/* use more specific killer if specified */
if (!g.killer.name[0]) {
g.killer.format = KILLED_BY_AN;
Strcpy(g.killer.name, "falling drawbridge");
if (!gk.killer.name[0]) {
gk.killer.format = KILLED_BY_AN;
Strcpy(gk.killer.name, "falling drawbridge");
}
done(how);
/* So, you didn't die */
@@ -428,12 +428,12 @@ e_died(struct entity *etmp, int xkill_flags, int how)
} else {
int entitycnt;
g.killer.name[0] = 0;
gk.killer.name[0] = 0;
/* fake "digested to death" damage-type suppresses corpse */
#define mk_message(dest) (((dest & XKILL_NOMSG) != 0) ? (char *) 0 : "")
#define mk_corpse(dest) (((dest & XKILL_NOCORPSE) != 0) ? AD_DGST : AD_PHYS)
/* if monsters are moving, one of them caused the destruction */
if (g.context.mon_moving)
if (gc.context.mon_moving)
monkilled(etmp->emon,
mk_message(xkill_flags), mk_corpse(xkill_flags));
else /* you caused it */
@@ -442,9 +442,9 @@ e_died(struct entity *etmp, int xkill_flags, int how)
/* dead long worm handling */
for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++) {
if (etmp != &(g.occupants[entitycnt])
&& etmp->emon == g.occupants[entitycnt].emon)
g.occupants[entitycnt].edata = (struct permonst *) 0;
if (etmp != &(go.occupants[entitycnt])
&& etmp->emon == go.occupants[entitycnt].emon)
go.occupants[entitycnt].edata = (struct permonst *) 0;
}
#undef mk_message
#undef mk_corpse
@@ -566,8 +566,8 @@ do_entity(struct entity *etmp)
} else {
if (crm->typ == DRAWBRIDGE_DOWN) {
if (is_u(etmp)) {
g.killer.format = NO_KILLER_PREFIX;
Strcpy(g.killer.name,
gk.killer.format = NO_KILLER_PREFIX;
Strcpy(gk.killer.name,
"crushed to death underneath a drawbridge");
}
pline("%s crushed underneath the drawbridge.",
@@ -684,8 +684,8 @@ do_entity(struct entity *etmp)
E_phrase(etmp, "disappear"));
}
if (!e_survives_at(etmp, etmp->ex, etmp->ey)) {
g.killer.format = KILLED_BY_AN;
Strcpy(g.killer.name, "closing drawbridge");
gk.killer.format = KILLED_BY_AN;
Strcpy(gk.killer.name, "closing drawbridge");
e_died(etmp, XKILL_NOMSG, CRUSHING);
return;
}
@@ -715,8 +715,8 @@ do_entity(struct entity *etmp)
pline("%s into the %s.", E_phrase(etmp, "fall"),
lava ? hliquid("lava") : "moat");
}
g.killer.format = NO_KILLER_PREFIX;
Strcpy(g.killer.name, "fell from a drawbridge");
gk.killer.format = NO_KILLER_PREFIX;
Strcpy(gk.killer.name, "fell from a drawbridge");
e_died(etmp, /* CRUSHING is arbitrary */
XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
is_pool(etmp->ex, etmp->ey) ? DROWNING
@@ -727,7 +727,7 @@ do_entity(struct entity *etmp)
}
/* clear stale reason for death before returning */
#define nokiller() (g.killer.name[0] = '\0', g.killer.format = 0)
#define nokiller() (gk.killer.name[0] = '\0', gk.killer.format = 0)
/*
* Close the drawbridge located at x,y
@@ -767,11 +767,11 @@ close_drawbridge(coordxy x, coordxy y)
break;
}
lev2->wall_info = W_NONDIGGABLE;
set_entity(x, y, &(g.occupants[0]));
set_entity(x2, y2, &(g.occupants[1]));
do_entity(&(g.occupants[0])); /* Do set_entity after first */
set_entity(x2, y2, &(g.occupants[1])); /* do_entity for worm tail */
do_entity(&(g.occupants[1]));
set_entity(x, y, &(go.occupants[0]));
set_entity(x2, y2, &(go.occupants[1]));
do_entity(&(go.occupants[0])); /* Do set_entity after first */
set_entity(x2, y2, &(go.occupants[1])); /* do_entity for worm tail */
do_entity(&(go.occupants[1]));
if (OBJ_AT(x, y) && !Deaf)
You_hear("smashing and crushing.");
(void) revive_nasty(x, y, (char *) 0);
@@ -815,11 +815,11 @@ open_drawbridge(coordxy x, coordxy y)
lev2 = &levl[x2][y2];
lev2->typ = DOOR;
lev2->doormask = D_NODOOR;
set_entity(x, y, &(g.occupants[0]));
set_entity(x2, y2, &(g.occupants[1]));
do_entity(&(g.occupants[0])); /* do set_entity after first */
set_entity(x2, y2, &(g.occupants[1])); /* do_entity for worm tails */
do_entity(&(g.occupants[1]));
set_entity(x, y, &(go.occupants[0]));
set_entity(x2, y2, &(go.occupants[1]));
do_entity(&(go.occupants[0])); /* do set_entity after first */
set_entity(x2, y2, &(go.occupants[1])); /* do_entity for worm tails */
do_entity(&(go.occupants[1]));
(void) revive_nasty(x, y, (char *) 0);
delallobj(x, y);
if ((t = t_at(x, y)) != 0)
@@ -848,7 +848,7 @@ destroy_drawbridge(coordxy x, coordxy y)
coordxy x2, y2;
int i;
boolean e_inview;
struct entity *etmp1 = &(g.occupants[0]), *etmp2 = &(g.occupants[1]);
struct entity *etmp1 = &(go.occupants[0]), *etmp2 = &(go.occupants[1]);
lev1 = &levl[x][y];
if (!IS_DRAWBRIDGE(lev1->typ))
@@ -922,8 +922,8 @@ destroy_drawbridge(coordxy x, coordxy y)
if (e_inview)
pline("%s blown apart by flying debris.",
E_phrase(etmp2, "are"));
g.killer.format = KILLED_BY_AN;
Strcpy(g.killer.name, "exploding drawbridge");
gk.killer.format = KILLED_BY_AN;
Strcpy(gk.killer.name, "exploding drawbridge");
e_died(etmp2,
XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
CRUSHING); /*no corpse*/
@@ -954,8 +954,8 @@ destroy_drawbridge(coordxy x, coordxy y)
debugpline1("%s from shrapnel", E_phrase(etmp1, "die"));
}
}
g.killer.format = KILLED_BY_AN;
Strcpy(g.killer.name, "collapsing drawbridge");
gk.killer.format = KILLED_BY_AN;
Strcpy(gk.killer.name, "collapsing drawbridge");
e_died(etmp1,
XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
CRUSHING); /*no corpse*/
+733 -470
View File
File diff suppressed because it is too large Load Diff
+56 -56
View File
@@ -146,7 +146,7 @@ trapped_chest_at(int ttyp, coordxy x, coordxy y)
return TRUE;
/* in inventory, we need to find one which is actually trapped */
if (u_at(x, y)) {
for (otmp = g.invent; otmp; otmp = otmp->nobj)
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if (Is_box(otmp) && otmp->otrapped)
return TRUE;
if (u.usteed) { /* steed isn't on map so won't be found by m_at() */
@@ -255,13 +255,13 @@ check_map_spot(coordxy x, coordxy y, char oclass, unsigned material)
if (glyph_is_object(glyph)) {
/* there's some object shown here */
if (oclass == ALL_CLASSES) {
return !(g.level.objects[x][y] /* stale if nothing here */
return !(gl.level.objects[x][y] /* stale if nothing here */
|| ((mtmp = m_at(x, y)) != 0 && mtmp->minvent));
} else {
if (material
&& objects[glyph_to_obj(glyph)].oc_material == material) {
/* object shown here is of interest because material matches */
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (o_material(otmp, GOLD))
return FALSE;
/* didn't find it; perhaps a monster is carrying it */
@@ -275,7 +275,7 @@ check_map_spot(coordxy x, coordxy y, char oclass, unsigned material)
}
if (oclass && objects[glyph_to_obj(glyph)].oc_class == oclass) {
/* obj shown here is of interest because its class matches */
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (o_in(otmp, oclass))
return FALSE;
/* didn't find it; perhaps a monster is carrying it */
@@ -324,7 +324,7 @@ gold_detect(struct obj *sobj)
boolean stale, ugold = FALSE, steedgold = FALSE;
int ter_typ = TER_DETECT | TER_OBJ;
g.known = stale = clear_stale_map(COIN_CLASS,
gk.known = stale = clear_stale_map(COIN_CLASS,
(unsigned) (sobj->blessed ? GOLD : 0));
/* look for gold carried by monsters (might be in a container) */
@@ -335,7 +335,7 @@ gold_detect(struct obj *sobj)
if (mtmp == u.usteed) {
steedgold = TRUE;
} else {
g.known = TRUE;
gk.known = TRUE;
goto outgoldmap; /* skip further searching */
}
} else {
@@ -345,7 +345,7 @@ gold_detect(struct obj *sobj)
if (mtmp == u.usteed) {
steedgold = TRUE;
} else {
g.known = TRUE;
gk.known = TRUE;
goto outgoldmap; /* skip further searching */
}
}
@@ -355,25 +355,25 @@ gold_detect(struct obj *sobj)
/* look for gold objects */
for (obj = fobj; obj; obj = obj->nobj) {
if (sobj->blessed && o_material(obj, GOLD)) {
g.known = TRUE;
gk.known = TRUE;
if (obj->ox != u.ux || obj->oy != u.uy)
goto outgoldmap;
} else if (o_in(obj, COIN_CLASS)) {
g.known = TRUE;
gk.known = TRUE;
if (obj->ox != u.ux || obj->oy != u.uy)
goto outgoldmap;
}
}
if (!g.known) {
if (!gk.known) {
/* no gold found on floor or monster's inventory.
adjust message if you have gold in your inventory */
if (sobj) {
char buf[BUFSZ];
if (g.youmonst.data == &mons[PM_GOLD_GOLEM])
if (gy.youmonst.data == &mons[PM_GOLD_GOLEM])
Sprintf(buf, "You feel like a million %s!", currency(2L));
else if (money_cnt(g.invent) || hidden_gold(TRUE))
else if (money_cnt(gi.invent) || hidden_gold(TRUE))
Strcpy(buf,
"You feel worried about your future financial situation.");
else if (steedgold)
@@ -496,7 +496,7 @@ food_detect(struct obj *sobj)
}
if (!ct && !ctu) {
g.known = stale && !confused;
gk.known = stale && !confused;
if (stale) {
docrt();
You("sense a lack of %s nearby.", what);
@@ -524,7 +524,7 @@ food_detect(struct obj *sobj)
}
return !stale;
} else if (!ct) {
g.known = TRUE;
gk.known = TRUE;
You("%s %s nearby.", sobj ? "smell" : "sense", what);
if (sobj && sobj->blessed) {
if (!u.uedibility)
@@ -535,7 +535,7 @@ food_detect(struct obj *sobj)
struct obj *temp;
int ter_typ = TER_DETECT | TER_OBJ;
g.known = TRUE;
gk.known = TRUE;
cls();
(void) unconstrain_map();
for (obj = fobj; obj; obj = obj->nobj)
@@ -612,7 +612,7 @@ object_detect(struct obj *detector, /* object doing the detecting */
* We can exclude checking the buried obj chain for boulders below.
*/
sym = class ? def_oc_syms[class].sym : 0;
if (sym && sym == g.showsyms[SYM_BOULDER + SYM_OFF_X])
if (sym && sym == gs.showsyms[SYM_BOULDER + SYM_OFF_X])
boulder = ROCK_CLASS;
if (Hallucination || (Confusion && class == SCROLL_CLASS))
@@ -623,7 +623,7 @@ object_detect(struct obj *detector, /* object doing the detecting */
Strcat(stuff, " and/or large stones");
if (do_dknown)
for (obj = g.invent; obj; obj = obj->nobj)
for (obj = gi.invent; obj; obj = obj->nobj)
do_dknown_of(obj);
for (obj = fobj; obj; obj = obj->nobj) {
@@ -637,7 +637,7 @@ object_detect(struct obj *detector, /* object doing the detecting */
do_dknown_of(obj);
}
for (obj = g.level.buriedobjlist; obj; obj = obj->nobj) {
for (obj = gl.level.buriedobjlist; obj; obj = obj->nobj) {
if (!class || o_in(obj, class)) {
if (u_at(obj->ox, obj->oy))
ctu++;
@@ -685,7 +685,7 @@ object_detect(struct obj *detector, /* object doing the detecting */
/*
* Map all buried objects first.
*/
for (obj = g.level.buriedobjlist; obj; obj = obj->nobj)
for (obj = gl.level.buriedobjlist; obj; obj = obj->nobj)
if (!class || (otmp = o_in(obj, class)) != 0) {
if (class) {
if (otmp != obj) {
@@ -706,7 +706,7 @@ object_detect(struct obj *detector, /* object doing the detecting */
*/
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
for (obj = g.level.objects[x][y]; obj; obj = obj->nexthere)
for (obj = gl.level.objects[x][y]; obj; obj = obj->nexthere)
if ((!class && !boulder) || (otmp = o_in(obj, class)) != 0
|| (otmp = o_in(obj, boulder)) != 0) {
if (class || boulder) {
@@ -933,20 +933,20 @@ display_trap_map(struct trap *ttmp, int cursed_src)
/* show chest traps first, so that subsequent floor trap display
will override if both types are present at the same location */
(void) detect_obj_traps(fobj, TRUE, cursed_src);
(void) detect_obj_traps(g.level.buriedobjlist, TRUE, cursed_src);
(void) detect_obj_traps(gl.level.buriedobjlist, TRUE, cursed_src);
for (mon = fmon; mon; mon = mon->nmon) {
if (DEADMONSTER(mon) || (mon->isgd && !mon->mx))
continue;
(void) detect_obj_traps(mon->minvent, TRUE, cursed_src);
}
(void) detect_obj_traps(g.invent, TRUE, cursed_src);
(void) detect_obj_traps(gi.invent, TRUE, cursed_src);
for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap)
for (ttmp = gf.ftrap; ttmp; ttmp = ttmp->ntrap)
sense_trap(ttmp, 0, 0, cursed_src);
dummytrap.ttyp = TRAPPED_DOOR;
for (door = 0; door < g.doorindex; door++) {
cc = g.doors[door];
for (door = 0; door < gd.doorindex; door++) {
cc = gd.doors[door];
if (levl[cc.x][cc.y].typ == SDOOR) /* see above */
continue;
if (levl[cc.x][cc.y].doormask & D_TRAPPED) {
@@ -988,7 +988,7 @@ trap_detect(struct obj *sobj) /* null if crystal ball,
u.usteed->mx = u.ux, u.usteed->my = u.uy;
/* floor/ceiling traps */
for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) {
for (ttmp = gf.ftrap; ttmp; ttmp = ttmp->ntrap) {
if (ttmp->tx != u.ux || ttmp->ty != u.uy) {
display_trap_map(ttmp, cursed_src);
return 0;
@@ -1003,7 +1003,7 @@ trap_detect(struct obj *sobj) /* null if crystal ball,
} else
found = TRUE;
}
if ((tr = detect_obj_traps(g.level.buriedobjlist, FALSE, 0))
if ((tr = detect_obj_traps(gl.level.buriedobjlist, FALSE, 0))
!= OTRAP_NONE) {
if (tr & OTRAP_THERE) {
display_trap_map(ttmp, cursed_src);
@@ -1022,11 +1022,11 @@ trap_detect(struct obj *sobj) /* null if crystal ball,
found = TRUE;
}
}
if (detect_obj_traps(g.invent, FALSE, 0) != OTRAP_NONE)
if (detect_obj_traps(gi.invent, FALSE, 0) != OTRAP_NONE)
found = TRUE;
/* door traps */
for (door = 0; door < g.doorindex; door++) {
cc = g.doors[door];
for (door = 0; door < gd.doorindex; door++) {
cc = gd.doors[door];
/* levl[][].doormask and .wall_info both overlay levl[][].flags;
the bit in doormask for D_TRAPPED is also a bit in wall_info;
secret doors use wall_info so can't be marked as trapped */
@@ -1183,7 +1183,7 @@ use_crystal_ball(struct obj **optr)
make_confused((HConfusion & TIMEOUT) + impair, FALSE);
break;
case 3:
if (!resists_blnd(&g.youmonst)) {
if (!resists_blnd(&gy.youmonst)) {
pline("%s your vision!", Tobjnam(obj, "damage"));
make_blinded((Blinded & TIMEOUT) + impair, FALSE);
if (!Blind)
@@ -1214,8 +1214,8 @@ use_crystal_ball(struct obj **optr)
if (Hallucination) {
nomul(-rnd(charged ? 4 : 2));
g.multi_reason = "gazing into a Magic 8-Ball (tm)";
g.nomovemsg = "";
gm.multi_reason = "gazing into a Magic 8-Ball (tm)";
gn.nomovemsg = "";
if (!charged) {
pline("All you see is funky %s haze.", hcolor((char *) 0));
@@ -1267,8 +1267,8 @@ use_crystal_ball(struct obj **optr)
You("peer into %s...", the(xname(obj)));
nomul(-rnd(charged ? 10 : 2));
g.multi_reason = "gazing into a crystal ball";
g.nomovemsg = "";
gm.multi_reason = "gazing into a crystal ball";
gn.nomovemsg = "";
if (!charged) {
pline_The("vision is unclear.");
@@ -1301,8 +1301,8 @@ use_crystal_ball(struct obj **optr)
ret = object_detect((struct obj *) 0, class);
} else if ((class = def_char_to_monclass(ch)) != MAXMCLASSES) {
ret = monster_detect((struct obj *) 0, class);
} else if (g.showsyms[SYM_BOULDER + SYM_OFF_X]
&& (ch == g.showsyms[SYM_BOULDER + SYM_OFF_X])) {
} else if (gs.showsyms[SYM_BOULDER + SYM_OFF_X]
&& (ch == gs.showsyms[SYM_BOULDER + SYM_OFF_X])) {
ret = object_detect((struct obj *) 0, ROCK_CLASS);
} else if (ch == '^') {
ret = trap_detect((struct obj *) 0);
@@ -1350,7 +1350,7 @@ show_map_spot(coordxy x, coordxy y)
* opposite to how normal vision behaves.
*/
oldglyph = glyph_at(x, y);
if (g.level.flags.hero_memory) {
if (gl.level.flags.hero_memory) {
magic_map_background(x, y, 0);
newsym(x, y); /* show it, if not blocked */
} else {
@@ -1361,7 +1361,7 @@ show_map_spot(coordxy x, coordxy y)
map_trap(t, 1);
} else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) {
show_glyph(x, y, oldglyph);
if (g.level.flags.hero_memory)
if (gl.level.flags.hero_memory)
lev->glyph = oldglyph;
}
}
@@ -1378,7 +1378,7 @@ do_mapping(void)
for (zy = 0; zy < ROWNO; zy++)
show_map_spot(zx, zy);
if (!g.level.flags.hero_memory || unconstrained) {
if (!gl.level.flags.hero_memory || unconstrained) {
flush_screen(1); /* flush temp screen */
/* browse_map() instead of display_nhwindow(WIN_MAP, TRUE) */
browse_map(TER_DETECT | TER_MAP | TER_TRP | TER_OBJ,
@@ -1437,9 +1437,9 @@ do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */
*/
/* if hero is engulfed, show engulfer at <u.ux,u.uy> */
save_viz_uyux = g.viz_array[u.uy][u.ux];
save_viz_uyux = gv.viz_array[u.uy][u.ux];
if (u.uswallow)
g.viz_array[u.uy][u.ux] |= IN_SIGHT; /* <x,y> are reversed to [y][x] */
gv.viz_array[u.uy][u.ux] |= IN_SIGHT; /* <x,y> are reversed to [y][x] */
save_EDetect_mons = EDetect_monsters;
/* for skilled spell, getpos() scanning of the map will display all
monsters within range; otherwise, "unseen creature" will be shown */
@@ -1454,7 +1454,7 @@ do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */
if (OBJ_AT(zx, zy)) {
/* not vobj_at(); this is not vision-based access;
unlike object detection, we don't notice buried items */
otmp = g.level.objects[zx][zy];
otmp = gl.level.objects[zx][zy];
if (extended)
otmp->dknown = 1;
map_object(otmp, TRUE);
@@ -1471,7 +1471,7 @@ do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */
the map and we're not doing extended/blessed clairvoyance
(hence must be swallowed or underwater), show "unseen
creature" unless map already displayed a monster here */
if ((unconstrained || !g.level.flags.hero_memory)
if ((unconstrained || !gl.level.flags.hero_memory)
&& !extended && (zx != u.ux || zy != u.uy)
&& !glyph_is_monster(oldglyph))
map_invisible(zx, zy);
@@ -1494,7 +1494,7 @@ do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */
if (random_farsight && flags.quick_farsight)
mdetected = odetected = FALSE;
if (!g.level.flags.hero_memory || unconstrained
if (!gl.level.flags.hero_memory || unconstrained
|| mdetected || odetected) {
flush_screen(1); /* flush temp screen */
/* the getpos() prompt from browse_map() is only shown when
@@ -1508,7 +1508,7 @@ do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */
}
reconstrain_map();
EDetect_monsters = save_EDetect_mons;
g.viz_array[u.uy][u.ux] = save_viz_uyux;
gv.viz_array[u.uy][u.ux] = save_viz_uyux;
/* replace monsters with remembered,unseen monster, then run
see_monsters() to update visible ones and warned-of ones */
@@ -1621,7 +1621,7 @@ openone(coordxy zx, coordxy zy, genericptr_t num)
int *num_p = (int *) num;
if (OBJ_AT(zx, zy)) {
for (otmp = g.level.objects[zx][zy]; otmp; otmp = otmp->nexthere) {
for (otmp = gl.level.objects[zx][zy]; otmp; otmp = otmp->nexthere) {
if (Is_box(otmp) && otmp->olocked) {
otmp->olocked = 0;
(*num_p)++;
@@ -1664,7 +1664,7 @@ openone(coordxy zx, coordxy zy, genericptr_t num)
newsym(zx, zy);
(*num_p)++;
}
mon = u_at(zx, zy) ? &g.youmonst : m_at(zx, zy);
mon = u_at(zx, zy) ? &gy.youmonst : m_at(zx, zy);
if (openholdingtrap(mon, &dummy)
|| openfallingtrap(mon, TRUE, &dummy))
(*num_p)++;
@@ -1950,7 +1950,7 @@ dosearch(void)
{
if (cmd_safety_prevention("another search",
"You already found a monster.",
&g.already_found_flag))
&ga.already_found_flag))
return ECMD_OK;
return dosearch0(0) ? ECMD_TIME : ECMD_OK;
}
@@ -1992,7 +1992,7 @@ sokoban_detect(void)
}
/* Map the traps */
for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) {
for (ttmp = gf.ftrap; ttmp; ttmp = ttmp->ntrap) {
ttmp->tseen = 1;
map_trap(ttmp, 1);
/* set sokoban_rules when there is at least one pit or hole */
@@ -2016,14 +2016,14 @@ reveal_terrain_getglyph(coordxy x, coordxy y, int full, unsigned swallowed,
/* for 'full', show the actual terrain for the entire level,
otherwise what the hero remembers for seen locations with
monsters, objects, and/or traps removed as caller dictates */
seenv = (full || g.level.flags.hero_memory)
seenv = (full || gl.level.flags.hero_memory)
? levl[x][y].seenv : cansee(x, y) ? SVALL : 0;
if (full) {
levl[x][y].seenv = SVALL;
glyph = back_to_glyph(x, y);
levl[x][y].seenv = seenv;
} else {
levl_glyph = g.level.flags.hero_memory
levl_glyph = gl.level.flags.hero_memory
? levl[x][y].glyph
: seenv ? back_to_glyph(x, y): default_glyph;
/* glyph_at() returns the displayed glyph, which might
@@ -2049,7 +2049,7 @@ reveal_terrain_getglyph(coordxy x, coordxy y, int full, unsigned swallowed,
|| glyph_is_invisible(glyph)) {
if (!seenv) {
glyph = default_glyph;
} else if (g.lastseentyp[x][y] == levl[x][y].typ) {
} else if (gl.lastseentyp[x][y] == levl[x][y].typ) {
glyph = back_to_glyph(x, y);
} else {
/* look for a mimic here posing as furniture;
@@ -2067,7 +2067,7 @@ reveal_terrain_getglyph(coordxy x, coordxy y, int full, unsigned swallowed,
but we've got no other choice) */
schar save_typ = levl[x][y].typ;
levl[x][y].typ = g.lastseentyp[x][y];
levl[x][y].typ = gl.lastseentyp[x][y];
glyph = back_to_glyph(x, y);
levl[x][y].typ = save_typ;
}
@@ -2089,7 +2089,7 @@ dump_map(void)
coordxy x, y;
int glyph, skippedrows, lastnonblank;
int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON;
int default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree
int default_glyph = cmap_to_glyph(gl.level.flags.arboreal ? S_tree
: S_stone);
char buf[COLBUFSZ];
boolean blankrow, toprow;
@@ -2161,7 +2161,7 @@ reveal_terrain(
if (unconstrain_map())
docrt();
default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree
default_glyph = cmap_to_glyph(gl.level.flags.arboreal ? S_tree
: S_stone);
for (x = 1; x < COLNO; x++)
+95 -95
View File
@@ -76,7 +76,7 @@ mkcavepos(coordxy x, coordxy y, int dist, boolean waslit, boolean rockit)
lev->waslit = (rockit ? FALSE : TRUE);
lev->horizontal = FALSE;
/* short-circuit vision recalc */
g.viz_array[y][x] = (dist < 3) ? (IN_SIGHT | COULD_SEE) : COULD_SEE;
gv.viz_array[y][x] = (dist < 3) ? (IN_SIGHT | COULD_SEE) : COULD_SEE;
lev->typ = (rockit ? STONE : ROOM); /* flags set via doormask above */
if (dist >= 3)
impossible("mkcavepos called with dist %d", dist);
@@ -130,7 +130,7 @@ mkcavearea(boolean rockit)
newsym(u.ux, u.uy); /* in case player is invisible */
}
g.vision_full_recalc = 1; /* everything changed */
gv.vision_full_recalc = 1; /* everything changed */
}
/* When digging into location <x,y>, what are you actually digging into? */
@@ -154,7 +154,7 @@ dig_typ(struct obj *otmp, coordxy x, coordxy y)
: IS_TREE(levl[x][y].typ)
? (ispick ? DIGTYP_UNDIGGABLE : DIGTYP_TREE)
: (ispick && IS_ROCK(levl[x][y].typ)
&& (!g.level.flags.arboreal
&& (!gl.level.flags.arboreal
|| IS_WALL(levl[x][y].typ)))
? DIGTYP_ROCK
: DIGTYP_UNDIGGABLE);
@@ -163,13 +163,13 @@ dig_typ(struct obj *otmp, coordxy x, coordxy y)
boolean
is_digging(void)
{
if (g.occupation == dig) {
if (go.occupation == dig) {
return TRUE;
}
return FALSE;
}
#define BY_YOU (&g.youmonst)
#define BY_YOU (&gy.youmonst)
#define BY_OBJECT ((struct monst *) 0)
boolean
@@ -231,7 +231,7 @@ static int
dig(void)
{
struct rm *lev;
coordxy dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y;
coordxy dpx = gc.context.digging.pos.x, dpy = gc.context.digging.pos.y;
boolean ispick = uwep && is_pick(uwep);
const char *verb = (!uwep || is_pick(uwep)) ? "dig into" : "chop through";
@@ -239,15 +239,15 @@ dig(void)
/* perhaps a nymph stole your pick-axe while you were busy digging */
/* or perhaps you teleported away */
if (u.uswallow || !uwep || (!ispick && !is_axe(uwep))
|| !on_level(&g.context.digging.level, &u.uz)
|| ((g.context.digging.down ? (dpx != u.ux || dpy != u.uy)
|| !on_level(&gc.context.digging.level, &u.uz)
|| ((gc.context.digging.down ? (dpx != u.ux || dpy != u.uy)
: !next2u(dpx, dpy))))
return 0;
if (g.context.digging.down) {
if (gc.context.digging.down) {
if (!dig_check(BY_YOU, TRUE, u.ux, u.uy))
return 0;
} else { /* !g.context.digging.down */
} else { /* !gc.context.digging.down */
if (IS_TREE(lev->typ) && !may_dig(dpx, dpy)
&& dig_typ(uwep, dpx, dpy) == DIGTYP_TREE) {
pline("This tree seems to be petrified.");
@@ -287,21 +287,21 @@ dig(void)
return 0;
}
g.context.digging.effort +=
gc.context.digging.effort +=
10 + rn2(5) + abon() + uwep->spe - greatest_erosion(uwep) + u.udaminc;
if (Race_if(PM_DWARF))
g.context.digging.effort *= 2;
if (g.context.digging.down) {
gc.context.digging.effort *= 2;
if (gc.context.digging.down) {
struct trap *ttmp = t_at(dpx, dpy);
if (g.context.digging.effort > 250 || (ttmp && ttmp->ttyp == HOLE)) {
if (gc.context.digging.effort > 250 || (ttmp && ttmp->ttyp == HOLE)) {
(void) dighole(FALSE, FALSE, (coord *) 0);
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof g.context.digging);
(void) memset((genericptr_t) &gc.context.digging, 0,
sizeof gc.context.digging);
return 0; /* done with digging */
}
if (g.context.digging.effort <= 50
if (gc.context.digging.effort <= 50
|| (ttmp && (ttmp->ttyp == TRAPDOOR || is_pit(ttmp->ttyp)))) {
return 1;
} else if (ttmp && (ttmp->ttyp == LANDMINE
@@ -310,13 +310,13 @@ dig(void)
hero should have used #untrap first */
dotrap(ttmp, FORCETRAP);
/* restart completely from scratch if we resume digging */
(void) memset((genericptr_t) &g.context.digging, 0,
sizeof g.context.digging);
(void) memset((genericptr_t) &gc.context.digging, 0,
sizeof gc.context.digging);
return 0;
} else if (ttmp && ttmp->ttyp == BEAR_TRAP && u.utrap) {
if (rnl(7) > (Fumbling ? 1 : 4)) {
char kbuf[BUFSZ];
int dmg = dmgval(uwep, &g.youmonst) + dbon();
int dmg = dmgval(uwep, &gy.youmonst) + dbon();
if (dmg < 1)
dmg = 1;
@@ -333,7 +333,7 @@ dig(void)
reset_utrap(TRUE); /* release from trap, maybe Lev or Fly */
}
/* we haven't made any progress toward a pit yet */
g.context.digging.effort = 0;
gc.context.digging.effort = 0;
return 0;
}
@@ -344,13 +344,13 @@ dig(void)
/* make pit at <u.ux,u.uy> */
if (dighole(TRUE, FALSE, (coord *) 0)) {
g.context.digging.level.dnum = 0;
g.context.digging.level.dlevel = -1;
gc.context.digging.level.dnum = 0;
gc.context.digging.level.dlevel = -1;
}
return 0;
}
if (g.context.digging.effort > 100) {
if (gc.context.digging.effort > 100) {
const char *digtxt, *dmgtxt = (const char *) 0;
struct obj *obj;
boolean shopedge = *in_rooms(dpx, dpy, SHOPBASE);
@@ -401,9 +401,9 @@ dig(void)
add_damage(dpx, dpy, SHOP_WALL_DMG);
dmgtxt = "damage";
}
if (g.level.flags.is_maze_lev) {
if (gl.level.flags.is_maze_lev) {
lev->typ = ROOM, lev->flags = 0;
} else if (g.level.flags.is_cavernous_lev && !in_town(dpx, dpy)) {
} else if (gl.level.flags.is_cavernous_lev && !in_town(dpx, dpy)) {
lev->typ = CORR, lev->flags = 0;
} else {
lev->typ = DOOR, lev->doormask = D_NODOOR;
@@ -428,7 +428,7 @@ dig(void)
if (!does_block(dpx, dpy, &levl[dpx][dpy]))
unblock_point(dpx, dpy); /* vision: can see through */
feel_newsym(dpx, dpy);
if (digtxt && !g.context.digging.quiet)
if (digtxt && !gc.context.digging.quiet)
pline1(digtxt); /* after newsym */
if (dmgtxt)
pay_for_damage(dmgtxt, FALSE);
@@ -454,10 +454,10 @@ dig(void)
newsym(dpx, dpy);
}
cleanup:
g.context.digging.lastdigtime = g.moves;
g.context.digging.quiet = FALSE;
g.context.digging.level.dnum = 0;
g.context.digging.level.dlevel = -1;
gc.context.digging.lastdigtime = gm.moves;
gc.context.digging.quiet = FALSE;
gc.context.digging.level.dnum = 0;
gc.context.digging.level.dlevel = -1;
return 0;
} else { /* not enough effort has been spent yet */
static const char *const d_target[6] = { "", "rock", "statue",
@@ -474,9 +474,9 @@ dig(void)
|| (dig_target == DIGTYP_ROCK && !IS_ROCK(lev->typ)))
return 0; /* statue or boulder got taken */
if (!g.did_dig_msg) {
if (!gd.did_dig_msg) {
You("hit the %s with all your might.", d_target[dig_target]);
g.did_dig_msg = TRUE;
gd.did_dig_msg = TRUE;
}
}
return 1;
@@ -511,9 +511,9 @@ furniture_handled(coordxy x, coordxy y, boolean madeby_u)
int
holetime(void)
{
if (g.occupation != dig || !*u.ushops)
if (go.occupation != dig || !*u.ushops)
return -1;
return ((250 - g.context.digging.effort) / 20);
return ((250 - gc.context.digging.effort) / 20);
}
/* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */
@@ -588,11 +588,11 @@ digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp)
else
Strcpy(surface_type, surface(x, y));
shopdoor = IS_DOOR(lev->typ) && *in_rooms(x, y, SHOPBASE);
oldobjs = g.level.objects[x][y];
oldobjs = gl.level.objects[x][y];
ttmp = maketrap(x, y, ttyp);
if (!ttmp)
return;
newobjs = g.level.objects[x][y];
newobjs = gl.level.objects[x][y];
ttmp->madeby_u = madeby_u;
ttmp->tseen = 0;
if (cansee(x, y))
@@ -624,7 +624,7 @@ digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp)
if (at_u) {
if (!wont_fall) {
set_utrap(rn1(4, 2), TT_PIT);
g.vision_full_recalc = 1; /* vision limits change */
gv.vision_full_recalc = 1; /* vision limits change */
} else
reset_utrap(TRUE);
if (oldobjs != newobjs) /* something unearthed */
@@ -749,7 +749,7 @@ liquid_flow(coordxy x, coordxy y, schar typ, struct trap *ttmp,
if (fillmsg)
pline(fillmsg, hliquid(typ == LAVAPOOL ? "lava" : "water"));
/* handle object damage before hero damage; affects potential bones */
if ((objchain = g.level.objects[x][y]) != 0) {
if ((objchain = gl.level.objects[x][y]) != 0) {
if (typ == LAVAPOOL)
fire_damage_chain(objchain, TRUE, TRUE, x, y);
else
@@ -1055,7 +1055,7 @@ use_pick_axe2(struct obj *obj)
You("hit yourself with %s.", yname(uwep));
Sprintf(buf, "%s own %s", uhis(), OBJ_NAME(objects[obj->otyp]));
losehp(Maybe_Half_Phys(dam), buf, KILLED_BY);
g.context.botl = 1;
gc.context.botl = 1;
return ECMD_TIME;
} else if (u.dz == 0) {
confdir(FALSE);
@@ -1081,8 +1081,8 @@ use_pick_axe2(struct obj *obj)
/* you ought to be able to let go; tough luck */
/* (maybe `move_into_trap()' would be better) */
nomul(-d(2, 2));
g.multi_reason = "stuck in a spider web";
g.nomovemsg = "You pull free.";
gm.multi_reason = "stuck in a spider web";
gn.nomovemsg = "You pull free.";
} else if (lev->typ == IRONBARS) {
pline("Clang!");
wake_nearby();
@@ -1127,32 +1127,32 @@ use_pick_axe2(struct obj *obj)
"chopping at the door",
"cutting the tree" };
g.did_dig_msg = FALSE;
g.context.digging.quiet = FALSE;
if (g.context.digging.pos.x != rx || g.context.digging.pos.y != ry
|| !on_level(&g.context.digging.level, &u.uz)
|| g.context.digging.down) {
gd.did_dig_msg = FALSE;
gc.context.digging.quiet = FALSE;
if (gc.context.digging.pos.x != rx || gc.context.digging.pos.y != ry
|| !on_level(&gc.context.digging.level, &u.uz)
|| gc.context.digging.down) {
if (flags.autodig && dig_target == DIGTYP_ROCK
&& !g.context.digging.down
&& u_at(g.context.digging.pos.x, g.context.digging.pos.y)
&& (g.moves <= g.context.digging.lastdigtime + 2
&& g.moves >= g.context.digging.lastdigtime)) {
&& !gc.context.digging.down
&& u_at(gc.context.digging.pos.x, gc.context.digging.pos.y)
&& (gm.moves <= gc.context.digging.lastdigtime + 2
&& gm.moves >= gc.context.digging.lastdigtime)) {
/* avoid messages if repeated autodigging */
g.did_dig_msg = TRUE;
g.context.digging.quiet = TRUE;
gd.did_dig_msg = TRUE;
gc.context.digging.quiet = TRUE;
}
g.context.digging.down = g.context.digging.chew = FALSE;
g.context.digging.warned = FALSE;
g.context.digging.pos.x = rx;
g.context.digging.pos.y = ry;
assign_level(&g.context.digging.level, &u.uz);
g.context.digging.effort = 0;
if (!g.context.digging.quiet)
gc.context.digging.down = gc.context.digging.chew = FALSE;
gc.context.digging.warned = FALSE;
gc.context.digging.pos.x = rx;
gc.context.digging.pos.y = ry;
assign_level(&gc.context.digging.level, &u.uz);
gc.context.digging.effort = 0;
if (!gc.context.digging.quiet)
You("start %s.", d_action[dig_target]);
} else {
You("%s %s.", g.context.digging.chew ? "begin" : "continue",
You("%s %s.", gc.context.digging.chew ? "begin" : "continue",
d_action[dig_target]);
g.context.digging.chew = FALSE;
gc.context.digging.chew = FALSE;
}
set_occupation(dig, verbing, 0);
}
@@ -1180,16 +1180,16 @@ use_pick_axe2(struct obj *obj)
surface(u.ux, u.uy));
u_wipe_engr(3);
} else {
if (g.context.digging.pos.x != u.ux || g.context.digging.pos.y != u.uy
|| !on_level(&g.context.digging.level, &u.uz)
|| !g.context.digging.down) {
g.context.digging.chew = FALSE;
g.context.digging.down = TRUE;
g.context.digging.warned = FALSE;
g.context.digging.pos.x = u.ux;
g.context.digging.pos.y = u.uy;
assign_level(&g.context.digging.level, &u.uz);
g.context.digging.effort = 0;
if (gc.context.digging.pos.x != u.ux || gc.context.digging.pos.y != u.uy
|| !on_level(&gc.context.digging.level, &u.uz)
|| !gc.context.digging.down) {
gc.context.digging.chew = FALSE;
gc.context.digging.down = TRUE;
gc.context.digging.warned = FALSE;
gc.context.digging.pos.x = u.ux;
gc.context.digging.pos.y = u.uy;
assign_level(&gc.context.digging.level, &u.uz);
gc.context.digging.effort = 0;
You("start %s downward.", verbing);
if (*u.ushops) {
shopdig(0);
@@ -1197,7 +1197,7 @@ use_pick_axe2(struct obj *obj)
}
} else
You("continue %s downward.", verbing);
g.did_dig_msg = FALSE;
gd.did_dig_msg = FALSE;
set_occupation(dig, verbing, 0);
}
return ECMD_TIME;
@@ -1230,7 +1230,7 @@ watch_dig(struct monst *mtmp, coordxy x, coordxy y, boolean zap)
mtmp = get_iter_mons(watchman_canseeu);
if (mtmp) {
if (zap || g.context.digging.warned) {
if (zap || gc.context.digging.warned) {
verbalize("Halt, vandal! You're under arrest!");
(void) angry_guards(!!Deaf);
} else {
@@ -1245,7 +1245,7 @@ watch_dig(struct monst *mtmp, coordxy x, coordxy y, boolean zap)
else
str = "fountain";
verbalize("Hey, stop damaging that %s!", str);
g.context.digging.warned = TRUE;
gc.context.digging.warned = TRUE;
}
if (is_digging())
stop_occupation();
@@ -1313,9 +1313,9 @@ mdig_tunnel(struct monst *mtmp)
You_hear("crashing rock.");
if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
add_damage(mtmp->mx, mtmp->my, 0L);
if (g.level.flags.is_maze_lev) {
if (gl.level.flags.is_maze_lev) {
here->typ = ROOM, here->flags = 0;
} else if (g.level.flags.is_cavernous_lev
} else if (gl.level.flags.is_cavernous_lev
&& !in_town(mtmp->mx, mtmp->my)) {
here->typ = CORR, here->flags = 0;
} else {
@@ -1453,7 +1453,7 @@ zap_dig(void)
/* normal case: digging across the level */
shopdoor = shopwall = FALSE;
maze_dig = g.level.flags.is_maze_lev && !Is_earthlevel(&u.uz);
maze_dig = gl.level.flags.is_maze_lev && !Is_earthlevel(&u.uz);
zx = u.ux + u.dx;
zy = u.uy + u.dy;
if (u.utrap && u.utraptype == TT_PIT
@@ -1558,7 +1558,7 @@ zap_dig(void)
shopwall = TRUE;
}
watch_dig((struct monst *) 0, zx, zy, TRUE);
if (g.level.flags.is_cavernous_lev && !in_town(zx, zy)) {
if (gl.level.flags.is_cavernous_lev && !in_town(zx, zy)) {
room->typ = CORR, room->flags = 0;
} else {
room->typ = DOOR, room->doormask = D_NODOOR;
@@ -1733,7 +1733,7 @@ buried_ball(coord *cc)
* criterium (within 2 steps of tethered hero's present location)
* it will find an arbitrary one rather than the one which used
* to be uball. Once 3.6.{0,1} save file compatibility is broken,
* we should add g.context.buriedball_oid and then we can find the
* we should add gc.context.buriedball_oid and then we can find the
* actual former uball, which might be extra heavy or christened
* or not the one buried directly underneath the target spot.
*
@@ -1745,7 +1745,7 @@ buried_ball(coord *cc)
of u.utraptype is no longer meaningful; if u.utrap is still set
then u.utraptype needs to be for buried ball */
if (!u.utrap || u.utraptype == TT_BURIEDBALL) {
for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj) {
for (otmp = gl.level.buriedobjlist; otmp; otmp = otmp->nobj) {
if (otmp->otyp != HEAVY_IRON_BALL)
continue;
/* if found at the target spot, we're done */
@@ -1898,10 +1898,10 @@ bury_objs(int x, int y)
costly = ((shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)))
&& costly_spot(x, y));
if (g.level.objects[x][y] != (struct obj *) 0) {
if (gl.level.objects[x][y] != (struct obj *) 0) {
debugpline2("bury_objs: at <%d,%d>", x, y);
}
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp2) {
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp2) {
if (costly) {
loss += stolen_value(otmp, x, y, (boolean) shkp->mpeaceful, TRUE);
if (otmp->oclass != COIN_CLASS)
@@ -1932,7 +1932,7 @@ unearth_objs(int x, int y)
cc.x = x;
cc.y = y;
bball = buried_ball(&cc);
for (otmp = g.level.buriedobjlist; otmp; otmp = otmp2) {
for (otmp = gl.level.buriedobjlist; otmp; otmp = otmp2) {
otmp2 = otmp->nobj;
if (otmp->ox == x && otmp->oy == y) {
if (bball && otmp == bball
@@ -2021,8 +2021,8 @@ rot_corpse(anything *arg, long timeout)
&& hides_under(mtmp->data)) {
mtmp->mundetected = 0;
} else if (u_at(x, y)
&& u.uundetected && hides_under(g.youmonst.data))
(void) hideunder(&g.youmonst);
&& u.uundetected && hides_under(gy.youmonst.data))
(void) hideunder(&gy.youmonst);
newsym(x, y);
} else if (in_invent)
update_inventory();
@@ -2081,27 +2081,27 @@ void
escape_tomb(void)
{
debugpline0("escape_tomb");
if ((Teleportation || can_teleport(g.youmonst.data))
if ((Teleportation || can_teleport(gy.youmonst.data))
&& (Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell.");
(void) dotele(FALSE); /* calls unearth_you() */
} else if (u.uburied) { /* still buried after 'port attempt */
boolean good;
if (amorphous(g.youmonst.data) || Passes_walls
|| noncorporeal(g.youmonst.data)
|| (unsolid(g.youmonst.data)
&& g.youmonst.data != &mons[PM_WATER_ELEMENTAL])
|| (tunnels(g.youmonst.data) && !needspick(g.youmonst.data))) {
if (amorphous(gy.youmonst.data) || Passes_walls
|| noncorporeal(gy.youmonst.data)
|| (unsolid(gy.youmonst.data)
&& gy.youmonst.data != &mons[PM_WATER_ELEMENTAL])
|| (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))) {
You("%s up through the %s.",
(tunnels(g.youmonst.data) && !needspick(g.youmonst.data))
(tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))
? "try to tunnel"
: (amorphous(g.youmonst.data))
: (amorphous(gy.youmonst.data))
? "ooze"
: "phase",
surface(u.ux, u.uy));
good = (tunnels(g.youmonst.data) && !needspick(g.youmonst.data))
good = (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data))
? dighole(TRUE, FALSE, (coord *)0) : TRUE;
if (good)
unearth_you();
+95 -95
View File
@@ -151,7 +151,7 @@ static void set_seenv(struct rm *, coordxy, coordxy, coordxy, coordxy);
static void t_warn(struct rm *);
static int wall_angle(struct rm *);
#define remember_topology(x, y) (g.lastseentyp[x][y] = levl[x][y].typ)
#define remember_topology(x, y) (gl.lastseentyp[x][y] = levl[x][y].typ)
/*
* See display.h for descriptions of tp_sensemon() through
@@ -249,7 +249,7 @@ magic_map_background(coordxy x, coordxy y, int show)
else if (lev->typ == CORR && glyph == cmap_to_glyph(S_litcorr))
glyph = cmap_to_glyph(S_corr);
}
if (g.level.flags.hero_memory)
if (gl.level.flags.hero_memory)
lev->glyph = glyph;
if (show)
show_glyph(x, y, glyph);
@@ -280,7 +280,7 @@ map_background(register coordxy x, register coordxy y, register int show)
{
register int glyph = back_to_glyph(x, y);
if (g.level.flags.hero_memory)
if (gl.level.flags.hero_memory)
levl[x][y].glyph = glyph;
if (show)
show_glyph(x, y, glyph);
@@ -298,7 +298,7 @@ map_trap(register struct trap *trap, register int show)
register coordxy x = trap->tx, y = trap->ty;
register int glyph = trap_to_glyph(trap);
if (g.level.flags.hero_memory)
if (gl.level.flags.hero_memory)
levl[x][y].glyph = glyph;
if (show)
show_glyph(x, y, glyph);
@@ -316,7 +316,7 @@ map_object(register struct obj *obj, register int show)
register coordxy x = obj->ox, y = obj->oy;
register int glyph = obj_to_glyph(obj, newsym_rn2);
if (g.level.flags.hero_memory) {
if (gl.level.flags.hero_memory) {
/* MRKR: While hallucinating, statues are seen as random monsters */
/* but remembered as random objects. */
@@ -343,7 +343,7 @@ void
map_invisible(register coordxy x, register coordxy y)
{
if (x != u.ux || y != u.uy) { /* don't display I at hero's location */
if (g.level.flags.hero_memory)
if (gl.level.flags.hero_memory)
levl[x][y].glyph = GLYPH_INVISIBLE;
show_glyph(x, y, GLYPH_INVISIBLE);
}
@@ -375,7 +375,7 @@ unmap_object(register coordxy x, register coordxy y)
{
register struct trap *trap;
if (!g.level.flags.hero_memory)
if (!gl.level.flags.hero_memory)
return;
if ((trap = t_at(x, y)) != 0 && trap->tseen && !covers_traps(x, y)) {
@@ -499,7 +499,7 @@ display_monster(coordxy x, coordxy y, /* display position */
if (!sensed) {
show_glyph(x, y, glyph);
/* override real topology with mimic's fake one */
g.lastseentyp[x][y] = cmap_to_type(sym);
gl.lastseentyp[x][y] = cmap_to_type(sym);
}
break;
}
@@ -610,10 +610,10 @@ warning_of(struct monst *mon)
boolean
suppress_map_output(void)
{
if (g.in_mklev || g.program_state.saving || g.program_state.restoring)
if (gi.in_mklev || gp.program_state.saving || gp.program_state.restoring)
return TRUE;
#ifdef HANGUPHANDLING
if (g.program_state.done_hup)
if (gp.program_state.done_hup)
return TRUE;
#endif
return FALSE;
@@ -776,14 +776,14 @@ feel_location(coordxy x, coordxy y)
*/
if (uchain && uchain->where == OBJ_FLOOR
&& uchain->ox == x && uchain->oy == y
&& g.level.objects[x][y] == uchain)
&& gl.level.objects[x][y] == uchain)
u.bc_felt |= BC_CHAIN;
else
u.bc_felt &= ~BC_CHAIN; /* do not feel the chain */
if (uball && uball->where == OBJ_FLOOR
&& uball->ox == x && uball->oy == y
&& g.level.objects[x][y] == uball)
&& gl.level.objects[x][y] == uball)
u.bc_felt |= BC_BALL;
else
u.bc_felt &= ~BC_BALL; /* do not feel the ball */
@@ -1176,7 +1176,7 @@ flash_glyph_at(coordxy x, coordxy y, int tg, int rpt)
rpt *= 2; /* two loop iterations per 'count' */
glyph[0] = tg;
glyph[1] = (g.level.flags.hero_memory) ? levl[x][y].glyph
glyph[1] = (gl.level.flags.hero_memory) ? levl[x][y].glyph
: back_to_glyph(x, y);
/* even iteration count (guaranteed) ends with glyph[1] showing;
caller might want to override that, but no newsym() calls here
@@ -1357,7 +1357,7 @@ see_monsters(void)
register struct monst *mon;
int new_warn_obj_cnt = 0;
if (g.defer_see_monsters)
if (gd.defer_see_monsters)
return;
for (mon = fmon; mon; mon = mon->nmon) {
@@ -1366,16 +1366,16 @@ see_monsters(void)
newsym(mon->mx, mon->my);
if (mon->wormno)
see_wsegs(mon);
if (Warn_of_mon && (g.context.warntype.obj & mon->data->mflags2) != 0L)
if (Warn_of_mon && (gc.context.warntype.obj & mon->data->mflags2) != 0L)
new_warn_obj_cnt++;
}
/*
* Make Sting glow blue or stop glowing if required.
*/
if (new_warn_obj_cnt != g.warn_obj_cnt) {
if (new_warn_obj_cnt != gw.warn_obj_cnt) {
Sting_effects(new_warn_obj_cnt);
g.warn_obj_cnt = new_warn_obj_cnt;
gw.warn_obj_cnt = new_warn_obj_cnt;
}
/* when mounted, hero's location gets caught by monster loop */
@@ -1434,7 +1434,7 @@ see_traps(void)
struct trap *trap;
int glyph;
for (trap = g.ftrap; trap; trap = trap->ntrap) {
for (trap = gf.ftrap; trap; trap = trap->ntrap) {
glyph = glyph_at(trap->tx, trap->ty);
if (glyph_is_trap(glyph))
newsym(trap->tx, trap->ty);
@@ -1453,7 +1453,7 @@ static glyph_info no_ginfo = {
#ifndef UNBUFFERED_GLYPHINFO
#define Glyphinfo_at(x, y, glyph) \
(((x) < 0 || (y) < 0 || (x) >= COLNO || (y) >= ROWNO) ? &no_ginfo \
: &g.gbuf[(y)][(x)].glyphinfo)
: &gg.gbuf[(y)][(x)].glyphinfo)
#else
static glyph_info ginfo;
#define Glyphinfo_at(x, y, glyph) glyphinfo_at(x, y, glyph)
@@ -1512,10 +1512,10 @@ docrt(void)
coordxy x, y;
register struct rm *lev;
if (!u.ux || g.program_state.in_docrt)
if (!u.ux || gp.program_state.in_docrt)
return; /* display isn't ready yet */
g.program_state.in_docrt = TRUE;
gp.program_state.in_docrt = TRUE;
if (u.uswallow) {
swallowed(1);
@@ -1558,8 +1558,8 @@ docrt(void)
/* perm_invent */
update_inventory();
g.context.botlx = 1; /* force a redraw of the bottom line */
g.program_state.in_docrt = FALSE;
gc.context.botlx = 1; /* force a redraw of the bottom line */
gp.program_state.in_docrt = FALSE;
}
/* for panning beyond a clipped region; resend the current map data to
@@ -1637,9 +1637,9 @@ reglyph_darkroom(void)
}
}
if (flags.dark_room && iflags.use_color)
g.showsyms[S_darkroom] = g.showsyms[S_room];
gs.showsyms[S_darkroom] = gs.showsyms[S_room];
else
g.showsyms[S_darkroom] = g.showsyms[SYM_NOTHING + SYM_OFF_X];
gs.showsyms[S_darkroom] = gs.showsyms[SYM_NOTHING + SYM_OFF_X];
}
/* ======================================================================== */
@@ -1652,11 +1652,11 @@ void
newsym_force(coordxy x, coordxy y)
{
newsym(x, y);
g.gbuf[y][x].gnew = 1;
if (g.gbuf_start[y] > x)
g.gbuf_start[y] = x;
if (g.gbuf_stop[y] < x)
g.gbuf_stop[y] = x;
gg.gbuf[y][x].gnew = 1;
if (gg.gbuf_start[y] > x)
gg.gbuf_start[y] = x;
if (gg.gbuf_stop[y] < x)
gg.gbuf_stop[y] = x;
}
/*
@@ -1782,7 +1782,7 @@ show_glyph(coordxy x, coordxy y, int glyph)
map_glyphinfo(x, y, glyph, 0, &glyphinfo);
#endif
if (g.gbuf[y][x].glyphinfo.glyph != glyph
if (gg.gbuf[y][x].glyphinfo.glyph != glyph
#ifndef UNBUFFERED_GLYPHINFO
/* flags might change (single object vs pile, monster tamed or pet
gone feral), color might change (altar's alignment converted by
@@ -1790,23 +1790,23 @@ show_glyph(coordxy x, coordxy y, int glyph)
glyph does too (changing boulder symbol would be an exception,
but that triggers full redraw so doesn't matter here); still,
be thorough and check everything */
|| g.gbuf[y][x].glyphinfo.ttychar != glyphinfo.ttychar
|| g.gbuf[y][x].glyphinfo.gm.glyphflags != glyphinfo.gm.glyphflags
|| g.gbuf[y][x].glyphinfo.gm.sym.color != glyphinfo.gm.sym.color
|| g.gbuf[y][x].glyphinfo.gm.tileidx != glyphinfo.gm.tileidx
|| gg.gbuf[y][x].glyphinfo.ttychar != glyphinfo.ttychar
|| gg.gbuf[y][x].glyphinfo.gm.glyphflags != glyphinfo.gm.glyphflags
|| gg.gbuf[y][x].glyphinfo.gm.sym.color != glyphinfo.gm.sym.color
|| gg.gbuf[y][x].glyphinfo.gm.tileidx != glyphinfo.gm.tileidx
#endif
|| iflags.use_background_glyph) {
g.gbuf[y][x].glyphinfo.glyph = glyph;
g.gbuf[y][x].gnew = 1;
gg.gbuf[y][x].glyphinfo.glyph = glyph;
gg.gbuf[y][x].gnew = 1;
#ifndef UNBUFFERED_GLYPHINFO
g.gbuf[y][x].glyphinfo.glyph = glyphinfo.glyph;
g.gbuf[y][x].glyphinfo.ttychar = glyphinfo.ttychar;
g.gbuf[y][x].glyphinfo.gm = glyphinfo.gm;
gg.gbuf[y][x].glyphinfo.glyph = glyphinfo.glyph;
gg.gbuf[y][x].glyphinfo.ttychar = glyphinfo.ttychar;
gg.gbuf[y][x].glyphinfo.gm = glyphinfo.gm;
#endif
if (g.gbuf_start[y] > x)
g.gbuf_start[y] = x;
if (g.gbuf_stop[y] < x)
g.gbuf_stop[y] = x;
if (gg.gbuf_start[y] > x)
gg.gbuf_start[y] = x;
if (gg.gbuf_stop[y] < x)
gg.gbuf_stop[y] = x;
}
}
@@ -1819,8 +1819,8 @@ show_glyph(coordxy x, coordxy y, int glyph)
int i; \
\
for (i = 0; i < ROWNO; i++) { \
g.gbuf_start[i] = COLNO - 1; \
g.gbuf_stop[i] = 0; \
gg.gbuf_start[i] = COLNO - 1; \
gg.gbuf_stop[i] = 0; \
} \
}
@@ -1843,7 +1843,7 @@ void
clear_glyph_buffer(void)
{
register coordxy x, y;
gbuf_entry *gptr = &g.gbuf[0][0];
gbuf_entry *gptr = &gg.gbuf[0][0];
glyph_info *giptr =
#ifndef UNBUFFERED_GLYPHINFO
&gptr->glyphinfo;
@@ -1865,12 +1865,12 @@ clear_glyph_buffer(void)
#endif
? 1 : 0;
for (y = 0; y < ROWNO; y++) {
gptr = &g.gbuf[y][0];
gptr = &gg.gbuf[y][0];
for (x = COLNO; x; x--) {
*gptr++ = nul_gbuf;
}
g.gbuf_start[y] = 1;
g.gbuf_stop[y] = COLNO - 1;
gg.gbuf_start[y] = 1;
gg.gbuf_stop[y] = COLNO - 1;
}
}
@@ -1882,7 +1882,7 @@ row_refresh(coordxy start, coordxy stop, coordxy y)
register coordxy x;
int glyph;
register boolean force;
gbuf_entry *gptr = &g.gbuf[0][0];
gbuf_entry *gptr = &gg.gbuf[0][0];
glyph_info bkglyphinfo = nul_glyphinfo;
glyph_info *giptr =
#ifndef UNBUFFERED_GLYPHINFO
@@ -1904,7 +1904,7 @@ row_refresh(coordxy start, coordxy stop, coordxy y)
#endif
? 1 : 0;
for (x = start; x <= stop; x++) {
gptr = &g.gbuf[y][x];
gptr = &gg.gbuf[y][x];
glyph = gptr->glyphinfo.glyph;
if (force || glyph != GLYPH_UNEXPLORED) {
bkglyphinfo.glyph = get_bk_glyph(x, y);
@@ -1923,7 +1923,7 @@ cls(void)
return;
in_cls = TRUE;
display_nhwindow(WIN_MESSAGE, FALSE); /* flush messages */
g.context.botlx = 1; /* force update of botl window */
gc.context.botlx = 1; /* force update of botl window */
clear_nhwindow(WIN_MAP); /* clear physical screen */
clear_glyph_buffer(); /* force gbuf[][].glyph to unexplored */
@@ -1956,20 +1956,20 @@ flush_screen(int cursor_on_u)
return; /* if already flushing then return */
flushing = 1;
#ifdef HANGUPHANDLING
if (g.program_state.done_hup)
if (gp.program_state.done_hup)
return;
#endif
/* get this done now, before we place the cursor on the hero */
if (g.context.botl || g.context.botlx)
if (gc.context.botl || gc.context.botlx)
bot();
else if (iflags.time_botl)
timebot();
for (y = 0; y < ROWNO; y++) {
register gbuf_entry *gptr = &g.gbuf[y][x = g.gbuf_start[y]];
register gbuf_entry *gptr = &gg.gbuf[y][x = gg.gbuf_start[y]];
for (; x <= g.gbuf_stop[y]; gptr++, x++)
for (; x <= gg.gbuf_stop[y]; gptr++, x++)
if (gptr->gnew) {
map_glyphinfo(x, y, get_bk_glyph(x, y), 0, &bkglyphinfo);
print_glyph(WIN_MAP, x, y,
@@ -2014,7 +2014,7 @@ back_to_glyph(coordxy x, coordxy y)
switch (ptr->typ) {
case SCORR:
case STONE:
idx = g.level.flags.arboreal ? S_tree : S_stone;
idx = gl.level.flags.arboreal ? S_tree : S_stone;
break;
case ROOM:
idx = S_room;
@@ -2191,7 +2191,7 @@ glyph_at(coordxy x, coordxy y)
{
if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO)
return cmap_to_glyph(S_room); /* XXX */
return g.gbuf[y][x].glyphinfo.glyph;
return gg.gbuf[y][x].glyphinfo.glyph;
}
#ifdef UNBUFFERED_GLYPHINFO
@@ -2223,11 +2223,11 @@ get_bk_glyph(coordxy x, coordxy y)
struct rm *lev = &levl[x][y];
if (iflags.use_background_glyph && lev->seenv != 0
&& (g.gbuf[y][x].glyphinfo.glyph != GLYPH_UNEXPLORED)) {
&& (gg.gbuf[y][x].glyphinfo.glyph != GLYPH_UNEXPLORED)) {
switch (lev->typ) {
case SCORR:
case STONE:
idx = g.level.flags.arboreal ? S_tree : S_stone;
idx = gl.level.flags.arboreal ? S_tree : S_stone;
break;
case ROOM:
idx = S_room;
@@ -2276,14 +2276,14 @@ get_bk_glyph(coordxy x, coordxy y)
#if defined(USE_TILES) && defined(MSDOS)
#define HAS_ROGUE_IBM_GRAPHICS \
(g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM) && !iflags.grmode)
(gc.currentgraphics == ROGUESET && SYMHANDLING(H_IBM) && !iflags.grmode)
#else
#define HAS_ROGUE_IBM_GRAPHICS \
(g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM))
(gc.currentgraphics == ROGUESET && SYMHANDLING(H_IBM))
#endif
#define HI_DOMESTIC CLR_WHITE /* monst.c */
/* masks for per-level variances kept in g.glyphmap_perlevel_flags */
/* masks for per-level variances kept in gg.glyphmap_perlevel_flags */
#define GMAP_SET 0x0001
#define GMAP_ROGUELEVEL 0x0002
@@ -2320,7 +2320,7 @@ map_glyphinfo(
; /* color tweak not needed (!use_color) or not wanted (poly'd
or riding--which uses steed's color, not hero's) */
} else if (HAS_ROGUE_IBM_GRAPHICS
&& g.symset[g.currentgraphics].nocolor == 0) {
&& gs.symset[gc.currentgraphics].nocolor == 0) {
/* actually player should be yellow-on-gray if in corridor */
glyphinfo->gm.sym.color = CLR_YELLOW;
} else if (flags.showrace) {
@@ -2336,9 +2336,9 @@ map_glyphinfo(
Turn on override symbol if caller hasn't specified NOOVERRIDE. */
if (sysopt.accessibility == 1 && !(mgflags & MG_FLAG_NOOVERRIDE)) {
offset = SYM_HERO_OVERRIDE + SYM_OFF_X;
if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
? g.ov_rogue_syms[offset]
: g.ov_primary_syms[offset])
if ((gg.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
? go.ov_rogue_syms[offset]
: go.ov_primary_syms[offset])
glyphinfo->gm.sym.symidx = offset;
}
glyphinfo->gm.glyphflags |= MG_HERO;
@@ -2349,7 +2349,7 @@ map_glyphinfo(
turn off override symbol if caller has specfieid NOOVERRIDE */
glyphinfo->gm.sym.symidx = mons[glyph_to_mon(glyph)].mlet + SYM_OFF_M;
}
glyphinfo->ttychar = g.showsyms[glyphinfo->gm.sym.symidx];
glyphinfo->ttychar = gs.showsyms[glyphinfo->gm.sym.symidx];
glyphinfo->glyph = glyph;
}
@@ -2411,8 +2411,8 @@ int wallcolors[sokoban_walls + 1] = {
#if 0
#define is_objpile(x, y) \
(!Hallucination && g.level.objects[(x)][(y)] \
&& g.level.objects[(x)][(y)]->nexthere)
(!Hallucination && gl.level.objects[(x)][(y)] \
&& gl.level.objects[(x)][(y)]->nexthere)
#endif
static int cmap_to_roguecolor(int);
@@ -2422,7 +2422,7 @@ cmap_to_roguecolor(int cmap)
{
int color = NO_COLOR;
if (g.symset[g.currentgraphics].nocolor)
if (gs.symset[gc.currentgraphics].nocolor)
return NO_COLOR;
if (cmap >= S_vwall && cmap <= S_hcdoor)
@@ -2467,19 +2467,19 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
/* condense multiple tests in macro version down to single */
boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS,
has_rogue_color = (has_rogue_ibm_graphics
&& g.symset[g.currentgraphics].nocolor == 0);
&& gs.symset[gc.currentgraphics].nocolor == 0);
if (trigger == gm_levelchange)
g.glyphmap_perlevel_flags = 0;
gg.glyphmap_perlevel_flags = 0;
if (!g.glyphmap_perlevel_flags) {
if (!gg.glyphmap_perlevel_flags) {
/*
* GMAP_SET 0x00000001
* GMAP_ROGUELEVEL 0x00000002
*/
g.glyphmap_perlevel_flags |= GMAP_SET;
gg.glyphmap_perlevel_flags |= GMAP_SET;
if (Is_rogue_level(&u.uz)) {
g.glyphmap_perlevel_flags |= GMAP_ROGUELEVEL;
gg.glyphmap_perlevel_flags |= GMAP_ROGUELEVEL;
}
}
@@ -2612,25 +2612,25 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
/* try to provide a visible difference between water and lava
if they use the same symbol and color is disabled */
if (cmap == S_lava
&& (g.showsyms[gmap->sym.symidx]
== g.showsyms[S_pool + SYM_OFF_P]
|| g.showsyms[gmap->sym.symidx]
== g.showsyms[S_water + SYM_OFF_P])) {
&& (gs.showsyms[gmap->sym.symidx]
== gs.showsyms[S_pool + SYM_OFF_P]
|| gs.showsyms[gmap->sym.symidx]
== gs.showsyms[S_water + SYM_OFF_P])) {
gmap->glyphflags |= MG_BW_LAVA;
/* similar for floor [what about empty doorway?] and ice */
} else if (cmap == S_ice
&& (g.showsyms[gmap->sym.symidx]
== g.showsyms[S_room + SYM_OFF_P]
|| g.showsyms[gmap->sym.symidx]
== g.showsyms[S_darkroom
&& (gs.showsyms[gmap->sym.symidx]
== gs.showsyms[S_room + SYM_OFF_P]
|| gs.showsyms[gmap->sym.symidx]
== gs.showsyms[S_darkroom
+ SYM_OFF_P])) {
gmap->glyphflags |= MG_BW_ICE;
/* and for fountain vs sink */
} else if (cmap == S_sink
&& (g.showsyms[gmap->sym.symidx]
== g.showsyms[S_fountain + SYM_OFF_P])) {
&& (gs.showsyms[gmap->sym.symidx]
== gs.showsyms[S_fountain + SYM_OFF_P])) {
gmap->glyphflags |= MG_BW_SINK;
}
} else if (has_rogue_color) {
@@ -2656,8 +2656,8 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
/* provide a visible difference if normal and lit corridor
use the same symbol */
} else if ((cmap == S_litcorr)
&& g.showsyms[gmap->sym.symidx]
== g.showsyms[S_corr + SYM_OFF_P]) {
&& gs.showsyms[gmap->sym.symidx]
== gs.showsyms[S_corr + SYM_OFF_P]) {
color = CLR_WHITE;
#endif
}
@@ -2784,24 +2784,24 @@ reset_glyphmap(enum glyphmap_change_triggers trigger)
/* This was requested by a blind player to enhance screen reader use
*/
if (sysopt.accessibility == 1 && (gmap->glyphflags & MG_PET) != 0) {
int pet_override = ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
? g.ov_rogue_syms[SYM_PET_OVERRIDE + SYM_OFF_X]
: g.ov_primary_syms[SYM_PET_OVERRIDE + SYM_OFF_X]);
int pet_override = ((gg.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
? go.ov_rogue_syms[SYM_PET_OVERRIDE + SYM_OFF_X]
: go.ov_primary_syms[SYM_PET_OVERRIDE + SYM_OFF_X]);
if (g.showsyms[pet_override] != ' ')
if (gs.showsyms[pet_override] != ' ')
gmap->sym.symidx = SYM_PET_OVERRIDE + SYM_OFF_X;
}
#ifdef TEXTCOLOR
/* Turn off color if no color defined, or rogue level w/o PC graphics.
*/
if ((!has_color(color)
|| ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
|| ((gg.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
&& !has_rogue_color)) || !iflags.use_color)
#endif
color = NO_COLOR;
gmap->sym.color = color;
}
g.glyph_reset_timestamp = g.moves;
gg.glyph_reset_timestamp = gm.moves;
}
/* ------------------------------------------------------------------------ */
+86 -86
View File
@@ -116,7 +116,7 @@ boulder_hits_pool(
if (fills_up && u.uinwater && distu(rx, ry) == 0) {
set_uinwater(0); /* u.uinwater = 0 */
docrt();
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
You("find yourself on dry land again!");
} else if (lava && next2u(rx, ry)) {
int dmg;
@@ -164,8 +164,8 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
/* erode_obj() (called from water_damage() or lava_damage()) needs
bhitpos, but that was screwing up wand zapping that called us from
rloco(), so we now restore bhitpos before we return */
save_bhitpos = g.bhitpos;
g.bhitpos.x = x, g.bhitpos.y = y;
save_bhitpos = gb.bhitpos;
gb.bhitpos.x = x, gb.bhitpos.y = y;
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
res = TRUE;
@@ -191,7 +191,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
might have been thrown by a giant or launched by
a rolling boulder trap triggered by a monster or
dropped by a scroll of earth read by a monster */
if (g.context.mon_moving) {
if (gc.context.mon_moving) {
/* normally we'd use ohitmon() but it can call
drop_throw() which calls flooreffects() */
damage = dmgval(obj, mtmp);
@@ -212,7 +212,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
}
mtmp->mtrapped = 0;
} else {
if (!Passes_walls && !throws_rocks(g.youmonst.data)) {
if (!Passes_walls && !throws_rocks(gy.youmonst.data)) {
losehp(Maybe_Half_Phys(rnd(15)),
"squished under a boulder", NO_KILLER_PREFIX);
goto deletedwithboulder;
@@ -288,7 +288,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
res = (boolean) !obj;
}
g.bhitpos = save_bhitpos;
gb.bhitpos = save_bhitpos;
return res;
}
@@ -345,7 +345,7 @@ polymorph_sink(void)
return;
sinklooted = levl[u.ux][u.uy].looted != 0;
g.level.flags.nsinks--;
gl.level.flags.nsinks--;
levl[u.ux][u.uy].doormask = 0; /* levl[][].flags */
switch (rn2(4)) {
default:
@@ -355,7 +355,7 @@ polymorph_sink(void)
levl[u.ux][u.uy].blessedftn = 0;
if (sinklooted)
SET_FOUNTAIN_LOOTED(u.ux, u.uy);
g.level.flags.nfountains++;
gl.level.flags.nfountains++;
break;
case 1:
sym = S_throne;
@@ -482,7 +482,7 @@ dosinkring(struct obj *obj)
break;
case RIN_HUNGER:
ideed = FALSE;
for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
for (otmp = gl.level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere;
if (otmp != uball && otmp != uchain
&& !obj_resists(otmp, 1, 99)) {
@@ -741,7 +741,7 @@ dropz(struct obj *obj, boolean with_impact)
container_impact_dmg(obj, u.ux, u.uy);
if (obj == uball)
drop_ball(u.ux, u.uy);
else if (g.level.flags.has_shop)
else if (gl.level.flags.has_shop)
sellobj(obj, u.ux, u.uy);
stackobj(obj);
if (Blind && Levitation)
@@ -819,7 +819,7 @@ obj_no_longer_held(struct obj *obj)
*/
if (!obj->oerodeproof || !rn2(10)) {
/* if monsters aren't moving, assume player is responsible */
if (!g.context.mon_moving && !g.program_state.gameover)
if (!gc.context.mon_moving && !gp.program_state.gameover)
costly_alteration(obj, COST_DEGRD);
obj->otyp = WORM_TOOTH;
obj->oerodeproof = 0;
@@ -834,7 +834,7 @@ doddrop(void)
{
int result = ECMD_OK;
if (!g.invent) {
if (!gi.invent) {
You("have nothing to drop.");
return ECMD_OK;
}
@@ -883,7 +883,7 @@ menu_drop(int retry)
all_categories = (retry == -2);
} else if (flags.menu_style == MENU_FULL) {
all_categories = FALSE;
n = query_category("Drop what type of items?", g.invent,
n = query_category("Drop what type of items?", gi.invent,
(UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL
| BUC_BLESSED | BUC_CURSED | BUC_UNCURSED
| BUC_UNKNOWN | JUSTPICKED | INCLUDE_VENOM),
@@ -924,7 +924,7 @@ menu_drop(int retry)
* Dropping a burning potion of oil while levitating can cause
* an explosion which might destroy some of hero's inventory,
* so the old code
* for (otmp = g.invent; otmp; otmp = otmp2) {
* for (otmp = gi.invent; otmp; otmp = otmp2) {
* otmp2 = otmp->nobj;
* n_dropped += drop(otmp);
* }
@@ -938,23 +938,23 @@ menu_drop(int retry)
* ought to halt the traversal or perhaps ask player whether
* to halt it.
*/
bypass_objlist(g.invent, FALSE); /* clear bypass bit for invent */
while ((otmp = nxt_unbypassed_obj(g.invent)) != 0) {
bypass_objlist(gi.invent, FALSE); /* clear bypass bit for invent */
while ((otmp = nxt_unbypassed_obj(gi.invent)) != 0) {
if (drop_everything || all_categories || allow_category(otmp))
n_dropped += ((drop(otmp) & ECMD_TIME) != 0) ? 1 : 0;
}
/* we might not have dropped everything (worn armor, welded weapon,
cursed loadstones), so reset any remaining inventory to normal */
bypass_objlist(g.invent, FALSE);
} else if (drop_justpicked && count_justpicked(g.invent) == 1) {
bypass_objlist(gi.invent, FALSE);
} else if (drop_justpicked && count_justpicked(gi.invent) == 1) {
/* drop the just picked item automatically, if only one stack */
otmp = find_justpicked(g.invent);
otmp = find_justpicked(gi.invent);
if (otmp)
n_dropped += ((menudrop_split(otmp, justpicked_quan) & ECMD_TIME)
!= 0) ? 1 : 0;
} else {
/* should coordinate with perm invent, maybe not show worn items */
n = query_objlist("What would you like to drop?", &g.invent,
n = query_objlist("What would you like to drop?", &gi.invent,
(USE_INVLET | INVORDER_SORT | INCLUDE_VENOM),
&pick_list, PICK_ANY,
all_categories ? allow_all : allow_category);
@@ -963,18 +963,18 @@ menu_drop(int retry)
* picklist[] contains a set of pointers into inventory, but
* as soon as something gets dropped, they might become stale
* (see the drop_everything code above for an explanation).
* Just checking to see whether one is still in the g.invent
* Just checking to see whether one is still in the gi.invent
* chain is not sufficient validation since destroyed items
* will be freed and items we've split here might have already
* reused that memory and put the same pointer value back into
* g.invent. Ditto for using invlet to validate. So we start
* by setting bypass on all of g.invent, then check each pointer
* to verify that it is in g.invent and has that bit set.
* gi.invent. Ditto for using invlet to validate. So we start
* by setting bypass on all of gi.invent, then check each pointer
* to verify that it is in gi.invent and has that bit set.
*/
bypass_objlist(g.invent, TRUE);
bypass_objlist(gi.invent, TRUE);
for (i = 0; i < n; i++) {
otmp = pick_list[i].item.a_obj;
for (otmp2 = g.invent; otmp2; otmp2 = otmp2->nobj)
for (otmp2 = gi.invent; otmp2; otmp2 = otmp2->nobj)
if (otmp2 == otmp)
break;
if (!otmp2 || !otmp2->bypass)
@@ -983,7 +983,7 @@ menu_drop(int retry)
n_dropped += ((menudrop_split(otmp, pick_list[i].count)
& ECMD_TIME) != 0) ? 1 : 0;
}
bypass_objlist(g.invent, FALSE); /* reset g.invent to normal */
bypass_objlist(gi.invent, FALSE); /* reset gi.invent to normal */
free((genericptr_t) pick_list);
}
}
@@ -1017,11 +1017,11 @@ dodown(void)
if (ELevitation & W_ARTI) {
struct obj *obj;
for (obj = g.invent; obj; obj = obj->nobj) {
for (obj = gi.invent; obj; obj = obj->nobj) {
if (obj->oartifact
&& artifact_has_invprop(obj, LEVITATION)) {
if (obj->age < g.moves)
obj->age = g.moves;
if (obj->age < gm.moves)
obj->age = gm.moves;
obj->age += rnz(100);
}
}
@@ -1077,7 +1077,7 @@ dodown(void)
}
if (u.ustuck) {
if (u.uswallow || !sticks(g.youmonst.data)) {
if (u.uswallow || !sticks(gy.youmonst.data)) {
You("are %s, and cannot go down.",
!u.uswallow ? "being held"
: digests(u.ustuck->data) ? "swallowed"
@@ -1098,7 +1098,7 @@ dodown(void)
return ECMD_TIME;
} else if (!trap || !is_hole(trap->ttyp)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
if (flags.autodig && !g.context.nopick && uwep && is_pick(uwep)) {
if (flags.autodig && !gc.context.nopick && uwep && is_pick(uwep)) {
return use_pick_axe2(uwep);
} else {
You_cant("go down here%s.",
@@ -1126,7 +1126,7 @@ dodown(void)
const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through";
const char *actn = u_locomotion("jump");
if (g.youmonst.data->msize >= MZ_HUGE) {
if (gy.youmonst.data->msize >= MZ_HUGE) {
char qbuf[QBUFSZ];
You("don't fit %s easily.", down_or_thru);
@@ -1155,9 +1155,9 @@ dodown(void)
(void) clamp_hole_destination(&tdst);
goto_level(&tdst, FALSE, FALSE, FALSE);
} else {
g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
ga.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
next_level(!trap);
g.at_ladder = FALSE;
ga.at_ladder = FALSE;
}
return ECMD_TIME;
}
@@ -1187,7 +1187,7 @@ doup(void)
return ECMD_OK;
}
if (u.ustuck) {
if (u.uswallow || !sticks(g.youmonst.data)) {
if (u.uswallow || !sticks(gy.youmonst.data)) {
You("are %s, and cannot go up.",
!u.uswallow ? "being held"
: digests(u.ustuck->data) ? "swallowed"
@@ -1216,9 +1216,9 @@ doup(void)
You("are held back by your pet!");
return ECMD_OK;
}
g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
ga.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
prev_level(TRUE);
g.at_ladder = FALSE;
ga.at_ladder = FALSE;
return ECMD_TIME;
}
@@ -1255,7 +1255,7 @@ save_currentstate(void)
{
NHFILE *nhfp;
g.program_state.in_checkpoint++;
gp.program_state.in_checkpoint++;
if (flags.ins_chkpt) {
/* write out just-attained level, with pets and everything */
nhfp = currentlevel_rewrite();
@@ -1270,7 +1270,7 @@ save_currentstate(void)
/* write out non-level state */
savestateinlock();
g.program_state.in_checkpoint--;
gp.program_state.in_checkpoint--;
}
#endif
@@ -1305,7 +1305,7 @@ u_collide_m(struct monst *mtmp)
it was already here. Randomly move you to an adjacent spot
or else the monster to any nearby location. Prior to 3.3.0
the latter was done unconditionally. */
if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data)
if (!rn2(2) && enexto(&cc, u.ux, u.uy, gy.youmonst.data)
&& next2u(cc.x, cc.y))
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
else
@@ -1381,7 +1381,7 @@ goto_level(
*/
if (Inhell && up && u.uhave.amulet && !newdungeon && !portal
&& (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) {
if (!rn2(4 + g.context.mysteryforce)) {
if (!rn2(4 + gc.context.mysteryforce)) {
int odds = 3 + (int) u.ualign.type, /* 2..4 */
diff = (odds <= 1) ? 0 : rn2(odds); /* paranoia */
@@ -1401,7 +1401,7 @@ goto_level(
that drops faster, on average, when being sent down farther so
while the impact is reduced for everybody compared to earlier
versions, it is reduced least for chaotics, most for lawfuls */
g.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */
gc.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */
if (on_level(newlevel, &u.uz)) {
(void) safe_teleds(FALSE);
@@ -1409,7 +1409,7 @@ goto_level(
return;
}
new_ledger = ledger_no(newlevel);
at_stairs = g.at_ladder = FALSE;
at_stairs = ga.at_ladder = FALSE;
}
}
@@ -1439,7 +1439,7 @@ goto_level(
maybe_reset_pick((struct obj *) 0);
reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */
iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination cache */
g.context.polearm.hitmon = (struct monst *) 0; /* polearm target */
gc.context.polearm.hitmon = (struct monst *) 0; /* polearm target */
/* digging context is level-aware and can actually be resumed if
hero returns to the previous level without any intervening dig */
@@ -1488,7 +1488,7 @@ goto_level(
for (l_idx = maxledgerno(); l_idx > 0; --l_idx)
delete_levelfile(l_idx);
/* mark #overview data for all dungeon branches as uninteresting */
for (l_idx = 0; l_idx < g.n_dgns; ++l_idx)
for (l_idx = 0; l_idx < gn.n_dgns; ++l_idx)
remdun_mapseen(l_idx);
/* get rid of mons & objs scheduled to migrate to discarded levels */
discard_migrations();
@@ -1518,18 +1518,18 @@ goto_level(
stairway_free_all();
/* set default level change destination areas */
/* the special level code may override these */
(void) memset((genericptr_t) &g.updest, 0, sizeof g.updest);
(void) memset((genericptr_t) &g.dndest, 0, sizeof g.dndest);
(void) memset((genericptr_t) &gu.updest, 0, sizeof gu.updest);
(void) memset((genericptr_t) &gd.dndest, 0, sizeof gd.dndest);
if (!(g.level_info[new_ledger].flags & LFILE_EXISTS)) {
if (!(gl.level_info[new_ledger].flags & LFILE_EXISTS)) {
/* entering this level for first time; make it now */
if (g.level_info[new_ledger].flags & (VISITED)) {
if (gl.level_info[new_ledger].flags & (VISITED)) {
impossible("goto_level: returning to discarded level?");
g.level_info[new_ledger].flags &= ~(VISITED);
gl.level_info[new_ledger].flags &= ~(VISITED);
}
mklev();
new = TRUE; /* made the level */
familiar = bones_include_name(g.plname);
familiar = bones_include_name(gp.plname);
} else {
/* returning to previously visited level; reload it */
nhfp = open_levelfile(new_ledger, whynot);
@@ -1540,7 +1540,7 @@ goto_level(
reseed_random(rn2);
reseed_random(rn2_on_display_rng);
minit(); /* ZEROCOMP */
getlev(nhfp, g.hackpid, new_ledger);
getlev(nhfp, gh.hackpid, new_ledger);
close_nhfile(nhfp);
oinit(); /* reassign level dependent obj probabilities */
}
@@ -1548,14 +1548,14 @@ goto_level(
set_uinwater(0); /* u.uinwater = 0 */
/* do this prior to level-change pline messages */
vision_reset(); /* clear old level's line-of-sight */
g.vision_full_recalc = 0; /* don't let that reenable vision yet */
gv.vision_full_recalc = 0; /* don't let that reenable vision yet */
flush_screen(-1); /* ensure all map flushes are postponed */
if (portal && !In_endgame(&u.uz)) {
/* find the portal on the new level */
register struct trap *ttrap;
for (ttrap = g.ftrap; ttrap; ttrap = ttrap->ntrap)
for (ttrap = gf.ftrap; ttrap; ttrap = ttrap->ntrap)
if (ttrap->ttyp == MAGIC_PORTAL)
break;
@@ -1575,7 +1575,7 @@ goto_level(
}
} else if (at_stairs && !In_endgame(&u.uz)) {
if (up) {
stairway *stway = stairway_find_from(&u.uz0, g.at_ladder);
stairway *stway = stairway_find_from(&u.uz0, ga.at_ladder);
if (stway) {
u_on_newpos(stway->sx, stway->sy);
stway->u_traversed = TRUE;
@@ -1590,10 +1590,10 @@ goto_level(
pline("%s %s up%s the %s.",
great_effort ? "With great effort, you" : "You",
u_locomotion("climb"),
(Flying && g.at_ladder) ? " along" : "",
g.at_ladder ? "ladder" : "stairs");
(Flying && ga.at_ladder) ? " along" : "",
ga.at_ladder ? "ladder" : "stairs");
} else { /* down */
stairway *stway = stairway_find_from(&u.uz0, g.at_ladder);
stairway *stway = stairway_find_from(&u.uz0, ga.at_ladder);
if (stway) {
u_on_newpos(stway->sx, stway->sy);
stway->u_traversed = TRUE;
@@ -1606,10 +1606,10 @@ goto_level(
} else if (Flying) {
if (Verbose(0, go_to_level2))
You("fly down %s.",
g.at_ladder ? "along the ladder" : "the stairs");
ga.at_ladder ? "along the ladder" : "the stairs");
} else if (near_capacity() > UNENCUMBERED
|| Punished || Fumbling) {
You("fall down the %s.", g.at_ladder ? "ladder" : "stairs");
You("fall down the %s.", ga.at_ladder ? "ladder" : "stairs");
if (Punished) {
drag_down();
ballrelease(FALSE);
@@ -1619,13 +1619,13 @@ goto_level(
dismount_steed(DISMOUNT_FELL);
else
losehp(Maybe_Half_Phys(rnd(3)),
g.at_ladder ? "falling off a ladder"
ga.at_ladder ? "falling off a ladder"
: "tumbling down a flight of stairs",
KILLED_BY);
selftouch("Falling, you");
} else { /* ordinary descent */
if (Verbose(0, go_to_level3))
You("%s.", g.at_ladder ? "climb down the ladder"
You("%s.", ga.at_ladder ? "climb down the ladder"
: "descend the stairs");
}
}
@@ -1681,7 +1681,7 @@ goto_level(
'dfr_post_msg' has already been reset to Null];
if 'dfr_post_msg' is "you materialize on a different level" then
maybe_lvltport_feedback() will deliver it now and then free it */
if (g.dfr_post_msg)
if (gd.dfr_post_msg)
maybe_lvltport_feedback(); /* potentially called by Sting_effects() */
/* special levels can have a custom arrival message */
@@ -1749,7 +1749,7 @@ goto_level(
pline_The("heat and smoke are gone.");
} else if (Is_knox(&u.uz)) {
/* alarm stops working once Croesus has died */
if (new || !g.mvitals[PM_CROESUS].died) {
if (new || !gm.mvitals[PM_CROESUS].died) {
You("have penetrated a high security area!");
pline("An alarm sounds!");
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
@@ -1773,7 +1773,7 @@ goto_level(
/* main dungeon message from your quest leader */
if (!In_quest(&u.uz0) && at_dgn_entrance("The Quest")
&& !(u.uevent.qcompleted || u.uevent.qexpelled
|| g.quest_status.leader_is_dead)) {
|| gq.quest_status.leader_is_dead)) {
/* [TODO: copy of same TODO below; if an achievement for
receiving quest call from leader gets added, that should
come after logging new level entry] */
@@ -1845,17 +1845,17 @@ hellish_smoke_mesg(void)
{
if (Inhell && !Is_valley(&u.uz))
pline("It is hot here. You %s smoke...",
olfaction(g.youmonst.data) ? "smell" : "sense");
olfaction(gy.youmonst.data) ? "smell" : "sense");
}
/* usually called from goto_level(); might be called from Sting_effects() */
void
maybe_lvltport_feedback(void)
{
if (g.dfr_post_msg && !strncmpi(g.dfr_post_msg, "You materialize", 15)) {
if (gd.dfr_post_msg && !strncmpi(gd.dfr_post_msg, "You materialize", 15)) {
/* "You materialize on a different level." */
pline("%s", g.dfr_post_msg);
free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0;
pline("%s", gd.dfr_post_msg);
free((genericptr_t) gd.dfr_post_msg), gd.dfr_post_msg = 0;
}
}
@@ -1883,9 +1883,9 @@ schedule_goto(d_level *tolev, int utotype_flags,
assign_level(&u.utolev, tolev);
if (pre_msg)
g.dfr_pre_msg = dupstr(pre_msg);
gd.dfr_pre_msg = dupstr(pre_msg);
if (post_msg)
g.dfr_post_msg = dupstr(post_msg);
gd.dfr_post_msg = dupstr(post_msg);
}
/* handle something like portal ejection */
@@ -1898,8 +1898,8 @@ deferred_goto(void)
assign_level(&dest, &u.utolev);
assign_level(&oldlev, &u.uz);
if (g.dfr_pre_msg)
pline1(g.dfr_pre_msg);
if (gd.dfr_pre_msg)
pline1(gd.dfr_pre_msg);
goto_level(&dest, !!(typmask & UTOTYPE_ATSTAIRS),
!!(typmask & UTOTYPE_FALLING),
!!(typmask & UTOTYPE_PORTAL));
@@ -1911,14 +1911,14 @@ deferred_goto(void)
newsym(u.ux, u.uy);
}
}
if (g.dfr_post_msg && !on_level(&u.uz, &oldlev))
pline1(g.dfr_post_msg);
if (gd.dfr_post_msg && !on_level(&u.uz, &oldlev))
pline1(gd.dfr_post_msg);
}
u.utotype = UTOTYPE_NONE; /* our caller keys off of this */
if (g.dfr_pre_msg)
free((genericptr_t) g.dfr_pre_msg), g.dfr_pre_msg = 0;
if (g.dfr_post_msg)
free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0;
if (gd.dfr_pre_msg)
free((genericptr_t) gd.dfr_pre_msg), gd.dfr_pre_msg = 0;
if (gd.dfr_post_msg)
free((genericptr_t) gd.dfr_post_msg), gd.dfr_post_msg = 0;
}
/*
@@ -2089,7 +2089,7 @@ revive_mon(anything *arg, long timeout UNUSED)
if (!obj_has_timer(body, ROT_CORPSE))
You_feel("%sless hassled.", is_rider(mptr) ? "much " : "");
action = ROT_CORPSE;
when = (long) d(5, 50) - (g.moves - body->age);
when = (long) d(5, 50) - (gm.moves - body->age);
if (when < 1L)
when = 1L;
}
@@ -2105,7 +2105,7 @@ zombify_mon(anything *arg, long timeout)
struct obj *body = arg->a_obj;
int zmon = zombie_form(&mons[body->corpsenm]);
if (zmon != NON_PM && !(g.mvitals[zmon].mvflags & G_GENOD)) {
if (zmon != NON_PM && !(gm.mvitals[zmon].mvflags & G_GENOD)) {
if (has_omid(body))
free_omid(body);
if (has_omonst(body))
@@ -2122,7 +2122,7 @@ boolean
cmd_safety_prevention(const char *cmddesc, const char *act, int *flagcounter)
{
if (flags.safe_wait && !iflags.menu_requested
&& !g.multi && monster_nearby()) {
&& !gm.multi && monster_nearby()) {
char buf[QBUFSZ];
buf[0] = '\0';
@@ -2143,7 +2143,7 @@ donull(void)
{
if (cmd_safety_prevention("a no-op (to rest)",
"Are you waiting to get hit?",
&g.did_nothing_flag))
&gd.did_nothing_flag))
return ECMD_OK;
return ECMD_TIME; /* Do nothing, but let other things happen */
}
@@ -2219,7 +2219,7 @@ set_wounded_legs(long side, int timex)
* You still call this function, but don't lose hp.
* Caller is also responsible for adjusting messages.
*/
g.context.botl = 1;
gc.context.botl = 1;
if (!Wounded_legs)
ATEMP(A_DEX)--;
@@ -2239,7 +2239,7 @@ heal_legs(
int how) /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */
{
if (Wounded_legs) {
g.context.botl = 1;
gc.context.botl = 1;
if (ATEMP(A_DEX) < 0)
ATEMP(A_DEX)++;
+70 -70
View File
@@ -133,49 +133,49 @@ getpos_help(boolean force, const char *goal)
putstr(tmpwin, 0, sbuf);
putstr(tmpwin, 0, "Or enter a background symbol (ex. '<').");
Sprintf(sbuf, "Use '%s' to move the cursor on yourself.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_SELF]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_SELF]));
putstr(tmpwin, 0, sbuf);
if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) {
getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MON_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MON_PREV]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_MON_NEXT]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_MON_PREV]),
GLOC_MONS);
}
if (goal && !strcmp(goal, "a monster"))
goto skip_non_mons;
if (!iflags.terrainmode || (iflags.terrainmode & TER_OBJ) != 0) {
getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_OBJ_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_OBJ_PREV]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_OBJ_NEXT]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_OBJ_PREV]),
GLOC_OBJS);
}
if (!iflags.terrainmode || (iflags.terrainmode & TER_MAP) != 0) {
/* these are primarily useful when choosing a travel
destination for the '_' command */
getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_DOOR_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_DOOR_PREV]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_DOOR_NEXT]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_DOOR_PREV]),
GLOC_DOOR);
getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_UNEX_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_UNEX_PREV]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_UNEX_NEXT]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_UNEX_PREV]),
GLOC_EXPLORE);
getpos_help_keyxhelp(tmpwin,
visctrl(g.Cmd.spkeys[NHKF_GETPOS_INTERESTING_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_INTERESTING_PREV]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_INTERESTING_NEXT]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_INTERESTING_PREV]),
GLOC_INTERESTING);
}
Sprintf(sbuf, "Use '%s' to change fast-move mode to %s.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MOVESKIP]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_MOVESKIP]),
fastmovemode[!iflags.getloc_moveskip]);
putstr(tmpwin, 0, sbuf);
if (!iflags.terrainmode || (iflags.terrainmode & TER_DETECT) == 0) {
Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_MENU]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_MENU]));
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf,
"Use '%s' to change the mode of limiting possible targets.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]));
putstr(tmpwin, 0, sbuf);
}
if (!iflags.terrainmode) {
@@ -183,24 +183,24 @@ getpos_help(boolean force, const char *goal)
if (getpos_getvalid) {
Sprintf(sbuf, "Use '%s' or '%s' to move to valid locations.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_VALID_NEXT]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_VALID_PREV]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_VALID_NEXT]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_VALID_PREV]));
putstr(tmpwin, 0, sbuf);
}
if (getpos_hilitefunc) {
Sprintf(sbuf, "Use '%s' to display valid locations.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_SHOWVALID]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_SHOWVALID]));
putstr(tmpwin, 0, sbuf);
}
Sprintf(sbuf, "Use '%s' to toggle automatic description.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
putstr(tmpwin, 0, sbuf);
if (iflags.cmdassist) { /* assisting the '/' command, I suppose... */
Sprintf(sbuf,
(iflags.getpos_coords == GPCOORDS_NONE)
? "(Set 'whatis_coord' option to include coordinates with '%s' text.)"
: "(Reset 'whatis_coord' option to omit coordinates from '%s' text.)",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
}
skip_non_mons:
/* disgusting hack; the alternate selection characters work for any
@@ -209,12 +209,12 @@ getpos_help(boolean force, const char *goal)
doing_what_is = (goal == what_is_an_unknown_object);
if (doing_what_is) {
Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_Q]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_O]),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_V]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK_Q]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK_O]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK_V]));
} else {
Sprintf(kbuf, "'%s'", visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK]));
Sprintf(kbuf, "'%s'", visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK]));
}
Snprintf(sbuf, sizeof(sbuf),
"Type a %s when you are at the right place.", kbuf);
@@ -222,20 +222,20 @@ getpos_help(boolean force, const char *goal)
if (doing_what_is) {
Sprintf(sbuf,
" '%s' describe current spot, show 'more info', move to another spot.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_V]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK_V]));
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf,
" '%s' describe current spot,%s move to another spot;",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK]),
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK]),
flags.help && !force ? " prompt if 'more info'," : "");
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf,
" '%s' describe current spot, move to another spot;",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_Q]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK_Q]));
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf,
" '%s' describe current spot, stop looking at things;",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_O]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK_O]));
putstr(tmpwin, 0, sbuf);
}
}
@@ -275,7 +275,7 @@ cmp_coord_distu(const void *a, const void *b)
#define GLOC_SAME_AREA(x,y) \
(isok((x), (y)) \
&& (selection_getpoint((x),(y), g.gloc_filter_map)))
&& (selection_getpoint((x),(y), gg.gloc_filter_map)))
static int
gloc_filter_classify_glyph(int glyph)
@@ -308,11 +308,11 @@ gloc_filter_floodfill_matcharea(coordxy x, coordxy y)
if (!levl[x][y].seenv)
return FALSE;
if (glyph == g.gloc_filter_floodfill_match_glyph)
if (glyph == gg.gloc_filter_floodfill_match_glyph)
return TRUE;
if (gloc_filter_classify_glyph(glyph)
== gloc_filter_classify_glyph(g.gloc_filter_floodfill_match_glyph))
== gloc_filter_classify_glyph(gg.gloc_filter_floodfill_match_glyph))
return TRUE;
return FALSE;
@@ -321,18 +321,18 @@ gloc_filter_floodfill_matcharea(coordxy x, coordxy y)
static void
gloc_filter_floodfill(coordxy x, coordxy y)
{
g.gloc_filter_floodfill_match_glyph = back_to_glyph(x, y);
gg.gloc_filter_floodfill_match_glyph = back_to_glyph(x, y);
set_selection_floodfillchk(gloc_filter_floodfill_matcharea);
selection_floodfill(g.gloc_filter_map, x, y, FALSE);
selection_floodfill(gg.gloc_filter_map, x, y, FALSE);
}
static void
gloc_filter_init(void)
{
if (iflags.getloc_filter == GFILTER_AREA) {
if (!g.gloc_filter_map) {
g.gloc_filter_map = selection_new();
if (!gg.gloc_filter_map) {
gg.gloc_filter_map = selection_new();
}
/* special case: if we're in a doorway, try to figure out which
direction we're moving, and use that side of the doorway */
@@ -351,9 +351,9 @@ gloc_filter_init(void)
static void
gloc_filter_done(void)
{
if (g.gloc_filter_map) {
selection_free(g.gloc_filter_map, TRUE);
g.gloc_filter_map = (struct selectionvar *) 0;
if (gg.gloc_filter_map) {
selection_free(gg.gloc_filter_map, TRUE);
gg.gloc_filter_map = (struct selectionvar *) 0;
}
}
@@ -716,7 +716,7 @@ getpos(coord *ccp, boolean force, const char *goal)
/* temporary? if we have a queued direction, return the adjacent spot
in that direction */
if (!g.in_doagain) {
if (!gi.in_doagain) {
if ((cmdq = cmdq_pop()) != 0) {
cq = *cmdq;
free((genericptr_t) cmdq);
@@ -732,18 +732,18 @@ getpos(coord *ccp, boolean force, const char *goal)
}
for (i = 0; i < SIZE(pick_chars_def); i++)
pick_chars[i] = g.Cmd.spkeys[pick_chars_def[i].nhkf];
pick_chars[i] = gc.Cmd.spkeys[pick_chars_def[i].nhkf];
pick_chars[SIZE(pick_chars_def)] = '\0';
for (i = 0; i < SIZE(mMoOdDxX_def); i++)
mMoOdDxX[i] = g.Cmd.spkeys[mMoOdDxX_def[i]];
mMoOdDxX[i] = gc.Cmd.spkeys[mMoOdDxX_def[i]];
mMoOdDxX[SIZE(mMoOdDxX_def)] = '\0';
if (!goal)
goal = "desired location";
if (Verbose(0, getpos1)) {
pline("(For instructions type a '%s')",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_HELP]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_HELP]));
msg_given = TRUE;
}
cx = ccp->x;
@@ -769,7 +769,7 @@ getpos(coord *ccp, boolean force, const char *goal)
rushrun = FALSE;
g.program_state.getting_a_command = 1;
gp.program_state.getting_a_command = 1;
if ((cmdq = cmdq_pop()) != 0) {
if (cmdq->typ == CMDQ_KEY) {
c = cmdq->key;
@@ -784,7 +784,7 @@ getpos(coord *ccp, boolean force, const char *goal)
/* remember_getpos is normally False because reusing the
cursor positioning during ^A is almost never the right
thing to do, but caller could set it if that was needed */
if (iflags.remember_getpos && !g.in_doagain)
if (iflags.remember_getpos && !gi.in_doagain)
cmdq_add_key(CQ_REPEAT, c);
}
@@ -798,7 +798,7 @@ getpos(coord *ccp, boolean force, const char *goal)
if (iflags.autodescribe)
msg_given = FALSE;
if (c == g.Cmd.spkeys[NHKF_ESC]) {
if (c == gc.Cmd.spkeys[NHKF_ESC]) {
cx = cy = -10;
msg_given = TRUE; /* force clear */
result = -1;
@@ -851,15 +851,15 @@ getpos(coord *ccp, boolean force, const char *goal)
goto nxtc;
}
if (c == g.Cmd.spkeys[NHKF_GETPOS_HELP] || redraw_cmd(c)) {
if (c == g.Cmd.spkeys[NHKF_GETPOS_HELP])
if (c == gc.Cmd.spkeys[NHKF_GETPOS_HELP] || redraw_cmd(c)) {
if (c == gc.Cmd.spkeys[NHKF_GETPOS_HELP])
getpos_help(force, goal);
else /* ^R */
docrt(); /* redraw */
/* update message window to reflect that we're still targeting */
show_goal_msg = TRUE;
msg_given = TRUE;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_SHOWVALID]
} else if (c == gc.Cmd.spkeys[NHKF_GETPOS_SHOWVALID]
&& getpos_hilitefunc) {
if (!hilite_state) {
(*getpos_hilitefunc)(0);
@@ -867,7 +867,7 @@ getpos(coord *ccp, boolean force, const char *goal)
hilite_state = TRUE;
}
goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_AUTODESC]) {
} else if (c == gc.Cmd.spkeys[NHKF_GETPOS_AUTODESC]) {
iflags.autodescribe = !iflags.autodescribe;
pline("Automatic description %sis %s.",
Verbose(0, getpos2) ? "of features under cursor " : "",
@@ -876,7 +876,7 @@ getpos(coord *ccp, boolean force, const char *goal)
show_goal_msg = TRUE;
msg_given = TRUE;
goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]) {
} else if (c == gc.Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]) {
static const char *const view_filters[NUM_GFILTER] = {
"Not limiting targets",
"Limiting targets to those in sight",
@@ -894,7 +894,7 @@ getpos(coord *ccp, boolean force, const char *goal)
pline("%s.", view_filters[iflags.getloc_filter]);
msg_given = TRUE;
goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_MENU]) {
} else if (c == gc.Cmd.spkeys[NHKF_GETPOS_MENU]) {
iflags.getloc_usemenu = !iflags.getloc_usemenu;
pline("%s a menu to show possible targets%s.",
iflags.getloc_usemenu ? "Using" : "Not using",
@@ -902,7 +902,7 @@ getpos(coord *ccp, boolean force, const char *goal)
? " for 'm|M', 'o|O', 'd|D', and 'x|X'" : "");
msg_given = TRUE;
goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_SELF]) {
} else if (c == gc.Cmd.spkeys[NHKF_GETPOS_SELF]) {
/* reset 'm&M', 'o&O', &c; otherwise, there's no way for player
to achieve that except by manually cycling through all spots */
for (i = 0; i < NUM_GLOCS; i++)
@@ -910,7 +910,7 @@ getpos(coord *ccp, boolean force, const char *goal)
cx = u.ux;
cy = u.uy;
goto nxtc;
} else if (c == g.Cmd.spkeys[NHKF_GETPOS_MOVESKIP]) {
} else if (c == gc.Cmd.spkeys[NHKF_GETPOS_MOVESKIP]) {
iflags.getloc_moveskip = !iflags.getloc_moveskip;
pline("%skipping over similar terrain when fastmoving the cursor.",
iflags.getloc_moveskip ? "S" : "Not s");
@@ -957,7 +957,7 @@ getpos(coord *ccp, boolean force, const char *goal)
|| sidx == S_ndoor)
continue;
if (c == defsyms[sidx].sym
|| c == (int) g.showsyms[sidx]
|| c == (int) gs.showsyms[sidx]
/* have '^' match webs and vibrating square or any
other trap that uses something other than '^' */
|| (c == '^' && is_cmap_trap(sidx)))
@@ -981,7 +981,7 @@ getpos(coord *ccp, boolean force, const char *goal)
goto foundc;
/* next, try glyph that's remembered here
(might be trap or object) */
if (g.level.flags.hero_memory
if (gl.level.flags.hero_memory
/* !terrainmode: don't move to remembered
trap or object if not currently shown */
&& !iflags.terrainmode) {
@@ -991,7 +991,7 @@ getpos(coord *ccp, boolean force, const char *goal)
goto foundc;
}
/* last, try actual terrain here (shouldn't
we be using g.lastseentyp[][] instead?) */
we be using gl.lastseentyp[][] instead?) */
if (levl[tx][ty].seenv) {
k = back_to_glyph(tx, ty);
if (glyph_is_cmap(k)
@@ -1023,7 +1023,7 @@ getpos(coord *ccp, boolean force, const char *goal)
visctrl(cmd_from_func(do_move_south)),
visctrl(cmd_from_func(do_move_north)),
visctrl(cmd_from_func(do_move_east)),
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK]));
visctrl(gc.Cmd.spkeys[NHKF_GETPOS_PICK]));
pline("Unknown direction: '%s' (%s).", visctrl((char) c),
note);
msg_given = TRUE;
@@ -1229,7 +1229,7 @@ do_mgivenname(void)
mtmp = u.usteed;
} else {
pline("This %s creature is called %s and cannot be renamed.",
beautiful(), g.plname);
beautiful(), gp.plname);
return;
}
} else
@@ -1521,7 +1521,7 @@ docallcmd(void)
any.a_char = 'm'; /* group accelerator 'C' */
add_menu(win, &nul_glyphinfo, &any, abc ? 0 : any.a_char, 'C',
ATR_NONE, clr, "a monster", MENU_ITEMFLAGS_NONE);
if (g.invent) {
if (gi.invent) {
/* we use y and n as accelerators so that we can accept user's
response keyed to old "name an individual object?" prompt */
any.a_char = 'i'; /* group accelerator 'y' */
@@ -1692,7 +1692,7 @@ namefloorobj(void)
been moved off the hero's '@' yet, but there's no way to adjust
the help text once getpos() has started */
Sprintf(buf, "object on map (or '.' for one %s you)",
(u.uundetected && hides_under(g.youmonst.data))
(u.uundetected && hides_under(gy.youmonst.data))
? "over" : "under");
if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0)
return;
@@ -1724,9 +1724,9 @@ namefloorobj(void)
char tmpbuf[BUFSZ];
/* straight role name */
unames[0] = ((Upolyd ? u.mfemale : flags.female) && g.urole.name.f)
? g.urole.name.f
: g.urole.name.m;
unames[0] = ((Upolyd ? u.mfemale : flags.female) && gu.urole.name.f)
? gu.urole.name.f
: gu.urole.name.m;
/* random rank title for hero's role
note: the 30 is hardcoded in xlev_to_rank, so should be
@@ -1775,7 +1775,7 @@ const char *
rndghostname(void)
{
return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))]
: (const char *) g.plname;
: (const char *) gp.plname;
}
/*
@@ -1834,10 +1834,10 @@ x_monnam(
boolean name_at_start, has_adjectives, insertbuf2;
char *bp, buf2[BUFSZ];
if (mtmp == &g.youmonst)
if (mtmp == &gy.youmonst)
return strcpy(buf, "you"); /* ignore article, "invisible", &c */
if (g.program_state.gameover)
if (gp.program_state.gameover)
suppress |= SUPPRESS_HALLUCINATION;
if (article == ARTICLE_YOUR && !mtmp->mtame)
article = ARTICLE_THE;
@@ -1845,7 +1845,7 @@ x_monnam(
do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION);
do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE);
do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR
&& !g.program_state.gameover && mtmp != u.usteed
&& !gp.program_state.gameover && mtmp != u.usteed
&& !engulfing_u(mtmp) && !(suppress & SUPPRESS_IT);
do_saddle = !(suppress & SUPPRESS_SADDLE);
do_name = !(suppress & SUPPRESS_NAME) || type_is_pname(mdat);
@@ -2229,7 +2229,7 @@ minimal_monnam(struct monst *mon, boolean ckloc)
fmt_ptr((genericptr_t) mon->data),
fmt_ptr((genericptr_t) &mons[NUMMONS]));
} else if (ckloc && ptr == &mons[PM_LONG_WORM] && mon->mx
&& g.level.monsters[mon->mx][mon->my] != mon) {
&& gl.level.monsters[mon->mx][mon->my] != mon) {
Sprintf(outbuf, "%s <%d,%d>",
pmname(&mons[PM_LONG_WORM_TAIL], Mgender(mon)),
mon->mx, mon->my);
@@ -2250,7 +2250,7 @@ Mgender(struct monst *mtmp)
{
int mgender = MALE;
if (mtmp == &g.youmonst) {
if (mtmp == &gy.youmonst) {
if (Upolyd ? u.mfemale : flags.female)
mgender = FEMALE;
} else if (mtmp->female) {
@@ -2452,7 +2452,7 @@ const char *
hliquid(
const char *liquidpref) /* use as-is when not hallucintg (unless empty) */
{
boolean hallucinate = Hallucination && !g.program_state.gameover;
boolean hallucinate = Hallucination && !gp.program_state.gameover;
if (hallucinate || !liquidpref || !*liquidpref) {
int indx, count = SIZE(hliquids);
+156 -156
View File
@@ -92,7 +92,7 @@ toggle_stealth(
long oldprop, /* prop[].extrinsic, with obj->owornmask pre-stripped */
boolean on)
{
if (on ? g.initial_don : g.context.takeoff.cancelled_don)
if (on ? gi.initial_don : gc.context.takeoff.cancelled_don)
return;
if (!oldprop /* extrinsic stealth from something else */
@@ -127,7 +127,7 @@ toggle_displacement(struct obj *obj,
stripped by caller */
boolean on)
{
if (on ? g.initial_don : g.context.takeoff.cancelled_don)
if (on ? gi.initial_don : gc.context.takeoff.cancelled_don)
return;
if (!oldprop /* extrinsic displacement from something else */
@@ -200,7 +200,7 @@ Boots_on(void)
* so uarmf could be Null below; status line
* gets updated during brief interval they're
* worn so hero and player learn enchantment */
g.context.botl = 1; /* status hilites might mark AC changed */
gc.context.botl = 1; /* status hilites might mark AC changed */
makeknown(uarmf->otyp);
float_up();
if (Levitation)
@@ -224,14 +224,14 @@ Boots_off(void)
int otyp = otmp->otyp;
long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_BOOTS;
g.context.takeoff.mask &= ~W_ARMF;
gc.context.takeoff.mask &= ~W_ARMF;
/* For levitation, float_down() returns if Levitation, so we
* must do a setworn() _before_ the levitation case.
*/
setworn((struct obj *) 0, W_ARMF);
switch (otyp) {
case SPEED_BOOTS:
if (!Very_fast && !g.context.takeoff.cancelled_don) {
if (!Very_fast && !gc.context.takeoff.cancelled_don) {
makeknown(otyp);
You_feel("yourself slow down%s.", Fast ? " a bit" : "");
}
@@ -239,8 +239,8 @@ Boots_off(void)
case WATER_WALKING_BOOTS:
/* check for lava since fireproofed boots make it viable */
if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))
&& !Levitation && !Flying && !is_clinger(g.youmonst.data)
&& !g.context.takeoff.cancelled_don
&& !Levitation && !Flying && !is_clinger(gy.youmonst.data)
&& !gc.context.takeoff.cancelled_don
/* avoid recursive call to lava_effects() */
&& !iflags.in_lava_effects) {
/* make boots known in case you survive the drowning */
@@ -257,7 +257,7 @@ Boots_off(void)
break;
case LEVITATION_BOOTS:
if (!oldprop && !HLevitation && !(BLevitation & FROMOUTSIDE)
&& !g.context.takeoff.cancelled_don) {
&& !gc.context.takeoff.cancelled_don) {
(void) float_down(0L, 0L);
makeknown(otyp);
} else {
@@ -273,7 +273,7 @@ Boots_off(void)
default:
impossible(unknown_type, c_boots, otyp);
}
g.context.takeoff.cancelled_don = FALSE;
gc.context.takeoff.cancelled_don = FALSE;
return 0;
}
@@ -339,7 +339,7 @@ Cloak_off(void)
int otyp = otmp->otyp;
long oldprop = u.uprops[objects[otyp].oc_oprop].extrinsic & ~WORN_CLOAK;
g.context.takeoff.mask &= ~W_ARMC;
gc.context.takeoff.mask &= ~W_ARMC;
/* For mummy wrapping, taking it off first resets `Invisible'. */
setworn((struct obj *) 0, W_ARMC);
switch (otyp) {
@@ -403,7 +403,7 @@ Helmet_on(void)
but it takes trained arrogance to pull it off, and the actual
enchantment of the hat is irrelevant */
ABON(A_CHA) += (Role_if(PM_WIZARD) ? 1 : -1);
g.context.botl = 1;
gc.context.botl = 1;
makeknown(uarmh->otyp);
break;
case HELM_OF_OPPOSITE_ALIGNMENT:
@@ -435,7 +435,7 @@ Helmet_on(void)
else if (uarmh->bknown)
update_inventory(); /* keep bknown as-is; display the curse */
}
g.context.botl = 1; /* reveal new alignment or INT & WIS */
gc.context.botl = 1; /* reveal new alignment or INT & WIS */
if (Hallucination) {
pline("My brain hurts!"); /* Monty Python's Flying Circus */
} else if (uarmh && uarmh->otyp == DUNCE_CAP) {
@@ -461,7 +461,7 @@ Helmet_on(void)
int
Helmet_off(void)
{
g.context.takeoff.mask &= ~W_ARMH;
gc.context.takeoff.mask &= ~W_ARMH;
switch (uarmh->otyp) {
case FEDORA:
@@ -472,12 +472,12 @@ Helmet_off(void)
case ORCISH_HELM:
break;
case DUNCE_CAP:
g.context.botl = 1;
gc.context.botl = 1;
break;
case CORNUTHAUM:
if (!g.context.takeoff.cancelled_don) {
if (!gc.context.takeoff.cancelled_don) {
ABON(A_CHA) += (Role_if(PM_WIZARD) ? -1 : 1);
g.context.botl = 1;
gc.context.botl = 1;
}
break;
case HELM_OF_TELEPATHY:
@@ -486,7 +486,7 @@ Helmet_off(void)
see_monsters();
return 0;
case HELM_OF_BRILLIANCE:
if (!g.context.takeoff.cancelled_don)
if (!gc.context.takeoff.cancelled_don)
adj_abon(uarmh, -uarmh->spe);
break;
case HELM_OF_OPPOSITE_ALIGNMENT:
@@ -499,7 +499,7 @@ Helmet_off(void)
impossible(unknown_type, c_helmet, uarmh->otyp);
}
setworn((struct obj *) 0, W_ARMH);
g.context.takeoff.cancelled_don = FALSE;
gc.context.takeoff.cancelled_don = FALSE;
return 0;
}
@@ -518,7 +518,7 @@ Gloves_on(void)
break;
case GAUNTLETS_OF_POWER:
makeknown(uarmg->otyp);
g.context.botl = 1; /* taken care of in attrib.c */
gc.context.botl = 1; /* taken care of in attrib.c */
break;
case GAUNTLETS_OF_DEXTERITY:
adj_abon(uarmg, uarmg->spe);
@@ -577,9 +577,9 @@ Gloves_off(void)
struct obj *gloves = uarmg; /* needed after uarmg has been set to Null */
long oldprop =
u.uprops[objects[uarmg->otyp].oc_oprop].extrinsic & ~WORN_GLOVES;
boolean on_purpose = !g.context.mon_moving && !uarmg->in_use;
boolean on_purpose = !gc.context.mon_moving && !uarmg->in_use;
g.context.takeoff.mask &= ~W_ARMG;
gc.context.takeoff.mask &= ~W_ARMG;
switch (uarmg->otyp) {
case LEATHER_GLOVES:
@@ -590,17 +590,17 @@ Gloves_off(void)
break;
case GAUNTLETS_OF_POWER:
makeknown(uarmg->otyp);
g.context.botl = 1; /* taken care of in attrib.c */
gc.context.botl = 1; /* taken care of in attrib.c */
break;
case GAUNTLETS_OF_DEXTERITY:
if (!g.context.takeoff.cancelled_don)
if (!gc.context.takeoff.cancelled_don)
adj_abon(uarmg, -uarmg->spe);
break;
default:
impossible(unknown_type, c_gloves, uarmg->otyp);
}
setworn((struct obj *) 0, W_ARMG);
g.context.takeoff.cancelled_don = FALSE;
gc.context.takeoff.cancelled_don = FALSE;
(void) encumber_msg(); /* immediate feedback for GoP */
/* usually can't remove gloves when they're slippery but it can
@@ -625,7 +625,7 @@ Gloves_off(void)
wielding_corpse(uswapwep, gloves, on_purpose);
if (condtests[bl_bareh].enabled)
g.context.botl = 1;
gc.context.botl = 1;
return 0;
}
@@ -657,7 +657,7 @@ Shield_on(void)
int
Shield_off(void)
{
g.context.takeoff.mask &= ~W_ARMS;
gc.context.takeoff.mask &= ~W_ARMS;
/* no shield currently requires special handling when taken off, but we
keep this uncommented in case somebody adds a new one which does */
@@ -698,7 +698,7 @@ Shirt_on(void)
int
Shirt_off(void)
{
g.context.takeoff.mask &= ~W_ARMU;
gc.context.takeoff.mask &= ~W_ARMU;
/* no shirt currently requires special handling when taken off, but we
keep this uncommented in case somebody adds a new one which does */
@@ -743,7 +743,7 @@ dragon_armor_handling(
EFast |= W_ARM;
} else {
EFast &= ~W_ARM;
if (!Very_fast && !g.context.takeoff.cancelled_don)
if (!Very_fast && !gc.context.takeoff.cancelled_don)
pline("You slow down.");
}
break;
@@ -767,7 +767,7 @@ dragon_armor_handling(
case GOLD_DRAGON_SCALES:
case GOLD_DRAGON_SCALE_MAIL:
(void) make_hallucinated((long) !puton,
g.program_state.restoring ? FALSE : TRUE,
gp.program_state.restoring ? FALSE : TRUE,
W_ARM);
break;
case ORANGE_DRAGON_SCALES:
@@ -830,9 +830,9 @@ Armor_off(void)
struct obj *otmp = uarm;
boolean was_arti_light = otmp && otmp->lamplit && artifact_light(otmp);
g.context.takeoff.mask &= ~W_ARM;
gc.context.takeoff.mask &= ~W_ARM;
setworn((struct obj *) 0, W_ARM);
g.context.takeoff.cancelled_don = FALSE;
gc.context.takeoff.cancelled_don = FALSE;
/* taking off yellow dragon scales/mail might be fatal; arti_light
comes from gold dragon scales/mail so they don't overlap, but
@@ -860,9 +860,9 @@ Armor_gone(void)
struct obj *otmp = uarm;
boolean was_arti_light = otmp && otmp->lamplit && artifact_light(otmp);
g.context.takeoff.mask &= ~W_ARM;
gc.context.takeoff.mask &= ~W_ARM;
setnotworn(uarm);
g.context.takeoff.cancelled_don = FALSE;
gc.context.takeoff.cancelled_don = FALSE;
/* losing yellow dragon scales/mail might be fatal; arti_light
comes from gold dragon scales/mail so they don't overlap, but
@@ -914,7 +914,7 @@ Amulet_on(void)
makeknown(AMULET_OF_CHANGE);
You("are suddenly very %s!",
flags.female ? "feminine" : "masculine");
g.context.botl = 1;
gc.context.botl = 1;
newsym(u.ux, u.uy); /* glyphmon flag and tile may have gone
* from male to female or vice versa */
} else {
@@ -930,10 +930,10 @@ Amulet_on(void)
break;
}
case AMULET_OF_STRANGULATION:
if (can_be_strangled(&g.youmonst)) {
if (can_be_strangled(&gy.youmonst)) {
makeknown(AMULET_OF_STRANGULATION);
Strangled = 6L;
g.context.botl = TRUE;
gc.context.botl = TRUE;
pline("It constricts your throat!");
}
break;
@@ -960,7 +960,7 @@ Amulet_on(void)
if (!already_flying) {
makeknown(AMULET_OF_FLYING);
g.context.botl = TRUE; /* status: 'Fly' On */
gc.context.botl = TRUE; /* status: 'Fly' On */
You("are now in flight.");
}
}
@@ -977,7 +977,7 @@ Amulet_on(void)
void
Amulet_off(void)
{
g.context.takeoff.mask &= ~W_AMUL;
gc.context.takeoff.mask &= ~W_AMUL;
switch (uamul->otyp) {
case AMULET_OF_ESP:
@@ -997,7 +997,7 @@ Amulet_off(void)
/* HMagical_breathing must be set off
before calling drown() */
setworn((struct obj *) 0, W_AMUL);
if (!breathless(g.youmonst.data) && !amphibious(g.youmonst.data)
if (!breathless(gy.youmonst.data) && !amphibious(gy.youmonst.data)
&& !Swimming) {
You("suddenly inhale an unhealthy amount of %s!",
hliquid("water"));
@@ -1009,7 +1009,7 @@ Amulet_off(void)
case AMULET_OF_STRANGULATION:
if (Strangled) {
Strangled = 0L;
g.context.botl = TRUE;
gc.context.botl = TRUE;
if (Breathless)
Your("%s is no longer constricted!", body_part(NECK));
else
@@ -1030,7 +1030,7 @@ Amulet_off(void)
float_vs_flight(); /* probably not needed here */
if (was_flying && !Flying) {
makeknown(AMULET_OF_FLYING);
g.context.botl = TRUE; /* status: 'Fly' Off */
gc.context.botl = TRUE; /* status: 'Fly' Off */
You("%s.", (is_pool_or_lava(u.ux, u.uy)
|| Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
? "stop flying"
@@ -1096,7 +1096,7 @@ adjust_attrib(struct obj *obj, int which, int val)
already discovered, both handled by learnring()] */
if (observable || !extremeattr(which))
learnring(obj, observable);
g.context.botl = 1;
gc.context.botl = 1;
}
void
@@ -1208,7 +1208,7 @@ Ring_off_or_gone(register struct obj *obj, boolean gone)
long mask = (obj->owornmask & W_RING);
boolean observable;
g.context.takeoff.mask &= ~mask;
gc.context.takeoff.mask &= ~mask;
if (!(u.uprops[objects[obj->otyp].oc_oprop].extrinsic & mask))
impossible("Strange... I didn't know you had that ring.");
if (gone)
@@ -1362,7 +1362,7 @@ Blindf_off(struct obj *otmp)
impossible("Blindf_off without eyewear?");
return;
}
g.context.takeoff.mask &= ~W_TOOL;
gc.context.takeoff.mask &= ~W_TOOL;
setworn((struct obj *) 0, otmp->owornmask);
if (!nooffmsg)
off_msg(otmp);
@@ -1398,7 +1398,7 @@ void
set_wear(struct obj *obj) /* if null, do all worn items;
otherwise just obj itself */
{
g.initial_don = !obj;
gi.initial_don = !obj;
if (!obj ? ublindf != 0 : (obj == ublindf))
(void) Blindf_on(ublindf);
@@ -1424,7 +1424,7 @@ set_wear(struct obj *obj) /* if null, do all worn items;
if (!obj ? uarms != 0 : (obj == uarms))
(void) Shield_on();
g.initial_don = FALSE;
gi.initial_don = FALSE;
}
/* check whether the target object is currently being put on (or taken off--
@@ -1434,23 +1434,23 @@ donning(struct obj *otmp)
{
boolean result = FALSE;
/* 'W' (or 'P' used for armor) sets g.afternmv */
/* 'W' (or 'P' used for armor) sets ga.afternmv */
if (doffing(otmp))
result = TRUE;
else if (otmp == uarm)
result = (g.afternmv == Armor_on);
result = (ga.afternmv == Armor_on);
else if (otmp == uarmu)
result = (g.afternmv == Shirt_on);
result = (ga.afternmv == Shirt_on);
else if (otmp == uarmc)
result = (g.afternmv == Cloak_on);
result = (ga.afternmv == Cloak_on);
else if (otmp == uarmf)
result = (g.afternmv == Boots_on);
result = (ga.afternmv == Boots_on);
else if (otmp == uarmh)
result = (g.afternmv == Helmet_on);
result = (ga.afternmv == Helmet_on);
else if (otmp == uarmg)
result = (g.afternmv == Gloves_on);
result = (ga.afternmv == Gloves_on);
else if (otmp == uarms)
result = (g.afternmv == Shield_on);
result = (ga.afternmv == Shield_on);
return result;
}
@@ -1461,25 +1461,25 @@ donning(struct obj *otmp)
boolean
doffing(struct obj *otmp)
{
long what = g.context.takeoff.what;
long what = gc.context.takeoff.what;
boolean result = FALSE;
/* 'T' (or 'R' used for armor) sets g.afternmv, 'A' sets takeoff.what */
/* 'T' (or 'R' used for armor) sets ga.afternmv, 'A' sets takeoff.what */
if (otmp == uarm)
result = (g.afternmv == Armor_off || what == WORN_ARMOR);
result = (ga.afternmv == Armor_off || what == WORN_ARMOR);
else if (otmp == uarmu)
result = (g.afternmv == Shirt_off || what == WORN_SHIRT);
result = (ga.afternmv == Shirt_off || what == WORN_SHIRT);
else if (otmp == uarmc)
result = (g.afternmv == Cloak_off || what == WORN_CLOAK);
result = (ga.afternmv == Cloak_off || what == WORN_CLOAK);
else if (otmp == uarmf)
result = (g.afternmv == Boots_off || what == WORN_BOOTS);
result = (ga.afternmv == Boots_off || what == WORN_BOOTS);
else if (otmp == uarmh)
result = (g.afternmv == Helmet_off || what == WORN_HELMET);
result = (ga.afternmv == Helmet_off || what == WORN_HELMET);
else if (otmp == uarmg)
result = (g.afternmv == Gloves_off || what == WORN_GLOVES);
result = (ga.afternmv == Gloves_off || what == WORN_GLOVES);
else if (otmp == uarms)
result = (g.afternmv == Shield_off || what == WORN_SHIELD);
/* these 1-turn items don't need 'g.afternmv' checks */
result = (ga.afternmv == Shield_off || what == WORN_SHIELD);
/* these 1-turn items don't need 'ga.afternmv' checks */
else if (otmp == uamul)
result = (what == WORN_AMUL);
else if (otmp == uleft)
@@ -1512,9 +1512,9 @@ cancel_doff(struct obj *obj, long slotmask)
* matter whether cancel_don() gets called here--the item has already
* been removed by now.]
*/
if (!(g.context.takeoff.mask & I_SPECIAL) && donning(obj))
if (!(gc.context.takeoff.mask & I_SPECIAL) && donning(obj))
cancel_don(); /* applies to doffing too */
g.context.takeoff.mask &= ~slotmask;
gc.context.takeoff.mask &= ~slotmask;
}
/* despite their names, cancel_don() and cancel_doff() both apply to both
@@ -1526,14 +1526,14 @@ cancel_don(void)
* wasting time on it (and don't dereference it when donning would
* otherwise finish)
*/
g.context.takeoff.cancelled_don =
(g.afternmv == Boots_on || g.afternmv == Helmet_on
|| g.afternmv == Gloves_on || g.afternmv == Armor_on);
g.afternmv = (int (*)(void)) 0;
g.nomovemsg = (char *) 0;
g.multi = 0;
g.context.takeoff.delay = 0;
g.context.takeoff.what = 0L;
gc.context.takeoff.cancelled_don =
(ga.afternmv == Boots_on || ga.afternmv == Helmet_on
|| ga.afternmv == Gloves_on || ga.afternmv == Armor_on);
ga.afternmv = (int (*)(void)) 0;
gn.nomovemsg = (char *) 0;
gm.multi = 0;
gc.context.takeoff.delay = 0;
gc.context.takeoff.what = 0L;
}
/* called by steal() during theft from hero; interrupt donning/doffing */
@@ -1546,7 +1546,7 @@ stop_donning(struct obj *stolenobj) /* no message if stolenobj is already
boolean putting_on;
int result = 0;
for (otmp = g.invent; otmp; otmp = otmp->nobj)
for (otmp = gi.invent; otmp; otmp = otmp->nobj)
if ((otmp->owornmask & W_ARMOR) && donning(otmp))
break;
/* at most one item will pass donning() test at any given time */
@@ -1559,14 +1559,14 @@ stop_donning(struct obj *stolenobj) /* no message if stolenobj is already
cancel_don();
/* don't want <armor>_on() or <armor>_off() being called
by unmul() since the on or off action isn't completing */
g.afternmv = (int (*)(void)) 0;
ga.afternmv = (int (*)(void)) 0;
if (putting_on || otmp != stolenobj) {
Sprintf(buf, "You stop %s %s.",
putting_on ? "putting on" : "taking off",
thesimpleoname(otmp));
} else {
buf[0] = '\0'; /* silently stop doffing stolenobj */
result = (int) -g.multi; /* remember this before calling unmul() */
result = (int) -gm.multi; /* remember this before calling unmul() */
}
unmul(buf);
/* while putting on, item becomes worn immediately but side-effects are
@@ -1651,7 +1651,7 @@ armor_or_accessory_off(struct obj *obj)
reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
(void) select_off(obj);
if (!g.context.takeoff.mask)
if (!gc.context.takeoff.mask)
return ECMD_OK;
/* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */
reset_remarm();
@@ -1766,35 +1766,35 @@ armoroff(struct obj *otmp)
delays and which didn't; now both are handled for all types */
if (delay) {
nomul(delay);
g.multi_reason = "disrobing";
gm.multi_reason = "disrobing";
switch (objects[otmp->otyp].oc_armcat) {
case ARM_SUIT:
what = suit_simple_name(otmp);
g.afternmv = Armor_off;
ga.afternmv = Armor_off;
break;
case ARM_SHIELD:
what = shield_simple_name(otmp);
g.afternmv = Shield_off;
ga.afternmv = Shield_off;
break;
case ARM_HELM:
what = helm_simple_name(otmp);
g.afternmv = Helmet_off;
ga.afternmv = Helmet_off;
break;
case ARM_GLOVES:
what = gloves_simple_name(otmp);
g.afternmv = Gloves_off;
ga.afternmv = Gloves_off;
break;
case ARM_BOOTS:
what = boots_simple_name(otmp);
g.afternmv = Boots_off;
ga.afternmv = Boots_off;
break;
case ARM_CLOAK:
what = cloak_simple_name(otmp);
g.afternmv = Cloak_off;
ga.afternmv = Cloak_off;
break;
case ARM_SHIRT:
what = shirt_simple_name(otmp);
g.afternmv = Shirt_off;
ga.afternmv = Shirt_off;
break;
default:
impossible("Taking off unknown armor (%d: %d), delay %d",
@@ -1804,7 +1804,7 @@ armoroff(struct obj *otmp)
if (what) {
/* sizeof offdelaybuf == 60; increase it if this becomes longer */
Sprintf(offdelaybuf, "You finish taking off your %s.", what);
g.nomovemsg = offdelaybuf;
gn.nomovemsg = offdelaybuf;
}
} else {
/* no delay so no '(*afternmv)()' or 'nomovemsg' */
@@ -1839,7 +1839,7 @@ armoroff(struct obj *otmp)
avoid "You were wearing ____ (being worn)." */
off_msg(otmp);
}
g.context.takeoff.mask = g.context.takeoff.what = 0L;
gc.context.takeoff.mask = gc.context.takeoff.what = 0L;
return 1;
}
@@ -1870,7 +1870,7 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
/* this is the same check as for 'W' (dowear), but different message,
in case we get here via 'P' (doputon) */
if (verysmall(g.youmonst.data) || nohands(g.youmonst.data)) {
if (verysmall(gy.youmonst.data) || nohands(gy.youmonst.data)) {
if (noisy)
You("can't wear any armor in your current form.");
return 0;
@@ -1880,13 +1880,13 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
: is_shirt(otmp) ? c_shirt
: is_suit(otmp) ? c_suit
: 0;
if (which && cantweararm(g.youmonst.data)
if (which && cantweararm(gy.youmonst.data)
/* same exception for cloaks as used in m_dowear() */
&& (which != c_cloak
|| ((otmp->otyp != MUMMY_WRAPPING)
? g.youmonst.data->msize != MZ_SMALL
: !WrappingAllowed(g.youmonst.data)))
&& (racial_exception(&g.youmonst, otmp) < 1)) {
? gy.youmonst.data->msize != MZ_SMALL
: !WrappingAllowed(gy.youmonst.data)))
&& (racial_exception(&gy.youmonst, otmp) < 1)) {
if (noisy)
pline_The("%s will not fit on your body.", which);
return 0;
@@ -1908,12 +1908,12 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
if (noisy)
already_wearing(an(helm_simple_name(uarmh)));
err++;
} else if (Upolyd && has_horns(g.youmonst.data) && !is_flimsy(otmp)) {
} else if (Upolyd && has_horns(gy.youmonst.data) && !is_flimsy(otmp)) {
/* (flimsy exception matches polyself handling) */
if (noisy)
pline_The("%s won't fit over your horn%s.",
helm_simple_name(otmp),
plur(num_horns(g.youmonst.data)));
plur(num_horns(gy.youmonst.data)));
err++;
} else
*mask = W_ARMH;
@@ -1940,11 +1940,11 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy)
if (noisy)
already_wearing(c_boots);
err++;
} else if (Upolyd && slithy(g.youmonst.data)) {
} else if (Upolyd && slithy(gy.youmonst.data)) {
if (noisy)
You("have no feet..."); /* not body_part(FOOT) */
err++;
} else if (Upolyd && g.youmonst.data->mlet == S_CENTAUR) {
} else if (Upolyd && gy.youmonst.data->mlet == S_CENTAUR) {
/* break_armor() pushes boots off for centaurs,
so don't let dowear() put them back on... */
if (noisy)
@@ -2068,7 +2068,7 @@ accessory_or_armor_on(struct obj *obj)
You("are suddenly overcome with shame and change your mind.");
u.ublessed = 0; /* lose your god's protection */
makeknown(obj->otyp);
g.context.botl = 1; /*for AC after zeroing u.ublessed */
gc.context.botl = 1; /*for AC after zeroing u.ublessed */
return ECMD_TIME;
}
} else {
@@ -2086,13 +2086,13 @@ accessory_or_armor_on(struct obj *obj)
char answer, qbuf[QBUFSZ];
int res = 0;
if (nolimbs(g.youmonst.data)) {
if (nolimbs(gy.youmonst.data)) {
You("cannot make the ring stick to your body.");
return ECMD_OK;
}
if (uleft && uright) {
There("are no more %s%s to fill.",
humanoid(g.youmonst.data) ? "ring-" : "",
humanoid(gy.youmonst.data) ? "ring-" : "",
fingers_or_gloves(FALSE));
return ECMD_OK;
}
@@ -2103,7 +2103,7 @@ accessory_or_armor_on(struct obj *obj)
} else {
do {
Sprintf(qbuf, "Which %s%s, Right or Left?",
humanoid(g.youmonst.data) ? "ring-" : "",
humanoid(gy.youmonst.data) ? "ring-" : "",
body_part(FINGER));
answer = yn_function(qbuf, "rl", '\0', TRUE);
switch (answer) {
@@ -2154,7 +2154,7 @@ accessory_or_armor_on(struct obj *obj)
return ECMD_OK;
}
} else if (eyewear) {
if (!has_head(g.youmonst.data)) {
if (!has_head(gy.youmonst.data)) {
You("have no head to wear %s on.", ansimpleoname(obj));
return ECMD_OK;
}
@@ -2208,32 +2208,32 @@ accessory_or_armor_on(struct obj *obj)
setworn(obj, mask);
/* if there's no delay, we'll execute 'afternmv' immediately */
if (obj == uarm)
g.afternmv = Armor_on;
ga.afternmv = Armor_on;
else if (obj == uarmh)
g.afternmv = Helmet_on;
ga.afternmv = Helmet_on;
else if (obj == uarmg)
g.afternmv = Gloves_on;
ga.afternmv = Gloves_on;
else if (obj == uarmf)
g.afternmv = Boots_on;
ga.afternmv = Boots_on;
else if (obj == uarms)
g.afternmv = Shield_on;
ga.afternmv = Shield_on;
else if (obj == uarmc)
g.afternmv = Cloak_on;
ga.afternmv = Cloak_on;
else if (obj == uarmu)
g.afternmv = Shirt_on;
ga.afternmv = Shirt_on;
else
panic("wearing armor not worn as armor? [%08lx]", obj->owornmask);
delay = -objects[obj->otyp].oc_delay;
if (delay) {
nomul(delay);
g.multi_reason = "dressing up";
g.nomovemsg = "You finish your dressing maneuver.";
gm.multi_reason = "dressing up";
gn.nomovemsg = "You finish your dressing maneuver.";
} else {
unmul(""); /* call afternmv, clear it+nomovemsg+multi_reason */
on_msg(obj);
}
g.context.takeoff.mask = g.context.takeoff.what = 0L;
gc.context.takeoff.mask = gc.context.takeoff.what = 0L;
} else { /* not armor */
boolean give_feedback = FALSE;
@@ -2267,7 +2267,7 @@ dowear(void)
/* cantweararm() checks for suits of armor, not what we want here;
verysmall() or nohands() checks for shields, gloves, etc... */
if (verysmall(g.youmonst.data) || nohands(g.youmonst.data)) {
if (verysmall(gy.youmonst.data) || nohands(gy.youmonst.data)) {
pline("Don't even bother.");
return ECMD_OK;
}
@@ -2291,7 +2291,7 @@ doputon(void)
&& uarm && uarmu && uarmc && uarmh && uarms && uarmg && uarmf) {
/* 'P' message doesn't mention armor */
Your("%s%s are full, and you're already wearing an amulet and %s.",
humanoid(g.youmonst.data) ? "ring-" : "",
humanoid(gy.youmonst.data) ? "ring-" : "",
fingers_or_gloves(FALSE),
(ublindf->otyp == LENSES) ? "some lenses" : "a blindfold");
return ECMD_OK;
@@ -2339,7 +2339,7 @@ find_ac(void)
if (uac != u.uac) {
u.uac = uac;
g.context.botl = 1;
gc.context.botl = 1;
#if 0
/* these could conceivably be achieved out of order (by being near
threshold and putting on +N dragon scale mail from bones, for
@@ -2367,7 +2367,7 @@ glibr(void)
leftfall = (uleft && !uleft->cursed
&& (!uwep || !welded(uwep) || !bimanual(uwep)));
rightfall = (uright && !uright->cursed && (!welded(uwep)));
if (!uarmg && (leftfall || rightfall) && !nolimbs(g.youmonst.data)) {
if (!uarmg && (leftfall || rightfall) && !nolimbs(gy.youmonst.data)) {
/* changed so cursed rings don't fall off, GAN 10/30/86 */
Your("%s off your %s.",
(leftfall && rightfall) ? "rings slip" : "ring slips",
@@ -2452,22 +2452,22 @@ some_armor(struct monst *victim)
{
register struct obj *otmph, *otmp;
otmph = (victim == &g.youmonst) ? uarmc : which_armor(victim, W_ARMC);
otmph = (victim == &gy.youmonst) ? uarmc : which_armor(victim, W_ARMC);
if (!otmph)
otmph = (victim == &g.youmonst) ? uarm : which_armor(victim, W_ARM);
otmph = (victim == &gy.youmonst) ? uarm : which_armor(victim, W_ARM);
if (!otmph)
otmph = (victim == &g.youmonst) ? uarmu : which_armor(victim, W_ARMU);
otmph = (victim == &gy.youmonst) ? uarmu : which_armor(victim, W_ARMU);
otmp = (victim == &g.youmonst) ? uarmh : which_armor(victim, W_ARMH);
otmp = (victim == &gy.youmonst) ? uarmh : which_armor(victim, W_ARMH);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
otmp = (victim == &g.youmonst) ? uarmg : which_armor(victim, W_ARMG);
otmp = (victim == &gy.youmonst) ? uarmg : which_armor(victim, W_ARMG);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
otmp = (victim == &g.youmonst) ? uarmf : which_armor(victim, W_ARMF);
otmp = (victim == &gy.youmonst) ? uarmf : which_armor(victim, W_ARMF);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
otmp = (victim == &g.youmonst) ? uarms : which_armor(victim, W_ARMS);
otmp = (victim == &gy.youmonst) ? uarms : which_armor(victim, W_ARMS);
if (otmp && (!otmph || !rn2(4)))
otmph = otmp;
return otmph;
@@ -2485,7 +2485,7 @@ stuck_ring(struct obj *ring, int otyp)
if (ring && ring->otyp == otyp) {
/* reasons ring can't be removed match those checked by select_off();
limbless case has extra checks because ordinarily it's temporary */
if (nolimbs(g.youmonst.data) && uamul
if (nolimbs(gy.youmonst.data) && uamul
&& uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
return uamul;
if (welded(uwep) && (ring == uright || bimanual(uwep)))
@@ -2527,7 +2527,7 @@ select_off(register struct obj *otmp)
if (otmp == uright || otmp == uleft) {
struct obj glibdummy;
if (nolimbs(g.youmonst.data)) {
if (nolimbs(gy.youmonst.data)) {
pline_The("ring is stuck.");
return 0;
}
@@ -2605,33 +2605,33 @@ select_off(register struct obj *otmp)
}
if (otmp == uarm)
g.context.takeoff.mask |= WORN_ARMOR;
gc.context.takeoff.mask |= WORN_ARMOR;
else if (otmp == uarmc)
g.context.takeoff.mask |= WORN_CLOAK;
gc.context.takeoff.mask |= WORN_CLOAK;
else if (otmp == uarmf)
g.context.takeoff.mask |= WORN_BOOTS;
gc.context.takeoff.mask |= WORN_BOOTS;
else if (otmp == uarmg)
g.context.takeoff.mask |= WORN_GLOVES;
gc.context.takeoff.mask |= WORN_GLOVES;
else if (otmp == uarmh)
g.context.takeoff.mask |= WORN_HELMET;
gc.context.takeoff.mask |= WORN_HELMET;
else if (otmp == uarms)
g.context.takeoff.mask |= WORN_SHIELD;
gc.context.takeoff.mask |= WORN_SHIELD;
else if (otmp == uarmu)
g.context.takeoff.mask |= WORN_SHIRT;
gc.context.takeoff.mask |= WORN_SHIRT;
else if (otmp == uleft)
g.context.takeoff.mask |= LEFT_RING;
gc.context.takeoff.mask |= LEFT_RING;
else if (otmp == uright)
g.context.takeoff.mask |= RIGHT_RING;
gc.context.takeoff.mask |= RIGHT_RING;
else if (otmp == uamul)
g.context.takeoff.mask |= WORN_AMUL;
gc.context.takeoff.mask |= WORN_AMUL;
else if (otmp == ublindf)
g.context.takeoff.mask |= WORN_BLINDF;
gc.context.takeoff.mask |= WORN_BLINDF;
else if (otmp == uwep)
g.context.takeoff.mask |= W_WEP;
gc.context.takeoff.mask |= W_WEP;
else if (otmp == uswapwep)
g.context.takeoff.mask |= W_SWAPWEP;
gc.context.takeoff.mask |= W_SWAPWEP;
else if (otmp == uquiver)
g.context.takeoff.mask |= W_QUIVER;
gc.context.takeoff.mask |= W_QUIVER;
else
impossible("select_off: %s???", doname(otmp));
@@ -2644,9 +2644,9 @@ do_takeoff(void)
{
struct obj *otmp = (struct obj *) 0;
boolean was_twoweap = u.twoweap;
struct takeoff_info *doff = &g.context.takeoff;
struct takeoff_info *doff = &gc.context.takeoff;
g.context.takeoff.mask |= I_SPECIAL; /* set flag for cancel_doff() */
gc.context.takeoff.mask |= I_SPECIAL; /* set flag for cancel_doff() */
if (doff->what == W_WEP) {
if (!cursed(uwep)) {
setuwep((struct obj *) 0);
@@ -2709,7 +2709,7 @@ do_takeoff(void)
} else {
impossible("do_takeoff: taking off %lx", doff->what);
}
g.context.takeoff.mask &= ~I_SPECIAL; /* clear cancel_doff() flag */
gc.context.takeoff.mask &= ~I_SPECIAL; /* clear cancel_doff() flag */
return otmp;
}
@@ -2720,7 +2720,7 @@ take_off(void)
{
register int i;
register struct obj *otmp;
struct takeoff_info *doff = &g.context.takeoff;
struct takeoff_info *doff = &gc.context.takeoff;
if (doff->what) {
if (doff->delay > 0) {
@@ -2809,8 +2809,8 @@ take_off(void)
void
reset_remarm(void)
{
g.context.takeoff.what = g.context.takeoff.mask = 0L;
g.context.takeoff.disrobing[0] = '\0';
gc.context.takeoff.what = gc.context.takeoff.mask = 0L;
gc.context.takeoff.disrobing[0] = '\0';
}
/* the #takeoffall command -- remove multiple worn items */
@@ -2819,9 +2819,9 @@ doddoremarm(void)
{
int result = 0;
if (g.context.takeoff.what || g.context.takeoff.mask) {
You("continue %s.", g.context.takeoff.disrobing);
set_occupation(take_off, g.context.takeoff.disrobing, 0);
if (gc.context.takeoff.what || gc.context.takeoff.mask) {
You("continue %s.", gc.context.takeoff.disrobing);
set_occupation(take_off, gc.context.takeoff.disrobing, 0);
return ECMD_OK;
} else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf
&& !uleft && !uright && !wearing_armor()) {
@@ -2835,9 +2835,9 @@ doddoremarm(void)
(unsigned *) 0)) < -1)
result = menu_remarm(result);
if (g.context.takeoff.mask) {
(void) strncpy(g.context.takeoff.disrobing,
(((g.context.takeoff.mask & ~W_WEAPONS) != 0)
if (gc.context.takeoff.mask) {
(void) strncpy(gc.context.takeoff.disrobing,
(((gc.context.takeoff.mask & ~W_WEAPONS) != 0)
/* default activity for armor and/or accessories,
possibly combined with weapons */
? "disrobing"
@@ -2877,7 +2877,7 @@ remarm_swapwep(void)
* can't be unwielded even though things
* don't work that way... */
reset_remarm();
g.context.takeoff.what = g.context.takeoff.mask = W_SWAPWEP;
gc.context.takeoff.what = gc.context.takeoff.mask = W_SWAPWEP;
(void) do_takeoff();
return (!uswapwep || uswapwep->bknown != oldbknown) ? ECMD_TIME : ECMD_OK;
}
@@ -2894,7 +2894,7 @@ menu_remarm(int retry)
} else if (flags.menu_style == MENU_FULL) {
all_worn_categories = FALSE;
n = query_category("What type of things do you want to take off?",
g.invent, (WORN_TYPES | ALL_TYPES
gi.invent, (WORN_TYPES | ALL_TYPES
| UNPAID_TYPES | BUCX_TYPES),
&pick_list, PICK_ANY);
if (!n)
@@ -2919,7 +2919,7 @@ menu_remarm(int retry)
|| menu_class_present('C') || menu_class_present('X'))
all_worn_categories = FALSE;
n = query_objlist("What do you want to take off?", &g.invent,
n = query_objlist("What do you want to take off?", &gi.invent,
(SIGNAL_NOMENU | USE_INVLET | INVORDER_SORT),
&pick_list, PICK_ANY,
all_worn_categories ? is_worn : is_worn_by_type);
@@ -3024,7 +3024,7 @@ adj_abon(register struct obj *otmp, register schar delta)
makeknown(uarmg->otyp);
ABON(A_DEX) += (delta);
}
g.context.botl = 1;
gc.context.botl = 1;
}
if (uarmh && uarmh == otmp && otmp->otyp == HELM_OF_BRILLIANCE) {
if (delta) {
@@ -3032,7 +3032,7 @@ adj_abon(register struct obj *otmp, register schar delta)
ABON(A_INT) += (delta);
ABON(A_WIS) += (delta);
}
g.context.botl = 1;
gc.context.botl = 1;
}
}
+47 -47
View File
@@ -52,7 +52,7 @@ initedog(struct monst *mtmp)
EDOG(mtmp)->dropdist = 10000;
EDOG(mtmp)->apport = ACURR(A_CHA);
EDOG(mtmp)->whistletime = 0;
EDOG(mtmp)->hungrytime = 1000 + g.moves;
EDOG(mtmp)->hungrytime = 1000 + gm.moves;
EDOG(mtmp)->ogoal.x = -1; /* force error if used before set */
EDOG(mtmp)->ogoal.y = -1;
EDOG(mtmp)->abuse = 0;
@@ -64,11 +64,11 @@ initedog(struct monst *mtmp)
static int
pet_type(void)
{
if (g.urole.petnum != NON_PM)
return g.urole.petnum;
else if (g.preferred_pet == 'c')
if (gu.urole.petnum != NON_PM)
return gu.urole.petnum;
else if (gp.preferred_pet == 'c')
return PM_KITTEN;
else if (g.preferred_pet == 'd')
else if (gp.preferred_pet == 'd')
return PM_LITTLE_DOG;
else
return rn2(2) ? PM_KITTEN : PM_LITTLE_DOG;
@@ -91,7 +91,7 @@ make_familiar(struct obj *otmp, coordxy x, coordxy y, boolean quietly)
/* activating a figurine provides one way to exceed the
maximum number of the target critter created--unless
it has a special limit (erinys, Nazgul) */
if ((g.mvitals[mndx].mvflags & G_EXTINCT)
if ((gm.mvitals[mndx].mvflags & G_EXTINCT)
&& mbirth_limit(mndx) != MAXMONNO) {
if (!quietly)
/* have just been given "You <do something with>
@@ -168,16 +168,16 @@ makedog(void)
const char *petname;
int pettype;
if (g.preferred_pet == 'n')
if (gp.preferred_pet == 'n')
return ((struct monst *) 0);
pettype = pet_type();
if (pettype == PM_LITTLE_DOG)
petname = g.dogname;
petname = gd.dogname;
else if (pettype == PM_PONY)
petname = g.horsename;
petname = gh.horsename;
else
petname = g.catname;
petname = gc.catname;
/* default pet names */
if (!*petname && pettype == PM_LITTLE_DOG) {
@@ -197,14 +197,14 @@ makedog(void)
if (!mtmp)
return ((struct monst *) 0); /* pets were genocided */
g.context.startingpet_mid = mtmp->m_id;
gc.context.startingpet_mid = mtmp->m_id;
/* Horses already wear a saddle */
if (pettype == PM_PONY && !!(otmp = mksobj(SADDLE, TRUE, FALSE))) {
otmp->dknown = otmp->bknown = otmp->rknown = 1;
put_saddle_on_mon(otmp, mtmp);
}
if (!g.petname_used++ && *petname)
if (!gp.petname_used++ && *petname)
mtmp = christen_monst(mtmp, petname);
initedog(mtmp);
@@ -214,7 +214,7 @@ makedog(void)
static void
set_mon_lastmove(struct monst *mtmp)
{
mtmp->mlstmv = g.moves;
mtmp->mlstmv = gm.moves;
}
/* record `last move time' for all monsters prior to level save so that
@@ -236,8 +236,8 @@ losedogs(void)
failed_arrivals = 0;
/*
* First, scan g.migrating_mons for shopkeepers who want to dismiss Kops,
* and scan g.mydogs for shopkeepers who want to retain kops.
* First, scan gm.migrating_mons for shopkeepers who want to dismiss Kops,
* and scan gm.mydogs for shopkeepers who want to retain kops.
* Second, dismiss kops if warranted, making more room for arrival.
* Third, replace monsters who went onto migrating_mons in order to
* be accessible from other levels but didn't actually leave the level.
@@ -251,7 +251,7 @@ losedogs(void)
*/
/* check for returning shk(s) */
for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon) {
for (mtmp = gm.migrating_mons; mtmp; mtmp = mtmp->nmon) {
if (mtmp->mux != u.uz.dnum || mtmp->muy != u.uz.dlevel)
continue;
if (mtmp->isshk) {
@@ -267,11 +267,11 @@ losedogs(void)
}
}
}
/* make the same check for g.mydogs */
for (mtmp = g.mydogs; mtmp && dismissKops >= 0; mtmp = mtmp->nmon) {
/* make the same check for gm.mydogs */
for (mtmp = gm.mydogs; mtmp && dismissKops >= 0; mtmp = mtmp->nmon) {
if (mtmp->isshk) {
/* hostile shk might accompany hero [ESHK(mtmp)->dismiss_kops
can't be set here; it's only used for g.migrating_mons] */
can't be set here; it's only used for gm.migrating_mons] */
if (!mtmp->mpeaceful)
dismissKops = -1;
}
@@ -290,7 +290,7 @@ losedogs(void)
should always be able to arrive because they were present on the
level at the time the hero left [if they can't arrive for some
reason, mon_arrive() will put them on the 'failed_arrivals' list] */
for (mprev = &g.migrating_mons; (mtmp = *mprev) != 0; ) {
for (mprev = &gm.migrating_mons; (mtmp = *mprev) != 0; ) {
xyloc = mtmp->mtrack[0].x; /* (for legibility) */
if (mtmp->mux == u.uz.dnum && mtmp->muy == u.uz.dlevel
&& xyloc == MIGR_EXACT_XY) {
@@ -306,8 +306,8 @@ losedogs(void)
any that fail to arrive (level may be full) will be moved
first to failed_arrivals, then to migrating_mons scheduled
to arrive back on this level if hero leaves and returns */
while ((mtmp = g.mydogs) != 0) {
g.mydogs = mtmp->nmon;
while ((mtmp = gm.mydogs) != 0) {
gm.mydogs = mtmp->nmon;
mon_arrive(mtmp, With_you);
}
@@ -315,7 +315,7 @@ losedogs(void)
this level but fail to arrive get put on the failed_arrivals list
temporarily [by mon_arrive()], then back onto the migrating_mons
list below */
for (mprev = &g.migrating_mons; (mtmp = *mprev) != 0; ) {
for (mprev = &gm.migrating_mons; (mtmp = *mprev) != 0; ) {
xyloc = mtmp->mtrack[0].x;
if (mtmp->mux == u.uz.dnum && mtmp->muy == u.uz.dlevel
&& xyloc != MIGR_EXACT_XY) {
@@ -408,9 +408,9 @@ mon_arrive(struct monst *mtmp, int when)
* specify its final destination.
*/
if (mtmp->mlstmv < g.moves - 1L) {
if (mtmp->mlstmv < gm.moves - 1L) {
/* heal monster for time spent in limbo */
long nmv = g.moves - 1L - mtmp->mlstmv;
long nmv = gm.moves - 1L - mtmp->mlstmv;
mon_catchup_elapsed_time(mtmp, nmv);
@@ -465,12 +465,12 @@ mon_arrive(struct monst *mtmp, int when)
that we know that the current endgame levels always
build upwards and never have any exclusion subregion
inside their TELEPORT_REGION settings. */
xlocale = rn1(g.updest.hx - g.updest.lx + 1, g.updest.lx);
ylocale = rn1(g.updest.hy - g.updest.ly + 1, g.updest.ly);
xlocale = rn1(gu.updest.hx - gu.updest.lx + 1, gu.updest.lx);
ylocale = rn1(gu.updest.hy - gu.updest.ly + 1, gu.updest.ly);
break;
}
/* find the arrival portal */
for (t = g.ftrap; t; t = t->ntrap)
for (t = gf.ftrap; t; t = t->ntrap)
if (t->ttyp == MAGIC_PORTAL)
break;
if (t) {
@@ -488,7 +488,7 @@ mon_arrive(struct monst *mtmp, int when)
if ((mtmp->migflags & MIGR_LEFTOVERS) != 0L) {
/* Pick up the rest of the MIGR_TO_SPECIES objects */
if (g.migrating_objs)
if (gm.migrating_objs)
deliver_obj_to_mon(mtmp, 0, DF_ALL);
}
@@ -501,7 +501,7 @@ mon_arrive(struct monst *mtmp, int when)
coord c;
/* somexy() handles irregular rooms */
if (somexy(&g.rooms[*r - ROOMOFFSET], &c))
if (somexy(&gr.rooms[*r - ROOMOFFSET], &c))
xlocale = c.x, ylocale = c.y;
else
xlocale = ylocale = 0;
@@ -612,8 +612,8 @@ mon_catchup_elapsed_time(
&& (carnivorous(mtmp->data) || herbivorous(mtmp->data))) {
struct edog *edog = EDOG(mtmp);
if ((g.moves > edog->hungrytime + 500 && mtmp->mhp < 3)
|| (g.moves > edog->hungrytime + 750))
if ((gm.moves > edog->hungrytime + 500 && mtmp->mhp < 3)
|| (gm.moves > edog->hungrytime + 750))
mtmp->mtame = mtmp->mpeaceful = 0;
}
@@ -772,10 +772,10 @@ keepdogs(
/* prepare to take mtmp off the map */
num_segs = mon_leave(mtmp);
/* take off map and move mtmp from fmon list to mydogs */
relmon(mtmp, &g.mydogs); /* mtmp->mx,my retain current value */
relmon(mtmp, &gm.mydogs); /* mtmp->mx,my retain current value */
mtmp->mx = mtmp->my = 0; /* mx==0 implies migating */
mtmp->wormno = num_segs;
mtmp->mlstmv = g.moves;
mtmp->mlstmv = gm.moves;
} else if (keep_mon_accessible(mtmp)) {
/* we want to be able to find the Wizard when his next
resurrection chance comes up, but have him resume his
@@ -815,7 +815,7 @@ migrate_to_level(
/* prepare to take mtmp off the map */
num_segs = mon_leave(mtmp);
/* take off map and move mtmp from fmon list to migrating_mons */
relmon(mtmp, &g.migrating_mons); /* mtmp->mx,my retain their value */
relmon(mtmp, &gm.migrating_mons); /* mtmp->mx,my retain their value */
mtmp->mstate |= MON_MIGRATING;
new_lev.dnum = ledger_to_dnum((xint16) tolev);
@@ -826,7 +826,7 @@ migrate_to_level(
if (In_W_tower(mx, my, &u.uz))
xyflags |= 2;
mtmp->wormno = num_segs;
mtmp->mlstmv = g.moves;
mtmp->mlstmv = gm.moves;
mtmp->mtrack[2].x = u.uz.dnum; /* migrating from this dungeon */
mtmp->mtrack[2].y = u.uz.dlevel; /* migrating from this dungeon level */
mtmp->mtrack[1].x = cc ? cc->x : mx;
@@ -853,7 +853,7 @@ discard_migrations(void)
struct obj *otmp, **oprev;
d_level dest;
for (mprev = &g.migrating_mons; (mtmp = *mprev) != 0; ) {
for (mprev = &gm.migrating_mons; (mtmp = *mprev) != 0; ) {
dest.dnum = mtmp->mux;
dest.dlevel = mtmp->muy;
/* the Wizard is kept regardless of location so that he is
@@ -871,7 +871,7 @@ discard_migrations(void)
}
/* objects get similar treatment */
for (oprev = &g.migrating_objs; (otmp = *oprev) != 0; ) {
for (oprev = &gm.migrating_objs; (otmp = *oprev) != 0; ) {
dest.dnum = otmp->ox;
dest.dlevel = otmp->oy;
/* there is no special case like the Wizard (certainly not the
@@ -937,7 +937,7 @@ dogfood(struct monst *mon, struct obj *obj)
when starving; they never eat stone-to-flesh'd meat */
if (mptr == &mons[PM_GHOUL]) {
if (obj->otyp == CORPSE)
return (peek_at_iced_corpse_age(obj) + 50L <= g.moves
return (peek_at_iced_corpse_age(obj) + 50L <= gm.moves
&& fptr != &mons[PM_LIZARD]
&& fptr != &mons[PM_LICHEN])
? DOGFOOD
@@ -959,7 +959,7 @@ dogfood(struct monst *mon, struct obj *obj)
case EGG:
return carni ? CADAVER : MANFOOD;
case CORPSE:
if ((peek_at_iced_corpse_age(obj) + 50L <= g.moves
if ((peek_at_iced_corpse_age(obj) + 50L <= gm.moves
&& obj->corpsenm != PM_LIZARD && obj->corpsenm != PM_LICHEN
&& mptr->mlet != S_FUNGUS)
|| (acidic(fptr) && !resists_acid(mon))
@@ -1058,7 +1058,7 @@ tamedog(struct monst *mtmp, struct obj *obj)
if (mtmp == u.ustuck) {
if (u.uswallow)
expels(mtmp, mtmp->data, TRUE);
else if (!(Upolyd && sticks(g.youmonst.data)))
else if (!(Upolyd && sticks(gy.youmonst.data)))
unstuck(mtmp);
}
@@ -1069,7 +1069,7 @@ tamedog(struct monst *mtmp, struct obj *obj)
if (mtmp->mcanmove && !mtmp->mconf && !mtmp->meating
&& ((tasty = dogfood(mtmp, obj)) == DOGFOOD
|| (tasty <= ACCFOOD
&& EDOG(mtmp)->hungrytime <= g.moves))) {
&& EDOG(mtmp)->hungrytime <= gm.moves))) {
/* pet will "catch" and eat this thrown food */
if (canseemon(mtmp)) {
boolean big_corpse =
@@ -1109,11 +1109,11 @@ tamedog(struct monst *mtmp, struct obj *obj)
with each other anymore] */
|| mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion
|| is_covetous(mtmp->data) || is_human(mtmp->data)
|| (is_demon(mtmp->data) && !is_demon(g.youmonst.data))
|| (is_demon(mtmp->data) && !is_demon(gy.youmonst.data))
|| (obj && dogfood(mtmp, obj) >= MANFOOD))
return FALSE;
if (mtmp->m_id == g.quest_status.leader_m_id)
if (mtmp->m_id == gq.quest_status.leader_m_id)
return FALSE;
/* add the pet extension */
@@ -1169,7 +1169,7 @@ wary_dog(struct monst *mtmp, boolean was_dead)
if (!rn2(edog->abuse + 1))
mtmp->mpeaceful = 1;
if (!quietly && cansee(mtmp->mx, mtmp->my)) {
if (haseyes(g.youmonst.data)) {
if (haseyes(gy.youmonst.data)) {
if (haseyes(mtmp->data))
pline("%s %s to look you in the %s.", Monnam(mtmp),
mtmp->mpeaceful ? "seems unable" : "refuses",
@@ -1202,8 +1202,8 @@ wary_dog(struct monst *mtmp, boolean was_dead)
edog->killed_by_u = 0;
edog->abuse = 0;
edog->ogoal.x = edog->ogoal.y = -1;
if (was_dead || edog->hungrytime < g.moves + 500L)
edog->hungrytime = g.moves + 500L;
if (was_dead || edog->hungrytime < gm.moves + 500L)
edog->hungrytime = gm.moves + 500L;
if (was_dead) {
edog->droptime = 0L;
edog->dropdist = 10000;
+57 -57
View File
@@ -144,7 +144,7 @@ cursed_object_at(coordxy x, coordxy y)
{
struct obj *otmp;
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
if (otmp->cursed)
return TRUE;
return FALSE;
@@ -226,8 +226,8 @@ dog_eat(struct monst *mtmp,
char objnambuf[BUFSZ], *obj_name;
objnambuf[0] = '\0';
if (edog->hungrytime < g.moves)
edog->hungrytime = g.moves;
if (edog->hungrytime < gm.moves)
edog->hungrytime = gm.moves;
nutrit = dog_nutrition(mtmp, obj);
deadmimic = (obj->otyp == CORPSE && (obj->corpsenm == PM_SMALL_MIMIC
@@ -312,7 +312,7 @@ dog_eat(struct monst *mtmp,
/* It's a reward if it's DOGFOOD and the player dropped/threw it.
We know the player had it if invlet is set. -dlc */
if (dogfood(mtmp, obj) == DOGFOOD && obj->invlet)
edog->apport += (int) (200L / ((long) edog->dropdist + g.moves
edog->apport += (int) (200L / ((long) edog->dropdist + gm.moves
- edog->droptime));
if (mtmp->data == &mons[PM_RUST_MONSTER] && obj->oerodeproof) {
/* The object's rustproofing is gone now */
@@ -393,9 +393,9 @@ dog_starve(struct monst *mtmp)
static boolean
dog_hunger(struct monst *mtmp, struct edog *edog)
{
if (g.moves > edog->hungrytime + DOG_WEAK) {
if (gm.moves > edog->hungrytime + DOG_WEAK) {
if (!carnivorous(mtmp->data) && !herbivorous(mtmp->data)) {
edog->hungrytime = g.moves + DOG_WEAK;
edog->hungrytime = gm.moves + DOG_WEAK;
/* but not too high; it might polymorph */
} else if (!edog->mhpmax_penalty) {
/* starving pets are limited in healing */
@@ -416,7 +416,7 @@ dog_hunger(struct monst *mtmp, struct edog *edog)
else
You_feel("worried about %s.", y_monnam(mtmp));
stop_occupation();
} else if (g.moves > edog->hungrytime + DOG_STARVE
} else if (gm.moves > edog->hungrytime + DOG_STARVE
|| DEADMONSTER(mtmp)) {
dog_starve(mtmp);
return TRUE;
@@ -451,10 +451,10 @@ dog_invent(struct monst *mtmp, struct edog *edog, int udist)
if (edog->apport > 1)
edog->apport--;
edog->dropdist = udist; /* hpscdi!jon */
edog->droptime = g.moves;
edog->droptime = gm.moves;
}
} else {
if ((obj = g.level.objects[omx][omy]) != 0
if ((obj = gl.level.objects[omx][omy]) != 0
&& !strchr(nofetch, obj->oclass)
#ifdef MAIL_STRUCTURES
&& obj->otyp != SCR_MAIL
@@ -530,17 +530,17 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
dog_has_minvent = (droppables(mtmp) != 0);
if (!edog || mtmp->mleashed) { /* he's not going anywhere... */
g.gtyp = APPORT;
g.gx = u.ux;
g.gy = u.uy;
gg.gtyp = APPORT;
gg.gx = u.ux;
gg.gy = u.uy;
} else {
#define DDIST(x, y) (dist2(x, y, omx, omy))
#define SQSRCHRADIUS 5
int min_x, max_x, min_y, max_y;
coordxy nx, ny;
g.gtyp = UNDEF; /* no goal as yet */
g.gx = g.gy = 0; /* suppress 'used before set' message */
gg.gtyp = UNDEF; /* no goal as yet */
gg.gx = gg.gy = 0; /* suppress 'used before set' message */
if ((min_x = omx - SQSRCHRADIUS) < 1)
min_x = 1;
@@ -558,7 +558,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
if (nx >= min_x && nx <= max_x && ny >= min_y && ny <= max_y) {
otyp = dogfood(mtmp, obj);
/* skip inferior goals */
if (otyp > g.gtyp || otyp == UNDEF)
if (otyp > gg.gtyp || otyp == UNDEF)
continue;
/* avoid cursed items unless starving */
if (cursed_object_at(nx, ny)
@@ -569,31 +569,31 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
|| !can_reach_location(mtmp, mtmp->mx, mtmp->my, nx, ny))
continue;
if (otyp < MANFOOD) {
if (otyp < g.gtyp || DDIST(nx, ny) < DDIST(g.gx, g.gy)) {
g.gx = nx;
g.gy = ny;
g.gtyp = otyp;
if (otyp < gg.gtyp || DDIST(nx, ny) < DDIST(gg.gx, gg.gy)) {
gg.gx = nx;
gg.gy = ny;
gg.gtyp = otyp;
}
} else if (g.gtyp == UNDEF && in_masters_sight
} else if (gg.gtyp == UNDEF && in_masters_sight
&& !dog_has_minvent
&& (!levl[omx][omy].lit || levl[u.ux][u.uy].lit)
&& (otyp == MANFOOD || m_cansee(mtmp, nx, ny))
&& edog->apport > rn2(8)
&& can_carry(mtmp, obj) > 0) {
g.gx = nx;
g.gy = ny;
g.gtyp = APPORT;
gg.gx = nx;
gg.gy = ny;
gg.gtyp = APPORT;
}
}
}
}
/* follow player if appropriate */
if (g.gtyp == UNDEF || (g.gtyp != DOGFOOD && g.gtyp != APPORT
&& g.moves < edog->hungrytime)) {
g.gx = u.ux;
g.gy = u.uy;
if (after && udist <= 4 && u_at(g.gx, g.gy))
if (gg.gtyp == UNDEF || (gg.gtyp != DOGFOOD && gg.gtyp != APPORT
&& gm.moves < edog->hungrytime)) {
gg.gx = u.ux;
gg.gy = u.uy;
if (after && udist <= 4 && u_at(gg.gx, gg.gy))
return -2;
appr = (udist >= 9) ? 1 : (mtmp->mflee) ? -1 : 0;
if (udist > 1) {
@@ -608,7 +608,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
if (On_stairs(u.ux, u.uy)) {
appr = 1;
} else {
for (obj = g.invent; obj; obj = obj->nobj)
for (obj = gi.invent; obj; obj = obj->nobj)
if (dogfood(mtmp, obj) == DOGFOOD) {
appr = 1;
break;
@@ -618,7 +618,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
/* assume at most one magic portal per level;
[should this be limited to known portals?] */
for (t = g.ftrap; t; t = t->ntrap)
for (t = gf.ftrap; t; t = t->ntrap)
if (t->ttyp == MAGIC_PORTAL) {
if (/*t->tseen &&*/ distu(t->tx, t->ty) <= 2)
appr = 1;
@@ -633,34 +633,34 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
appr = 0;
#define FARAWAY (COLNO + 2) /* position outside screen */
if (u_at(g.gx, g.gy) && !in_masters_sight) {
if (u_at(gg.gx, gg.gy) && !in_masters_sight) {
register coord *cp;
cp = gettrack(omx, omy);
if (cp) {
g.gx = cp->x;
g.gy = cp->y;
gg.gx = cp->x;
gg.gy = cp->y;
if (edog)
edog->ogoal.x = 0;
} else {
/* assume master hasn't moved far, and reuse previous goal */
if (edog && edog->ogoal.x
&& (edog->ogoal.x != omx || edog->ogoal.y != omy)) {
g.gx = edog->ogoal.x;
g.gy = edog->ogoal.y;
gg.gx = edog->ogoal.x;
gg.gy = edog->ogoal.y;
edog->ogoal.x = 0;
} else {
int fardist = FARAWAY * FARAWAY;
g.gx = g.gy = FARAWAY; /* random */
gg.gx = gg.gy = FARAWAY; /* random */
do_clear_area(omx, omy, 9, wantdoor, (genericptr_t) &fardist);
/* here gx == FARAWAY e.g. when dog is in a vault */
if (g.gx == FARAWAY || (g.gx == omx && g.gy == omy)) {
g.gx = u.ux;
g.gy = u.uy;
if (gg.gx == FARAWAY || (gg.gx == omx && gg.gy == omy)) {
gg.gx = u.ux;
gg.gy = u.uy;
} else if (edog) {
edog->ogoal.x = g.gx;
edog->ogoal.y = g.gy;
edog->ogoal.x = gg.gx;
edog->ogoal.y = gg.gy;
}
}
}
@@ -696,7 +696,7 @@ find_targ(register struct monst *mtmp, int dx, int dy, int maxdist)
break;
if (curx == mtmp->mux && cury == mtmp->muy)
return &g.youmonst;
return &gy.youmonst;
if ((targ = m_at(curx, cury)) != 0) {
/* Is the monster visible to the pet? */
@@ -798,7 +798,7 @@ score_targ(struct monst *mtmp, struct monst *mtarg)
return score;
}
/* Is the monster peaceful or tame? */
if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == &g.youmonst) {
if (/*mtarg->mpeaceful ||*/ mtarg->mtame || mtarg == &gy.youmonst) {
/* Pets will never be targeted */
score -= 3000L;
return score;
@@ -929,7 +929,7 @@ dog_move(register struct monst *mtmp,
int chi = -1, nidist, ndist;
coord poss[9];
long info[9], allowflags;
#define GDIST(x, y) (dist2(x, y, g.gx, g.gy))
#define GDIST(x, y) (dist2(x, y, gg.gx, gg.gy))
/*
* Tame Angels have isminion set and an ispriest structure instead of
@@ -969,7 +969,7 @@ dog_move(register struct monst *mtmp,
else if (j == 1)
goto newdogpos; /* eating something */
whappr = (g.moves - edog->whistletime < 5);
whappr = (gm.moves - edog->whistletime < 5);
} else
whappr = 0;
@@ -989,7 +989,7 @@ dog_move(register struct monst *mtmp,
}
#if 0 /* [this is now handled in dochug()] */
if (!Conflict && !mtmp->mconf
&& mtmp == u.ustuck && !sticks(g.youmonst.data)) {
&& mtmp == u.ustuck && !sticks(gy.youmonst.data)) {
unstuck(mtmp); /* swallowed case handled above */
You("get released!");
}
@@ -1013,7 +1013,7 @@ dog_move(register struct monst *mtmp,
}
better_with_displacing = should_displace(mtmp, poss, info, cnt,
g.gx, g.gy);
gg.gx, gg.gy);
chcnt = 0;
chi = -1;
@@ -1067,7 +1067,7 @@ dog_move(register struct monst *mtmp,
if (after)
return MMOVE_NOTHING; /* hit only once each move */
g.notonhead = 0;
gn.notonhead = 0;
mstatus = mattackm(mtmp, mtmp2);
/* aggressor (pet) died */
@@ -1075,7 +1075,7 @@ dog_move(register struct monst *mtmp,
return MMOVE_DIED;
if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4)
&& mtmp2->mlstmv != g.moves
&& mtmp2->mlstmv != gm.moves
&& !onscary(mtmp->mx, mtmp->my, mtmp2)
/* monnear check needed: long worms hit on tail */
&& monnear(mtmp2, mtmp->mx, mtmp->my)) {
@@ -1124,13 +1124,13 @@ dog_move(register struct monst *mtmp,
/* (minion isn't interested; `cursemsg' stays FALSE) */
if (has_edog) {
boolean can_reach_food = could_reach_item(mtmp, nx, ny);
for (obj = g.level.objects[nx][ny]; obj; obj = obj->nexthere) {
for (obj = gl.level.objects[nx][ny]; obj; obj = obj->nexthere) {
if (obj->cursed) {
cursemsg[i] = TRUE;
} else if (can_reach_food
&& (otyp = dogfood(mtmp, obj)) < MANFOOD
&& (otyp < ACCFOOD
|| edog->hungrytime <= g.moves)) {
|| edog->hungrytime <= gm.moves)) {
/* Note: our dog likes the food so much that he
* might eat it even when it conceals a cursed object */
nix = nx;
@@ -1188,7 +1188,7 @@ dog_move(register struct monst *mtmp,
if (!mtmp->isminion) {
struct edog *dog = EDOG(mtmp);
hungry = (g.moves > (dog->hungrytime + DOG_HUNGRY));
hungry = (gm.moves > (dog->hungrytime + DOG_HUNGRY));
}
/* Identify the best target in a straight line from the pet;
@@ -1200,7 +1200,7 @@ dog_move(register struct monst *mtmp,
if (mtarg && (!hungry || !rn2(5))) {
int mstatus = MM_MISS;
if (mtarg == &g.youmonst) {
if (mtarg == &gy.youmonst) {
if (mattacku(mtmp))
return MMOVE_DIED;
/* Treat this as the pet having initiated an attack even if it
@@ -1222,7 +1222,7 @@ dog_move(register struct monst *mtmp,
* nothing will happen.
*/
if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED)
&& rn2(4) && mtarg != &g.youmonst) {
&& rn2(4) && mtarg != &gy.youmonst) {
/* Can monster see? If it can, it can retaliate
* even if the pet is invisible, since it'll see
@@ -1277,7 +1277,7 @@ dog_move(register struct monst *mtmp,
/* describe top item of pile, not necessarily cursed item itself;
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 */
struct obj *o = (!Hallucination && g.level.flags.hero_memory
struct obj *o = (!Hallucination && gl.level.flags.hero_memory
&& glyph_is_object(levl[nix][niy].glyph))
? vobj_at(nix, niy) : 0;
const char *what = o ? distant_name(o, doname) : something;
@@ -1391,8 +1391,8 @@ wantdoor(coordxy x, coordxy y, genericptr_t distance)
int ndist, *dist_ptr = (int *) distance;
if (*dist_ptr > (ndist = distu(x, y))) {
g.gx = x;
g.gy = y;
gg.gx = x;
gg.gy = y;
*dist_ptr = ndist;
}
}
+177 -177
View File
@@ -6,10 +6,10 @@
#define is_bigfoot(x) ((x) == &mons[PM_SASQUATCH])
#define martial() \
(martial_bonus() || is_bigfoot(g.youmonst.data) \
(martial_bonus() || is_bigfoot(gy.youmonst.data) \
|| (uarmf && uarmf->otyp == KICKING_BOOTS))
/* g.kickedobj (decl.c) tracks a kicked object until placed or destroyed */
/* gk.kickedobj (decl.c) tracks a kicked object until placed or destroyed */
static void kickdmg(struct monst *, boolean);
static boolean maybe_kick_monster(struct monst *, coordxy, coordxy);
@@ -50,7 +50,7 @@ kickdmg(struct monst *mon, boolean clumsy)
if (mon->data == &mons[PM_SHADE])
dmg = 0;
specialdmg = special_dmgval(&g.youmonst, mon, W_ARMF, (long *) 0);
specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF, (long *) 0);
if (mon->data == &mons[PM_SHADE] && !specialdmg) {
pline_The("%s.", kick_passes_thru);
@@ -123,18 +123,18 @@ static boolean
maybe_kick_monster(struct monst *mon, coordxy x, coordxy y)
{
if (mon) {
boolean save_forcefight = g.context.forcefight;
boolean save_forcefight = gc.context.forcefight;
g.bhitpos.x = x;
g.bhitpos.y = y;
gb.bhitpos.x = x;
gb.bhitpos.y = y;
if (!mon->mpeaceful || !canspotmon(mon))
g.context.forcefight = TRUE; /* attack even if invisible */
gc.context.forcefight = TRUE; /* attack even if invisible */
/* kicking might be halted by discovery of hidden monster,
by player declining to attack peaceful monster,
or by passing out due to encumbrance */
if (attack_checks(mon, (struct obj *) 0) || overexertion())
mon = 0; /* don't kick after all */
g.context.forcefight = save_forcefight;
gc.context.forcefight = save_forcefight;
}
return (boolean) (mon != 0);
}
@@ -177,7 +177,7 @@ kick_monster(struct monst *mon, coordxy x, coordxy y)
* normally, getting all your attacks _including_ all your kicks.
* If you have >1 kick attack, you get all of them.
*/
if (Upolyd && attacktype(g.youmonst.data, AT_KICK)) {
if (Upolyd && attacktype(gy.youmonst.data, AT_KICK)) {
struct attack *uattk;
int sum, kickdieroll, armorpenalty, specialdmg,
attknum = 0,
@@ -188,16 +188,16 @@ kick_monster(struct monst *mon, coordxy x, coordxy y)
for (i = 0; i < NATTK; i++) {
/* first of two kicks might have provoked counterattack
that has incapacitated the hero (ie, floating eye) */
if (g.multi < 0)
if (gm.multi < 0)
break;
uattk = &g.youmonst.data->mattk[i];
uattk = &gy.youmonst.data->mattk[i];
/* we only care about kicking attacks here */
if (uattk->aatyp != AT_KICK)
continue;
kickdieroll = rnd(20);
specialdmg = special_dmgval(&g.youmonst, mon, W_ARMF, (long *) 0);
specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF, (long *) 0);
if (mon->data == &mons[PM_SHADE] && !specialdmg) {
/* doesn't matter whether it would have hit or missed,
and shades have no passive counterattack */
@@ -340,7 +340,7 @@ ghitm(register struct monst *mtmp, register struct obj *gold)
else
verbalize("Thanks, scum!");
} else if (mtmp->isgd) {
umoney = money_cnt(g.invent);
umoney = money_cnt(gi.invent);
/* Some of these are iffy, because a hostile guard
won't become peaceful and resume leading hero
out of the vault. If he did do that, player
@@ -366,7 +366,7 @@ ghitm(register struct monst *mtmp, register struct obj *gold)
goldreqd = 750L;
if (goldreqd && rn2(3)) {
umoney = money_cnt(g.invent);
umoney = money_cnt(gi.invent);
goldreqd += (umoney + u.ulevel * rn2(5)) / ACURR(A_CHA);
if (value > goldreqd)
mtmp->mpeaceful = TRUE;
@@ -414,7 +414,7 @@ container_impact_dmg(
insider = (*u.ushops && inside_shop(u.ux, u.uy)
&& *in_rooms(x, y, SHOPBASE) == *u.ushops);
/* if dropped or thrown, shop ownership flags are set on this obj */
frominv = (obj != g.kickedobj);
frominv = (obj != gk.kickedobj);
for (otmp = obj->cobj; otmp; otmp = otmp2) {
const char *result = (char *) 0;
@@ -470,12 +470,12 @@ kick_object(coordxy x, coordxy y, char *kickobjnam)
*kickobjnam = '\0';
/* if a pile, the "top" object gets kicked */
g.kickedobj = g.level.objects[x][y];
if (g.kickedobj) {
/* kick object; if doing is fatal, done() will clean up g.kickedobj */
Strcpy(kickobjnam, killer_xname(g.kickedobj)); /* matters iff res==0 */
gk.kickedobj = gl.level.objects[x][y];
if (gk.kickedobj) {
/* kick object; if doing is fatal, done() will clean up gk.kickedobj */
Strcpy(kickobjnam, killer_xname(gk.kickedobj)); /* matters iff res==0 */
res = really_kick_object(x, y);
g.kickedobj = (struct obj *) 0;
gk.kickedobj = (struct obj *) 0;
}
return res;
}
@@ -490,9 +490,9 @@ really_kick_object(coordxy x, coordxy y)
char bhitroom;
boolean costly, isgold, slide = FALSE;
/* g.kickedobj should always be set due to conditions of call */
if (!g.kickedobj || g.kickedobj->otyp == BOULDER || g.kickedobj == uball
|| g.kickedobj == uchain)
/* gk.kickedobj should always be set due to conditions of call */
if (!gk.kickedobj || gk.kickedobj->otyp == BOULDER || gk.kickedobj == uball
|| gk.kickedobj == uchain)
return 0;
if ((trap = t_at(x, y)) != 0) {
@@ -516,35 +516,35 @@ really_kick_object(coordxy x, coordxy y)
return 1;
}
if (!uarmf && g.kickedobj->otyp == CORPSE
&& touch_petrifies(&mons[g.kickedobj->corpsenm])
if (!uarmf && gk.kickedobj->otyp == CORPSE
&& touch_petrifies(&mons[gk.kickedobj->corpsenm])
&& !Stone_resistance) {
You("kick %s with your bare %s.",
corpse_xname(g.kickedobj, (const char *) 0, CXN_PFX_THE),
corpse_xname(gk.kickedobj, (const char *) 0, CXN_PFX_THE),
makeplural(body_part(FOOT)));
if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM)) {
if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
; /* hero has been transformed but kick continues */
} else {
/* normalize body shape here; foot, not body_part(FOOT) */
Sprintf(g.killer.name, "kicking %s barefoot",
killer_xname(g.kickedobj));
instapetrify(g.killer.name);
Sprintf(gk.killer.name, "kicking %s barefoot",
killer_xname(gk.kickedobj));
instapetrify(gk.killer.name);
}
}
isgold = (g.kickedobj->oclass == COIN_CLASS);
isgold = (gk.kickedobj->oclass == COIN_CLASS);
{
int k_owt = (int) g.kickedobj->owt;
int k_owt = (int) gk.kickedobj->owt;
/* for non-gold stack, 1 item will be split off below (unless an
early return occurs, so we aren't moving the split to here);
calculate the range for that 1 rather than for the whole stack */
if (g.kickedobj->quan > 1L && !isgold) {
long save_quan = g.kickedobj->quan;
if (gk.kickedobj->quan > 1L && !isgold) {
long save_quan = gk.kickedobj->quan;
g.kickedobj->quan = 1L;
k_owt = weight(g.kickedobj);
g.kickedobj->quan = save_quan;
gk.kickedobj->quan = 1L;
k_owt = weight(gk.kickedobj);
gk.kickedobj->quan = save_quan;
}
/* range < 2 means the object will not move
@@ -564,12 +564,12 @@ really_kick_object(coordxy x, coordxy y)
} else {
if (is_ice(x, y))
range += rnd(3), slide = TRUE;
if (g.kickedobj->greased)
if (gk.kickedobj->greased)
range += rnd(3), slide = TRUE;
}
/* Mjollnir is magically too heavy to kick */
if (is_art(g.kickedobj, ART_MJOLLNIR))
if (is_art(gk.kickedobj, ART_MJOLLNIR))
range = 1;
/* see if the object has a place to move into */
@@ -577,7 +577,7 @@ really_kick_object(coordxy x, coordxy y)
|| closed_door(x + u.dx, y + u.dy))
range = 1;
costly = (!(g.kickedobj->no_charge && !Has_contents(g.kickedobj))
costly = (!(gk.kickedobj->no_charge && !Has_contents(gk.kickedobj))
&& (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0
&& costly_spot(x, y));
@@ -588,49 +588,49 @@ really_kick_object(coordxy x, coordxy y)
pline("It doesn't come loose.");
else
pline("%s %sn't come loose.",
The(distant_name(g.kickedobj, xname)),
otense(g.kickedobj, "do"));
The(distant_name(gk.kickedobj, xname)),
otense(gk.kickedobj, "do"));
return (!rn2(3) || martial());
}
if (Blind)
pline("It comes loose.");
else
pline("%s %s loose.", The(distant_name(g.kickedobj, xname)),
otense(g.kickedobj, "come"));
obj_extract_self(g.kickedobj);
pline("%s %s loose.", The(distant_name(gk.kickedobj, xname)),
otense(gk.kickedobj, "come"));
obj_extract_self(gk.kickedobj);
newsym(x, y);
if (costly && (!costly_spot(u.ux, u.uy)
|| !strchr(u.urooms, *in_rooms(x, y, SHOPBASE))))
addtobill(g.kickedobj, FALSE, FALSE, FALSE);
if (!flooreffects(g.kickedobj, u.ux, u.uy, "fall")) {
place_object(g.kickedobj, u.ux, u.uy);
stackobj(g.kickedobj);
addtobill(gk.kickedobj, FALSE, FALSE, FALSE);
if (!flooreffects(gk.kickedobj, u.ux, u.uy, "fall")) {
place_object(gk.kickedobj, u.ux, u.uy);
stackobj(gk.kickedobj);
newsym(u.ux, u.uy);
}
return 1;
}
/* a box gets a chance of breaking open here */
if (Is_box(g.kickedobj)) {
boolean otrp = g.kickedobj->otrapped;
if (Is_box(gk.kickedobj)) {
boolean otrp = gk.kickedobj->otrapped;
if (range < 2)
pline("THUD!");
container_impact_dmg(g.kickedobj, x, y);
if (g.kickedobj->olocked) {
container_impact_dmg(gk.kickedobj, x, y);
if (gk.kickedobj->olocked) {
if (!rn2(5) || (martial() && !rn2(2))) {
You("break open the lock!");
breakchestlock(g.kickedobj, FALSE);
breakchestlock(gk.kickedobj, FALSE);
if (otrp)
(void) chest_trap(g.kickedobj, LEG, FALSE);
(void) chest_trap(gk.kickedobj, LEG, FALSE);
return 1;
}
} else {
if (!rn2(3) || (martial() && !rn2(2))) {
pline_The("lid slams open, then falls shut.");
g.kickedobj->lknown = 1;
gk.kickedobj->lknown = 1;
if (otrp)
(void) chest_trap(g.kickedobj, LEG, FALSE);
(void) chest_trap(gk.kickedobj, LEG, FALSE);
return 1;
}
}
@@ -640,7 +640,7 @@ really_kick_object(coordxy x, coordxy y)
}
/* fragile objects should not be kicked */
if (hero_breaks(g.kickedobj, g.kickedobj->ox, g.kickedobj->oy, 0))
if (hero_breaks(gk.kickedobj, gk.kickedobj->ox, gk.kickedobj->oy, 0))
return 1;
/* too heavy to move. range is calculated as potential distance from
@@ -648,14 +648,14 @@ really_kick_object(coordxy x, coordxy y)
* from its current position
*/
if (range < 2) {
if (!Is_box(g.kickedobj))
if (!Is_box(gk.kickedobj))
pline("Thump!");
return (!rn2(3) || martial());
}
if (g.kickedobj->quan > 1L) {
if (gk.kickedobj->quan > 1L) {
if (!isgold) {
g.kickedobj = splitobj(g.kickedobj, 1L);
gk.kickedobj = splitobj(gk.kickedobj, 1L);
} else {
if (rn2(20)) {
static NEARDATA const char *const flyingcoinmsg[] = {
@@ -667,11 +667,11 @@ really_kick_object(coordxy x, coordxy y)
pline1("Thwwpingg!");
You("%s!", flyingcoinmsg[rn2(SIZE(flyingcoinmsg))]);
(void) scatter(x, y, rnd(3), VIS_EFFECTS | MAY_HIT,
g.kickedobj);
gk.kickedobj);
newsym(x, y);
return 1;
}
if (g.kickedobj->quan > 300L) {
if (gk.kickedobj->quan > 300L) {
pline("Thump!");
return (!rn2(3) || martial());
}
@@ -679,63 +679,63 @@ really_kick_object(coordxy x, coordxy y)
}
if (slide && !Blind)
pline("Whee! %s %s across the %s.", Doname2(g.kickedobj),
otense(g.kickedobj, "slide"), surface(x, y));
pline("Whee! %s %s across the %s.", Doname2(gk.kickedobj),
otense(gk.kickedobj, "slide"), surface(x, y));
if (costly && !isgold)
addtobill(g.kickedobj, FALSE, FALSE, TRUE);
obj_extract_self(g.kickedobj);
(void) snuff_candle(g.kickedobj);
addtobill(gk.kickedobj, FALSE, FALSE, TRUE);
obj_extract_self(gk.kickedobj);
(void) snuff_candle(gk.kickedobj);
newsym(x, y);
mon = bhit(u.dx, u.dy, range, KICKED_WEAPON,
(int (*) (struct monst *, struct obj *)) 0,
(int (*) (struct obj *, struct obj *)) 0, &g.kickedobj);
if (!g.kickedobj)
(int (*) (struct obj *, struct obj *)) 0, &gk.kickedobj);
if (!gk.kickedobj)
return 1; /* object broken */
if (mon) {
if (mon->isshk && g.kickedobj->where == OBJ_MINVENT
&& g.kickedobj->ocarry == mon)
if (mon->isshk && gk.kickedobj->where == OBJ_MINVENT
&& gk.kickedobj->ocarry == mon)
return 1; /* alert shk caught it */
g.notonhead = (mon->mx != g.bhitpos.x || mon->my != g.bhitpos.y);
if (isgold ? ghitm(mon, g.kickedobj) /* caught? */
: thitmonst(mon, g.kickedobj)) /* hit && used up? */
gn.notonhead = (mon->mx != gb.bhitpos.x || mon->my != gb.bhitpos.y);
if (isgold ? ghitm(mon, gk.kickedobj) /* caught? */
: thitmonst(mon, gk.kickedobj)) /* hit && used up? */
return 1;
}
/* the object might have fallen down a hole;
ship_object() will have taken care of shop billing */
if (g.kickedobj->where == OBJ_MIGRATING)
if (gk.kickedobj->where == OBJ_MIGRATING)
return 1;
bhitroom = *in_rooms(g.bhitpos.x, g.bhitpos.y, SHOPBASE);
if (costly && (!costly_spot(g.bhitpos.x, g.bhitpos.y)
bhitroom = *in_rooms(gb.bhitpos.x, gb.bhitpos.y, SHOPBASE);
if (costly && (!costly_spot(gb.bhitpos.x, gb.bhitpos.y)
|| *in_rooms(x, y, SHOPBASE) != bhitroom)) {
if (isgold)
costly_gold(x, y, g.kickedobj->quan, FALSE);
costly_gold(x, y, gk.kickedobj->quan, FALSE);
else
(void) stolen_value(g.kickedobj, x, y, (boolean) shkp->mpeaceful,
(void) stolen_value(gk.kickedobj, x, y, (boolean) shkp->mpeaceful,
FALSE);
costly = FALSE; /* already billed */
}
if (flooreffects(g.kickedobj, g.bhitpos.x, g.bhitpos.y, "fall"))
if (flooreffects(gk.kickedobj, gb.bhitpos.x, gb.bhitpos.y, "fall"))
return 1;
if (costly) {
long gt = 0L;
long gtg = 0L;
/* costly + landed outside shop handled above; must be inside shop */
if (g.kickedobj->unpaid)
subfrombill(g.kickedobj, shkp);
if (gk.kickedobj->unpaid)
subfrombill(gk.kickedobj, shkp);
/* if billed for contained gold during kick, get a refund now */
if (Has_contents(g.kickedobj)
&& (gt = contained_gold(g.kickedobj, TRUE)) > 0L)
donate_gold(gt, shkp, FALSE);
if (Has_contents(gk.kickedobj)
&& (gtg = contained_gold(gk.kickedobj, TRUE)) > 0L)
donate_gold(gtg, shkp, FALSE);
}
place_object(g.kickedobj, g.bhitpos.x, g.bhitpos.y);
stackobj(g.kickedobj);
newsym(g.kickedobj->ox, g.kickedobj->oy);
place_object(gk.kickedobj, gb.bhitpos.x, gb.bhitpos.y);
stackobj(gk.kickedobj);
newsym(gk.kickedobj->ox, gk.kickedobj->oy);
return 1;
}
@@ -747,33 +747,33 @@ kickstr(char *buf, const char *kickobjnam)
if (*kickobjnam)
what = kickobjnam;
else if (g.maploc == &g.nowhere)
else if (gm.maploc == &gn.nowhere)
what = "nothing";
else if (IS_DOOR(g.maploc->typ))
else if (IS_DOOR(gm.maploc->typ))
what = "a door";
else if (IS_TREE(g.maploc->typ))
else if (IS_TREE(gm.maploc->typ))
what = "a tree";
else if (IS_STWALL(g.maploc->typ))
else if (IS_STWALL(gm.maploc->typ))
what = "a wall";
else if (IS_ROCK(g.maploc->typ))
else if (IS_ROCK(gm.maploc->typ))
what = "a rock";
else if (IS_THRONE(g.maploc->typ))
else if (IS_THRONE(gm.maploc->typ))
what = "a throne";
else if (IS_FOUNTAIN(g.maploc->typ))
else if (IS_FOUNTAIN(gm.maploc->typ))
what = "a fountain";
else if (IS_GRAVE(g.maploc->typ))
else if (IS_GRAVE(gm.maploc->typ))
what = "a headstone";
else if (IS_SINK(g.maploc->typ))
else if (IS_SINK(gm.maploc->typ))
what = "a sink";
else if (IS_ALTAR(g.maploc->typ))
else if (IS_ALTAR(gm.maploc->typ))
what = "an altar";
else if (IS_DRAWBRIDGE(g.maploc->typ))
else if (IS_DRAWBRIDGE(gm.maploc->typ))
what = "a drawbridge";
else if (g.maploc->typ == STAIRS)
else if (gm.maploc->typ == STAIRS)
what = "the stairs";
else if (g.maploc->typ == LADDER)
else if (gm.maploc->typ == LADDER)
what = "a ladder";
else if (g.maploc->typ == IRONBARS)
else if (gm.maploc->typ == IRONBARS)
what = "an iron bar";
else
what = "something weird";
@@ -843,7 +843,7 @@ kick_ouch(coordxy x, coordxy y, const char *kickobjnam)
pline_The("drawbridge is unaffected.");
/* update maploc to refer to the drawbridge */
(void) find_drawbridge(&x, &y);
g.maploc = &levl[x][y];
gm.maploc = &levl[x][y];
}
}
if (!rn2(3))
@@ -865,10 +865,10 @@ dokick(void)
boolean no_kick = FALSE;
char buf[BUFSZ];
if (nolimbs(g.youmonst.data) || slithy(g.youmonst.data)) {
if (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data)) {
You("have no legs to kick with.");
no_kick = TRUE;
} else if (verysmall(g.youmonst.data)) {
} else if (verysmall(gy.youmonst.data)) {
You("are too small to do any kicking.");
no_kick = TRUE;
} else if (u.usteed) {
@@ -885,7 +885,7 @@ dokick(void)
} else if (near_capacity() > SLT_ENCUMBER) {
Your("load is too heavy to balance yourself for a kick.");
no_kick = TRUE;
} else if (g.youmonst.data->mlet == S_LIZARD) {
} else if (gy.youmonst.data->mlet == S_LIZARD) {
Your("legs cannot kick effectively.");
no_kick = TRUE;
} else if (u.uinwater && !rn2(2)) {
@@ -973,23 +973,23 @@ dokick(void)
mtmp = isok(x, y) ? m_at(x, y) : 0;
/* might not kick monster if it is hidden and becomes revealed,
if it is peaceful and player declines to attack, or if the
hero passes out due to encumbrance with low hp; g.context.move
hero passes out due to encumbrance with low hp; gc.context.move
will be 1 unless player declines to kick peaceful monster */
if (mtmp) {
oldglyph = glyph_at(x, y);
if (!maybe_kick_monster(mtmp, x, y))
return (g.context.move ? ECMD_TIME : ECMD_OK);
return (gc.context.move ? ECMD_TIME : ECMD_OK);
}
wake_nearby();
u_wipe_engr(2);
if (!isok(x, y)) {
g.maploc = &g.nowhere;
gm.maploc = &gn.nowhere;
kick_ouch(x, y, "");
return ECMD_TIME;
}
g.maploc = &levl[x][y];
gm.maploc = &levl[x][y];
/*
* The next five tests should stay in their present order:
@@ -1026,11 +1026,11 @@ dokick(void)
map_invisible(x, y);
}
/* recoil if floating */
if ((Is_airlevel(&u.uz) || Levitation) && g.context.move) {
if ((Is_airlevel(&u.uz) || Levitation) && gc.context.move) {
int range;
range =
((int) g.youmonst.data->cwt + (weight_cap() + inv_weight()));
((int) gy.youmonst.data->cwt + (weight_cap() + inv_weight()));
if (range < 1)
range = 1; /* divide by zero avoidance */
range = (3 * (int) mdat->cwt) / range;
@@ -1061,26 +1061,26 @@ dokick(void)
return ECMD_TIME;
}
if (!IS_DOOR(g.maploc->typ)) {
if (g.maploc->typ == SDOOR) {
if (!IS_DOOR(gm.maploc->typ)) {
if (gm.maploc->typ == SDOOR) {
if (!Levitation && rn2(30) < avrg_attrib) {
cvt_sdoor_to_door(g.maploc); /* ->typ = DOOR */
cvt_sdoor_to_door(gm.maploc); /* ->typ = DOOR */
pline("Crash! %s a secret door!",
/* don't "kick open" when it's locked
unless it also happens to be trapped */
(g.maploc->doormask & (D_LOCKED | D_TRAPPED)) == D_LOCKED
(gm.maploc->doormask & (D_LOCKED | D_TRAPPED)) == D_LOCKED
? "Your kick uncovers"
: "You kick open");
exercise(A_DEX, TRUE);
if (g.maploc->doormask & D_TRAPPED) {
g.maploc->doormask = D_NODOOR;
if (gm.maploc->doormask & D_TRAPPED) {
gm.maploc->doormask = D_NODOOR;
b_trapped("door", FOOT);
} else if (g.maploc->doormask != D_NODOOR
&& !(g.maploc->doormask & D_LOCKED))
g.maploc->doormask = D_ISOPEN;
} else if (gm.maploc->doormask != D_NODOOR
&& !(gm.maploc->doormask & D_LOCKED))
gm.maploc->doormask = D_ISOPEN;
feel_newsym(x, y); /* we know it's gone */
if (g.maploc->doormask == D_ISOPEN
|| g.maploc->doormask == D_NODOOR)
if (gm.maploc->doormask == D_ISOPEN
|| gm.maploc->doormask == D_NODOOR)
unblock_point(x, y); /* vision */
return ECMD_TIME;
} else {
@@ -1088,11 +1088,11 @@ dokick(void)
return ECMD_TIME;
}
}
if (g.maploc->typ == SCORR) {
if (gm.maploc->typ == SCORR) {
if (!Levitation && rn2(30) < avrg_attrib) {
pline("Crash! You kick open a secret passage!");
exercise(A_DEX, TRUE);
g.maploc->typ = CORR;
gm.maploc->typ = CORR;
feel_newsym(x, y); /* we know it's gone */
unblock_point(x, y); /* vision */
return ECMD_TIME;
@@ -1101,15 +1101,15 @@ dokick(void)
return ECMD_TIME;
}
}
if (IS_THRONE(g.maploc->typ)) {
if (IS_THRONE(gm.maploc->typ)) {
register int i;
if (Levitation) {
kick_dumb(x, y);
return ECMD_TIME;
}
if ((Luck < 0 || g.maploc->looted) && !rn2(3)) {
g.maploc->looted = 0; /* don't leave loose ends.. */
g.maploc->typ = ROOM;
if ((Luck < 0 || gm.maploc->looted) && !rn2(3)) {
gm.maploc->looted = 0; /* don't leave loose ends.. */
gm.maploc->typ = ROOM;
(void) mkgold((long) rnd(200), x, y);
if (Blind)
pline("CRASH! You destroy it.");
@@ -1119,7 +1119,7 @@ dokick(void)
}
exercise(A_DEX, TRUE);
return ECMD_TIME;
} else if (Luck > 0 && !rn2(3) && !g.maploc->looted) {
} else if (Luck > 0 && !rn2(3) && !gm.maploc->looted) {
(void) mkgold((long) rn1(201, 300), x, y);
i = Luck + 1;
if (i > 6)
@@ -1135,7 +1135,7 @@ dokick(void)
newsym(x, y);
}
/* prevent endless milking */
g.maploc->looted = T_LOOTED;
gm.maploc->looted = T_LOOTED;
return ECMD_TIME;
} else if (!rn2(4)) {
if (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)) {
@@ -1149,7 +1149,7 @@ dokick(void)
kick_ouch(x, y, "");
return ECMD_TIME;
}
if (IS_ALTAR(g.maploc->typ)) {
if (IS_ALTAR(gm.maploc->typ)) {
if (Levitation) {
kick_dumb(x, y);
return ECMD_TIME;
@@ -1163,7 +1163,7 @@ dokick(void)
exercise(A_DEX, TRUE);
return ECMD_TIME;
}
if (IS_FOUNTAIN(g.maploc->typ)) {
if (IS_FOUNTAIN(gm.maploc->typ)) {
if (Levitation) {
kick_dumb(x, y);
return ECMD_TIME;
@@ -1182,7 +1182,7 @@ dokick(void)
exercise(A_DEX, TRUE);
return ECMD_TIME;
}
if (IS_GRAVE(g.maploc->typ)) {
if (IS_GRAVE(gm.maploc->typ)) {
if (Levitation) {
kick_dumb(x, y);
return ECMD_TIME;
@@ -1196,8 +1196,8 @@ dokick(void)
|| ((u.ualign.type == A_LAWFUL) && (u.ualign.record > -10))) {
adjalign(-sgn(u.ualign.type));
}
g.maploc->typ = ROOM;
g.maploc->doormask = 0;
gm.maploc->typ = ROOM;
gm.maploc->doormask = 0;
(void) mksobj_at(ROCK, x, y, TRUE, FALSE);
del_engr_at(x, y);
if (Blind)
@@ -1208,21 +1208,21 @@ dokick(void)
}
return ECMD_TIME;
}
if (g.maploc->typ == IRONBARS) {
if (gm.maploc->typ == IRONBARS) {
kick_ouch(x, y, "");
return ECMD_TIME;
}
if (IS_TREE(g.maploc->typ)) {
if (IS_TREE(gm.maploc->typ)) {
struct obj *treefruit;
/* nothing, fruit or trouble? 75:23.5:1.5% */
if (rn2(3)) {
if (!rn2(6) && !(g.mvitals[PM_KILLER_BEE].mvflags & G_GONE))
if (!rn2(6) && !(gm.mvitals[PM_KILLER_BEE].mvflags & G_GONE))
You_hear("a low buzzing."); /* a warning */
kick_ouch(x, y, "");
return ECMD_TIME;
}
if (rn2(15) && !(g.maploc->looted & TREE_LOOTED)
if (rn2(15) && !(gm.maploc->looted & TREE_LOOTED)
&& (treefruit = rnd_treefruit_at(x, y))) {
long nfruit = 8L - rnl(7), nfall;
short frtype = treefruit->otyp;
@@ -1246,9 +1246,9 @@ dokick(void)
exercise(A_DEX, TRUE);
exercise(A_WIS, TRUE); /* discovered a new food source! */
newsym(x, y);
g.maploc->looted |= TREE_LOOTED;
gm.maploc->looted |= TREE_LOOTED;
return ECMD_TIME;
} else if (!(g.maploc->looted & TREE_SWARM)) {
} else if (!(gm.maploc->looted & TREE_SWARM)) {
int cnt = rnl(4) + 2;
int made = 0;
coord mm;
@@ -1265,13 +1265,13 @@ dokick(void)
pline("You've attracted the tree's former occupants!");
else
You("smell stale honey.");
g.maploc->looted |= TREE_SWARM;
gm.maploc->looted |= TREE_SWARM;
return ECMD_TIME;
}
kick_ouch(x, y, "");
return ECMD_TIME;
}
if (IS_SINK(g.maploc->typ)) {
if (IS_SINK(gm.maploc->typ)) {
int gend = poly_gender();
if (Levitation) {
@@ -1285,8 +1285,8 @@ dokick(void)
pline("Klunk!");
exercise(A_DEX, TRUE);
return ECMD_TIME;
} else if (!(g.maploc->looted & S_LPUDDING) && !rn2(3)
&& !(g.mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) {
} else if (!(gm.maploc->looted & S_LPUDDING) && !rn2(3)
&& !(gm.mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) {
if (Blind)
You_hear("a gushing sound.");
else
@@ -1295,17 +1295,17 @@ dokick(void)
(void) makemon(&mons[PM_BLACK_PUDDING], x, y, MM_NOMSG);
exercise(A_DEX, TRUE);
newsym(x, y);
g.maploc->looted |= S_LPUDDING;
gm.maploc->looted |= S_LPUDDING;
return ECMD_TIME;
} else if (!(g.maploc->looted & S_LDWASHER) && !rn2(3)
&& !(g.mvitals[PM_AMOROUS_DEMON].mvflags & G_GONE)) {
} else if (!(gm.maploc->looted & S_LDWASHER) && !rn2(3)
&& !(gm.mvitals[PM_AMOROUS_DEMON].mvflags & G_GONE)) {
/* can't resist... */
pline("%s returns!", (Blind ? Something : "The dish washer"));
if (makemon(&mons[PM_AMOROUS_DEMON], x, y,
MM_NOMSG | ((gend == 1 || (gend == 2 && rn2(2)))
? MM_MALE : MM_FEMALE)))
newsym(x, y);
g.maploc->looted |= S_LDWASHER;
gm.maploc->looted |= S_LDWASHER;
exercise(A_DEX, TRUE);
return ECMD_TIME;
} else if (!rn2(3)) {
@@ -1319,23 +1319,23 @@ dokick(void)
: !Deaf
? "You hear a sloshing sound" /* Deaf-aware */
: "Something splashes you in the", buf);
if (!(g.maploc->looted & S_LRING)) { /* once per sink */
if (!(gm.maploc->looted & S_LRING)) { /* once per sink */
if (!Blind)
You_see("a ring shining in its midst.");
(void) mkobj_at(RING_CLASS, x, y, TRUE);
newsym(x, y);
exercise(A_DEX, TRUE);
exercise(A_WIS, TRUE); /* a discovery! */
g.maploc->looted |= S_LRING;
gm.maploc->looted |= S_LRING;
}
return ECMD_TIME;
}
kick_ouch(x, y, "");
return ECMD_TIME;
}
if (g.maploc->typ == STAIRS || g.maploc->typ == LADDER
|| IS_STWALL(g.maploc->typ)) {
if (!IS_STWALL(g.maploc->typ) && g.maploc->ladder == LA_DOWN) {
if (gm.maploc->typ == STAIRS || gm.maploc->typ == LADDER
|| IS_STWALL(gm.maploc->typ)) {
if (!IS_STWALL(gm.maploc->typ) && gm.maploc->ladder == LA_DOWN) {
kick_dumb(x, y);
return ECMD_TIME;
}
@@ -1346,8 +1346,8 @@ dokick(void)
return ECMD_TIME;
}
if (g.maploc->doormask == D_ISOPEN || g.maploc->doormask == D_BROKEN
|| g.maploc->doormask == D_NODOOR) {
if (gm.maploc->doormask == D_ISOPEN || gm.maploc->doormask == D_BROKEN
|| gm.maploc->doormask == D_NODOOR) {
kick_dumb(x, y);
return ECMD_TIME; /* uses a turn */
}
@@ -1363,20 +1363,20 @@ dokick(void)
if (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX))) {
boolean shopdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
/* break the door */
if (g.maploc->doormask & D_TRAPPED) {
if (gm.maploc->doormask & D_TRAPPED) {
if (Verbose(0, dokick))
You("kick the door.");
exercise(A_STR, FALSE);
g.maploc->doormask = D_NODOOR;
gm.maploc->doormask = D_NODOOR;
b_trapped("door", FOOT);
} else if (ACURR(A_STR) > 18 && !rn2(5) && !shopdoor) {
pline("As you kick the door, it shatters to pieces!");
exercise(A_STR, TRUE);
g.maploc->doormask = D_NODOOR;
gm.maploc->doormask = D_NODOOR;
} else {
pline("As you kick the door, it crashes open!");
exercise(A_STR, TRUE);
g.maploc->doormask = D_BROKEN;
gm.maploc->doormask = D_BROKEN;
}
feel_newsym(x, y); /* we know we broke it */
unblock_point(x, y); /* vision */
@@ -1486,7 +1486,7 @@ impact_drop(
isrock = (missile && missile->otyp == ROCK);
oct = dct = 0L;
for (obj = g.level.objects[x][y]; obj; obj = obj2) {
for (obj = gl.level.objects[x][y]; obj; obj = obj2) {
obj2 = obj->nexthere;
if (obj == missile)
continue;
@@ -1530,11 +1530,11 @@ impact_drop(
dct == oct ? "the " : dct == 1L ? "an" : "", what);
else if (oct == dct)
pline("%s adjacent %s %s.", dct == 1L ? "The" : "All the", what,
g.gate_str);
gg.gate_str);
else
pline("%s adjacent %s %s.",
dct == 1L ? "One of the" : "Some of the",
dct == 1L ? "objects falls" : what, g.gate_str);
dct == 1L ? "objects falls" : what, gg.gate_str);
}
if (costly && shkp && price) {
@@ -1542,11 +1542,11 @@ impact_drop(
You("removed %ld %s worth of goods!", price, currency(price));
if (cansee(shkp->mx, shkp->my)) {
if (ESHK(shkp)->customer[0] == 0)
(void) strncpy(ESHK(shkp)->customer, g.plname, PL_NSIZ);
(void) strncpy(ESHK(shkp)->customer, gp.plname, PL_NSIZ);
if (angry)
pline("%s is infuriated!", Shknam(shkp));
else
pline("\"%s, you are a thief!\"", g.plname);
pline("\"%s, you are a thief!\"", gp.plname);
} else
You_hear("a scream, \"Thief!\"");
hot_pursuit(shkp);
@@ -1593,7 +1593,7 @@ ship_object(struct obj *otmp, coordxy x, coordxy y, boolean shop_floor_obj)
unpaid = is_unpaid(otmp);
if (OBJ_AT(x, y)) {
for (obj = g.level.objects[x][y]; obj; obj = obj->nexthere) {
for (obj = gl.level.objects[x][y]; obj; obj = obj->nexthere) {
if (obj == uchain)
chainthere = TRUE;
else if (obj != otmp)
@@ -1701,7 +1701,7 @@ obj_delivery(boolean near_hero)
d_level fromdlev;
boolean isladder;
for (otmp = g.migrating_objs; otmp; otmp = otmp2) {
for (otmp = gm.migrating_objs; otmp; otmp = otmp2) {
otmp2 = otmp->nobj;
if (otmp->ox != u.uz.dnum || otmp->oy != u.uz.dlevel)
continue;
@@ -1792,7 +1792,7 @@ deliver_obj_to_mon(struct monst *mtmp, int cnt, unsigned long deliverflags)
| M2_GNOME | M2_ORC | M2_DEMON | M2_GIANT)
cnt = 0;
for (otmp = g.migrating_objs; otmp; otmp = otmp2) {
for (otmp = gm.migrating_objs; otmp; otmp = otmp2) {
otmp2 = otmp->nobj;
where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
if ((where & MIGR_TO_SPECIES) == 0)
@@ -1856,10 +1856,10 @@ otransit_msg(register struct obj *otmp, boolean nodrop, boolean chainthere, long
Sprintf(eos(xbuf), ".");
else
Sprintf(eos(xbuf), " and %s %s.",
otense(otmp, "fall"), g.gate_str);
otense(otmp, "fall"), gg.gate_str);
pline("%s%s", obuf, xbuf);
} else if (!nodrop)
pline("%s %s %s.", obuf, otense(otmp, "fall"), g.gate_str);
pline("%s %s %s.", obuf, otense(otmp, "fall"), gg.gate_str);
}
/* migration destination for objects which fall down to next level */
@@ -1869,23 +1869,23 @@ down_gate(coordxy x, coordxy y)
struct trap *ttmp;
stairway *stway = stairway_at(x, y);
g.gate_str = 0;
gg.gate_str = 0;
/* this matches the player restriction in goto_level() */
if (on_level(&u.uz, &qstart_level) && !ok_to_quest()) {
return MIGR_NOWHERE;
}
if (stway && !stway->up && !stway->isladder) {
g.gate_str = "down the stairs";
gg.gate_str = "down the stairs";
return (stway->tolev.dnum == u.uz.dnum) ? MIGR_STAIRS_UP
: MIGR_SSTAIRS;
}
if (stway && !stway->up && stway->isladder) {
g.gate_str = "down the ladder";
gg.gate_str = "down the ladder";
return MIGR_LADDER_UP;
}
/* hole will always be flagged as seen; trap drop might or might not */
if ((ttmp = t_at(x, y)) != 0 && ttmp->tseen && is_hole(ttmp->ttyp)) {
g.gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door"
gg.gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door"
: "through the hole";
return MIGR_RANDOM;
}
+129 -129
View File
@@ -30,7 +30,7 @@ static boolean mhurtle_step(genericptr_t, coordxy, coordxy);
|| ((o)->oartifact == ART_MJOLLNIR && Role_if(PM_VALKYRIE)))) \
|| (o)->otyp == BOOMERANG)
/* g.thrownobj (decl.c) tracks an object until it lands */
/* gt.thrownobj (decl.c) tracks an object until it lands */
int
multishot_class_bonus(
@@ -88,7 +88,7 @@ throw_obj(struct obj *obj, int shotlimit)
long wep_mask;
boolean twoweap, weakmultishot;
int res = ECMD_TIME;
struct obj_split save_osplit = g.context.objsplit;
struct obj_split save_osplit = gc.context.objsplit;
/* ask "in what direction?" */
if (!getdir((char *) 0)) {
@@ -121,7 +121,7 @@ throw_obj(struct obj *obj, int shotlimit)
goto unsplit_stack;
}
if ((is_art(obj, ART_MJOLLNIR) && ACURR(A_STR) < STR19(25))
|| (obj->otyp == BOULDER && !throws_rocks(g.youmonst.data))) {
|| (obj->otyp == BOULDER && !throws_rocks(gy.youmonst.data))) {
pline("It's too heavy.");
res = ECMD_TIME;
goto unsplit_stack;
@@ -139,8 +139,8 @@ throw_obj(struct obj *obj, int shotlimit)
/* throwing with one hand, but pluralize since the
expression "with your bare hands" sounds better */
makeplural(body_part(HAND)));
Sprintf(g.killer.name, "throwing %s bare-handed", killer_xname(obj));
instapetrify(g.killer.name);
Sprintf(gk.killer.name, "throwing %s bare-handed", killer_xname(obj));
instapetrify(gk.killer.name);
}
if (welded(obj)) {
weldmsg(obj);
@@ -231,21 +231,21 @@ throw_obj(struct obj *obj, int shotlimit)
multishot = shotlimit;
}
g.m_shot.s = ammo_and_launcher(obj, uwep) ? TRUE : FALSE;
gm.m_shot.s = ammo_and_launcher(obj, uwep) ? TRUE : FALSE;
/* give a message if shooting more than one, or if player
attempted to specify a count */
if (multishot > 1 || shotlimit > 0) {
/* "You shoot N arrows." or "You throw N daggers." */
You("%s %d %s.", g.m_shot.s ? "shoot" : "throw",
You("%s %d %s.", gm.m_shot.s ? "shoot" : "throw",
multishot, /* (might be 1 if player gave shotlimit) */
(multishot == 1) ? singular(obj, xname) : xname(obj));
}
wep_mask = obj->owornmask;
oldslot = 0;
g.m_shot.o = obj->otyp;
g.m_shot.n = multishot;
for (g.m_shot.i = 1; g.m_shot.i <= g.m_shot.n; g.m_shot.i++) {
gm.m_shot.o = obj->otyp;
gm.m_shot.n = multishot;
for (gm.m_shot.i = 1; gm.m_shot.i <= gm.m_shot.n; gm.m_shot.i++) {
twoweap = u.twoweap;
/* split this object off from its slot if necessary */
if (obj->quan > 1L) {
@@ -263,9 +263,9 @@ throw_obj(struct obj *obj, int shotlimit)
throwit(otmp, wep_mask, twoweap, oldslot);
(void) encumber_msg();
}
g.m_shot.n = g.m_shot.i = 0;
g.m_shot.o = STRANGE_OBJECT;
g.m_shot.s = FALSE;
gm.m_shot.n = gm.m_shot.i = 0;
gm.m_shot.o = STRANGE_OBJECT;
gm.m_shot.s = FALSE;
unsplit_stack:
/* might need to undo an object split.
@@ -279,7 +279,7 @@ throw_obj(struct obj *obj, int shotlimit)
|| obj->o_id == save_osplit.child_oid)) {
/* futureproofing: objsplit will have been affected if partial stack
was thrown; objects will have been split off stack to throw. */
g.context.objsplit = save_osplit;
gc.context.objsplit = save_osplit;
(void) unsplitobj(obj);
}
return res;
@@ -289,13 +289,13 @@ throw_obj(struct obj *obj, int shotlimit)
static boolean
ok_to_throw(int *shotlimit_p) /* (see dothrow()) */
{
*shotlimit_p = LIMIT_TO_RANGE_INT(0, LARGEST_INT, g.command_count);
g.multi = 0; /* reset; it's been used up */
*shotlimit_p = LIMIT_TO_RANGE_INT(0, LARGEST_INT, gc.command_count);
gm.multi = 0; /* reset; it's been used up */
if (notake(g.youmonst.data)) {
if (notake(gy.youmonst.data)) {
You("are physically incapable of throwing or shooting anything.");
return FALSE;
} else if (nohands(g.youmonst.data)) {
} else if (nohands(gy.youmonst.data)) {
You_cant("throw or shoot without hands."); /* not body_part(HAND) */
return FALSE;
/*[what about !freehand(), aside from cursed missile launcher?]*/
@@ -334,7 +334,7 @@ throw_ok(struct obj *obj)
if (uslinging() && obj->oclass == GEM_CLASS)
return GETOBJ_SUGGEST;
if (throws_rocks(g.youmonst.data) && obj->otyp == BOULDER)
if (throws_rocks(gy.youmonst.data) && obj->otyp == BOULDER)
return GETOBJ_SUGGEST;
return GETOBJ_DOWNPLAY;
@@ -379,7 +379,7 @@ autoquiver(void)
return;
/* Scan through the inventory */
for (otmp = g.invent; otmp; otmp = otmp->nobj) {
for (otmp = gi.invent; otmp; otmp = otmp->nobj) {
if (otmp->owornmask || otmp->oartifact || !otmp->dknown) {
; /* Skip it */
} else if (otmp->otyp == ROCK
@@ -444,7 +444,7 @@ find_launcher(struct obj *ammo)
if (!ammo)
return (struct obj *) 0;
for (oX = 0, otmp = g.invent; otmp; otmp = otmp->nobj) {
for (oX = 0, otmp = gi.invent; otmp; otmp = otmp->nobj) {
if (otmp->cursed && otmp->bknown)
continue; /* known to be cursed, so skip */
if (ammo_and_launcher(ammo, otmp)) {
@@ -535,7 +535,7 @@ dofire(void)
if (!obj) {
/* in case we're using ^A to repeat prior 'f' command, don't
use direction of previous throw as getobj()'s choice here */
g.in_doagain = 0;
gi.in_doagain = 0;
/* this gives its own feedback about populating the quiver slot */
res = doquiver_core("fire");
@@ -577,14 +577,14 @@ dofire(void)
void
endmultishot(boolean verbose)
{
if (g.m_shot.i < g.m_shot.n) {
if (verbose && !g.context.mon_moving) {
if (gm.m_shot.i < gm.m_shot.n) {
if (verbose && !gc.context.mon_moving) {
You("stop %s after the %d%s %s.",
g.m_shot.s ? "firing" : "throwing",
g.m_shot.i, ordin(g.m_shot.i),
g.m_shot.s ? "shot" : "toss");
gm.m_shot.s ? "firing" : "throwing",
gm.m_shot.i, ordin(gm.m_shot.i),
gm.m_shot.s ? "shot" : "toss");
}
g.m_shot.n = g.m_shot.i; /* make current shot be the last */
gm.m_shot.n = gm.m_shot.i; /* make current shot be the last */
}
}
@@ -822,13 +822,13 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
wake_nearto(x,y, 10);
return FALSE;
}
if ((u.ux - x) && (u.uy - y) && bad_rock(g.youmonst.data, u.ux, y)
&& bad_rock(g.youmonst.data, x, u.uy)) {
boolean too_much = (g.invent
if ((u.ux - x) && (u.uy - y) && bad_rock(gy.youmonst.data, u.ux, y)
&& bad_rock(gy.youmonst.data, x, u.uy)) {
boolean too_much = (gi.invent
&& (inv_weight() + weight_cap() > 600));
/* Move at a diagonal. */
if (bigmonst(g.youmonst.data) || too_much) {
if (bigmonst(gy.youmonst.data) || too_much) {
You("%sget forcefully wedged into a crevice.",
too_much ? "and all your belongings " : "");
dmg = rnd(2 + *range);
@@ -871,11 +871,11 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
if (touch_petrifies(mon->data)
/* this is a bodily collision, so check for body armor */
&& !uarmu && !uarm && !uarmc) {
Sprintf(g.killer.name, "bumping into %s",
Sprintf(gk.killer.name, "bumping into %s",
an(pmname(mon->data, NEUTRAL)));
instapetrify(g.killer.name);
instapetrify(gk.killer.name);
}
if (touch_petrifies(g.youmonst.data)
if (touch_petrifies(gy.youmonst.data)
&& !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) {
minstapetrify(mon, TRUE);
}
@@ -884,8 +884,8 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
}
if ((u.ux - x) && (u.uy - y)
&& bad_rock(g.youmonst.data, u.ux, y)
&& bad_rock(g.youmonst.data, x, u.uy)) {
&& bad_rock(gy.youmonst.data, u.ux, y)
&& bad_rock(gy.youmonst.data, x, u.uy)) {
/* Move at a diagonal. */
if (Sokoban) {
You("come to an abrupt halt!");
@@ -922,7 +922,7 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
|| !(Levitation || Flying || Wwalking)) {
/* couldn't move while hurtling; allow movement now so that
drown() will give a chance to crawl out of pool and survive */
g.multi = 0;
gm.multi = 0;
(void) drown();
return FALSE;
} else if (!Is_waterlevel(&u.uz) && !stopping_short) {
@@ -1013,16 +1013,16 @@ mhurtle_step(genericptr_t arg, coordxy x, coordxy y)
if ((mtmp = m_at(x, y)) != 0) {
if (canseemon(mon) || canseemon(mtmp))
pline("%s bumps into %s.", Monnam(mon), a_monnam(mtmp));
wakeup(mon, !g.context.mon_moving);
wakeup(mtmp, !g.context.mon_moving);
wakeup(mon, !gc.context.mon_moving);
wakeup(mtmp, !gc.context.mon_moving);
if (touch_petrifies(mtmp->data)
&& !which_armor(mon, W_ARMU | W_ARM | W_ARMC)) {
minstapetrify(mon, !g.context.mon_moving);
minstapetrify(mon, !gc.context.mon_moving);
newsym(mon->mx, mon->my);
}
if (touch_petrifies(mon->data)
&& !which_armor(mtmp, W_ARMU | W_ARM | W_ARMC)) {
minstapetrify(mtmp, !g.context.mon_moving);
minstapetrify(mtmp, !gc.context.mon_moving);
newsym(mtmp->mx, mtmp->my);
}
}
@@ -1076,8 +1076,8 @@ hurtle(int dx, int dy, int range, boolean verbose)
return; /* paranoia */
nomul(-range);
g.multi_reason = "moving through the air";
g.nomovemsg = ""; /* it just happens */
gm.multi_reason = "moving through the air";
gn.nomovemsg = ""; /* it just happens */
if (verbose)
You("%s in the opposite direction.", range > 1 ? "hurtle" : "float");
/* if we're in the midst of shooting multiple projectiles, stop */
@@ -1163,11 +1163,11 @@ check_shop_obj(struct obj *obj, coordxy x, coordxy y, boolean broken)
out of shop (most likely to the shk's spot in front of door) */
if (*oshops == *u.ushops || *oshops == *u.ushops0) {
if (is_unpaid(obj)) {
long gt = Has_contents(obj) ? contained_gold(obj, TRUE) : 0L;
long gtg = Has_contents(obj) ? contained_gold(obj, TRUE) : 0L;
subfrombill(obj, shkp);
if (gt > 0L)
donate_gold(gt, shkp, TRUE);
if (gtg > 0L)
donate_gold(gtg, shkp, TRUE);
} else if (x != shkp->mx || y != shkp->my) {
sellobj(obj, x, y);
}
@@ -1242,14 +1242,14 @@ toss_up(struct obj *obj, boolean hitsroof)
/* object now hits you */
if (obj->oclass == POTION_CLASS) {
potionhit(&g.youmonst, obj, POTHIT_HERO_THROW);
potionhit(&gy.youmonst, obj, POTHIT_HERO_THROW);
} else if (breaktest(obj)) {
int blindinc;
/* need to check for blindness result prior to destroying obj */
blindinc = ((otyp == CREAM_PIE || otyp == BLINDING_VENOM)
/* AT_WEAP is ok here even if attack type was AT_SPIT */
&& can_blnd(&g.youmonst, &g.youmonst, AT_WEAP, obj))
&& can_blnd(&gy.youmonst, &gy.youmonst, AT_WEAP, obj))
? rnd(25)
: 0;
breakmsg(obj, !Blind);
@@ -1258,7 +1258,7 @@ toss_up(struct obj *obj, boolean hitsroof)
switch (otyp) {
case EGG:
if (petrifier && !Stone_resistance
&& !(poly_when_stoned(g.youmonst.data)
&& !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) {
/* egg ends up "all over your face"; perhaps
visored helmet should still save you here */
@@ -1286,20 +1286,20 @@ toss_up(struct obj *obj, boolean hitsroof)
} else if (harmless_missile(obj)) {
pline("It doesn't hurt.");
hitfloor(obj, FALSE);
g.thrownobj = 0;
gt.thrownobj = 0;
} else { /* neither potion nor other breaking object */
int material = objects[otyp].oc_material;
boolean is_silver = (material == SILVER),
less_damage = (uarmh && is_metallic(uarmh)
&& (!is_silver || !Hate_silver)),
harmless = (stone_missile(obj)
&& passes_rocks(g.youmonst.data)),
&& passes_rocks(gy.youmonst.data)),
artimsg = FALSE;
int dmg = dmgval(obj, &g.youmonst);
int dmg = dmgval(obj, &gy.youmonst);
if (obj->oartifact && !harmless)
/* need a fake die roll here; rn1(18,2) avoids 1 and 20 */
artimsg = artifact_hit((struct monst *) 0, &g.youmonst, obj, &dmg,
artimsg = artifact_hit((struct monst *) 0, &gy.youmonst, obj, &dmg,
rn1(18, 2));
if (!dmg) { /* probably wasn't a weapon; base damage on weight */
@@ -1313,9 +1313,9 @@ toss_up(struct obj *obj, boolean hitsroof)
dmgval()'s artifact light against gremlin or axe against
woody creature since both involve weapons; hero-as-shade is
hypothetical because hero can't polymorph into that form */
if (g.youmonst.data == &mons[PM_SHADE] && !is_silver)
if (gy.youmonst.data == &mons[PM_SHADE] && !is_silver)
dmg = 0;
if (obj->blessed && mon_hates_blessings(&g.youmonst))
if (obj->blessed && mon_hates_blessings(&gy.youmonst))
dmg += rnd(4);
if (is_silver && Hate_silver)
dmg += rnd(20);
@@ -1348,25 +1348,25 @@ toss_up(struct obj *obj, boolean hitsroof)
harmless, but hitting a worn helmet negates that */
harmless = FALSE;
} else if (petrifier && !Stone_resistance
&& !(poly_when_stoned(g.youmonst.data)
&& !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) {
petrify:
g.killer.format = KILLED_BY;
Strcpy(g.killer.name, "elementary physics"); /* what goes up... */
gk.killer.format = KILLED_BY;
Strcpy(gk.killer.name, "elementary physics"); /* what goes up... */
You("turn to stone.");
if (obj)
dropy(obj); /* bypass most of hitfloor() */
g.thrownobj = 0; /* now either gone or on floor */
gt.thrownobj = 0; /* now either gone or on floor */
done(STONING);
return obj ? TRUE : FALSE;
}
if (is_silver && Hate_silver)
pline_The("silver sears you!");
if (harmless)
hit(thesimpleoname(obj), &g.youmonst, " but doesn't hurt.");
hit(thesimpleoname(obj), &gy.youmonst, " but doesn't hurt.");
hitfloor(obj, TRUE);
g.thrownobj = 0;
gt.thrownobj = 0;
if (!harmless)
losehp(dmg, "falling object", KILLED_BY_AN);
}
@@ -1390,8 +1390,8 @@ static void
sho_obj_return_to_u(struct obj *obj)
{
/* might already be our location (bounced off a wall) */
if ((u.dx || u.dy) && (g.bhitpos.x != u.ux || g.bhitpos.y != u.uy)) {
int x = g.bhitpos.x - u.dx, y = g.bhitpos.y - u.dy;
if ((u.dx || u.dy) && (gb.bhitpos.x != u.ux || gb.bhitpos.y != u.uy)) {
int x = gb.bhitpos.x - u.dx, y = gb.bhitpos.y - u.dy;
tmp_at(DISP_FLASH, obj_to_glyph(obj, rn2_on_display_rng));
while (isok(x,y) && (x != u.ux || y != u.uy)) {
@@ -1419,7 +1419,7 @@ throwit(struct obj *obj,
|| Hallucination || Fumbling),
tethered_weapon = (obj->otyp == AKLYS && (wep_mask & W_WEP) != 0);
g.notonhead = FALSE; /* reset potentially stale value */
gn.notonhead = FALSE; /* reset potentially stale value */
if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) {
boolean slipok = TRUE;
@@ -1456,8 +1456,8 @@ throwit(struct obj *obj,
u.dz = 1;
}
g.thrownobj = obj;
g.thrownobj->was_thrown = 1;
gt.thrownobj = obj;
gt.thrownobj->was_thrown = 1;
iflags.returning_missile = AutoReturn(obj, wep_mask) ? (genericptr_t) obj
: (genericptr_t) 0;
/* NOTE: No early returns after this point or returning_missile
@@ -1469,8 +1469,8 @@ throwit(struct obj *obj,
uball->oy = uchain->oy = u.uy;
}
mon = u.ustuck;
g.bhitpos.x = mon->mx;
g.bhitpos.y = mon->my;
gb.bhitpos.x = mon->mx;
gb.bhitpos.y = mon->my;
if (tethered_weapon)
tmp_at(DISP_TETHER, obj_to_glyph(obj, rn2_on_display_rng));
} else if (u.dz) {
@@ -1505,7 +1505,7 @@ throwit(struct obj *obj,
hurtle(-u.dx, -u.dy, 1, TRUE);
iflags.returning_missile = 0; /* doesn't return if it hits monster */
mon = boomhit(obj, u.dx, u.dy);
if (mon == &g.youmonst) { /* the thing was caught */
if (mon == &gy.youmonst) { /* the thing was caught */
exercise(A_DEX, TRUE);
obj = addinv_before(obj, oldslot);
(void) encumber_msg();
@@ -1578,7 +1578,7 @@ throwit(struct obj *obj,
tethered_weapon ? THROWN_TETHERED_WEAPON : THROWN_WEAPON,
(int (*)(MONST_P, OBJ_P)) 0,
(int (*)(OBJ_P, OBJ_P)) 0, &obj);
g.thrownobj = obj; /* obj may be null now */
gt.thrownobj = obj; /* obj may be null now */
/* have to do this after bhit() so u.ux & u.uy are correct */
if (Is_airlevel(&u.uz) || Levitation)
@@ -1602,10 +1602,10 @@ throwit(struct obj *obj,
goto throwit_return; /* alert shk caught it */
}
(void) snuff_candle(obj);
g.notonhead = (g.bhitpos.x != mon->mx || g.bhitpos.y != mon->my);
gn.notonhead = (gb.bhitpos.x != mon->mx || gb.bhitpos.y != mon->my);
obj_gone = thitmonst(mon, obj);
/* Monster may have been tamed; this frees old mon [obsolete] */
mon = m_at(g.bhitpos.x, g.bhitpos.y);
mon = m_at(gb.bhitpos.x, gb.bhitpos.y);
/* [perhaps this should be moved into thitmonst or hmon] */
if (mon && mon->isshk
@@ -1614,17 +1614,17 @@ throwit(struct obj *obj,
hot_pursuit(mon);
if (obj_gone)
g.thrownobj = (struct obj *) 0;
gt.thrownobj = (struct obj *) 0;
}
if (!g.thrownobj) {
if (!gt.thrownobj) {
/* missile has already been handled */
if (tethered_weapon)
tmp_at(DISP_END, 0);
} else if (u.uswallow && !iflags.returning_missile) {
swallowit:
if (obj != uball)
(void) mpickobj(u.ustuck, obj); /* clears 'g.thrownobj' */
(void) mpickobj(u.ustuck, obj); /* clears 'gt.thrownobj' */
else
clear_thrownobj = TRUE;
goto throwit_return;
@@ -1648,8 +1648,8 @@ throwit(struct obj *obj,
setuqwep((struct obj *) 0);
setuwep(obj);
set_twoweap(twoweap); /* u.twoweap = twoweap */
if (cansee(g.bhitpos.x, g.bhitpos.y))
newsym(g.bhitpos.x, g.bhitpos.y);
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
newsym(gb.bhitpos.x, gb.bhitpos.y);
} else {
int dmg = rn2(2);
@@ -1667,7 +1667,7 @@ throwit(struct obj *obj,
body_part(ARM));
if (obj->oartifact)
(void) artifact_hit((struct monst *) 0,
&g.youmonst, obj, &dmg, 0);
&gy.youmonst, obj, &dmg, 0);
losehp(Maybe_Half_Phys(dmg), killer_xname(obj),
KILLED_BY);
}
@@ -1697,70 +1697,70 @@ throwit(struct obj *obj,
}
}
if ((!IS_SOFT(levl[g.bhitpos.x][g.bhitpos.y].typ) && breaktest(obj))
if ((!IS_SOFT(levl[gb.bhitpos.x][gb.bhitpos.y].typ) && breaktest(obj))
/* venom [via #monster to spit while poly'd] fails breaktest()
but we want to force breakage even when location IS_SOFT() */
|| obj->oclass == VENOM_CLASS) {
tmp_at(DISP_FLASH, obj_to_glyph(obj, rn2_on_display_rng));
tmp_at(g.bhitpos.x, g.bhitpos.y);
tmp_at(gb.bhitpos.x, gb.bhitpos.y);
delay_output();
tmp_at(DISP_END, 0);
breakmsg(obj, cansee(g.bhitpos.x, g.bhitpos.y));
breakobj(obj, g.bhitpos.x, g.bhitpos.y, TRUE, TRUE);
breakmsg(obj, cansee(gb.bhitpos.x, gb.bhitpos.y));
breakobj(obj, gb.bhitpos.x, gb.bhitpos.y, TRUE, TRUE);
clear_thrownobj = TRUE;
goto throwit_return;
}
if (!Deaf && !Underwater) {
/* Some sound effects when item lands in water or lava */
if (is_pool(g.bhitpos.x, g.bhitpos.y)
|| (is_lava(g.bhitpos.x, g.bhitpos.y) && !is_flammable(obj)))
if (is_pool(gb.bhitpos.x, gb.bhitpos.y)
|| (is_lava(gb.bhitpos.x, gb.bhitpos.y) && !is_flammable(obj)))
pline((weight(obj) > 9) ? "Splash!" : "Plop!");
}
if (flooreffects(obj, g.bhitpos.x, g.bhitpos.y, "fall")) {
if (flooreffects(obj, gb.bhitpos.x, gb.bhitpos.y, "fall")) {
clear_thrownobj = TRUE;
goto throwit_return;
}
obj_no_longer_held(obj);
if (mon && mon->isshk && is_pick(obj)) {
if (cansee(g.bhitpos.x, g.bhitpos.y))
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
pline("%s snatches up %s.", Monnam(mon), the(xname(obj)));
if (*u.ushops || obj->unpaid)
check_shop_obj(obj, g.bhitpos.x, g.bhitpos.y, FALSE);
check_shop_obj(obj, gb.bhitpos.x, gb.bhitpos.y, FALSE);
(void) mpickobj(mon, obj); /* may merge and free obj */
clear_thrownobj = TRUE;
goto throwit_return;
}
(void) snuff_candle(obj);
if (!mon && ship_object(obj, g.bhitpos.x, g.bhitpos.y, FALSE)) {
if (!mon && ship_object(obj, gb.bhitpos.x, gb.bhitpos.y, FALSE)) {
clear_thrownobj = TRUE;
goto throwit_return;
}
g.thrownobj = (struct obj *) 0;
place_object(obj, g.bhitpos.x, g.bhitpos.y);
gt.thrownobj = (struct obj *) 0;
place_object(obj, gb.bhitpos.x, gb.bhitpos.y);
/* container contents might break;
do so before turning ownership of g.thrownobj over to shk
do so before turning ownership of gt.thrownobj over to shk
(container_impact_dmg handles item already owned by shop) */
if (!IS_SOFT(levl[g.bhitpos.x][g.bhitpos.y].typ))
/* <x,y> is spot where you initiated throw, not g.bhitpos */
if (!IS_SOFT(levl[gb.bhitpos.x][gb.bhitpos.y].typ))
/* <x,y> is spot where you initiated throw, not gb.bhitpos */
container_impact_dmg(obj, u.ux, u.uy);
/* charge for items thrown out of shop;
shk takes possession for items thrown into one */
if ((*u.ushops || obj->unpaid) && obj != uball)
check_shop_obj(obj, g.bhitpos.x, g.bhitpos.y, FALSE);
check_shop_obj(obj, gb.bhitpos.x, gb.bhitpos.y, FALSE);
stackobj(obj);
if (obj == uball)
drop_ball(g.bhitpos.x, g.bhitpos.y);
if (cansee(g.bhitpos.x, g.bhitpos.y))
newsym(g.bhitpos.x, g.bhitpos.y);
drop_ball(gb.bhitpos.x, gb.bhitpos.y);
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
newsym(gb.bhitpos.x, gb.bhitpos.y);
if (obj_sheds_light(obj))
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
}
throwit_return:
iflags.returning_missile = (genericptr_t) 0;
if (clear_thrownobj)
g.thrownobj = (struct obj *) 0;
gt.thrownobj = (struct obj *) 0;
return;
}
@@ -1826,7 +1826,7 @@ tmiss(struct obj *obj, struct monst *mon, boolean maybe_wakeup)
#define quest_arti_hits_leader(obj, mon) \
(obj->oartifact && is_quest_artifact(obj) \
&& mon->m_id == g.quest_status.leader_m_id)
&& mon->m_id == gq.quest_status.leader_m_id)
/*
* Object thrown by player arrives at monster's location.
@@ -1837,7 +1837,7 @@ tmiss(struct obj *obj, struct monst *mon, boolean maybe_wakeup)
int
thitmonst(
struct monst *mon,
struct obj *obj) /* g.thrownobj or g.kickedobj or uwep */
struct obj *obj) /* gt.thrownobj or gk.kickedobj or uwep */
{
register int tmp; /* Base chance to hit */
register int disttmp; /* distance modifier */
@@ -1846,7 +1846,7 @@ thitmonst(
int dieroll;
hmode = (obj == uwep) ? HMON_APPLIED
: (obj == g.kickedobj) ? HMON_KICKED
: (obj == gk.kickedobj) ? HMON_KICKED
: HMON_THROWN;
/* Differences from melee weapons:
@@ -1861,7 +1861,7 @@ thitmonst(
* Distance and monster size affect chance to hit.
*/
tmp = -1 + Luck + find_mac(mon) + u.uhitinc
+ maybe_polyd(g.youmonst.data->mlevel, u.ulevel);
+ maybe_polyd(gy.youmonst.data->mlevel, u.ulevel);
if (ACURR(A_DEX) < 4)
tmp -= 3;
else if (ACURR(A_DEX) < 6)
@@ -1900,7 +1900,7 @@ thitmonst(
tmp += omon_adj(mon, obj, TRUE);
if (is_orc(mon->data)
&& maybe_polyd(is_elf(g.youmonst.data), Race_if(PM_ELF)))
&& maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
tmp++;
if (guaranteed_hit) {
tmp += 1000; /* Guaranteed hit */
@@ -1978,7 +1978,7 @@ thitmonst(
* Polymorphing won't make you a bow expert.
*/
if ((Race_if(PM_ELF) || Role_if(PM_SAMURAI))
&& (!Upolyd || your_race(g.youmonst.data))
&& (!Upolyd || your_race(gy.youmonst.data))
&& objects[uwep->otyp].oc_skill == P_BOW) {
++tmp;
if ((Race_if(PM_ELF) && uwep->otyp == ELVEN_BOW)
@@ -1991,7 +1991,7 @@ thitmonst(
tmp += 4;
else if (throwing_weapon(obj)) /* meant to be thrown */
tmp += 2;
else if (obj == g.thrownobj) /* not meant to be thrown */
else if (obj == gt.thrownobj) /* not meant to be thrown */
tmp -= 2;
/* we know we're dealing with a weapon or weptool handled
by WEAPON_SKILLS once ammo objects have been excluded */
@@ -1999,7 +1999,7 @@ thitmonst(
}
if (tmp >= dieroll) {
boolean wasthrown = (g.thrownobj != 0),
boolean wasthrown = (gt.thrownobj != 0),
/* remember weapon attribute; hmon() might destroy obj */
chopper = is_axe(obj);
@@ -2012,14 +2012,14 @@ thitmonst(
}
if (hmon(mon, obj, hmode, dieroll)) { /* mon still alive */
if (mon->wormno)
cutworm(mon, g.bhitpos.x, g.bhitpos.y, chopper);
cutworm(mon, gb.bhitpos.x, gb.bhitpos.y, chopper);
}
exercise(A_DEX, TRUE);
/* if hero was swallowed and projectile killed the engulfer,
'obj' got added to engulfer's inventory and then dropped,
so we can't safely use that pointer anymore; it escapes
the chance to be used up here... */
if (wasthrown && !g.thrownobj)
if (wasthrown && !gt.thrownobj)
return 1;
/* projectiles other than magic stones sometimes disappear
@@ -2049,7 +2049,7 @@ thitmonst(
if (broken) {
if (*u.ushops || obj->unpaid)
check_shop_obj(obj, g.bhitpos.x, g.bhitpos.y, TRUE);
check_shop_obj(obj, gb.bhitpos.x, gb.bhitpos.y, TRUE);
obfree(obj, (struct obj *) 0);
return 1;
}
@@ -2321,16 +2321,16 @@ breakobj(
if (obj->otyp == POT_OIL && obj->lamplit) {
explode_oil(obj, x, y);
} else if (next2u(x, y)) {
if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) {
if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data)) {
/* wet towel protects both eyes and breathing */
if (obj->otyp != POT_WATER && !Half_gas_damage) {
if (!breathless(g.youmonst.data)) {
if (!breathless(gy.youmonst.data)) {
/* [what about "familiar odor" when known?] */
You("smell a peculiar odor...");
} else {
const char *eyes = body_part(EYE);
if (eyecount(g.youmonst.data) != 1)
if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes);
Your("%s %s.", eyes, vtense(eyes, "water"));
}
@@ -2373,15 +2373,15 @@ breakobj(
/* base shk actions on her peacefulness at start of
this turn, so that "simultaneous" multiple breakage
isn't drastically worse than single breakage */
if (g.hero_seq != eshkp->break_seq)
if (gh.hero_seq != eshkp->break_seq)
eshkp->seq_peaceful = shkp->mpeaceful;
if ((stolen_value(obj, x, y, eshkp->seq_peaceful, FALSE) > 0L)
&& (*o_shop != u.ushops[0] || !inside_shop(u.ux, u.uy))
&& g.hero_seq != eshkp->break_seq)
&& gh.hero_seq != eshkp->break_seq)
make_angry_shk(shkp, x, y);
/* make_angry_shk() is only called on the first instance
of breakage during any particular hero move */
eshkp->break_seq = g.hero_seq;
eshkp->break_seq = gh.hero_seq;
}
}
}
@@ -2465,8 +2465,8 @@ throw_gold(struct obj *obj)
You("cannot throw gold at yourself.");
/* If we tried to throw part of a stack, force it to merge back
together (same as in throw_obj). Essential for gold. */
if (obj->o_id == g.context.objsplit.parent_oid
|| obj->o_id == g.context.objsplit.child_oid)
if (obj->o_id == gc.context.objsplit.parent_oid
|| obj->o_id == gc.context.objsplit.child_oid)
(void) unsplitobj(obj);
return ECMD_CANCEL;
}
@@ -2492,8 +2492,8 @@ throw_gold(struct obj *obj)
pline("Fortunately, you are wearing %s!",
an(helm_simple_name(uarmh)));
}
g.bhitpos.x = u.ux;
g.bhitpos.y = u.uy;
gb.bhitpos.x = u.ux;
gb.bhitpos.y = u.uy;
} else {
/* consistent with range for normal objects */
range = (int) ((ACURRSTR) / 2 - obj->owt / 40);
@@ -2502,8 +2502,8 @@ throw_gold(struct obj *obj)
odx = u.ux + u.dx;
ody = u.uy + u.dy;
if (!ZAP_POS(levl[odx][ody].typ) || closed_door(odx, ody)) {
g.bhitpos.x = u.ux;
g.bhitpos.y = u.uy;
gb.bhitpos.x = u.ux;
gb.bhitpos.y = u.uy;
} else {
mon = bhit(u.dx, u.dy, range, THROWN_WEAPON,
(int (*)(MONST_P, OBJ_P)) 0,
@@ -2514,21 +2514,21 @@ throw_gold(struct obj *obj)
if (ghitm(mon, obj)) /* was it caught? */
return ECMD_TIME;
} else {
if (ship_object(obj, g.bhitpos.x, g.bhitpos.y, FALSE))
if (ship_object(obj, gb.bhitpos.x, gb.bhitpos.y, FALSE))
return ECMD_TIME;
}
}
}
if (flooreffects(obj, g.bhitpos.x, g.bhitpos.y, "fall"))
if (flooreffects(obj, gb.bhitpos.x, gb.bhitpos.y, "fall"))
return ECMD_TIME;
if (u.dz > 0)
pline_The("gold hits the %s.", surface(g.bhitpos.x, g.bhitpos.y));
place_object(obj, g.bhitpos.x, g.bhitpos.y);
pline_The("gold hits the %s.", surface(gb.bhitpos.x, gb.bhitpos.y));
place_object(obj, gb.bhitpos.x, gb.bhitpos.y);
if (*u.ushops)
sellobj(obj, g.bhitpos.x, g.bhitpos.y);
sellobj(obj, gb.bhitpos.x, gb.bhitpos.y);
stackobj(obj);
newsym(g.bhitpos.x, g.bhitpos.y);
newsym(gb.bhitpos.x, gb.bhitpos.y);
return ECMD_TIME;
}
+206 -206
View File
File diff suppressed because it is too large Load Diff
+299 -299
View File
File diff suppressed because it is too large Load Diff
+136 -136
View File
@@ -43,7 +43,7 @@ extern void nethack_exit(int) NORETURN;
#define nethack_exit exit
#endif
#define done_stopprint g.program_state.stopprint
#define done_stopprint gp.program_state.stopprint
#ifndef PANICTRACE
#define NH_abort NH_abort_
@@ -315,7 +315,7 @@ done1(int sig_unused UNUSED)
clear_nhwindow(WIN_MESSAGE);
curs_on_u();
wait_synch();
if (g.multi > 0)
if (gm.multi > 0)
nomul(0);
} else {
(void) done2();
@@ -333,9 +333,9 @@ done2(void)
clear_nhwindow(WIN_MESSAGE);
curs_on_u();
wait_synch();
if (g.multi > 0)
if (gm.multi > 0)
nomul(0);
if (g.multi == 0) {
if (gm.multi == 0) {
u.uinvulnerable = FALSE; /* avoid ctrl-C bug -dlc */
u.usleep = 0;
}
@@ -388,7 +388,7 @@ done_intr(int sig_unused UNUSED)
static void
done_hangup(int sig)
{
g.program_state.done_hup++;
gp.program_state.done_hup++;
sethanguphandler((void (*)(int)) SIG_IGN);
done_intr(sig);
return;
@@ -414,19 +414,19 @@ done_in_by(struct monst *mtmp, int how)
You((how == STONING) ? "turn to stone..." : "die...");
mark_synch(); /* flush buffered screen output */
buf[0] = '\0';
g.killer.format = KILLED_BY_AN;
gk.killer.format = KILLED_BY_AN;
/* "killed by the high priest of Crom" is okay,
"killed by the high priest" alone isn't */
if ((mptr->geno & G_UNIQ) != 0 && !(imitator && !mimicker)
&& !(mptr == &mons[PM_HIGH_CLERIC] && !mtmp->ispriest)) {
if (!type_is_pname(mptr))
Strcat(buf, "the ");
g.killer.format = KILLED_BY;
gk.killer.format = KILLED_BY;
}
/* _the_ <invisible> <distorted> ghost of Dudley */
if (mptr == &mons[PM_GHOST] && has_mgivenname(mtmp)) {
Strcat(buf, "the ");
g.killer.format = KILLED_BY;
gk.killer.format = KILLED_BY;
}
(void) monhealthdescr(mtmp, TRUE, eos(buf));
if (mtmp->minvis)
@@ -477,7 +477,7 @@ done_in_by(struct monst *mtmp, int how)
: mtmp->female ? "Ms. " : "Mr. ";
Sprintf(eos(buf), "%s%s, the shopkeeper", honorific, shknm);
g.killer.format = KILLED_BY;
gk.killer.format = KILLED_BY;
} else if (mtmp->ispriest || mtmp->isminion) {
/* m_monnam() suppresses "the" prefix plus "invisible", and
it overrides the effect of Hallucination on priestname() */
@@ -488,12 +488,12 @@ done_in_by(struct monst *mtmp, int how)
Sprintf(eos(buf), " called %s", MGIVENNAME(mtmp));
}
Strcpy(g.killer.name, buf);
Strcpy(gk.killer.name, buf);
/* might need to fix up multi_reason if 'mtmp' caused the reason */
if (g.multi_reason
&& g.multi_reason > g.multireasonbuf
&& g.multi_reason < g.multireasonbuf + sizeof g.multireasonbuf - 1) {
if (gm.multi_reason
&& gm.multi_reason > gm.multireasonbuf
&& gm.multi_reason < gm.multireasonbuf + sizeof gm.multireasonbuf - 1) {
char reasondummy, *p;
unsigned reasonmid = 0;
@@ -513,9 +513,9 @@ done_in_by(struct monst *mtmp, int how)
* report the truncated helplessness reason even if some other
* monster peforms the /coup de grace/.
*/
if (sscanf(g.multireasonbuf, "%u:%c", &reasonmid, &reasondummy) == 2
if (sscanf(gm.multireasonbuf, "%u:%c", &reasonmid, &reasondummy) == 2
&& mtmp->m_id == reasonmid) {
if ((p = strchr(g.multireasonbuf, ' ')) != 0)
if ((p = strchr(gm.multireasonbuf, ' ')) != 0)
*p = '\0';
}
}
@@ -531,10 +531,10 @@ done_in_by(struct monst *mtmp, int how)
*/
if (mptr->mlet == S_WRAITH)
u.ugrave_arise = PM_WRAITH;
else if (mptr->mlet == S_MUMMY && g.urace.mummynum != NON_PM)
u.ugrave_arise = g.urace.mummynum;
else if (zombie_maker(mtmp) && zombie_form(g.youmonst.data) != NON_PM)
u.ugrave_arise = zombie_form(g.youmonst.data);
else if (mptr->mlet == S_MUMMY && gu.urace.mummynum != NON_PM)
u.ugrave_arise = gu.urace.mummynum;
else if (zombie_maker(mtmp) && zombie_form(gy.youmonst.data) != NON_PM)
u.ugrave_arise = zombie_form(gy.youmonst.data);
else if (mptr->mlet == S_VAMPIRE && Race_if(PM_HUMAN))
u.ugrave_arise = PM_VAMPIRE;
else if (mptr == &mons[PM_GHOUL])
@@ -542,7 +542,7 @@ done_in_by(struct monst *mtmp, int how)
/* this could happen if a high-end vampire kills the hero
when ordinary vampires are genocided; ditto for wraiths */
if (u.ugrave_arise >= LOW_PM
&& (g.mvitals[u.ugrave_arise].mvflags & G_GENOD))
&& (gm.mvitals[u.ugrave_arise].mvflags & G_GENOD))
u.ugrave_arise = NON_PM;
done(how);
@@ -573,17 +573,17 @@ fixup_death(int how)
{
int i;
if (g.multi_reason) {
if (gm.multi_reason) {
for (i = 0; i < SIZE(death_fixups); ++i)
if (death_fixups[i].why == how
&& !strcmp(death_fixups[i].exclude, g.multi_reason)) {
&& !strcmp(death_fixups[i].exclude, gm.multi_reason)) {
if (death_fixups[i].include) /* substitute alternate reason */
g.multi_reason = death_fixups[i].include;
gm.multi_reason = death_fixups[i].include;
else /* remove the helplessness reason */
g.multi_reason = (char *) 0;
g.multireasonbuf[0] = '\0'; /* dynamic buf stale either way */
gm.multi_reason = (char *) 0;
gm.multireasonbuf[0] = '\0'; /* dynamic buf stale either way */
if (death_fixups[i].unmulti) /* possibly hide helplessness */
g.multi = 0L;
gm.multi = 0L;
break;
}
}
@@ -602,7 +602,7 @@ panic VA_DECL(const char *, str)
VA_START(str);
VA_INIT(str, char *);
if (g.program_state.panicking++)
if (gp.program_state.panicking++)
NH_abort(); /* avoid loops - this should never happen*/
if (iflags.window_inited) {
@@ -612,9 +612,9 @@ panic VA_DECL(const char *, str)
iflags.window_inited = 0; /* they're gone; force raw_print()ing */
}
raw_print(g.program_state.gameover
raw_print(gp.program_state.gameover
? "Postgame wrapup disrupted."
: !g.program_state.something_worth_saving
: !gp.program_state.something_worth_saving
? "Program initialization has failed."
: "Suddenly, the dungeon collapses.");
#ifndef MICRO
@@ -622,11 +622,11 @@ panic VA_DECL(const char *, str)
if (!wizard)
raw_printf("Report the following error to \"%s\" or at \"%s\".",
DEVTEAM_EMAIL, DEVTEAM_URL);
else if (g.program_state.something_worth_saving)
else if (gp.program_state.something_worth_saving)
raw_print("\nError save file being written.\n");
#else /* !NOTIFY_NETHACK_BUGS */
if (!wizard) {
const char *maybe_rebuild = !g.program_state.something_worth_saving
const char *maybe_rebuild = !gp.program_state.something_worth_saving
? "."
: "\nand it may be possible to rebuild.";
@@ -644,7 +644,7 @@ panic VA_DECL(const char *, str)
/* XXX can we move this above the prints? Then we'd be able to
* suppress "it may be possible to rebuild" based on dosave0()
* or say it's NOT possible to rebuild. */
if (g.program_state.something_worth_saving && !iflags.debug_fuzzer) {
if (gp.program_state.something_worth_saving && !iflags.debug_fuzzer) {
set_error_savefile();
if (dosave0()) {
/* os/win port specific recover instructions */
@@ -727,9 +727,9 @@ dump_plines(void)
Strcpy(buf, " "); /* one space for indentation */
putstr(0, 0, "Latest messages:");
for (i = 0, j = (int) g.saved_pline_index; i < DUMPLOG_MSG_COUNT;
for (i = 0, j = (int) gs.saved_pline_index; i < DUMPLOG_MSG_COUNT;
++i, j = (j + 1) % DUMPLOG_MSG_COUNT) {
strp = &g.saved_plines[j];
strp = &gs.saved_plines[j];
if (*strp) {
copynchars(&buf[1], *strp, BUFSZ - 1 - 1);
putstr(0, 0, buf);
@@ -777,10 +777,10 @@ dump_everything(
/* character name and basic role info */
Sprintf(pbuf, "%s, %s %s %s %s",
g.plname, aligns[1 - u.ualign.type].adj,
genders[flags.female].adj, g.urace.adj,
(flags.female && g.urole.name.f) ? g.urole.name.f
: g.urole.name.m);
gp.plname, aligns[1 - u.ualign.type].adj,
genders[flags.female].adj, gu.urace.adj,
(flags.female && gu.urole.name.f) ? gu.urole.name.f
: gu.urole.name.m);
putstr(0, 0, pbuf);
putstr(0, 0, "");
@@ -794,7 +794,7 @@ dump_everything(
putstr(0, 0, "");
putstr(0, 0, "Inventory:");
(void) display_inventory((char *) 0, TRUE);
container_contents(g.invent, TRUE, TRUE, FALSE);
container_contents(gi.invent, TRUE, TRUE, FALSE);
enlightenment((BASICENLIGHTENMENT | MAGICENLIGHTENMENT),
(how >= PANICKED) ? ENL_GAMEOVERALIVE : ENL_GAMEOVERDEAD);
putstr(0, 0, "");
@@ -824,7 +824,7 @@ disclose(int how, boolean taken)
char qbuf[QBUFSZ];
boolean ask = FALSE;
if (g.invent && !done_stopprint) {
if (gi.invent && !done_stopprint) {
if (taken)
Sprintf(qbuf, "Do you want to see what you had when you %s?",
(how == QUIT) ? "quit" : "died");
@@ -837,7 +837,7 @@ disclose(int how, boolean taken)
/* caller has already ID'd everything; we pass 'want_reply=True'
to force display_pickinv() to avoid using WIN_INVENT */
(void) display_inventory((char *) 0, TRUE);
container_contents(g.invent, TRUE, TRUE, FALSE);
container_contents(gi.invent, TRUE, TRUE, FALSE);
}
if (c == 'q')
done_stopprint++;
@@ -925,30 +925,30 @@ savelife(int how)
if ((Sick & TIMEOUT) == 1L) {
make_sick(0L, (char *) 0, FALSE, SICK_ALL);
}
g.nomovemsg = "You survived that attempt on your life.";
g.context.move = 0;
gn.nomovemsg = "You survived that attempt on your life.";
gc.context.move = 0;
g.multi = -1; /* can't move again during the current turn */
gm.multi = -1; /* can't move again during the current turn */
/* in case being life-saved is immediately followed by being killed
again (perhaps due to zap rebound); this text will be appended to
"killed by <something>, while "
in high scores entry, if any, and in logfile (but not on tombstone) */
g.multi_reason = Role_if(PM_TOURIST) ? "being toyed with by Fate"
gm.multi_reason = Role_if(PM_TOURIST) ? "being toyed with by Fate"
: "attempting to cheat Death";
if (u.utrap && u.utraptype == TT_LAVA)
reset_utrap(FALSE);
g.context.botl = TRUE;
gc.context.botl = TRUE;
u.ugrave_arise = NON_PM;
HUnchanging = 0L;
curs_on_u();
if (!g.context.mon_moving)
if (!gc.context.mon_moving)
endmultishot(FALSE);
if (u.uswallow) {
/* might drop hero onto a trap that kills her all over again */
expels(u.ustuck, u.ustuck->data, TRUE);
} else if (u.ustuck) {
if (Upolyd && sticks(g.youmonst.data))
if (Upolyd && sticks(gy.youmonst.data))
You("release %s.", mon_nam(u.ustuck));
else
pline("%s releases you.", Monnam(u.ustuck));
@@ -974,18 +974,18 @@ get_valuables(struct obj *list) /* inventory or container contents */
continue;
} else if (obj->oclass == AMULET_CLASS) {
i = obj->otyp - FIRST_AMULET;
if (!g.amulets[i].count) {
g.amulets[i].count = obj->quan;
g.amulets[i].typ = obj->otyp;
if (!ga.amulets[i].count) {
ga.amulets[i].count = obj->quan;
ga.amulets[i].typ = obj->otyp;
} else
g.amulets[i].count += obj->quan; /* always adds one */
ga.amulets[i].count += obj->quan; /* always adds one */
} else if (obj->oclass == GEM_CLASS && obj->otyp < LUCKSTONE) {
i = min(obj->otyp, LAST_GEM + 1) - FIRST_GEM;
if (!g.gems[i].count) {
g.gems[i].count = obj->quan;
g.gems[i].typ = obj->otyp;
if (!gg.gems[i].count) {
gg.gems[i].count = obj->quan;
gg.gems[i].typ = obj->otyp;
} else
g.gems[i].count += obj->quan;
gg.gems[i].count += obj->quan;
}
return;
}
@@ -1063,7 +1063,7 @@ done_object_cleanup(void)
* any inventory. Saving bones with an active light source in limbo
* would trigger an 'object not local' panic.
*
* We used to use dealloc_obj() on g.thrownobj and g.kickedobj but
* We used to use dealloc_obj() on gt.thrownobj and gk.kickedobj but
* that keeps them out of bones and could leave uball in a confused
* state (gone but still attached). Place them on the map but
* bypass flooreffects(). That could lead to minor anomalies in
@@ -1078,13 +1078,13 @@ done_object_cleanup(void)
be incorrect (perhaps killed by divine lightning when throwing at
a temple priest?) but this should be better than just vanishing
(fragile stuff should be taken care of before getting here) */
if (g.thrownobj && g.thrownobj->where == OBJ_FREE) {
place_object(g.thrownobj, ox, oy);
stackobj(g.thrownobj), g.thrownobj = 0;
if (gt.thrownobj && gt.thrownobj->where == OBJ_FREE) {
place_object(gt.thrownobj, ox, oy);
stackobj(gt.thrownobj), gt.thrownobj = 0;
}
if (g.kickedobj && g.kickedobj->where == OBJ_FREE) {
place_object(g.kickedobj, ox, oy);
stackobj(g.kickedobj), g.kickedobj = 0;
if (gk.kickedobj && gk.kickedobj->where == OBJ_FREE) {
place_object(gk.kickedobj, ox, oy);
stackobj(gk.kickedobj), gk.kickedobj = 0;
}
/* if Punished hero dies during level change or dies or quits while
swallowed, uball and uchain will be in limbo; put them on floor
@@ -1145,32 +1145,32 @@ done(int how)
boolean survive = FALSE;
if (how == TRICKED) {
if (g.killer.name[0]) {
paniclog("trickery", g.killer.name);
g.killer.name[0] = '\0';
if (gk.killer.name[0]) {
paniclog("trickery", gk.killer.name);
gk.killer.name[0] = '\0';
}
if (wizard) {
You("are a very tricky wizard, it seems.");
g.killer.format = KILLED_BY_AN; /* reset to 0 */
gk.killer.format = KILLED_BY_AN; /* reset to 0 */
return;
}
}
if (g.program_state.panicking
if (gp.program_state.panicking
#ifdef HANGUPHANDLING
|| g.program_state.done_hup
|| gp.program_state.done_hup
#endif
|| (how == QUIT && done_stopprint)) {
/* skip status update if panicking or disconnected
or answer of 'q' to "Really quit?" */
g.context.botl = g.context.botlx = iflags.time_botl = FALSE;
gc.context.botl = gc.context.botlx = iflags.time_botl = FALSE;
} else {
/* otherwise force full status update */
g.context.botlx = TRUE;
gc.context.botlx = TRUE;
bot();
}
if (iflags.debug_fuzzer) {
if (!(g.program_state.panicking || how == PANICKED)) {
if (!(gp.program_state.panicking || how == PANICKED)) {
savelife(how);
/* periodically restore characteristics and lost exp levels
or cure lycanthropy */
@@ -1184,18 +1184,18 @@ done(int how)
/* not useup(); we haven't put this potion into inventory */
obfree(potion, (struct obj *) 0);
}
g.killer.name[0] = '\0';
g.killer.format = 0;
gk.killer.name[0] = '\0';
gk.killer.format = 0;
return;
}
} else
if (how == ASCENDED || (!g.killer.name[0] && how == GENOCIDED))
g.killer.format = NO_KILLER_PREFIX;
if (how == ASCENDED || (!gk.killer.name[0] && how == GENOCIDED))
gk.killer.format = NO_KILLER_PREFIX;
/* Avoid killed by "a" burning or "a" starvation */
if (!g.killer.name[0] && (how == STARVING || how == BURNING))
g.killer.format = KILLED_BY;
if (!g.killer.name[0] || how >= PANICKED)
Strcpy(g.killer.name, deaths[how]);
if (!gk.killer.name[0] && (how == STARVING || how == BURNING))
gk.killer.format = KILLED_BY;
if (!gk.killer.name[0] || how >= PANICKED)
Strcpy(gk.killer.name, deaths[how]);
if (how < PANICKED) {
u.umortality++;
@@ -1206,7 +1206,7 @@ done(int how)
negative (-1 is used as a flag in some circumstances
which don't apply when actually dying due to HP loss) */
u.uhp = u.mh = 0;
g.context.botl = 1;
gc.context.botl = 1;
}
}
if (Lifesaved && (how <= GENOCIDED)) {
@@ -1241,8 +1241,8 @@ done(int how)
}
if (survive) {
g.killer.name[0] = '\0';
g.killer.format = KILLED_BY_AN; /* reset to 0 */
gk.killer.name[0] = '\0';
gk.killer.format = KILLED_BY_AN; /* reset to 0 */
return;
}
really_done(how);
@@ -1265,11 +1265,11 @@ really_done(int how)
/*
* The game is now over...
*/
g.program_state.gameover = 1;
gp.program_state.gameover = 1;
/* in case of a subsequent panic(), there's no point trying to save */
g.program_state.something_worth_saving = 0;
gp.program_state.something_worth_saving = 0;
#ifdef HANGUPHANDLING
if (g.program_state.done_hup)
if (gp.program_state.done_hup)
done_stopprint++;
#endif
/* render vision subsystem inoperative */
@@ -1277,7 +1277,7 @@ really_done(int how)
/* maybe use up active invent item(s), place thrown/kicked missile,
deal with ball and chain possibly being temporarily off the map */
if (!g.program_state.panicking)
if (!gp.program_state.panicking)
done_object_cleanup();
/* in case we're panicking; normally cleared by done_object_cleanup() */
iflags.perm_invent = FALSE;
@@ -1307,7 +1307,7 @@ really_done(int how)
* On those rare occasions you get hosed immediately, go out
* smiling... :-) -3.
*/
if (g.moves <= 1 && how < PANICKED && !done_stopprint)
if (gm.moves <= 1 && how < PANICKED && !done_stopprint)
pline("Do not pass Go. Do not collect 200 %s.", currency(200L));
if (have_windows)
@@ -1337,21 +1337,21 @@ really_done(int how)
have been genocided: genocide could occur after hero is
already infected or hero could eat a glob of one created
before genocide; don't try to arise as one if they're gone */
&& !(g.mvitals[PM_GREEN_SLIME].mvflags & G_GENOD))
&& !(gm.mvitals[PM_GREEN_SLIME].mvflags & G_GENOD))
u.ugrave_arise = PM_GREEN_SLIME;
if (how == QUIT) {
g.killer.format = NO_KILLER_PREFIX;
gk.killer.format = NO_KILLER_PREFIX;
if (u.uhp < 1) {
how = DIED;
u.umortality++; /* skipped above when how==QUIT */
Strcpy(g.killer.name, "quit while already on Charon's boat");
Strcpy(gk.killer.name, "quit while already on Charon's boat");
}
}
if (how == ESCAPED || how == PANICKED)
g.killer.format = NO_KILLER_PREFIX;
gk.killer.format = NO_KILLER_PREFIX;
fixup_death(how); /* actually, fixup g.multi_reason */
fixup_death(how); /* actually, fixup gm.multi_reason */
if (how != PANICKED) {
boolean silently = done_stopprint ? TRUE : FALSE;
@@ -1376,7 +1376,7 @@ really_done(int how)
* Both are optional, so do it once here instead of duplicating
* it in both of those places.
*/
for (obj = g.invent; obj; obj = obj->nobj) {
for (obj = gi.invent; obj; obj = obj->nobj) {
discover_object(obj->otyp, TRUE, FALSE);
obj->known = obj->bknown = obj->dknown = obj->rknown = 1;
set_cknown_lknown(obj); /* set flags when applicable */
@@ -1410,7 +1410,7 @@ really_done(int how)
dump_everything(how, endtime);
}
/* if pets will contribute to score, populate g.mydogs list now
/* if pets will contribute to score, populate gm.mydogs list now
(bones creation isn't a factor, but pline() messaging is; used to
be done even sooner, but we need it to come after dump_everything()
so that any accompanying pets are still on the map during dump) */
@@ -1424,13 +1424,13 @@ really_done(int how)
/* grave creation should be after disclosure so it doesn't have
this grave in the current level's features for #overview */
if (bones_ok && u.ugrave_arise == NON_PM
&& !(g.mvitals[u.umonnum].mvflags & G_NOCORPSE)) {
&& !(gm.mvitals[u.umonnum].mvflags & G_NOCORPSE)) {
/* Base corpse on race when not poly'd since original u.umonnum
is based on role, and all role monsters are human. */
int mnum = !Upolyd ? g.urace.mnum : u.umonnum;
int mnum = !Upolyd ? gu.urace.mnum : u.umonnum;
corpse = mk_named_object(CORPSE, &mons[mnum], u.ux, u.uy, g.plname);
Sprintf(pbuf, "%s, ", g.plname);
corpse = mk_named_object(CORPSE, &mons[mnum], u.ux, u.uy, gp.plname);
Sprintf(pbuf, "%s, ", gp.plname);
formatkiller(eos(pbuf), sizeof pbuf - Strlen(pbuf), how, TRUE);
make_grave(u.ux, u.uy, pbuf);
}
@@ -1440,7 +1440,7 @@ really_done(int how)
{
int deepest = deepest_lev_reached(FALSE);
umoney = money_cnt(g.invent);
umoney = money_cnt(gi.invent);
tmp = u.umoney0;
umoney += hidden_gold(TRUE); /* accumulate gold from containers */
tmp = umoney - tmp; /* net gain */
@@ -1487,7 +1487,7 @@ really_done(int how)
/* update gold for the rip output, which can't use hidden_gold()
(containers will be gone by then if bones just got saved...) */
g.done_money = umoney;
gd.done_money = umoney;
/* clean up unneeded windows */
if (have_windows) {
@@ -1523,20 +1523,20 @@ really_done(int how)
}
#endif
if (u.uhave.amulet) {
Strcat(g.killer.name, " (with the Amulet)");
Strcat(gk.killer.name, " (with the Amulet)");
} else if (how == ESCAPED) {
if (Is_astralevel(&u.uz)) /* offered Amulet to wrong deity */
Strcat(g.killer.name, " (in celestial disgrace)");
Strcat(gk.killer.name, " (in celestial disgrace)");
else if (carrying(FAKE_AMULET_OF_YENDOR))
Strcat(g.killer.name, " (with a fake Amulet)");
Strcat(gk.killer.name, " (with a fake Amulet)");
/* don't bother counting to see whether it should be plural */
}
Sprintf(pbuf, "%s %s the %s...", Goodbye(), g.plname,
Sprintf(pbuf, "%s %s the %s...", Goodbye(), gp.plname,
(how != ASCENDED)
? (const char *) ((flags.female && g.urole.name.f)
? g.urole.name.f
: g.urole.name.m)
? (const char *) ((flags.female && gu.urole.name.f)
? gu.urole.name.f
: gu.urole.name.m)
: (const char *) (flags.female ? "Demigoddess" : "Demigod"));
dump_forward_putstr(endwin, 0, pbuf, done_stopprint);
dump_forward_putstr(endwin, 0, "", done_stopprint);
@@ -1547,14 +1547,14 @@ really_done(int how)
register struct val_list *val;
register int i;
for (val = g.valuables; val->list; val++)
for (val = gv.valuables; val->list; val++)
for (i = 0; i < val->size; i++) {
val->list[i].count = 0L;
}
get_valuables(g.invent);
get_valuables(gi.invent);
/* add points for collected valuables */
for (val = g.valuables; val->list; val++)
for (val = gv.valuables; val->list; val++)
for (i = 0; i < val->size; i++)
if (val->list[i].count != 0L) {
tmp = val->list[i].count
@@ -1563,10 +1563,10 @@ really_done(int how)
}
/* count the points for artifacts */
artifact_score(g.invent, TRUE, endwin);
artifact_score(gi.invent, TRUE, endwin);
g.viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */
mtmp = g.mydogs;
gv.viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */
mtmp = gm.mydogs;
Strcpy(pbuf, "You");
if (mtmp || Schroedingers_cat) {
while (mtmp) {
@@ -1576,7 +1576,7 @@ really_done(int how)
mtmp = mtmp->nmon;
}
/* [it might be more robust to create a housecat and add it to
g.mydogs; it doesn't have to be placed on the map for that] */
gm.mydogs; it doesn't have to be placed on the map for that] */
if (Schroedingers_cat) {
int mhp, m_lev = adj_lev(&mons[PM_HOUSECAT]);
@@ -1596,16 +1596,16 @@ really_done(int how)
dump_forward_putstr(endwin, 0, pbuf, done_stopprint);
if (!done_stopprint)
artifact_score(g.invent, FALSE, endwin); /* list artifacts */
artifact_score(gi.invent, FALSE, endwin); /* list artifacts */
#ifdef DUMPLOG
dump_redirect(TRUE);
if (iflags.in_dumplog)
artifact_score(g.invent, FALSE, 0);
artifact_score(gi.invent, FALSE, 0);
dump_redirect(FALSE);
#endif
/* list valuables here */
for (val = g.valuables; val->list; val++) {
for (val = gv.valuables; val->list; val++) {
sort_valuables(val->list, val->size);
for (i = 0; i < val->size && !done_stopprint; i++) {
int typ = val->list[i].typ;
@@ -1642,7 +1642,7 @@ really_done(int how)
(u.uz.dlevel < 0) ? "passed away" : ends[how]);
} else {
/* more conventional demise */
const char *where = g.dungeons[u.uz.dnum].dname;
const char *where = gd.dungeons[u.uz.dnum].dname;
if (Is_astralevel(&u.uz))
where = "The Astral Plane";
@@ -1657,7 +1657,7 @@ really_done(int how)
}
Sprintf(pbuf, "and %ld piece%s of gold, after %ld move%s.", umoney,
plur(umoney), g.moves, plur(g.moves));
plur(umoney), gm.moves, plur(gm.moves));
dump_forward_putstr(endwin, 0, pbuf, done_stopprint);
Sprintf(pbuf,
"You were level %d with a maximum of %d hit point%s when you %s.",
@@ -1783,7 +1783,7 @@ container_contents(
ATTRNORETURN void
nh_terminate(int status)
{
g.program_state.in_moveloop = 0; /* won't be returning to normal play */
gp.program_state.in_moveloop = 0; /* won't be returning to normal play */
l_nhcore_call(NHCORE_GAME_EXIT);
#ifdef MAC
@@ -1791,7 +1791,7 @@ nh_terminate(int status)
#endif
/* don't bother to try to release memory if we're in panic mode, to
avoid trouble in case that happens to be due to memory problems */
if (!g.program_state.panicking) {
if (!gp.program_state.panicking) {
freedynamicdata();
dlb_cleanup();
l_nhcore_done();
@@ -1805,10 +1805,10 @@ nh_terminate(int status)
*/
/* don't call exit() if already executing within an exit handler;
that would cancel any other pending user-mode handlers */
if (g.program_state.exiting)
if (gp.program_state.exiting)
return;
#endif
g.program_state.exiting = 1;
gp.program_state.exiting = 1;
nethack_exit(status);
}
@@ -1823,13 +1823,13 @@ delayed_killer(int id, int format, const char *killername)
k = (struct kinfo *) alloc(sizeof (struct kinfo));
(void) memset((genericptr_t) k, 0, sizeof (struct kinfo));
k->id = id;
k->next = g.killer.next;
g.killer.next = k;
k->next = gk.killer.next;
gk.killer.next = k;
}
k->format = format;
Strcpy(k->name, killername ? killername : "");
g.killer.name[0] = 0;
gk.killer.name[0] = 0;
}
struct kinfo *
@@ -1837,7 +1837,7 @@ find_delayed_killer(int id)
{
struct kinfo *k;
for (k = g.killer.next; k != (struct kinfo *) 0; k = k->next) {
for (k = gk.killer.next; k != (struct kinfo *) 0; k = k->next) {
if (k->id == id)
break;
}
@@ -1847,11 +1847,11 @@ find_delayed_killer(int id)
void
dealloc_killer(struct kinfo *kptr)
{
struct kinfo *prev = &g.killer, *k;
struct kinfo *prev = &gk.killer, *k;
if (kptr == (struct kinfo *) 0)
return;
for (k = g.killer.next; k != (struct kinfo *) 0; k = k->next) {
for (k = gk.killer.next; k != (struct kinfo *) 0; k = k->next) {
if (k == kptr)
break;
prev = k;
@@ -1872,16 +1872,16 @@ save_killers(NHFILE *nhfp)
struct kinfo *kptr;
if (perform_bwrite(nhfp)) {
for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) {
for (kptr = &gk.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) {
if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t)kptr, sizeof(struct kinfo));
}
}
if (release_data(nhfp)) {
while (g.killer.next) {
kptr = g.killer.next->next;
free((genericptr_t) g.killer.next);
g.killer.next = kptr;
while (gk.killer.next) {
kptr = gk.killer.next->next;
free((genericptr_t) gk.killer.next);
gk.killer.next = kptr;
}
}
}
@@ -1891,7 +1891,7 @@ restore_killers(NHFILE *nhfp)
{
struct kinfo *kptr;
for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) {
for (kptr = &gk.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) {
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t)kptr, sizeof(struct kinfo));
if (kptr->next) {
+47 -47
View File
@@ -151,7 +151,7 @@ can_reach_floor(boolean check_pit)
struct trap *t;
if (u.uswallow
|| (u.ustuck && !sticks(g.youmonst.data)
|| (u.ustuck && !sticks(gy.youmonst.data)
/* assume that arms are pinned rather than that the hero
has been lifted up above the floor [doesn't explain
how hero can attack the creature holding him or her;
@@ -162,10 +162,10 @@ can_reach_floor(boolean check_pit)
/* Restricted/unskilled riders can't reach the floor */
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
return FALSE;
if (u.uundetected && ceiling_hider(g.youmonst.data))
if (u.uundetected && ceiling_hider(gy.youmonst.data))
return FALSE;
if (Flying || g.youmonst.data->msize >= MZ_HUGE)
if (Flying || gy.youmonst.data->msize >= MZ_HUGE)
return TRUE;
if (check_pit && (t = t_at(u.ux, u.uy)) != 0
@@ -276,7 +276,7 @@ sengr_at(const char *s, coordxy x, coordxy y, boolean strict)
{
struct engr *ep = engr_at(x, y);
if (ep && ep->engr_type != HEADSTONE && ep->engr_time <= g.moves) {
if (ep && ep->engr_type != HEADSTONE && ep->engr_time <= gm.moves) {
if (strict ? !strcmpi(ep->engr_txt, s)
: (strstri(ep->engr_txt, s) != 0))
return ep;
@@ -381,7 +381,7 @@ read_engr_at(coordxy x, coordxy y)
et = ep->engr_txt;
}
You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et);
if (g.context.run > 0)
if (gc.context.run > 0)
nomul(0);
}
}
@@ -407,7 +407,7 @@ make_engr_at(coordxy x, coordxy y, const char *s, long e_time, xint16 e_type)
/* engraving "Elbereth": if done when making a level, it creates
an old-style Elbereth that deters monsters when any objects are
present; otherwise (done by the player), exercises wisdom */
if (g.in_mklev)
if (gi.in_mklev)
ep->guardobjects = 1;
else
exercise(A_WIS, TRUE);
@@ -488,7 +488,7 @@ u_can_engrave(void)
You_cant("write here.");
return FALSE;
}
if (cantwield(g.youmonst.data)) {
if (cantwield(gy.youmonst.data)) {
You_cant("even hold anything!");
return FALSE;
}
@@ -552,15 +552,15 @@ doengrave(void)
char *writer;
boolean frosted, adding;
g.multi = 0; /* moves consumed */
g.nomovemsg = (char *) 0; /* occupation end message */
gm.multi = 0; /* moves consumed */
gn.nomovemsg = (char *) 0; /* occupation end message */
buf[0] = (char) 0;
ebuf[0] = (char) 0;
post_engr_text[0] = (char) 0;
if (oep)
oetype = oep->engr_type;
if (is_demon(g.youmonst.data) || is_vampire(g.youmonst.data))
if (is_demon(gy.youmonst.data) || is_vampire(gy.youmonst.data))
type = ENGR_BLOOD;
/* Can the adventurer engrave at all? */
@@ -795,7 +795,7 @@ doengrave(void)
? "Chips fly out from the headstone."
: frosted
? "Ice chips fly up from the ice surface!"
: (g.level.locations[u.ux][u.uy].typ
: (gl.level.locations[u.ux][u.uy].typ
== DRAWBRIDGE_DOWN)
? "Splinters fly up from the bridge."
: "Gravel flies up from the floor.");
@@ -945,7 +945,7 @@ doengrave(void)
}
/* Something has changed the engraving here */
if (*buf) {
make_engr_at(u.ux, u.uy, buf, g.moves, type);
make_engr_at(u.ux, u.uy, buf, gm.moves, type);
if (!Blind)
pline_The("engraving now reads: \"%s\".", buf);
ptext = FALSE;
@@ -1109,18 +1109,18 @@ doengrave(void)
oep = (struct engr *) 0;
}
Strcpy(g.context.engraving.text, ebuf);
g.context.engraving.nextc = g.context.engraving.text;
g.context.engraving.stylus = otmp;
g.context.engraving.type = type;
g.context.engraving.pos.x = u.ux;
g.context.engraving.pos.y = u.uy;
g.context.engraving.actionct = 0;
Strcpy(gc.context.engraving.text, ebuf);
gc.context.engraving.nextc = gc.context.engraving.text;
gc.context.engraving.stylus = otmp;
gc.context.engraving.type = type;
gc.context.engraving.pos.x = u.ux;
gc.context.engraving.pos.y = u.uy;
gc.context.engraving.actionct = 0;
set_occupation(engrave, "engraving", 0);
if (post_engr_text[0])
pline("%s", post_engr_text);
if (doblind && !resists_blnd(&g.youmonst)) {
if (doblind && !resists_blnd(&gy.youmonst)) {
You("are blinded by the flash!");
make_blinded((long) rnd(50), FALSE);
if (!Blind)
@@ -1140,30 +1140,30 @@ engrave(void)
char buf[BUFSZ]; /* holds the post-this-action engr text, including
* anything already there */
const char *finishverb; /* "You finish [foo]." */
struct obj * stylus; /* shorthand for g.context.engraving.stylus */
boolean firsttime = (g.context.engraving.actionct == 0);
struct obj * stylus; /* shorthand for gc.context.engraving.stylus */
boolean firsttime = (gc.context.engraving.actionct == 0);
int rate = 10; /* # characters that can be engraved in this action */
boolean truncate = FALSE;
boolean carving = (g.context.engraving.type == ENGRAVE
|| g.context.engraving.type == HEADSTONE);
boolean carving = (gc.context.engraving.type == ENGRAVE
|| gc.context.engraving.type == HEADSTONE);
boolean dulling_wep, marker;
char *endc; /* points at character 1 beyond the last character to engrave
* this action */
int i, space_left;
if (g.context.engraving.pos.x != u.ux
|| g.context.engraving.pos.y != u.uy) { /* teleported? */
if (gc.context.engraving.pos.x != u.ux
|| gc.context.engraving.pos.y != u.uy) { /* teleported? */
pline("You are unable to continue engraving.");
return 0;
}
/* Stylus might have been taken out of inventory and destroyed somehow.
* Not safe to dereference stylus until after this. */
if (g.context.engraving.stylus == &cg.zeroobj) { /* bare finger */
if (gc.context.engraving.stylus == &cg.zeroobj) { /* bare finger */
stylus = (struct obj *) 0;
} else {
for (stylus = g.invent; stylus; stylus = stylus->nobj) {
if (stylus == g.context.engraving.stylus) {
for (stylus = gi.invent; stylus; stylus = stylus->nobj) {
if (stylus == gc.context.engraving.stylus) {
break;
}
}
@@ -1176,14 +1176,14 @@ engrave(void)
dulling_wep = (carving && stylus && stylus->oclass == WEAPON_CLASS
&& (stylus->otyp != ATHAME || stylus->cursed));
marker = (stylus && stylus->otyp == MAGIC_MARKER
&& g.context.engraving.type == MARK);
&& gc.context.engraving.type == MARK);
g.context.engraving.actionct++;
gc.context.engraving.actionct++;
/* sanity checks */
if (dulling_wep && !is_blade(stylus)) {
impossible("carving with non-bladed weapon");
} else if (g.context.engraving.type == MARK && !marker) {
} else if (gc.context.engraving.type == MARK && !marker) {
impossible("making graffiti with non-marker stylus");
}
@@ -1200,7 +1200,7 @@ engrave(void)
/* Step 2: Compute last character that can be engraved this action. */
i = rate;
for (endc = g.context.engraving.nextc; *endc && i > 0; endc++) {
for (endc = gc.context.engraving.nextc; *endc && i > 0; endc++) {
if (*endc != ' ') {
i--;
}
@@ -1219,7 +1219,7 @@ engrave(void)
if (firsttime) {
pline("%s dull.", Yobjnam2(stylus, "get"));
}
if (g.context.engraving.actionct % 2 == 1) { /* 1st, 3rd, ... action */
if (gc.context.engraving.actionct % 2 == 1) { /* 1st, 3rd, ... action */
/* deduct a point on 1st, 3rd, 5th, ... turns, unless this is the
* last character being engraved (a rather convoluted way to round
* down), but always deduct a point on the 1st turn to prevent
@@ -1232,7 +1232,7 @@ engrave(void)
impossible("<= -3 weapon valid for engraving");
}
truncate = TRUE;
} else if (*endc || g.context.engraving.actionct == 1) {
} else if (*endc || gc.context.engraving.actionct == 1) {
stylus->spe -= 1;
update_inventory();
}
@@ -1254,7 +1254,7 @@ engrave(void)
}
}
switch (g.context.engraving.type) {
switch (gc.context.engraving.type) {
default:
finishverb = "your weird engraving";
break;
@@ -1285,9 +1285,9 @@ engrave(void)
Strcpy(buf, oep->engr_txt);
space_left = (int) (sizeof buf - strlen(buf) - 1U);
if (endc - g.context.engraving.nextc > space_left) {
if (endc - gc.context.engraving.nextc > space_left) {
You("run out of room to write.");
endc = g.context.engraving.nextc + space_left;
endc = gc.context.engraving.nextc + space_left;
truncate = TRUE;
}
@@ -1295,19 +1295,19 @@ engrave(void)
* can't go any further. */
if (truncate && *endc != '\0') {
*endc = '\0';
You("are only able to write \"%s\".", g.context.engraving.text);
You("are only able to write \"%s\".", gc.context.engraving.text);
} else {
/* input was not truncated; stylus may still have worn out on the last
* character, though */
truncate = FALSE;
}
(void) strncat(buf, g.context.engraving.nextc,
min(space_left, endc - g.context.engraving.nextc));
make_engr_at(u.ux, u.uy, buf, g.moves - g.multi, g.context.engraving.type);
(void) strncat(buf, gc.context.engraving.nextc,
min(space_left, endc - gc.context.engraving.nextc));
make_engr_at(u.ux, u.uy, buf, gm.moves - gm.multi, gc.context.engraving.type);
if (*endc) {
g.context.engraving.nextc = endc;
gc.context.engraving.nextc = endc;
return 1; /* not yet finished this turn */
} else { /* finished engraving */
/* actions that happen after the engraving is finished go here */
@@ -1320,9 +1320,9 @@ engrave(void)
/* only print this if engraving took multiple actions */
You("finish %s.", finishverb);
}
g.context.engraving.text[0] = '\0';
g.context.engraving.nextc = (char *) 0;
g.context.engraving.stylus = (struct obj *) 0;
gc.context.engraving.text[0] = '\0';
gc.context.engraving.nextc = (char *) 0;
gc.context.engraving.stylus = (struct obj *) 0;
}
return 0;
}
@@ -1389,7 +1389,7 @@ rest_engravings(NHFILE *nhfp)
/* mark as finished for bones levels -- no problem for
* normal levels as the player must have finished engraving
* to be able to move again */
ep->engr_time = g.moves;
ep->engr_time = gm.moves;
}
}
+22 -22
View File
@@ -47,19 +47,19 @@ newpw(void)
int en = 0, enrnd, enfix;
if (u.ulevel == 0) {
en = g.urole.enadv.infix + g.urace.enadv.infix;
if (g.urole.enadv.inrnd > 0)
en += rnd(g.urole.enadv.inrnd);
if (g.urace.enadv.inrnd > 0)
en += rnd(g.urace.enadv.inrnd);
en = gu.urole.enadv.infix + gu.urace.enadv.infix;
if (gu.urole.enadv.inrnd > 0)
en += rnd(gu.urole.enadv.inrnd);
if (gu.urace.enadv.inrnd > 0)
en += rnd(gu.urace.enadv.inrnd);
} else {
enrnd = (int) ACURR(A_WIS) / 2;
if (u.ulevel < g.urole.xlev) {
enrnd += g.urole.enadv.lornd + g.urace.enadv.lornd;
enfix = g.urole.enadv.lofix + g.urace.enadv.lofix;
if (u.ulevel < gu.urole.xlev) {
enrnd += gu.urole.enadv.lornd + gu.urace.enadv.lornd;
enfix = gu.urole.enadv.lofix + gu.urace.enadv.lofix;
} else {
enrnd += g.urole.enadv.hirnd + g.urace.enadv.hirnd;
enfix = g.urole.enadv.hifix + g.urace.enadv.hifix;
enrnd += gu.urole.enadv.hirnd + gu.urace.enadv.hirnd;
enfix = gu.urole.enadv.hifix + gu.urace.enadv.hifix;
}
en = enermod(rn1(enrnd, enfix));
}
@@ -183,19 +183,19 @@ more_experienced(register int exper, register int rexp)
if (newexp != oldexp) {
u.uexp = newexp;
if (flags.showexp)
g.context.botl = TRUE;
gc.context.botl = TRUE;
/* even when experience points aren't being shown, experience level
might be highlighted with a percentage highlight rule and that
percentage depends upon experience points */
if (!g.context.botl && exp_percent_changing())
g.context.botl = TRUE;
if (!gc.context.botl && exp_percent_changing())
gc.context.botl = TRUE;
}
/* newrexp will always differ from oldrexp unless they're LONG_MAX */
if (newrexp != oldrexp) {
u.urexp = newrexp;
#ifdef SCORE_ON_BOTL
if (flags.showscore)
g.context.botl = TRUE;
gc.context.botl = TRUE;
#endif
}
if (u.urexp >= (Role_if(PM_WIZARD) ? 1000 : 2000))
@@ -213,7 +213,7 @@ losexp(
wizard mode request to reduce level; never fatal though */
if (drainer && !strcmp(drainer, "#levelchange"))
drainer = 0;
else if (resists_drli(&g.youmonst))
else if (resists_drli(&gy.youmonst))
return;
/* level-loss message; "Goodbye level 1." is fatal; divine anger
@@ -229,9 +229,9 @@ losexp(
livelog_printf(LL_MINORAC, "lost experience level %d", u.ulevel + 1);
} else {
if (drainer) {
g.killer.format = KILLED_BY;
if (g.killer.name != drainer)
Strcpy(g.killer.name, drainer);
gk.killer.format = KILLED_BY;
if (gk.killer.name != drainer)
Strcpy(gk.killer.name, drainer);
done(DIED);
}
/* no drainer or lifesaved */
@@ -273,14 +273,14 @@ losexp(
u.uexp = newuexp(u.ulevel) - 1;
if (Upolyd) {
num = monhp_per_lvl(&g.youmonst);
num = monhp_per_lvl(&gy.youmonst);
u.mhmax -= num;
u.mh -= num;
if (u.mh <= 0)
rehumanize();
}
g.context.botl = TRUE;
gc.context.botl = TRUE;
}
/*
@@ -309,7 +309,7 @@ pluslvl(
/* increase hit points (when polymorphed, do monster form first
in order to retain normal human/whatever increase for later) */
if (Upolyd) {
hpinc = monhp_per_lvl(&g.youmonst);
hpinc = monhp_per_lvl(&gy.youmonst);
u.mhmax += hpinc;
u.mh += hpinc;
}
@@ -359,7 +359,7 @@ pluslvl(
if (u.ulevel > u.ulevelpeak)
u.ulevelpeak = u.ulevel;
}
g.context.botl = TRUE;
gc.context.botl = TRUE;
}
/* compute a random amount of experience points suitable for the hero's
+45 -45
View File
@@ -29,7 +29,7 @@ explosionmask(
{
int res = EXPL_NONE;
if (m == &g.youmonst) {
if (m == &gy.youmonst) {
switch (adtyp) {
case AD_PHYS:
/* leave 'res' with EXPL_NONE */
@@ -208,7 +208,7 @@ explode(
so might get hit by double damage */
grabbed = grabbing = FALSE;
if (u.ustuck && !u.uswallow) {
if (Upolyd && sticks(g.youmonst.data))
if (Upolyd && sticks(gy.youmonst.data))
grabbing = TRUE;
else
grabbed = TRUE;
@@ -230,9 +230,9 @@ explode(
*/
if (olet == MON_EXPLODE && !you_exploding) {
/* when explode() is called recursively, g.killer.name might change so
/* when explode() is called recursively, gk.killer.name might change so
we need to retain a copy of the current value for this explosion */
str = strcpy(killr_buf, g.killer.name);
str = strcpy(killr_buf, gk.killer.name);
do_hallu = (Hallucination
&& (strstri(str, "'s explosion")
|| strstri(str, "s' explosion")));
@@ -297,7 +297,7 @@ explode(
explmask[i][j] = EXPL_NONE;
if (u_at(xx, yy)) {
explmask[i][j] = explosionmask(&g.youmonst, adtyp, olet);
explmask[i][j] = explosionmask(&gy.youmonst, adtyp, olet);
}
/* can be both you and mtmp if you're swallowed or riding */
mtmp = m_at(xx, yy);
@@ -399,7 +399,7 @@ explode(
* with an explosion attack, leave them (and their gear)
* unharmed, to avoid punishing them from using such
* polyforms creatively */
if (!g.context.mon_moving && you_exploding)
if (!gc.context.mon_moving && you_exploding)
uhurt = 0;
} else if (inside_engulfer) {
/* for inside_engulfer, only <u.ux,u.uy> is affected */
@@ -408,7 +408,7 @@ explode(
idamres = idamnonres = 0;
/* Affect the floor unless the player caused the explosion
* from inside their engulfer. */
if (!(u.uswallow && !g.context.mon_moving))
if (!(u.uswallow && !gc.context.mon_moving))
(void) zap_over_floor(xx, yy, type,
&shopdamage, exploding_wand_typ);
@@ -543,7 +543,7 @@ explode(
&& completelyburns(mtmp->data))
? XKILL_NOCORPSE : 0);
if (!g.context.mon_moving) {
if (!gc.context.mon_moving) {
xkilled(mtmp, XKILL_GIVEMSG | xkflg);
} else if (mdef && mtmp == mdef) {
/* 'mdef' killed self trying to cure being turned
@@ -565,7 +565,7 @@ explode(
adtyp = AD_RBRE; /* no corpse */
monkilled(mtmp, "", (int) adtyp);
}
} else if (!g.context.mon_moving) {
} else if (!gc.context.mon_moving) {
/* all affected monsters, even if mdef is set */
setmangry(mtmp, TRUE);
}
@@ -597,8 +597,8 @@ explode(
} else if (adtyp == AD_PHYS || adtyp == AD_ACID)
damu = Maybe_Half_Phys(damu);
if (adtyp == AD_FIRE) {
(void) burnarmor(&g.youmonst);
ignite_items(g.invent);
(void) burnarmor(&gy.youmonst);
ignite_items(gi.invent);
}
destroy_item(SCROLL_CLASS, (int) adtyp);
destroy_item(SPBOOK_CLASS, (int) adtyp);
@@ -619,7 +619,7 @@ explode(
u.mh -= damu;
else
u.uhp -= damu;
g.context.botl = 1;
gc.context.botl = 1;
}
/* You resisted the damage, lets not keep that to ourselves */
@@ -632,21 +632,21 @@ explode(
} else {
if (olet == MON_EXPLODE) {
if (generic) /* explosion was unseen; str=="explosion", */
; /* g.killer.name=="gas spore's explosion". */
else if (str != g.killer.name && str != hallu_buf)
Strcpy(g.killer.name, str);
g.killer.format = KILLED_BY_AN;
; /* gk.killer.name=="gas spore's explosion". */
else if (str != gk.killer.name && str != hallu_buf)
Strcpy(gk.killer.name, str);
gk.killer.format = KILLED_BY_AN;
} else if (type >= 0 && olet != SCROLL_CLASS) {
g.killer.format = NO_KILLER_PREFIX;
Snprintf(g.killer.name, sizeof g.killer.name,
gk.killer.format = NO_KILLER_PREFIX;
Snprintf(gk.killer.name, sizeof gk.killer.name,
"caught %sself in %s own %s", uhim(),
uhis(), str);
} else {
g.killer.format = (!strcmpi(str, "tower of flame")
gk.killer.format = (!strcmpi(str, "tower of flame")
|| !strcmpi(str, "fireball"))
? KILLED_BY_AN
: KILLED_BY;
Strcpy(g.killer.name, str);
Strcpy(gk.killer.name, str);
}
if (iflags.last_msg == PLNMSG_CAUGHT_IN_EXPLOSION
|| iflags.last_msg == PLNMSG_TOWER_OF_FLAME) /*seffects()*/
@@ -728,7 +728,7 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
if (shop_origin)
credit_report(shkp, 0, TRUE); /* establish baseline, without msgs */
while ((otmp = (individual_object ? obj : g.level.objects[sx][sy])) != 0) {
while ((otmp = (individual_object ? obj : gl.level.objects[sx][sy])) != 0) {
if (otmp == uball || otmp == uchain) {
boolean waschain = (otmp == uchain);
pline_The("chain shatters!");
@@ -814,20 +814,20 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
while (farthest-- > 0) {
for (stmp = schain; stmp; stmp = stmp->next) {
if ((stmp->range-- > 0) && (!stmp->stopped)) {
g.thrownobj = stmp->obj; /* mainly in case it kills hero */
g.bhitpos.x = stmp->ox + stmp->dx;
g.bhitpos.y = stmp->oy + stmp->dy;
typ = levl[g.bhitpos.x][g.bhitpos.y].typ;
if (!isok(g.bhitpos.x, g.bhitpos.y)) {
g.bhitpos.x -= stmp->dx;
g.bhitpos.y -= stmp->dy;
gt.thrownobj = stmp->obj; /* mainly in case it kills hero */
gb.bhitpos.x = stmp->ox + stmp->dx;
gb.bhitpos.y = stmp->oy + stmp->dy;
typ = levl[gb.bhitpos.x][gb.bhitpos.y].typ;
if (!isok(gb.bhitpos.x, gb.bhitpos.y)) {
gb.bhitpos.x -= stmp->dx;
gb.bhitpos.y -= stmp->dy;
stmp->stopped = TRUE;
} else if (!ZAP_POS(typ)
|| closed_door(g.bhitpos.x, g.bhitpos.y)) {
g.bhitpos.x -= stmp->dx;
g.bhitpos.y -= stmp->dy;
|| closed_door(gb.bhitpos.x, gb.bhitpos.y)) {
gb.bhitpos.x -= stmp->dx;
gb.bhitpos.y -= stmp->dy;
stmp->stopped = TRUE;
} else if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) {
} else if ((mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y)) != 0) {
if (scflags & MAY_HITMON) {
stmp->range--;
if (ohitmon(mtmp, stmp->obj, 1, FALSE)) {
@@ -835,16 +835,16 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
stmp->stopped = TRUE;
}
}
} else if (u_at(g.bhitpos.x, g.bhitpos.y)) {
} else if (u_at(gb.bhitpos.x, gb.bhitpos.y)) {
if (scflags & MAY_HITYOU) {
int hitvalu, hitu;
if (g.multi)
if (gm.multi)
nomul(0);
hitvalu = 8 + stmp->obj->spe;
if (bigmonst(g.youmonst.data))
if (bigmonst(gy.youmonst.data))
hitvalu++;
hitu = thitu(hitvalu, dmgval(stmp->obj, &g.youmonst),
hitu = thitu(hitvalu, dmgval(stmp->obj, &gy.youmonst),
&stmp->obj, (char *) 0);
if (!stmp->obj)
stmp->stopped = TRUE;
@@ -855,15 +855,15 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
}
} else {
if (scflags & VIS_EFFECTS) {
/* tmp_at(g.bhitpos.x, g.bhitpos.y); */
/* tmp_at(gb.bhitpos.x, gb.bhitpos.y); */
/* delay_output(); */
}
}
stmp->ox = g.bhitpos.x;
stmp->oy = g.bhitpos.y;
stmp->ox = gb.bhitpos.x;
stmp->oy = gb.bhitpos.y;
if (IS_SINK(levl[stmp->ox][stmp->oy].typ))
stmp->stopped = TRUE;
g.thrownobj = (struct obj *) 0;
gt.thrownobj = (struct obj *) 0;
}
}
}
@@ -906,8 +906,8 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
newsym(x, y);
}
newsym(sx, sy);
if (u_at(sx, sy) && u.uundetected && hides_under(g.youmonst.data))
(void) hideunder(&g.youmonst);
if (u_at(sx, sy) && u.uundetected && hides_under(gy.youmonst.data))
(void) hideunder(&gy.youmonst);
if (((mtmp = m_at(sx, sy)) != 0) && mtmp->mtrapped)
mtmp->mtrapped = 0;
maybe_unhide_at(sx, sy);
@@ -1021,15 +1021,15 @@ mon_explodes(struct monst *mon, struct attack *mattk)
/* This might end up killing you, too; you never know...
* also, it is used in explode() messages */
Sprintf(g.killer.name, "%s explosion",
Sprintf(gk.killer.name, "%s explosion",
s_suffix(pmname(mon->data, Mgender(mon))));
g.killer.format = KILLED_BY_AN;
gk.killer.format = KILLED_BY_AN;
explode(mon->mx, mon->my, type, dmg, MON_EXPLODE,
adtyp_to_expltype(mattk->adtyp));
/* reset killer */
g.killer.name[0] = '\0';
gk.killer.name[0] = '\0';
}
/*explode.c*/
+42 -42
View File
@@ -49,20 +49,20 @@ roguecorr(coordxy x, coordxy y, int dir)
register coordxy fromx, fromy, tox, toy;
if (dir == XL_DOWN) {
g.r[x][y].doortable &= ~XL_DOWN;
if (!g.r[x][y].real) {
fromx = g.r[x][y].rlx;
fromy = g.r[x][y].rly;
gr.r[x][y].doortable &= ~XL_DOWN;
if (!gr.r[x][y].real) {
fromx = gr.r[x][y].rlx;
fromy = gr.r[x][y].rly;
fromx += 1 + 26 * x;
fromy += 7 * y;
} else {
fromx = g.r[x][y].rlx + rn2(g.r[x][y].dx);
fromy = g.r[x][y].rly + g.r[x][y].dy;
fromx = gr.r[x][y].rlx + rn2(gr.r[x][y].dx);
fromy = gr.r[x][y].rly + gr.r[x][y].dy;
fromx += 1 + 26 * x;
fromy += 7 * y;
if (!IS_WALL(levl[fromx][fromy].typ))
impossible("down: no wall at %d,%d?", fromx, fromy);
dodoor(fromx, fromy, &g.rooms[g.r[x][y].nroom]);
dodoor(fromx, fromy, &gr.rooms[gr.r[x][y].nroom]);
levl[fromx][fromy].doormask = D_NODOOR;
fromy++;
}
@@ -71,40 +71,40 @@ roguecorr(coordxy x, coordxy y, int dir)
return;
}
y++;
g.r[x][y].doortable &= ~XL_UP;
if (!g.r[x][y].real) {
tox = g.r[x][y].rlx;
toy = g.r[x][y].rly;
gr.r[x][y].doortable &= ~XL_UP;
if (!gr.r[x][y].real) {
tox = gr.r[x][y].rlx;
toy = gr.r[x][y].rly;
tox += 1 + 26 * x;
toy += 7 * y;
} else {
tox = g.r[x][y].rlx + rn2(g.r[x][y].dx);
toy = g.r[x][y].rly - 1;
tox = gr.r[x][y].rlx + rn2(gr.r[x][y].dx);
toy = gr.r[x][y].rly - 1;
tox += 1 + 26 * x;
toy += 7 * y;
if (!IS_WALL(levl[tox][toy].typ))
impossible("up: no wall at %d,%d?", tox, toy);
dodoor(tox, toy, &g.rooms[g.r[x][y].nroom]);
dodoor(tox, toy, &gr.rooms[gr.r[x][y].nroom]);
levl[tox][toy].doormask = D_NODOOR;
toy--;
}
roguejoin(fromx, fromy, tox, toy, FALSE);
return;
} else if (dir == XL_RIGHT) {
g.r[x][y].doortable &= ~XL_RIGHT;
if (!g.r[x][y].real) {
fromx = g.r[x][y].rlx;
fromy = g.r[x][y].rly;
gr.r[x][y].doortable &= ~XL_RIGHT;
if (!gr.r[x][y].real) {
fromx = gr.r[x][y].rlx;
fromy = gr.r[x][y].rly;
fromx += 1 + 26 * x;
fromy += 7 * y;
} else {
fromx = g.r[x][y].rlx + g.r[x][y].dx;
fromy = g.r[x][y].rly + rn2(g.r[x][y].dy);
fromx = gr.r[x][y].rlx + gr.r[x][y].dx;
fromy = gr.r[x][y].rly + rn2(gr.r[x][y].dy);
fromx += 1 + 26 * x;
fromy += 7 * y;
if (!IS_WALL(levl[fromx][fromy].typ))
impossible("down: no wall at %d,%d?", fromx, fromy);
dodoor(fromx, fromy, &g.rooms[g.r[x][y].nroom]);
dodoor(fromx, fromy, &gr.rooms[gr.r[x][y].nroom]);
levl[fromx][fromy].doormask = D_NODOOR;
fromx++;
}
@@ -113,20 +113,20 @@ roguecorr(coordxy x, coordxy y, int dir)
return;
}
x++;
g.r[x][y].doortable &= ~XL_LEFT;
if (!g.r[x][y].real) {
tox = g.r[x][y].rlx;
toy = g.r[x][y].rly;
gr.r[x][y].doortable &= ~XL_LEFT;
if (!gr.r[x][y].real) {
tox = gr.r[x][y].rlx;
toy = gr.r[x][y].rly;
tox += 1 + 26 * x;
toy += 7 * y;
} else {
tox = g.r[x][y].rlx - 1;
toy = g.r[x][y].rly + rn2(g.r[x][y].dy);
tox = gr.r[x][y].rlx - 1;
toy = gr.r[x][y].rly + rn2(gr.r[x][y].dy);
tox += 1 + 26 * x;
toy += 7 * y;
if (!IS_WALL(levl[tox][toy].typ))
impossible("left: no wall at %d,%d?", tox, toy);
dodoor(tox, toy, &g.rooms[g.r[x][y].nroom]);
dodoor(tox, toy, &gr.rooms[gr.r[x][y].nroom]);
levl[tox][toy].doormask = D_NODOOR;
tox--;
}
@@ -146,18 +146,18 @@ miniwalk(coordxy x, coordxy y)
while (1) {
q = 0;
#define doorhere (g.r[x][y].doortable)
#define doorhere (gr.r[x][y].doortable)
if (x > 0 && (!(doorhere & XL_LEFT))
&& (!g.r[x - 1][y].doortable || !rn2(10)))
&& (!gr.r[x - 1][y].doortable || !rn2(10)))
dirs[q++] = 0;
if (x < 2 && (!(doorhere & XL_RIGHT))
&& (!g.r[x + 1][y].doortable || !rn2(10)))
&& (!gr.r[x + 1][y].doortable || !rn2(10)))
dirs[q++] = 1;
if (y > 0 && (!(doorhere & XL_UP))
&& (!g.r[x][y - 1].doortable || !rn2(10)))
&& (!gr.r[x][y - 1].doortable || !rn2(10)))
dirs[q++] = 2;
if (y < 2 && (!(doorhere & XL_DOWN))
&& (!g.r[x][y + 1].doortable || !rn2(10)))
&& (!gr.r[x][y + 1].doortable || !rn2(10)))
dirs[q++] = 3;
/* Rogue levels aren't just 3 by 3 mazes; they have some extra
* connections, thus that 1/10 chance
@@ -212,15 +212,15 @@ makeroguerooms(void)
* Room height may be 2-4 (2-5 on last row), length 2-23 (not
* counting walls).
*/
#define here g.r[x][y]
#define here gr.r[x][y]
g.nroom = 0;
gn.nroom = 0;
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++) {
/* Note: we want to insure at least 1 room. So, if the
* first 8 are all dummies, force the last to be a room.
*/
if (!rn2(5) && (g.nroom || (x < 2 && y < 2))) {
if (!rn2(5) && (gn.nroom || (x < 2 && y < 2))) {
/* Arbitrary: dummy rooms may only go where real
* ones do.
*/
@@ -235,19 +235,19 @@ makeroguerooms(void)
/* boundaries of room floor */
here.rlx = rnd(23 - here.dx + 1);
here.rly = rnd(((y == 2) ? 5 : 4) - here.dy + 1);
g.nroom++;
gn.nroom++;
}
here.doortable = 0;
}
miniwalk(rn2(3), rn2(3));
g.nroom = 0;
gn.nroom = 0;
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++) {
if (here.real) { /* Make a room */
coordxy lowx, lowy, hix, hiy;
g.r[x][y].nroom = g.nroom;
g.smeq[g.nroom] = g.nroom;
gr.r[x][y].nroom = gn.nroom;
gs.smeq[gn.nroom] = gn.nroom;
lowx = 1 + 26 * x + here.rlx;
lowy = 7 * y + here.rly;
@@ -295,9 +295,9 @@ makerogueghost(void)
struct mkroom *croom;
coordxy x, y;
if (!g.nroom)
if (!gn.nroom)
return; /* Should never happen */
croom = &g.rooms[rn2(g.nroom)];
croom = &gr.rooms[rn2(gn.nroom)];
x = somex(croom);
y = somey(croom);
if (!(ghost = makemon(&mons[PM_GHOST], x, y, NO_MM_FLAGS)))
+204 -204
View File
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -40,7 +40,7 @@ dowatersnakes(void)
register int num = rn1(5, 2);
struct monst *mtmp;
if (!(g.mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) {
if (!(gm.mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) {
if (!Blind)
pline("An endless stream of %s pours forth!",
Hallucination ? makeplural(rndmonnam(NULL)) : "snakes");
@@ -61,7 +61,7 @@ dowaterdemon(void)
{
struct monst *mtmp;
if (!(g.mvitals[PM_WATER_DEMON].mvflags & G_GONE)) {
if (!(gm.mvitals[PM_WATER_DEMON].mvflags & G_GONE)) {
if ((mtmp = makemon(&mons[PM_WATER_DEMON], u.ux, u.uy,
MM_NOMSG)) != 0) {
if (!Blind)
@@ -89,7 +89,7 @@ dowaternymph(void)
{
register struct monst *mtmp;
if (!(g.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
if (!(gm.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
&& (mtmp = makemon(&mons[PM_WATER_NYMPH], u.ux, u.uy,
MM_NOMSG)) != 0) {
if (!Blind)
@@ -141,7 +141,7 @@ gush(coordxy x, coordxy y, genericptr_t poolcnt)
levl[x][y].typ = POOL, levl[x][y].flags = 0;
/* No kelp! */
del_engr_at(x, y);
water_damage_chain(g.level.objects[x][y], TRUE);
water_damage_chain(gl.level.objects[x][y], TRUE);
if ((mtmp = m_at(x, y)) != 0)
(void) minliquid(mtmp);
@@ -218,7 +218,7 @@ dryup(coordxy x, coordxy y, boolean isyou)
/* replace the fountain with ordinary floor */
levl[x][y].typ = ROOM, levl[x][y].flags = 0;
levl[x][y].blessedftn = 0;
g.level.flags.nfountains--;
gl.level.flags.nfountains--;
/* The location is seen if the hero/monster is invisible
or felt if the hero is blind. */
newsym(x, y);
@@ -247,7 +247,7 @@ drinkfountain(void)
for (ii = 0; ii < A_MAX; ii++)
if (ABASE(ii) < AMAX(ii)) {
ABASE(ii) = AMAX(ii);
g.context.botl = 1;
gc.context.botl = 1;
}
/* gain ability, blessed if "natural" luck is high */
i = rn2(A_MAX); /* start at a random attribute */
@@ -310,7 +310,7 @@ drinkfountain(void)
morehungry(rn1(20, 11));
exercise(A_CON, FALSE);
/* this is more severe than rndcurse() */
for (obj = g.invent; obj; obj = obj->nobj)
for (obj = gi.invent; obj; obj = obj->nobj)
if (obj->oclass != COIN_CLASS && !obj->cursed && !rn2(5)) {
curse(obj);
++buc_changed;
@@ -422,7 +422,7 @@ dipfountain(register struct obj *obj)
update_inventory();
levl[u.ux][u.uy].typ = ROOM, levl[u.ux][u.uy].flags = 0;
newsym(u.ux, u.uy);
g.level.flags.nfountains--;
gl.level.flags.nfountains--;
if (in_town(u.ux, u.uy))
(void) angry_guards(FALSE);
return;
@@ -483,13 +483,13 @@ dipfountain(register struct obj *obj)
case 28: /* Strange feeling */
pline("An urge to take a bath overwhelms you.");
{
long money = money_cnt(g.invent);
long money = money_cnt(gi.invent);
struct obj *otmp;
if (money > 10) {
/* Amount to lose. Might get rounded up as fountains don't
* pay change... */
money = somegold(money) / 10;
for (otmp = g.invent; otmp && money > 0; otmp = otmp->nobj)
for (otmp = gi.invent; otmp && money > 0; otmp = otmp->nobj)
if (otmp->oclass == COIN_CLASS) {
int denomination = objects[otmp->otyp].oc_cost;
long coin_loss =
@@ -537,11 +537,11 @@ breaksink(coordxy x, coordxy y)
{
if (cansee(x, y) || u_at(x, y))
pline_The("pipes break! Water spurts out!");
g.level.flags.nsinks--;
gl.level.flags.nsinks--;
levl[x][y].typ = FOUNTAIN, levl[x][y].looted = 0;
levl[x][y].blessedftn = 0;
SET_FOUNTAIN_LOOTED(x, y);
g.level.flags.nfountains++;
gl.level.flags.nfountains++;
newsym(x, y);
}
@@ -572,7 +572,7 @@ drinksink(void)
/* boiling water burns considered fire damage */
break;
case 3:
if (g.mvitals[PM_SEWER_RAT].mvflags & G_GONE)
if (gm.mvitals[PM_SEWER_RAT].mvflags & G_GONE)
pline_The("sink seems quite dirty.");
else {
mtmp = makemon(&mons[PM_SEWER_RAT], u.ux, u.uy, MM_NOMSG);
@@ -614,7 +614,7 @@ drinksink(void)
break;
case 7:
pline_The("%s moves as though of its own will!", hliquid("water"));
if ((g.mvitals[PM_WATER_ELEMENTAL].mvflags & G_GONE)
if ((gm.mvitals[PM_WATER_ELEMENTAL].mvflags & G_GONE)
|| !makemon(&mons[PM_WATER_ELEMENTAL], u.ux, u.uy, MM_NOMSG))
pline("But it quiets down.");
break;
+242 -242
View File
File diff suppressed because it is too large Load Diff
+116 -116
View File
@@ -115,14 +115,14 @@ enlght_out(const char *buf)
{
int clr = 0;
if (g.en_via_menu) {
if (ge.en_via_menu) {
anything any;
any = cg.zeroany;
add_menu(g.en_win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf,
add_menu(ge.en_win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf,
MENU_ITEMFLAGS_NONE);
} else
putstr(g.en_win, 0, buf);
putstr(ge.en_win, 0, buf);
}
static void
@@ -248,7 +248,7 @@ cause_known(
/* simpler than from_what()/what_gives(); we don't attempt to
handle artifacts and we deliberately ignore wielded items */
for (o = g.invent; o; o = o->nobj) {
for (o = gi.invent; o; o = o->nobj) {
if (!(o->owornmask & mask))
continue;
if ((int) objects[o->otyp].oc_oprop == propindx
@@ -340,19 +340,19 @@ enlightenment(
{
char buf[BUFSZ], tmpbuf[BUFSZ];
g.en_win = create_nhwindow(NHW_MENU);
g.en_via_menu = !final;
if (g.en_via_menu)
start_menu(g.en_win, MENU_BEHAVE_STANDARD);
ge.en_win = create_nhwindow(NHW_MENU);
ge.en_via_menu = !final;
if (ge.en_via_menu)
start_menu(ge.en_win, MENU_BEHAVE_STANDARD);
Strcpy(tmpbuf, g.plname);
Strcpy(tmpbuf, gp.plname);
*tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */
/* as in background_enlightenment, when poly'd we need to use the saved
gender in u.mfemale rather than the current you-as-monster gender */
Snprintf(buf, sizeof(buf), "%s the %s's attributes:", tmpbuf,
((Upolyd ? u.mfemale : flags.female) && g.urole.name.f)
? g.urole.name.f
: g.urole.name.m);
((Upolyd ? u.mfemale : flags.female) && gu.urole.name.f)
? gu.urole.name.f
: gu.urole.name.m);
/* title */
enlght_out(buf); /* "Conan the Archeologist's attributes:" */
@@ -398,18 +398,18 @@ enlightenment(
(void) fmt_elapsed_time(buf, final);
enl_msg("Total elapsed playing time ", "is", "was", buf, "");
if (!g.en_via_menu) {
display_nhwindow(g.en_win, TRUE);
if (!ge.en_via_menu) {
display_nhwindow(ge.en_win, TRUE);
} else {
menu_item *selected = 0;
end_menu(g.en_win, (char *) 0);
if (select_menu(g.en_win, PICK_NONE, &selected) > 0)
end_menu(ge.en_win, (char *) 0);
if (select_menu(ge.en_win, PICK_NONE, &selected) > 0)
free((genericptr_t) selected);
g.en_via_menu = FALSE;
ge.en_via_menu = FALSE;
}
destroy_nhwindow(g.en_win);
g.en_win = WIN_ERR;
destroy_nhwindow(ge.en_win);
ge.en_win = WIN_ERR;
}
/*ARGSUSED*/
@@ -424,8 +424,8 @@ background_enlightenment(int unused_mode UNUSED, int final)
/* note that if poly'd, we need to use u.mfemale instead of flags.female
to access hero's saved gender-as-human/elf/&c rather than current */
innategend = (Upolyd ? u.mfemale : flags.female) ? 1 : 0;
role_titl = (innategend && g.urole.name.f) ? g.urole.name.f
: g.urole.name.m;
role_titl = (innategend && gu.urole.name.f) ? gu.urole.name.f
: gu.urole.name.m;
rank_titl = rank_of(u.ulevel, Role_switch, innategend);
enlght_out(""); /* separator after title */
@@ -439,8 +439,8 @@ background_enlightenment(int unused_mode UNUSED, int final)
the player to know he's not a samurai at the moment... */
if (Upolyd) {
char anbuf[20]; /* includes trailing space; [4] suffices */
struct permonst *uasmon = g.youmonst.data;
boolean altphrasing = vampshifted(&g.youmonst);
struct permonst *uasmon = gy.youmonst.data;
boolean altphrasing = vampshifted(&gy.youmonst);
tmpbuf[0] = '\0';
/* here we always use current gender, not saved role gender */
@@ -448,7 +448,7 @@ background_enlightenment(int unused_mode UNUSED, int final)
Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj);
if (altphrasing)
Sprintf(eos(tmpbuf), "%s in ",
pmname(&mons[g.youmonst.cham],
pmname(&mons[gy.youmonst.cham],
flags.female ? FEMALE : MALE));
Snprintf(buf, sizeof(buf), "%s%s%s%s form",
!final ? "currently " : "",
@@ -459,8 +459,8 @@ background_enlightenment(int unused_mode UNUSED, int final)
/* report role; omit gender if it's redundant (eg, "female priestess") */
tmpbuf[0] = '\0';
if (!g.urole.name.f
&& ((g.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
if (!gu.urole.name.f
&& ((gu.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
|| innategend != flags.initgend))
Sprintf(tmpbuf, "%s ", genders[innategend].adj);
buf[0] = '\0';
@@ -469,10 +469,10 @@ background_enlightenment(int unused_mode UNUSED, int final)
if (!strcmpi(rank_titl, role_titl)) {
/* omit role when rank title matches it */
Sprintf(eos(buf), "%s, level %d %s%s", an(rank_titl), u.ulevel,
tmpbuf, g.urace.noun);
tmpbuf, gu.urace.noun);
} else {
Sprintf(eos(buf), "%s, a level %d %s%s %s", an(rank_titl), u.ulevel,
tmpbuf, g.urace.adj, role_titl);
tmpbuf, gu.urace.adj, role_titl);
}
you_are(buf, "");
@@ -494,7 +494,7 @@ background_enlightenment(int unused_mode UNUSED, int final)
way sooner (in other words, didn't start that way) */
? (!final ? "now " : "belatedly ")
/* atheist (ignored in very early game) */
: (!u.uconduct.gnostic && g.moves > 1000L)
: (!u.uconduct.gnostic && gm.moves > 1000L)
? "nominally "
/* lastly, normal case */
: "",
@@ -552,13 +552,13 @@ background_enlightenment(int unused_mode UNUSED, int final)
!strncmp(tmpbuf, "Plane", 5) ? "Elemental " : "", tmpbuf);
} else if (Is_knox(&u.uz)) {
/* this gives away the fact that the knox branch is only 1 level */
Sprintf(buf, "on the %s level", g.dungeons[u.uz.dnum].dname);
Sprintf(buf, "on the %s level", gd.dungeons[u.uz.dnum].dname);
/* TODO? maybe phrase it differently when actually inside the fort,
if we're able to determine that (not trivial) */
} else {
char dgnbuf[QBUFSZ];
Strcpy(dgnbuf, g.dungeons[u.uz.dnum].dname);
Strcpy(dgnbuf, gd.dungeons[u.uz.dnum].dname);
if (!strncmpi(dgnbuf, "The ", 4))
*dgnbuf = lowc(*dgnbuf);
Sprintf(tmpbuf, "level %d",
@@ -574,11 +574,11 @@ background_enlightenment(int unused_mode UNUSED, int final)
you_are(buf, "");
/* this is shown even if the 'time' option is off */
if (g.moves == 1L) {
if (gm.moves == 1L) {
you_have("just started your adventure", "");
} else {
/* 'turns' grates on the nerves in this context... */
Sprintf(buf, "the dungeon %ld turn%s ago", g.moves, plur(g.moves));
Sprintf(buf, "the dungeon %ld turn%s ago", gm.moves, plur(gm.moves));
/* same phrasing for current and final: "entered" is unconditional */
enlght_line(You_, "entered ", buf, "");
}
@@ -721,7 +721,7 @@ basics_enlightenment(int mode UNUSED, int final)
/* gold; similar to doprgold (#showgold) but without shop billing info;
includes container contents, unlike status line but like doprgold */
{
long umoney = money_cnt(g.invent), hmoney = hidden_gold(final);
long umoney = money_cnt(gi.invent), hmoney = hidden_gold(final);
if (!umoney) {
Sprintf(buf, " Your wallet %s empty", !final ? "is" : "was");
@@ -756,7 +756,7 @@ basics_enlightenment(int mode UNUSED, int final)
*ocl ? ocl : "all types", *ocl ? "'" : "");
if (flags.pickup_thrown && *ocl)
Strcat(buf, " plus thrown"); /* show when not 'all types' */
if (g.apelist)
if (ga.apelist)
Strcat(buf, ", with exceptions");
}
} else
@@ -888,7 +888,7 @@ status_enlightenment(int mode, int final)
/* if hero dies while dismounting, u.usteed will still
be set; we want to ignore steed in that situation */
&& !(final == ENL_GAMEOVERDEAD
&& !strcmp(g.killer.name, "riding accident")));
&& !strcmp(gk.killer.name, "riding accident")));
const char *steedname = (!Riding ? (char *) 0
: x_monnam(u.usteed,
u.usteed->mtame ? ARTICLE_YOUR : ARTICLE_THE,
@@ -1002,16 +1002,16 @@ status_enlightenment(int mode, int final)
/* from_what() (currently wizard-mode only) checks !haseyes()
before u.uroleplay.blind, so we should too */
Sprintf(buf, "%s blind",
!haseyes(g.youmonst.data) ? "innately"
!haseyes(gy.youmonst.data) ? "innately"
: u.uroleplay.blind ? "permanently"
/* better phrasing desperately wanted... */
: Blindfolded_only ? "deliberately"
: "temporarily");
if (wizard && (Blinded & TIMEOUT) != 0L
&& !u.uroleplay.blind && haseyes(g.youmonst.data))
&& !u.uroleplay.blind && haseyes(gy.youmonst.data))
Sprintf(eos(buf), " (%ld)", (Blinded & TIMEOUT));
/* !haseyes: avoid "you are innately blind innately" */
you_are(buf, !haseyes(g.youmonst.data) ? "" : from_what(BLINDED));
you_are(buf, !haseyes(gy.youmonst.data) ? "" : from_what(BLINDED));
}
if (Deaf)
you_are("deaf", from_what(DEAF));
@@ -1064,7 +1064,7 @@ status_enlightenment(int mode, int final)
Sprintf(eos(buf), " (%u)", u.uswldtim);
you_are(buf, "");
} else if (u.ustuck) {
boolean ustick = (Upolyd && sticks(g.youmonst.data));
boolean ustick = (Upolyd && sticks(gy.youmonst.data));
int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy;
Snprintf(buf, sizeof buf, "%s %s (%s)",
@@ -1192,7 +1192,7 @@ status_enlightenment(int mode, int final)
/* unlike ring of increase accuracy's effect, the monk's suit penalty
is too blatant to be restricted to magical enlightenment */
if (iflags.tux_penalty && !Upolyd) {
(void) enlght_combatinc("to hit", -g.urole.spelarmr, final, buf);
(void) enlght_combatinc("to hit", -gu.urole.spelarmr, final, buf);
/* if from_what() ever gets extended from wizard mode to normal
play, it could be adapted to handle this */
Sprintf(eos(buf), " due to your %s", suit_simple_name(uarm));
@@ -1494,7 +1494,7 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
you_can("recognize detrimental food", "");
/*** Vision and senses ***/
if (!Blind && (Blinded || !haseyes(g.youmonst.data)))
if (!Blind && (Blinded || !haseyes(gy.youmonst.data)))
you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */
if (See_invisible) {
if (!Blind)
@@ -1507,32 +1507,32 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
you_are("telepathic", from_what(TELEPAT));
if (Warning)
you_are("warned", from_what(WARNING));
if (Warn_of_mon && g.context.warntype.obj) {
if (Warn_of_mon && gc.context.warntype.obj) {
Sprintf(buf, "aware of the presence of %s",
(g.context.warntype.obj & M2_ORC) ? "orcs"
: (g.context.warntype.obj & M2_ELF) ? "elves"
: (g.context.warntype.obj & M2_DEMON) ? "demons" : something);
(gc.context.warntype.obj & M2_ORC) ? "orcs"
: (gc.context.warntype.obj & M2_ELF) ? "elves"
: (gc.context.warntype.obj & M2_DEMON) ? "demons" : something);
you_are(buf, from_what(WARN_OF_MON));
}
if (Warn_of_mon && g.context.warntype.polyd) {
if (Warn_of_mon && gc.context.warntype.polyd) {
Sprintf(buf, "aware of the presence of %s",
((g.context.warntype.polyd & (M2_HUMAN | M2_ELF))
((gc.context.warntype.polyd & (M2_HUMAN | M2_ELF))
== (M2_HUMAN | M2_ELF))
? "humans and elves"
: (g.context.warntype.polyd & M2_HUMAN)
: (gc.context.warntype.polyd & M2_HUMAN)
? "humans"
: (g.context.warntype.polyd & M2_ELF)
: (gc.context.warntype.polyd & M2_ELF)
? "elves"
: (g.context.warntype.polyd & M2_ORC)
: (gc.context.warntype.polyd & M2_ORC)
? "orcs"
: (g.context.warntype.polyd & M2_DEMON)
: (gc.context.warntype.polyd & M2_DEMON)
? "demons"
: "certain monsters");
you_are(buf, "");
}
if (Warn_of_mon && g.context.warntype.speciesidx >= LOW_PM) {
if (Warn_of_mon && gc.context.warntype.speciesidx >= LOW_PM) {
Sprintf(buf, "aware of the presence of %s",
makeplural(mons[g.context.warntype.speciesidx].pmnames[NEUTRAL]));
makeplural(mons[gc.context.warntype.speciesidx].pmnames[NEUTRAL]));
you_are(buf, from_what(WARN_OF_MON));
}
if (Undead_warning)
@@ -1659,7 +1659,7 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
}
/* including this might bring attention to the fact that ceiling
clinging has inconsistencies... */
if (is_clinger(g.youmonst.data)) {
if (is_clinger(gy.youmonst.data)) {
boolean has_lid = has_ceiling(&u.uz);
if (has_lid && !u.uinwater) {
@@ -1697,9 +1697,9 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
if (iflags.tux_penalty && !Upolyd)
Sprintf(eos(buf), " %s your suit's penalty",
(u.uhitinc < 0) ? "increasing"
: (u.uhitinc < 4 * g.urole.spelarmr / 5)
: (u.uhitinc < 4 * gu.urole.spelarmr / 5)
? "partly offsetting"
: (u.uhitinc < g.urole.spelarmr) ? "nearly offseting"
: (u.uhitinc < gu.urole.spelarmr) ? "nearly offseting"
: "overcoming");
you_have(buf, "");
}
@@ -1720,7 +1720,7 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
if (prot)
you_have(enlght_combatinc("defense", prot, final, buf), "");
}
if ((armpro = magic_negation(&g.youmonst)) > 0) {
if ((armpro = magic_negation(&gy.youmonst)) > 0) {
/* magic cancellation factor, conferred by worn armor */
static const char *const mc_types[] = {
"" /*ordinary*/, "warded", "guarded", "protected",
@@ -1769,20 +1769,20 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
&& !(final == ENL_GAMEOVERDEAD
&& u.umonnum == PM_GREEN_SLIME && !Unchanging)) {
/* foreign shape (except were-form which is handled below) */
if (!vampshifted(&g.youmonst))
if (!vampshifted(&gy.youmonst))
Sprintf(buf, "polymorphed into %s",
an(pmname(g.youmonst.data,
an(pmname(gy.youmonst.data,
flags.female ? FEMALE : MALE)));
else
Sprintf(buf, "polymorphed into %s in %s form",
an(pmname(&mons[g.youmonst.cham],
an(pmname(&mons[gy.youmonst.cham],
flags.female ? FEMALE : MALE)),
pmname(g.youmonst.data, flags.female ? FEMALE : MALE));
pmname(gy.youmonst.data, flags.female ? FEMALE : MALE));
if (wizard)
Sprintf(eos(buf), " (%d)", u.mtimedone);
you_are(buf, "");
}
if (lays_eggs(g.youmonst.data) && flags.female) /* Upolyd */
if (lays_eggs(gy.youmonst.data) && flags.female) /* Upolyd */
you_can("lay eggs", "");
if (u.ulycn >= LOW_PM) {
/* "you are a werecreature [in beast form]" */
@@ -1867,14 +1867,14 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
struct fruit *f;
reorder_fruit(TRUE); /* sort by fruit index, from low to high;
* this modifies the g.ffruit chain, so could
* this modifies the gf.ffruit chain, so could
* possibly mask or even introduce a problem,
* but it does useful sanity checking */
for (f = g.ffruit; f; f = f->nextf) {
for (f = gf.ffruit; f; f = f->nextf) {
Sprintf(buf, "Fruit #%d ", f->fid);
enl_msg(buf, "is ", "was ", f->fname, "");
}
enl_msg("The current fruit ", "is ", "was ", g.pl_fruit, "");
enl_msg("The current fruit ", "is ", "was ", gp.pl_fruit, "");
Sprintf(buf, "%d", flags.made_fruit);
enl_msg("The made fruit flag ", "is ", "was ", buf, "");
}
@@ -1948,7 +1948,7 @@ youhiding(boolean via_enlghtmt, /* englightment line vs topl message */
for the hypothetical furniture and monster cases */
bp = eos(strcpy(buf, "mimicking"));
if (U_AP_TYPE == M_AP_OBJECT) {
Sprintf(bp, " %s", an(simple_typename(g.youmonst.mappearance)));
Sprintf(bp, " %s", an(simple_typename(gy.youmonst.mappearance)));
} else if (U_AP_TYPE == M_AP_FURNITURE) {
Strcpy(bp, " something");
} else if (U_AP_TYPE == M_AP_MONSTER) {
@@ -1958,15 +1958,15 @@ youhiding(boolean via_enlghtmt, /* englightment line vs topl message */
}
} else if (u.uundetected) {
bp = eos(buf); /* points past "hiding" */
if (g.youmonst.data->mlet == S_EEL) {
if (gy.youmonst.data->mlet == S_EEL) {
if (is_pool(u.ux, u.uy))
Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy));
} else if (hides_under(g.youmonst.data)) {
struct obj *o = g.level.objects[u.ux][u.uy];
} else if (hides_under(gy.youmonst.data)) {
struct obj *o = gl.level.objects[u.ux][u.uy];
if (o)
Sprintf(bp, " underneath %s", ansimpleoname(o));
} else if (is_clinger(g.youmonst.data) || Flying) {
} else if (is_clinger(gy.youmonst.data) || Flying) {
/* Flying: 'lurker above' hides on ceiling but doesn't cling */
Sprintf(bp, " on the %s", ceiling(u.ux, u.uy));
} else {
@@ -2009,8 +2009,8 @@ show_conduct(int final)
int ngenocided;
/* Create the conduct window */
g.en_win = create_nhwindow(NHW_MENU);
putstr(g.en_win, 0, "Voluntary challenges:");
ge.en_win = create_nhwindow(NHW_MENU);
putstr(ge.en_win, 0, "Voluntary challenges:");
if (u.uroleplay.blind)
you_have_been("blind from birth");
@@ -2133,9 +2133,9 @@ show_conduct(int final)
show_achievements(final);
/* Pop up the window and wait for a key */
display_nhwindow(g.en_win, TRUE);
destroy_nhwindow(g.en_win);
g.en_win = WIN_ERR;
display_nhwindow(ge.en_win, TRUE);
destroy_nhwindow(ge.en_win);
ge.en_win = WIN_ERR;
}
/*
@@ -2162,8 +2162,8 @@ show_achievements(
if ((acnt = count_achievements()) == 0)
return;
if (g.en_win != WIN_ERR) {
awin = g.en_win; /* end of game disclosure window */
if (ge.en_win != WIN_ERR) {
awin = ge.en_win; /* end of game disclosure window */
putstr(awin, 0, "");
} else {
awin = create_nhwindow(NHW_MENU);
@@ -2299,7 +2299,7 @@ show_achievements(
} /* switch */
} /* for */
if (awin != g.en_win) {
if (awin != ge.en_win) {
display_nhwindow(awin, TRUE);
destroy_nhwindow(awin);
}
@@ -2333,7 +2333,7 @@ record_achievement(schar achidx)
/* avoid livelog for achievements recorded during final disclosure:
nudist and blind-from-birth; also ascension which is suppressed
by this gets logged separately in really_done() */
if (g.program_state.gameover)
if (gp.program_state.gameover)
return;
if (absidx >= ACH_RNK1 && absidx <= ACH_RNK8) {
@@ -2346,8 +2346,8 @@ record_achievement(schar achidx)
|| achidx == ACH_MINE_PRIZE) {
/* need to supply extra information for these two */
short otyp = ((achidx == ACH_SOKO_PRIZE)
? g.context.achieveo.soko_prize_otyp
: g.context.achieveo.mines_prize_otyp);
? gc.context.achieveo.soko_prize_otyp
: gc.context.achieveo.mines_prize_otyp);
/* note: OBJ_NAME() works here because both "bag of holding" and
"amulet of reflection" are fully named in their objects[] entry
@@ -2421,7 +2421,7 @@ int
do_gamelog(void)
{
#ifdef CHRONICLE
if (g.gamelog) {
if (gg.gamelog) {
show_gamelog(ENL_GAMEINPROGRESS);
} else {
pline("No chronicled events.");
@@ -2458,7 +2458,7 @@ show_gamelog(int final)
win = create_nhwindow(NHW_TEXT);
Sprintf(buf, "%s events:", final ? "Major" : "Logged");
putstr(win, 0, buf);
for (llmsg = g.gamelog; llmsg; llmsg = llmsg->next) {
for (llmsg = gg.gamelog; llmsg; llmsg = llmsg->next) {
if (final && !majorevent(llmsg))
continue;
if (!final && !wizard && spoilerevent(llmsg))
@@ -2507,7 +2507,7 @@ vanqsort_cmp(
const char *name1, *name2, *punct;
schar mcls1, mcls2;
switch (g.vanq_sortmode) {
switch (gv.vanq_sortmode) {
default:
case VANQ_MLVL_MNDX:
/* sort by monster level */
@@ -2564,16 +2564,16 @@ vanqsort_cmp(
mlev1 = mons[indx1].mlevel;
mlev2 = mons[indx2].mlevel;
res = mlev1 - mlev2; /* mlevel low to high */
if (g.vanq_sortmode == VANQ_MCLS_HTOL)
if (gv.vanq_sortmode == VANQ_MCLS_HTOL)
res = -res; /* mlevel high to low */
}
break;
case VANQ_COUNT_H_L:
case VANQ_COUNT_L_H:
died1 = g.mvitals[indx1].died;
died2 = g.mvitals[indx2].died;
died1 = gm.mvitals[indx1].died;
died2 = gm.mvitals[indx2].died;
res = died2 - died1; /* dead count high to low */
if (g.vanq_sortmode == VANQ_COUNT_L_H)
if (gv.vanq_sortmode == VANQ_COUNT_L_H)
res = -res; /* dead count low to high */
break;
}
@@ -2602,7 +2602,7 @@ set_vanq_order(void)
any.a_int = i + 1;
add_menu(tmpwin, &nul_glyphinfo, &any, *vanqorders[i][0], 0,
ATR_NONE, clr, vanqorders[i][1],
(i == g.vanq_sortmode) ? MENU_ITEMFLAGS_SELECTED
(i == gv.vanq_sortmode) ? MENU_ITEMFLAGS_SELECTED
: MENU_ITEMFLAGS_NONE);
}
end_menu(tmpwin, "Sort order for vanquished monster counts");
@@ -2612,12 +2612,12 @@ set_vanq_order(void)
if (n > 0) {
choice = selected[0].item.a_int - 1;
/* skip preselected entry if we have more than one item chosen */
if (n > 1 && choice == g.vanq_sortmode)
if (n > 1 && choice == gv.vanq_sortmode)
choice = selected[1].item.a_int - 1;
free((genericptr_t) selected);
g.vanq_sortmode = choice;
gv.vanq_sortmode = choice;
}
return (n < 0) ? -1 : g.vanq_sortmode;
return (n < 0) ? -1 : gv.vanq_sortmode;
}
/* #vanquished command */
@@ -2642,18 +2642,18 @@ doborn(void)
putstr(datawin, 0, "died born");
for (i = LOW_PM; i < NUMMONS; i++)
if (g.mvitals[i].born || g.mvitals[i].died
|| (g.mvitals[i].mvflags & G_GONE) != 0) {
if (gm.mvitals[i].born || gm.mvitals[i].died
|| (gm.mvitals[i].mvflags & G_GONE) != 0) {
Sprintf(buf, fmt,
g.mvitals[i].died, g.mvitals[i].born,
((g.mvitals[i].mvflags & G_GONE) == G_EXTINCT) ? 'E'
: ((g.mvitals[i].mvflags & G_GONE) == G_GENOD) ? 'G'
: ((g.mvitals[i].mvflags & G_GONE) != 0) ? 'X'
gm.mvitals[i].died, gm.mvitals[i].born,
((gm.mvitals[i].mvflags & G_GONE) == G_EXTINCT) ? 'E'
: ((gm.mvitals[i].mvflags & G_GONE) == G_GENOD) ? 'G'
: ((gm.mvitals[i].mvflags & G_GONE) != 0) ? 'X'
: ' ',
mons[i].pmnames[NEUTRAL]);
putstr(datawin, 0, buf);
nborn += g.mvitals[i].born;
ndied += g.mvitals[i].died;
nborn += gm.mvitals[i].born;
ndied += gm.mvitals[i].died;
}
putstr(datawin, 0, "");
@@ -2671,7 +2671,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL
#define UniqCritterIndx(mndx) ((mons[mndx].geno & G_UNIQ) \
&& mndx != PM_HIGH_CLERIC)
#define done_stopprint g.program_state.stopprint
#define done_stopprint gp.program_state.stopprint
void
list_vanquished(char defquery, boolean ask)
@@ -2694,7 +2694,7 @@ list_vanquished(char defquery, boolean ask)
/* get totals first */
ntypes = 0;
for (i = LOW_PM; i < NUMMONS; i++) {
if ((nkilled = (int) g.mvitals[i].died) == 0)
if ((nkilled = (int) gm.mvitals[i].died) == 0)
continue;
mindx[ntypes++] = i;
total_killed += (long) nkilled;
@@ -2720,9 +2720,9 @@ list_vanquished(char defquery, boolean ask)
if (set_vanq_order() < 0)
return;
}
uniq_header = (g.vanq_sortmode == VANQ_ALPHA_SEP);
class_header = ((g.vanq_sortmode == VANQ_MCLS_LTOH
|| g.vanq_sortmode == VANQ_MCLS_HTOL)
uniq_header = (gv.vanq_sortmode == VANQ_ALPHA_SEP);
class_header = ((gv.vanq_sortmode == VANQ_MCLS_LTOH
|| gv.vanq_sortmode == VANQ_MCLS_HTOL)
&& ntypes > 1);
klwin = create_nhwindow(NHW_MENU);
@@ -2733,7 +2733,7 @@ list_vanquished(char defquery, boolean ask)
qsort((genericptr_t) mindx, ntypes, sizeof *mindx, vanqsort_cmp);
for (ni = 0; ni < ntypes; ni++) {
i = mindx[ni];
nkilled = g.mvitals[i].died;
nkilled = gm.mvitals[i].died;
mlet = mons[i].mlet;
if (class_header && mlet != prev_mlet) {
Strcpy(buf, def_monsyms[(int) mlet].explain);
@@ -2812,7 +2812,7 @@ num_genocides(void)
int i, n = 0;
for (i = LOW_PM; i < NUMMONS; ++i) {
if (g.mvitals[i].mvflags & G_GENOD) {
if (gm.mvitals[i].mvflags & G_GENOD) {
++n;
if (UniqCritterIndx(i))
impossible("unique creature '%d: %s' genocided?",
@@ -2830,7 +2830,7 @@ num_extinct(void)
for (i = LOW_PM; i < NUMMONS; ++i) {
if (UniqCritterIndx(i))
continue;
if ((g.mvitals[i].mvflags & G_GONE) == G_EXTINCT)
if ((gm.mvitals[i].mvflags & G_GONE) == G_EXTINCT)
++n;
}
return n;
@@ -2876,7 +2876,7 @@ list_genocided(char defquery, boolean ask)
however, they're never reported as extinct, so skip them */
if (UniqCritterIndx(i))
continue;
if (g.mvitals[i].mvflags & G_GONE) {
if (gm.mvitals[i].mvflags & G_GONE) {
Sprintf(buf, " %s", makeplural(mons[i].pmnames[NEUTRAL]));
/*
* "Extinct" is unfortunate terminology. A species
@@ -2884,7 +2884,7 @@ list_genocided(char defquery, boolean ask)
* but there might be members of the species still
* alive, contradicting the meaning of the word.
*/
if ((g.mvitals[i].mvflags & G_GONE) == G_EXTINCT)
if ((gm.mvitals[i].mvflags & G_GONE) == G_EXTINCT)
Strcat(buf, " (extinct)");
putstr(klwin, 0, buf);
}
@@ -3002,7 +3002,7 @@ mstatusline(struct monst *mtmp)
Strcat(info, ", single segment");
} else {
++nsegs; /* include head in the segment count */
segndx = wseg_at(mtmp, g.bhitpos.x, g.bhitpos.y);
segndx = wseg_at(mtmp, gb.bhitpos.x, gb.bhitpos.y);
Sprintf(eos(info), ", %d%s of %d segments",
segndx, ordin(segndx), nsegs);
}
@@ -3066,7 +3066,7 @@ mstatusline(struct monst *mtmp)
: ", engulfing you")
/* !u.uswallow; if both youmonst and ustuck are holders,
youmonst wins */
: (!sticks(g.youmonst.data) ? ", holding you"
: (!sticks(gy.youmonst.data) ? ", holding you"
: ", held by you"));
}
if (mtmp == u.usteed) {
@@ -3127,7 +3127,7 @@ ustatusline(void)
Strcat(info, ", blind");
if (u.ucreamed) {
if ((long) u.ucreamed < Blinded || Blindfolded
|| !haseyes(g.youmonst.data))
|| !haseyes(gy.youmonst.data))
Strcat(info, ", cover");
Strcat(info, "ed by sticky goop");
} /* note: "goop" == "glop"; variation is intentional */
@@ -3158,14 +3158,14 @@ ustatusline(void)
if (Invis)
Strcat(info, ", invisible");
if (u.ustuck) {
if (sticks(g.youmonst.data))
if (sticks(gy.youmonst.data))
Strcat(info, ", holding ");
else
Strcat(info, ", held by ");
Strcat(info, mon_nam(u.ustuck));
}
pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", g.plname,
pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", gp.plname,
piousness(FALSE, align_str(u.ualign.type)),
Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp,
Upolyd ? u.mhmax : u.uhpmax, u.uac, info);
+172 -172
View File
File diff suppressed because it is too large Load Diff
+38 -38
View File
@@ -13,8 +13,8 @@
* Light sources are "things" that have a physical position and range.
* They have a type, which gives us information about them. Currently
* they are only attached to objects and monsters. Note well: the
* polymorphed-player handling assumes that both g.youmonst.m_id and
* g.youmonst.mx will always remain 0.
* polymorphed-player handling assumes that both gy.youmonst.m_id and
* gy.youmonst.mx will always remain 0.
*
* Light sources, like timers, either follow game play (RANGE_GLOBAL) or
* stay on a level (RANGE_LEVEL). Light sources are unique by their
@@ -74,16 +74,16 @@ new_light_core(coordxy x, coordxy y, int range, int type, anything *id)
ls = (light_source *) alloc(sizeof *ls);
ls->next = g.light_base;
ls->next = gl.light_base;
ls->x = x;
ls->y = y;
ls->range = range;
ls->type = type;
ls->id = *id;
ls->flags = 0;
g.light_base = ls;
gl.light_base = ls;
g.vision_full_recalc = 1; /* make the source show up */
gv.vision_full_recalc = 1; /* make the source show up */
return ls;
}
@@ -113,7 +113,7 @@ del_light_source(int type, anything *id)
break;
}
for (prev = 0, curr = g.light_base; curr; prev = curr, curr = curr->next) {
for (prev = 0, curr = gl.light_base; curr; prev = curr, curr = curr->next) {
if (curr->type != type)
continue;
if (curr->id.a_obj
@@ -121,10 +121,10 @@ del_light_source(int type, anything *id)
if (prev)
prev->next = curr->next;
else
g.light_base = curr->next;
gl.light_base = curr->next;
free((genericptr_t) curr);
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
return;
}
}
@@ -143,7 +143,7 @@ do_light_sources(seenV **cs_rows)
light_source *ls;
seenV *row;
for (ls = g.light_base; ls; ls = ls->next) {
for (ls = gl.light_base; ls; ls = ls->next) {
ls->flags &= ~LSF_SHOW;
/*
@@ -241,7 +241,7 @@ show_transient_light(struct obj *obj, coordxy x, coordxy y)
} else {
/* thrown or kicked object which is emitting light; validate its
light source to obtain its radius (for monster sightings) */
for (ls = g.light_base; ls; ls = ls->next) {
for (ls = gl.light_base; ls; ls = ls->next) {
if (ls->type != LS_OBJECT)
continue;
if (ls->id.a_obj == obj)
@@ -256,7 +256,7 @@ show_transient_light(struct obj *obj, coordxy x, coordxy y)
}
if (obj) /* put lit candle or lamp temporarily on the map */
place_object(obj, g.bhitpos.x, g.bhitpos.y);
place_object(obj, gb.bhitpos.x, gb.bhitpos.y);
else /* camera flash: no object; directly set light source's location */
ls->x = x, ls->y = y;
@@ -298,7 +298,7 @@ transient_light_cleanup(void)
/* in case we're cleaning up a camera flash, remove all object light
sources which aren't associated with a specific object */
discard_flashes();
if (g.vision_full_recalc) /* set by del_light_source() */
if (gv.vision_full_recalc) /* set by del_light_source() */
vision_recalc(0);
/* for thrown/kicked candle or lamp or for camera flash, some
@@ -325,7 +325,7 @@ discard_flashes(void)
{
light_source *ls, *nxt_ls;
for (ls = g.light_base; ls; ls = nxt_ls) {
for (ls = gl.light_base; ls; ls = nxt_ls) {
nxt_ls = ls->next;
if (ls->type != LS_OBJECT)
continue;
@@ -343,17 +343,17 @@ find_mid(unsigned nid, unsigned fmflags)
struct monst *mtmp;
if (!nid)
return &g.youmonst;
return &gy.youmonst;
if (fmflags & FM_FMON)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (!DEADMONSTER(mtmp) && mtmp->m_id == nid)
return mtmp;
if (fmflags & FM_MIGRATE)
for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon)
for (mtmp = gm.migrating_mons; mtmp; mtmp = mtmp->nmon)
if (mtmp->m_id == nid)
return mtmp;
if (fmflags & FM_MYDOGS)
for (mtmp = g.mydogs; mtmp; mtmp = mtmp->nmon)
for (mtmp = gm.mydogs; mtmp; mtmp = mtmp->nmon)
if (mtmp->m_id == nid)
return mtmp;
return (struct monst *) 0;
@@ -371,7 +371,7 @@ save_light_sources(NHFILE *nhfp, int range)
in the midst of a panic save and they wouldn't be useful after
restore so just throw any that are present away */
discard_flashes();
g.vision_full_recalc = 0;
gv.vision_full_recalc = 0;
if (perform_bwrite(nhfp)) {
count = maybe_write_ls(nhfp, range, FALSE);
@@ -385,7 +385,7 @@ save_light_sources(NHFILE *nhfp, int range)
}
if (release_data(nhfp)) {
for (prev = &g.light_base; (curr = *prev) != 0; ) {
for (prev = &gl.light_base; (curr = *prev) != 0; ) {
if (!curr->id.a_monst) {
impossible("save_light_sources: no id! [range=%d]", range);
is_global = 0;
@@ -432,8 +432,8 @@ restore_light_sources(NHFILE *nhfp)
ls = (light_source *) alloc(sizeof(light_source));
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) ls, sizeof(light_source));
ls->next = g.light_base;
g.light_base = ls;
ls->next = gl.light_base;
gl.light_base = ls;
}
}
@@ -447,7 +447,7 @@ light_stats(const char *hdrfmt, char *hdrbuf, long *count, long *size)
Sprintf(hdrbuf, hdrfmt, (long) sizeof (light_source));
*count = *size = 0L;
for (ls = g.light_base; ls; ls = ls->next) {
for (ls = gl.light_base; ls; ls = ls->next) {
++*count;
*size += (long) sizeof *ls;
}
@@ -463,7 +463,7 @@ relink_light_sources(boolean ghostly)
unsigned nid;
light_source *ls;
for (ls = g.light_base; ls; ls = ls->next) {
for (ls = gl.light_base; ls; ls = ls->next) {
if (ls->flags & LSF_NEEDS_FIXUP) {
if (ls->type == LS_OBJECT || ls->type == LS_MONSTER) {
if (ghostly) {
@@ -500,7 +500,7 @@ maybe_write_ls(NHFILE *nhfp, int range, boolean write_it)
int count = 0, is_global;
light_source *ls;
for (ls = g.light_base; ls; ls = ls->next) {
for (ls = gl.light_base; ls; ls = ls->next) {
if (!ls->id.a_monst) {
impossible("maybe_write_ls: no id! [range=%d]", range);
continue;
@@ -537,7 +537,7 @@ light_sources_sanity_check(void)
struct obj *otmp;
unsigned int auint;
for (ls = g.light_base; ls; ls = ls->next) {
for (ls = gl.light_base; ls; ls = ls->next) {
if (!ls->id.a_monst)
panic("insane light source: no id!");
if (ls->type == LS_OBJECT) {
@@ -603,7 +603,7 @@ obj_move_light_source(struct obj *src, struct obj *dest)
{
light_source *ls;
for (ls = g.light_base; ls; ls = ls->next)
for (ls = gl.light_base; ls; ls = ls->next)
if (ls->type == LS_OBJECT && ls->id.a_obj == src)
ls->id.a_obj = dest;
src->lamplit = 0;
@@ -614,7 +614,7 @@ obj_move_light_source(struct obj *src, struct obj *dest)
boolean
any_light_source(void)
{
return (boolean) (g.light_base != (light_source *) 0);
return (boolean) (gl.light_base != (light_source *) 0);
}
/*
@@ -627,7 +627,7 @@ snuff_light_source(coordxy x, coordxy y)
light_source *ls;
struct obj *obj;
for (ls = g.light_base; ls; ls = ls->next)
for (ls = gl.light_base; ls; ls = ls->next)
/*
* Is this position check valid??? Can I assume that the positions
* will always be correct because the objects would have been
@@ -676,7 +676,7 @@ obj_split_light_source(struct obj *src, struct obj *dest)
{
light_source *ls, *new_ls;
for (ls = g.light_base; ls; ls = ls->next)
for (ls = gl.light_base; ls; ls = ls->next)
if (ls->type == LS_OBJECT && ls->id.a_obj == src) {
/*
* Insert the new source at beginning of list. This will
@@ -689,11 +689,11 @@ obj_split_light_source(struct obj *src, struct obj *dest)
/* split candles may emit less light than original group */
ls->range = candle_light_range(src);
new_ls->range = candle_light_range(dest);
g.vision_full_recalc = 1; /* in case range changed */
gv.vision_full_recalc = 1; /* in case range changed */
}
new_ls->id.a_obj = dest;
new_ls->next = g.light_base;
g.light_base = new_ls;
new_ls->next = gl.light_base;
gl.light_base = new_ls;
dest->lamplit = 1; /* now an active light source */
}
}
@@ -709,10 +709,10 @@ obj_merge_light_sources(struct obj *src, struct obj *dest)
if (src != dest)
end_burn(src, TRUE); /* extinguish candles */
for (ls = g.light_base; ls; ls = ls->next)
for (ls = gl.light_base; ls; ls = ls->next)
if (ls->type == LS_OBJECT && ls->id.a_obj == dest) {
ls->range = candle_light_range(dest);
g.vision_full_recalc = 1; /* in case range changed */
gv.vision_full_recalc = 1; /* in case range changed */
break;
}
}
@@ -723,10 +723,10 @@ obj_adjust_light_radius(struct obj *obj, int new_radius)
{
light_source *ls;
for (ls = g.light_base; ls; ls = ls->next)
for (ls = gl.light_base; ls; ls = ls->next)
if (ls->type == LS_OBJECT && ls->id.a_obj == obj) {
if (new_radius != ls->range)
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
ls->range = new_radius;
return;
}
@@ -842,10 +842,10 @@ wiz_light_sources(void)
putstr(win, 0, buf);
putstr(win, 0, "");
if (g.light_base) {
if (gl.light_base) {
putstr(win, 0, "location range flags type id");
putstr(win, 0, "-------- ----- ------ ---- -------");
for (ls = g.light_base; ls; ls = ls->next) {
for (ls = gl.light_base; ls; ls = ls->next) {
Sprintf(buf, " %2d,%2d %2d 0x%04x %s %s", ls->x, ls->y,
ls->range, ls->flags,
(ls->type == LS_OBJECT
@@ -853,7 +853,7 @@ wiz_light_sources(void)
: ls->type == LS_MONSTER
? (mon_is_local(ls->id.a_monst)
? "mon"
: (ls->id.a_monst == &g.youmonst)
: (ls->id.a_monst == &gy.youmonst)
? "you"
/* migrating monster */
: "<m>")
+106 -106
View File
@@ -16,7 +16,7 @@ static void chest_shatter_msg(struct obj *);
boolean
picking_lock(coordxy *x, coordxy *y)
{
if (g.occupation == picklock) {
if (go.occupation == picklock) {
*x = u.ux + u.dx;
*y = u.uy + u.dy;
return TRUE;
@@ -29,7 +29,7 @@ picking_lock(coordxy *x, coordxy *y)
boolean
picking_at(coordxy x, coordxy y)
{
return (boolean) (g.occupation == picklock && g.xlock.door == &levl[x][y]);
return (boolean) (go.occupation == picklock && gx.xlock.door == &levl[x][y]);
}
/* produce an occupation string appropriate for the current activity */
@@ -45,19 +45,19 @@ lock_action(void)
};
/* if the target is currently unlocked, we're trying to lock it now */
if (g.xlock.door && !(g.xlock.door->doormask & D_LOCKED))
if (gx.xlock.door && !(gx.xlock.door->doormask & D_LOCKED))
return actions[0] + 2; /* "locking the door" */
else if (g.xlock.box && !g.xlock.box->olocked)
return g.xlock.box->otyp == CHEST ? actions[1] + 2 : actions[2] + 2;
else if (gx.xlock.box && !gx.xlock.box->olocked)
return gx.xlock.box->otyp == CHEST ? actions[1] + 2 : actions[2] + 2;
/* otherwise we're trying to unlock it */
else if (g.xlock.picktyp == LOCK_PICK)
else if (gx.xlock.picktyp == LOCK_PICK)
return actions[3]; /* "picking the lock" */
else if (g.xlock.picktyp == CREDIT_CARD)
else if (gx.xlock.picktyp == CREDIT_CARD)
return actions[3]; /* same as lock_pick */
else if (g.xlock.door)
else if (gx.xlock.door)
return actions[0]; /* "unlocking the door" */
else if (g.xlock.box)
return g.xlock.box->otyp == CHEST ? actions[1] : actions[2];
else if (gx.xlock.box)
return gx.xlock.box->otyp == CHEST ? actions[1] : actions[2];
else
return actions[3];
}
@@ -66,44 +66,44 @@ lock_action(void)
static int
picklock(void)
{
if (g.xlock.box) {
if (g.xlock.box->where != OBJ_FLOOR
|| g.xlock.box->ox != u.ux || g.xlock.box->oy != u.uy) {
return ((g.xlock.usedtime = 0)); /* you or it moved */
if (gx.xlock.box) {
if (gx.xlock.box->where != OBJ_FLOOR
|| gx.xlock.box->ox != u.ux || gx.xlock.box->oy != u.uy) {
return ((gx.xlock.usedtime = 0)); /* you or it moved */
}
} else { /* door */
if (g.xlock.door != &(levl[u.ux + u.dx][u.uy + u.dy])) {
return ((g.xlock.usedtime = 0)); /* you moved */
if (gx.xlock.door != &(levl[u.ux + u.dx][u.uy + u.dy])) {
return ((gx.xlock.usedtime = 0)); /* you moved */
}
switch (g.xlock.door->doormask) {
switch (gx.xlock.door->doormask) {
case D_NODOOR:
pline("This doorway has no door.");
return ((g.xlock.usedtime = 0));
return ((gx.xlock.usedtime = 0));
case D_ISOPEN:
You("cannot lock an open door.");
return ((g.xlock.usedtime = 0));
return ((gx.xlock.usedtime = 0));
case D_BROKEN:
pline("This door is broken.");
return ((g.xlock.usedtime = 0));
return ((gx.xlock.usedtime = 0));
}
}
if (g.xlock.usedtime++ >= 50 || nohands(g.youmonst.data)) {
if (gx.xlock.usedtime++ >= 50 || nohands(gy.youmonst.data)) {
You("give up your attempt at %s.", lock_action());
exercise(A_DEX, TRUE); /* even if you don't succeed */
return ((g.xlock.usedtime = 0));
return ((gx.xlock.usedtime = 0));
}
if (rn2(100) >= g.xlock.chance)
if (rn2(100) >= gx.xlock.chance)
return 1; /* still busy */
/* using the Master Key of Thievery finds traps if its bless/curse
state is adequate (non-cursed for rogues, blessed for others;
checked when setting up 'xlock') */
if ((!g.xlock.door ? (int) g.xlock.box->otrapped
: (g.xlock.door->doormask & D_TRAPPED) != 0)
&& g.xlock.magic_key) {
g.xlock.chance += 20; /* less effort needed next time */
if ((!gx.xlock.door ? (int) gx.xlock.box->otrapped
: (gx.xlock.door->doormask & D_TRAPPED) != 0)
&& gx.xlock.magic_key) {
gx.xlock.chance += 20; /* less effort needed next time */
/* unfortunately we don't have a 'tknown' flag to record
"known to be trapped" so declining to disarm and then
retrying lock manipulation will find it all over again */
@@ -112,14 +112,14 @@ picklock(void)
boolean alreadyunlocked;
/* disarming while using magic key always succeeds */
if (g.xlock.door) {
g.xlock.door->doormask &= ~D_TRAPPED;
if (gx.xlock.door) {
gx.xlock.door->doormask &= ~D_TRAPPED;
what = "door";
alreadyunlocked = !(g.xlock.door->doormask & D_LOCKED);
alreadyunlocked = !(gx.xlock.door->doormask & D_LOCKED);
} else {
g.xlock.box->otrapped = 0;
what = (g.xlock.box->otyp == CHEST) ? "chest" : "box";
alreadyunlocked = !g.xlock.box->olocked;
gx.xlock.box->otrapped = 0;
what = (gx.xlock.box->otyp == CHEST) ? "chest" : "box";
alreadyunlocked = !gx.xlock.box->olocked;
}
You("succeed in disarming the trap. The %s is still %slocked.",
what, alreadyunlocked ? "un" : "");
@@ -128,30 +128,30 @@ picklock(void)
You("stop %s.", lock_action());
exercise(A_WIS, FALSE);
}
return ((g.xlock.usedtime = 0));
return ((gx.xlock.usedtime = 0));
}
You("succeed in %s.", lock_action());
if (g.xlock.door) {
if (g.xlock.door->doormask & D_TRAPPED) {
if (gx.xlock.door) {
if (gx.xlock.door->doormask & D_TRAPPED) {
b_trapped("door", FINGER);
g.xlock.door->doormask = D_NODOOR;
gx.xlock.door->doormask = D_NODOOR;
unblock_point(u.ux + u.dx, u.uy + u.dy);
if (*in_rooms(u.ux + u.dx, u.uy + u.dy, SHOPBASE))
add_damage(u.ux + u.dx, u.uy + u.dy, SHOP_DOOR_COST);
newsym(u.ux + u.dx, u.uy + u.dy);
} else if (g.xlock.door->doormask & D_LOCKED)
g.xlock.door->doormask = D_CLOSED;
} else if (gx.xlock.door->doormask & D_LOCKED)
gx.xlock.door->doormask = D_CLOSED;
else
g.xlock.door->doormask = D_LOCKED;
gx.xlock.door->doormask = D_LOCKED;
} else {
g.xlock.box->olocked = !g.xlock.box->olocked;
g.xlock.box->lknown = 1;
if (g.xlock.box->otrapped)
(void) chest_trap(g.xlock.box, FINGER, FALSE);
gx.xlock.box->olocked = !gx.xlock.box->olocked;
gx.xlock.box->lknown = 1;
if (gx.xlock.box->otrapped)
(void) chest_trap(gx.xlock.box, FINGER, FALSE);
}
exercise(A_DEX, TRUE);
return ((g.xlock.usedtime = 0));
return ((gx.xlock.usedtime = 0));
}
void
@@ -192,7 +192,7 @@ breakchestlock(struct obj *box, boolean destroyit)
useup(otmp);
}
if (box->otyp == ICE_BOX && otmp->otyp == CORPSE) {
otmp->age = g.moves - otmp->age; /* actual age */
otmp->age = gm.moves - otmp->age; /* actual age */
start_corpse_timeout(otmp);
}
place_object(otmp, u.ux, u.uy);
@@ -210,17 +210,17 @@ breakchestlock(struct obj *box, boolean destroyit)
static int
forcelock(void)
{
if ((g.xlock.box->ox != u.ux) || (g.xlock.box->oy != u.uy))
return ((g.xlock.usedtime = 0)); /* you or it moved */
if ((gx.xlock.box->ox != u.ux) || (gx.xlock.box->oy != u.uy))
return ((gx.xlock.usedtime = 0)); /* you or it moved */
if (g.xlock.usedtime++ >= 50 || !uwep || nohands(g.youmonst.data)) {
if (gx.xlock.usedtime++ >= 50 || !uwep || nohands(gy.youmonst.data)) {
You("give up your attempt to force the lock.");
if (g.xlock.usedtime >= 50) /* you made the effort */
exercise((g.xlock.picktyp) ? A_DEX : A_STR, TRUE);
return ((g.xlock.usedtime = 0));
if (gx.xlock.usedtime >= 50) /* you made the effort */
exercise((gx.xlock.picktyp) ? A_DEX : A_STR, TRUE);
return ((gx.xlock.usedtime = 0));
}
if (g.xlock.picktyp) { /* blade */
if (gx.xlock.picktyp) { /* blade */
if (rn2(1000 - (int) uwep->spe) > (992 - greatest_erosion(uwep) * 10)
&& !uwep->cursed && !obj_resists(uwep, 0, 99)) {
/* for a +0 weapon, probability that it survives an unsuccessful
@@ -231,20 +231,20 @@ forcelock(void)
useup(uwep);
You("give up your attempt to force the lock.");
exercise(A_DEX, TRUE);
return ((g.xlock.usedtime = 0));
return ((gx.xlock.usedtime = 0));
}
} else /* blunt */
wake_nearby(); /* due to hammering on the container */
if (rn2(100) >= g.xlock.chance)
if (rn2(100) >= gx.xlock.chance)
return 1; /* still busy */
You("succeed in forcing the lock.");
exercise(g.xlock.picktyp ? A_DEX : A_STR, TRUE);
/* breakchestlock() might destroy g.xlock.box; if so, g.xlock context will
exercise(gx.xlock.picktyp ? A_DEX : A_STR, TRUE);
/* breakchestlock() might destroy gx.xlock.box; if so, gx.xlock context will
be cleared (delobj -> obfree -> maybe_reset_pick); but it might not,
so explicitly clear that manually */
breakchestlock(g.xlock.box, (boolean) (!g.xlock.picktyp && !rn2(3)));
breakchestlock(gx.xlock.box, (boolean) (!gx.xlock.picktyp && !rn2(3)));
reset_pick(); /* lock-picking context is no longer valid */
return 0;
@@ -253,10 +253,10 @@ forcelock(void)
void
reset_pick(void)
{
g.xlock.usedtime = g.xlock.chance = g.xlock.picktyp = 0;
g.xlock.magic_key = FALSE;
g.xlock.door = (struct rm *) 0;
g.xlock.box = (struct obj *) 0;
gx.xlock.usedtime = gx.xlock.chance = gx.xlock.picktyp = 0;
gx.xlock.magic_key = FALSE;
gx.xlock.door = (struct rm *) 0;
gx.xlock.box = (struct obj *) 0;
}
/* level change or object deletion; context may no longer be valid */
@@ -268,14 +268,14 @@ maybe_reset_pick(struct obj *container) /* passed from obfree() */
* particular container (which is being deleted). Other stuff on
* the current dungeon level remains valid.
* However if 'container' is Null, clear context if not carrying
* g.xlock.box (which might be Null if context is for a door).
* gx.xlock.box (which might be Null if context is for a door).
* Used for changing levels, where a floor container or a door is
* being left behind and won't be valid on the new level but a
* carried container will still be. There might not be any context,
* in which case redundantly clearing it is harmless.
*/
if (container ? (container == g.xlock.box)
: (!g.xlock.box || !carried(g.xlock.box)))
if (container ? (container == gx.xlock.box)
: (!gx.xlock.box || !carried(gx.xlock.box)))
reset_pick();
}
@@ -289,7 +289,7 @@ autokey(boolean opening) /* True: key, pick, or card; False: key or pick */
key = pick = card = (struct obj *) 0;
/* other role's quest artifact (Rogue's Key or Tourist's Credit Card) */
akey = apick = acard = (struct obj *) 0;
for (o = g.invent; o; o = o->nobj) {
for (o = gi.invent; o; o = o->nobj) {
if (any_quest_artifact(o) && !is_quest_artifact(o)) {
switch (o->otyp) {
case SKELETON_KEY:
@@ -310,7 +310,7 @@ autokey(boolean opening) /* True: key, pick, or card; False: key or pick */
} else {
switch (o->otyp) {
case SKELETON_KEY:
if (!key || is_magic_key(&g.youmonst, o))
if (!key || is_magic_key(&gy.youmonst, o))
key = o;
break;
case LOCK_PICK:
@@ -372,10 +372,10 @@ pick_lock(
picktyp = pick->otyp;
/* check whether we're resuming an interrupted previous attempt */
if (g.xlock.usedtime && picktyp == g.xlock.picktyp) {
if (gx.xlock.usedtime && picktyp == gx.xlock.picktyp) {
static char no_longer[] = "Unfortunately, you can no longer %s %s.";
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
const char *what = (picktyp == LOCK_PICK) ? "pick" : "key";
if (picktyp == CREDIT_CARD)
@@ -383,7 +383,7 @@ pick_lock(
pline(no_longer, "hold the", what);
reset_pick();
return PICKLOCK_LEARNED_SOMETHING;
} else if (u.uswallow || (g.xlock.box && !can_reach_floor(TRUE))) {
} else if (u.uswallow || (gx.xlock.box && !can_reach_floor(TRUE))) {
pline(no_longer, "reach the", "lock");
reset_pick();
return PICKLOCK_LEARNED_SOMETHING;
@@ -391,13 +391,13 @@ pick_lock(
const char *action = lock_action();
You("resume your attempt at %s.", action);
g.xlock.magic_key = is_magic_key(&g.youmonst, pick);
gx.xlock.magic_key = is_magic_key(&gy.youmonst, pick);
set_occupation(picklock, action, 0);
return PICKLOCK_DID_SOMETHING;
}
}
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
You_cant("hold %s -- you have no hands!", doname(pick));
return PICKLOCK_DID_NOTHING;
} else if (u.uswallow) {
@@ -441,7 +441,7 @@ pick_lock(
count = 0;
c = 'n'; /* in case there are no boxes here */
for (otmp = g.level.objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere) {
for (otmp = gl.level.objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere) {
/* autounlock on boxes: only the one that was just discovered to
be locked; don't include any other boxes which might be here */
if (autounlock && otmp != container)
@@ -505,7 +505,7 @@ pick_lock(
You_cant("do that with %s.",
an(simple_typename(picktyp)));
return PICKLOCK_LEARNED_SOMETHING;
} else if (autounlock && !touch_artifact(pick, &g.youmonst)) {
} else if (autounlock && !touch_artifact(pick, &gy.youmonst)) {
/* note: for !autounlock, apply already did touch check */
return PICKLOCK_DID_SOMETHING;
}
@@ -525,8 +525,8 @@ pick_lock(
if (otmp->cursed)
ch /= 2;
g.xlock.box = otmp;
g.xlock.door = 0;
gx.xlock.box = otmp;
gx.xlock.door = 0;
break;
}
}
@@ -567,12 +567,12 @@ pick_lock(
}
if (!IS_DOOR(door->typ)) {
int res = PICKLOCK_DID_NOTHING, oldglyph = door->glyph;
schar oldlastseentyp = g.lastseentyp[cc.x][cc.y];
schar oldlastseentyp = gl.lastseentyp[cc.x][cc.y];
/* this is probably only relevant when blind */
feel_location(cc.x, cc.y);
if (door->glyph != oldglyph
|| g.lastseentyp[cc.x][cc.y] != oldlastseentyp)
|| gl.lastseentyp[cc.x][cc.y] != oldlastseentyp)
res = PICKLOCK_LEARNED_SOMETHING;
if (is_drawbridge_wall(cc.x, cc.y) >= 0)
@@ -616,7 +616,7 @@ pick_lock(
return PICKLOCK_DID_NOTHING;
/* note: for !autounlock, 'apply' already did touch check */
if (autounlock && !touch_artifact(pick, &g.youmonst))
if (autounlock && !touch_artifact(pick, &gy.youmonst))
return PICKLOCK_DID_SOMETHING;
switch (picktyp) {
@@ -632,15 +632,15 @@ pick_lock(
default:
ch = 0;
}
g.xlock.door = door;
g.xlock.box = 0;
gx.xlock.door = door;
gx.xlock.box = 0;
}
}
g.context.move = 0;
g.xlock.chance = ch;
g.xlock.picktyp = picktyp;
g.xlock.magic_key = is_magic_key(&g.youmonst, pick);
g.xlock.usedtime = 0;
gc.context.move = 0;
gx.xlock.chance = ch;
gx.xlock.picktyp = picktyp;
gx.xlock.magic_key = is_magic_key(&gy.youmonst, pick);
gx.xlock.usedtime = 0;
set_occupation(picklock, lock_action(), 0);
return PICKLOCK_DID_SOMETHING;
}
@@ -692,15 +692,15 @@ doforce(void)
}
picktyp = is_blade(uwep) && !is_pick(uwep);
if (g.xlock.usedtime && g.xlock.box && picktyp == g.xlock.picktyp) {
if (gx.xlock.usedtime && gx.xlock.box && picktyp == gx.xlock.picktyp) {
You("resume your attempt to force the lock.");
set_occupation(forcelock, "forcing the lock", 0);
return ECMD_TIME;
}
/* A lock is made only for the honest man, the thief will break it. */
g.xlock.box = (struct obj *) 0;
for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
gx.xlock.box = (struct obj *) 0;
for (otmp = gl.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) {
if (otmp->obroken || !otmp->olocked) {
/* force doname() to omit known "broken" or "unlocked"
@@ -727,15 +727,15 @@ doforce(void)
You("force %s into a crack and pry.", yname(uwep));
else
You("start bashing it with %s.", yname(uwep));
g.xlock.box = otmp;
g.xlock.chance = objects[uwep->otyp].oc_wldam * 2;
g.xlock.picktyp = picktyp;
g.xlock.magic_key = FALSE;
g.xlock.usedtime = 0;
gx.xlock.box = otmp;
gx.xlock.chance = objects[uwep->otyp].oc_wldam * 2;
gx.xlock.picktyp = picktyp;
gx.xlock.magic_key = FALSE;
gx.xlock.usedtime = 0;
break;
}
if (g.xlock.box)
if (gx.xlock.box)
set_occupation(forcelock, "forcing the lock", 0);
else
You("decide not to force the issue.");
@@ -772,7 +772,7 @@ doopen_indir(coordxy x, coordxy y)
const char *dirprompt;
int res = ECMD_OK;
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
You_cant("open anything -- you have no hands!");
return ECMD_OK;
}
@@ -816,11 +816,11 @@ doopen_indir(coordxy x, coordxy y)
/* this used to be 'if (Blind)' but using a key skips that so we do too */
{
int oldglyph = door->glyph;
schar oldlastseentyp = g.lastseentyp[cc.x][cc.y];
schar oldlastseentyp = gl.lastseentyp[cc.x][cc.y];
feel_location(cc.x, cc.y);
if (door->glyph != oldglyph
|| g.lastseentyp[cc.x][cc.y] != oldlastseentyp)
|| gl.lastseentyp[cc.x][cc.y] != oldlastseentyp)
res = ECMD_TIME; /* learned something */
}
@@ -877,7 +877,7 @@ doopen_indir(coordxy x, coordxy y)
return res;
}
if (verysmall(g.youmonst.data)) {
if (verysmall(gy.youmonst.data)) {
pline("You're too small to pull the door open.");
return res;
}
@@ -941,7 +941,7 @@ doclose(void)
boolean portcullis;
int res = ECMD_OK;
if (nohands(g.youmonst.data)) {
if (nohands(gy.youmonst.data)) {
You_cant("close anything -- you have no hands!");
return ECMD_OK;
}
@@ -976,10 +976,10 @@ doclose(void)
portcullis = (is_drawbridge_wall(x, y) >= 0);
if (Blind) {
int oldglyph = door->glyph;
schar oldlastseentyp = g.lastseentyp[x][y];
schar oldlastseentyp = gl.lastseentyp[x][y];
feel_location(x, y);
if (door->glyph != oldglyph || g.lastseentyp[x][y] != oldlastseentyp)
if (door->glyph != oldglyph || gl.lastseentyp[x][y] != oldlastseentyp)
res = ECMD_TIME; /* learned something */
}
@@ -1010,7 +1010,7 @@ doclose(void)
}
if (door->doormask == D_ISOPEN) {
if (verysmall(g.youmonst.data) && !u.usteed) {
if (verysmall(gy.youmonst.data) && !u.usteed) {
pline("You're too small to push the door closed.");
return res;
}
@@ -1067,7 +1067,7 @@ boxlock(struct obj *obj, struct obj *otmp) /* obj *is* a box */
case SPE_POLYMORPH:
/* maybe start unlocking chest, get interrupted, then zap it;
we must avoid any attempt to resume unlocking it */
if (g.xlock.box == obj)
if (gx.xlock.box == obj)
reset_pick();
break;
}
@@ -1215,7 +1215,7 @@ doorlock(struct obj *otmp, coordxy x, coordxy y)
You_hear("a crashing sound.");
}
/* force vision recalc before printing more messages */
if (g.vision_full_recalc)
if (gv.vision_full_recalc)
vision_recalc(0);
loudness = 20;
} else
@@ -1251,7 +1251,7 @@ chest_shatter_msg(struct obj *otmp)
if (otmp->oclass == POTION_CLASS) {
You("%s %s shatter!", Blind ? "hear" : "see", an(bottlename()));
if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data))
if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
potionbreathe(otmp);
return;
}
+15 -15
View File
@@ -153,7 +153,7 @@ md_start(coord *startp)
int lax; /* if TRUE, pick a position in sight. */
int dd; /* distance to current point */
int max_distance; /* max distance found so far */
stairway *stway = g.stairs;
stairway *stway = gs.stairs;
/*
* If blind and not telepathic, then it doesn't matter what we pick ---
@@ -184,23 +184,23 @@ md_start(coord *startp)
* position that could be seen. What we really ought to be doing is
* finding a path from a stairwell...
*
* The arrays g.viz_rmin[] and g.viz_rmax[] are set even when blind. These
* The arrays gv.viz_rmin[] and gv.viz_rmax[] are set even when blind. These
* are the LOS limits for each row.
*/
lax = 0; /* be picky */
max_distance = -1;
retry:
for (row = 0; row < ROWNO; row++) {
if (g.viz_rmin[row] < g.viz_rmax[row]) {
if (gv.viz_rmin[row] < gv.viz_rmax[row]) {
/* There are valid positions on this row. */
dd = distu(g.viz_rmin[row], row);
dd = distu(gv.viz_rmin[row], row);
if (dd > max_distance) {
if (lax) {
max_distance = dd;
startp->y = row;
startp->x = g.viz_rmin[row];
startp->x = gv.viz_rmin[row];
} else if (enexto(&testcc, (coordxy) g.viz_rmin[row], row,
} else if (enexto(&testcc, (coordxy) gv.viz_rmin[row], row,
(struct permonst *) 0)
&& !cansee(testcc.x, testcc.y)
&& couldsee(testcc.x, testcc.y)) {
@@ -208,14 +208,14 @@ md_start(coord *startp)
*startp = testcc;
}
}
dd = distu(g.viz_rmax[row], row);
dd = distu(gv.viz_rmax[row], row);
if (dd > max_distance) {
if (lax) {
max_distance = dd;
startp->y = row;
startp->x = g.viz_rmax[row];
startp->x = gv.viz_rmax[row];
} else if (enexto(&testcc, (coordxy) g.viz_rmax[row], row,
} else if (enexto(&testcc, (coordxy) gv.viz_rmax[row], row,
(struct permonst *) 0)
&& !cansee(testcc.x, testcc.y)
&& couldsee(testcc.x, testcc.y)) {
@@ -403,7 +403,7 @@ newmail(struct mail_info *info)
goto go_back;
message_seen = TRUE;
verbalize("%s, %s! %s.", Hello(md), g.plname, info->display_txt);
verbalize("%s, %s! %s.", Hello(md), gp.plname, info->display_txt);
if (info->message_typ) {
struct obj *obj = mksobj(SCR_MAIL, FALSE, FALSE);
@@ -442,7 +442,7 @@ ckmailstatus(void)
return;
if (mustgetmail < 0) {
#if defined(AMIGA) || defined(MSDOS) || defined(TOS)
mustgetmail = (g.moves < 2000) ? (100 + rn2(2000)) : (2000 + rn2(3000));
mustgetmail = (gm.moves < 2000) ? (100 + rn2(2000)) : (2000 + rn2(3000));
#endif
return;
}
@@ -528,12 +528,12 @@ ckmailstatus(void)
if (!mailbox || u.uswallow || !flags.biff
#ifdef MAILCKFREQ
|| g.moves < laststattime + MAILCKFREQ
|| gm.moves < laststattime + MAILCKFREQ
#endif
)
return;
laststattime = g.moves;
laststattime = gm.moves;
if (stat(mailbox, &nmstat)) {
#ifdef PERMANENT_MAILBOX
pline("Cannot get status of MAIL=\"%s\" anymore.", mailbox);
@@ -663,8 +663,8 @@ ck_server_admin_msg(void)
static struct stat ost,nst;
static long lastchk = 0;
if (g.moves < lastchk + SERVER_ADMIN_MSG_CKFREQ) return;
lastchk = g.moves;
if (gm.moves < lastchk + SERVER_ADMIN_MSG_CKFREQ) return;
lastchk = gm.moves;
if (!stat(SERVER_ADMIN_MSG, &nst)) {
if (nst.st_mtime > ost.st_mtime)
+47 -47
View File
@@ -246,7 +246,7 @@ m_initweap(register struct monst *mtmp)
break;
}
if (mm == PM_ELVEN_MONARCH) {
if (rn2(3) || (g.in_mklev && Is_earthlevel(&u.uz)))
if (rn2(3) || (gi.in_mklev && Is_earthlevel(&u.uz)))
(void) mongets(mtmp, PICK_AXE);
if (!rn2(50))
(void) mongets(mtmp, CRYSTAL_BALL);
@@ -717,7 +717,7 @@ m_initinv(register struct monst *mtmp)
break;
case S_GIANT:
if (ptr == &mons[PM_MINOTAUR]) {
if (!rn2(3) || (g.in_mklev && Is_earthlevel(&u.uz)))
if (!rn2(3) || (gi.in_mklev && Is_earthlevel(&u.uz)))
(void) mongets(mtmp, WAN_DIGGING);
} else if (is_giant(ptr)) {
for (cnt = rn2((int) (mtmp->m_lev / 2)); cnt; cnt--) {
@@ -787,7 +787,7 @@ m_initinv(register struct monst *mtmp)
}
break;
case S_GNOME:
if (!rn2((In_mines(&u.uz) && g.in_mklev) ? 20 : 60)) {
if (!rn2((In_mines(&u.uz) && gi.in_mklev) ? 20 : 60)) {
otmp = mksobj(rn2(4) ? TALLOW_CANDLE : WAX_CANDLE, TRUE, FALSE);
otmp->quan = 1;
otmp->owt = weight(otmp);
@@ -821,7 +821,7 @@ clone_mon(struct monst *mon,
struct monst *m2;
/* may be too weak or have been extinguished for population control */
if (mon->mhp <= 1 || (g.mvitals[monsndx(mon->data)].mvflags & G_EXTINCT))
if (mon->mhp <= 1 || (gm.mvitals[monsndx(mon->data)].mvflags & G_EXTINCT))
return (struct monst *) 0;
if (x == 0) {
@@ -885,7 +885,7 @@ clone_mon(struct monst *mon,
}
/* not all clones caused by player are tame or peaceful */
if (!g.context.mon_moving && mon->mpeaceful) {
if (!gc.context.mon_moving && mon->mpeaceful) {
if (mon->mtame)
m2->mtame = rn2(max(2 + u.uluck, 2)) ? mon->mtame : 0;
else if (mon->mpeaceful)
@@ -935,23 +935,23 @@ propagate(int mndx, boolean tally, boolean ghostly)
boolean gone, result;
int lim = mbirth_limit(mndx);
gone = (g.mvitals[mndx].mvflags & G_GONE) != 0; /* geno'd|extinct */
result = ((int) g.mvitals[mndx].born < lim && !gone) ? TRUE : FALSE;
gone = (gm.mvitals[mndx].mvflags & G_GONE) != 0; /* geno'd|extinct */
result = ((int) gm.mvitals[mndx].born < lim && !gone) ? TRUE : FALSE;
/* if it's unique, don't ever make it again */
if ((mons[mndx].geno & G_UNIQ) != 0 && mndx != PM_HIGH_CLERIC)
g.mvitals[mndx].mvflags |= G_EXTINCT;
gm.mvitals[mndx].mvflags |= G_EXTINCT;
if (g.mvitals[mndx].born < 255 && tally && (!ghostly || result))
g.mvitals[mndx].born++;
if ((int) g.mvitals[mndx].born >= lim
if (gm.mvitals[mndx].born < 255 && tally && (!ghostly || result))
gm.mvitals[mndx].born++;
if ((int) gm.mvitals[mndx].born >= lim
&& !(mons[mndx].geno & G_NOGEN)
&& !(g.mvitals[mndx].mvflags & G_EXTINCT)) {
&& !(gm.mvitals[mndx].mvflags & G_EXTINCT)) {
if (wizard) {
debugpline1("Automatically extinguished %s.",
makeplural(mons[mndx].pmnames[NEUTRAL]));
}
g.mvitals[mndx].mvflags |= G_EXTINCT;
gm.mvitals[mndx].mvflags |= G_EXTINCT;
}
return result;
}
@@ -1060,7 +1060,7 @@ makemon_rnd_goodpos(
do {
nx = rn1(COLNO - 3, 2);
ny = rn2(ROWNO);
good = (!g.in_mklev && cansee(nx,ny)) ? FALSE
good = (!gi.in_mklev && cansee(nx,ny)) ? FALSE
: goodpos(nx, ny, mon, gpflags);
} while ((++tryct < 50) && !good);
@@ -1071,7 +1071,7 @@ makemon_rnd_goodpos(
coordxy xofs = nx;
coordxy yofs = ny;
coordxy dx,dy;
int bl = (g.in_mklev || Blind) ? 1 : 0;
int bl = (gi.in_mklev || Blind) ? 1 : 0;
for ( ; bl < 2; bl++) {
if (!bl)
@@ -1086,7 +1086,7 @@ makemon_rnd_goodpos(
goto gotgood;
}
if (bl == 0 && (!mon || mon->data->mmove)) {
stairway *stway = g.stairs;
stairway *stway = gs.stairs;
/* all map positions are visible (or not good),
try to pick something logical */
while (stway) {
@@ -1113,7 +1113,7 @@ makemon_rnd_goodpos(
/*
* called with [x,y] = coordinates;
* [0,0] means anyplace
* [u.ux,u.uy] means: near player (if !g.in_mklev)
* [u.ux,u.uy] means: near player (if !gi.in_mklev)
*
* In case we make a monster group, only return the one at [x,y].
*/
@@ -1150,7 +1150,7 @@ makemon(
return (struct monst *) 0;
x = cc.x;
y = cc.y;
} else if (byyou && !g.in_mklev) {
} else if (byyou && !gi.in_mklev) {
if (!enexto_core(&cc, u.ux, u.uy, ptr, gpflags)
&& !enexto_core(&cc, u.ux, u.uy, ptr, gpflags & ~GP_CHECKSCARY))
return (struct monst *) 0;
@@ -1177,9 +1177,9 @@ makemon(
mndx = monsndx(ptr);
/* if you are to make a specific monster and it has
already been genocided, return */
if (g.mvitals[mndx].mvflags & G_GENOD)
if (gm.mvitals[mndx].mvflags & G_GENOD)
return (struct monst *) 0;
if (wizard && (g.mvitals[mndx].mvflags & G_EXTINCT)) {
if (wizard && (gm.mvitals[mndx].mvflags & G_EXTINCT)) {
debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].pmnames[NEUTRAL]);
}
@@ -1225,7 +1225,7 @@ makemon(
mtmp->m_id = next_ident();
set_mon_data(mtmp, ptr); /* mtmp->data = ptr; */
if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx)
g.quest_status.leader_m_id = mtmp->m_id;
gq.quest_status.leader_m_id = mtmp->m_id;
mtmp->mnum = mndx;
/* set up level and hit points */
@@ -1242,9 +1242,9 @@ makemon(
but for ones which can be random, it has already been chosen
(in role_init(), for possible use by the quest pager code) */
else if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx)
mtmp->female = g.quest_status.ldrgend;
mtmp->female = gq.quest_status.ldrgend;
else if (ptr->msound == MS_NEMESIS && quest_info(MS_NEMESIS) == mndx)
mtmp->female = g.quest_status.nemgend;
mtmp->female = gq.quest_status.nemgend;
/* female used to be set randomly here even for neuters on the
grounds that it was ignored, but after corpses were changed to
@@ -1273,7 +1273,7 @@ makemon(
break;
case S_SPIDER:
case S_SNAKE:
if (g.in_mklev)
if (gi.in_mklev)
if (x && y)
(void) mkobj_at(RANDOM_CLASS, x, y, TRUE);
(void) hideunder(mtmp);
@@ -1332,8 +1332,8 @@ makemon(
allow_minvent = FALSE;
} else if (mndx == PM_WIZARD_OF_YENDOR) {
mtmp->iswiz = TRUE;
g.context.no_of_wizards++;
if (g.context.no_of_wizards == 1 && Is_earthlevel(&u.uz))
gc.context.no_of_wizards++;
if (gc.context.no_of_wizards == 1 && Is_earthlevel(&u.uz))
mitem = SPE_DIG;
} else if (mndx == PM_GHOST && !(mmflags & MM_NONAME)) {
mtmp = christen_monst(mtmp, rndghostname());
@@ -1347,7 +1347,7 @@ makemon(
if (mitem && allow_minvent)
(void) mongets(mtmp, mitem);
if (g.in_mklev) {
if (gi.in_mklev) {
if ((is_ndemon(ptr) || mndx == PM_WUMPUS
|| mndx == PM_LONG_WORM || mndx == PM_GIANT_EEL)
&& !u.uhave.amulet && rn2(5))
@@ -1430,10 +1430,10 @@ makemon(
mtmp->mstrategy |= STRAT_APPEARMSG;
}
if (allow_minvent && g.migrating_objs)
if (allow_minvent && gm.migrating_objs)
deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case of waiting items */
if (!g.in_mklev) {
if (!gi.in_mklev) {
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
if (!(mmflags & MM_NOMSG)) {
char mbuf[BUFSZ], *what = 0;
@@ -1460,7 +1460,7 @@ makemon(
exclaim ? '!' : '.');
}
/* if discernable and a threat, stop fiddling while Rome burns */
if (g.occupation)
if (go.occupation)
(void) dochugw(mtmp, FALSE);
/* TODO: unify with teleport appears msg */
@@ -1482,10 +1482,10 @@ unmakemon(
that just happened when creating this monster or the threshold
had already been reached and further increments were suppressed;
assume the latter */
if (countbirth && g.mvitals[mndx].born > 0 && g.mvitals[mndx].born < 255)
g.mvitals[mndx].born -= 1;
if (countbirth && gm.mvitals[mndx].born > 0 && gm.mvitals[mndx].born < 255)
gm.mvitals[mndx].born -= 1;
if ((mon->data->geno & G_UNIQ) != 0)
g.mvitals[mndx].mvflags &= ~G_EXTINCT;
gm.mvitals[mndx].mvflags &= ~G_EXTINCT;
mon->mhp = 0; /* let discard_minvent() know that mon isn't being kept */
/* uncreate any artifact that the monster was provided with; unlike
@@ -1553,7 +1553,7 @@ uncommon(int mndx)
{
if (mons[mndx].geno & (G_NOGEN | G_UNIQ))
return TRUE;
if (g.mvitals[mndx].mvflags & G_GONE)
if (gm.mvitals[mndx].mvflags & G_GONE)
return TRUE;
if (Inhell)
return (boolean) (mons[mndx].maligntyp > A_NEUTRAL);
@@ -1573,11 +1573,11 @@ align_shift(register struct permonst *ptr)
static NEARDATA s_level *lev;
register int alshift;
if (oldmoves != g.moves) {
if (oldmoves != gm.moves) {
lev = Is_special(&u.uz);
oldmoves = g.moves;
oldmoves = gm.moves;
}
switch ((lev) ? lev->flags.align : g.dungeons[u.uz.dnum].flags.align) {
switch ((lev) ? lev->flags.align : gd.dungeons[u.uz.dnum].flags.align) {
default: /* just in case */
case AM_NONE:
alshift = 0;
@@ -1684,7 +1684,7 @@ mk_gen_ok(int mndx, unsigned mvflagsmask, unsigned genomask)
{
struct permonst *ptr = &mons[mndx];
if (g.mvitals[mndx].mvflags & mvflagsmask)
if (gm.mvitals[mndx].mvflags & mvflagsmask)
return FALSE;
if (ptr->geno & genomask)
return FALSE;
@@ -1780,7 +1780,7 @@ mkclass_aligned(char class, int spc, /* special mons[].geno handling */
against picking the next demon resulted in incubus
being picked nearly twice as often as sucubus);
we need the '+1' in case the entire set is too high
level (really low g.level hero) */
level (really low gl.level hero) */
nums[last] = k + 1 - (adj_lev(&mons[last]) > (u.ulevel * 2));
num += nums[last];
}
@@ -1844,7 +1844,7 @@ adj_lev(register struct permonst *ptr)
/* does not depend on other strengths, but does get stronger
* every time he is killed
*/
tmp = ptr->mlevel + g.mvitals[PM_WIZARD_OF_YENDOR].died;
tmp = ptr->mlevel + gm.mvitals[PM_WIZARD_OF_YENDOR].died;
if (tmp > 49)
tmp = 49;
return tmp;
@@ -1945,12 +1945,12 @@ grow_up(struct monst *mtmp, struct monst *victim)
/* new form might force gender change */
fem = is_male(ptr) ? 0 : is_female(ptr) ? 1 : mtmp->female;
if (g.mvitals[newtype].mvflags & G_GENOD) { /* allow G_EXTINCT */
if (gm.mvitals[newtype].mvflags & G_GENOD) { /* allow G_EXTINCT */
if (canspotmon(mtmp))
pline("As %s grows up into %s, %s %s!", mon_nam(mtmp),
an(pmname(ptr, Mgender(mtmp))), mhe(mtmp),
nonliving(ptr) ? "expires" : "dies");
set_mon_data(mtmp, ptr); /* keep g.mvitals[] accurate */
set_mon_data(mtmp, ptr); /* keep gm.mvitals[] accurate */
mondied(mtmp);
return (struct permonst *) 0;
} else if (canspotmon(mtmp)) {
@@ -2226,7 +2226,7 @@ set_mimic_sym(register struct monst *mtmp)
/* only valid for INSIDE of room */
roomno = levl[mx][my].roomno - ROOMOFFSET;
if (roomno >= 0)
rt = g.rooms[roomno].rtype;
rt = gr.rooms[roomno].rtype;
#ifdef SPECIALIZATION
else if (IS_ROOM(typ))
rt = OROOM, roomno = 0;
@@ -2236,7 +2236,7 @@ set_mimic_sym(register struct monst *mtmp)
if (OBJ_AT(mx, my)) {
ap_type = M_AP_OBJECT;
appear = g.level.objects[mx][my]->otyp;
appear = gl.level.objects[mx][my]->otyp;
} else if (IS_DOOR(typ) || IS_WALL(typ) || typ == SDOOR || typ == SCORR) {
ap_type = M_AP_FURNITURE;
/*
@@ -2256,7 +2256,7 @@ set_mimic_sym(register struct monst *mtmp)
appear = Is_rogue_level(&u.uz) ? S_hwall : S_hcdoor;
else
appear = Is_rogue_level(&u.uz) ? S_vwall : S_vcdoor;
} else if (g.level.flags.is_maze_lev
} else if (gl.level.flags.is_maze_lev
&& !(In_mines(&u.uz) && in_town(u.ux, u.uy))
&& !In_sokoban(&u.uz) && rn2(2)) {
ap_type = M_AP_OBJECT;
@@ -2336,7 +2336,7 @@ set_mimic_sym(register struct monst *mtmp)
&& (appear == STATUE || appear == FIGURINE
|| appear == CORPSE || appear == EGG || appear == TIN)) {
int mndx = rndmonnum(),
nocorpse_ndx = (g.mvitals[mndx].mvflags & G_NOCORPSE) != 0;
nocorpse_ndx = (gm.mvitals[mndx].mvflags & G_NOCORPSE) != 0;
if (appear == CORPSE && nocorpse_ndx)
mndx = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
@@ -2348,7 +2348,7 @@ set_mimic_sym(register struct monst *mtmp)
MCORPSENM(mtmp) = mndx;
} else if (ap_type == M_AP_OBJECT && appear == SLIME_MOLD) {
newmcorpsenm(mtmp);
MCORPSENM(mtmp) = g.context.current_fruit;
MCORPSENM(mtmp) = gc.context.current_fruit;
/* if no objects of this fruit type have been created yet,
context.current_fruit is available for re-use when the player
assigns a new fruit name; override that--having a mimic as the
+16 -16
View File
@@ -55,7 +55,7 @@ cursetxt(struct monst *mtmp, boolean undirected)
point_msg = "all around, then curses";
else if ((Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
|| is_obj_mappear(&g.youmonst, STRANGE_OBJECT)
|| is_obj_mappear(&gy.youmonst, STRANGE_OBJECT)
|| u.uundetected)
point_msg = "and curses in your general direction";
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
@@ -64,7 +64,7 @@ cursetxt(struct monst *mtmp, boolean undirected)
point_msg = "at you, then curses";
pline("%s points %s.", Monnam(mtmp), point_msg);
} else if ((!(g.moves % 4) || !rn2(4))) {
} else if ((!(gm.moves % 4) || !rn2(4))) {
if (!Deaf)
Norep("You hear a mumbled curse."); /* Deaf-aware */
}
@@ -354,8 +354,8 @@ touch_of_death(void)
You_feel("drained...");
if (drain >= u.uhpmax) {
g.killer.format = KILLED_BY_AN;
Strcpy(g.killer.name, touchodeath);
gk.killer.format = KILLED_BY_AN;
Strcpy(gk.killer.name, touchodeath);
done(DIED);
} else {
u.uhpmax -= drain;
@@ -387,7 +387,7 @@ cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum)
switch (spellnum) {
case MGC_DEATH_TOUCH:
pline("Oh no, %s's using the touch of death!", mhe(mtmp));
if (nonliving(g.youmonst.data) || is_demon(g.youmonst.data)) {
if (nonliving(gy.youmonst.data) || is_demon(gy.youmonst.data)) {
You("seem no deader than before.");
} else if (!Antimagic && rn2(mtmp->m_lev) > 12) {
if (Hallucination) {
@@ -405,7 +405,7 @@ cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum)
dmg = 0;
break;
case MGC_CLONE_WIZ:
if (mtmp->iswiz && g.context.no_of_wizards == 1) {
if (mtmp->iswiz && gc.context.no_of_wizards == 1) {
pline("Double Trouble...");
clonewiz();
dmg = 0;
@@ -454,7 +454,7 @@ cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum)
shieldeff(u.ux, u.uy);
monstseesu(M_SEEN_MAGR);
pline("A field of force surrounds you!");
} else if (!destroy_arm(some_armor(&g.youmonst))) {
} else if (!destroy_arm(some_armor(&gy.youmonst))) {
Your("skin itches.");
}
dmg = 0;
@@ -568,11 +568,11 @@ cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum)
if (Half_spell_damage)
dmg = (dmg + 1) / 2;
burn_away_slime();
(void) burnarmor(&g.youmonst);
(void) burnarmor(&gy.youmonst);
destroy_item(SCROLL_CLASS, AD_FIRE);
destroy_item(POTION_CLASS, AD_FIRE);
destroy_item(SPBOOK_CLASS, AD_FIRE);
ignite_items(g.invent);
ignite_items(gi.invent);
(void) burn_floor_objects(u.ux, u.uy, TRUE, FALSE);
break;
case CLC_LIGHTNING: {
@@ -684,7 +684,7 @@ cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum)
case CLC_BLIND_YOU:
/* note: resists_blnd() doesn't apply here */
if (!Blinded) {
int num_eyes = eyecount(g.youmonst.data);
int num_eyes = eyecount(gy.youmonst.data);
pline("Scales cover your %s!", (num_eyes == 1)
? body_part(EYE)
@@ -700,19 +700,19 @@ cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum)
if (Antimagic || Free_action) {
shieldeff(u.ux, u.uy);
monstseesu(M_SEEN_MAGR);
if (g.multi >= 0)
if (gm.multi >= 0)
You("stiffen briefly.");
dmg = 1; /* to produce nomul(-1), not actual damage */
} else {
if (g.multi >= 0)
if (gm.multi >= 0)
You("are frozen in place!");
dmg = 4 + (int) mtmp->m_lev;
if (Half_spell_damage)
dmg = (dmg + 1) / 2;
}
nomul(-dmg);
g.multi_reason = "paralyzed by a monster";
g.nomovemsg = 0;
gm.multi_reason = "paralyzed by a monster";
gn.nomovemsg = 0;
dmg = 0;
break;
case CLC_CONFUSE_YOU:
@@ -829,7 +829,7 @@ spell_would_be_useless(struct monst *mtmp, unsigned int adtyp, int spellnum)
if (!mcouldseeu && (spellnum == MGC_SUMMON_MONS
|| (!mtmp->iswiz && spellnum == MGC_CLONE_WIZ)))
return TRUE;
if ((!mtmp->iswiz || g.context.no_of_wizards > 1)
if ((!mtmp->iswiz || gc.context.no_of_wizards > 1)
&& spellnum == MGC_CLONE_WIZ)
return TRUE;
/* aggravation (global wakeup) when everyone is already active */
@@ -878,7 +878,7 @@ buzzmu(register struct monst *mtmp, register struct attack *mattk)
pline("%s zaps you with a %s!", Monnam(mtmp),
flash_str(BZ_OFS_AD(mattk->adtyp), FALSE));
buzz(BZ_M_SPELL(BZ_OFS_AD(mattk->adtyp)), (int) mattk->damn, mtmp->mx,
mtmp->my, sgn(g.tbx), sgn(g.tby));
mtmp->my, sgn(gt.tbx), sgn(gt.tby));
return MM_HIT;
}
return MM_MISS;
+47 -47
View File
@@ -28,9 +28,9 @@ noises(register struct monst *magr, register struct attack *mattk)
{
boolean farq = (mdistu(magr) > 15);
if (!Deaf && (farq != g.far_noise || g.moves - g.noisetime > 10)) {
g.far_noise = farq;
g.noisetime = g.moves;
if (!Deaf && (farq != gf.far_noise || gm.moves - gn.noisetime > 10)) {
gf.far_noise = farq;
gn.noisetime = gm.moves;
You_hear("%s%s.",
(mattk->aatyp == AT_EXPL) ? "an explosion" : "some noises",
farq ? " in the distance" : "");
@@ -46,20 +46,20 @@ pre_mm_attack(struct monst *magr, struct monst *mdef)
because the formerly concealed monster is now in action */
if (M_AP_TYPE(mdef)) {
seemimic(mdef);
showit |= g.vis;
showit |= gv.vis;
} else if (mdef->mundetected) {
mdef->mundetected = 0;
showit |= g.vis;
showit |= gv.vis;
}
if (M_AP_TYPE(magr)) {
seemimic(magr);
showit |= g.vis;
showit |= gv.vis;
} else if (magr->mundetected) {
magr->mundetected = 0;
showit |= g.vis;
showit |= gv.vis;
}
if (g.vis) {
if (gv.vis) {
if (!canspotmon(magr))
map_invisible(magr->mx, magr->my);
else if (showit)
@@ -83,7 +83,7 @@ missmm(register struct monst *magr, register struct monst *mdef,
pre_mm_attack(magr, mdef);
if (g.vis) {
if (gv.vis) {
fmt = (could_seduce(magr, mdef, mattk) && !magr->mcan)
? "%s pretends to be friendly to"
: "%s misses";
@@ -143,9 +143,9 @@ fightm(register struct monst *mtmp)
}
/* mtmp can be killed */
g.bhitpos.x = mon->mx;
g.bhitpos.y = mon->my;
g.notonhead = 0;
gb.bhitpos.x = mon->mx;
gb.bhitpos.y = mon->my;
gn.notonhead = 0;
result = mattackm(mtmp, mon);
if (result & MM_AGR_DIED)
@@ -163,7 +163,7 @@ fightm(register struct monst *mtmp)
if ((result & MM_HIT) && !(result & MM_DEF_DIED) && rn2(4)
&& mon->movement >= NORMAL_SPEED) {
mon->movement -= NORMAL_SPEED;
g.notonhead = 0;
gn.notonhead = 0;
(void) mattackm(mon, mtmp); /* return attack */
}
@@ -220,7 +220,7 @@ mdisplacem(register struct monst *magr, register struct monst *mdef,
* You can observe monster displacement if you can see both of
* the monsters involved.
*/
g.vis = (canspotmon(magr) && canspotmon(mdef));
gv.vis = (canspotmon(magr) && canspotmon(mdef));
if (touch_petrifies(pd) && !resists_ston(magr)) {
if (!which_armor(magr, W_ARMG)) {
@@ -229,7 +229,7 @@ mdisplacem(register struct monst *magr, register struct monst *mdef,
return MM_HIT; /* no damage during the polymorph */
}
if (!quietly && canspotmon(magr)) {
if (g.vis) {
if (gv.vis) {
pline("%s tries to move %s out of %s way.", Monnam(magr),
mon_nam(mdef), is_rider(pa) ? "the" : mhis(magr));
}
@@ -238,7 +238,7 @@ mdisplacem(register struct monst *magr, register struct monst *mdef,
monstone(magr);
if (!DEADMONSTER(magr))
return MM_HIT; /* lifesaved */
else if (magr->mtame && !g.vis)
else if (magr->mtame && !gv.vis)
You(brief_feeling, "peculiarly sad");
return MM_AGR_DIED;
}
@@ -257,7 +257,7 @@ mdisplacem(register struct monst *magr, register struct monst *mdef,
update_monster_region(magr);
update_monster_region(mdef);
if (g.vis && !quietly)
if (gv.vis && !quietly)
pline("%s moves %s out of %s way!", Monnam(magr), mon_nam(mdef),
is_rider(pa) ? "the" : mhis(magr));
newsym(fx, fy); /* see it */
@@ -344,7 +344,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
tmp++;
/* Set up the visibility of action */
g.vis = ((cansee(magr->mx, magr->my) && canspotmon(magr))
gv.vis = ((cansee(magr->mx, magr->my) && canspotmon(magr))
|| (cansee(mdef->mx, mdef->my) && canspotmon(mdef)));
/* Set flag indicating monster has moved this turn. Necessary since a
@@ -352,13 +352,13 @@ mattackm(register struct monst *magr, register struct monst *mdef)
* some cases, in which case this still counts as its move for the round
* and it shouldn't move again.
*/
magr->mlstmv = g.moves;
magr->mlstmv = gm.moves;
/* controls whether a mind flayer uses all of its tentacle-for-DRIN
attacks; when fighting a headless monster, stop after the first
one because repeating the same failing hit (or even an ordinary
tentacle miss) is very verbose and makes the flayer look stupid */
g.skipdrin = FALSE;
gs.skipdrin = FALSE;
/* Now perform all attacks for the monster. */
for (i = 0; i < NATTK; i++) {
@@ -369,7 +369,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
/* reduce verbosity for mind flayer attacking creature without a
head (or worm's tail); this is similar to monster with multiple
attacks after a wildmiss against displaced or invisible hero */
if (g.skipdrin && mattk->aatyp == AT_TENT && mattk->adtyp == AD_DRIN)
if (gs.skipdrin && mattk->aatyp == AT_TENT && mattk->adtyp == AD_DRIN)
continue;
switch (mattk->aatyp) {
@@ -393,7 +393,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
}
possibly_unwield(magr, FALSE);
if ((mwep = MON_WEP(magr)) != 0) {
if (g.vis)
if (gv.vis)
mswingsm(magr, mdef, mwep);
tmp += hitval(mwep, mdef);
}
@@ -433,7 +433,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
struct monst *mclone;
if ((mclone = clone_mon(mdef, 0, 0)) != 0) {
if (g.vis && canspotmon(mdef)) {
if (gv.vis && canspotmon(mdef)) {
char buf[BUFSZ];
Strcpy(buf, Monnam(mdef));
@@ -474,7 +474,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
case AT_ENGL:
if (mdef->data == &mons[PM_SHADE]) { /* no silver teeth... */
if (g.vis)
if (gv.vis)
pline("%s attempt to engulf %s is futile.",
s_suffix(Monnam(magr)), mon_nam(mdef));
strike = 0;
@@ -569,10 +569,10 @@ hitmm(
pre_mm_attack(magr, mdef);
compat = !magr->mcan ? could_seduce(magr, mdef, mattk) : 0;
if (!compat && shade_miss(magr, mdef, mwep, FALSE, g.vis))
if (!compat && shade_miss(magr, mdef, mwep, FALSE, gv.vis))
return MM_MISS; /* bypass mdamagem() */
if (g.vis) {
if (gv.vis) {
char buf[BUFSZ], magr_name[BUFSZ];
Strcpy(magr_name, Monnam(magr));
@@ -658,7 +658,7 @@ gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk)
seemimic(mdef);
mdef->mundetected = 0;
if (g.vis) {
if (gv.vis) {
Sprintf(buf, "%s gazes %s",
altmesg ? Adjmonnam(magr, "blinded") : Monnam(magr),
altmesg ? "toward" : "at");
@@ -669,7 +669,7 @@ gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk)
if (magr->mcan || !mdef->mcansee
|| (archon ? resists_blnd(mdef) : !magr->mcansee)
|| (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) {
if (g.vis && canspotmon(mdef))
if (gv.vis && canspotmon(mdef))
pline("but nothing happens.");
return MM_MISS;
}
@@ -731,14 +731,14 @@ engulf_target(struct monst *magr, struct monst *mdef)
/* (hypothetical) engulfers who can pass through walls aren't
limited by rock|trees|bars */
if ((magr == &g.youmonst) ? Passes_walls : passes_walls(magr->data))
if ((magr == &gy.youmonst) ? Passes_walls : passes_walls(magr->data))
return TRUE;
/* don't swallow something in a spot where attacker wouldn't
otherwise be able to move onto; we don't want to engulf
a wall-phaser and end up with a non-phaser inside a wall */
dx = mdef->mx, dy = mdef->my;
if (mdef == &g.youmonst)
if (mdef == &gy.youmonst)
dx = u.ux, dy = u.uy;
lev = &levl[dx][dy];
if (IS_ROCK(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ)
@@ -764,7 +764,7 @@ gulpmm(
if (!engulf_target(magr, mdef))
return MM_MISS;
if (g.vis) {
if (gv.vis) {
/* [this two-part formatting dates back to when only one x_monnam
result could be included in an expression because the next one
would overwrite first's result -- that's no longer the case] */
@@ -779,7 +779,7 @@ gulpmm(
if (is_vampshifter(mdef)
&& newcham(mdef, &mons[mdef->cham], NO_NC_FLAGS)) {
if (g.vis) {
if (gv.vis) {
/* 'it' -- previous form is no longer available and
using that would be excessively verbose */
pline("%s expels %s.", Monnam(magr),
@@ -942,12 +942,12 @@ mdamagem(struct monst *magr, struct monst *mdef,
mon_to_stone(magr);
return MM_HIT; /* no damage during the polymorph */
}
if (g.vis && canspotmon(magr))
if (gv.vis && canspotmon(magr))
pline("%s turns to stone!", Monnam(magr));
monstone(magr);
if (!DEADMONSTER(magr))
return MM_HIT; /* lifesaved */
else if (magr->mtame && !g.vis)
else if (magr->mtame && !gv.vis)
You(brief_feeling, "peculiarly sad");
return MM_AGR_DIED;
}
@@ -975,15 +975,15 @@ mdamagem(struct monst *magr, struct monst *mdef,
mdef->mhp = 0;
}
if (mattk->aatyp == AT_WEAP || mattk->aatyp == AT_CLAW)
g.mkcorpstat_norevive = troll_baned(mdef, mwep) ? TRUE : FALSE;
g.zombify = (!mwep && zombie_maker(magr)
gm.mkcorpstat_norevive = troll_baned(mdef, mwep) ? TRUE : FALSE;
gz.zombify = (!mwep && zombie_maker(magr)
&& (mattk->aatyp == AT_TUCH
|| mattk->aatyp == AT_CLAW
|| mattk->aatyp == AT_BITE)
&& zombie_form(mdef->data) != NON_PM);
monkilled(mdef, "", (int) mattk->adtyp);
g.zombify = FALSE; /* reset */
g.mkcorpstat_norevive = FALSE;
gz.zombify = FALSE; /* reset */
gm.mkcorpstat_norevive = FALSE;
if (!DEADMONSTER(mdef))
return mhm.hitflags; /* mdef lifesaved */
else if (mhm.hitflags == MM_AGR_DIED)
@@ -1017,7 +1017,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
{
static const char freaky[] = " undergoes a freakish metamorphosis";
if (mdef == &g.youmonst) {
if (mdef == &gy.youmonst) {
if (Antimagic) {
shieldeff(u.ux, u.uy);
} else if (Unchanging) {
@@ -1042,7 +1042,7 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
Strcpy(Before, Monnam(mdef));
if (resists_magm(mdef)) {
/* Magic resistance */
if (g.vis)
if (gv.vis)
shieldeff(mdef->mx, mdef->my);
} else if (resist(mdef, WAND_CLASS, 0, TELL)) {
/* general resistance to magic... */
@@ -1052,20 +1052,20 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
|| pm_to_cham(monsndx(mdef->data)) != NON_PM)) {
/* system shock; this variation takes away half of mon's HP
rather than kill outright */
if (g.vis)
if (gv.vis)
pline("%s shudders!", Before);
dmg += (mdef->mhpmax + 1) / 2;
mdef->mhp -= dmg;
dmg = 0;
if (DEADMONSTER(mdef)) {
if (magr == &g.youmonst)
if (magr == &gy.youmonst)
xkilled(mdef, XKILL_GIVEMSG | XKILL_NOCORPSE);
else
monkilled(mdef, "", AD_RBRE);
}
} else if (newcham(mdef, (struct permonst *) 0, NO_NC_FLAGS)) {
if (g.vis) { /* either seen or adjacent */
if (gv.vis) { /* either seen or adjacent */
boolean was_seen = !!strcmpi("It", Before),
verbosely = Verbose(1, monpoly1) || !was_seen;
@@ -1075,19 +1075,19 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg)
x_monnam(mdef, ARTICLE_A, (char *) 0,
(SUPPRESS_NAME | SUPPRESS_IT
| SUPPRESS_INVISIBLE), FALSE));
else if (was_seen || magr == &g.youmonst)
else if (was_seen || magr == &gy.youmonst)
pline("%s%s%s.", Before, freaky,
!was_seen ? "" : " and disappears");
}
dmg = 0;
if (can_teleport(magr->data)) {
if (magr == &g.youmonst)
if (magr == &gy.youmonst)
tele();
else if (!tele_restrict(magr))
(void) rloc(magr, RLOC_MSG);
}
} else {
if (g.vis && Verbose(1, monpoly2))
if (gv.vis && Verbose(1, monpoly2))
pline1(nothing_happens);
}
}
@@ -1132,7 +1132,7 @@ void
slept_monst(struct monst *mon)
{
if (helpless(mon) && mon == u.ustuck
&& !sticks(g.youmonst.data) && !u.uswallow) {
&& !sticks(gy.youmonst.data) && !u.uswallow) {
pline("%s grip relaxes.", s_suffix(Monnam(mon)));
unstuck(mon);
}
+93 -93
View File
@@ -32,7 +32,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
/* Note: if opposite gender, "seductively" */
/* If same gender, "engagingly" for nymph, normal msg for others */
if ((compat = could_seduce(mtmp, &g.youmonst, mattk)) != 0
if ((compat = could_seduce(mtmp, &gy.youmonst, mattk)) != 0
&& !mtmp->mcan && !mtmp->mspec_used) {
pline("%s %s you %s.", Monst_name,
!Blind ? "smiles at" : !Deaf ? "talks to" : "touches",
@@ -44,7 +44,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
break;
case AT_KICK:
pline("%s kicks%c", Monst_name,
thick_skinned(g.youmonst.data) ? '.' : '!');
thick_skinned(gy.youmonst.data) ? '.' : '!');
break;
case AT_STNG:
pfmt = "%s stings!";
@@ -80,7 +80,7 @@ missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk)
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
if (could_seduce(mtmp, &g.youmonst, mattk) && !mtmp->mcan)
if (could_seduce(mtmp, &gy.youmonst, mattk) && !mtmp->mcan)
pline("%s pretends to be friendly.", Monnam(mtmp));
else
pline("%s %smisses!", Monnam(mtmp),
@@ -133,7 +133,7 @@ const char *
mpoisons_subj(struct monst *mtmp, struct attack *mattk)
{
if (mattk->aatyp == AT_WEAP) {
struct obj *mwep = (mtmp == &g.youmonst) ? uwep : MON_WEP(mtmp);
struct obj *mwep = (mtmp == &gy.youmonst) ? uwep : MON_WEP(mtmp);
/* "Foo's attack was poisoned." is pretty lame, but at least
it's better than "sting" when not a stinging attack... */
return (!mwep || !mwep->opoisoned) ? "attack" : "weapon";
@@ -172,7 +172,7 @@ wildmiss(struct monst *mtmp, struct attack *mattk)
/* maybe it's attacking an image around the corner? */
compat = ((mattk->adtyp == AD_SEDU || mattk->adtyp == AD_SSEX)
? could_seduce(mtmp, &g.youmonst, mattk) : 0);
? could_seduce(mtmp, &gy.youmonst, mattk) : 0);
Monst_name = Monnam(mtmp);
if (!mtmp->mcansee || (Invis && !perceives(mtmp->data))) {
@@ -237,7 +237,7 @@ expels(
struct permonst *mdat, /* if mtmp is polymorphed, mdat != mtmp->data */
boolean message)
{
g.context.botl = 1;
gc.context.botl = 1;
if (message) {
if (digests(mdat)) {
You("get regurgitated!");
@@ -283,7 +283,7 @@ getmattk(struct monst *magr, struct monst *mdef,
{
struct permonst *mptr = magr->data;
struct attack *attk = &mptr->mattk[indx];
struct obj *weap = (magr == &g.youmonst) ? uwep : MON_WEP(magr);
struct obj *weap = (magr == &gy.youmonst) ? uwep : MON_WEP(magr);
/* honor SEDUCE=0 */
if (!SYSOPT_SEDUCE) {
@@ -314,7 +314,7 @@ getmattk(struct monst *magr, struct monst *mdef,
attk->adtyp = AD_STUN;
/* make drain-energy damage be somewhat in proportion to energy */
} else if (attk->adtyp == AD_DREN && mdef == &g.youmonst) {
} else if (attk->adtyp == AD_DREN && mdef == &gy.youmonst) {
int ulev = max(u.ulevel, 6);
*alt_attk_buf = *attk;
@@ -362,7 +362,7 @@ getmattk(struct monst *magr, struct monst *mdef,
if weapon is sufficiently interesting; a few unique creatures
have two weapon attacks where one does physical damage and other
doesn't--avoid forcing physical damage for those */
} else if (indx == 0 && magr != &g.youmonst
} else if (indx == 0 && magr != &gy.youmonst
&& attk->aatyp == AT_WEAP && attk->adtyp != AD_PHYS
&& !(mptr->mattk[1].aatyp == AT_WEAP
&& mptr->mattk[1].adtyp == AD_PHYS)
@@ -450,7 +450,7 @@ mattacku(register struct monst *mtmp)
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
u.uundetected = 0;
if (is_hider(g.youmonst.data) && u.umonnum != PM_TRAPPER) {
if (is_hider(gy.youmonst.data) && u.umonnum != PM_TRAPPER) {
/* ceiling hider */
coord cc; /* maybe we need a unexto() function? */
struct obj *obj;
@@ -460,7 +460,7 @@ mattacku(register struct monst *mtmp)
is eligible for placing hero; we assume that a
removed monster remembers its old spot <mx,my> */
remove_monster(mtmp->mx, mtmp->my);
if (!enexto(&cc, u.ux, u.uy, g.youmonst.data)
if (!enexto(&cc, u.ux, u.uy, gy.youmonst.data)
/* a fish won't voluntarily swap positions
when it's in water and hero is over land */
|| (mtmp->data->mlet == S_EEL
@@ -485,13 +485,13 @@ mattacku(register struct monst *mtmp)
/* tail hasn't grown, so if it now occupies <cc.x,.y>
then one of its original spots must be free */
if (m_at(cc.x, cc.y))
(void) enexto(&cc, u.ux, u.uy, g.youmonst.data);
(void) enexto(&cc, u.ux, u.uy, gy.youmonst.data);
}
teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG); /* move hero */
set_apparxy(mtmp);
newsym(u.ux, u.uy);
if (g.youmonst.data->mlet != S_PIERCER)
if (gy.youmonst.data->mlet != S_PIERCER)
return 0; /* lurkers don't attack */
obj = which_armor(mtmp, WORN_HELMET);
@@ -520,10 +520,10 @@ mattacku(register struct monst *mtmp)
* parallelism to work, we can't rephrase it, so we
* zap the "laid by you" momentarily instead.
*/
struct obj *obj = g.level.objects[u.ux][u.uy];
struct obj *obj = gl.level.objects[u.ux][u.uy];
if (obj || u.umonnum == PM_TRAPPER
|| (g.youmonst.data->mlet == S_EEL
|| (gy.youmonst.data->mlet == S_EEL
&& is_pool(u.ux, u.uy))) {
int save_spe = 0; /* suppress warning */
@@ -534,17 +534,17 @@ mattacku(register struct monst *mtmp)
}
/* note that m_monnam() overrides hallucination, which is
what we want when message is from mtmp's perspective */
if (g.youmonst.data->mlet == S_EEL
if (gy.youmonst.data->mlet == S_EEL
|| u.umonnum == PM_TRAPPER)
pline(
"Wait, %s! There's a hidden %s named %s there!",
m_monnam(mtmp),
pmname(g.youmonst.data, Ugender), g.plname);
pmname(gy.youmonst.data, Ugender), gp.plname);
else
pline(
"Wait, %s! There's a %s named %s hiding under %s!",
m_monnam(mtmp), pmname(g.youmonst.data, Ugender),
g.plname, doname(g.level.objects[u.ux][u.uy]));
m_monnam(mtmp), pmname(gy.youmonst.data, Ugender),
gp.plname, doname(gl.level.objects[u.ux][u.uy]));
if (obj)
obj->spe = save_spe;
} else
@@ -556,9 +556,9 @@ mattacku(register struct monst *mtmp)
}
/* hero might be a mimic, concealed via #monster */
if (g.youmonst.data->mlet == S_MIMIC && U_AP_TYPE && !range2
if (gy.youmonst.data->mlet == S_MIMIC && U_AP_TYPE && !range2
&& foundyou && !u.uswallow) {
boolean sticky = sticks(g.youmonst.data);
boolean sticky = sticks(gy.youmonst.data);
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
@@ -566,11 +566,11 @@ mattacku(register struct monst *mtmp)
pline("It gets stuck on you.");
else /* see note about m_monnam() above */
pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp),
pmname(g.youmonst.data, Ugender), g.plname);
pmname(gy.youmonst.data, Ugender), gp.plname);
if (sticky)
set_ustuck(mtmp);
g.youmonst.m_ap_type = M_AP_NOTHING;
g.youmonst.mappearance = 0;
gy.youmonst.m_ap_type = M_AP_NOTHING;
gy.youmonst.mappearance = 0;
newsym(u.ux, u.uy);
return 0;
}
@@ -581,18 +581,18 @@ mattacku(register struct monst *mtmp)
map_invisible(mtmp->mx, mtmp->my);
if (!youseeit)
pline("%s %s!", Something, (likes_gold(mtmp->data)
&& g.youmonst.mappearance == GOLD_PIECE)
&& gy.youmonst.mappearance == GOLD_PIECE)
? "tries to pick you up"
: "disturbs you");
else /* see note about m_monnam() above */
pline("Wait, %s! That %s is really %s named %s!", m_monnam(mtmp),
mimic_obj_name(&g.youmonst),
an(pmname(&mons[u.umonnum], Ugender)), g.plname);
if (g.multi < 0) { /* this should always be the case */
mimic_obj_name(&gy.youmonst),
an(pmname(&mons[u.umonnum], Ugender)), gp.plname);
if (gm.multi < 0) { /* this should always be the case */
char buf[BUFSZ];
Sprintf(buf, "You appear to be %s again.",
Upolyd ? (const char *) an(pmname(g.youmonst.data,
Upolyd ? (const char *) an(pmname(gy.youmonst.data,
flags.female))
: (const char *) "yourself");
unmul(buf); /* immediately stop mimicking */
@@ -603,7 +603,7 @@ mattacku(register struct monst *mtmp)
/* Work out the armor class differential */
tmp = AC_VALUE(u.uac) + 10; /* tmp ~= 0 - 20 */
tmp += mtmp->m_lev;
if (g.multi < 0)
if (gm.multi < 0)
tmp += 4;
if ((Invis && !perceives(mdat)) || !mtmp->mcansee)
tmp -= 2;
@@ -649,7 +649,7 @@ mattacku(register struct monst *mtmp)
return (foo == 1);
}
g.skipdrin = FALSE; /* [see mattackm(mhitm.c)] */
gs.skipdrin = FALSE; /* [see mattackm(mhitm.c)] */
for (i = 0; i < NATTK; i++) {
sum[i] = MM_MISS;
@@ -657,10 +657,10 @@ mattacku(register struct monst *mtmp)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
continue; /* fill in sum[] with 'miss' but skip other actions */
mon_currwep = (struct obj *) 0;
mattk = getmattk(mtmp, &g.youmonst, i, sum, &alt_attk);
mattk = getmattk(mtmp, &gy.youmonst, i, sum, &alt_attk);
if ((u.uswallow && mattk->aatyp != AT_ENGL)
|| (skipnonmagc && mattk->aatyp != AT_MAGC)
|| (g.skipdrin && mattk->aatyp == AT_TENT
|| (gs.skipdrin && mattk->aatyp == AT_TENT
&& mattk->adtyp == AD_DRIN))
continue;
@@ -673,11 +673,11 @@ mattacku(register struct monst *mtmp)
case AT_BUTT:
case AT_TENT:
if (!range2 && (!MON_WEP(mtmp) || mtmp->mconf || Conflict
|| !touch_petrifies(g.youmonst.data))) {
|| !touch_petrifies(gy.youmonst.data))) {
if (foundyou) {
if (tmp > (j = rnd(20 + i))) {
if (mattk->aatyp != AT_KICK
|| !thick_skinned(g.youmonst.data))
|| !thick_skinned(gy.youmonst.data))
sum[i] = hitmu(mtmp, mattk);
} else
missmu(mtmp, (tmp == j), mattk);
@@ -765,11 +765,11 @@ mattacku(register struct monst *mtmp)
boolean bash = (is_pole(mon_currwep)
&& next2u(mtmp->mx, mtmp->my));
hittmp = hitval(mon_currwep, &g.youmonst);
hittmp = hitval(mon_currwep, &gy.youmonst);
tmp += hittmp;
mswings(mtmp, mon_currwep, bash);
}
if (tmp > (j = g.mhitu_dieroll = rnd(20 + i)))
if (tmp > (j = gm.mhitu_dieroll = rnd(20 + i)))
sum[i] = hitmu(mtmp, mattk);
else
missmu(mtmp, (tmp == j), mattk);
@@ -793,13 +793,13 @@ mattacku(register struct monst *mtmp)
default: /* no attack */
break;
}
if (g.context.botl)
if (gc.context.botl)
bot();
/* give player a chance of waking up before dying -kaa */
if (sum[i] == MM_HIT) { /* successful attack */
if (u.usleep && u.usleep < g.moves && !rn2(10)) {
g.multi = -1;
g.nomovemsg = "The combat suddenly awakens you.";
if (u.usleep && u.usleep < gm.moves && !rn2(10)) {
gm.multi = -1;
gn.nomovemsg = "The combat suddenly awakens you.";
}
}
if ((sum[i] & MM_AGR_DIED))
@@ -943,13 +943,13 @@ magic_negation(struct monst *mon)
struct obj *o;
long wearmask;
int armpro, mc = 0;
boolean is_you = (mon == &g.youmonst),
boolean is_you = (mon == &gy.youmonst),
via_amul = FALSE,
gotprot = is_you ? (EProtection != 0L)
/* high priests have innate protection */
: (mon->data == &mons[PM_HIGH_CLERIC]);
for (o = is_you ? g.invent : mon->minvent; o; o = o->nobj) {
for (o = is_you ? gi.invent : mon->minvent; o; o = o->nobj) {
/* a_can field is only applicable for armor (which must be worn) */
if ((o->owornmask & W_ARMOR) != 0L) {
armpro = objects[o->otyp].a_can;
@@ -995,7 +995,7 @@ static int
hitmu(register struct monst *mtmp, register struct attack *mattk)
{
struct permonst *mdat = mtmp->data;
struct permonst *olduasmon = g.youmonst.data;
struct permonst *olduasmon = gy.youmonst.data;
int res;
struct mhitm_data mhm;
mhm.hitflags = MM_MISS;
@@ -1016,7 +1016,7 @@ hitmu(register struct monst *mtmp, register struct attack *mattk)
const char *what;
char Amonbuf[BUFSZ];
if ((obj = g.level.objects[mtmp->mx][mtmp->my]) != 0) {
if ((obj = gl.level.objects[mtmp->mx][mtmp->my]) != 0) {
if (Blind && !obj->dknown)
what = something;
else if (is_pool(mtmp->mx, mtmp->my) && !Underwater)
@@ -1039,9 +1039,9 @@ hitmu(register struct monst *mtmp, register struct attack *mattk)
if ((is_undead(mdat) || is_vampshifter(mtmp)) && midnight())
mhm.damage += d((int) mattk->damn, (int) mattk->damd); /* extra dmg */
mhitm_adtyping(mtmp, mattk, &g.youmonst, &mhm);
mhitm_adtyping(mtmp, mattk, &gy.youmonst, &mhm);
(void) mhitm_knockback(mtmp, &g.youmonst, mattk, &mhm.hitflags,
(void) mhitm_knockback(mtmp, &gy.youmonst, mattk, &mhm.hitflags,
(MON_WEP(mtmp) != 0));
if (mhm.done)
@@ -1090,8 +1090,8 @@ hitmu(register struct monst *mtmp, register struct attack *mattk)
if (Upolyd) {
hpmax_p = &u.mhmax;
/* [can't use g.youmonst.m_lev] */
lowerlimit = min((int) g.youmonst.data->mlevel, u.ulevel);
/* [can't use gy.youmonst.m_lev] */
lowerlimit = min((int) gy.youmonst.data->mlevel, u.ulevel);
} else {
hpmax_p = &u.uhpmax;
lowerlimit = minuhpmax(1);
@@ -1102,7 +1102,7 @@ hitmu(register struct monst *mtmp, register struct attack *mattk)
*hpmax_p = lowerlimit;
/* else unlikely...
* already at or below minimum threshold; do nothing */
g.context.botl = 1;
gc.context.botl = 1;
}
mdamageu(mtmp, mhm.damage);
@@ -1126,7 +1126,7 @@ gulp_blnd_check(void)
if (!Blinded && u.uswallow
&& (mattk = attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
&& can_blnd(u.ustuck, &g.youmonst, mattk->aatyp, (struct obj *) 0)) {
&& can_blnd(u.ustuck, &gy.youmonst, mattk->aatyp, (struct obj *) 0)) {
++u.uswldtim; /* compensate for gulpmu change */
(void) gulpmu(u.ustuck, mattk);
return TRUE;
@@ -1148,7 +1148,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
if (!u.uswallow) { /* swallows you */
int omx = mtmp->mx, omy = mtmp->my;
if (!engulf_target(mtmp, &g.youmonst))
if (!engulf_target(mtmp, &gy.youmonst))
return MM_MISS;
if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy))
return MM_MISS;
@@ -1201,7 +1201,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
unleash_all();
}
if (touch_petrifies(g.youmonst.data) && !resists_ston(mtmp)) {
if (touch_petrifies(gy.youmonst.data) && !resists_ston(mtmp)) {
/* put the attacker back where it started;
the resulting statue will end up there
[note: if poly'd hero could ride or non-poly'd hero could
@@ -1243,7 +1243,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
u.uswldtim = (unsigned) ((tim_tmp < 2) ? 2 : tim_tmp);
swallowed(1); /* update the map display, shows hero swallowed */
if (!flaming(mtmp->data)) {
for (otmp2 = g.invent; otmp2; otmp2 = otmp2->nobj)
for (otmp2 = gi.invent; otmp2; otmp2 = otmp2->nobj)
(void) snuff_lit(otmp2);
}
}
@@ -1284,14 +1284,14 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
physical_damage = TRUE;
if (mtmp->data == &mons[PM_FOG_CLOUD]) {
You("are laden with moisture and %s",
flaming(g.youmonst.data)
flaming(gy.youmonst.data)
? "are smoldering out!"
: Breathless ? "find it mildly uncomfortable."
: amphibious(g.youmonst.data)
: amphibious(gy.youmonst.data)
? "feel comforted."
: "can barely breathe!");
/* NB: Amphibious includes Breathless */
if (Amphibious && !flaming(g.youmonst.data))
if (Amphibious && !flaming(gy.youmonst.data))
tmp = 0;
} else {
You("are %s!", enfolds(mtmp->data) ? "being squashed"
@@ -1313,7 +1313,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
}
break;
case AD_BLND:
if (can_blnd(mtmp, &g.youmonst, mattk->aatyp, (struct obj *) 0)) {
if (can_blnd(mtmp, &gy.youmonst, mattk->aatyp, (struct obj *) 0)) {
if (!Blind) {
long was_blinded = Blinded;
@@ -1393,13 +1393,13 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
if (!u.uswallow) {
; /* life-saving has already expelled swallowed hero */
} else if (touch_petrifies(g.youmonst.data) && !resists_ston(mtmp)) {
} else if (touch_petrifies(gy.youmonst.data) && !resists_ston(mtmp)) {
pline("%s very hurriedly %s you!", Monnam(mtmp),
digests(mtmp->data) ? "regurgitates"
: enfolds(mtmp->data) ? "releases"
: "expels");
expels(mtmp, mtmp->data, FALSE);
} else if (!u.uswldtim || g.youmonst.data->msize >= MZ_HUGE) {
} else if (!u.uswldtim || gy.youmonst.data->msize >= MZ_HUGE) {
/* As of 3.6.2: u.uswldtim used to be set to 0 by life-saving but it
expels now so the !u.uswldtim case is no longer possible;
however, polymorphing into a huge form while already
@@ -1447,7 +1447,7 @@ explmu(struct monst *mtmp, struct attack *mattk, boolean ufound)
kill_agr = FALSE; /* lifesaving? */
break;
case AD_BLND:
not_affected = resists_blnd(&g.youmonst);
not_affected = resists_blnd(&gy.youmonst);
if (ufound && !not_affected) {
/* sometimes you're affected even if it's invisible */
if (mon_visible(mtmp) || (rnd(tmp /= 2) > u.ulevel)) {
@@ -1462,7 +1462,7 @@ explmu(struct monst *mtmp, struct attack *mattk, boolean ufound)
case AD_HALU:
not_affected |= Blind || (u.umonnum == PM_BLACK_LIGHT
|| u.umonnum == PM_VIOLET_FUNGUS
|| dmgtype(g.youmonst.data, AD_STUN));
|| dmgtype(gy.youmonst.data, AD_STUN));
if (ufound && !not_affected) {
boolean chg;
if (!Hallucination)
@@ -1552,7 +1552,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
}
if (useeit)
pline("%s is turned to stone!", Monnam(mtmp));
g.stoned = TRUE;
gs.stoned = TRUE;
killed(mtmp);
if (!DEADMONSTER(mtmp))
@@ -1563,11 +1563,11 @@ gazemu(struct monst *mtmp, struct attack *mattk)
&& !Stone_resistance) {
You("meet %s gaze.", s_suffix(mon_nam(mtmp)));
stop_occupation();
if (poly_when_stoned(g.youmonst.data) && polymon(PM_STONE_GOLEM))
if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))
break;
urgent_pline("You turn to stone...");
g.killer.format = KILLED_BY;
Strcpy(g.killer.name, pmname(mtmp->data, Mgender(mtmp)));
gk.killer.format = KILLED_BY;
Strcpy(gk.killer.name, pmname(mtmp->data, Mgender(mtmp)));
done(STONING);
}
break;
@@ -1605,7 +1605,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
}
break;
case AD_BLND:
if (canseemon(mtmp) && !resists_blnd(&g.youmonst)
if (canseemon(mtmp) && !resists_blnd(&gy.youmonst)
&& mdistu(mtmp) <= BOLT_LIM * BOLT_LIM) {
if (cancelled) {
react = rn1(2, 2); /* "puzzled" || "dazzled" */
@@ -1653,7 +1653,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
}
burn_away_slime();
if (lev > rn2(20))
(void) burnarmor(&g.youmonst);
(void) burnarmor(&gy.youmonst);
if (lev > rn2(20))
destroy_item(SCROLL_CLASS, AD_FIRE);
if (lev > rn2(20))
@@ -1661,7 +1661,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
if (lev > rn2(25))
destroy_item(SPBOOK_CLASS, AD_FIRE);
if (lev > rn2(20))
ignite_items(g.invent);
ignite_items(gi.invent);
if (dmg)
mdamageu(mtmp, dmg);
}
@@ -1669,7 +1669,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
break;
#ifdef PM_BEHOLDER /* work in progress */
case AD_SLEE:
if (mcanseeu && g.multi >= 0 && !rn2(5) && !Sleep_resistance) {
if (mcanseeu && gm.multi >= 0 && !rn2(5) && !Sleep_resistance) {
if (cancelled) {
react = 6; /* "tired" */
already = (mtmp->mfrozen != 0); /* can't happen... */
@@ -1715,7 +1715,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
void
mdamageu(struct monst *mtmp, int n)
{
g.context.botl = 1;
gc.context.botl = 1;
if (Upolyd) {
u.mh -= n;
if (u.mh < 1)
@@ -1743,8 +1743,8 @@ could_seduce(
if (is_animal(magr->data))
return 0;
if (magr == &g.youmonst) {
pagr = g.youmonst.data;
if (magr == &gy.youmonst) {
pagr = gy.youmonst.data;
agrinvis = (Invis != 0);
genagr = poly_gender();
} else {
@@ -1752,7 +1752,7 @@ could_seduce(
agrinvis = magr->minvis;
genagr = gender(magr);
}
if (mdef == &g.youmonst) {
if (mdef == &gy.youmonst) {
defperc = (See_invisible != 0);
gendef = poly_gender();
} else {
@@ -1816,7 +1816,7 @@ doseduce(struct monst *mon)
if (welded(uwep))
tried_gloves = 1;
for (ring = g.invent; ring; ring = nring) {
for (ring = gi.invent; ring; ring = nring) {
nring = ring->nobj;
if (ring->otyp != RIN_ADORNMENT)
continue;
@@ -1989,16 +1989,16 @@ doseduce(struct monst *mon)
You("are down in the dumps.");
(void) adjattrib(A_CON, -1, TRUE);
exercise(A_CON, FALSE);
g.context.botl = 1;
gc.context.botl = 1;
break;
case 2:
Your("senses are dulled.");
(void) adjattrib(A_WIS, -1, TRUE);
exercise(A_WIS, FALSE);
g.context.botl = 1;
gc.context.botl = 1;
break;
case 3:
if (!resists_drli(&g.youmonst)) {
if (!resists_drli(&gy.youmonst)) {
You_feel("out of shape.");
losexp("overexertion");
} else {
@@ -2033,13 +2033,13 @@ doseduce(struct monst *mon)
You_feel("good enough to do it again.");
(void) adjattrib(A_CON, 1, TRUE);
exercise(A_CON, TRUE);
g.context.botl = 1;
gc.context.botl = 1;
break;
case 2:
You("will always remember %s...", noit_mon_nam(mon));
(void) adjattrib(A_WIS, 1, TRUE);
exercise(A_WIS, TRUE);
g.context.botl = 1;
gc.context.botl = 1;
break;
case 3:
pline("That was a very educational experience.");
@@ -2052,7 +2052,7 @@ doseduce(struct monst *mon)
if (Upolyd)
u.mh = u.mhmax;
exercise(A_STR, TRUE);
g.context.botl = 1;
gc.context.botl = 1;
break;
}
}
@@ -2066,7 +2066,7 @@ doseduce(struct monst *mon)
pline("%s tries to take your gold, but fails...", noit_Monnam(mon));
} else {
long cost;
long umoney = money_cnt(g.invent);
long umoney = money_cnt(gi.invent);
if (umoney > (long) LARGEST_INT - 10L)
cost = (long) rnd(LARGEST_INT) + 500L;
@@ -2085,7 +2085,7 @@ doseduce(struct monst *mon)
pline("%s takes %ld %s for services rendered!", noit_Monnam(mon),
cost, currency(cost));
money2mon(mon, cost);
g.context.botl = 1;
gc.context.botl = 1;
}
}
if (!rn2(25))
@@ -2213,7 +2213,7 @@ passiveum(
return 1;
}
pline("%s turns to stone!", Monnam(mtmp));
g.stoned = 1;
gs.stoned = 1;
xkilled(mtmp, XKILL_NOMSG);
if (!DEADMONSTER(mtmp))
return MM_HIT;
@@ -2256,7 +2256,7 @@ passiveum(
&& (perceives(mtmp->data) || !Invis)) {
if (Blind)
pline("As a blind %s, you cannot defend yourself.",
pmname(g.youmonst.data,
pmname(gy.youmonst.data,
flags.female ? FEMALE : MALE));
else {
if (mon_reflects(mtmp,
@@ -2285,8 +2285,8 @@ passiveum(
u.mh += tmp / 2;
if (u.mhmax < u.mh)
u.mhmax = u.mh;
if (u.mhmax > ((g.youmonst.data->mlevel + 1) * 8))
(void) split_mon(&g.youmonst, mtmp);
if (u.mhmax > ((gy.youmonst.data->mlevel + 1) * 8))
(void) split_mon(&gy.youmonst, mtmp);
break;
case AD_STUN: /* Yellow mold */
if (!mtmp->mstun) {
@@ -2338,24 +2338,24 @@ struct monst *
cloneu(void)
{
struct monst *mon;
int mndx = monsndx(g.youmonst.data);
int mndx = monsndx(gy.youmonst.data);
if (u.mh <= 1)
return (struct monst *) 0;
if (g.mvitals[mndx].mvflags & G_EXTINCT)
if (gm.mvitals[mndx].mvflags & G_EXTINCT)
return (struct monst *) 0;
mon = makemon(g.youmonst.data, u.ux, u.uy,
mon = makemon(gy.youmonst.data, u.ux, u.uy,
NO_MINVENT | MM_EDOG | MM_NOMSG);
if (!mon)
return NULL;
mon->mcloned = 1;
mon = christen_monst(mon, g.plname);
mon = christen_monst(mon, gp.plname);
initedog(mon);
mon->m_lev = g.youmonst.data->mlevel;
mon->m_lev = gy.youmonst.data->mlevel;
mon->mhpmax = u.mhmax;
mon->mhp = u.mh / 2;
u.mh -= mon->mhp;
g.context.botl = 1;
gc.context.botl = 1;
return mon;
}
+10 -10
View File
@@ -130,7 +130,7 @@ msummon(struct monst *mon)
* If this daemon is unique and being re-summoned (the only way we
* could get this far with an extinct dtype), try another.
*/
if ((g.mvitals[dtype].mvflags & G_GONE) != 0) {
if ((gm.mvitals[dtype].mvflags & G_GONE) != 0) {
dtype = ndemon(atyp);
if (dtype == NON_PM)
return 0;
@@ -274,7 +274,7 @@ demon_talk(register struct monst *mtmp)
reset_faint(); /* if fainted - wake up */
} else {
stop_occupation();
if (g.multi > 0) {
if (gm.multi > 0) {
nomul(0);
unmul((char *) 0);
}
@@ -291,7 +291,7 @@ demon_talk(register struct monst *mtmp)
}
newsym(mtmp->mx, mtmp->my);
}
if (g.youmonst.data->mlet == S_DEMON) { /* Won't blackmail their own. */
if (gy.youmonst.data->mlet == S_DEMON) { /* Won't blackmail their own. */
if (!Deaf)
pline("%s says, \"Good hunting, %s.\"", Amonnam(mtmp),
flags.female ? "Sister" : "Brother");
@@ -301,11 +301,11 @@ demon_talk(register struct monst *mtmp)
(void) rloc(mtmp, RLOC_MSG);
return 1;
}
cash = money_cnt(g.invent);
cash = money_cnt(gi.invent);
demand = (cash * (rnd(80) + 20 * Athome))
/ (100 * (1 + (sgn(u.ualign.type) == sgn(mtmp->data->maligntyp))));
if (!demand || g.multi < 0) { /* you have no gold or can't move */
if (!demand || gm.multi < 0) { /* you have no gold or can't move */
mtmp->mpeaceful = 0;
set_malign(mtmp);
return 0;
@@ -352,7 +352,7 @@ bribe(struct monst *mtmp)
{
char buf[BUFSZ] = DUMMY;
long offer;
long umoney = money_cnt(g.invent);
long umoney = money_cnt(gi.invent);
getlin("How much will you offer?", buf);
if (sscanf(buf, "%ld", &offer) != 1)
@@ -373,7 +373,7 @@ bribe(struct monst *mtmp)
You("give %s %ld %s.", mon_nam(mtmp), offer, currency(offer));
}
(void) money2mon(mtmp, offer);
g.context.botl = 1;
gc.context.botl = 1;
return offer;
}
@@ -384,7 +384,7 @@ dprince(aligntyp atyp)
for (tryct = !In_endgame(&u.uz) ? 20 : 0; tryct > 0; --tryct) {
pm = rn1(PM_DEMOGORGON + 1 - PM_ORCUS, PM_ORCUS);
if (!(g.mvitals[pm].mvflags & G_GONE)
if (!(gm.mvitals[pm].mvflags & G_GONE)
&& (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp)))
return pm;
}
@@ -398,7 +398,7 @@ dlord(aligntyp atyp)
for (tryct = !In_endgame(&u.uz) ? 20 : 0; tryct > 0; --tryct) {
pm = rn1(PM_YEENOGHU + 1 - PM_JUIBLEX, PM_JUIBLEX);
if (!(g.mvitals[pm].mvflags & G_GONE)
if (!(gm.mvitals[pm].mvflags & G_GONE)
&& (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp)))
return pm;
}
@@ -409,7 +409,7 @@ dlord(aligntyp atyp)
int
llord(void)
{
if (!(g.mvitals[PM_ARCHON].mvflags & G_GONE))
if (!(gm.mvitals[PM_ARCHON].mvflags & G_GONE))
return PM_ARCHON;
return lminion(); /* approximate */
+188 -188
View File
@@ -41,8 +41,8 @@ static void mkinvpos(coordxy, coordxy, int);
static void mk_knox_portal(coordxy, coordxy);
#define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE)
#define init_vault() g.vault_x = -1
#define do_vault() (g.vault_x != -1)
#define init_vault() gv.vault_x = -1
#define do_vault() (gv.vault_x != -1)
/* Args must be (const genericptr) so that qsort will always be happy. */
@@ -77,7 +77,7 @@ door_into_nonjoined(coordxy x, coordxy y)
/* Is this connecting to a room that doesn't want joining? */
if (levl[tx][ty].roomno >= ROOMOFFSET
&& !g.rooms[levl[tx][ty].roomno - ROOMOFFSET].needjoining) {
&& !gr.rooms[levl[tx][ty].roomno - ROOMOFFSET].needjoining) {
return TRUE;
}
}
@@ -119,13 +119,13 @@ void
sort_rooms(void)
{
coordxy x, y;
unsigned i, ri[MAXNROFROOMS + 1], n = (unsigned) g.nroom;
unsigned i, ri[MAXNROFROOMS + 1], n = (unsigned) gn.nroom;
qsort((genericptr_t) g.rooms, n, sizeof (struct mkroom), mkroom_cmp);
qsort((genericptr_t) gr.rooms, n, sizeof (struct mkroom), mkroom_cmp);
/* Update the roomnos on the map */
for (i = 0; i < n; i++)
ri[g.rooms[i].roomnoidx] = i;
ri[gr.rooms[i].roomnoidx] = i;
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
@@ -165,18 +165,18 @@ do_room_or_subroom(register struct mkroom *croom,
} else
croom->rlit = 0;
croom->roomnoidx = (croom - g.rooms);
croom->roomnoidx = (croom - gr.rooms);
croom->lx = lowx;
croom->hx = hix;
croom->ly = lowy;
croom->hy = hiy;
croom->rtype = rtype;
croom->doorct = 0;
/* if we're not making a vault, g.doorindex will still be 0
/* if we're not making a vault, gd.doorindex will still be 0
* if we are, we'll have problems adding niches to the previous room
* unless fdoor is at least g.doorindex
* unless fdoor is at least gd.doorindex
*/
croom->fdoor = g.doorindex;
croom->fdoor = gd.doorindex;
croom->irregular = FALSE;
croom->nsubrooms = 0;
@@ -215,12 +215,12 @@ add_room(int lowx, int lowy, int hix, int hiy,
{
register struct mkroom *croom;
croom = &g.rooms[g.nroom];
croom = &gr.rooms[gn.nroom];
do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special,
(boolean) TRUE);
croom++;
croom->hx = -1;
g.nroom++;
gn.nroom++;
}
void
@@ -229,13 +229,13 @@ add_subroom(struct mkroom *proom, int lowx, int lowy, int hix, int hiy,
{
register struct mkroom *croom;
croom = &g.subrooms[g.nsubroom];
croom = &gs.subrooms[gn.nsubroom];
do_room_or_subroom(croom, lowx, lowy, hix, hiy, lit, rtype, special,
(boolean) FALSE);
proom->sbrooms[proom->nsubrooms++] = croom;
croom++;
croom->hx = -1;
g.nsubroom++;
gn.nsubroom++;
}
void
@@ -243,12 +243,12 @@ free_luathemes(boolean keependgame) /* F: done, T: discarding main dungeon */
{
int i;
for (i = 0; i < g.n_dgns; ++i) {
for (i = 0; i < gn.n_dgns; ++i) {
if (keependgame && i == astral_level.dnum)
continue;
if (g.luathemes[i]) {
nhl_done((lua_State *) g.luathemes[i]);
g.luathemes[i] = (lua_State *) 0;
if (gl.luathemes[i]) {
nhl_done((lua_State *) gl.luathemes[i]);
gl.luathemes[i] = (lua_State *) 0;
}
}
}
@@ -260,9 +260,9 @@ makerooms(void)
int themeroom_tries = 0;
char *fname;
nhl_sandbox_info sbi = {NHL_SB_SAFE, 0, 0, 0};
lua_State *themes = (lua_State *) g.luathemes[u.uz.dnum];
lua_State *themes = (lua_State *) gl.luathemes[u.uz.dnum];
if (!themes && *(fname = g.dungeons[u.uz.dnum].themerms)) {
if (!themes && *(fname = gd.dungeons[u.uz.dnum].themerms)) {
if ((themes = nhl_init(&sbi)) != 0) {
if (!nhl_loadlua(themes, fname)) {
/* loading lua failed, don't use themed rooms */
@@ -270,48 +270,48 @@ makerooms(void)
themes = (lua_State *) 0;
} else {
/* success; save state for this dungeon branch */
g.luathemes[u.uz.dnum] = (genericptr_t) themes;
gl.luathemes[u.uz.dnum] = (genericptr_t) themes;
/* keep themes context, so not 'nhl_done(themes);' */
iflags.in_lua = FALSE; /* can affect error messages */
}
}
if (!themes) /* don't try again when making next level */
*fname = '\0'; /* g.dungeons[u.uz.dnum].themerms */
*fname = '\0'; /* gd.dungeons[u.uz.dnum].themerms */
}
if (themes) {
create_des_coder();
iflags.in_lua = g.in_mk_themerooms = TRUE;
g.themeroom_failed = FALSE;
iflags.in_lua = gi.in_mk_themerooms = TRUE;
gt.themeroom_failed = FALSE;
lua_getglobal(themes, "pre_themerooms_generate");
if ( nhl_pcall(themes, 0, 0)){
impossible("Lua error: %s", lua_tostring(themes, -1));
}
iflags.in_lua = g.in_mk_themerooms = FALSE;
iflags.in_lua = gi.in_mk_themerooms = FALSE;
}
/* make rooms until satisfied */
/* rnd_rect() will returns 0 if no more rects are available... */
while (g.nroom < (MAXNROFROOMS-1) && rnd_rect()) {
if (g.nroom >= (MAXNROFROOMS / 6) && rn2(2) && !tried_vault) {
while (gn.nroom < (MAXNROFROOMS-1) && rnd_rect()) {
if (gn.nroom >= (MAXNROFROOMS / 6) && rn2(2) && !tried_vault) {
tried_vault = TRUE;
if (create_vault()) {
g.vault_x = g.rooms[g.nroom].lx;
g.vault_y = g.rooms[g.nroom].ly;
g.rooms[g.nroom].hx = -1;
gv.vault_x = gr.rooms[gn.nroom].lx;
gv.vault_y = gr.rooms[gn.nroom].ly;
gr.rooms[gn.nroom].hx = -1;
}
} else {
if (themes) {
iflags.in_lua = g.in_mk_themerooms = TRUE;
g.themeroom_failed = FALSE;
iflags.in_lua = gi.in_mk_themerooms = TRUE;
gt.themeroom_failed = FALSE;
lua_getglobal(themes, "themerooms_generate");
if (nhl_pcall(themes, 0, 0)) {
impossible("Lua error: %s", lua_tostring(themes, -1));
}
iflags.in_lua = g.in_mk_themerooms = FALSE;
if (g.themeroom_failed
iflags.in_lua = gi.in_mk_themerooms = FALSE;
if (gt.themeroom_failed
&& ((themeroom_tries++ > 10)
|| (g.nroom >= (MAXNROFROOMS / 6))))
|| (gn.nroom >= (MAXNROFROOMS / 6))))
break;
} else {
if (!create_room(-1, -1, -1, -1, -1, -1, OROOM, -1))
@@ -321,17 +321,17 @@ makerooms(void)
}
if (themes) {
reset_xystart_size();
iflags.in_lua = g.in_mk_themerooms = TRUE;
g.themeroom_failed = FALSE;
iflags.in_lua = gi.in_mk_themerooms = TRUE;
gt.themeroom_failed = FALSE;
lua_getglobal(themes, "post_themerooms_generate");
if ( nhl_pcall(themes, 0, 0)){
impossible("Lua error: %s", lua_tostring(themes, -1));
}
iflags.in_lua = g.in_mk_themerooms = FALSE;
iflags.in_lua = gi.in_mk_themerooms = FALSE;
wallification(1, 0, COLNO - 1, ROWNO - 1);
free(g.coder);
g.coder = NULL;
free(gc.coder);
gc.coder = NULL;
}
}
@@ -343,8 +343,8 @@ join(register int a, register int b, boolean nxcor)
register struct mkroom *croom, *troom;
register int dx, dy;
croom = &g.rooms[a];
troom = &g.rooms[b];
croom = &gr.rooms[a];
troom = &gr.rooms[b];
if (!croom->needjoining || !troom->needjoining)
return;
@@ -406,17 +406,17 @@ join(register int a, register int b, boolean nxcor)
dest.y = ty;
if (!dig_corridor(&org, &dest, nxcor,
g.level.flags.arboreal ? ROOM : CORR, STONE))
gl.level.flags.arboreal ? ROOM : CORR, STONE))
return;
/* we succeeded in digging the corridor */
if (okdoor(tt.x, tt.y) || !nxcor)
dodoor(tt.x, tt.y, troom);
if (g.smeq[a] < g.smeq[b])
g.smeq[b] = g.smeq[a];
if (gs.smeq[a] < gs.smeq[b])
gs.smeq[b] = gs.smeq[a];
else
g.smeq[a] = g.smeq[b];
gs.smeq[a] = gs.smeq[b];
}
void
@@ -425,45 +425,45 @@ makecorridors(void)
int a, b, i;
boolean any = TRUE;
for (a = 0; a < g.nroom - 1; a++) {
for (a = 0; a < gn.nroom - 1; a++) {
join(a, a + 1, FALSE);
if (!rn2(50))
break; /* allow some randomness */
}
for (a = 0; a < g.nroom - 2; a++)
if (g.smeq[a] != g.smeq[a + 2])
for (a = 0; a < gn.nroom - 2; a++)
if (gs.smeq[a] != gs.smeq[a + 2])
join(a, a + 2, FALSE);
for (a = 0; any && a < g.nroom; a++) {
for (a = 0; any && a < gn.nroom; a++) {
any = FALSE;
for (b = 0; b < g.nroom; b++)
if (g.smeq[a] != g.smeq[b]) {
for (b = 0; b < gn.nroom; b++)
if (gs.smeq[a] != gs.smeq[b]) {
join(a, b, FALSE);
any = TRUE;
}
}
if (g.nroom > 2)
for (i = rn2(g.nroom) + 4; i; i--) {
a = rn2(g.nroom);
b = rn2(g.nroom - 2);
if (gn.nroom > 2)
for (i = rn2(gn.nroom) + 4; i; i--) {
a = rn2(gn.nroom);
b = rn2(gn.nroom - 2);
if (b >= a)
b += 2;
join(a, b, TRUE);
}
}
/* (re)allocate space for g.doors array */
/* (re)allocate space for gd.doors array */
static void
alloc_doors(void)
{
if (!g.doors || g.doorindex >= g.doors_alloc) {
int c = g.doors_alloc + DOORINC;
if (!gd.doors || gd.doorindex >= gd.doors_alloc) {
int c = gd.doors_alloc + DOORINC;
coord *doortmp = (coord *) alloc(c * sizeof(coord));
if (g.doors) {
(void) memcpy(doortmp, g.doors, g.doors_alloc * sizeof(coord));
free(g.doors);
if (gd.doors) {
(void) memcpy(doortmp, gd.doors, gd.doors_alloc * sizeof(coord));
free(gd.doors);
}
g.doors = doortmp;
g.doors_alloc = c;
gd.doors = doortmp;
gd.doors_alloc = c;
}
}
@@ -479,33 +479,33 @@ add_door(coordxy x, coordxy y, register struct mkroom *aroom)
if (aroom->doorct) {
for (i = 0; i < aroom->doorct; i++) {
tmp = aroom->fdoor + i;
if (g.doors[tmp].x == x && g.doors[tmp].y == y)
if (gd.doors[tmp].x == x && gd.doors[tmp].y == y)
return;
}
}
if (aroom->doorct == 0)
aroom->fdoor = g.doorindex;
aroom->fdoor = gd.doorindex;
aroom->doorct++;
for (tmp = g.doorindex; tmp > aroom->fdoor; tmp--)
g.doors[tmp] = g.doors[tmp - 1];
for (tmp = gd.doorindex; tmp > aroom->fdoor; tmp--)
gd.doors[tmp] = gd.doors[tmp - 1];
for (i = 0; i < g.nroom; i++) {
broom = &g.rooms[i];
for (i = 0; i < gn.nroom; i++) {
broom = &gr.rooms[i];
if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor)
broom->fdoor++;
}
for (i = 0; i < g.nsubroom; i++) {
broom = &g.subrooms[i];
for (i = 0; i < gn.nsubroom; i++) {
broom = &gs.subrooms[i];
if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor)
broom->fdoor++;
}
g.doorindex++;
g.doors[aroom->fdoor].x = x;
g.doors[aroom->fdoor].y = y;
gd.doorindex++;
gd.doors[aroom->fdoor].x = x;
gd.doors[aroom->fdoor].y = y;
}
static void
@@ -540,7 +540,7 @@ dosdoor(register coordxy x, register coordxy y, struct mkroom *aroom, int type)
}
/* also done in roguecorr(); doing it here first prevents
making mimics in place of trapped doors on rogue g.level */
making mimics in place of trapped doors on rogue gl.level */
if (Is_rogue_level(&u.uz))
levl[x][y].doormask = D_NODOOR;
@@ -548,9 +548,9 @@ dosdoor(register coordxy x, register coordxy y, struct mkroom *aroom, int type)
struct monst *mtmp;
if (level_difficulty() >= 9 && !rn2(5)
&& !((g.mvitals[PM_SMALL_MIMIC].mvflags & G_GONE)
&& (g.mvitals[PM_LARGE_MIMIC].mvflags & G_GONE)
&& (g.mvitals[PM_GIANT_MIMIC].mvflags & G_GONE))) {
&& !((gm.mvitals[PM_SMALL_MIMIC].mvflags & G_GONE)
&& (gm.mvitals[PM_LARGE_MIMIC].mvflags & G_GONE)
&& (gm.mvitals[PM_GIANT_MIMIC].mvflags & G_GONE))) {
/* make a mimic instead */
levl[x][y].doormask = D_NODOOR;
mtmp = makemon(mkclass(S_MIMIC, 0), x, y, NO_MM_FLAGS);
@@ -617,7 +617,7 @@ makeniche(int trap_type)
struct trap *ttmp;
while (vct--) {
aroom = &g.rooms[rn2(g.nroom)];
aroom = &gr.rooms[rn2(gn.nroom)];
if (aroom->rtype != OROOM)
continue; /* not an ordinary room */
if (aroom->doorct == 1 && rn2(5))
@@ -658,7 +658,7 @@ makeniche(int trap_type)
mkclass(S_HUMAN, 0), xx,
yy + dy, TRUE);
}
if (!g.level.flags.noteleport)
if (!gl.level.flags.noteleport)
(void) mksobj_at(SCR_TELEPORTATION, xx, yy + dy, TRUE,
FALSE);
if (!rn2(3))
@@ -672,8 +672,8 @@ makeniche(int trap_type)
static void
make_niches(void)
{
int ct = rnd((g.nroom >> 1) + 1), dep = depth(&u.uz);
boolean ltptr = (!g.level.flags.noteleport && dep > 15),
int ct = rnd((gn.nroom >> 1) + 1), dep = depth(&u.uz);
boolean ltptr = (!gl.level.flags.noteleport && dep > 15),
vamp = (dep > 5 && dep < 25);
while (ct--) {
@@ -715,56 +715,56 @@ clear_level_structures(void)
lev = &levl[x][0];
for (y = 0; y < ROWNO; y++) {
*lev++ = zerorm;
g.level.objects[x][y] = (struct obj *) 0;
g.level.monsters[x][y] = (struct monst *) 0;
gl.level.objects[x][y] = (struct obj *) 0;
gl.level.monsters[x][y] = (struct monst *) 0;
}
}
g.level.objlist = (struct obj *) 0;
g.level.buriedobjlist = (struct obj *) 0;
g.level.monlist = (struct monst *) 0;
g.level.damagelist = (struct damage *) 0;
g.level.bonesinfo = (struct cemetery *) 0;
gl.level.objlist = (struct obj *) 0;
gl.level.buriedobjlist = (struct obj *) 0;
gl.level.monlist = (struct monst *) 0;
gl.level.damagelist = (struct damage *) 0;
gl.level.bonesinfo = (struct cemetery *) 0;
g.level.flags.nfountains = 0;
g.level.flags.nsinks = 0;
g.level.flags.has_shop = 0;
g.level.flags.has_vault = 0;
g.level.flags.has_zoo = 0;
g.level.flags.has_court = 0;
g.level.flags.has_morgue = g.level.flags.graveyard = 0;
g.level.flags.has_beehive = 0;
g.level.flags.has_barracks = 0;
g.level.flags.has_temple = 0;
g.level.flags.has_swamp = 0;
g.level.flags.noteleport = 0;
g.level.flags.hardfloor = 0;
g.level.flags.nommap = 0;
g.level.flags.hero_memory = 1;
g.level.flags.shortsighted = 0;
g.level.flags.sokoban_rules = 0;
g.level.flags.is_maze_lev = 0;
g.level.flags.is_cavernous_lev = 0;
g.level.flags.arboreal = 0;
g.level.flags.wizard_bones = 0;
g.level.flags.corrmaze = 0;
gl.level.flags.nfountains = 0;
gl.level.flags.nsinks = 0;
gl.level.flags.has_shop = 0;
gl.level.flags.has_vault = 0;
gl.level.flags.has_zoo = 0;
gl.level.flags.has_court = 0;
gl.level.flags.has_morgue = gl.level.flags.graveyard = 0;
gl.level.flags.has_beehive = 0;
gl.level.flags.has_barracks = 0;
gl.level.flags.has_temple = 0;
gl.level.flags.has_swamp = 0;
gl.level.flags.noteleport = 0;
gl.level.flags.hardfloor = 0;
gl.level.flags.nommap = 0;
gl.level.flags.hero_memory = 1;
gl.level.flags.shortsighted = 0;
gl.level.flags.sokoban_rules = 0;
gl.level.flags.is_maze_lev = 0;
gl.level.flags.is_cavernous_lev = 0;
gl.level.flags.arboreal = 0;
gl.level.flags.wizard_bones = 0;
gl.level.flags.corrmaze = 0;
g.nroom = 0;
g.rooms[0].hx = -1;
g.nsubroom = 0;
g.subrooms[0].hx = -1;
g.doorindex = 0;
g.doors_alloc = 0;
free(g.doors);
g.doors = (coord *) 0;
gn.nroom = 0;
gr.rooms[0].hx = -1;
gn.nsubroom = 0;
gs.subrooms[0].hx = -1;
gd.doorindex = 0;
gd.doors_alloc = 0;
free(gd.doors);
gd.doors = (coord *) 0;
init_rect();
init_vault();
stairway_free_all();
g.made_branch = FALSE;
gm.made_branch = FALSE;
clear_regions();
reset_xystart_size();
if (g.lev_message) {
free(g.lev_message);
g.lev_message = (char *) 0;
if (gl.lev_message) {
free(gl.lev_message);
gl.lev_message = (char *) 0;
}
}
@@ -836,7 +836,7 @@ fill_ordinary_room(struct mkroom *croom)
* of rooms; about 5 - 7.5% for 2 boxes, least likely
* when few rooms; chance for 3 or more is negligible.
*/
if (!rn2(g.nroom * 5 / 2) && somexyspace(croom, &pos))
if (!rn2(gn.nroom * 5 / 2) && somexyspace(croom, &pos))
(void) mksobj_at((rn2(3)) ? LARGE_BOX : CHEST,
pos.x, pos.y, TRUE, FALSE);
@@ -891,18 +891,18 @@ makelevel(void)
/* check for special levels */
if (slev && !Is_rogue_level(&u.uz)) {
makemaz(slev->proto);
} else if (g.dungeons[u.uz.dnum].proto[0]) {
} else if (gd.dungeons[u.uz.dnum].proto[0]) {
makemaz("");
} else if (g.dungeons[u.uz.dnum].fill_lvl[0]) {
makemaz(g.dungeons[u.uz.dnum].fill_lvl);
} else if (gd.dungeons[u.uz.dnum].fill_lvl[0]) {
makemaz(gd.dungeons[u.uz.dnum].fill_lvl);
} else if (In_quest(&u.uz)) {
char fillname[9];
s_level *loc_lev;
Sprintf(fillname, "%s-loca", g.urole.filecode);
Sprintf(fillname, "%s-loca", gu.urole.filecode);
loc_lev = find_level(fillname);
Sprintf(fillname, "%s-fil", g.urole.filecode);
Sprintf(fillname, "%s-fil", gu.urole.filecode);
Strcat(fillname,
(u.uz.dlevel < loc_lev->dlevel.dlevel) ? "a" : "b");
makemaz(fillname);
@@ -938,24 +938,24 @@ makelevel(void)
debugpline0("trying to make a vault...");
w = 1;
h = 1;
if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE)) {
if (check_room(&gv.vault_x, &w, &gv.vault_y, &h, TRUE)) {
fill_vault:
add_room(g.vault_x, g.vault_y, g.vault_x + w, g.vault_y + h,
add_room(gv.vault_x, gv.vault_y, gv.vault_x + w, gv.vault_y + h,
TRUE, VAULT, FALSE);
g.level.flags.has_vault = 1;
gl.level.flags.has_vault = 1;
++room_threshold;
g.rooms[g.nroom - 1].needfill = FILL_NORMAL;
fill_special_room(&g.rooms[g.nroom - 1]);
mk_knox_portal(g.vault_x + w, g.vault_y + h);
if (!g.level.flags.noteleport && !rn2(3))
gr.rooms[gn.nroom - 1].needfill = FILL_NORMAL;
fill_special_room(&gr.rooms[gn.nroom - 1]);
mk_knox_portal(gv.vault_x + w, gv.vault_y + h);
if (!gl.level.flags.noteleport && !rn2(3))
makevtele();
} else if (rnd_rect() && create_vault()) {
g.vault_x = g.rooms[g.nroom].lx;
g.vault_y = g.rooms[g.nroom].ly;
if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE))
gv.vault_x = gr.rooms[gn.nroom].lx;
gv.vault_y = gr.rooms[gn.nroom].ly;
if (check_room(&gv.vault_x, &w, &gv.vault_y, &h, TRUE))
goto fill_vault;
else
g.rooms[g.nroom].hx = -1;
gr.rooms[gn.nroom].hx = -1;
}
}
@@ -965,54 +965,54 @@ makelevel(void)
if (wizard && nh_getenv("SHOPTYPE"))
do_mkroom(SHOPBASE);
else if (u_depth > 1 && u_depth < depth(&medusa_level)
&& g.nroom >= room_threshold && rn2(u_depth) < 3)
&& gn.nroom >= room_threshold && rn2(u_depth) < 3)
do_mkroom(SHOPBASE);
else if (u_depth > 4 && !rn2(6))
do_mkroom(COURT);
else if (u_depth > 5 && !rn2(8)
&& !(g.mvitals[PM_LEPRECHAUN].mvflags & G_GONE))
&& !(gm.mvitals[PM_LEPRECHAUN].mvflags & G_GONE))
do_mkroom(LEPREHALL);
else if (u_depth > 6 && !rn2(7))
do_mkroom(ZOO);
else if (u_depth > 8 && !rn2(5))
do_mkroom(TEMPLE);
else if (u_depth > 9 && !rn2(5)
&& !(g.mvitals[PM_KILLER_BEE].mvflags & G_GONE))
&& !(gm.mvitals[PM_KILLER_BEE].mvflags & G_GONE))
do_mkroom(BEEHIVE);
else if (u_depth > 11 && !rn2(6))
do_mkroom(MORGUE);
else if (u_depth > 12 && !rn2(8) && antholemon())
do_mkroom(ANTHOLE);
else if (u_depth > 14 && !rn2(4)
&& !(g.mvitals[PM_SOLDIER].mvflags & G_GONE))
&& !(gm.mvitals[PM_SOLDIER].mvflags & G_GONE))
do_mkroom(BARRACKS);
else if (u_depth > 15 && !rn2(6))
do_mkroom(SWAMP);
else if (u_depth > 16 && !rn2(8)
&& !(g.mvitals[PM_COCKATRICE].mvflags & G_GONE))
&& !(gm.mvitals[PM_COCKATRICE].mvflags & G_GONE))
do_mkroom(COCKNEST);
skip0:
prevstairs = g.stairs; /* used to test for place_branch() success */
prevstairs = gs.stairs; /* used to test for place_branch() success */
/* Place multi-dungeon branch. */
place_branch(branchp, 0, 0);
/* for main dungeon level 1, the stairs up where the hero starts
are branch stairs; treat them as if hero had just come down
them by marking them as having been traversed; most recently
created stairway is held in 'g.stairs' */
if (u.uz.dnum == 0 && u.uz.dlevel == 1 && g.stairs != prevstairs)
g.stairs->u_traversed = TRUE;
created stairway is held in 'gs.stairs' */
if (u.uz.dnum == 0 && u.uz.dlevel == 1 && gs.stairs != prevstairs)
gs.stairs->u_traversed = TRUE;
/* for each room: put things inside */
for (croom = g.rooms; croom->hx > 0; croom++) {
for (croom = gr.rooms; croom->hx > 0; croom++) {
fill_ordinary_room(croom);
}
}
/* Fill all special rooms now, regardless of whether this is a special
* level, proto level, or ordinary level. */
for (i = 0; i < g.nroom; ++i) {
fill_special_room(&g.rooms[i]);
for (i = 0; i < gn.nroom; ++i) {
fill_special_room(&gr.rooms[i]);
}
}
@@ -1049,7 +1049,7 @@ mineralize(int kelp_pool, int kelp_moat, int goldprob, int gemprob,
almost all special levels are excluded */
if (!skip_lvl_checks
&& (In_hell(&u.uz) || In_V_tower(&u.uz) || Is_rogue_level(&u.uz)
|| g.level.flags.arboreal
|| gl.level.flags.arboreal
|| ((sp = Is_special(&u.uz)) != 0 && !Is_oracle_level(&u.uz)
&& (!In_mines(&u.uz) || sp->flags.town))))
return;
@@ -1126,18 +1126,18 @@ level_finalize_topology(void)
bound_digging();
mineralize(-1, -1, -1, -1, FALSE);
g.in_mklev = FALSE;
gi.in_mklev = FALSE;
/* avoid coordinates in future lua-loads for this level being thrown off
* because xstart and ystart aren't saved with the level and will be 0 after
* leaving and returning */
g.xstart = g.ystart = 0;
gx.xstart = gy.ystart = 0;
/* has_morgue gets cleared once morgue is entered; graveyard stays
set (graveyard might already be set even when has_morgue is clear
[see fixup_special()], so don't update it unconditionally) */
if (g.level.flags.has_morgue)
g.level.flags.graveyard = 1;
if (!g.level.flags.is_maze_lev) {
for (croom = &g.rooms[0]; croom != &g.rooms[g.nroom]; croom++)
if (gl.level.flags.has_morgue)
gl.level.flags.graveyard = 1;
if (!gl.level.flags.is_maze_lev) {
for (croom = &gr.rooms[0]; croom != &gr.rooms[gn.nroom]; croom++)
#ifdef SPECIALIZATION
topologize(croom, FALSE);
#else
@@ -1145,10 +1145,10 @@ level_finalize_topology(void)
#endif
}
set_wall_state();
/* for many room types, g.rooms[].rtype is zeroed once the room has been
entered; g.rooms[].orig_rtype always retains original rtype value */
for (ridx = 0; ridx < SIZE(g.rooms); ridx++)
g.rooms[ridx].orig_rtype = g.rooms[ridx].rtype;
/* for many room types, gr.rooms[].rtype is zeroed once the room has been
entered; gr.rooms[].orig_rtype always retains original rtype value */
for (ridx = 0; ridx < SIZE(gr.rooms); ridx++)
gr.rooms[ridx].orig_rtype = gr.rooms[ridx].rtype;
}
void
@@ -1161,7 +1161,7 @@ mklev(void)
if (getbones())
return;
g.in_mklev = TRUE;
gi.in_mklev = TRUE;
makelevel();
level_finalize_topology();
@@ -1178,7 +1178,7 @@ topologize(struct mkroom *croom)
#endif
{
coordxy x, y;
register int roomno = (int) ((croom - g.rooms) + ROOMOFFSET);
register int roomno = (int) ((croom - gr.rooms) + ROOMOFFSET);
coordxy lowx = croom->lx, lowy = croom->ly;
coordxy hix = croom->hx, hiy = croom->hy;
#ifdef SPECIALIZATION
@@ -1224,7 +1224,7 @@ topologize(struct mkroom *croom)
levl[x][y].roomno = roomno;
}
}
/* g.subrooms */
/* gs.subrooms */
for (subindex = 0; subindex < nsubrooms; subindex++)
#ifdef SPECIALIZATION
topologize(croom->sbrooms[subindex], (boolean) (rtype != OROOM));
@@ -1239,7 +1239,7 @@ find_branch_room(coord *mp)
{
struct mkroom *croom = 0;
if (g.nroom == 0) {
if (gn.nroom == 0) {
mazexy(mp); /* already verifies location */
} else {
croom = generate_stairs_find_room();
@@ -1257,7 +1257,7 @@ pos_to_room(coordxy x, coordxy y)
int i;
struct mkroom *curr;
for (curr = g.rooms, i = 0; i < g.nroom; curr++, i++)
for (curr = gr.rooms, i = 0; i < gn.nroom; curr++, i++)
if (inside_room(curr, x, y))
return curr;
;
@@ -1281,7 +1281,7 @@ place_branch(
* a special level is loaded that specifies an SSTAIR location
* as a favored spot for a branch.
*/
if (!br || g.made_branch)
if (!br || gm.made_branch)
return;
nhUse(br_room);
@@ -1320,7 +1320,7 @@ place_branch(
* per level, if we failed once, we're going to fail again on the
* next call.
*/
g.made_branch = TRUE;
gm.made_branch = TRUE;
}
static boolean
@@ -1449,7 +1449,7 @@ mktrap(
kind = NO_TRAP;
break;
case LEVEL_TELEP:
if (lvl < 5 || g.level.flags.noteleport
if (lvl < 5 || gl.level.flags.noteleport
|| single_level_branch(&u.uz))
kind = NO_TRAP;
break;
@@ -1475,7 +1475,7 @@ mktrap(
kind = NO_TRAP;
break;
case TELEP_TRAP:
if (g.level.flags.noteleport)
if (gl.level.flags.noteleport)
kind = NO_TRAP;
break;
case HOLE:
@@ -1724,26 +1724,26 @@ generate_stairs_find_room(void)
struct mkroom *croom;
int i, phase, tryct = 0;
if (!g.nroom)
if (!gn.nroom)
return (struct mkroom *) 0;
for (phase = 2; phase > -1; phase--) {
do {
croom = &g.rooms[rn2(g.nroom)];
croom = &gr.rooms[rn2(gn.nroom)];
if (generate_stairs_room_good(croom, phase))
return croom;
} while (tryct++ < 50);
}
for (phase = 2; phase > -2; phase--) {
for (i = 0; i < g.nroom; i++) {
croom = &g.rooms[i];
for (i = 0; i < gn.nroom; i++) {
croom = &gr.rooms[i];
if (generate_stairs_room_good(croom, phase))
return croom;
}
}
croom = &g.rooms[rn2(g.nroom)];
croom = &gr.rooms[rn2(gn.nroom)];
return croom;
}
@@ -1763,7 +1763,7 @@ generate_stairs(void)
mkstairs(pos.x, pos.y, 0, croom, FALSE); /* down */
}
if (g.nroom > 1)
if (gn.nroom > 1)
croom = generate_stairs_find_room();
if (u.uz.dlevel != 1) {
@@ -1790,7 +1790,7 @@ mkfount(struct mkroom *croom)
if (!rn2(7))
levl[m.x][m.y].blessedftn = 1;
g.level.flags.nfountains++;
gl.level.flags.nfountains++;
}
static boolean
@@ -1819,7 +1819,7 @@ mksink(struct mkroom *croom)
if (!set_levltyp(m.x, m.y, SINK))
return;
g.level.flags.nsinks++;
gl.level.flags.nsinks++;
}
static void
@@ -1897,7 +1897,7 @@ mkgrave(struct mkroom *croom)
/*
* Major level transmutation: add a set of stairs (to the Sanctum) after
* an earthquake that leaves behind a new topology, centered at inv_pos.
* Assumes there are no rooms within the invocation area and that g.inv_pos
* Assumes there are no rooms within the invocation area and that gi.inv_pos
* is not too close to the edge of the map. Also assume the hero can see,
* which is guaranteed for normal play due to the fact that sight is needed
* to read the Book of the Dead. [That assumption is not valid; it is
@@ -1908,8 +1908,8 @@ void
mkinvokearea(void)
{
int dist;
coordxy xmin = g.inv_pos.x, xmax = g.inv_pos.x,
ymin = g.inv_pos.y, ymax = g.inv_pos.y;
coordxy xmin = gi.inv_pos.x, xmax = gi.inv_pos.x,
ymin = gi.inv_pos.y, ymax = gi.inv_pos.y;
register coordxy i;
/* slightly odd if levitating, but not wrong */
@@ -1957,7 +1957,7 @@ mkinvokearea(void)
You("are standing at the top of a stairwell leading down!");
mkstairs(u.ux, u.uy, 0, (struct mkroom *) 0, FALSE); /* down */
newsym(u.ux, u.uy);
g.vision_full_recalc = 1; /* everything changed */
gv.vision_full_recalc = 1; /* everything changed */
}
/* Change level topology. Boulders in the vicinity are eliminated.
@@ -1974,7 +1974,7 @@ mkinvpos(coordxy x, coordxy y, int dist)
/* clip at existing map borders if necessary */
if (!within_bounded_area(x, y, x_maze_min + 1, y_maze_min + 1,
g.x_maze_max - 1, g.y_maze_max - 1)) {
gx.x_maze_max - 1, gy.y_maze_max - 1)) {
/* outermost 2 columns and/or rows may be truncated due to edge */
if (dist < (7 - 2))
panic("mkinvpos: <%d,%d> (%d) off map edge!", x, y, dist);
@@ -2005,7 +2005,7 @@ mkinvpos(coordxy x, coordxy y, int dist)
lev->waslit = TRUE;
lev->horizontal = FALSE;
/* short-circuit vision recalc */
g.viz_array[y][x] = (dist < 6) ? (IN_SIGHT | COULD_SEE) : COULD_SEE;
gv.viz_array[y][x] = (dist < 6) ? (IN_SIGHT | COULD_SEE) : COULD_SEE;
switch (dist) {
case 1: /* fire traps */
@@ -2076,7 +2076,7 @@ mk_knox_portal(coordxy x, coordxy y)
}
/* Already set or 2/3 chance of deferring until a later level. */
if (source->dnum < g.n_dgns || (rn2(3) && !wizard))
if (source->dnum < gn.n_dgns || (rn2(3) && !wizard))
return;
if (!(u.uz.dnum == oracle_level.dnum /* in main dungeon */
+36 -36
View File
@@ -95,7 +95,7 @@ pass_one(schar bg_typ, schar fg_typ)
}
}
#define new_loc(i, j) *(g.new_locations + ((j) * (WIDTH + 1)) + (i))
#define new_loc(i, j) *(gn.new_locations + ((j) * (WIDTH + 1)) + (i))
static void
pass_two(schar bg_typ, schar fg_typ)
@@ -169,10 +169,10 @@ flood_fill_rm(
sx++; /* compensate for extra decrement */
/* assume sx,sy is valid */
if (sx < g.min_rx)
g.min_rx = sx;
if (sy < g.min_ry)
g.min_ry = sy;
if (sx < gm.min_rx)
gm.min_rx = sx;
if (sy < gm.min_ry)
gm.min_ry = sy;
for (i = sx; i <= WIDTH && levl[i][sy].typ == fg_typ; i++) {
levl[i][sy].roomno = rmno;
@@ -195,7 +195,7 @@ flood_fill_rm(
levl[ii][jj].roomno = SHARED;
}
}
g.n_loc_filled++;
gn.n_loc_filled++;
}
nx = i;
@@ -236,10 +236,10 @@ flood_fill_rm(
}
}
if (nx > g.max_rx)
g.max_rx = nx - 1; /* nx is just past valid region */
if (sy > g.max_ry)
g.max_ry = sy;
if (nx > gm.max_rx)
gm.max_rx = nx - 1; /* nx is just past valid region */
if (sy > gm.max_ry)
gm.max_ry = sy;
}
/* join_map uses temporary rooms; clean up after it */
@@ -251,8 +251,8 @@ join_map_cleanup(void)
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
levl[x][y].roomno = NO_ROOM;
g.nroom = g.nsubroom = 0;
g.rooms[g.nroom].hx = g.subrooms[g.nsubroom].hx = -1;
gn.nroom = gn.nsubroom = 0;
gr.rooms[gn.nroom].hx = gs.subrooms[gn.nsubroom].hx = -1;
}
static void
@@ -269,25 +269,25 @@ join_map(schar bg_typ, schar fg_typ)
for (i = 2; i <= WIDTH; i++)
for (j = 1; j < HEIGHT; j++) {
if (levl[i][j].typ == fg_typ && levl[i][j].roomno == NO_ROOM) {
g.min_rx = g.max_rx = i;
g.min_ry = g.max_ry = j;
g.n_loc_filled = 0;
flood_fill_rm(i, j, g.nroom + ROOMOFFSET, FALSE, FALSE);
if (g.n_loc_filled > 3) {
add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry,
gm.min_rx = gm.max_rx = i;
gm.min_ry = gm.max_ry = j;
gn.n_loc_filled = 0;
flood_fill_rm(i, j, gn.nroom + ROOMOFFSET, FALSE, FALSE);
if (gn.n_loc_filled > 3) {
add_room(gm.min_rx, gm.min_ry, gm.max_rx, gm.max_ry,
FALSE, OROOM, TRUE);
g.rooms[g.nroom - 1].irregular = TRUE;
if (g.nroom >= (MAXNROFROOMS * 2))
gr.rooms[gn.nroom - 1].irregular = TRUE;
if (gn.nroom >= (MAXNROFROOMS * 2))
goto joinm;
} else {
/*
* it's a tiny hole; erase it from the map to avoid
* having the player end up here with no way out.
*/
for (sx = g.min_rx; sx <= g.max_rx; sx++)
for (sy = g.min_ry; sy <= g.max_ry; sy++)
for (sx = gm.min_rx; sx <= gm.max_rx; sx++)
for (sy = gm.min_ry; sy <= gm.max_ry; sy++)
if ((int) levl[sx][sy].roomno
== g.nroom + ROOMOFFSET) {
== gn.nroom + ROOMOFFSET) {
levl[sx][sy].typ = bg_typ;
levl[sx][sy].roomno = NO_ROOM;
}
@@ -302,8 +302,8 @@ join_map(schar bg_typ, schar fg_typ)
* so don't call sort_rooms(), which can screw up the roomno's
* validity in the levl structure.
*/
for (croom = &g.rooms[0], croom2 = croom + 1;
croom2 < &g.rooms[g.nroom]; ) {
for (croom = &gr.rooms[0], croom2 = croom + 1;
croom2 < &gr.rooms[gn.nroom]; ) {
/* pick random starting and end locations for "corridor" */
if (!somexy(croom, &sm) || !somexy(croom2, &em)) {
/* ack! -- the level is going to be busted */
@@ -350,8 +350,8 @@ finish_map(
|| (bg_typ == TREE && levl[i][j].typ == bg_typ)
|| (walled && IS_WALL(levl[i][j].typ)))
levl[i][j].lit = TRUE;
for (i = 0; i < g.nroom; i++)
g.rooms[i].rlit = 1;
for (i = 0; i < gn.nroom; i++)
gr.rooms[i].rlit = 1;
}
/* light lava even if everything's otherwise unlit;
ice might be frozen pool rather than frozen moat */
@@ -383,8 +383,8 @@ remove_rooms(int lx, int ly, int hx, int hy)
int i;
struct mkroom *croom;
for (i = g.nroom - 1; i >= 0; --i) {
croom = &g.rooms[i];
for (i = gn.nroom - 1; i >= 0; --i) {
croom = &gr.rooms[i];
if (croom->hx < lx || croom->lx >= hx || croom->hy < ly
|| croom->ly >= hy)
continue; /* no overlap */
@@ -411,8 +411,8 @@ remove_rooms(int lx, int ly, int hx, int hy)
static void
remove_room(unsigned int roomno)
{
struct mkroom *croom = &g.rooms[roomno];
struct mkroom *maxroom = &g.rooms[--g.nroom];
struct mkroom *croom = &gr.rooms[roomno];
struct mkroom *maxroom = &gr.rooms[--gn.nroom];
int i, j;
unsigned oroomno;
@@ -424,7 +424,7 @@ remove_room(unsigned int roomno)
sizeof(struct mkroom));
/* since maxroom moved, update affected level roomno values */
oroomno = g.nroom + ROOMOFFSET;
oroomno = gn.nroom + ROOMOFFSET;
roomno += ROOMOFFSET;
for (i = croom->lx; i <= croom->hx; ++i)
for (j = croom->ly; j <= croom->hy; ++j) {
@@ -458,7 +458,7 @@ mkmap(lev_init* init_lev)
lit = litstate_rnd(lit);
g.new_locations = (char *) alloc((WIDTH + 1) * HEIGHT);
gn.new_locations = (char *) alloc((WIDTH + 1) * HEIGHT);
init_map(bg_typ);
init_fill(bg_typ, fg_typ);
@@ -480,10 +480,10 @@ mkmap(lev_init* init_lev)
init_lev->icedpools);
/* a walled, joined level is cavernous, not mazelike -dlc */
if (walled && join) {
g.level.flags.is_maze_lev = FALSE;
g.level.flags.is_cavernous_lev = TRUE;
gl.level.flags.is_maze_lev = FALSE;
gl.level.flags.is_cavernous_lev = TRUE;
}
free(g.new_locations);
free(gn.new_locations);
}
/*mkmap.c*/
+151 -151
View File
@@ -178,8 +178,8 @@ wall_cleanup(coordxy x1, coordxy y1, coordxy x2, coordxy y2)
for (x = x1; x <= x2; x++)
for (y = y1; y <= y2; y++) {
if (within_bounded_area(x, y,
g.bughack.inarea.x1, g.bughack.inarea.y1,
g.bughack.inarea.x2, g.bughack.inarea.y2))
gb.bughack.inarea.x1, gb.bughack.inarea.y1,
gb.bughack.inarea.x2, gb.bughack.inarea.y2))
continue;
lev = &levl[x][y];
type = lev->typ;
@@ -228,8 +228,8 @@ fix_wall_spines(coordxy x1, coordxy y1, coordxy x2, coordxy y2)
/* set the locations TRUE if rock or wall or out of bounds */
loc_f = within_bounded_area(x, y, /* for baalz insect */
g.bughack.inarea.x1, g.bughack.inarea.y1,
g.bughack.inarea.x2, g.bughack.inarea.y2)
gb.bughack.inarea.x1, gb.bughack.inarea.y1,
gb.bughack.inarea.x2, gb.bughack.inarea.y2)
? iswall
: iswall_or_stone;
locale[0][0] = (*loc_f)(x - 1, y - 1);
@@ -267,7 +267,7 @@ okay(coordxy x, coordxy y, coordxy dir)
{
mz_move(x, y, dir);
mz_move(x, y, dir);
if (x < 3 || y < 3 || x > g.x_maze_max || y > g.y_maze_max
if (x < 3 || y < 3 || x > gx.x_maze_max || y > gy.y_maze_max
|| levl[x][y].typ != STONE)
return FALSE;
return TRUE;
@@ -277,8 +277,8 @@ okay(coordxy x, coordxy y, coordxy dir)
static void
maze0xy(coord *cc)
{
cc->x = 3 + 2 * rn2((g.x_maze_max >> 1) - 1);
cc->y = 3 + 2 * rn2((g.y_maze_max >> 1) - 1);
cc->x = 3 + 2 * rn2((gx.x_maze_max >> 1) - 1);
cc->y = 3 + 2 * rn2((gy.y_maze_max >> 1) - 1);
return;
}
@@ -296,7 +296,7 @@ bad_location(
return (boolean) (occupied(x, y)
|| within_bounded_area(x, y, nlx, nly, nhx, nhy)
|| !((levl[x][y].typ == CORR
&& g.level.flags.is_maze_lev)
&& gl.level.flags.is_maze_lev)
|| levl[x][y].typ == ROOM
|| levl[x][y].typ == AIR));
}
@@ -319,7 +319,7 @@ place_lregion(
* if there are rooms and this a branch, let place_branch choose
* the branch location (to avoid putting branches in corridors).
*/
if (rtype == LR_BRANCH && g.nroom) {
if (rtype == LR_BRANCH && gn.nroom) {
place_branch(Is_branchlev(&u.uz), 0, 0);
return;
}
@@ -432,28 +432,28 @@ baalz_fixup(void)
for (lastx = x = 0; x < COLNO; ++x)
if ((levl[x][y].wall_info & W_NONDIGGABLE) != 0) {
if (!lastx)
g.bughack.inarea.x1 = x + 1;
gb.bughack.inarea.x1 = x + 1;
lastx = x;
}
g.bughack.inarea.x2 = ((lastx > g.bughack.inarea.x1) ? lastx : x) - 1;
gb.bughack.inarea.x2 = ((lastx > gb.bughack.inarea.x1) ? lastx : x) - 1;
/* find low and high y for to-be-wallified portion of level */
x = g.bughack.inarea.x1;
x = gb.bughack.inarea.x1;
for (lasty = y = 0; y < ROWNO; ++y)
if ((levl[x][y].wall_info & W_NONDIGGABLE) != 0) {
if (!lasty)
g.bughack.inarea.y1 = y + 1;
gb.bughack.inarea.y1 = y + 1;
lasty = y;
}
g.bughack.inarea.y2 = ((lasty > g.bughack.inarea.y1) ? lasty : y) - 1;
gb.bughack.inarea.y2 = ((lasty > gb.bughack.inarea.y1) ? lasty : y) - 1;
/* two pools mark where special post-wallify fix-ups are needed */
for (x = g.bughack.inarea.x1; x <= g.bughack.inarea.x2; ++x)
for (y = g.bughack.inarea.y1; y <= g.bughack.inarea.y2; ++y)
for (x = gb.bughack.inarea.x1; x <= gb.bughack.inarea.x2; ++x)
for (y = gb.bughack.inarea.y1; y <= gb.bughack.inarea.y2; ++y)
if (levl[x][y].typ == POOL) {
levl[x][y].typ = HWALL;
if (g.bughack.delarea.x1 == COLNO)
g.bughack.delarea.x1 = x, g.bughack.delarea.y1 = y;
if (gb.bughack.delarea.x1 == COLNO)
gb.bughack.delarea.x1 = x, gb.bughack.delarea.y1 = y;
else
g.bughack.delarea.x2 = x, g.bughack.delarea.y2 = y;
gb.bughack.delarea.x2 = x, gb.bughack.delarea.y2 = y;
} else if (levl[x][y].typ == IRONBARS) {
/* novelty effect; allowing digging in front of 'eyes' */
if (isok(x - 1, y)
@@ -469,15 +469,15 @@ baalz_fixup(void)
}
}
wallification(max(g.bughack.inarea.x1 - 2, 1),
max(g.bughack.inarea.y1 - 2, 0),
min(g.bughack.inarea.x2 + 2, COLNO - 1),
min(g.bughack.inarea.y2 + 2, ROWNO - 1));
wallification(max(gb.bughack.inarea.x1 - 2, 1),
max(gb.bughack.inarea.y1 - 2, 0),
min(gb.bughack.inarea.x2 + 2, COLNO - 1),
min(gb.bughack.inarea.y2 + 2, ROWNO - 1));
/* bughack hack for rear-most legs on baalz level; first joint on
both top and bottom gets a bogus extra connection to room area,
producing unwanted rectangles; change back to separated legs */
x = g.bughack.delarea.x1, y = g.bughack.delarea.y1;
x = gb.bughack.delarea.x1, y = gb.bughack.delarea.y1;
if (isok(x, y) && (levl[x][y].typ == TLWALL || levl[x][y].typ == TRWALL)
&& isok(x, y + 1) && levl[x][y + 1].typ == TUWALL) {
levl[x][y].typ = (levl[x][y].typ == TLWALL) ? BRCORNER : BLCORNER;
@@ -486,7 +486,7 @@ baalz_fixup(void)
(void) rloc(mtmp, RLOC_ERR|RLOC_NOMSG);
}
x = g.bughack.delarea.x2, y = g.bughack.delarea.y2;
x = gb.bughack.delarea.x2, y = gb.bughack.delarea.y2;
if (isok(x, y) && (levl[x][y].typ == TLWALL || levl[x][y].typ == TRWALL)
&& isok(x, y - 1) && levl[x][y - 1].typ == TDWALL) {
levl[x][y].typ = (levl[x][y].typ == TLWALL) ? TRCORNER : TLCORNER;
@@ -498,29 +498,29 @@ baalz_fixup(void)
/* reset bughack region; set low end to <COLNO,ROWNO> so that
within_bounded_region() in fix_wall_spines() will fail
most quickly--on its first test--when loading other levels */
g.bughack.inarea.x1 = g.bughack.delarea.x1 = COLNO;
g.bughack.inarea.y1 = g.bughack.delarea.y1 = ROWNO;
g.bughack.inarea.x2 = g.bughack.delarea.x2 = 0;
g.bughack.inarea.y2 = g.bughack.delarea.y2 = 0;
gb.bughack.inarea.x1 = gb.bughack.delarea.x1 = COLNO;
gb.bughack.inarea.y1 = gb.bughack.delarea.y1 = ROWNO;
gb.bughack.inarea.x2 = gb.bughack.delarea.x2 = 0;
gb.bughack.inarea.y2 = gb.bughack.delarea.y2 = 0;
}
/* this is special stuff that the level compiler cannot (yet) handle */
void
fixup_special(void)
{
lev_region *r = g.lregions;
lev_region *r = gl.lregions;
struct d_level lev;
int x, y;
struct mkroom *croom;
boolean added_branch = FALSE;
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) {
g.level.flags.hero_memory = 0;
gl.level.flags.hero_memory = 0;
/* water level is an odd beast - it has to be set up
before calling place_lregions etc. */
setup_waterlevel();
}
for (x = 0; x < g.num_lregions; x++, r++) {
for (x = 0; x < gn.num_lregions; x++, r++) {
switch (r->rtype) {
case LR_BRANCH:
added_branch = TRUE;
@@ -551,24 +551,24 @@ fixup_special(void)
case LR_DOWNTELE:
/* save the region outlines for goto_level() */
if (r->rtype == LR_TELE || r->rtype == LR_UPTELE) {
g.updest.lx = r->inarea.x1;
g.updest.ly = r->inarea.y1;
g.updest.hx = r->inarea.x2;
g.updest.hy = r->inarea.y2;
g.updest.nlx = r->delarea.x1;
g.updest.nly = r->delarea.y1;
g.updest.nhx = r->delarea.x2;
g.updest.nhy = r->delarea.y2;
gu.updest.lx = r->inarea.x1;
gu.updest.ly = r->inarea.y1;
gu.updest.hx = r->inarea.x2;
gu.updest.hy = r->inarea.y2;
gu.updest.nlx = r->delarea.x1;
gu.updest.nly = r->delarea.y1;
gu.updest.nhx = r->delarea.x2;
gu.updest.nhy = r->delarea.y2;
}
if (r->rtype == LR_TELE || r->rtype == LR_DOWNTELE) {
g.dndest.lx = r->inarea.x1;
g.dndest.ly = r->inarea.y1;
g.dndest.hx = r->inarea.x2;
g.dndest.hy = r->inarea.y2;
g.dndest.nlx = r->delarea.x1;
g.dndest.nly = r->delarea.y1;
g.dndest.nhx = r->delarea.x2;
g.dndest.nhy = r->delarea.y2;
gd.dndest.lx = r->inarea.x1;
gd.dndest.ly = r->inarea.y1;
gd.dndest.hx = r->inarea.x2;
gd.dndest.hy = r->inarea.y2;
gd.dndest.nlx = r->delarea.x1;
gd.dndest.nly = r->delarea.y1;
gd.dndest.nhx = r->delarea.x2;
gd.dndest.nhy = r->delarea.y2;
}
/* place_lregion gets called from goto_level() */
break;
@@ -588,7 +588,7 @@ fixup_special(void)
struct obj *otmp;
int tryct;
croom = &g.rooms[0]; /* the first room defined on the medusa level */
croom = &gr.rooms[0]; /* the first room defined on the medusa level */
for (tryct = rnd(4); tryct; tryct--) {
x = somex(croom);
y = somey(croom);
@@ -618,26 +618,26 @@ fixup_special(void)
}
} else if (Role_if(PM_CLERIC) && In_quest(&u.uz)) {
/* less chance for undead corpses (lured from lower morgues) */
g.level.flags.graveyard = 1;
gl.level.flags.graveyard = 1;
} else if (Is_stronghold(&u.uz)) {
g.level.flags.graveyard = 1;
gl.level.flags.graveyard = 1;
} else if (on_level(&u.uz, &baalzebub_level)) {
/* custom wallify the "beetle" potion of the level */
baalz_fixup();
} else if (u.uz.dnum == mines_dnum && g.ransacked) {
} else if (u.uz.dnum == mines_dnum && gr.ransacked) {
stolen_booty();
}
if (g.lregions)
free((genericptr_t) g.lregions), g.lregions = 0;
g.num_lregions = 0;
if (gl.lregions)
free((genericptr_t) gl.lregions), gl.lregions = 0;
gn.num_lregions = 0;
}
static void
check_ransacked(const char *s)
{
/* this kludge only works as long as orctown is minetn-1 */
g.ransacked = (u.uz.dnum == mines_dnum && !strcmp(s, "minetn-1"));
gr.ransacked = (u.uz.dnum == mines_dnum && !strcmp(s, "minetn-1"));
}
#define ORC_LEADER 1
@@ -651,7 +651,7 @@ migrate_orc(struct monst *mtmp, unsigned long mflags)
cur_depth = (int) depth(&u.uz);
max_depth = dunlevs_in_dungeon(&u.uz)
+ (g.dungeons[u.uz.dnum].depth_start - 1);
+ (gd.dungeons[u.uz.dnum].depth_start - 1);
if (mflags == ORC_LEADER) {
/* Note that the orc leader will take possession of any
* remaining stuff not already delivered to other
@@ -814,7 +814,7 @@ stolen_booty(void)
migrate_orc(mtmp, 0UL);
}
}
g.ransacked = 0;
gr.ransacked = 0;
}
#undef ORC_LEADER
@@ -823,7 +823,7 @@ static boolean
maze_inbounds(coordxy x, coordxy y)
{
return (x >= 2 && y >= 2
&& x < g.x_maze_max && y < g.y_maze_max
&& x < gx.x_maze_max && y < gy.y_maze_max
/* isok() test is superfluous here (unless something has
clobbered the static *_maze_max variables) */
&& isok(x, y));
@@ -836,8 +836,8 @@ maze_remove_deadends(xint16 typ)
coordxy x, y, dir, idx, idx2, dx, dy, dx2, dy2;
dirok[0] = 0; /* lint suppression */
for (x = 2; x < g.x_maze_max; x++)
for (y = 2; y < g.y_maze_max; y++)
for (x = 2; x < gx.x_maze_max; x++)
for (y = 2; y < gy.y_maze_max; y++)
if (ACCESSIBLE(levl[x][y].typ) && (x % 2) && (y % 2)) {
idx = idx2 = 0;
for (dir = 0; dir < 4; dir++) {
@@ -880,8 +880,8 @@ create_maze(int corrwid, int wallthick, boolean rmdeadends)
{
coordxy x,y;
coord mm;
int tmp_xmax = g.x_maze_max;
int tmp_ymax = g.y_maze_max;
int tmp_xmax = gx.x_maze_max;
int tmp_ymax = gy.y_maze_max;
int rdx = 0;
int rdy = 0;
int scale;
@@ -903,10 +903,10 @@ create_maze(int corrwid, int wallthick, boolean rmdeadends)
corrwid = 5;
scale = corrwid + wallthick;
rdx = (g.x_maze_max / scale);
rdy = (g.y_maze_max / scale);
rdx = (gx.x_maze_max / scale);
rdy = (gy.y_maze_max / scale);
if (g.level.flags.corrmaze)
if (gl.level.flags.corrmaze)
for (x = 2; x < (rdx * 2); x++)
for (y = 2; y < (rdy * 2); y++)
levl[x][y].typ = STONE;
@@ -916,19 +916,19 @@ create_maze(int corrwid, int wallthick, boolean rmdeadends)
levl[x][y].typ = ((x % 2) && (y % 2)) ? STONE : HWALL;
/* set upper bounds for maze0xy and walkfrom */
g.x_maze_max = (rdx * 2);
g.y_maze_max = (rdy * 2);
gx.x_maze_max = (rdx * 2);
gy.y_maze_max = (rdy * 2);
/* create maze */
maze0xy(&mm);
walkfrom((int) mm.x, (int) mm.y, 0);
if (rmdeadends)
maze_remove_deadends((g.level.flags.corrmaze) ? CORR : ROOM);
maze_remove_deadends((gl.level.flags.corrmaze) ? CORR : ROOM);
/* restore bounds */
g.x_maze_max = tmp_xmax;
g.y_maze_max = tmp_ymax;
gx.x_maze_max = tmp_xmax;
gy.y_maze_max = tmp_ymax;
/* scale maze up if needed */
if (scale > 2) {
@@ -936,27 +936,27 @@ create_maze(int corrwid, int wallthick, boolean rmdeadends)
int rx = 1, ry = 1;
/* back up the existing smaller maze */
for (x = 1; x < g.x_maze_max; x++)
for (y = 1; y < g.y_maze_max; y++) {
for (x = 1; x < gx.x_maze_max; x++)
for (y = 1; y < gy.y_maze_max; y++) {
tmpmap[x][y] = levl[x][y].typ;
}
/* do the scaling */
rx = x = 2;
while (rx < g.x_maze_max) {
while (rx < gx.x_maze_max) {
int mx = (x % 2) ? corrwid
: ((x == 2 || x == (rdx * 2)) ? 1
: wallthick);
ry = y = 2;
while (ry < g.y_maze_max) {
while (ry < gy.y_maze_max) {
int dx = 0, dy = 0;
int my = (y % 2) ? corrwid
: ((y == 2 || y == (rdy * 2)) ? 1
: wallthick);
for (dx = 0; dx < mx; dx++)
for (dy = 0; dy < my; dy++) {
if (rx+dx >= g.x_maze_max
|| ry+dy >= g.y_maze_max)
if (rx+dx >= gx.x_maze_max
|| ry+dy >= gy.y_maze_max)
break;
levl[rx + dx][ry + dy].typ = tmpmap[x][y];
}
@@ -985,22 +985,22 @@ makemaz(const char *s)
"%s-%d", s, rnd((int) sp->rndlevs));
else
Strcpy(protofile, s);
} else if (*(g.dungeons[u.uz.dnum].proto)) {
} else if (*(gd.dungeons[u.uz.dnum].proto)) {
if (dunlevs_in_dungeon(&u.uz) > 1) {
if (sp && sp->rndlevs)
Snprintf(protofile, sizeof protofile,
"%s%d-%d", g.dungeons[u.uz.dnum].proto,
"%s%d-%d", gd.dungeons[u.uz.dnum].proto,
dunlev(&u.uz), rnd((int) sp->rndlevs));
else
Snprintf(protofile, sizeof protofile,
"%s%d", g.dungeons[u.uz.dnum].proto,
"%s%d", gd.dungeons[u.uz.dnum].proto,
dunlev(&u.uz));
} else if (sp && sp->rndlevs) {
Snprintf(protofile, sizeof protofile,
"%s-%d", g.dungeons[u.uz.dnum].proto,
"%s-%d", gd.dungeons[u.uz.dnum].proto,
rnd((int) sp->rndlevs));
} else
Strcpy(protofile, g.dungeons[u.uz.dnum].proto);
Strcpy(protofile, gd.dungeons[u.uz.dnum].proto);
} else
Strcpy(protofile, "");
@@ -1031,7 +1031,7 @@ makemaz(const char *s)
if (*protofile) {
check_ransacked(protofile);
Strcat(protofile, LEV_EXT);
g.in_mk_themerooms = FALSE;
gi.in_mk_themerooms = FALSE;
if (load_special(protofile)) {
/* some levels can end up with monsters
on dead mon list, including light source monsters */
@@ -1041,8 +1041,8 @@ makemaz(const char *s)
impossible("Couldn't load \"%s\" - making a maze.", protofile);
}
g.level.flags.is_maze_lev = TRUE;
g.level.flags.corrmaze = !rn2(3);
gl.level.flags.is_maze_lev = TRUE;
gl.level.flags.corrmaze = !rn2(3);
if (!Invocation_lev(&u.uz) && rn2(2)) {
create_maze(-1, -1, !rn2(5));
@@ -1050,8 +1050,8 @@ makemaz(const char *s)
create_maze(1, 1, FALSE);
}
if (!g.level.flags.corrmaze)
wallification(2, 2, g.x_maze_max, g.y_maze_max);
if (!gl.level.flags.corrmaze)
wallification(2, 2, gx.x_maze_max, gy.y_maze_max);
mazexy(&mm);
mkstairs(mm.x, mm.y, 1, (struct mkroom *) 0, FALSE); /* up */
@@ -1076,15 +1076,15 @@ makemaz(const char *s)
#define INVPOS_X_MARGIN (6 - 2)
#define INVPOS_Y_MARGIN (5 - 2)
#define INVPOS_DISTANCE 11
int x_range = g.x_maze_max - x_maze_min - 2 * INVPOS_X_MARGIN - 1,
y_range = g.y_maze_max - y_maze_min - 2 * INVPOS_Y_MARGIN - 1;
int x_range = gx.x_maze_max - x_maze_min - 2 * INVPOS_X_MARGIN - 1,
y_range = gy.y_maze_max - y_maze_min - 2 * INVPOS_Y_MARGIN - 1;
if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN
|| (x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE)) {
debugpline2("g.inv_pos: maze is too small! (%d x %d)",
g.x_maze_max, g.y_maze_max);
debugpline2("gi.inv_pos: maze is too small! (%d x %d)",
gx.x_maze_max, gy.y_maze_max);
}
g.inv_pos.x = g.inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
gi.inv_pos.x = gi.inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do {
x = rn1(x_range, x_maze_min + INVPOS_X_MARGIN + 1);
y = rn1(y_range, y_maze_min + INVPOS_Y_MARGIN + 1);
@@ -1097,9 +1097,9 @@ makemaz(const char *s)
|| abs(x - stway->sx) == abs(y - stway->sy)
|| distmin(x, y, stway->sx, stway->sy) <= INVPOS_DISTANCE
|| !SPACE_POS(levl[x][y].typ) || occupied(x, y)));
g.inv_pos.x = x;
g.inv_pos.y = y;
maketrap(g.inv_pos.x, g.inv_pos.y, VIBRATING_SQUARE);
gi.inv_pos.x = x;
gi.inv_pos.y = y;
maketrap(gi.inv_pos.x, gi.inv_pos.y, VIBRATING_SQUARE);
#undef INVPOS_X_MARGIN
#undef INVPOS_Y_MARGIN
#undef INVPOS_DISTANCE
@@ -1149,7 +1149,7 @@ walkfrom(coordxy x, coordxy y, schar typ)
int dirs[4];
if (!typ) {
if (g.level.flags.corrmaze)
if (gl.level.flags.corrmaze)
typ = CORR;
else
typ = ROOM;
@@ -1194,7 +1194,7 @@ walkfrom(coordxy x, coordxy y, schar typ)
int dirs[4];
if (!typ) {
if (g.level.flags.corrmaze)
if (gl.level.flags.corrmaze)
typ = CORR;
else
typ = ROOM;
@@ -1228,7 +1228,7 @@ void
mazexy(coord *cc)
{
coordxy x, y;
int allowedtyp = (g.level.flags.corrmaze ? CORR : ROOM);
int allowedtyp = (gl.level.flags.corrmaze ? CORR : ROOM);
int cpt = 0;
do {
@@ -1239,8 +1239,8 @@ mazexy(coord *cc)
obscure way to get rnd(N); probably ought to be using 2+rn2(N-1)
to exclude the maze's outer boundary walls; trying and rejecting
those walls will waste some of the 100 random attempts... */
x = rnd(g.x_maze_max);
y = rnd(g.y_maze_max);
x = rnd(gx.x_maze_max);
y = rnd(gy.y_maze_max);
if (levl[x][y].typ == allowedtyp) {
cc->x = (coordxy) x;
cc->y = (coordxy) y;
@@ -1248,8 +1248,8 @@ mazexy(coord *cc)
}
} while (++cpt < 100);
/* 100 random attempts failed; systematically try every possibility */
for (x = 1; x <= g.x_maze_max; x++)
for (y = 1; y <= g.y_maze_max; y++)
for (x = 1; x <= gx.x_maze_max; x++)
for (y = 1; y <= gy.y_maze_max; y++)
if (levl[x][y].typ == allowedtyp) {
cc->x = (coordxy) x;
cc->y = (coordxy) y;
@@ -1282,7 +1282,7 @@ get_level_extends(coordxy *left, coordxy *top, coordxy *right, coordxy *bottom)
}
}
}
xmin -= (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
xmin -= (nonwall || !gl.level.flags.is_maze_lev) ? 2 : 1;
if (xmin < 0)
xmin = 0;
@@ -1298,7 +1298,7 @@ get_level_extends(coordxy *left, coordxy *top, coordxy *right, coordxy *bottom)
}
}
}
xmax += (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
xmax += (nonwall || !gl.level.flags.is_maze_lev) ? 2 : 1;
if (xmax >= COLNO)
xmax = COLNO - 1;
@@ -1314,7 +1314,7 @@ get_level_extends(coordxy *left, coordxy *top, coordxy *right, coordxy *bottom)
}
}
}
ymin -= (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
ymin -= (nonwall || !gl.level.flags.is_maze_lev) ? 2 : 1;
found = nonwall = FALSE;
for (ymax = ROWNO - 1; !found && ymax >= 0; ymax--) {
@@ -1328,7 +1328,7 @@ get_level_extends(coordxy *left, coordxy *top, coordxy *right, coordxy *bottom)
}
}
}
ymax += (nonwall || !g.level.flags.is_maze_lev) ? 2 : 1;
ymax += (nonwall || !gl.level.flags.is_maze_lev) ? 2 : 1;
*left = xmin;
*right = xmax;
@@ -1375,7 +1375,7 @@ mkportal(coordxy x, coordxy y, xint16 todnum, xint16 todlevel)
return;
}
debugpline4("mkportal: at <%d,%d>, to %s, level %d", x, y,
g.dungeons[todnum].dname, todlevel);
gd.dungeons[todnum].dname, todlevel);
ttmp->dst.dnum = todnum;
ttmp->dst.dlevel = todlevel;
return;
@@ -1412,10 +1412,10 @@ fumaroles(void)
*/
/* bubble movement boundaries */
#define gbxmin (g.xmin + 1)
#define gbymin (g.ymin + 1)
#define gbxmax (g.xmax - 1)
#define gbymax (g.ymax - 1)
#define gbxmin (gx.xmin + 1)
#define gbymin (gy.ymin + 1)
#define gbxmax (gx.xmax - 1)
#define gbymax (gy.ymax - 1)
static void set_wportal(void);
static void mk_bubble(coordxy, coordxy, int);
@@ -1436,7 +1436,7 @@ movebubbles(void)
int i, j, bcpin = 0;
/* set up the portal the first time bubbles are moved */
if (!g.wportal)
if (!gw.wportal)
set_wportal();
vision_recalc(2);
@@ -1450,7 +1450,7 @@ movebubbles(void)
* Pick up everything inside of a bubble then fill all bubble
* locations.
*/
for (b = up ? g.bbubbles : g.ebubbles; b; b = up ? b->next : b->prev) {
for (b = up ? gb.bbubbles : ge.ebubbles; b; b = up ? b->next : b->prev) {
if (b->cons)
panic("movebubbles: cons != null");
for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++)
@@ -1465,7 +1465,7 @@ movebubbles(void)
if (OBJ_AT(x, y)) {
struct obj *olist = (struct obj *) 0, *otmp;
while ((otmp = g.level.objects[x][y]) != 0) {
while ((otmp = gl.level.objects[x][y]) != 0) {
remove_object(otmp);
otmp->ox = otmp->oy = 0;
otmp->nexthere = olist;
@@ -1552,7 +1552,7 @@ movebubbles(void)
* would eventually end up in the last bubble in the chain.
*/
up = !up;
for (b = up ? g.bbubbles : g.ebubbles; b; b = up ? b->next : b->prev) {
for (b = up ? gb.bbubbles : ge.ebubbles; b; b = up ? b->next : b->prev) {
int rx = rn2(3), ry = rn2(3);
mv_bubble(b, b->dx + 1 - (!b->dx ? rx : (rx ? 1 : 0)),
@@ -1562,7 +1562,7 @@ movebubbles(void)
/* put attached ball&chain back */
if (Is_waterlevel(&u.uz) && Punished)
lift_covet_and_placebc(bcpin);
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
}
/* when moving in water, possibly (1 in 3) alter the intended destination */
@@ -1605,21 +1605,21 @@ save_waterlevel(NHFILE* nhfp)
{
struct bubble *b;
if (!g.bbubbles)
if (!gb.bbubbles)
return;
if (perform_bwrite(nhfp)) {
int n = 0;
for (b = g.bbubbles; b; b = b->next)
for (b = gb.bbubbles; b; b = b->next)
++n;
if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) &n, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &g.xmin, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &g.ymin, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &g.xmax, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &g.ymax, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &gx.xmin, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &gy.ymin, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &gx.xmax, sizeof(int));
bwrite(nhfp->fd, (genericptr_t) &gy.ymax, sizeof(int));
}
for (b = g.bbubbles; b; b = b->next) {
for (b = gb.bbubbles; b; b = b->next) {
if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) b, sizeof(struct bubble));
}
@@ -1637,40 +1637,40 @@ restore_waterlevel(NHFILE* nhfp)
set_wportal();
if (nhfp->structlevel) {
mread(nhfp->fd,(genericptr_t)&n,sizeof(int));
mread(nhfp->fd,(genericptr_t)&g.xmin,sizeof(int));
mread(nhfp->fd,(genericptr_t)&g.ymin,sizeof(int));
mread(nhfp->fd,(genericptr_t)&g.xmax,sizeof(int));
mread(nhfp->fd,(genericptr_t)&g.ymax,sizeof(int));
mread(nhfp->fd,(genericptr_t)&gx.xmin,sizeof(int));
mread(nhfp->fd,(genericptr_t)&gy.ymin,sizeof(int));
mread(nhfp->fd,(genericptr_t)&gx.xmax,sizeof(int));
mread(nhfp->fd,(genericptr_t)&gy.ymax,sizeof(int));
}
for (i = 0; i < n; i++) {
btmp = b;
b = (struct bubble *) alloc(sizeof(struct bubble));
if (nhfp->structlevel)
mread(nhfp->fd,(genericptr_t) b, sizeof(struct bubble));
if (g.bbubbles) {
if (gb.bbubbles) {
btmp->next = b;
b->prev = btmp;
} else {
g.bbubbles = b;
gb.bbubbles = b;
b->prev = (struct bubble *) 0;
}
mv_bubble(b, 0, 0, TRUE);
}
g.ebubbles = b;
ge.ebubbles = b;
if (b) {
b->next = (struct bubble *) 0;
} else {
/* avoid "saving and reloading may fix this" */
g.program_state.something_worth_saving = 0;
gp.program_state.something_worth_saving = 0;
/* during restore, information about what level this is might not
be available so we're wishy-washy about what we describe */
impossible("No %s to restore?",
(Is_waterlevel(&u.uz) || Is_waterlevel(&g.uz_save))
(Is_waterlevel(&u.uz) || Is_waterlevel(&gu.uz_save))
? "air bubbles"
: (Is_airlevel(&u.uz) || Is_airlevel(&g.uz_save))
: (Is_airlevel(&u.uz) || Is_airlevel(&gu.uz_save))
? "clouds"
: "air bubbles or clouds");
g.program_state.something_worth_saving = 1;
gp.program_state.something_worth_saving = 1;
}
}
@@ -1678,8 +1678,8 @@ static void
set_wportal(void)
{
/* there better be only one magic portal on water level... */
for (g.wportal = g.ftrap; g.wportal; g.wportal = g.wportal->ntrap)
if (g.wportal->ttyp == MAGIC_PORTAL)
for (gw.wportal = gf.ftrap; gw.wportal; gw.wportal = gw.wportal->ntrap)
if (gw.wportal->ttyp == MAGIC_PORTAL)
return;
impossible("set_wportal(): no portal!");
}
@@ -1695,15 +1695,15 @@ setup_waterlevel(void)
(int) u.uz.dnum, (int) u.uz.dlevel);
/* ouch, hardcoded... (file scope statics and used in bxmin,bymax,&c) */
g.xmin = 3;
g.ymin = 1;
gx.xmin = 3;
gy.ymin = 1;
/* use separate statements so that compiler won't complain about min()
comparing two constants; the alternative is to do this in the
preprocessor: #if (20 > ROWNO-1) g.ymax=ROWNO-1 #else g.ymax=20 #endif */
g.xmax = 78;
g.xmax = min(g.xmax, (COLNO - 1) - 1);
g.ymax = 20;
g.ymax = min(g.ymax, (ROWNO - 1));
preprocessor: #if (20 > ROWNO-1) gy.ymax=ROWNO-1 #else gy.ymax=20 #endif */
gx.xmax = 78;
gx.xmax = min(gx.xmax, (COLNO - 1) - 1);
gy.ymax = 20;
gy.ymax = min(gy.ymax, (ROWNO - 1));
/* entire level is remembered as one glyph and any unspecified portion
should default to level's base element rather than to usual stone */
@@ -1738,11 +1738,11 @@ unsetup_waterlevel(void)
struct bubble *b, *bb;
/* free bubbles */
for (b = g.bbubbles; b; b = bb) {
for (b = gb.bbubbles; b; b = bb) {
bb = b->next;
free((genericptr_t) b);
}
g.bbubbles = g.ebubbles = (struct bubble *) 0;
gb.bbubbles = ge.ebubbles = (struct bubble *) 0;
}
static void
@@ -1788,15 +1788,15 @@ mk_bubble(coordxy x, coordxy y, int n)
(void) memcpy((genericptr_t) b->bm, (genericptr_t) bmask[n],
(bmask[n][1] + 2) * sizeof (b->bm[0]));
b->cons = 0;
if (!g.bbubbles)
g.bbubbles = b;
if (g.ebubbles) {
g.ebubbles->next = b;
b->prev = g.ebubbles;
if (!gb.bbubbles)
gb.bbubbles = b;
if (ge.ebubbles) {
ge.ebubbles->next = b;
b->prev = ge.ebubbles;
} else
b->prev = (struct bubble *) 0;
b->next = (struct bubble *) 0;
g.ebubbles = b;
ge.ebubbles = b;
mv_bubble(b, 0, 0, TRUE);
}
+82 -82
View File
@@ -223,18 +223,18 @@ mkobj(int oclass, boolean artif)
}
if (oclass == SPBOOK_no_NOVEL) {
i = rnd_class(g.bases[SPBOOK_CLASS], SPE_BLANK_PAPER);
i = rnd_class(gb.bases[SPBOOK_CLASS], SPE_BLANK_PAPER);
oclass = SPBOOK_CLASS; /* for sanity check below */
} else {
prob = rnd(g.oclass_prob_totals[oclass]);
i = g.bases[oclass];
prob = rnd(go.oclass_prob_totals[oclass]);
i = gb.bases[oclass];
while ((prob -= objects[i].oc_prob) > 0)
++i;
}
if (objects[i].oc_class != oclass || !OBJ_NAME(objects[i])) {
impossible("probtype error, oclass=%d i=%d", (int) oclass, i);
i = g.bases[oclass];
i = gb.bases[oclass];
}
return mksobj(i, TRUE, artif);
@@ -261,7 +261,7 @@ mkbox_cnts(struct obj *box)
case SACK:
case OILSKIN_SACK:
/* initial inventory: sack starts out empty */
if (g.moves <= 1 && !g.in_mklev) {
if (gm.moves <= 1 && !gi.in_mklev) {
n = 0;
break;
}
@@ -411,8 +411,8 @@ splitobj(struct obj *obj, long num)
otmp->lua_ref_cnt = 0;
otmp->pickup_prev = 0;
g.context.objsplit.parent_oid = obj->o_id;
g.context.objsplit.child_oid = otmp->o_id;
gc.context.objsplit.parent_oid = obj->o_id;
gc.context.objsplit.child_oid = otmp->o_id;
obj->nobj = otmp;
/* Only set nexthere when on the floor; nexthere is also used
as a back pointer to the container object when contained.
@@ -442,7 +442,7 @@ splitobj(struct obj *obj, long num)
unsigned
next_ident(void)
{
unsigned res = g.context.ident;
unsigned res = gc.context.ident;
/* +rnd(2): originally just +1; changed to rnd() to avoid potential
exploit of player using #adjust to split an object stack in a manner
@@ -452,14 +452,14 @@ next_ident(void)
next object to be created was knowable and player could make a wish
under controlled circumstances for an item that is affected by the
low bits of its obj->o_id [particularly helm of opposite alignment] */
g.context.ident += rnd(2); /* ready for next new object or monster */
gc.context.ident += rnd(2); /* ready for next new object or monster */
/* if ident has wrapped to 0, force it to be non-zero; if/when it
ever wraps past 0 (unlikely, but possible on a configuration which
uses 16-bit 'int'), just live with that and hope no o_id conflicts
between objects or m_id conflicts between monsters arise */
if (!g.context.ident)
g.context.ident = rnd(2);
if (!gc.context.ident)
gc.context.ident = rnd(2);
return res;
}
@@ -470,7 +470,7 @@ static unsigned
nextoid(struct obj *oldobj, struct obj *newobj)
{
int olddif, newdif, trylimit = 256; /* limit of 4 suffices at present */
unsigned oid = g.context.ident - 1; /* loop increment will reverse -1 */
unsigned oid = gc.context.ident - 1; /* loop increment will reverse -1 */
olddif = oid_price_adjustment(oldobj, oldobj->o_id);
do {
@@ -479,7 +479,7 @@ nextoid(struct obj *oldobj, struct obj *newobj)
++oid;
newdif = oid_price_adjustment(newobj, oid);
} while (newdif != olddif && --trylimit >= 0);
g.context.ident = oid; /* update 'last ident used' */
gc.context.ident = oid; /* update 'last ident used' */
(void) next_ident(); /* increment context.ident for next use */
return oid; /* caller will use this ident */
}
@@ -509,7 +509,7 @@ unsplitobj(struct obj *obj)
default:
return (struct obj *) 0;
case OBJ_INVENT:
list = g.invent;
list = gi.invent;
break;
case OBJ_MINVENT:
list = obj->ocarry->minvent;
@@ -520,17 +520,17 @@ unsplitobj(struct obj *obj)
}
/* first try the expected case; obj is split from another stack */
if (obj->o_id == g.context.objsplit.child_oid) {
if (obj->o_id == gc.context.objsplit.child_oid) {
/* parent probably precedes child and will require list traversal */
ochild = obj;
target_oid = g.context.objsplit.parent_oid;
target_oid = gc.context.objsplit.parent_oid;
if (obj->nobj && obj->nobj->o_id == target_oid)
oparent = obj->nobj;
} else if (obj->o_id == g.context.objsplit.parent_oid) {
} else if (obj->o_id == gc.context.objsplit.parent_oid) {
/* alternate scenario: another stack was split from obj;
child probably follows parent and will be found here */
oparent = obj;
target_oid = g.context.objsplit.child_oid;
target_oid = gc.context.objsplit.child_oid;
if (obj->nobj && obj->nobj->o_id == target_oid)
ochild = obj->nobj;
}
@@ -559,7 +559,7 @@ unsplitobj(struct obj *obj)
void
clear_splitobjs(void)
{
g.context.objsplit.parent_oid = g.context.objsplit.child_oid = 0;
gc.context.objsplit.parent_oid = gc.context.objsplit.child_oid = 0;
}
/*
@@ -582,7 +582,7 @@ replace_object(struct obj *obj, struct obj *otmp)
case OBJ_INVENT:
otmp->nobj = obj->nobj;
obj->nobj = otmp;
extract_nobj(obj, &g.invent);
extract_nobj(obj, &gi.invent);
break;
case OBJ_CONTAINED:
otmp->nobj = obj->nobj;
@@ -604,7 +604,7 @@ replace_object(struct obj *obj, struct obj *otmp)
obj->nobj = otmp;
obj->nexthere = otmp;
extract_nobj(obj, &fobj);
extract_nexthere(obj, &g.level.objects[obj->ox][obj->oy]);
extract_nexthere(obj, &gl.level.objects[obj->ox][obj->oy]);
break;
default:
panic("replace_object: obj position");
@@ -799,7 +799,7 @@ mksobj(int otyp, boolean init, boolean artif)
otmp = newobj();
*otmp = cg.zeroobj;
otmp->age = g.moves;
otmp->age = gm.moves;
otmp->o_id = next_ident();
otmp->quan = 1L;
otmp->oclass = let;
@@ -836,11 +836,11 @@ mksobj(int otyp, boolean init, boolean artif)
tryct = 50;
do
otmp->corpsenm = undead_to_corpse(rndmonnum());
while ((g.mvitals[otmp->corpsenm].mvflags & G_NOCORPSE)
while ((gm.mvitals[otmp->corpsenm].mvflags & G_NOCORPSE)
&& (--tryct > 0));
if (tryct == 0) {
/* perhaps rndmonnum() only wants to make G_NOCORPSE
monsters on this g.level; create an adventurer's
monsters on this gl.level; create an adventurer's
corpse instead, then */
otmp->corpsenm = PM_HUMAN;
}
@@ -866,7 +866,7 @@ mksobj(int otyp, boolean init, boolean artif)
for (tryct = 200; tryct > 0; --tryct) {
mndx = undead_to_corpse(rndmonnum());
if (mons[mndx].cnutrit
&& !(g.mvitals[mndx].mvflags & G_NOCORPSE)) {
&& !(gm.mvitals[mndx].mvflags & G_NOCORPSE)) {
otmp->corpsenm = mndx;
set_tin_variety(otmp, RANDOM_TIN);
break;
@@ -875,7 +875,7 @@ mksobj(int otyp, boolean init, boolean artif)
blessorcurse(otmp, 10);
break;
case SLIME_MOLD:
otmp->spe = g.context.current_fruit;
otmp->spe = gc.context.current_fruit;
flags.made_fruit = TRUE;
break;
case KELP_FROND:
@@ -993,7 +993,7 @@ mksobj(int otyp, boolean init, boolean artif)
break;
case AMULET_CLASS:
if (otmp->otyp == AMULET_OF_YENDOR)
g.context.made_amulet = TRUE;
gc.context.made_amulet = TRUE;
if (rn2(10) && (otmp->otyp == AMULET_OF_STRANGULATION
|| otmp->otyp == AMULET_OF_CHANGE
|| otmp->otyp == AMULET_OF_RESTFUL_SLEEP)) {
@@ -1033,7 +1033,7 @@ mksobj(int otyp, boolean init, boolean artif)
otmp = mk_artifact(otmp, (aligntyp) A_NONE);
/* simulate lacquered armor for samurai */
if (Role_if(PM_SAMURAI) && otmp->otyp == SPLINT_MAIL
&& (g.moves <= 1 || In_quest(&u.uz))) {
&& (gm.moves <= 1 || In_quest(&u.uz))) {
#ifdef UNIXPC
/* optimizer bitfield bug */
otmp->oerodeproof = 1;
@@ -1104,8 +1104,8 @@ mksobj(int otyp, boolean init, boolean artif)
case CORPSE:
if (otmp->corpsenm == NON_PM) {
otmp->corpsenm = undead_to_corpse(rndmonnum());
if (g.mvitals[otmp->corpsenm].mvflags & (G_NOCORPSE | G_GONE))
otmp->corpsenm = g.urole.mnum;
if (gm.mvitals[otmp->corpsenm].mvflags & (G_NOCORPSE | G_GONE))
otmp->corpsenm = gu.urole.mnum;
}
/*FALLTHRU*/
case STATUE:
@@ -1263,8 +1263,8 @@ start_corpse_timeout(struct obj *body)
return;
action = ROT_CORPSE; /* default action: rot away */
rot_adjust = g.in_mklev ? 25 : 10; /* give some variation */
age = g.moves - body->age;
rot_adjust = gi.in_mklev ? 25 : 10; /* give some variation */
age = gm.moves - body->age;
if (age > ROT_AGE)
when = rot_adjust;
else
@@ -1281,7 +1281,7 @@ start_corpse_timeout(struct obj *body)
when = age;
break;
}
} else if (g.zombify && zombie_form(&mons[body->corpsenm]) != NON_PM
} else if (gz.zombify && zombie_form(&mons[body->corpsenm]) != NON_PM
&& !body->norevive) {
action = ZOMBIFY_MON;
when = rn1(15, 5); /* 5..19 */
@@ -1383,9 +1383,9 @@ shrink_glob(
/*
* If shrinkage occurred while we were on another level, catch up now.
*/
if (expire_time < g.moves && globloc != BURIED_UNDER_ICE) {
if (expire_time < gm.moves && globloc != BURIED_UNDER_ICE) {
/* number of units of weight to remove */
long delta = (g.moves - expire_time + 24L) / 25L,
long delta = (gm.moves - expire_time + 24L) / 25L,
/* leftover amount to use for new timer */
moddelta = 25L - (delta % 25L);
@@ -1424,7 +1424,7 @@ shrink_glob(
*/
if (eating_glob(obj)
|| globloc == BURIED_UNDER_ICE
|| (globloc == SET_ON_ICE && (g.moves % 3L) == 1L)) {
|| (globloc == SET_ON_ICE && (gm.moves % 3L) == 1L)) {
/* schedule next shrink attempt; for the being eaten case, the
glob and its timer might be deleted before this kicks in */
start_glob_timeout(obj, 0L);
@@ -1487,7 +1487,7 @@ shrink_glob(
change because only a fraction of glob's weight is counted;
however, always say the bag is lighter for the 'gone' case */
if (gone || (shrink && topcontnr->owt != old_top_owt)
|| near_capacity() != g.oldcap)
|| near_capacity() != go.oldcap)
pline("%s %s%s lighter.", Yname2(topcontnr),
/* containers also always have quantity 1 */
(topcontnr->owt != old_top_owt) ? "becomes" : "seems",
@@ -1726,7 +1726,7 @@ set_bknown(
{
if (obj->bknown != onoff) {
obj->bknown = onoff;
if (obj->where == OBJ_INVENT && g.moves > 1L)
if (obj->where == OBJ_INVENT && gm.moves > 1L)
update_inventory();
}
}
@@ -1887,7 +1887,7 @@ mkcorpstat(
}
/* record gender and 'historic statue' in overloaded enchantment field */
otmp->spe = (corpstatflags & CORPSTAT_SPE_VAL);
otmp->norevive = g.mkcorpstat_norevive; /* via envrmt rather than flags */
otmp->norevive = gm.mkcorpstat_norevive; /* via envrmt rather than flags */
/* when 'mtmp' is non-null save the monster's details with the
corpse or statue; it will also force the 'ptr' override below */
@@ -1910,7 +1910,7 @@ mkcorpstat(
otmp->corpsenm = monsndx(ptr);
otmp->owt = weight(otmp);
if (otmp->otyp == CORPSE && (g.zombify || special_corpse(old_corpsenm)
if (otmp->otyp == CORPSE && (gz.zombify || special_corpse(old_corpsenm)
|| special_corpse(otmp->corpsenm))) {
obj_stop_timers(otmp);
start_corpse_timeout(otmp);
@@ -2119,7 +2119,7 @@ place_object(struct obj *otmp, coordxy x, coordxy y)
panic("place_object: obj \"%s\" [%d] not free",
safe_typename(otmp->otyp), otmp->where);
otmp2 = g.level.objects[x][y];
otmp2 = gl.level.objects[x][y];
obj_no_longer_held(otmp);
if (otmp->otyp == BOULDER) {
@@ -2142,7 +2142,7 @@ place_object(struct obj *otmp, coordxy x, coordxy y)
} else {
/* put on top of current pile */
otmp->nexthere = otmp2;
g.level.objects[x][y] = otmp;
gl.level.objects[x][y] = otmp;
}
/* set the new object's location */
@@ -2167,12 +2167,12 @@ obj_ice_effects(coordxy x, coordxy y, boolean do_buried)
{
struct obj *otmp;
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere) {
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere) {
if (otmp->timed)
obj_timer_checks(otmp, x, y, 0);
}
if (do_buried) {
for (otmp = g.level.buriedobjlist; otmp; otmp = otmp->nobj) {
for (otmp = gl.level.buriedobjlist; otmp; otmp = otmp->nobj) {
if (otmp->ox == x && otmp->oy == y) {
if (otmp->timed)
obj_timer_checks(otmp, x, y, 0);
@@ -2195,12 +2195,12 @@ peek_at_iced_corpse_age(struct obj *otmp)
if (otmp->otyp == CORPSE && otmp->on_ice) {
/* Adjust the age; must be same as obj_timer_checks() for off ice*/
age = g.moves - otmp->age;
age = gm.moves - otmp->age;
retval += age * (ROT_ICE_ADJUSTMENT - 1) / ROT_ICE_ADJUSTMENT;
debugpline3(
"The %s age has ice modifications: otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)), otmp->age, retval);
debugpline1("Effective age of corpse: %ld.", g.moves - retval);
debugpline1("Effective age of corpse: %ld.", gm.moves - retval);
}
return retval;
}
@@ -2239,8 +2239,8 @@ obj_timer_checks(
later calculations behave as if it had been on ice during
that time (longwinded way of saying this is the inverse
of removing it from the ice and of peeking at its age). */
age = g.moves - otmp->age;
otmp->age = g.moves - (age * ROT_ICE_ADJUSTMENT);
age = gm.moves - otmp->age;
otmp->age = gm.moves - (age * ROT_ICE_ADJUSTMENT);
}
/* Check for corpses coming off ice */
@@ -2261,7 +2261,7 @@ obj_timer_checks(
tleft /= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE;
/* Adjust the age */
age = g.moves - otmp->age;
age = gm.moves - otmp->age;
otmp->age += age * (ROT_ICE_ADJUSTMENT - 1) / ROT_ICE_ADJUSTMENT;
}
}
@@ -2281,7 +2281,7 @@ remove_object(struct obj *otmp)
if (otmp->where != OBJ_FLOOR)
panic("remove_object: obj not on floor");
extract_nexthere(otmp, &g.level.objects[x][y]);
extract_nexthere(otmp, &gl.level.objects[x][y]);
extract_nobj(otmp, &fobj);
/* update vision iff this was the only boulder at its spot */
if (otmp->otyp == BOULDER && !sobj_at(BOULDER, x, y))
@@ -2318,7 +2318,7 @@ discard_minvent(struct monst *mtmp, boolean uncreate_artifacts)
* OBJ_MINVENT monster's invent chain
* OBJ_MIGRATING migrating chain
* OBJ_BURIED level.buriedobjs chain
* OBJ_ONBILL on g.billobjs chain
* OBJ_ONBILL on gb.billobjs chain
* OBJ_LUAFREE obj is dealloc'd from core, but still used by lua
*/
void
@@ -2344,13 +2344,13 @@ obj_extract_self(struct obj *obj)
obj->ocarry = (struct monst *) 0; /* clear stale back-link */
break;
case OBJ_MIGRATING:
extract_nobj(obj, &g.migrating_objs);
extract_nobj(obj, &gm.migrating_objs);
break;
case OBJ_BURIED:
extract_nobj(obj, &g.level.buriedobjlist);
extract_nobj(obj, &gl.level.buriedobjlist);
break;
case OBJ_ONBILL:
extract_nobj(obj, &g.billobjs);
extract_nobj(obj, &gb.billobjs);
break;
default:
panic("obj_extract_self");
@@ -2468,10 +2468,10 @@ add_to_migration(struct obj *obj)
maybe_reset_pick(obj);
obj->where = OBJ_MIGRATING;
obj->nobj = g.migrating_objs;
obj->nobj = gm.migrating_objs;
obj->omigr_from_dnum = u.uz.dnum;
obj->omigr_from_dlevel = u.uz.dlevel;
g.migrating_objs = obj;
gm.migrating_objs = obj;
}
void
@@ -2481,8 +2481,8 @@ add_to_buried(struct obj *obj)
panic("add_to_buried: obj not free");
obj->where = OBJ_BURIED;
obj->nobj = g.level.buriedobjlist;
g.level.buriedobjlist = obj;
obj->nobj = gl.level.buriedobjlist;
gl.level.buriedobjlist = obj;
}
/* Recalculate the weight of this container and all of _its_ containers. */
@@ -2529,10 +2529,10 @@ dealloc_obj(struct obj *obj)
obj->lamplit = 0;
}
if (obj == g.thrownobj)
g.thrownobj = 0;
if (obj == g.kickedobj)
g.kickedobj = 0;
if (obj == gt.thrownobj)
gt.thrownobj = 0;
if (obj == gk.kickedobj)
gk.kickedobj = 0;
if (obj->oextra)
dealloc_oextra(obj);
@@ -2658,7 +2658,7 @@ obj_sanity_check(void)
for (y = 0; y < ROWNO; y++) {
char at_fmt[BUFSZ];
otop = g.level.objects[x][y];
otop = gl.level.objects[x][y];
prevo = 0;
for (obj = otop; obj; prevo = obj, obj = prevo->nexthere) {
/* <ox,oy> should match <x,y>; <0,*> should always be empty */
@@ -2690,32 +2690,32 @@ obj_sanity_check(void)
}
}
objlist_sanity(g.invent, OBJ_INVENT, "invent sanity");
objlist_sanity(g.migrating_objs, OBJ_MIGRATING, "migrating sanity");
objlist_sanity(g.level.buriedobjlist, OBJ_BURIED, "buried sanity");
objlist_sanity(g.billobjs, OBJ_ONBILL, "bill sanity");
objlist_sanity(gi.invent, OBJ_INVENT, "invent sanity");
objlist_sanity(gm.migrating_objs, OBJ_MIGRATING, "migrating sanity");
objlist_sanity(gl.level.buriedobjlist, OBJ_BURIED, "buried sanity");
objlist_sanity(gb.billobjs, OBJ_ONBILL, "bill sanity");
mon_obj_sanity(fmon, "minvent sanity");
mon_obj_sanity(g.migrating_mons, "migrating minvent sanity");
mon_obj_sanity(gm.migrating_mons, "migrating minvent sanity");
/* monsters temporarily in transit;
they should have arrived with hero by the time we get called */
if (g.mydogs) {
impossible("g.mydogs sanity [not empty]");
mon_obj_sanity(g.mydogs, "mydogs minvent sanity");
if (gm.mydogs) {
impossible("gm.mydogs sanity [not empty]");
mon_obj_sanity(gm.mydogs, "mydogs minvent sanity");
}
/* objects temporarily freed from invent/floor lists;
they should have arrived somewhere by the time we get called */
if (g.thrownobj)
insane_object(g.thrownobj, ofmt3, "g.thrownobj sanity",
if (gt.thrownobj)
insane_object(gt.thrownobj, ofmt3, "gt.thrownobj sanity",
(struct monst *) 0);
if (g.kickedobj)
insane_object(g.kickedobj, ofmt3, "g.kickedobj sanity",
if (gk.kickedobj)
insane_object(gk.kickedobj, ofmt3, "gk.kickedobj sanity",
(struct monst *) 0);
/* g.current_wand isn't removed from invent while in use, but should
/* gc.current_wand isn't removed from invent while in use, but should
be Null between moves when we're called */
if (g.current_wand)
insane_object(g.current_wand, ofmt3, "g.current_wand sanity",
if (gc.current_wand)
insane_object(gc.current_wand, ofmt3, "gc.current_wand sanity",
(struct monst *) 0);
}
@@ -2981,7 +2981,7 @@ init_dummyobj(struct obj *obj, short otyp, long oquan)
obj->next_boulder = 0; /* overloads corpsenm, avoid NON_PM */
/* but suppressing fruit details leads to "bad fruit #0" */
if (obj->otyp == SLIME_MOLD)
obj->spe = g.context.current_fruit;
obj->spe = gc.context.current_fruit;
}
return obj;
}
@@ -3340,11 +3340,11 @@ obj_absorb(struct obj **obj1, struct obj **obj2)
o2wt = otmp2->oeaten ? otmp2->oeaten : otmp2->owt;
/* averaging the relative ages is less likely to overflow
than averaging the absolute ages directly */
agetmp = (((g.moves - otmp1->age) * o1wt
+ (g.moves - otmp2->age) * o2wt)
agetmp = (((gm.moves - otmp1->age) * o1wt
+ (gm.moves - otmp2->age) * o2wt)
/ (o1wt + o2wt));
/* convert relative age back to absolute age */
otmp1->age = g.moves - agetmp;
otmp1->age = gm.moves - agetmp;
otmp1->owt += o2wt;
if (otmp1->oeaten || otmp2->oeaten)
otmp1->oeaten = o1wt + o2wt;
+52 -52
View File
@@ -150,14 +150,14 @@ mkshop(void)
}
gottype:
for (sroom = &g.rooms[0];; sroom++) {
for (sroom = &gr.rooms[0];; sroom++) {
/* return from this loop: cannot find any eligible room to be a shop
* continue: sroom is ineligible
* break: sroom is eligible
*/
if (sroom->hx < 0)
return;
if (sroom - g.rooms >= g.nroom) {
if (sroom - gr.rooms >= gn.nroom) {
impossible("rooms[] not closed by -1?");
return;
}
@@ -215,11 +215,11 @@ static struct mkroom *
pick_room(boolean strict)
{
register struct mkroom *sroom;
register int i = g.nroom;
register int i = gn.nroom;
for (sroom = &g.rooms[rn2(g.nroom)]; i--; sroom++) {
if (sroom == &g.rooms[g.nroom])
sroom = &g.rooms[0];
for (sroom = &gr.rooms[rn2(gn.nroom)]; i--; sroom++) {
if (sroom == &gr.rooms[gn.nroom])
sroom = &gr.rooms[0];
if (sroom->hx < 0)
return (struct mkroom *) 0;
if (sroom->rtype != OROOM)
@@ -274,7 +274,7 @@ fill_zoo(struct mkroom* sroom)
register int sx, sy, i;
int sh, goldlim = 0, type = sroom->rtype;
coordxy tx = 0, ty = 0;
int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET);
int rmno = (int) ((sroom - gr.rooms) + ROOMOFFSET);
coord mm;
/* Note: This doesn't check needfill; it assumes the caller has already
@@ -282,7 +282,7 @@ fill_zoo(struct mkroom* sroom)
sh = sroom->fdoor;
switch (type) {
case COURT:
if (g.level.flags.is_maze_lev) {
if (gl.level.flags.is_maze_lev) {
for (tx = sroom->lx; tx <= sroom->hx; tx++)
for (ty = sroom->ly; ty <= sroom->hy; ty++)
if (IS_THRONE(levl[tx][ty].typ))
@@ -320,15 +320,15 @@ fill_zoo(struct mkroom* sroom)
if (sroom->irregular) {
if ((int) levl[sx][sy].roomno != rmno || levl[sx][sy].edge
|| (sroom->doorct
&& distmin(sx, sy, g.doors[sh].x, g.doors[sh].y) <= 1))
&& distmin(sx, sy, gd.doors[sh].x, gd.doors[sh].y) <= 1))
continue;
} else if (!SPACE_POS(levl[sx][sy].typ)
|| (sroom->doorct
&& ((sx == sroom->lx && g.doors[sh].x == sx - 1)
|| (sx == sroom->hx && g.doors[sh].x == sx + 1)
|| (sy == sroom->ly && g.doors[sh].y == sy - 1)
&& ((sx == sroom->lx && gd.doors[sh].x == sx - 1)
|| (sx == sroom->hx && gd.doors[sh].x == sx + 1)
|| (sy == sroom->ly && gd.doors[sh].y == sy - 1)
|| (sy == sroom->hy
&& g.doors[sh].y == sy + 1))))
&& gd.doors[sh].y == sy + 1))))
continue;
/* don't place monster on explicitly placed throne */
if (type == COURT && IS_THRONE(levl[sx][sy].typ))
@@ -362,7 +362,7 @@ fill_zoo(struct mkroom* sroom)
case ZOO:
case LEPREHALL:
if (sroom->doorct) {
int distval = dist2(sx, sy, g.doors[sh].x, g.doors[sh].y);
int distval = dist2(sx, sy, gd.doors[sh].x, gd.doors[sh].y);
i = sq(distval);
} else
i = goldlim;
@@ -421,23 +421,23 @@ fill_zoo(struct mkroom* sroom)
add_to_container(chest, gold);
chest->owt = weight(chest);
chest->spe = 2; /* so it can be found later */
g.level.flags.has_court = 1;
gl.level.flags.has_court = 1;
break;
}
case BARRACKS:
g.level.flags.has_barracks = 1;
gl.level.flags.has_barracks = 1;
break;
case ZOO:
g.level.flags.has_zoo = 1;
gl.level.flags.has_zoo = 1;
break;
case MORGUE:
g.level.flags.has_morgue = 1;
gl.level.flags.has_morgue = 1;
break;
case SWAMP:
g.level.flags.has_swamp = 1;
gl.level.flags.has_swamp = 1;
break;
case BEEHIVE:
g.level.flags.has_beehive = 1;
gl.level.flags.has_beehive = 1;
break;
}
}
@@ -462,7 +462,7 @@ mkundead(
|| !revive(otmp, FALSE)))
(void) makemon(mdat, cc.x, cc.y, mm_flags);
}
g.level.flags.graveyard = TRUE; /* reduced chance for undead corpse */
gl.level.flags.graveyard = TRUE; /* reduced chance for undead corpse */
}
static struct permonst *
@@ -511,9 +511,9 @@ antholemon(void)
break;
}
/* try again if chosen type has been genocided or used up */
} while (++trycnt < 3 && (g.mvitals[mtyp].mvflags & G_GONE));
} while (++trycnt < 3 && (gm.mvitals[mtyp].mvflags & G_GONE));
return ((g.mvitals[mtyp].mvflags & G_GONE) ? (struct permonst *) 0
return ((gm.mvitals[mtyp].mvflags & G_GONE) ? (struct permonst *) 0
: &mons[mtyp]);
}
@@ -526,12 +526,12 @@ mkswamp(void) /* Michiel Huisjes & Fred de Wilde */
int rmno;
for (i = 0; i < 5; i++) { /* turn up to 5 rooms swampy */
sroom = &g.rooms[rn2(g.nroom)];
sroom = &gr.rooms[rn2(gn.nroom)];
if (sroom->hx < 0 || sroom->rtype != OROOM || has_upstairs(sroom)
|| has_dnstairs(sroom))
continue;
rmno = (int)(sroom - g.rooms) + ROOMOFFSET;
rmno = (int)(sroom - gr.rooms) + ROOMOFFSET;
/* satisfied; make a swamp */
sroom->rtype = SWAMP;
@@ -559,7 +559,7 @@ mkswamp(void) /* Michiel Huisjes & Fred de Wilde */
NO_MM_FLAGS);
}
}
g.level.flags.has_swamp = 1;
gl.level.flags.has_swamp = 1;
}
}
@@ -568,7 +568,7 @@ shrine_pos(int roomno)
{
static coord buf;
int delta;
struct mkroom *troom = &g.rooms[roomno - ROOMOFFSET];
struct mkroom *troom = &gr.rooms[roomno - ROOMOFFSET];
/* if width and height are odd, placement will be the exact center;
if either or both are even, center point is a hypothetical spot
@@ -600,13 +600,13 @@ mktemple(void)
* In temples, shrines are blessed altars
* located in the center of the room
*/
shrine_spot = shrine_pos((int) ((sroom - g.rooms) + ROOMOFFSET));
shrine_spot = shrine_pos((int) ((sroom - gr.rooms) + ROOMOFFSET));
lev = &levl[shrine_spot->x][shrine_spot->y];
lev->typ = ALTAR;
lev->altarmask = induced_align(80);
priestini(&u.uz, sroom, shrine_spot->x, shrine_spot->y, FALSE);
lev->altarmask |= AM_SHRINE;
g.level.flags.has_temple = 1;
gl.level.flags.has_temple = 1;
}
boolean
@@ -629,7 +629,7 @@ nexttodoor(int sx, int sy)
boolean
has_dnstairs(struct mkroom* sroom)
{
stairway *stway = g.stairs;
stairway *stway = gs.stairs;
while (stway) {
if (!stway->up && inside_room(sroom, stway->sx, stway->sy))
@@ -642,7 +642,7 @@ has_dnstairs(struct mkroom* sroom)
boolean
has_upstairs(struct mkroom* sroom)
{
stairway *stway = g.stairs;
stairway *stway = gs.stairs;
while (stway) {
if (stway->up && inside_room(sroom, stway->sx, stway->sy))
@@ -668,7 +668,7 @@ boolean
inside_room(struct mkroom* croom, coordxy x, coordxy y)
{
if (croom->irregular) {
int i = (int) ((croom - g.rooms) + ROOMOFFSET);
int i = (int) ((croom - gr.rooms) + ROOMOFFSET);
return (!levl[x][y].edge && (int) levl[x][y].roomno == i);
}
@@ -687,7 +687,7 @@ somexy(struct mkroom* croom,coord * c)
int i;
if (croom->irregular) {
i = (int) ((croom - g.rooms) + ROOMOFFSET);
i = (int) ((croom - gr.rooms) + ROOMOFFSET);
while (try_cnt++ < 100) {
c->x = somex(croom);
@@ -756,12 +756,12 @@ search_special(schar type)
{
register struct mkroom *croom;
for (croom = &g.rooms[0]; croom->hx >= 0; croom++)
for (croom = &gr.rooms[0]; croom->hx >= 0; croom++)
if ((type == ANY_TYPE && croom->rtype != OROOM)
|| (type == ANY_SHOP && croom->rtype >= SHOPBASE)
|| croom->rtype == type)
return croom;
for (croom = &g.subrooms[0]; croom->hx >= 0; croom++)
for (croom = &gs.subrooms[0]; croom->hx >= 0; croom++)
if ((type == ANY_TYPE && croom->rtype != OROOM)
|| (type == ANY_SHOP && croom->rtype >= SHOPBASE)
|| croom->rtype == type)
@@ -820,7 +820,7 @@ squadmon(void)
}
mndx = squadprob[rn2(SIZE(squadprob))].pm;
gotone:
if (!(g.mvitals[mndx].mvflags & G_GONE))
if (!(gm.mvitals[mndx].mvflags & G_GONE))
return &mons[mndx];
else
return (struct permonst *) 0;
@@ -838,7 +838,7 @@ save_room(NHFILE* nhfp, struct mkroom* r)
/*
* Well, I really should write only useful information instead
* of writing the whole structure. That is I should not write
* the g.subrooms pointers, but who cares ?
* the gs.subrooms pointers, but who cares ?
*/
if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) r, sizeof (struct mkroom));
@@ -857,9 +857,9 @@ save_rooms(NHFILE* nhfp)
/* First, write the number of rooms */
if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) &g.nroom, sizeof(g.nroom));
for (i = 0; i < g.nroom; i++)
save_room(nhfp, &g.rooms[i]);
bwrite(nhfp->fd, (genericptr_t) &gn.nroom, sizeof(gn.nroom));
for (i = 0; i < gn.nroom; i++)
save_room(nhfp, &gr.rooms[i]);
}
static void
@@ -871,9 +871,9 @@ rest_room(NHFILE* nhfp, struct mkroom* r)
mread(nhfp->fd, (genericptr_t) r, sizeof(struct mkroom));
for (i = 0; i < r->nsubrooms; i++) {
r->sbrooms[i] = &g.subrooms[g.nsubroom];
rest_room(nhfp, &g.subrooms[g.nsubroom]);
g.subrooms[g.nsubroom++].resident = (struct monst *) 0;
r->sbrooms[i] = &gs.subrooms[gn.nsubroom];
rest_room(nhfp, &gs.subrooms[gn.nsubroom]);
gs.subrooms[gn.nsubroom++].resident = (struct monst *) 0;
}
}
@@ -887,15 +887,15 @@ rest_rooms(NHFILE* nhfp)
short i;
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) &g.nroom, sizeof(g.nroom));
mread(nhfp->fd, (genericptr_t) &gn.nroom, sizeof(gn.nroom));
g.nsubroom = 0;
for (i = 0; i < g.nroom; i++) {
rest_room(nhfp, &g.rooms[i]);
g.rooms[i].resident = (struct monst *) 0;
gn.nsubroom = 0;
for (i = 0; i < gn.nroom; i++) {
rest_room(nhfp, &gr.rooms[i]);
gr.rooms[i].resident = (struct monst *) 0;
}
g.rooms[g.nroom].hx = -1; /* restore ending flags */
g.subrooms[g.nsubroom].hx = -1;
gr.rooms[gn.nroom].hx = -1; /* restore ending flags */
gs.subrooms[gn.nsubroom].hx = -1;
}
/* convert a display symbol for terrain into topology type;
@@ -1039,8 +1039,8 @@ static boolean
invalid_shop_shape(struct mkroom *sroom)
{
coordxy x, y;
coordxy doorx = g.doors[sroom->fdoor].x;
coordxy doory = g.doors[sroom->fdoor].y;
coordxy doorx = gd.doors[sroom->fdoor].x;
coordxy doory = gd.doors[sroom->fdoor].y;
coordxy insidex = 0, insidey = 0, insidect = 0;
/* First, identify squares inside the room and next to the door. */
+118 -118
View File
@@ -32,7 +32,7 @@ static void pacify_guard(struct monst *);
#define LEVEL_SPECIFIC_NOCORPSE(mdat) \
(Is_rogue_level(&u.uz) \
|| (g.level.flags.graveyard && is_undead(mdat) && rn2(3)))
|| (gl.level.flags.graveyard && is_undead(mdat) && rn2(3)))
/* A specific combination of x_monnam flags for livelogging. The livelog
* shouldn't show that you killed a hallucinatory monster and not what it
@@ -99,7 +99,7 @@ sanity_check_single_mon(
#endif
return;
}
if (chk_geno && (g.mvitals[mndx].mvflags & G_GENOD) != 0)
if (chk_geno && (gm.mvitals[mndx].mvflags & G_GENOD) != 0)
impossible("genocided %s in play (%s)",
pmname(&mons[mndx], Mgender(mtmp)), msg);
if (mtmp->mtame && !mtmp->mpeaceful)
@@ -218,7 +218,7 @@ mon_sanity_check(void)
if (x != u.ux || y != u.uy)
impossible("steed (%s) claims to be at <%d,%d>?",
fmt_ptr((genericptr_t) mtmp), x, y);
} else if (g.level.monsters[x][y] != mtmp) {
} else if (gl.level.monsters[x][y] != mtmp) {
impossible("mon (%s) at <%d,%d> is not there!",
fmt_ptr((genericptr_t) mtmp), x, y);
} else if (mtmp->wormno) {
@@ -228,7 +228,7 @@ mon_sanity_check(void)
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
if ((mtmp = g.level.monsters[x][y]) != 0) {
if ((mtmp = gl.level.monsters[x][y]) != 0) {
for (m = fmon; m; m = m->nmon)
if (m == mtmp)
break;
@@ -245,7 +245,7 @@ mon_sanity_check(void)
mtmp->mx, mtmp->my, x, y);
}
for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon) {
for (mtmp = gm.migrating_mons; mtmp; mtmp = mtmp->nmon) {
sanity_check_single_mon(mtmp, FALSE, "migr");
}
@@ -259,7 +259,7 @@ int
m_poisongas_ok(struct monst* mtmp)
{
int px, py;
boolean is_you = (mtmp == &g.youmonst);
boolean is_you = (mtmp == &gy.youmonst);
/* Non living, non breathing, immune monsters are not concerned */
if (nonliving(mtmp->data) || is_vampshifter(mtmp)
@@ -480,7 +480,7 @@ pm_to_cham(int mndx)
|| is_reviver((mon)->data) \
/* normally quest leader will be unique, */ \
/* but he or she might have been polymorphed */ \
|| (mon)->m_id == g.quest_status.leader_m_id \
|| (mon)->m_id == gq.quest_status.leader_m_id \
/* special cancellation handling for these */ \
|| (dmgtype((mon)->data, AD_SEDU) || dmgtype((mon)->data, AD_SSEX)))
@@ -653,7 +653,7 @@ make_corpse(struct monst *mtmp, unsigned int corpseflags)
return obj;
default:
default_1:
if (g.mvitals[mndx].mvflags & G_NOCORPSE) {
if (gm.mvitals[mndx].mvflags & G_NOCORPSE) {
return (struct obj *) 0;
} else {
corpstatflags |= CORPSTAT_INIT;
@@ -677,7 +677,7 @@ make_corpse(struct monst *mtmp, unsigned int corpseflags)
/* if polymorph or undead turning has killed this monster,
prevent the same attack beam from hitting its corpse */
if (g.context.bypasses)
if (gc.context.bypasses)
bypass_obj(obj);
if (has_mgivenname(mtmp))
@@ -795,7 +795,7 @@ minliquid_core(struct monst* mtmp)
hero to create lava beneath a monster, so the !mon_moving
case is not expected to happen (and we haven't made a
player-against-monster variation of the message above) */
if (g.context.mon_moving)
if (gc.context.mon_moving)
mondead(mtmp); /* no corpse */
else
xkilled(mtmp, XKILL_NOMSG);
@@ -830,7 +830,7 @@ minliquid_core(struct monst* mtmp)
return 0;
}
if (cansee(mtmp->mx, mtmp->my)) {
if (g.context.mon_moving)
if (gc.context.mon_moving)
pline("%s drowns.", Monnam(mtmp));
else
/* hero used fire to melt ice that monster was on */
@@ -842,7 +842,7 @@ minliquid_core(struct monst* mtmp)
pline("%s sinks as %s rushes in and flushes you out.",
Monnam(mtmp), hliquid("water"));
}
if (g.context.mon_moving)
if (gc.context.mon_moving)
mondied(mtmp); /* ok to leave corpse despite water */
else
xkilled(mtmp, XKILL_NOMSG);
@@ -885,7 +885,7 @@ mcalcmove(
else if (mon->mspeed == MFAST)
mmove = (4 * mmove + 2) / 3;
if (mon == u.usteed && u.ugallop && g.context.mv) {
if (mon == u.usteed && u.ugallop && gc.context.mv) {
/* increase movement by a factor of 1.5; also increase variance of
movement speed (if it's naturally 24, we don't want it to always
become 36) */
@@ -923,7 +923,7 @@ m_calcdistress(struct monst *mtmp)
to end up in water or lava; note: when not in liquid they regen,
shape-shift, timeout temporary maladies just like other monsters */
if (mtmp->data->mmove == 0) {
if (g.vision_full_recalc)
if (gv.vision_full_recalc)
vision_recalc(0);
if (minliquid(mtmp))
return;
@@ -959,10 +959,10 @@ movemon_singlemon(struct monst *mtmp)
if (u.utotype
#ifdef SAFERHANGUP
/* or if the program has lost contact with the user */
|| g.program_state.done_hup
|| gp.program_state.done_hup
#endif
) {
g.somebody_can_move = FALSE;
gs.somebody_can_move = FALSE;
return TRUE;
}
@@ -974,9 +974,9 @@ movemon_singlemon(struct monst *mtmp)
mon->isgd flag so that dmonsfree() will get rid of mon) */
if (mtmp->isgd && !mtmp->mx && !(mtmp->mstate & MON_MIGRATING)) {
/* parked at <0,0>; eventually isgd should get set to false */
if (g.moves > mtmp->mlstmv) {
if (gm.moves > mtmp->mlstmv) {
(void) gd_move(mtmp);
mtmp->mlstmv = g.moves;
mtmp->mlstmv = gm.moves;
}
return FALSE;
}
@@ -993,13 +993,13 @@ movemon_singlemon(struct monst *mtmp)
mtmp->movement -= NORMAL_SPEED;
if (mtmp->movement >= NORMAL_SPEED)
g.somebody_can_move = TRUE;
gs.somebody_can_move = TRUE;
if (g.vision_full_recalc)
if (gv.vision_full_recalc)
vision_recalc(0); /* vision! */
/* reset obj bypasses before next monster moves */
if (g.context.bypasses)
if (gc.context.bypasses)
clear_bypasses();
clear_splitobjs();
if (minliquid(mtmp))
@@ -1065,14 +1065,14 @@ movemon_singlemon(struct monst *mtmp)
int
movemon(void)
{
g.somebody_can_move = FALSE;
gs.somebody_can_move = FALSE;
iter_mons_safe(movemon_singlemon);
if (any_light_source())
g.vision_full_recalc = 1; /* in case a mon moved with a light source */
gv.vision_full_recalc = 1; /* in case a mon moved with a light source */
/* reset obj bypasses after last monster has moved */
if (g.context.bypasses)
if (gc.context.bypasses)
clear_bypasses();
clear_splitobjs();
/* remove dead monsters; dead vault guard will be left at <0,0>
@@ -1083,10 +1083,10 @@ movemon(void)
if (u.utotype) {
deferred_goto();
/* changed levels, so these monsters are dormant */
g.somebody_can_move = FALSE;
gs.somebody_can_move = FALSE;
}
return g.somebody_can_move;
return gs.somebody_can_move;
}
/* dispose of contents of an eaten container; used for pets and other mons */
@@ -1145,7 +1145,7 @@ meatmetal(struct monst *mtmp)
return 0;
/* Eats topmost metal object if it is there */
for (otmp = g.level.objects[mtmp->mx][mtmp->my]; otmp;
for (otmp = gl.level.objects[mtmp->mx][mtmp->my]; otmp;
otmp = otmp->nexthere) {
/* Don't eat indigestible/choking/inappropriate objects */
if ((mtmp->data == &mons[PM_RUST_MONSTER] && !is_rustprone(otmp))
@@ -1261,7 +1261,7 @@ meatobj(struct monst* mtmp) /* for gelatinous cubes */
/* eat organic objects, including cloth and wood, if present;
engulf others, except huge rocks and metal attached to player
[despite comment at top, doesn't assume that eater is a g-cube] */
for (otmp = g.level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) {
for (otmp = gl.level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere;
/* avoid special items; once hero picks them up, they'll cease
@@ -1603,7 +1603,7 @@ mpickstuff(struct monst *mtmp, const char *str)
if (mtmp->isshk && inhishop(mtmp))
return FALSE;
for (otmp = g.level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) {
for (otmp = gl.level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere;
/* avoid special items; once hero picks them up, they'll cease
@@ -2025,7 +2025,7 @@ mfndpos(
}
/* Note: ALLOW_SANCT only prevents movement, not
attack, into a temple. */
if (g.level.flags.has_temple && *in_rooms(nx, ny, TEMPLE)
if (gl.level.flags.has_temple && *in_rooms(nx, ny, TEMPLE)
&& !*in_rooms(x, y, TEMPLE)
&& in_your_sanctuary((struct monst *) 0, nx, ny)) {
if (!(flag & ALLOW_SANCT))
@@ -2219,8 +2219,8 @@ replmon(struct monst *mtmp, struct monst *mtmp2)
}
mtmp->minvent = 0;
/* before relmon(mtmp), because it could clear polearm.hitmon */
if (g.context.polearm.hitmon == mtmp)
g.context.polearm.hitmon = mtmp2;
if (gc.context.polearm.hitmon == mtmp)
gc.context.polearm.hitmon = mtmp2;
/* remove the old monster from the map and from `fmon' list */
relmon(mtmp, (struct monst **) 0);
@@ -2255,7 +2255,7 @@ replmon(struct monst *mtmp, struct monst *mtmp2)
void
relmon(
struct monst *mon,
struct monst **monst_list) /* &g.migrating_mons or &g.mydogs or null */
struct monst **monst_list) /* &gm.migrating_mons or &gm.mydogs or null */
{
if (!fmon)
panic("relmon: no fmon available.");
@@ -2279,7 +2279,7 @@ relmon(
}
if (monst_list) {
/* insert into g.mydogs or g.migrating_mons */
/* insert into gm.mydogs or gm.migrating_mons */
mon->nmon = *monst_list;
*monst_list = mon;
} else {
@@ -2375,14 +2375,14 @@ static void
mon_leaving_level(struct monst *mon)
{
coordxy mx = mon->mx, my = mon->my;
boolean onmap = (isok(mx, my) && g.level.monsters[mx][my] == mon);
boolean onmap = (isok(mx, my) && gl.level.monsters[mx][my] == mon);
/* to prevent an infinite relobj-flooreffects-hmon-killed loop */
mon->mtrapped = 0;
unstuck(mon); /* mon is not swallowing or holding you nor held by you */
/* vault guard might be at <0,0> */
if (onmap || mon == g.level.monsters[0][0]) {
if (onmap || mon == gl.level.monsters[0][0]) {
if (mon->wormno)
remove_worm(mon);
else
@@ -2404,8 +2404,8 @@ mon_leaving_level(struct monst *mon)
newsym(mx, my);
}
/* if mon is a remembered target, forget it since it isn't here anymore */
if (mon == g.context.polearm.hitmon)
g.context.polearm.hitmon = (struct monst *) 0;
if (mon == gc.context.polearm.hitmon)
gc.context.polearm.hitmon = (struct monst *) 0;
}
/* 'mtmp' is going away; remove effects of mtmp from other data structures */
@@ -2445,7 +2445,7 @@ m_detach(
}
if (mtmp->data->msound == MS_LEADER)
leaddead();
if (mtmp->m_id == g.stealmid)
if (mtmp->m_id == gs.stealmid)
thiefdead();
/* release (drop onto map) all objects carried by mtmp; assumes that
mtmp->mx,my contains the appropriate location */
@@ -2529,7 +2529,7 @@ lifesaved_monster(struct monst* mtmp)
/* equip replacement amulet, if any, on next move */
check_gear_next_turn(mtmp);
surviver = !(g.mvitals[monsndx(mtmp->data)].mvflags & G_GENOD);
surviver = !(gm.mvitals[monsndx(mtmp->data)].mvflags & G_GENOD);
mtmp->mcanmove = 1;
mtmp->mfrozen = 0;
if (mtmp->mtame && !mtmp->isminion) {
@@ -2570,14 +2570,14 @@ mondead(struct monst *mtmp)
/* this only happens if shapeshifted */
mndx = mtmp->cham;
if (mndx >= LOW_PM && mndx != monsndx(mtmp->data)
&& !(g.mvitals[mndx].mvflags & G_GENOD)) {
&& !(gm.mvitals[mndx].mvflags & G_GENOD)) {
coord new_xy;
char buf[BUFSZ];
/* alternate message phrasing for some monster types */
boolean spec_mon = (nonliving(mtmp->data)
|| noncorporeal(mtmp->data)
|| amorphous(mtmp->data)),
spec_death = (g.disintegested /* disintegrated/digested */
spec_death = (gd.disintegested /* disintegrated/digested */
|| noncorporeal(mtmp->data)
|| amorphous(mtmp->data));
coordxy x = mtmp->mx, y = mtmp->my;
@@ -2620,7 +2620,7 @@ mondead(struct monst *mtmp)
x_monnam(mtmp, ARTICLE_A, (char *) 0,
(SUPPRESS_NAME | SUPPRESS_IT
| SUPPRESS_INVISIBLE), FALSE));
g.vamp_rise_msg = TRUE;
gv.vamp_rise_msg = TRUE;
}
newsym(x, y);
return;
@@ -2653,7 +2653,7 @@ mondead(struct monst *mtmp)
set_mon_data(mtmp, &mons[PM_HUMAN_WERERAT]);
/*
* g.mvitals[].died does double duty as total number of dead monsters
* gm.mvitals[].died does double duty as total number of dead monsters
* and as experience factor for the player killing more monsters.
* this means that a dragon dying by other means reduces the
* experience the player gets for killing a dragon directly; this
@@ -2663,16 +2663,16 @@ mondead(struct monst *mtmp)
* for rings of conflict and such.
*/
mndx = monsndx(mtmp->data);
if (g.mvitals[mndx].died < 255)
g.mvitals[mndx].died++;
if (gm.mvitals[mndx].died < 255)
gm.mvitals[mndx].died++;
/* if it's a (possibly polymorphed) quest leader, mark him as dead */
if (mtmp->m_id == g.quest_status.leader_m_id)
g.quest_status.leader_is_dead = TRUE;
if (mtmp->m_id == gq.quest_status.leader_m_id)
gq.quest_status.leader_is_dead = TRUE;
#ifdef MAIL_STRUCTURES
/* if the mail daemon dies, no more mail delivery. -3. */
if (mndx == PM_MAIL_DAEMON)
g.mvitals[mndx].mvflags |= G_GENOD;
gm.mvitals[mndx].mvflags |= G_GENOD;
#endif
if (mtmp->data->mlet == S_KOP) {
@@ -2700,7 +2700,7 @@ mondead(struct monst *mtmp)
nemdead();
#endif
if (mndx == PM_MEDUSA && g.mvitals[mndx].died == 1) {
if (mndx == PM_MEDUSA && gm.mvitals[mndx].died == 1) {
record_achievement(ACH_MEDU); /* also generates a livelog event */
} else if (unique_corpstat(mtmp->data)) {
/*
@@ -2711,7 +2711,7 @@ mondead(struct monst *mtmp)
* unique within each game but unfortunately for this potential
* usage their kill count is lumped together in a group total.
*/
int howmany = g.mvitals[mndx].died;
int howmany = gm.mvitals[mndx].died;
/* killing a unique more than once doesn't get logged every time;
the Wizard and the Riders can be killed more than once
@@ -2772,11 +2772,11 @@ corpse_chance(
else
tmp = 0;
if (was_swallowed && magr) {
if (magr == &g.youmonst) {
if (magr == &gy.youmonst) {
There("is an explosion in your %s!", body_part(STOMACH));
Sprintf(g.killer.name, "%s explosion",
Sprintf(gk.killer.name, "%s explosion",
s_suffix(pmname(mdat, Mgender(mon))));
losehp(Maybe_Half_Phys(tmp), g.killer.name, KILLED_BY_AN);
losehp(Maybe_Half_Phys(tmp), gk.killer.name, KILLED_BY_AN);
} else {
You_hear("an explosion.");
magr->mhp -= tmp;
@@ -2960,9 +2960,9 @@ monkilled(
rot completely are described as "falling to pieces" so they do
leave a corpse (which means staves for wood golem, leather armor for
leather golem, iron chains for iron golem, not a regular corpse) */
g.disintegested = (how == AD_DGST || how == -AD_RBRE
gd.disintegested = (how == AD_DGST || how == -AD_RBRE
|| (how == AD_FIRE && completelyburns(mptr)));
if (g.disintegested)
if (gd.disintegested)
mondead(mdef); /* never leaves a corpse */
else
mondied(mdef); /* calls mondead() and maybe leaves a corpse */
@@ -2991,7 +2991,7 @@ set_ustuck(struct monst *mtmp)
mon_nam(mtmp), mdistu(mtmp));
}
g.context.botl = 1;
gc.context.botl = 1;
u.ustuck = mtmp;
if (!u.ustuck) {
u.uswallow = 0;
@@ -3015,7 +3015,7 @@ unstuck(struct monst *mtmp)
u.uy = mtmp->my;
if (Punished && uchain->where != OBJ_FLOOR)
placebc();
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
docrt();
}
@@ -3088,37 +3088,37 @@ xkilled(
if (mtmp->mtame && !mtmp->isminion)
EDOG(mtmp)->killed_by_u = 1;
if (wasinside && g.thrownobj && g.thrownobj != uball
if (wasinside && gt.thrownobj && gt.thrownobj != uball
/* don't give to mon if missile is going to be destroyed */
&& g.thrownobj->oclass != POTION_CLASS
&& gt.thrownobj->oclass != POTION_CLASS
/* don't give to mon if missile is going to return to hero */
&& g.thrownobj != (struct obj *) iflags.returning_missile) {
&& gt.thrownobj != (struct obj *) iflags.returning_missile) {
/* thrown object has killed hero's engulfer; add it to mon's
inventory now so that it will be placed with mon's other
stuff prior to lookhere/autopickup when hero is expelled
below (as a side-effect, this missile has immunity from
being consumed [for this shot/throw only]) */
mpickobj(mtmp, g.thrownobj);
mpickobj(mtmp, gt.thrownobj);
/* let throwing code know that missile has been disposed of */
g.thrownobj = 0;
gt.thrownobj = 0;
}
g.vamp_rise_msg = FALSE; /* might get set in mondead(); checked below */
g.disintegested = nocorpse; /* alternate vamp_rise mesg needed if true */
gv.vamp_rise_msg = FALSE; /* might get set in mondead(); checked below */
gd.disintegested = nocorpse; /* alternate vamp_rise mesg needed if true */
/* dispose of monster and make cadaver */
if (g.stoned)
if (gs.stoned)
monstone(mtmp);
else
mondead(mtmp);
g.disintegested = FALSE; /* reset */
gd.disintegested = FALSE; /* reset */
if (!DEADMONSTER(mtmp)) { /* monster lifesaved */
/* Cannot put the non-visible lifesaving message in
* lifesaved_monster() since the message appears only when _you_
* kill it (as opposed to visible lifesaving which always appears).
*/
g.stoned = FALSE;
if (!cansee(x, y) && !g.vamp_rise_msg)
gs.stoned = FALSE;
if (!cansee(x, y) && !gv.vamp_rise_msg)
pline("Maybe not...");
return;
}
@@ -3129,8 +3129,8 @@ xkilled(
mdat = mtmp->data; /* note: mondead can change mtmp->data */
mndx = monsndx(mdat);
if (g.stoned) {
g.stoned = FALSE;
if (gs.stoned) {
gs.stoned = FALSE;
goto cleanup;
}
@@ -3147,7 +3147,7 @@ xkilled(
int otyp;
/* illogical but traditional "treasure drop" */
if (!rn2(6) && !(g.mvitals[mndx].mvflags & G_NOCORPSE)
if (!rn2(6) && !(gm.mvitals[mndx].mvflags & G_NOCORPSE)
/* no extra item from swallower or steed */
&& (x != u.ux || y != u.uy)
/* no extra item from kops--too easy to abuse */
@@ -3171,12 +3171,12 @@ xkilled(
}
/* corpse--none if hero was inside the monster */
if (!wasinside && corpse_chance(mtmp, (struct monst *) 0, FALSE)) {
g.zombify = (!g.thrownobj && !g.stoned && !uwep
&& zombie_maker(&g.youmonst)
gz.zombify = (!gt.thrownobj && !gs.stoned && !uwep
&& zombie_maker(&gy.youmonst)
&& zombie_form(mtmp->data) != NON_PM);
cadaver = make_corpse(mtmp, burycorpse ? CORPSTAT_BURIED
: CORPSTAT_NONE);
g.zombify = FALSE; /* reset */
gz.zombify = FALSE; /* reset */
if (burycorpse && cadaver && cansee(x, y) && !mtmp->minvis
&& cadaver->where == OBJ_BURIED && !nomsg) {
pline("%s corpse ends up buried.", s_suffix(Monnam(mtmp)));
@@ -3208,19 +3208,19 @@ xkilled(
}
/* give experience points */
tmp = experience(mtmp, (int) g.mvitals[mndx].died);
tmp = experience(mtmp, (int) gm.mvitals[mndx].died);
more_experienced(tmp, 0);
newexplevel(); /* will decide if you go up */
/* adjust alignment points */
if (mtmp->m_id == g.quest_status.leader_m_id) { /* REAL BAD! */
if (mtmp->m_id == gq.quest_status.leader_m_id) { /* REAL BAD! */
adjalign(-(u.ualign.record + (int) ALIGNLIM / 2));
u.ugangr += 7; /* instantly become "extremely" angry */
change_luck(-20);
pline("That was %sa bad idea...",
u.uevent.qcompleted ? "probably " : "");
} else if (mdat->msound == MS_NEMESIS) { /* Real good! */
if (!g.quest_status.killed_leader)
if (!gq.quest_status.killed_leader)
adjalign((int) (ALIGNLIM / 4));
} else if (mdat->msound == MS_GUARDIAN) { /* Bad */
adjalign(-(int) (ALIGNLIM / 8));
@@ -3289,7 +3289,7 @@ vamp_stone(struct monst *mtmp)
/* this only happens if shapeshifted */
if (mndx >= LOW_PM && mndx != monsndx(mtmp->data)
&& !(g.mvitals[mndx].mvflags & G_GENOD)) {
&& !(gm.mvitals[mndx].mvflags & G_GENOD)) {
char buf[BUFSZ];
/* construct a format string before transformation */
@@ -3400,10 +3400,10 @@ elemental_clog(struct monst *mon)
if (In_endgame(&u.uz)) {
m1 = m2 = m3 = m4 = m5 = zm = (struct monst *) 0;
if (!msgmv || (g.moves - msgmv) > 200L) {
if (!msgmv || (gm.moves - msgmv) > 200L) {
if (!msgmv || rn2(2))
You_feel("besieged.");
msgmv = g.moves;
msgmv = gm.moves;
}
/*
* m1 an elemental from another plane.
@@ -3701,7 +3701,7 @@ setmangry(struct monst* mtmp, boolean via_attack)
}
/* make other peaceful monsters react */
if (!g.context.mon_moving) {
if (!gc.context.mon_moving) {
struct monst *mon;
int mndx = monsndx(mtmp->data);
@@ -3810,7 +3810,7 @@ wakeup(struct monst* mtmp, boolean via_attack)
have to lose his disguise */
if (M_AP_TYPE(mtmp) != M_AP_MONSTER)
seemimic(mtmp);
} else if (g.context.forcefight && !g.context.mon_moving
} else if (gc.context.forcefight && !gc.context.mon_moving
&& mtmp->mundetected) {
mtmp->mundetected = 0;
newsym(mtmp->mx, mtmp->my);
@@ -3843,11 +3843,11 @@ wake_nearto(coordxy x, coordxy y, int distance)
mtmp->msleeping = 0; /* wake indeterminate sleep */
if (!(mtmp->data->geno & G_UNIQ))
mtmp->mstrategy &= ~STRAT_WAITMASK; /* wake 'meditation' */
if (g.context.mon_moving)
if (gc.context.mon_moving)
continue;
if (mtmp->mtame) {
if (!mtmp->isminion)
EDOG(mtmp)->whistletime = g.moves;
EDOG(mtmp)->whistletime = gm.moves;
/* Fix up a pet who is stuck "fleeing" its master */
mon_track_clear(mtmp);
}
@@ -4068,7 +4068,7 @@ maybe_unhide_at(coordxy x, coordxy y)
if (OBJ_AT(x, y))
return;
if ((mtmp = m_at(x, y)) == 0 && u_at(x, y))
mtmp = &g.youmonst;
mtmp = &gy.youmonst;
if (mtmp && mtmp->mundetected && hides_under(mtmp->data))
(void) hideunder(mtmp);
}
@@ -4078,7 +4078,7 @@ boolean
hideunder(struct monst *mtmp)
{
struct trap *t;
boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &g.youmonst);
boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &gy.youmonst);
coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my;
if (mtmp == u.ustuck) {
@@ -4090,14 +4090,14 @@ hideunder(struct monst *mtmp)
} else if (mtmp->data->mlet == S_EEL) {
undetected = (is_pool(x, y) && !Is_waterlevel(&u.uz));
} else if (hides_under(mtmp->data) && OBJ_AT(x, y)) {
struct obj *otmp = g.level.objects[x][y];
struct obj *otmp = gl.level.objects[x][y];
/* most monsters won't hide under cockatrice corpse but they
can hide under a pile containing more than just such corpses */
while (otmp && otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm]))
otmp = otmp->nexthere;
if (otmp != 0 || ((mtmp == &g.youmonst) ? Stone_resistance
if (otmp != 0 || ((mtmp == &gy.youmonst) ? Stone_resistance
: resists_ston(mtmp)))
undetected = TRUE;
}
@@ -4123,16 +4123,16 @@ hide_monst(struct monst* mon)
if ((is_hider(mon->data) || hider_under)
&& !(mon->mundetected || M_AP_TYPE(mon))) {
coordxy x = mon->mx, y = mon->my;
char save_viz = g.viz_array[y][x];
char save_viz = gv.viz_array[y][x];
/* override vision, forcing hero to be unable to see monster's spot */
g.viz_array[y][x] &= ~(IN_SIGHT | COULD_SEE);
gv.viz_array[y][x] &= ~(IN_SIGHT | COULD_SEE);
if (is_hider(mon->data))
(void) restrap(mon);
/* try again if mimic missed its 1/3 chance to hide */
if (mon->data->mlet == S_MIMIC && !M_AP_TYPE(mon))
(void) restrap(mon);
g.viz_array[y][x] = save_viz;
gv.viz_array[y][x] = save_viz;
if (hider_under)
(void) hideunder(mon);
}
@@ -4152,14 +4152,14 @@ mon_animal_list(boolean construct)
animal_temp[n++] = i;
/* if (n == 0) animal_temp[n++] = NON_PM; */
g.animal_list = (short *) alloc(n * sizeof *g.animal_list);
(void) memcpy((genericptr_t) g.animal_list, (genericptr_t) animal_temp,
n * sizeof *g.animal_list);
g.animal_list_count = n;
ga.animal_list = (short *) alloc(n * sizeof *ga.animal_list);
(void) memcpy((genericptr_t) ga.animal_list, (genericptr_t) animal_temp,
n * sizeof *ga.animal_list);
ga.animal_list_count = n;
} else { /* release */
if (g.animal_list)
free((genericptr_t) g.animal_list), g.animal_list = 0;
g.animal_list_count = 0;
if (ga.animal_list)
free((genericptr_t) ga.animal_list), ga.animal_list = 0;
ga.animal_list_count = 0;
}
}
@@ -4168,15 +4168,15 @@ pick_animal(void)
{
int res;
if (!g.animal_list)
if (!ga.animal_list)
mon_animal_list(TRUE);
res = g.animal_list[rn2(g.animal_list_count)];
res = ga.animal_list[rn2(ga.animal_list_count)];
/* rogue level should use monsters represented by uppercase letters
only, but since chameleons aren't generated there (not uppercase!)
we don't perform a lot of retries */
if (Is_rogue_level(&u.uz) && !isupper((uchar) mons[res].mlet))
res = g.animal_list[rn2(g.animal_list_count)];
res = ga.animal_list[rn2(ga.animal_list_count)];
return res;
}
@@ -4274,7 +4274,7 @@ pickvampshape(struct monst* mon)
break;
}
if (g.mvitals[mndx].mvflags & G_GENOD)
if (gm.mvitals[mndx].mvflags & G_GENOD)
return mon->cham;
return mndx;
@@ -4285,7 +4285,7 @@ static boolean
isspecmon(struct monst* mon)
{
return (mon->isshk || mon->ispriest || mon->isgd
|| mon->m_id == g.quest_status.leader_m_id);
|| mon->m_id == gq.quest_status.leader_m_id);
}
/* restrict certain special monsters (shopkeepers, aligned priests,
@@ -4393,7 +4393,7 @@ select_newcham_form(struct monst* mon)
} else if (!rn2(3)) { /* quest guardians */
mndx = rn1(PM_APPRENTICE - PM_STUDENT + 1, PM_STUDENT);
/* avoid own role's guardian */
if (mndx == g.urole.guardnum)
if (mndx == gu.urole.guardnum)
mndx = NON_PM;
} else { /* general humanoids */
tryct = 5;
@@ -4526,7 +4526,7 @@ accept_newcham_form(struct monst *mon, int mndx)
if (mndx == NON_PM)
return 0;
mdat = &mons[mndx];
if ((g.mvitals[mndx].mvflags & G_GENOD) != 0)
if ((gm.mvitals[mndx].mvflags & G_GENOD) != 0)
return 0;
if (is_placeholder(mdat))
return 0;
@@ -4624,7 +4624,7 @@ newcham(
} while (--tryct > 0);
if (!tryct)
return 0;
} else if (g.mvitals[monsndx(mdat)].mvflags & G_GENOD)
} else if (gm.mvitals[monsndx(mdat)].mvflags & G_GENOD)
return 0; /* passed in mdat is genocided */
if (mdat == olddata)
@@ -4726,7 +4726,7 @@ newcham(
/* update swallow glyphs for new monster */
swallowed(0);
}
} else if (!sticks(mdat) && !sticks(g.youmonst.data))
} else if (!sticks(mdat) && !sticks(gy.youmonst.data))
unstuck(mtmp);
}
@@ -4762,7 +4762,7 @@ newcham(
mon_break_armor(mtmp, polyspot);
if (!(mtmp->misc_worn_check & W_ARMG))
mselftouch(mtmp, "No longer petrify-resistant, ",
!g.context.mon_moving);
!gc.context.mon_moving);
check_gear_next_turn(mtmp);
/* This ought to re-test can_carry() on each item in the inventory
@@ -4856,8 +4856,8 @@ dead_species(int m_idx, boolean egg)
* overpopulation does not kill eggs.
*/
alt_idx = egg ? big_to_little(m_idx) : m_idx;
return (boolean) ((g.mvitals[m_idx].mvflags & G_GENOD) != 0
|| (g.mvitals[alt_idx].mvflags & G_GENOD) != 0);
return (boolean) ((gm.mvitals[m_idx].mvflags & G_GENOD) != 0
|| (gm.mvitals[alt_idx].mvflags & G_GENOD) != 0);
}
/* kill off any eggs of genocided monsters */
@@ -4915,8 +4915,8 @@ kill_genocided_monsters(void)
continue;
mndx = monsndx(mtmp->data);
kill_cham = (mtmp->cham >= LOW_PM
&& (g.mvitals[mtmp->cham].mvflags & G_GENOD));
if ((g.mvitals[mndx].mvflags & G_GENOD) || kill_cham) {
&& (gm.mvitals[mtmp->cham].mvflags & G_GENOD));
if ((gm.mvitals[mndx].mvflags & G_GENOD) || kill_cham) {
if (mtmp->cham >= LOW_PM && !kill_cham)
(void) newcham(mtmp, (struct permonst *) 0, NC_SHOW_MSG);
else
@@ -4926,10 +4926,10 @@ kill_genocided_monsters(void)
kill_eggs(mtmp->minvent);
}
kill_eggs(g.invent);
kill_eggs(gi.invent);
kill_eggs(fobj);
kill_eggs(g.migrating_objs);
kill_eggs(g.level.buriedobjlist);
kill_eggs(gm.migrating_objs);
kill_eggs(gl.level.buriedobjlist);
}
void
@@ -5058,7 +5058,7 @@ usmellmon(struct permonst* mdat)
boolean msg_given = FALSE;
if (mdat) {
if (!olfaction(g.youmonst.data))
if (!olfaction(gy.youmonst.data))
return FALSE;
mndx = monsndx(mdat);
switch (mndx) {
@@ -5153,7 +5153,7 @@ usmellmon(struct permonst* mdat)
msg_given = TRUE;
break;
case S_ORC:
if (maybe_polyd(is_orc(g.youmonst.data), Race_if(PM_ORC)))
if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC)))
You("notice an attractive smell.");
else
pline("A foul stench makes you feel a little nauseated.");
+17 -17
View File
@@ -80,7 +80,7 @@ poly_when_stoned(struct permonst *ptr)
{
/* non-stone golems turn into stone golems unless latter is genocided */
return (boolean) (is_golem(ptr) && ptr != &mons[PM_STONE_GOLEM]
&& !(g.mvitals[PM_STONE_GOLEM].mvflags & G_GENOD));
&& !(gm.mvitals[PM_STONE_GOLEM].mvflags & G_GENOD));
/* allow G_EXTINCT */
}
@@ -91,7 +91,7 @@ defended(struct monst *mon, int adtyp)
{
struct obj *o, otemp;
int mndx;
boolean is_you = (mon == &g.youmonst);
boolean is_you = (mon == &gy.youmonst);
/* is 'mon' wielding an artifact that protects against 'adtyp'? */
o = is_you ? uwep : MON_WEP(mon);
@@ -130,7 +130,7 @@ resists_drli(struct monst *mon)
if (is_undead(ptr) || is_demon(ptr) || is_were(ptr)
/* is_were() doesn't handle hero in human form */
|| (mon == &g.youmonst && u.ulycn >= LOW_PM)
|| (mon == &gy.youmonst && u.ulycn >= LOW_PM)
|| ptr == &mons[PM_DEATH] || is_vampshifter(mon))
return TRUE;
return defended(mon, AD_DRLI);
@@ -141,7 +141,7 @@ boolean
resists_magm(struct monst* mon)
{
struct permonst *ptr = mon->data;
boolean is_you = (mon == &g.youmonst);
boolean is_you = (mon == &gy.youmonst);
long slotmask;
struct obj *o;
@@ -154,7 +154,7 @@ resists_magm(struct monst* mon)
if (o && o->oartifact && defends(AD_MAGM, o))
return TRUE;
/* check for magic resistance granted by worn or carried items */
o = is_you ? g.invent : mon->minvent;
o = is_you ? gi.invent : mon->minvent;
slotmask = W_ARMOR | W_ACCESSORY;
if (!is_you /* assumes monsters don't wield non-weapons */
|| (uwep && (uwep->oclass == WEAPON_CLASS || is_weptool(uwep))))
@@ -174,7 +174,7 @@ boolean
resists_blnd(struct monst* mon)
{
struct permonst *ptr = mon->data;
boolean is_you = (mon == &g.youmonst);
boolean is_you = (mon == &gy.youmonst);
long slotmask;
struct obj *o;
@@ -191,7 +191,7 @@ resists_blnd(struct monst* mon)
o = is_you ? uwep : MON_WEP(mon);
if (o && o->oartifact && defends(AD_BLND, o))
return TRUE;
o = is_you ? g.invent : mon->minvent;
o = is_you ? gi.invent : mon->minvent;
slotmask = W_ARMOR | W_ACCESSORY;
if (!is_you /* assumes monsters don't wield non-weapons */
|| (uwep && (uwep->oclass == WEAPON_CLASS || is_weptool(uwep))))
@@ -217,7 +217,7 @@ can_blnd(
uchar aatyp,
struct obj *obj) /* aatyp == AT_WEAP, AT_SPIT */
{
boolean is_you = (mdef == &g.youmonst);
boolean is_you = (mdef == &gy.youmonst);
boolean check_visor = FALSE;
struct obj *o;
@@ -259,7 +259,7 @@ can_blnd(
return TRUE; /* no defense */
} else
return FALSE; /* other objects cannot cause blindness yet */
if ((magr == &g.youmonst) && u.uswallow)
if ((magr == &gy.youmonst) && u.uswallow)
return FALSE; /* can't affect eyes while inside monster */
break;
@@ -274,7 +274,7 @@ can_blnd(
/* e.g. raven: all ublindf, including LENSES, protect */
if (is_you && ublindf)
return FALSE;
if ((magr == &g.youmonst) && u.uswallow)
if ((magr == &gy.youmonst) && u.uswallow)
return FALSE; /* can't affect eyes while inside monster */
check_visor = TRUE;
break;
@@ -292,7 +292,7 @@ can_blnd(
/* check if wearing a visor (only checked if visor might help) */
if (check_visor) {
o = (mdef == &g.youmonst) ? g.invent : mdef->minvent;
o = (mdef == &gy.youmonst) ? gi.invent : mdef->minvent;
for (; o; o = o->nobj)
if ((o->owornmask & W_ARMH)
&& objdescr_is(o, "visored helmet"))
@@ -467,7 +467,7 @@ can_blow(struct monst* mtmp)
&& (breathless(mtmp->data) || verysmall(mtmp->data)
|| !has_head(mtmp->data) || mtmp->data->mlet == S_EEL))
return FALSE;
if ((mtmp == &g.youmonst) && Strangled)
if ((mtmp == &gy.youmonst) && Strangled)
return FALSE;
return TRUE;
}
@@ -476,7 +476,7 @@ can_blow(struct monst* mtmp)
boolean
can_chant(struct monst* mtmp)
{
if ((mtmp == &g.youmonst && Strangled)
if ((mtmp == &gy.youmonst && Strangled)
|| is_silent(mtmp->data) || !has_head(mtmp->data)
|| mtmp->data->msound == MS_BUZZ || mtmp->data->msound == MS_BURBLE)
return FALSE;
@@ -499,10 +499,10 @@ can_be_strangled(struct monst* mon)
are non-breathing creatures which have higher brain function. */
if (!has_head(mon->data))
return FALSE;
if (mon == &g.youmonst) {
if (mon == &gy.youmonst) {
/* hero can't be mindless but poly'ing into mindless form can
confer strangulation protection */
nobrainer = mindless(g.youmonst.data);
nobrainer = mindless(gy.youmonst.data);
nonbreathing = Breathless;
} else {
nobrainer = mindless(mon->data);
@@ -1270,8 +1270,8 @@ big_little_match(int montyp1, int montyp2)
const struct permonst *
raceptr(struct monst* mtmp)
{
if (mtmp == &g.youmonst && !Upolyd)
return &mons[g.urace.mnum];
if (mtmp == &gy.youmonst && !Upolyd)
return &mons[gu.urace.mnum];
else
return mtmp->data;
}
+44 -44
View File
@@ -121,7 +121,7 @@ watch_on_duty(register struct monst* mtmp)
}
} else if (is_digging()) {
/* chewing, wand/spell of digging are checked elsewhere */
watch_dig(mtmp, g.context.digging.pos.x, g.context.digging.pos.y,
watch_dig(mtmp, gc.context.digging.pos.x, gc.context.digging.pos.y,
FALSE);
}
}
@@ -138,7 +138,7 @@ dochugw(
{
coordxy x = mtmp->mx, y = mtmp->my; /* 'mtmp's location before dochug() */
/* skip canspotmon() if occupation is Null */
boolean already_saw_mon = (chug && g.occupation) ? canspotmon(mtmp) : 0;
boolean already_saw_mon = (chug && go.occupation) ? canspotmon(mtmp) : 0;
int rd = chug ? dochug(mtmp) : 0;
/*
@@ -148,7 +148,7 @@ dochugw(
*/
/* check whether hero notices monster and stops current activity */
if (g.occupation && !rd
if (go.occupation && !rd
/* monster is hostile and can attack (or hallu distorts knowledge) */
&& (Hallucination || (!mtmp->mpeaceful && !noattacks(mtmp->data)))
/* it's close enough to be a threat */
@@ -224,7 +224,7 @@ void
mon_regen(struct monst *mon, boolean digest_meal)
{
if (mon->mhp < mon->mhpmax
&& (g.moves % 20 == 0 || regenerates(mon->data)))
&& (gm.moves % 20 == 0 || regenerates(mon->data)))
mon->mhp++;
if (mon->mspec_used)
mon->mspec_used--;
@@ -282,7 +282,7 @@ release_hero(struct monst *mon)
if (mon == u.ustuck) {
if (u.uswallow) {
expels(mon, mon->data, TRUE);
} else if (!sticks(g.youmonst.data)) {
} else if (!sticks(gy.youmonst.data)) {
unstuck(mon); /* let go */
You("get released!");
}
@@ -294,7 +294,7 @@ find_pmmonst(int pm)
{
struct monst *mtmp = 0;
if ((g.mvitals[pm].mvflags & G_GENOD) == 0)
if ((gm.mvitals[pm].mvflags & G_GENOD) == 0)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
@@ -498,8 +498,8 @@ mind_blast(register struct monst* mtmp)
/* hero has no way to hide as monster but
check for that theoretical case anyway */
&& U_AP_TYPE != M_AP_MONSTER) {
g.youmonst.m_ap_type = M_AP_NOTHING;
g.youmonst.mappearance = 0;
gy.youmonst.m_ap_type = M_AP_NOTHING;
gy.youmonst.mappearance = 0;
newsym(u.ux, u.uy);
}
pline("It locks on to your %s!",
@@ -662,7 +662,7 @@ dochug(register struct monst* mtmp)
pline("%s whispers at thin air.",
cansee(mtmp->mux, mtmp->muy) ? Monnam(mtmp) : "It");
if (is_demon(g.youmonst.data)) {
if (is_demon(gy.youmonst.data)) {
/* "Good hunting, brother" */
if (!tele_restrict(mtmp))
(void) rloc(mtmp, RLOC_MSG);
@@ -733,7 +733,7 @@ dochug(register struct monst* mtmp)
to move. Movement itself is handled by the m_move() function. */
if (!nearby || mtmp->mflee || scared || mtmp->mconf || mtmp->mstun
|| (mtmp->minvis && !rn2(3))
|| (mdat->mlet == S_LEPRECHAUN && !findgold(g.invent)
|| (mdat->mlet == S_LEPRECHAUN && !findgold(gi.invent)
&& (findgold(mtmp->minvent) || rn2(2)))
|| (is_wanderer(mdat) && !rn2(4)) || (Conflict && !mtmp->iswiz)
|| (!mtmp->mcansee && !rn2(4)) || mtmp->mpeaceful) {
@@ -846,7 +846,7 @@ static NEARDATA const char gem_class[] = { GEM_CLASS, 0 };
boolean
itsstuck(register struct monst* mtmp)
{
if (sticks(g.youmonst.data) && mtmp == u.ustuck && !u.uswallow) {
if (sticks(gy.youmonst.data) && mtmp == u.ustuck && !u.uswallow) {
pline("%s cannot escape from you!", Monnam(mtmp));
return TRUE;
}
@@ -866,8 +866,8 @@ should_displace(
coord *poss, /* coord poss[9] */
long *info, /* long info[9] */
int cnt,
coordxy gx,
coordxy gy)
coordxy ggx,
coordxy ggy)
{
int shortest_with_displacing = -1;
int shortest_without_displacing = -1;
@@ -878,7 +878,7 @@ should_displace(
for (i = 0; i < cnt; i++) {
nx = poss[i].x;
ny = poss[i].y;
ndist = dist2(nx, ny, gx, gy);
ndist = dist2(nx, ny, ggx, ggy);
if (MON_AT(nx, ny) && (info[i] & ALLOW_MDISP) && !(info[i] & ALLOW_M)
&& !undesirable_disp(mtmp, nx, ny)) {
if (shortest_with_displacing == -1
@@ -939,7 +939,7 @@ leppie_avoidance(struct monst *mtmp)
if (mtmp->data == &mons[PM_LEPRECHAUN]
&& ((lepgold = findgold(mtmp->minvent))
&& (lepgold->quan
> ((ygold = findgold(g.invent)) ? ygold->quan : 0L))))
> ((ygold = findgold(gi.invent)) ? ygold->quan : 0L))))
return TRUE;
return FALSE;
@@ -1074,7 +1074,7 @@ int
m_move(register struct monst* mtmp, register int after)
{
int appr, etmp;
coordxy gx, gy, nix, niy;
coordxy ggx, ggy, nix, niy;
xint16 chcnt;
int chi; /* could be schar except for stupid Sun-2 compiler */
boolean likegold = 0, likegems = 0, likeobjs = 0, likemagic = 0,
@@ -1142,7 +1142,7 @@ m_move(register struct monst* mtmp, register int after)
*/
if ((dist2(mtmp->mx, mtmp->my, tx, ty) < 2) && intruder
&& (intruder != mtmp)) {
g.notonhead = (intruder->mx != tx || intruder->my != ty);
gn.notonhead = (intruder->mx != tx || intruder->my != ty);
if (mattackm(mtmp, intruder) == 2)
return MMOVE_DIED;
mmoved = MMOVE_MOVED;
@@ -1199,20 +1199,20 @@ m_move(register struct monst* mtmp, register int after)
return MMOVE_MOVED;
omx = mtmp->mx;
omy = mtmp->my;
gx = mtmp->mux;
gy = mtmp->muy;
ggx = mtmp->mux;
ggy = mtmp->muy;
appr = mtmp->mflee ? -1 : 1;
if (mtmp->mconf || engulfing_u(mtmp)) {
appr = 0;
} else {
boolean should_see = (couldsee(omx, omy)
&& (levl[gx][gy].lit || !levl[omx][omy].lit)
&& (dist2(omx, omy, gx, gy) <= 36));
&& (levl[ggx][ggy].lit || !levl[omx][omy].lit)
&& (dist2(omx, omy, ggx, ggy) <= 36));
if (!mtmp->mcansee
|| (should_see && Invis && !perceives(ptr) && rn2(11))
|| is_obj_mappear(&g.youmonst, STRANGE_OBJECT) || u.uundetected
|| (is_obj_mappear(&g.youmonst, GOLD_PIECE) && !likes_gold(ptr))
|| is_obj_mappear(&gy.youmonst, STRANGE_OBJECT) || u.uundetected
|| (is_obj_mappear(&gy.youmonst, GOLD_PIECE) && !likes_gold(ptr))
|| (mtmp->mpeaceful && !mtmp->isshk) /* allow shks to follow */
|| ((monsndx(ptr) == PM_STALKER || ptr->mlet == S_BAT
|| ptr->mlet == S_LIGHT) && !rn2(3)))
@@ -1230,8 +1230,8 @@ m_move(register struct monst* mtmp, register int after)
cp = gettrack(omx, omy);
if (cp) {
gx = cp->x;
gy = cp->y;
ggx = cp->x;
ggy = cp->y;
}
}
}
@@ -1239,7 +1239,7 @@ m_move(register struct monst* mtmp, register int after)
if ((!mtmp->mpeaceful || !rn2(10)) && (!Is_rogue_level(&u.uz))) {
boolean in_line = (lined_up(mtmp)
&& (distmin(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy)
<= (throws_rocks(g.youmonst.data) ? 20 : ACURRSTR / 2 + 1)));
<= (throws_rocks(gy.youmonst.data) ? 20 : ACURRSTR / 2 + 1)));
if (appr != 1 || !in_line) {
/* Monsters in combat won't pick stuff up, avoiding the
@@ -1324,9 +1324,9 @@ m_move(register struct monst* mtmp, register int after)
/* ignore obj if there's a trap and monster knows it */
if ((ttmp = t_at(xx, yy)) != 0
&& mon_knows_traps(mtmp, ttmp->ttyp)) {
if (gx == xx && gy == yy) {
gx = mtmp->mux;
gy = mtmp->muy;
if (ggx == xx && ggy == yy) {
ggx = mtmp->mux;
ggy = mtmp->muy;
}
continue;
}
@@ -1358,9 +1358,9 @@ m_move(register struct monst* mtmp, register int after)
oomy = min(ROWNO - 1, omy + minr);
lmx = max(1, omx - minr);
lmy = max(0, omy - minr);
gx = otmp->ox;
gy = otmp->oy;
if (gx == omx && gy == omy) {
ggx = otmp->ox;
ggy = otmp->oy;
if (ggx == omx && ggy == omy) {
mmoved = MMOVE_DONE; /* actually unnecessary */
goto postmov;
}
@@ -1377,8 +1377,8 @@ m_move(register struct monst* mtmp, register int after)
if (minr < SQSRCHRADIUS && appr == -1) {
if (distmin(omx, omy, mtmp->mux, mtmp->muy) <= 3) {
gx = mtmp->mux;
gy = mtmp->muy;
ggx = mtmp->mux;
ggy = mtmp->muy;
} else
appr = 1;
}
@@ -1409,9 +1409,9 @@ m_move(register struct monst* mtmp, register int after)
chcnt = 0;
jcnt = min(MTSZ, cnt - 1);
chi = -1;
nidist = dist2(nix, niy, gx, gy);
nidist = dist2(nix, niy, ggx, ggy);
/* allow monsters be shortsighted on some levels for balance */
if (!mtmp->mpeaceful && g.level.flags.shortsighted
if (!mtmp->mpeaceful && gl.level.flags.shortsighted
&& nidist > (couldsee(nix, niy) ? 144 : 36) && appr == 1)
appr = 0;
if (is_unicorn(ptr) && noteleport_level(mtmp)) {
@@ -1421,7 +1421,7 @@ m_move(register struct monst* mtmp, register int after)
avoid = TRUE;
}
better_with_displacing =
should_displace(mtmp, poss, info, cnt, gx, gy);
should_displace(mtmp, poss, info, cnt, ggx, ggy);
for (i = 0; i < cnt; i++) {
if (avoid && (info[i] & NOTONL))
continue;
@@ -1439,7 +1439,7 @@ m_move(register struct monst* mtmp, register int after)
goto nxti;
}
nearer = ((ndist = dist2(nx, ny, gx, gy)) < nidist);
nearer = ((ndist = dist2(nx, ny, ggx, ggy)) < nidist);
if ((appr == 1 && nearer) || (appr == -1 && !nearer)
|| (!appr && !rn2(++chcnt)) || (mmoved == MMOVE_NOTHING)) {
@@ -1809,7 +1809,7 @@ m_move_aggress(struct monst* mtmp, coordxy x, coordxy y)
mtmp2 = m_at(x, y);
g.notonhead = mtmp2 && (x != mtmp2->mx || y != mtmp2->my);
gn.notonhead = mtmp2 && (x != mtmp2->mx || y != mtmp2->my);
/* note: mstatus returns 0 if mtmp2 is nonexistent */
mstatus = mattackm(mtmp, mtmp2);
@@ -1819,7 +1819,7 @@ m_move_aggress(struct monst* mtmp, coordxy x, coordxy y)
if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4)
&& mtmp2->movement >= NORMAL_SPEED) {
mtmp2->movement -= NORMAL_SPEED;
g.notonhead = 0;
gn.notonhead = 0;
mstatus = mattackm(mtmp2, mtmp); /* return attack */
if (mstatus & MM_DEF_DIED)
return MMOVE_DIED;
@@ -1863,7 +1863,7 @@ set_apparxy(register struct monst* mtmp)
boolean notseen, notthere, gotu;
int disp;
coordxy mx = mtmp->mux, my = mtmp->muy;
long umoney = money_cnt(g.invent);
long umoney = money_cnt(gi.invent);
/*
* do cheapest and/or most likely tests first
@@ -1983,8 +1983,8 @@ stuff_prevents_passage(struct monst* mtmp)
{
struct obj *chain, *obj;
if (mtmp == &g.youmonst) {
chain = g.invent;
if (mtmp == &gy.youmonst) {
chain = gi.invent;
} else {
chain = mtmp->minvent;
}
@@ -2027,7 +2027,7 @@ can_ooze(struct monst* mtmp)
boolean
can_fog(struct monst* mtmp)
{
if (!(g.mvitals[PM_FOG_CLOUD].mvflags & G_GENOD) && is_vampshifter(mtmp)
if (!(gm.mvitals[PM_FOG_CLOUD].mvflags & G_GENOD) && is_vampshifter(mtmp)
&& !Protection_from_shape_changers && !stuff_prevents_passage(mtmp))
return TRUE;
return FALSE;
+1 -1
View File
@@ -366,7 +366,7 @@ mplayer_talk(register struct monst* mtmp)
if (mtmp->mpeaceful)
return; /* will drop to humanoid talk */
verbalize("Talk? -- %s", mtmp->data == &mons[g.urole.mnum]
verbalize("Talk? -- %s", mtmp->data == &mons[gu.urole.mnum]
? same_class_msg[rn2(3)]
: other_class_msg[rn2(3)]);
}
+99 -99
View File
@@ -101,7 +101,7 @@ thitu(
is_acid = (obj && obj->otyp == ACID_VENOM);
if (u.uac + tlev <= (dieroll = rnd(20))) {
++g.mesg_given;
++gm.mesg_given;
if (Blind || !Verbose(2, thitu1)) {
pline("It misses.");
} else if (u.uac + tlev <= dieroll - 2) {
@@ -120,7 +120,7 @@ thitu(
if (is_acid && Acid_resistance) {
pline("It doesn't seem to hurt you.");
monstseesu(M_SEEN_ACID);
} else if (stone_missile(obj) && passes_rocks(g.youmonst.data)) {
} else if (stone_missile(obj) && passes_rocks(gy.youmonst.data)) {
/* use 'named' as an approximation for "hitting from above";
we avoid "passes through you" for horizontal flight path
because missile stops and that wording would suggest that
@@ -130,7 +130,7 @@ thitu(
} else if (obj && obj->oclass == POTION_CLASS) {
/* an explosion which scatters objects might hit hero with one
(potions deliberately thrown at hero are handled by m_throw) */
potionhit(&g.youmonst, obj, POTHIT_OTHER_THROW);
potionhit(&gy.youmonst, obj, POTHIT_OTHER_THROW);
*objp = obj = 0; /* potionhit() uses up the potion */
} else {
if (obj && objects[obj->otyp].oc_material == SILVER
@@ -183,7 +183,7 @@ drop_throw(
if (!flooreffects(obj, x, y, "fall")) {
place_object(obj, x, y);
if (!mtmp && u_at(x, y))
mtmp = &g.youmonst;
mtmp = &gy.youmonst;
if (mtmp && ohit)
passive_obj(mtmp, obj, (struct attack *) 0);
stackobj(obj);
@@ -193,7 +193,7 @@ drop_throw(
} else {
delobj(obj);
}
g.thrownobj = 0;
gt.thrownobj = 0;
return retvalu;
}
@@ -261,14 +261,14 @@ monmulti(struct monst* mtmp, struct obj* otmp, struct obj* mwep)
static void
monshoot(struct monst* mtmp, struct obj* otmp, struct obj* mwep)
{
struct monst *mtarg = g.mtarget;
struct monst *mtarg = gm.mtarget;
int dm = distmin(mtmp->mx, mtmp->my,
mtarg ? mtarg->mx : mtmp->mux,
mtarg ? mtarg->my : mtmp->muy),
multishot = monmulti(mtmp, otmp, mwep);
/*
* Caller must have called linedup() to set up <g.tbx, g.tby>.
* Caller must have called linedup() to set up <gt.tbx, gt.tby>.
*/
if (canseemon(mtmp)) {
@@ -285,38 +285,38 @@ monshoot(struct monst* mtmp, struct obj* otmp, struct obj* mwep)
onm = singular(otmp, xname);
onm = obj_is_pname(otmp) ? the(onm) : an(onm);
}
g.m_shot.s = ammo_and_launcher(otmp, mwep) ? TRUE : FALSE;
gm.m_shot.s = ammo_and_launcher(otmp, mwep) ? TRUE : FALSE;
Strcpy(trgbuf, mtarg ? some_mon_nam(mtarg) : "");
pline("%s %s %s%s%s!", Monnam(mtmp),
g.m_shot.s ? "shoots" : "throws", onm,
gm.m_shot.s ? "shoots" : "throws", onm,
mtarg ? " at " : "", trgbuf);
g.m_shot.o = otmp->otyp;
gm.m_shot.o = otmp->otyp;
} else {
g.m_shot.o = STRANGE_OBJECT; /* don't give multishot feedback */
gm.m_shot.o = STRANGE_OBJECT; /* don't give multishot feedback */
}
g.m_shot.n = multishot;
for (g.m_shot.i = 1; g.m_shot.i <= g.m_shot.n; g.m_shot.i++) {
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby), dm, otmp);
gm.m_shot.n = multishot;
for (gm.m_shot.i = 1; gm.m_shot.i <= gm.m_shot.n; gm.m_shot.i++) {
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(gt.tbx), sgn(gt.tby), dm, otmp);
/* conceptually all N missiles are in flight at once, but
if mtmp gets killed (shot kills adjacent gas spore and
triggers explosion, perhaps), inventory will be dropped
and otmp might go away via merging into another stack */
if (DEADMONSTER(mtmp) && g.m_shot.i < g.m_shot.n)
if (DEADMONSTER(mtmp) && gm.m_shot.i < gm.m_shot.n)
/* cancel pending shots (perhaps ought to give a message here
since we gave one above about throwing/shooting N missiles) */
break; /* endmultishot(FALSE); */
}
/* reset 'g.m_shot' */
g.m_shot.n = g.m_shot.i = 0;
g.m_shot.o = STRANGE_OBJECT;
g.m_shot.s = FALSE;
/* reset 'gm.m_shot' */
gm.m_shot.n = gm.m_shot.i = 0;
gm.m_shot.o = STRANGE_OBJECT;
gm.m_shot.s = FALSE;
}
/* an object launched by someone/thing other than player attacks a monster;
return 1 if the object has stopped moving (hit or its range used up) */
int
ohitmon(
struct monst *mtmp, /* accidental target, located at <g.bhitpos.x,.y> */
struct monst *mtmp, /* accidental target, located at <gb.bhitpos.x,.y> */
struct obj *otmp, /* missile; might be destroyed by drop_throw */
int range, /* how much farther will object travel if it misses;
* use -1 to signify to keep going even after hit,
@@ -326,11 +326,11 @@ ohitmon(
int damage, tmp;
boolean vis, ismimic;
int objgone = 1;
struct obj *mon_launcher = g.marcher ? MON_WEP(g.marcher) : NULL;
struct obj *mon_launcher = gm.marcher ? MON_WEP(gm.marcher) : NULL;
g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
gn.notonhead = (gb.bhitpos.x != mtmp->mx || gb.bhitpos.y != mtmp->my);
ismimic = M_AP_TYPE(mtmp) && M_AP_TYPE(mtmp) != M_AP_MONSTER;
vis = cansee(g.bhitpos.x, g.bhitpos.y);
vis = cansee(gb.bhitpos.x, gb.bhitpos.y);
if (vis)
otmp->dknown = 1;
@@ -338,9 +338,9 @@ ohitmon(
/* High level monsters will be more likely to hit */
/* This check applies only if this monster is the target
* the archer was aiming at. */
if (g.marcher && g.mtarget == mtmp) {
if (g.marcher->m_lev > 5)
tmp += g.marcher->m_lev - 5;
if (gm.marcher && gm.mtarget == mtmp) {
if (gm.marcher->m_lev > 5)
tmp += gm.marcher->m_lev - 5;
if (mon_launcher && mon_launcher->oartifact)
tmp += spec_abon(mon_launcher, mtmp);
}
@@ -348,7 +348,7 @@ ohitmon(
if (!ismimic) {
if (vis)
miss(distant_name(otmp, mshot_xname), mtmp);
else if (verbose && !g.mtarget)
else if (verbose && !gm.mtarget)
pline("It is missed.");
}
if (!range) { /* Last position; object drops */
@@ -392,7 +392,7 @@ ohitmon(
mhim(mtmp));
hit(distant_name(otmp, mshot_xname), mtmp, how);
}
} else if (verbose && !g.mtarget)
} else if (verbose && !gm.mtarget)
pline("%s%s is hit%s", (otmp->otyp == EGG) ? "Splat! " : "",
Monnam(mtmp), exclam(damage));
@@ -422,18 +422,18 @@ ohitmon(
if (flesh) /* s_suffix returns a modifiable buffer */
m_name = strcat(s_suffix(m_name), " flesh");
pline_The("silver sears %s!", m_name);
} else if (verbose && !g.mtarget) {
} else if (verbose && !gm.mtarget) {
pline("%s is seared!", flesh ? "Its flesh" : "It");
}
}
if (otmp->otyp == ACID_VENOM && cansee(mtmp->mx, mtmp->my)) {
if (resists_acid(mtmp)) {
if (vis || (verbose && !g.mtarget))
if (vis || (verbose && !gm.mtarget))
pline("%s is unaffected.", Monnam(mtmp));
} else {
if (vis)
pline_The("%s burns %s!", hliquid("acid"), mon_nam(mtmp));
else if (verbose && !g.mtarget)
else if (verbose && !gm.mtarget)
pline("It is burned!");
}
}
@@ -448,12 +448,12 @@ ohitmon(
if (!harmless && !DEADMONSTER(mtmp)) {
mtmp->mhp -= damage;
if (DEADMONSTER(mtmp)) {
if (vis || (verbose && !g.mtarget))
if (vis || (verbose && !gm.mtarget))
pline("%s is %s!", Monnam(mtmp),
(nonliving(mtmp->data) || is_vampshifter(mtmp)
|| !canspotmon(mtmp)) ? "destroyed" : "killed");
/* don't blame hero for unknown rolling boulder trap */
if (!g.context.mon_moving && (otmp->otyp != BOULDER
if (!gc.context.mon_moving && (otmp->otyp != BOULDER
|| range >= 0 || otmp->otrapped))
xkilled(mtmp, XKILL_NOMSG);
else
@@ -484,7 +484,7 @@ ohitmon(
mtmp->mblinded = tmp;
}
objgone = drop_throw(otmp, 1, g.bhitpos.x, g.bhitpos.y);
objgone = drop_throw(otmp, 1, gb.bhitpos.x, gb.bhitpos.y);
if (!objgone && range == -1) { /* special case */
obj_extract_self(otmp); /* free it for motion again */
return 0;
@@ -502,7 +502,7 @@ ucatchgem(
{
/* won't catch rock or gray stone; catch (then drop) worthless glass */
if (gem->otyp <= LAST_GEM + NUM_GLASS_GEMS
&& is_unicorn(g.youmonst.data)) {
&& is_unicorn(gy.youmonst.data)) {
char *gem_xname = xname(gem),
*mon_s_name = s_suffix(mon_nam(mon));
@@ -524,21 +524,21 @@ ucatchgem(
#define MT_FLIGHTCHECK(pre,forcehit) \
(/* missile hits edge of screen */ \
!isok(g.bhitpos.x + dx, g.bhitpos.y + dy) \
!isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy) \
/* missile hits the wall */ \
|| IS_ROCK(levl[g.bhitpos.x + dx][g.bhitpos.y + dy].typ) \
|| IS_ROCK(levl[gb.bhitpos.x + dx][gb.bhitpos.y + dy].typ) \
/* missile hit closed door */ \
|| closed_door(g.bhitpos.x + dx, g.bhitpos.y + dy) \
|| closed_door(gb.bhitpos.x + dx, gb.bhitpos.y + dy) \
/* missile might hit iron bars */ \
/* the random chance for small objects hitting bars is */ \
/* skipped when reaching them at point blank range */ \
|| (levl[g.bhitpos.x + dx][g.bhitpos.y + dy].typ == IRONBARS \
|| (levl[gb.bhitpos.x + dx][gb.bhitpos.y + dy].typ == IRONBARS \
&& hits_bars(&singleobj, \
g.bhitpos.x, g.bhitpos.y, \
g.bhitpos.x + dx, g.bhitpos.y + dy, \
gb.bhitpos.x, gb.bhitpos.y, \
gb.bhitpos.x + dx, gb.bhitpos.y + dy, \
((pre) ? 0 : forcehit), 0)) \
/* Thrown objects "sink" */ \
|| (!(pre) && IS_SINK(levl[g.bhitpos.x][g.bhitpos.y].typ)) \
|| (!(pre) && IS_SINK(levl[gb.bhitpos.x][gb.bhitpos.y].typ)) \
)
void
@@ -555,9 +555,9 @@ m_throw(
char sym = obj->oclass;
int hitu = 0, oldumort, blindinc = 0;
g.bhitpos.x = x;
g.bhitpos.y = y;
g.notonhead = FALSE; /* reset potentially stale value */
gb.bhitpos.x = x;
gb.bhitpos.y = y;
gn.notonhead = FALSE; /* reset potentially stale value */
if (obj->quan == 1L) {
/*
@@ -582,7 +582,7 @@ m_throw(
obj_extract_self(singleobj);
}
/* global pointer for missile object in OBJ_FREE state */
g.thrownobj = singleobj;
gt.thrownobj = singleobj;
singleobj->owornmask = 0; /* threw one of multiple weapons in hand? */
if (!canseemon(mon))
@@ -600,16 +600,16 @@ m_throw(
dy = rn2(3) - 1;
/* check validity of new direction */
if (!dx && !dy) {
(void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
(void) drop_throw(singleobj, 0, gb.bhitpos.x, gb.bhitpos.y);
return;
}
}
if (MT_FLIGHTCHECK(TRUE, 0)) {
(void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
(void) drop_throw(singleobj, 0, gb.bhitpos.x, gb.bhitpos.y);
return;
}
g.mesg_given = 0; /* a 'missile misses' message has not yet been shown */
gm.mesg_given = 0; /* a 'missile misses' message has not yet been shown */
/* Note: drop_throw may destroy singleobj. Since obj must be destroyed
* early to avoid the dagger bug, anyone who modifies this code should
@@ -618,12 +618,12 @@ m_throw(
if (sym)
tmp_at(DISP_FLASH, obj_to_glyph(singleobj, rn2_on_display_rng));
while (range-- > 0) { /* Actually the loop is always exited by break */
singleobj->ox = g.bhitpos.x += dx;
singleobj->oy = g.bhitpos.y += dy;
if (cansee(g.bhitpos.x, g.bhitpos.y))
singleobj->ox = gb.bhitpos.x += dx;
singleobj->oy = gb.bhitpos.y += dy;
if (cansee(gb.bhitpos.x, gb.bhitpos.y))
singleobj->dknown = 1;
mtmp = m_at(g.bhitpos.x, g.bhitpos.y);
mtmp = m_at(gb.bhitpos.x, gb.bhitpos.y);
if (mtmp && shade_miss(mon, mtmp, singleobj, TRUE, TRUE)) {
/* if mtmp is a shade and missile passes harmlessly through it,
give message and skip it in order to keep going */
@@ -631,12 +631,12 @@ m_throw(
} else if (mtmp) {
if (ohitmon(mtmp, singleobj, range, TRUE))
break;
} else if (u_at(g.bhitpos.x, g.bhitpos.y)) {
if (g.multi)
} else if (u_at(gb.bhitpos.x, gb.bhitpos.y)) {
if (gm.multi)
nomul(0);
if (singleobj->oclass == POTION_CLASS) {
potionhit(&g.youmonst, singleobj, POTHIT_MONST_THROW);
potionhit(&gy.youmonst, singleobj, POTHIT_MONST_THROW);
break;
} else if (singleobj->oclass == GEM_CLASS) {
/* hero might be poly'd into a unicorn */
@@ -662,7 +662,7 @@ m_throw(
{
int dam, hitv;
dam = dmgval(singleobj, &g.youmonst);
dam = dmgval(singleobj, &gy.youmonst);
hitv = 3 - distmin(u.ux, u.uy, mon->mx, mon->my);
if (hitv < -4)
hitv = -4;
@@ -674,7 +674,7 @@ m_throw(
if (singleobj->otyp == ELVEN_ARROW)
dam++;
}
if (bigmonst(g.youmonst.data))
if (bigmonst(gy.youmonst.data))
hitv++;
hitv += 8 + singleobj->spe;
if (dam < 1)
@@ -692,7 +692,7 @@ m_throw(
poison is limited to attrib loss */
(u.umortality > oldumort) ? 0 : 10, TRUE);
}
if (hitu && can_blnd((struct monst *) 0, &g.youmonst,
if (hitu && can_blnd((struct monst *) 0, &gy.youmonst,
(uchar) ((singleobj->otyp == BLINDING_VENOM)
? AT_SPIT
: AT_WEAP),
@@ -707,7 +707,7 @@ m_throw(
} else if (singleobj->otyp == BLINDING_VENOM) {
const char *eyes = body_part(EYE);
if (eyecount(g.youmonst.data) != 1)
if (eyecount(gy.youmonst.data) != 1)
eyes = makeplural(eyes);
/* venom in the eyes */
if (!Blind)
@@ -718,7 +718,7 @@ m_throw(
}
if (hitu && singleobj->otyp == EGG) {
if (!Stoned && !Stone_resistance
&& !(poly_when_stoned(g.youmonst.data)
&& !(poly_when_stoned(gy.youmonst.data)
&& polymon(PM_STONE_GOLEM))) {
make_stoned(5L, (char *) 0, KILLED_BY, "");
}
@@ -736,28 +736,28 @@ m_throw(
if (singleobj) { /* hits_bars might have destroyed it */
/* note: pline(The(missile)) rather than pline_The(missile)
in order to get "Grimtooth" rather than "The Grimtooth" */
if (range && cansee(g.bhitpos.x, g.bhitpos.y)
&& IS_SINK(levl[g.bhitpos.x][g.bhitpos.y].typ))
if (range && cansee(gb.bhitpos.x, gb.bhitpos.y)
&& IS_SINK(levl[gb.bhitpos.x][gb.bhitpos.y].typ))
pline("%s %s onto the sink.", The(mshot_xname(singleobj)),
otense(singleobj, Hallucination ? "plop" : "drop"));
else if (g.m_shot.n > 1
&& (!g.mesg_given
|| g.bhitpos.x != u.ux || g.bhitpos.y != u.uy)
&& (cansee(g.bhitpos.x, g.bhitpos.y)
|| (g.marcher && canseemon(g.marcher))))
else if (gm.m_shot.n > 1
&& (!gm.mesg_given
|| gb.bhitpos.x != u.ux || gb.bhitpos.y != u.uy)
&& (cansee(gb.bhitpos.x, gb.bhitpos.y)
|| (gm.marcher && canseemon(gm.marcher))))
pline("%s misses.", The(mshot_xname(singleobj)));
(void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
(void) drop_throw(singleobj, 0, gb.bhitpos.x, gb.bhitpos.y);
}
break;
}
tmp_at(g.bhitpos.x, g.bhitpos.y);
tmp_at(gb.bhitpos.x, gb.bhitpos.y);
delay_output();
}
tmp_at(g.bhitpos.x, g.bhitpos.y);
tmp_at(gb.bhitpos.x, gb.bhitpos.y);
delay_output();
tmp_at(DISP_END, 0);
g.mesg_given = 0; /* reset */
gm.mesg_given = 0; /* reset */
if (blindinc) {
u.ucreamed += blindinc;
@@ -766,7 +766,7 @@ m_throw(
Your1(vision_clears);
}
/* note: all early returns follow drop_throw() which clears thrownobj */
g.thrownobj = 0;
gt.thrownobj = 0;
return;
}
@@ -808,10 +808,10 @@ thrwmm(struct monst* mtmp, struct monst* mtarg)
> PET_MISSILE_RANGE2)
return MM_MISS; /* Out of range */
/* Set target monster */
g.mtarget = mtarg;
g.marcher = mtmp;
gm.mtarget = mtarg;
gm.marcher = mtmp;
monshoot(mtmp, otmp, mwep); /* multishot shooting or throwing */
g.marcher = g.mtarget = (struct monst *) 0;
gm.marcher = gm.mtarget = (struct monst *) 0;
nomul(0);
return MM_HIT;
}
@@ -837,7 +837,7 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg)
return MM_MISS;
}
if (m_lined_up(mtarg, mtmp)) {
boolean utarg = (mtarg == &g.youmonst);
boolean utarg = (mtarg == &gy.youmonst);
coordxy tx = utarg ? mtmp->mux : mtarg->mx;
coordxy ty = utarg ? mtmp->muy : mtarg->my;
@@ -857,10 +857,10 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg)
if (canseemon(mtmp))
pline("%s spits venom!", Monnam(mtmp));
if (!utarg)
g.mtarget = mtarg;
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby),
gm.mtarget = mtarg;
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(gt.tbx), sgn(gt.tby),
distmin(mtmp->mx,mtmp->my,tx,ty), otmp);
g.mtarget = (struct monst *)0;
gm.mtarget = (struct monst *)0;
nomul(0);
/* If this is a pet, it'll get hungry. Minions and
@@ -920,12 +920,12 @@ breamm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg)
if (!mtmp->mspec_used && rn2(3)) {
if (BZ_VALID_ADTYP(typ)) {
boolean utarget = (mtarg == &g.youmonst);
boolean utarget = (mtarg == &gy.youmonst);
if (canseemon(mtmp))
pline("%s breathes %s!",
Monnam(mtmp), breathwep_name(typ));
dobuzz(BZ_M_BREATH(BZ_OFS_AD(typ)), (int) mattk->damn,
mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby), utarget);
mtmp->mx, mtmp->my, sgn(gt.tbx), sgn(gt.tby), utarget);
nomul(0);
/* breath runs out sometimes. Also, give monster some
* cunning; don't breath if the target fell asleep.
@@ -1024,11 +1024,11 @@ thrwmu(struct monst* mtmp)
obj_is_pname(otmp) ? the(onm) : an(onm));
}
dam = dmgval(otmp, &g.youmonst);
dam = dmgval(otmp, &gy.youmonst);
hitv = 3 - distmin(u.ux, u.uy, mtmp->mx, mtmp->my);
if (hitv < -4)
hitv = -4;
if (bigmonst(g.youmonst.data))
if (bigmonst(gy.youmonst.data))
hitv++;
hitv += 8 + otmp->spe;
if (dam < 1)
@@ -1060,14 +1060,14 @@ thrwmu(struct monst* mtmp)
int
spitmu(struct monst* mtmp, struct attack* mattk)
{
return spitmm(mtmp, mattk, &g.youmonst);
return spitmm(mtmp, mattk, &gy.youmonst);
}
/* monster breathes at you (ranged) */
int
breamu(struct monst* mtmp, struct attack* mattk)
{
return breamm(mtmp, mattk, &g.youmonst);
return breamm(mtmp, mattk, &gy.youmonst);
}
/* Move from (ax,ay) to (bx,by), but only if distance is up to BOLT_LIM
@@ -1085,17 +1085,17 @@ linedup_callback(
int dx, dy;
/* These two values are set for use after successful return. */
g.tbx = ax - bx;
g.tby = ay - by;
gt.tbx = ax - bx;
gt.tby = ay - by;
/* sometimes displacement makes a monster think that you're at its
own location; prevent it from throwing and zapping in that case */
if (!g.tbx && !g.tby)
if (!gt.tbx && !gt.tby)
return FALSE;
/* straight line, orthogonal to the map or diagonal */
if ((!g.tbx || !g.tby || abs(g.tbx) == abs(g.tby))
&& distmin(g.tbx, g.tby, 0, 0) < BOLT_LIM) {
if ((!gt.tbx || !gt.tby || abs(gt.tbx) == abs(gt.tby))
&& distmin(gt.tbx, gt.tby, 0, 0) < BOLT_LIM) {
dx = sgn(ax - bx), dy = sgn(ay - by);
do {
/* <bx,by> is guaranteed to eventually converge with <ax,ay> */
@@ -1123,17 +1123,17 @@ linedup(
int dx, dy, boulderspots;
/* These two values are set for use after successful return. */
g.tbx = ax - bx;
g.tby = ay - by;
gt.tbx = ax - bx;
gt.tby = ay - by;
/* sometimes displacement makes a monster think that you're at its
own location; prevent it from throwing and zapping in that case */
if (!g.tbx && !g.tby)
if (!gt.tbx && !gt.tby)
return FALSE;
/* straight line, orthogonal to the map or diagonal */
if ((!g.tbx || !g.tby || abs(g.tbx) == abs(g.tby))
&& distmin(g.tbx, g.tby, 0, 0) < BOLT_LIM) {
if ((!gt.tbx || !gt.tby || abs(gt.tbx) == abs(gt.tby))
&& distmin(gt.tbx, gt.tby, 0, 0) < BOLT_LIM) {
if (u_at(ax, ay) ? (boolean) couldsee(bx, by)
: clear_path(ax, ay, bx, by))
return TRUE;
@@ -1162,7 +1162,7 @@ linedup(
static int
m_lined_up(struct monst* mtarg, struct monst* mtmp)
{
boolean utarget = (mtarg == &g.youmonst);
boolean utarget = (mtarg == &gy.youmonst);
coordxy tx = utarget ? mtmp->mux : mtarg->mx;
coordxy ty = utarget ? mtmp->muy : mtarg->my;
boolean ignore_boulders = utarget && (throws_rocks(mtmp->data)
@@ -1184,7 +1184,7 @@ m_lined_up(struct monst* mtarg, struct monst* mtmp)
boolean
lined_up(register struct monst* mtmp)
{
return m_lined_up(&g.youmonst, mtmp) ? TRUE : FALSE;
return m_lined_up(&gy.youmonst, mtmp) ? TRUE : FALSE;
}
/* check if a monster is carrying an item of a particular type */
@@ -1193,7 +1193,7 @@ m_carrying(struct monst *mtmp, int type)
{
register struct obj *otmp;
for (otmp = (mtmp == &g.youmonst) ? g.invent : mtmp->minvent; otmp;
for (otmp = (mtmp == &gy.youmonst) ? gi.invent : mtmp->minvent; otmp;
otmp = otmp->nobj)
if (otmp->otyp == type)
break;
+214 -214
View File
File diff suppressed because it is too large Load Diff
+13 -13
View File
@@ -155,7 +155,7 @@ awaken_soldiers(struct monst* bugler /* monster that played instrument */)
int distance, distm;
/* distance of affected non-soldier monsters to bugler */
distance = ((bugler == &g.youmonst) ? u.ulevel : bugler->data->mlevel) * 30;
distance = ((bugler == &gy.youmonst) ? u.ulevel : bugler->data->mlevel) * 30;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
@@ -169,7 +169,7 @@ awaken_soldiers(struct monst* bugler /* monster that played instrument */)
else if (!Deaf)
Norep("%s the rattle of battle gear being readied.",
"You hear"); /* Deaf-aware */
} else if ((distm = ((bugler == &g.youmonst)
} else if ((distm = ((bugler == &gy.youmonst)
? mdistu(mtmp)
: dist2(bugler->mx, bugler->my, mtmp->mx,
mtmp->my))) < distance) {
@@ -400,7 +400,7 @@ do_earthquake(int force)
Your("chain breaks!");
reset_utrap(TRUE);
}
if (Levitation || Flying || is_clinger(g.youmonst.data)) {
if (Levitation || Flying || is_clinger(gy.youmonst.data)) {
if (!tu_pit) { /* no pit here previously */
pline("A chasm opens up under you!");
You("don't fall in!");
@@ -426,8 +426,8 @@ do_earthquake(int force)
if (keepfooting)
exercise(A_DEX, TRUE);
else
selftouch((Upolyd && (slithy(g.youmonst.data)
|| nolimbs(g.youmonst.data)))
selftouch((Upolyd && (slithy(gy.youmonst.data)
|| nolimbs(gy.youmonst.data)))
? "Shaken, you"
: "Falling down, you");
}
@@ -620,7 +620,7 @@ do_improvisation(struct obj* instr)
You("extract a loud noise from %s.", yname(instr));
else
You("blow into the bugle.");
awaken_soldiers(&g.youmonst);
awaken_soldiers(&gy.youmonst);
exercise(A_WIS, FALSE);
break;
case MAGIC_HARP: /* Charm monsters */
@@ -672,7 +672,7 @@ do_improvisation(struct obj* instr)
rn2(2) ? "butcher" : rn2(2) ? "manage" : "pull off",
an(beats[rn2(SIZE(beats))]));
awaken_monsters(u.ulevel * (mundane ? 5 : 40));
g.context.botl = TRUE;
gc.context.botl = TRUE;
break;
default:
impossible("What a weird instrument (%d)!", instr->otyp);
@@ -698,7 +698,7 @@ do_play_instrument(struct obj* instr)
} else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE
|| instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN
|| instr->otyp == FIRE_HORN || instr->otyp == BUGLE)
&& !can_blow(&g.youmonst)) {
&& !can_blow(&gy.youmonst)) {
You("are incapable of playing %s.", thesimpleoname(instr));
return ECMD_OK;
}
@@ -715,7 +715,7 @@ do_play_instrument(struct obj* instr)
if (c == 'q') {
goto nevermind;
} else if (c == 'y') {
Strcpy(buf, g.tune);
Strcpy(buf, gt.tune);
} else {
getlin("What tune are you playing? [5 notes, A-G]", buf);
(void) mungspaces(buf);
@@ -739,7 +739,7 @@ do_play_instrument(struct obj* instr)
*/
if (Is_stronghold(&u.uz)) {
exercise(A_WIS, TRUE); /* just for trying */
if (!strcmp(buf, g.tune)) {
if (!strcmp(buf, gt.tune)) {
/* Search for the drawbridge */
for (y = u.uy - 1; y <= u.uy + 1; y++)
for (x = u.ux - 1; x <= u.ux + 1; x++) {
@@ -779,13 +779,13 @@ do_play_instrument(struct obj* instr)
for (x = 0; x < (int) strlen(buf); x++)
if (x < 5) {
if (buf[x] == g.tune[x]) {
if (buf[x] == gt.tune[x]) {
gears++;
matched[x] = TRUE;
} else {
for (y = 0; y < 5; y++)
if (!matched[y] && buf[x] == g.tune[y]
&& buf[y] != g.tune[y]) {
if (!matched[y] && buf[x] == gt.tune[y]
&& buf[y] != gt.tune[y]) {
tumblers++;
matched[y] = TRUE;
break;
+1 -1
View File
@@ -374,7 +374,7 @@ l_obj_at(lua_State *L)
cvt_to_abscoord(&x, &y);
lua_pop(L, 2);
(void) l_obj_push(L, g.level.objects[x][y]);
(void) l_obj_push(L, gl.level.objects[x][y]);
return 1;
} else
nhl_error(L, "l_obj_at: Wrong args");

Some files were not shown because too many files have changed in this diff Show More