Another round of instance globals changes.

This commit is contained in:
Bart House
2018-12-24 16:43:50 -08:00
parent e5e906dc3b
commit 572ee347b9
78 changed files with 946 additions and 975 deletions
+34 -21
View File
@@ -103,7 +103,6 @@ E struct dgn_topology { /* special dungeon levels for speed */
E NEARDATA char tune[6]; E NEARDATA char tune[6];
#define MAXLINFO (MAXDUNGEON * MAXLEVEL) #define MAXLINFO (MAXDUNGEON * MAXLEVEL)
E struct linfo level_info[MAXLINFO];
E NEARDATA struct sinfo { E NEARDATA struct sinfo {
int gameover; /* self explanatory? */ int gameover; /* self explanatory? */
@@ -144,11 +143,6 @@ E NEARDATA struct kinfo {
char name[BUFSZ]; /* actual killer name */ char name[BUFSZ]; /* actual killer name */
} killer; } killer;
E NEARDATA char dogname[];
E NEARDATA char catname[];
E NEARDATA char horsename[];
E char preferred_pet;
E char lock[]; E char lock[];
E const schar xdir[], ydir[], zdir[]; E const schar xdir[], ydir[], zdir[];
@@ -162,12 +156,9 @@ struct multishot {
E NEARDATA long moves, monstermoves; E NEARDATA long moves, monstermoves;
E NEARDATA long wailmsg; E NEARDATA long wailmsg;
E NEARDATA boolean in_steed_dismounting;
E const int shield_static[]; E const int shield_static[];
#include "spell.h" #include "spell.h"
E NEARDATA struct spell spl_book[]; /* sized in decl.c */
#include "color.h" #include "color.h"
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
@@ -188,7 +179,6 @@ E NEARDATA struct obj *uchain; /* defined only when punished */
E NEARDATA struct obj *uball; E NEARDATA struct obj *uball;
E NEARDATA struct obj *migrating_objs; E NEARDATA struct obj *migrating_objs;
E NEARDATA struct obj *billobjs; E NEARDATA struct obj *billobjs;
E NEARDATA struct obj *current_wand, *thrownobj, *kickedobj;
E NEARDATA struct obj zeroobj; /* for init; &zeroobj used as special value */ E NEARDATA struct obj zeroobj; /* for init; &zeroobj used as special value */
@@ -206,13 +196,12 @@ E NEARDATA struct u_realtime urealtime;
E NEARDATA struct monst zeromonst; /* for init of new or temp monsters */ E NEARDATA struct monst zeromonst; /* for init of new or temp monsters */
E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */ E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */
E NEARDATA struct monst *mydogs, *migrating_mons;
E NEARDATA struct mvitals { struct mvitals {
uchar born; uchar born;
uchar died; uchar died;
uchar mvflags; uchar mvflags;
} mvitals[NUMMONS]; };
E NEARDATA struct c_color_names { E NEARDATA struct c_color_names {
const char *const c_black, *const c_amber, *const c_golden, const char *const c_black, *const c_amber, *const c_golden,
@@ -268,10 +257,6 @@ E const char *materialnm[];
#define EXACT_NAME 0x0F #define EXACT_NAME 0x0F
#define SUPPRESS_NAME 0x10 #define SUPPRESS_NAME 0x10
/* Vision */
E NEARDATA boolean vision_full_recalc; /* TRUE if need vision recalc */
E NEARDATA char **viz_array; /* could see/in sight row pointers */
/* Window system stuff */ /* Window system stuff */
E NEARDATA winid WIN_MESSAGE; E NEARDATA winid WIN_MESSAGE;
E NEARDATA winid WIN_STATUS; E NEARDATA winid WIN_STATUS;
@@ -286,7 +271,6 @@ E NEARDATA winid WIN_MAP, WIN_INVEN;
#define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr) #define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr)
#define panic1(cstr) panic("%s", cstr) #define panic1(cstr) panic("%s", cstr)
E char toplines[];
#ifndef TCAP_H #ifndef TCAP_H
E struct tc_gbl_data { /* also declared in tcap.h */ E struct tc_gbl_data { /* also declared in tcap.h */
char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */ char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */
@@ -365,8 +349,6 @@ struct plinemsg_type {
/* bitmask for callers of hide_unhide_msgtypes() */ /* bitmask for callers of hide_unhide_msgtypes() */
#define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW)) #define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW))
E struct plinemsg_type *plinemsg_types;
#ifdef PANICTRACE #ifdef PANICTRACE
E const char *ARGV0; E const char *ARGV0;
#endif #endif
@@ -689,6 +671,24 @@ struct instance_globals {
boolean stoned; /* done to monsters hit by 'c' */ boolean stoned; /* done to monsters hit by 'c' */
boolean unweapon; boolean unweapon;
boolean mrg_to_wielded; /* weapon picked is merged with wielded one */ boolean mrg_to_wielded; /* weapon picked is merged with wielded one */
struct plinemsg_type *plinemsg_types;
char toplines[TBUFSZ];
struct mkroom *upstairs_room;
struct mkroom *dnstairs_room;
struct mkroom *sstairs_room;
coord bhitpos; /* place where throw or zap hits or stops */
boolean in_steed_dismounting;
coord doors[DOORMAX];
struct menucoloring *menu_colorings;
schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */
struct spell spl_book[MAXSPELL + 1];
struct linfo level_info[MAXLINFO];
struct trap *ftrap;
/* some objects need special handling during destruction or placement */
struct obj *current_wand; /* wand currently zapped/applied */
struct obj *thrownobj; /* object in flight due to throwing */
struct obj *kickedobj; /* object in flight due to kicking */
/* dig.c */ /* dig.c */
@@ -721,6 +721,13 @@ struct instance_globals {
xchar gtyp; /* type of dog's current goal */ xchar gtyp; /* type of dog's current goal */
xchar gx; /* x position of dog's current goal */ xchar gx; /* x position of dog's current goal */
char gy; /* y position of dog's current goal */ char gy; /* y position of dog's current goal */
char dogname[PL_PSIZ];
char catname[PL_PSIZ];
char horsename[PL_PSIZ];
char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */
struct monst *mydogs; /* monsters that went down/up together with @ */
struct monst *migrating_mons; /* monsters moving to another level */
struct mvitals mvitals[NUMMONS];
/* dokick.c */ /* dokick.c */
struct rm *maploc; struct rm *maploc;
@@ -975,7 +982,7 @@ struct instance_globals {
/* spells.c */ /* spells.c */
int spl_sortmode; /* index into spl_sortchoices[] */ int spl_sortmode; /* index into spl_sortchoices[] */
int *spl_orderindx; /* array of spl_book[] indices */ int *spl_orderindx; /* array of g.spl_book[] indices */
/* timeout.c */ /* timeout.c */
/* ordered timer list */ /* ordered timer list */
@@ -1010,6 +1017,12 @@ struct instance_globals {
boolean override_confirmation; /* Used to flag attacks caused by boolean override_confirmation; /* Used to flag attacks caused by
Stormbringer's maliciousness. */ Stormbringer's maliciousness. */
/* vision.c */
char **viz_array; /* used in cansee() and couldsee() macros */
char *viz_rmin; /* min could see indices */
char *viz_rmax; /* max could see indices */
boolean vision_full_recalc;
/* weapon.c */ /* weapon.c */
struct obj *propellor; struct obj *propellor;
+1 -1
View File
@@ -322,7 +322,7 @@ struct savefile_info {
#define BUFSZ 256 /* for getlin buffers */ #define BUFSZ 256 /* for getlin buffers */
#define QBUFSZ 128 /* for building question text */ #define QBUFSZ 128 /* for building question text */
#define TBUFSZ 300 /* toplines[] buffer max msg: 3 81char names */ #define TBUFSZ 300 /* g.toplines[] buffer max msg: 3 81char names */
/* plus longest prefix plus a few extra words */ /* plus longest prefix plus a few extra words */
#define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
+1 -3
View File
@@ -214,8 +214,6 @@ typedef struct {
#include "decl.h" #include "decl.h"
#include "timeout.h" #include "timeout.h"
NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
/* types of calls to bhit() */ /* types of calls to bhit() */
enum bhit_call_types { enum bhit_call_types {
ZAPPED_WAND = 0, ZAPPED_WAND = 0,
@@ -357,7 +355,7 @@ typedef struct sortloot_item Loot;
/* Flags to control find_mid() */ /* Flags to control find_mid() */
#define FM_FMON 0x01 /* search the fmon chain */ #define FM_FMON 0x01 /* search the fmon chain */
#define FM_MIGRATE 0x02 /* search the migrating monster chain */ #define FM_MIGRATE 0x02 /* search the migrating monster chain */
#define FM_MYDOGS 0x04 /* search mydogs */ #define FM_MYDOGS 0x04 /* search g.mydogs */
#define FM_EVERYWHERE (FM_FMON | FM_MIGRATE | FM_MYDOGS) #define FM_EVERYWHERE (FM_FMON | FM_MIGRATE | FM_MYDOGS)
/* Flags to control pick_[race,role,gend,align] routines in role.c */ /* Flags to control pick_[race,role,gend,align] routines in role.c */
-4
View File
@@ -47,10 +47,6 @@ extern NEARDATA struct mkroom *subrooms;
* there is at most one non-vault special room on a level * there is at most one non-vault special room on a level
*/ */
extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;
extern NEARDATA coord doors[DOORMAX];
/* values for rtype in the room definition structure */ /* values for rtype in the room definition structure */
enum roomtype_types { enum roomtype_types {
OROOM = 0, /* ordinary room */ OROOM = 0, /* ordinary room */
+1 -1
View File
@@ -186,7 +186,7 @@
#define G_NOCORPSE 0x0010 /* no corpse left ever */ #define G_NOCORPSE 0x0010 /* no corpse left ever */
#define G_FREQ 0x0007 /* creation frequency mask */ #define G_FREQ 0x0007 /* creation frequency mask */
/* for mvitals[].mvflags (variant during game), along with G_NOCORPSE */ /* for g.mvitals[].mvflags (variant during game), along with G_NOCORPSE */
#define G_KNOWN 0x0004 /* have been encountered */ #define G_KNOWN 0x0004 /* have been encountered */
#define G_GONE (G_GENOD | G_EXTINCT) #define G_GONE (G_GENOD | G_EXTINCT)
#define G_GENOD 0x0002 /* have been genocided */ #define G_GENOD 0x0002 /* have been genocided */
+1 -3
View File
@@ -345,7 +345,7 @@ extern const struct symdef def_warnsyms[WARNCOUNT];
#define CLEAR_FOUNTAIN_LOOTED(x, y) levl[x][y].looted &= ~F_LOOTED; #define CLEAR_FOUNTAIN_LOOTED(x, y) levl[x][y].looted &= ~F_LOOTED;
/* /*
* Doors are even worse :-) The special warning has a side effect * doors are even worse :-) The special warning has a side effect
* of instantly trapping the door, and if it was defined as trapped, * of instantly trapping the door, and if it was defined as trapped,
* the guards consider that you have already been warned! * the guards consider that you have already been warned!
*/ */
@@ -596,8 +596,6 @@ typedef struct {
struct levelflags flags; struct levelflags flags;
} dlevel_t; } dlevel_t;
extern schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */
extern dlevel_t level; /* structure describing the current level */ extern dlevel_t level; /* structure describing the current level */
/* /*
+3 -3
View File
@@ -20,8 +20,8 @@ struct spell {
#define ALL_MAP 0x1 #define ALL_MAP 0x1
#define ALL_SPELLS 0x2 #define ALL_SPELLS 0x2
#define decrnknow(spell) spl_book[spell].sp_know-- #define decrnknow(spell) g.spl_book[spell].sp_know--
#define spellid(spell) spl_book[spell].sp_id #define spellid(spell) g.spl_book[spell].sp_id
#define spellknow(spell) spl_book[spell].sp_know #define spellknow(spell) g.spl_book[spell].sp_know
#endif /* SPELL_H */ #endif /* SPELL_H */
-1
View File
@@ -37,7 +37,6 @@ struct trap {
#define tnote vl.v_tnote #define tnote vl.v_tnote
}; };
extern struct trap *ftrap;
#define newtrap() (struct trap *) alloc(sizeof(struct trap)) #define newtrap() (struct trap *) alloc(sizeof(struct trap))
#define dealloc_trap(trap) free((genericptr_t)(trap)) #define dealloc_trap(trap) free((genericptr_t)(trap))
+3 -9
View File
@@ -5,12 +5,6 @@
#ifndef VISION_H #ifndef VISION_H
#define VISION_H #define VISION_H
#if 0 /* (moved to decl.h) */
extern boolean vision_full_recalc; /* TRUE if need vision recalc */
extern char **viz_array; /* could see/in sight row pointers */
extern char *viz_rmin; /* min could see indices */
extern char *viz_rmax; /* max could see indices */
#endif
#define COULD_SEE 0x1 /* location could be seen, if it were lit */ #define COULD_SEE 0x1 /* location could be seen, if it were lit */
#define IN_SIGHT 0x2 /* location can be seen */ #define IN_SIGHT 0x2 /* location can be seen */
#define TEMP_LIT 0x4 /* location is temporarily lit */ #define TEMP_LIT 0x4 /* location is temporarily lit */
@@ -27,9 +21,9 @@ extern char *viz_rmax; /* max could see indices */
* couldsee() - Returns true if the hero has a clear line of sight to * couldsee() - Returns true if the hero has a clear line of sight to
* the location. * the location.
*/ */
#define cansee(x, y) (viz_array[y][x] & IN_SIGHT) #define cansee(x, y) (g.viz_array[y][x] & IN_SIGHT)
#define couldsee(x, y) (viz_array[y][x] & COULD_SEE) #define couldsee(x, y) (g.viz_array[y][x] & COULD_SEE)
#define templit(x, y) (viz_array[y][x] & TEMP_LIT) #define templit(x, y) (g.viz_array[y][x] & TEMP_LIT)
/* /*
* The following assume the monster is not blind. * The following assume the monster is not blind.
+3 -3
View File
@@ -346,7 +346,7 @@ boolean resuming;
} else if (Warning || Warn_of_mon) } else if (Warning || Warn_of_mon)
see_monsters(); see_monsters();
if (vision_full_recalc) if (g.vision_full_recalc)
vision_recalc(0); /* vision! */ vision_recalc(0); /* vision! */
} }
if (context.botl || context.botlx) { if (context.botl || context.botlx) {
@@ -425,7 +425,7 @@ boolean resuming;
else if (flags.time && (!context.move || !context.mv)) else if (flags.time && (!context.move || !context.mv))
context.botl = 1; context.botl = 1;
if (vision_full_recalc) if (g.vision_full_recalc)
vision_recalc(0); /* vision! */ vision_recalc(0); /* vision! */
/* when running in non-tport mode, this gets done through domove() */ /* when running in non-tport mode, this gets done through domove() */
if ((!context.run || flags.runmode == RUN_TPORT) if ((!context.run || flags.runmode == RUN_TPORT)
@@ -576,7 +576,7 @@ newgame()
context.tribute.tributesz = sizeof(struct tribute_info); context.tribute.tributesz = sizeof(struct tribute_info);
for (i = LOW_PM; i < NUMMONS; i++) for (i = LOW_PM; i < NUMMONS; i++)
mvitals[i].mvflags = mons[i].geno & G_NOCORPSE; g.mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
init_objects(); /* must be before u_init() */ init_objects(); /* must be before u_init() */
+23 -23
View File
@@ -322,7 +322,7 @@ register struct obj *obj;
context.stethoscope_move = moves; context.stethoscope_move = moves;
context.stethoscope_movement = youmonst.movement; context.stethoscope_movement = youmonst.movement;
bhitpos.x = u.ux, bhitpos.y = u.uy; /* tentative, reset below */ g.bhitpos.x = u.ux, g.bhitpos.y = u.uy; /* tentative, reset below */
g.notonhead = u.uswallow; g.notonhead = u.uswallow;
if (u.usteed && u.dz > 0) { if (u.usteed && u.dz > 0) {
if (interference) { if (interference) {
@@ -370,8 +370,8 @@ register struct obj *obj;
const char *mnm = x_monnam(mtmp, ARTICLE_A, (const char *) 0, const char *mnm = x_monnam(mtmp, ARTICLE_A, (const char *) 0,
SUPPRESS_IT | SUPPRESS_INVISIBLE, FALSE); SUPPRESS_IT | SUPPRESS_INVISIBLE, FALSE);
/* bhitpos needed by mstatusline() iff mtmp is a long worm */ /* g.bhitpos needed by mstatusline() iff mtmp is a long worm */
bhitpos.x = rx, bhitpos.y = ry; g.bhitpos.x = rx, g.bhitpos.y = ry;
g.notonhead = (mtmp->mx != rx || mtmp->my != ry); g.notonhead = (mtmp->mx != rx || mtmp->my != ry);
if (mtmp->mundetected) { if (mtmp->mundetected) {
@@ -1010,9 +1010,9 @@ struct obj **optr;
#endif #endif
if (obj->cursed && !rn2(4) if (obj->cursed && !rn2(4)
/* note: once any of them are gone, we stop all of them */ /* note: once any of them are gone, we stop all of them */
&& !(mvitals[PM_WOOD_NYMPH].mvflags & G_GONE) && !(g.mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
&& !(mvitals[PM_WATER_NYMPH].mvflags & G_GONE) && !(g.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
&& !(mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE) && !(g.mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE)
&& (mtmp = makemon(mkclass(S_NYMPH, 0), u.ux, u.uy, NO_MINVENT)) && (mtmp = makemon(mkclass(S_NYMPH, 0), u.ux, u.uy, NO_MINVENT))
!= 0) { != 0) {
You("summon %s!", a_monnam(mtmp)); You("summon %s!", a_monnam(mtmp));
@@ -1639,9 +1639,9 @@ int magic; /* 0=Physical, otherwise skill level */
int sp_no; int sp_no;
for (sp_no = 0; sp_no < MAXSPELL; ++sp_no) for (sp_no = 0; sp_no < MAXSPELL; ++sp_no)
if (spl_book[sp_no].sp_id == NO_SPELL) if (g.spl_book[sp_no].sp_id == NO_SPELL)
break; break;
else if (spl_book[sp_no].sp_id == SPE_JUMPING) else if (g.spl_book[sp_no].sp_id == SPE_JUMPING)
return spelleffects(sp_no, FALSE); return spelleffects(sp_no, FALSE);
} }
@@ -2729,7 +2729,7 @@ struct obj *obj;
You("yank yourself out of the pit!"); You("yank yourself out of the pit!");
teleds(cc.x, cc.y, TRUE); teleds(cc.x, cc.y, TRUE);
reset_utrap(TRUE); reset_utrap(TRUE);
vision_full_recalc = 1; g.vision_full_recalc = 1;
} }
} else { } else {
pline1(msg_slipsfree); pline1(msg_slipsfree);
@@ -3018,19 +3018,19 @@ struct obj *obj;
context.polearm.hitmon = (struct monst *) 0; context.polearm.hitmon = (struct monst *) 0;
/* Attack the monster there */ /* Attack the monster there */
bhitpos = cc; g.bhitpos = cc;
if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != (struct monst *) 0) { if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != (struct monst *) 0) {
if (attack_checks(mtmp, uwep)) if (attack_checks(mtmp, uwep))
return res; return res;
if (overexertion()) if (overexertion())
return 1; /* burn nutrition; maybe pass out */ return 1; /* burn nutrition; maybe pass out */
context.polearm.hitmon = mtmp; context.polearm.hitmon = mtmp;
check_caitiff(mtmp); check_caitiff(mtmp);
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my); g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
(void) thitmonst(mtmp, uwep); (void) thitmonst(mtmp, uwep);
} else if (glyph_is_statue(glyph) /* might be hallucinatory */ } else if (glyph_is_statue(glyph) /* might be hallucinatory */
&& sobj_at(STATUE, bhitpos.x, bhitpos.y)) { && sobj_at(STATUE, g.bhitpos.x, g.bhitpos.y)) {
struct trap *t = t_at(bhitpos.x, bhitpos.y); struct trap *t = t_at(g.bhitpos.x, g.bhitpos.y);
if (t && t->ttyp == STATUE_TRAP if (t && t->ttyp == STATUE_TRAP
&& activate_statue_trap(t, t->tx, t->ty, FALSE)) { && activate_statue_trap(t, t->tx, t->ty, FALSE)) {
@@ -3042,11 +3042,11 @@ struct obj *obj;
because the player is probably attempting to attack it; because the player is probably attempting to attack it;
other statues obscured by anything are just ignored. */ other statues obscured by anything are just ignored. */
pline("Thump! Your blow bounces harmlessly off the statue."); pline("Thump! Your blow bounces harmlessly off the statue.");
wake_nearto(bhitpos.x, bhitpos.y, 25); wake_nearto(g.bhitpos.x, g.bhitpos.y, 25);
} }
} else { } else {
/* no monster here and no statue seen or remembered here */ /* no monster here and no statue seen or remembered here */
(void) unmap_invisible(bhitpos.x, bhitpos.y); (void) unmap_invisible(g.bhitpos.x, g.bhitpos.y);
You("miss; there is no one there to hit."); You("miss; there is no one there to hit.");
} }
u_wipe_engr(2); /* same as for melee or throwing */ u_wipe_engr(2); /* same as for melee or throwing */
@@ -3191,10 +3191,10 @@ struct obj *obj;
} }
break; break;
case 2: /* Monster */ case 2: /* Monster */
bhitpos = cc; g.bhitpos = cc;
if ((mtmp = m_at(cc.x, cc.y)) == (struct monst *) 0) if ((mtmp = m_at(cc.x, cc.y)) == (struct monst *) 0)
break; break;
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my); g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
save_confirm = flags.confirm; save_confirm = flags.confirm;
if (verysmall(mtmp->data) && !rn2(4) if (verysmall(mtmp->data) && !rn2(4)
&& enexto(&cc, u.ux, u.uy, (struct permonst *) 0)) { && enexto(&cc, u.ux, u.uy, (struct permonst *) 0)) {
@@ -3280,7 +3280,7 @@ struct obj *obj;
costly_alteration(obj, COST_DSTROY); costly_alteration(obj, COST_DSTROY);
} }
current_wand = obj; /* destroy_item might reset this */ g.current_wand = obj; /* destroy_item might reset this */
freeinv(obj); /* hide it from destroy_item instead... */ freeinv(obj); /* hide it from destroy_item instead... */
setnotworn(obj); /* so we need to do this ourselves */ setnotworn(obj); /* so we need to do this ourselves */
@@ -3358,8 +3358,8 @@ struct obj *obj;
/* this makes it hit us last, so that we can see the action first */ /* this makes it hit us last, so that we can see the action first */
for (i = 0; i <= 8; i++) { for (i = 0; i <= 8; i++) {
bhitpos.x = x = obj->ox + xdir[i]; g.bhitpos.x = x = obj->ox + xdir[i];
bhitpos.y = y = obj->oy + ydir[i]; g.bhitpos.y = y = obj->oy + ydir[i];
if (!isok(x, y)) if (!isok(x, y))
continue; continue;
@@ -3458,8 +3458,8 @@ struct obj *obj;
litroom(TRUE, obj); /* only needs to be done once */ litroom(TRUE, obj); /* only needs to be done once */
discard_broken_wand: discard_broken_wand:
obj = current_wand; /* [see dozap() and destroy_item()] */ obj = g.current_wand; /* [see dozap() and destroy_item()] */
current_wand = 0; g.current_wand = 0;
if (obj) if (obj)
delobj(obj); delobj(obj);
nomul(0); nomul(0);
+1 -1
View File
@@ -599,7 +599,7 @@ long wp_mask;
u.xray_range = 3; u.xray_range = 3;
else else
u.xray_range = -1; u.xray_range = -1;
vision_full_recalc = 1; g.vision_full_recalc = 1;
} }
if ((spfx & SPFX_REFLECT) && (wp_mask & W_WEP)) { if ((spfx & SPFX_REFLECT) && (wp_mask & W_WEP)) {
if (on) if (on)
+1 -1
View File
@@ -752,7 +752,7 @@ xchar x, y;
u.ux = x - u.dx; u.ux = x - u.dx;
u.uy = y - u.dy; u.uy = y - u.dy;
} }
vision_full_recalc = 1; /* hero has moved, recalculate vision later */ g.vision_full_recalc = 1; /* hero has moved, recalculate vision later */
if (Blind) { if (Blind) {
/* drop glyph under the chain */ /* drop glyph under the chain */
+3 -3
View File
@@ -312,7 +312,7 @@ can_make_bones()
} }
if (!Is_branchlev(&u.uz)) { if (!Is_branchlev(&u.uz)) {
/* no bones on non-branches with portals */ /* no bones on non-branches with portals */
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap)
if (ttmp->ttyp == MAGIC_PORTAL) if (ttmp->ttyp == MAGIC_PORTAL)
return FALSE; return FALSE;
} }
@@ -451,7 +451,7 @@ make_bones:
if (mtmp->mtame) if (mtmp->mtame)
mtmp->mtame = mtmp->mpeaceful = 0; mtmp->mtame = mtmp->mpeaceful = 0;
} }
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) { for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) {
ttmp->madeby_u = 0; ttmp->madeby_u = 0;
ttmp->tseen = (ttmp->ttyp == HOLE); ttmp->tseen = (ttmp->ttyp == HOLE);
} }
@@ -468,7 +468,7 @@ make_bones:
levl[x][y].seenv = 0; levl[x][y].seenv = 0;
levl[x][y].waslit = 0; levl[x][y].waslit = 0;
levl[x][y].glyph = cmap_to_glyph(S_stone); levl[x][y].glyph = cmap_to_glyph(S_stone);
lastseentyp[x][y] = 0; g.lastseentyp[x][y] = 0;
} }
/* Attach bones info to the current level before saving. */ /* Attach bones info to the current level before saving. */
+12 -12
View File
@@ -802,7 +802,7 @@ wiz_makemap(VOID_ARGS)
savelev(-1, ledger_no(&u.uz), FREE_SAVE); savelev(-1, ledger_no(&u.uz), FREE_SAVE);
mklev(); mklev();
vision_reset(); vision_reset();
vision_full_recalc = 1; g.vision_full_recalc = 1;
cls(); cls();
(void) safe_teleds(TRUE); (void) safe_teleds(TRUE);
if (Punished) { if (Punished) {
@@ -824,7 +824,7 @@ wiz_map(VOID_ARGS)
long save_Hconf = HConfusion, save_Hhallu = HHallucination; long save_Hconf = HConfusion, save_Hhallu = HHallucination;
HConfusion = HHallucination = 0L; HConfusion = HHallucination = 0L;
for (t = ftrap; t != 0; t = t->ntrap) { for (t = g.ftrap; t != 0; t = t->ntrap) {
t->tseen = 1; t->tseen = 1;
map_trap(t, TRUE); map_trap(t, TRUE);
} }
@@ -1008,11 +1008,11 @@ wiz_show_vision(VOID_ARGS)
if (x == u.ux && y == u.uy) if (x == u.ux && y == u.uy)
row[x] = '@'; row[x] = '@';
else { else {
v = viz_array[y][x]; /* data access should be hidden */ v = g.viz_array[y][x]; /* data access should be hidden */
if (v == 0) if (v == 0)
row[x] = ' '; row[x] = ' ';
else else
row[x] = '0' + viz_array[y][x]; row[x] = '0' + g.viz_array[y][x];
} }
} }
/* remove trailing spaces */ /* remove trailing spaces */
@@ -3754,7 +3754,7 @@ long *total_size;
* inventory */ * inventory */
for (mon = fmon; mon; mon = mon->nmon) for (mon = fmon; mon; mon = mon->nmon)
count_obj(mon->minvent, &count, &size, FALSE, TRUE); count_obj(mon->minvent, &count, &size, FALSE, TRUE);
for (mon = migrating_mons; mon; mon = mon->nmon) for (mon = g.migrating_mons; mon; mon = mon->nmon)
count_obj(mon->minvent, &count, &size, FALSE, TRUE); count_obj(mon->minvent, &count, &size, FALSE, TRUE);
if (count || size) { if (count || size) {
@@ -3806,7 +3806,7 @@ long *total_size;
char buf[BUFSZ]; char buf[BUFSZ];
long count, size; long count, size;
struct monst *mon; struct monst *mon;
/* mon->wormno means something different for migrating_mons and mydogs */ /* mon->wormno means something different for g.migrating_mons and g.mydogs */
boolean incl_wsegs = !strcmpi(src, "fmon"); boolean incl_wsegs = !strcmpi(src, "fmon");
count = size = 0L; count = size = 0L;
@@ -3840,7 +3840,7 @@ long *total_size;
* others only if nonzero * others only if nonzero
*/ */
count = size = 0L; count = size = 0L;
for (tt = ftrap; tt; tt = tt->ntrap) { for (tt = g.ftrap; tt; tt = tt->ntrap) {
++count; ++count;
size += (long) sizeof *tt; size += (long) sizeof *tt;
} }
@@ -3970,7 +3970,7 @@ wiz_show_stats()
obj_chain(win, "billobjs", billobjs, FALSE, obj_chain(win, "billobjs", billobjs, FALSE,
&total_obj_count, &total_obj_size); &total_obj_count, &total_obj_size);
mon_invent_chain(win, "minvent", fmon, &total_obj_count, &total_obj_size); mon_invent_chain(win, "minvent", fmon, &total_obj_count, &total_obj_size);
mon_invent_chain(win, "migrating minvent", migrating_mons, mon_invent_chain(win, "migrating minvent", g.migrating_mons,
&total_obj_count, &total_obj_size); &total_obj_count, &total_obj_size);
contained_stats(win, "contained", &total_obj_count, &total_obj_size); contained_stats(win, "contained", &total_obj_count, &total_obj_size);
putstr(win, 0, stats_sep); putstr(win, 0, stats_sep);
@@ -3982,12 +3982,12 @@ wiz_show_stats()
Sprintf(buf, " Monsters, base size %ld", (long) sizeof (struct monst)); Sprintf(buf, " Monsters, base size %ld", (long) sizeof (struct monst));
putstr(win, 0, buf); putstr(win, 0, buf);
mon_chain(win, "fmon", fmon, TRUE, &total_mon_count, &total_mon_size); mon_chain(win, "fmon", fmon, TRUE, &total_mon_count, &total_mon_size);
mon_chain(win, "migrating", migrating_mons, FALSE, mon_chain(win, "migrating", g.migrating_mons, FALSE,
&total_mon_count, &total_mon_size); &total_mon_count, &total_mon_size);
/* 'mydogs' is only valid during level change or end of game disclosure, /* 'g.mydogs' is only valid during level change or end of game disclosure,
but conceivably we've been called from within debugger at such time */ but conceivably we've been called from within debugger at such time */
if (mydogs) /* monsters accompanying hero */ if (g.mydogs) /* monsters accompanying hero */
mon_chain(win, "mydogs", mydogs, FALSE, mon_chain(win, "mydogs", g.mydogs, FALSE,
&total_mon_count, &total_mon_size); &total_mon_count, &total_mon_size);
putstr(win, 0, stats_sep); putstr(win, 0, stats_sep);
Sprintf(buf, template, " Mon total", total_mon_count, total_mon_size); Sprintf(buf, template, " Mon total", total_mon_count, total_mon_size);
+30 -42
View File
@@ -46,8 +46,6 @@ const char *alllevels = "levels.*";
const char *allbones = "bones*.*"; const char *allbones = "bones*.*";
#endif #endif
struct linfo level_info[MAXLINFO];
NEARDATA struct sinfo program_state; NEARDATA struct sinfo program_state;
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */ /* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */
@@ -55,17 +53,10 @@ const schar xdir[10] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 }; const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 }; const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
NEARDATA boolean in_steed_dismounting = FALSE;
NEARDATA coord bhitpos = DUMMY;
NEARDATA coord doors[DOORMAX] = { DUMMY };
NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2] = { DUMMY }; NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2] = { DUMMY };
NEARDATA struct mkroom *subrooms = &rooms[MAXNROFROOMS + 1]; NEARDATA struct mkroom *subrooms = &rooms[MAXNROFROOMS + 1];
struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room;
dlevel_t level; /* level map */ dlevel_t level; /* level map */
struct trap *ftrap = (struct trap *) 0;
NEARDATA struct monst youmonst = DUMMY; NEARDATA struct monst youmonst = DUMMY;
NEARDATA struct context_info context = DUMMY; NEARDATA struct context_info context = DUMMY;
NEARDATA struct flag flags = DUMMY; NEARDATA struct flag flags = DUMMY;
@@ -77,10 +68,6 @@ NEARDATA struct you u = DUMMY;
NEARDATA time_t ubirthday = DUMMY; NEARDATA time_t ubirthday = DUMMY;
NEARDATA struct u_realtime urealtime = DUMMY; NEARDATA struct u_realtime urealtime = DUMMY;
schar lastseentyp[COLNO][ROWNO] = {
DUMMY
}; /* last seen/touched dungeon typ */
NEARDATA struct obj NEARDATA struct obj
*invent = (struct obj *) 0, *invent = (struct obj *) 0,
*uwep = (struct obj *) 0, *uarm = (struct obj *) 0, *uwep = (struct obj *) 0, *uarm = (struct obj *) 0,
@@ -94,11 +81,6 @@ NEARDATA struct obj
*uright = (struct obj *) 0, *uleft = (struct obj *) 0, *uright = (struct obj *) 0, *uleft = (struct obj *) 0,
*ublindf = (struct obj *) 0, *uchain = (struct obj *) 0, *ublindf = (struct obj *) 0, *uchain = (struct obj *) 0,
*uball = (struct obj *) 0; *uball = (struct obj *) 0;
/* some objects need special handling during destruction or placement */
NEARDATA struct obj
*current_wand = 0, /* wand currently zapped/applied */
*thrownobj = 0, /* object in flight due to throwing */
*kickedobj = 0; /* object in flight due to kicking */
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
/* /*
@@ -122,8 +104,6 @@ const int shield_static[SHIELD_COUNT] = {
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
}; };
NEARDATA struct spell spl_book[MAXSPELL + 1] = { DUMMY };
NEARDATA long moves = 1L, monstermoves = 1L; NEARDATA long moves = 1L, monstermoves = 1L;
/* These diverge when player is Fast */ /* These diverge when player is Fast */
NEARDATA long wailmsg = 0L; NEARDATA long wailmsg = 0L;
@@ -139,25 +119,11 @@ NEARDATA struct monst zeromonst = DUMMY;
/* used to zero out union any; initializer deliberately omitted */ /* used to zero out union any; initializer deliberately omitted */
NEARDATA anything zeroany; NEARDATA anything zeroany;
/* originally from dog.c */
NEARDATA char dogname[PL_PSIZ] = DUMMY;
NEARDATA char catname[PL_PSIZ] = DUMMY;
NEARDATA char horsename[PL_PSIZ] = DUMMY;
char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */
/* monsters that went down/up together with @ */
NEARDATA struct monst *mydogs = (struct monst *) 0;
/* monsters that are moving to another dungeon level */
NEARDATA struct monst *migrating_mons = (struct monst *) 0;
NEARDATA struct mvitals mvitals[NUMMONS];
NEARDATA struct c_color_names c_color_names = { NEARDATA struct c_color_names c_color_names = {
"black", "amber", "golden", "light blue", "red", "green", "black", "amber", "golden", "light blue", "red", "green",
"silver", "blue", "purple", "white", "orange" "silver", "blue", "purple", "white", "orange"
}; };
struct menucoloring *menu_colorings = NULL;
const char *c_obj_colors[] = { const char *c_obj_colors[] = {
"black", /* CLR_BLACK */ "black", /* CLR_BLACK */
"red", /* CLR_RED */ "red", /* CLR_RED */
@@ -197,15 +163,11 @@ const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
"platinum", "mithril", "plastic", "glass", "platinum", "mithril", "plastic", "glass",
"gemstone", "stone" }; "gemstone", "stone" };
/* Vision */
NEARDATA boolean vision_full_recalc = 0;
NEARDATA char **viz_array = 0; /* used in cansee() and couldsee() macros */
/* Global windowing data, defined here for multi-window-system support */ /* Global windowing data, defined here for multi-window-system support */
NEARDATA winid WIN_MESSAGE = WIN_ERR; NEARDATA winid WIN_MESSAGE = WIN_ERR;
NEARDATA winid WIN_STATUS = WIN_ERR; NEARDATA winid WIN_STATUS = WIN_ERR;
NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR; NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
char toplines[TBUFSZ];
/* Windowing stuff that's really tty oriented, but present for all ports */ /* Windowing stuff that's really tty oriented, but present for all ports */
struct tc_gbl_data tc_gbl_data = { 0, 0, 0, 0 }; /* AS,AE, LI,CO */ struct tc_gbl_data tc_gbl_data = { 0, 0, 0, 0 }; /* AS,AE, LI,CO */
@@ -246,8 +208,6 @@ const struct savefile_info default_sfinfo = {
NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo; NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
struct plinemsg_type *plinemsg_types = (struct plinemsg_type *) 0;
#ifdef PANICTRACE #ifdef PANICTRACE
const char *ARGV0; const char *ARGV0;
#endif #endif
@@ -347,7 +307,22 @@ const struct instance_globals g_init = {
FALSE, /* stoned */ FALSE, /* stoned */
FALSE, /* unweapon */ FALSE, /* unweapon */
FALSE, /* mrg_to_wielded */ FALSE, /* mrg_to_wielded */
NULL, /* plinemsg_types */
UNDEFINED_VALUES, /* toplines */
UNDEFINED_PTR, /* upstairs_room */
UNDEFINED_PTR, /* dnstairs_room */
UNDEFINED_PTR, /* sstairs_room */
DUMMY, /* bhitpos */
FALSE, /* in_steed_dismounting */
DUMMY, /* doors */
NULL, /* menu_colorings */
DUMMY, /* lastseentyp */
DUMMY, /* spl_book */
UNDEFINED_VALUES, /* level_info */
NULL, /* ftrap */
NULL, /* current_wand */
NULL, /* thrownobj */
NULL, /* kickedobj */
/* dig.c */ /* dig.c */
UNDEFINED_VALUE, /* did_dig_msg */ UNDEFINED_VALUE, /* did_dig_msg */
@@ -376,6 +351,13 @@ const struct instance_globals g_init = {
UNDEFINED_VALUE, /* gtyp */ UNDEFINED_VALUE, /* gtyp */
UNDEFINED_VALUE, /* gx */ UNDEFINED_VALUE, /* gx */
UNDEFINED_VALUE, /* gy */ UNDEFINED_VALUE, /* gy */
DUMMY, /* dogname */
DUMMY, /* catname */
DUMMY, /* horsename */
UNDEFINED_VALUE, /* preferred_pet */
NULL, /* mydogs */
NULL, /* migrating_mons */
UNDEFINED_VALUES, /* mvitals */
/* dokick.c */ /* dokick.c */
UNDEFINED_PTR, /* maploc */ UNDEFINED_PTR, /* maploc */
@@ -616,6 +598,12 @@ const struct instance_globals g_init = {
/* uhitm.c */ /* uhitm.c */
UNDEFINED_VALUE, /* override_confirmation */ UNDEFINED_VALUE, /* override_confirmation */
/* vision.c */
NULL, /* viz_array */
NULL, /* viz_rmin */
NULL, /* viz_rmax */
FALSE, /* vision_full_recalc */
/* weapon.c */ /* weapon.c */
UNDEFINED_PTR, /* propellor */ UNDEFINED_PTR, /* propellor */
+10 -10
View File
@@ -939,7 +939,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */
u.usteed->mx = u.ux, u.usteed->my = u.uy; u.usteed->mx = u.ux, u.usteed->my = u.uy;
/* floor/ceiling traps */ /* floor/ceiling traps */
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) { for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) {
if (ttmp->tx != u.ux || ttmp->ty != u.uy) if (ttmp->tx != u.ux || ttmp->ty != u.uy)
goto outtrapmap; goto outtrapmap;
else else
@@ -972,7 +972,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */
found = TRUE; found = TRUE;
/* door traps */ /* door traps */
for (door = 0; door < g.doorindex; door++) { for (door = 0; door < g.doorindex; door++) {
cc = doors[door]; cc = g.doors[door];
if (levl[cc.x][cc.y].doormask & D_TRAPPED) { if (levl[cc.x][cc.y].doormask & D_TRAPPED) {
if (cc.x != u.ux || cc.y != u.uy) if (cc.x != u.ux || cc.y != u.uy)
goto outtrapmap; goto outtrapmap;
@@ -1006,11 +1006,11 @@ outtrapmap:
} }
(void) detect_obj_traps(invent, TRUE, cursed_src); (void) detect_obj_traps(invent, TRUE, cursed_src);
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap)
sense_trap(ttmp, 0, 0, cursed_src); sense_trap(ttmp, 0, 0, cursed_src);
for (door = 0; door < g.doorindex; door++) { for (door = 0; door < g.doorindex; door++) {
cc = doors[door]; cc = g.doors[door];
if (levl[cc.x][cc.y].doormask & D_TRAPPED) if (levl[cc.x][cc.y].doormask & D_TRAPPED)
sense_trap((struct trap *) 0, cc.x, cc.y, cursed_src); sense_trap((struct trap *) 0, cc.x, cc.y, cursed_src);
} }
@@ -1341,9 +1341,9 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
*/ */
/* if hero is engulfed, show engulfer at <u.ux,u.uy> */ /* if hero is engulfed, show engulfer at <u.ux,u.uy> */
save_viz_uyux = viz_array[u.uy][u.ux]; save_viz_uyux = g.viz_array[u.uy][u.ux];
if (u.uswallow) if (u.uswallow)
viz_array[u.uy][u.ux] |= IN_SIGHT; /* <x,y> are reversed to [y][x] */ g.viz_array[u.uy][u.ux] |= IN_SIGHT; /* <x,y> are reversed to [y][x] */
save_EDetect_mons = EDetect_monsters; save_EDetect_mons = EDetect_monsters;
/* for skilled spell, getpos() scanning of the map will display all /* for skilled spell, getpos() scanning of the map will display all
monsters within range; otherwise, "unseen creature" will be shown */ monsters within range; otherwise, "unseen creature" will be shown */
@@ -1401,7 +1401,7 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
} }
reconstrain_map(); reconstrain_map();
EDetect_monsters = save_EDetect_mons; EDetect_monsters = save_EDetect_mons;
viz_array[u.uy][u.ux] = save_viz_uyux; g.viz_array[u.uy][u.ux] = save_viz_uyux;
/* replace monsters with remembered,unseen monster, then run /* replace monsters with remembered,unseen monster, then run
see_monsters() to update visible ones and warned-of ones */ see_monsters() to update visible ones and warned-of ones */
@@ -1787,7 +1787,7 @@ sokoban_detect()
} }
/* Map the traps */ /* Map the traps */
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) { for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) {
ttmp->tseen = 1; ttmp->tseen = 1;
map_trap(ttmp, 1); map_trap(ttmp, 1);
/* set sokoban_rules when there is at least one pit or hole */ /* set sokoban_rules when there is at least one pit or hole */
@@ -1846,7 +1846,7 @@ int default_glyph, which_subset;
|| glyph_is_invisible(glyph)) { || glyph_is_invisible(glyph)) {
if (!seenv) { if (!seenv) {
glyph = default_glyph; glyph = default_glyph;
} else if (lastseentyp[x][y] == levl[x][y].typ) { } else if (g.lastseentyp[x][y] == levl[x][y].typ) {
glyph = back_to_glyph(x, y); glyph = back_to_glyph(x, y);
} else { } else {
/* look for a mimic here posing as furniture; /* look for a mimic here posing as furniture;
@@ -1864,7 +1864,7 @@ int default_glyph, which_subset;
but we've got no other choice) */ but we've got no other choice) */
schar save_typ = levl[x][y].typ; schar save_typ = levl[x][y].typ;
levl[x][y].typ = lastseentyp[x][y]; levl[x][y].typ = g.lastseentyp[x][y];
glyph = back_to_glyph(x, y); glyph = back_to_glyph(x, y);
levl[x][y].typ = save_typ; levl[x][y].typ = save_typ;
} }
+3 -3
View File
@@ -78,7 +78,7 @@ boolean waslit, rockit;
lev->waslit = (rockit ? FALSE : TRUE); lev->waslit = (rockit ? FALSE : TRUE);
lev->horizontal = FALSE; lev->horizontal = FALSE;
/* short-circuit vision recalc */ /* short-circuit vision recalc */
viz_array[y][x] = (dist < 3) ? (IN_SIGHT | COULD_SEE) : COULD_SEE; g.viz_array[y][x] = (dist < 3) ? (IN_SIGHT | COULD_SEE) : COULD_SEE;
lev->typ = (rockit ? STONE : ROOM); /* flags set via doormask above */ lev->typ = (rockit ? STONE : ROOM); /* flags set via doormask above */
if (dist >= 3) if (dist >= 3)
impossible("mkcavepos called with dist %d", dist); impossible("mkcavepos called with dist %d", dist);
@@ -133,7 +133,7 @@ register boolean rockit;
newsym(u.ux, u.uy); /* in case player is invisible */ newsym(u.ux, u.uy); /* in case player is invisible */
} }
vision_full_recalc = 1; /* everything changed */ g.vision_full_recalc = 1; /* everything changed */
} }
/* When digging into location <x,y>, what are you actually digging into? */ /* When digging into location <x,y>, what are you actually digging into? */
@@ -618,7 +618,7 @@ int ttyp;
if (at_u) { if (at_u) {
if (!wont_fall) { if (!wont_fall) {
set_utrap(rn1(4, 2), TT_PIT); set_utrap(rn1(4, 2), TT_PIT);
vision_full_recalc = 1; /* vision limits change */ g.vision_full_recalc = 1; /* vision limits change */
} else } else
reset_utrap(TRUE); reset_utrap(TRUE);
if (oldobjs != newobjs) /* something unearthed */ if (oldobjs != newobjs) /* something unearthed */
+4 -4
View File
@@ -139,7 +139,7 @@ STATIC_DCL void FDECL(set_seenv, (struct rm *, int, int, int, int));
STATIC_DCL void FDECL(t_warn, (struct rm *)); STATIC_DCL void FDECL(t_warn, (struct rm *));
STATIC_DCL int FDECL(wall_angle, (struct rm *)); STATIC_DCL int FDECL(wall_angle, (struct rm *));
#define remember_topology(x, y) (lastseentyp[x][y] = levl[x][y].typ) #define remember_topology(x, y) (g.lastseentyp[x][y] = levl[x][y].typ)
/* /*
* magic_map_background() * magic_map_background()
@@ -413,7 +413,7 @@ xchar worm_tail; /* mon is actually a worm tail */
if (!sensed) { if (!sensed) {
show_glyph(x, y, glyph); show_glyph(x, y, glyph);
/* override real topology with mimic's fake one */ /* override real topology with mimic's fake one */
lastseentyp[x][y] = cmap_to_type(sym); g.lastseentyp[x][y] = cmap_to_type(sym);
} }
break; break;
} }
@@ -588,7 +588,7 @@ xchar x, y;
* *
* + Stone, walls, and closed doors. * + Stone, walls, and closed doors.
* + Boulders. [see a boulder before a doorway] * + Boulders. [see a boulder before a doorway]
* + Doors. * + doors.
* + Room/water positions * + Room/water positions
* + Everything else (hallways!) * + Everything else (hallways!)
*/ */
@@ -1301,7 +1301,7 @@ see_traps()
struct trap *trap; struct trap *trap;
int glyph; int glyph;
for (trap = ftrap; trap; trap = trap->ntrap) { for (trap = g.ftrap; trap; trap = trap->ntrap) {
glyph = glyph_at(trap->tx, trap->ty); glyph = glyph_at(trap->tx, trap->ty);
if (glyph_is_trap(glyph)) if (glyph_is_trap(glyph))
newsym(trap->tx, trap->ty); newsym(trap->tx, trap->ty);
+9 -9
View File
@@ -99,7 +99,7 @@ boolean pushing;
if (fills_up && u.uinwater && distu(rx, ry) == 0) { if (fills_up && u.uinwater && distu(rx, ry) == 0) {
u.uinwater = 0; u.uinwater = 0;
docrt(); docrt();
vision_full_recalc = 1; g.vision_full_recalc = 1;
You("find yourself on dry land again!"); You("find yourself on dry land again!");
} else if (lava && distu(rx, ry) <= 2) { } else if (lava && distu(rx, ry) <= 2) {
int dmg; int dmg;
@@ -1327,11 +1327,11 @@ boolean at_stairs, falling, portal;
(void) memset((genericptr_t) &g.updest, 0, sizeof g.updest); (void) memset((genericptr_t) &g.updest, 0, sizeof g.updest);
(void) memset((genericptr_t) &g.dndest, 0, sizeof g.dndest); (void) memset((genericptr_t) &g.dndest, 0, sizeof g.dndest);
if (!(level_info[new_ledger].flags & LFILE_EXISTS)) { if (!(g.level_info[new_ledger].flags & LFILE_EXISTS)) {
/* entering this level for first time; make it now */ /* entering this level for first time; make it now */
if (level_info[new_ledger].flags & (FORGOTTEN | VISITED)) { if (g.level_info[new_ledger].flags & (FORGOTTEN | VISITED)) {
impossible("goto_level: returning to discarded level?"); impossible("goto_level: returning to discarded level?");
level_info[new_ledger].flags &= ~(FORGOTTEN | VISITED); g.level_info[new_ledger].flags &= ~(FORGOTTEN | VISITED);
} }
mklev(); mklev();
new = TRUE; /* made the level */ new = TRUE; /* made the level */
@@ -1350,14 +1350,14 @@ boolean at_stairs, falling, portal;
reglyph_darkroom(); reglyph_darkroom();
/* do this prior to level-change pline messages */ /* do this prior to level-change pline messages */
vision_reset(); /* clear old level's line-of-sight */ vision_reset(); /* clear old level's line-of-sight */
vision_full_recalc = 0; /* don't let that reenable vision yet */ g.vision_full_recalc = 0; /* don't let that reenable vision yet */
flush_screen(-1); /* ensure all map flushes are postponed */ flush_screen(-1); /* ensure all map flushes are postponed */
if (portal && !In_endgame(&u.uz)) { if (portal && !In_endgame(&u.uz)) {
/* find the portal on the new level */ /* find the portal on the new level */
register struct trap *ttrap; register struct trap *ttrap;
for (ttrap = ftrap; ttrap; ttrap = ttrap->ntrap) for (ttrap = g.ftrap; ttrap; ttrap = ttrap->ntrap)
if (ttrap->ttyp == MAGIC_PORTAL) if (ttrap->ttyp == MAGIC_PORTAL)
break; break;
@@ -1472,11 +1472,11 @@ boolean at_stairs, falling, portal;
else if (Is_firelevel(&u.uz)) else if (Is_firelevel(&u.uz))
fumaroles(); fumaroles();
if (level_info[new_ledger].flags & FORGOTTEN) { if (g.level_info[new_ledger].flags & FORGOTTEN) {
forget_map(ALL_MAP); /* forget the map */ forget_map(ALL_MAP); /* forget the map */
forget_traps(); /* forget all traps too */ forget_traps(); /* forget all traps too */
familiar = TRUE; familiar = TRUE;
level_info[new_ledger].flags &= ~FORGOTTEN; g.level_info[new_ledger].flags &= ~FORGOTTEN;
} }
/* Reset the screen. */ /* Reset the screen. */
@@ -1554,7 +1554,7 @@ boolean at_stairs, falling, portal;
pline_The("heat and smoke are gone."); pline_The("heat and smoke are gone.");
} else if (Is_knox(&u.uz)) { } else if (Is_knox(&u.uz)) {
/* alarm stops working once Croesus has died */ /* alarm stops working once Croesus has died */
if (new || !mvitals[PM_CROESUS].died) { if (new || !g.mvitals[PM_CROESUS].died) {
You("have penetrated a high security area!"); You("have penetrated a high security area!");
pline("An alarm sounds!"); pline("An alarm sounds!");
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
+2 -2
View File
@@ -913,7 +913,7 @@ const char *goal;
goto foundc; goto foundc;
} }
/* last, try actual terrain here (shouldn't /* last, try actual terrain here (shouldn't
we be using lastseentyp[][] instead?) */ we be using g.lastseentyp[][] instead?) */
if (levl[tx][ty].seenv) { if (levl[tx][ty].seenv) {
k = back_to_glyph(tx, ty); k = back_to_glyph(tx, ty);
if (glyph_is_cmap(k) if (glyph_is_cmap(k)
@@ -1066,7 +1066,7 @@ const char *name;
int lth; int lth;
char buf[PL_PSIZ]; char buf[PL_PSIZ];
/* dogname & catname are PL_PSIZ arrays; object names have same limit */ /* g.dogname & g.catname are PL_PSIZ arrays; object names have same limit */
lth = (name && *name) ? ((int) strlen(name) + 1) : 0; lth = (name && *name) ? ((int) strlen(name) + 1) : 0;
if (lth > PL_PSIZ) { if (lth > PL_PSIZ) {
lth = PL_PSIZ; lth = PL_PSIZ;
+24 -24
View File
@@ -63,9 +63,9 @@ pet_type()
{ {
if (urole.petnum != NON_PM) if (urole.petnum != NON_PM)
return urole.petnum; return urole.petnum;
else if (preferred_pet == 'c') else if (g.preferred_pet == 'c')
return PM_KITTEN; return PM_KITTEN;
else if (preferred_pet == 'd') else if (g.preferred_pet == 'd')
return PM_LITTLE_DOG; return PM_LITTLE_DOG;
else else
return rn2(2) ? PM_KITTEN : PM_LITTLE_DOG; return rn2(2) ? PM_KITTEN : PM_LITTLE_DOG;
@@ -89,7 +89,7 @@ boolean quietly;
/* activating a figurine provides one way to exceed the /* activating a figurine provides one way to exceed the
maximum number of the target critter created--unless maximum number of the target critter created--unless
it has a special limit (erinys, Nazgul) */ it has a special limit (erinys, Nazgul) */
if ((mvitals[mndx].mvflags & G_EXTINCT) if ((g.mvitals[mndx].mvflags & G_EXTINCT)
&& mbirth_limit(mndx) != MAXMONNO) { && mbirth_limit(mndx) != MAXMONNO) {
if (!quietly) if (!quietly)
/* have just been given "You <do something with> /* have just been given "You <do something with>
@@ -161,16 +161,16 @@ makedog()
const char *petname; const char *petname;
int pettype; int pettype;
if (preferred_pet == 'n') if (g.preferred_pet == 'n')
return ((struct monst *) 0); return ((struct monst *) 0);
pettype = pet_type(); pettype = pet_type();
if (pettype == PM_LITTLE_DOG) if (pettype == PM_LITTLE_DOG)
petname = dogname; petname = g.dogname;
else if (pettype == PM_PONY) else if (pettype == PM_PONY)
petname = horsename; petname = g.horsename;
else else
petname = catname; petname = g.catname;
/* default pet names */ /* default pet names */
if (!*petname && pettype == PM_LITTLE_DOG) { if (!*petname && pettype == PM_LITTLE_DOG) {
@@ -227,8 +227,8 @@ losedogs()
int dismissKops = 0; int dismissKops = 0;
/* /*
* First, scan migrating_mons for shopkeepers who want to dismiss Kops, * First, scan g.migrating_mons for shopkeepers who want to dismiss Kops,
* and scan mydogs for shopkeepers who want to retain kops. * and scan g.mydogs for shopkeepers who want to retain kops.
* Second, dismiss kops if warranted, making more room for arrival. * Second, dismiss kops if warranted, making more room for arrival.
* Third, place monsters accompanying the hero. * Third, place monsters accompanying the hero.
* Last, place migrating monsters coming to this level. * Last, place migrating monsters coming to this level.
@@ -240,7 +240,7 @@ losedogs()
*/ */
/* check for returning shk(s) */ /* check for returning shk(s) */
for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) { for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon) {
if (mtmp->mux != u.uz.dnum || mtmp->muy != u.uz.dlevel) if (mtmp->mux != u.uz.dnum || mtmp->muy != u.uz.dlevel)
continue; continue;
if (mtmp->isshk) { if (mtmp->isshk) {
@@ -256,11 +256,11 @@ losedogs()
} }
} }
} }
/* make the same check for mydogs */ /* make the same check for g.mydogs */
for (mtmp = mydogs; mtmp && dismissKops >= 0; mtmp = mtmp->nmon) { for (mtmp = g.mydogs; mtmp && dismissKops >= 0; mtmp = mtmp->nmon) {
if (mtmp->isshk) { if (mtmp->isshk) {
/* hostile shk might accompany hero [ESHK(mtmp)->dismiss_kops /* hostile shk might accompany hero [ESHK(mtmp)->dismiss_kops
can't be set here; it's only used for migrating_mons] */ can't be set here; it's only used for g.migrating_mons] */
if (!mtmp->mpeaceful) if (!mtmp->mpeaceful)
dismissKops = -1; dismissKops = -1;
} }
@@ -273,22 +273,22 @@ losedogs()
make_happy_shoppers(TRUE); make_happy_shoppers(TRUE);
/* place pets and/or any other monsters who accompany hero */ /* place pets and/or any other monsters who accompany hero */
while ((mtmp = mydogs) != 0) { while ((mtmp = g.mydogs) != 0) {
mydogs = mtmp->nmon; g.mydogs = mtmp->nmon;
mon_arrive(mtmp, TRUE); mon_arrive(mtmp, TRUE);
} }
/* time for migrating monsters to arrive; /* time for migrating monsters to arrive;
monsters who belong on this level but fail to arrive get put monsters who belong on this level but fail to arrive get put
back onto the list (at head), so traversing it is tricky */ back onto the list (at head), so traversing it is tricky */
for (mtmp = migrating_mons; mtmp; mtmp = mtmp2) { for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp2) {
mtmp2 = mtmp->nmon; mtmp2 = mtmp->nmon;
if (mtmp->mux == u.uz.dnum && mtmp->muy == u.uz.dlevel) { if (mtmp->mux == u.uz.dnum && mtmp->muy == u.uz.dlevel) {
/* remove mtmp from migrating_mons list */ /* remove mtmp from g.migrating_mons list */
if (mtmp == migrating_mons) { if (mtmp == g.migrating_mons) {
migrating_mons = mtmp->nmon; g.migrating_mons = mtmp->nmon;
} else { } else {
for (mtmp0 = migrating_mons; mtmp0; mtmp0 = mtmp0->nmon) for (mtmp0 = g.migrating_mons; mtmp0; mtmp0 = mtmp0->nmon)
if (mtmp0->nmon == mtmp) { if (mtmp0->nmon == mtmp) {
mtmp0->nmon = mtmp->nmon; mtmp0->nmon = mtmp->nmon;
break; break;
@@ -407,7 +407,7 @@ boolean with_you;
break; break;
} }
/* find the arrival portal */ /* find the arrival portal */
for (t = ftrap; t; t = t->ntrap) for (t = g.ftrap; t; t = t->ntrap)
if (t->ttyp == MAGIC_PORTAL) if (t->ttyp == MAGIC_PORTAL)
break; break;
if (t) { if (t) {
@@ -656,7 +656,7 @@ boolean pets_only; /* true for ascension or final escape */
obj->no_charge = 0; obj->no_charge = 0;
} }
relmon(mtmp, &mydogs); /* move it from map to mydogs */ relmon(mtmp, &g.mydogs); /* move it from map to g.mydogs */
mtmp->mx = mtmp->my = 0; /* avoid mnexto()/MON_AT() problem */ mtmp->mx = mtmp->my = 0; /* avoid mnexto()/MON_AT() problem */
mtmp->wormno = num_segs; mtmp->wormno = num_segs;
mtmp->mlstmv = monstermoves; mtmp->mlstmv = monstermoves;
@@ -710,7 +710,7 @@ coord *cc; /* optional destination coordinates */
mtmp->mtame--; mtmp->mtame--;
m_unleash(mtmp, TRUE); m_unleash(mtmp, TRUE);
} }
relmon(mtmp, &migrating_mons); /* move it from map to migrating_mons */ relmon(mtmp, &g.migrating_mons); /* move it from map to g.migrating_mons */
new_lev.dnum = ledger_to_dnum((xchar) tolev); new_lev.dnum = ledger_to_dnum((xchar) tolev);
new_lev.dlevel = ledger_to_dlev((xchar) tolev); new_lev.dlevel = ledger_to_dlev((xchar) tolev);
@@ -762,7 +762,7 @@ register struct obj *obj;
/* if there's a queen bee on the level, don't eat royal jelly; /* if there's a queen bee on the level, don't eat royal jelly;
if there isn't, do eat it and grow into a queen */ if there isn't, do eat it and grow into a queen */
if ((mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0) if ((g.mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
+70 -70
View File
@@ -9,7 +9,7 @@
(martial_bonus() || is_bigfoot(youmonst.data) \ (martial_bonus() || is_bigfoot(youmonst.data) \
|| (uarmf && uarmf->otyp == KICKING_BOOTS)) || (uarmf && uarmf->otyp == KICKING_BOOTS))
/* kickedobj (decl.c) tracks a kicked object until placed or destroyed */ /* g.kickedobj (decl.c) tracks a kicked object until placed or destroyed */
STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P)); STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P));
STATIC_DCL boolean FDECL(maybe_kick_monster, (struct monst *, STATIC_DCL boolean FDECL(maybe_kick_monster, (struct monst *,
@@ -128,8 +128,8 @@ xchar x, y;
if (mon) { if (mon) {
boolean save_forcefight = context.forcefight; boolean save_forcefight = context.forcefight;
bhitpos.x = x; g.bhitpos.x = x;
bhitpos.y = y; g.bhitpos.y = y;
if (!mon->mpeaceful || !canspotmon(mon)) if (!mon->mpeaceful || !canspotmon(mon))
context.forcefight = TRUE; /* attack even if invisible */ context.forcefight = TRUE; /* attack even if invisible */
/* kicking might be halted by discovery of hidden monster, /* kicking might be halted by discovery of hidden monster,
@@ -405,7 +405,7 @@ xchar x, y; /* coordinates where object was before the impact, not after */
insider = (*u.ushops && inside_shop(u.ux, u.uy) insider = (*u.ushops && inside_shop(u.ux, u.uy)
&& *in_rooms(x, y, SHOPBASE) == *u.ushops); && *in_rooms(x, y, SHOPBASE) == *u.ushops);
/* if dropped or thrown, shop ownership flags are set on this obj */ /* if dropped or thrown, shop ownership flags are set on this obj */
frominv = (obj != kickedobj); frominv = (obj != g.kickedobj);
for (otmp = obj->cobj; otmp; otmp = otmp2) { for (otmp = obj->cobj; otmp; otmp = otmp2) {
const char *result = (char *) 0; const char *result = (char *) 0;
@@ -463,12 +463,12 @@ char *kickobjnam;
*kickobjnam = '\0'; *kickobjnam = '\0';
/* if a pile, the "top" object gets kicked */ /* if a pile, the "top" object gets kicked */
kickedobj = level.objects[x][y]; g.kickedobj = level.objects[x][y];
if (kickedobj) { if (g.kickedobj) {
/* kick object; if doing is fatal, done() will clean up kickedobj */ /* kick object; if doing is fatal, done() will clean up g.kickedobj */
Strcpy(kickobjnam, killer_xname(kickedobj)); /* matters iff res==0 */ Strcpy(kickobjnam, killer_xname(g.kickedobj)); /* matters iff res==0 */
res = really_kick_object(x, y); res = really_kick_object(x, y);
kickedobj = (struct obj *) 0; g.kickedobj = (struct obj *) 0;
} }
return res; return res;
} }
@@ -484,9 +484,9 @@ xchar x, y;
char bhitroom; char bhitroom;
boolean costly, isgold, slide = FALSE; boolean costly, isgold, slide = FALSE;
/* kickedobj should always be set due to conditions of call */ /* g.kickedobj should always be set due to conditions of call */
if (!kickedobj || kickedobj->otyp == BOULDER || kickedobj == uball if (!g.kickedobj || g.kickedobj->otyp == BOULDER || g.kickedobj == uball
|| kickedobj == uchain) || g.kickedobj == uchain)
return 0; return 0;
if ((trap = t_at(x, y)) != 0) { if ((trap = t_at(x, y)) != 0) {
@@ -510,24 +510,24 @@ xchar x, y;
return 1; return 1;
} }
if (!uarmf && kickedobj->otyp == CORPSE if (!uarmf && g.kickedobj->otyp == CORPSE
&& touch_petrifies(&mons[kickedobj->corpsenm]) && !Stone_resistance) { && touch_petrifies(&mons[g.kickedobj->corpsenm]) && !Stone_resistance) {
You("kick %s with your bare %s.", You("kick %s with your bare %s.",
corpse_xname(kickedobj, (const char *) 0, CXN_PFX_THE), corpse_xname(g.kickedobj, (const char *) 0, CXN_PFX_THE),
makeplural(body_part(FOOT))); makeplural(body_part(FOOT)));
if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) { if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) {
; /* hero has been transformed but kick continues */ ; /* hero has been transformed but kick continues */
} else { } else {
/* normalize body shape here; foot, not body_part(FOOT) */ /* normalize body shape here; foot, not body_part(FOOT) */
Sprintf(killer.name, "kicking %s barefoot", Sprintf(killer.name, "kicking %s barefoot",
killer_xname(kickedobj)); killer_xname(g.kickedobj));
instapetrify(killer.name); instapetrify(killer.name);
} }
} }
/* range < 2 means the object will not move. */ /* range < 2 means the object will not move. */
/* maybe dexterity should also figure here. */ /* maybe dexterity should also figure here. */
range = (int) ((ACURRSTR) / 2 - kickedobj->owt / 40); range = (int) ((ACURRSTR) / 2 - g.kickedobj->owt / 40);
if (martial()) if (martial())
range += rnd(3); range += rnd(3);
@@ -541,12 +541,12 @@ xchar x, y;
} else { } else {
if (is_ice(x, y)) if (is_ice(x, y))
range += rnd(3), slide = TRUE; range += rnd(3), slide = TRUE;
if (kickedobj->greased) if (g.kickedobj->greased)
range += rnd(3), slide = TRUE; range += rnd(3), slide = TRUE;
} }
/* Mjollnir is magically too heavy to kick */ /* Mjollnir is magically too heavy to kick */
if (kickedobj->oartifact == ART_MJOLLNIR) if (g.kickedobj->oartifact == ART_MJOLLNIR)
range = 1; range = 1;
/* see if the object has a place to move into */ /* see if the object has a place to move into */
@@ -554,10 +554,10 @@ xchar x, y;
|| closed_door(x + u.dx, y + u.dy)) || closed_door(x + u.dx, y + u.dy))
range = 1; range = 1;
costly = (!(kickedobj->no_charge && !Has_contents(kickedobj)) costly = (!(g.kickedobj->no_charge && !Has_contents(g.kickedobj))
&& (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0 && (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0
&& costly_spot(x, y)); && costly_spot(x, y));
isgold = (kickedobj->oclass == COIN_CLASS); isgold = (g.kickedobj->oclass == COIN_CLASS);
if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) { if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) {
if ((!martial() && rn2(20) > ACURR(A_DEX)) if ((!martial() && rn2(20) > ACURR(A_DEX))
@@ -566,49 +566,49 @@ xchar x, y;
pline("It doesn't come loose."); pline("It doesn't come loose.");
else else
pline("%s %sn't come loose.", pline("%s %sn't come loose.",
The(distant_name(kickedobj, xname)), The(distant_name(g.kickedobj, xname)),
otense(kickedobj, "do")); otense(g.kickedobj, "do"));
return (!rn2(3) || martial()); return (!rn2(3) || martial());
} }
if (Blind) if (Blind)
pline("It comes loose."); pline("It comes loose.");
else else
pline("%s %s loose.", The(distant_name(kickedobj, xname)), pline("%s %s loose.", The(distant_name(g.kickedobj, xname)),
otense(kickedobj, "come")); otense(g.kickedobj, "come"));
obj_extract_self(kickedobj); obj_extract_self(g.kickedobj);
newsym(x, y); newsym(x, y);
if (costly && (!costly_spot(u.ux, u.uy) if (costly && (!costly_spot(u.ux, u.uy)
|| !index(u.urooms, *in_rooms(x, y, SHOPBASE)))) || !index(u.urooms, *in_rooms(x, y, SHOPBASE))))
addtobill(kickedobj, FALSE, FALSE, FALSE); addtobill(g.kickedobj, FALSE, FALSE, FALSE);
if (!flooreffects(kickedobj, u.ux, u.uy, "fall")) { if (!flooreffects(g.kickedobj, u.ux, u.uy, "fall")) {
place_object(kickedobj, u.ux, u.uy); place_object(g.kickedobj, u.ux, u.uy);
stackobj(kickedobj); stackobj(g.kickedobj);
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
return 1; return 1;
} }
/* a box gets a chance of breaking open here */ /* a box gets a chance of breaking open here */
if (Is_box(kickedobj)) { if (Is_box(g.kickedobj)) {
boolean otrp = kickedobj->otrapped; boolean otrp = g.kickedobj->otrapped;
if (range < 2) if (range < 2)
pline("THUD!"); pline("THUD!");
container_impact_dmg(kickedobj, x, y); container_impact_dmg(g.kickedobj, x, y);
if (kickedobj->olocked) { if (g.kickedobj->olocked) {
if (!rn2(5) || (martial() && !rn2(2))) { if (!rn2(5) || (martial() && !rn2(2))) {
You("break open the lock!"); You("break open the lock!");
breakchestlock(kickedobj, FALSE); breakchestlock(g.kickedobj, FALSE);
if (otrp) if (otrp)
(void) chest_trap(kickedobj, LEG, FALSE); (void) chest_trap(g.kickedobj, LEG, FALSE);
return 1; return 1;
} }
} else { } else {
if (!rn2(3) || (martial() && !rn2(2))) { if (!rn2(3) || (martial() && !rn2(2))) {
pline_The("lid slams open, then falls shut."); pline_The("lid slams open, then falls shut.");
kickedobj->lknown = 1; g.kickedobj->lknown = 1;
if (otrp) if (otrp)
(void) chest_trap(kickedobj, LEG, FALSE); (void) chest_trap(g.kickedobj, LEG, FALSE);
return 1; return 1;
} }
} }
@@ -618,7 +618,7 @@ xchar x, y;
} }
/* fragile objects should not be kicked */ /* fragile objects should not be kicked */
if (hero_breaks(kickedobj, kickedobj->ox, kickedobj->oy, FALSE)) if (hero_breaks(g.kickedobj, g.kickedobj->ox, g.kickedobj->oy, FALSE))
return 1; return 1;
/* too heavy to move. range is calculated as potential distance from /* too heavy to move. range is calculated as potential distance from
@@ -626,14 +626,14 @@ xchar x, y;
* from its current position * from its current position
*/ */
if (range < 2) { if (range < 2) {
if (!Is_box(kickedobj)) if (!Is_box(g.kickedobj))
pline("Thump!"); pline("Thump!");
return (!rn2(3) || martial()); return (!rn2(3) || martial());
} }
if (kickedobj->quan > 1L) { if (g.kickedobj->quan > 1L) {
if (!isgold) { if (!isgold) {
kickedobj = splitobj(kickedobj, 1L); g.kickedobj = splitobj(g.kickedobj, 1L);
} else { } else {
if (rn2(20)) { if (rn2(20)) {
static NEARDATA const char *const flyingcoinmsg[] = { static NEARDATA const char *const flyingcoinmsg[] = {
@@ -644,11 +644,11 @@ xchar x, y;
pline("Thwwpingg!"); pline("Thwwpingg!");
You("%s!", flyingcoinmsg[rn2(SIZE(flyingcoinmsg))]); You("%s!", flyingcoinmsg[rn2(SIZE(flyingcoinmsg))]);
(void) scatter(x, y, rn2(3) + 1, VIS_EFFECTS | MAY_HIT, (void) scatter(x, y, rn2(3) + 1, VIS_EFFECTS | MAY_HIT,
kickedobj); g.kickedobj);
newsym(x, y); newsym(x, y);
return 1; return 1;
} }
if (kickedobj->quan > 300L) { if (g.kickedobj->quan > 300L) {
pline("Thump!"); pline("Thump!");
return (!rn2(3) || martial()); return (!rn2(3) || martial());
} }
@@ -656,52 +656,52 @@ xchar x, y;
} }
if (slide && !Blind) if (slide && !Blind)
pline("Whee! %s %s across the %s.", Doname2(kickedobj), pline("Whee! %s %s across the %s.", Doname2(g.kickedobj),
otense(kickedobj, "slide"), surface(x, y)); otense(g.kickedobj, "slide"), surface(x, y));
if (costly && !isgold) if (costly && !isgold)
addtobill(kickedobj, FALSE, FALSE, TRUE); addtobill(g.kickedobj, FALSE, FALSE, TRUE);
obj_extract_self(kickedobj); obj_extract_self(g.kickedobj);
(void) snuff_candle(kickedobj); (void) snuff_candle(g.kickedobj);
newsym(x, y); newsym(x, y);
mon = bhit(u.dx, u.dy, range, KICKED_WEAPON, mon = bhit(u.dx, u.dy, range, KICKED_WEAPON,
(int FDECL((*), (MONST_P, OBJ_P))) 0, (int FDECL((*), (MONST_P, OBJ_P))) 0,
(int FDECL((*), (OBJ_P, OBJ_P))) 0, &kickedobj); (int FDECL((*), (OBJ_P, OBJ_P))) 0, &g.kickedobj);
if (!kickedobj) if (!g.kickedobj)
return 1; /* object broken */ return 1; /* object broken */
if (mon) { if (mon) {
if (mon->isshk && kickedobj->where == OBJ_MINVENT if (mon->isshk && g.kickedobj->where == OBJ_MINVENT
&& kickedobj->ocarry == mon) && g.kickedobj->ocarry == mon)
return 1; /* alert shk caught it */ return 1; /* alert shk caught it */
g.notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y); g.notonhead = (mon->mx != g.bhitpos.x || mon->my != g.bhitpos.y);
if (isgold ? ghitm(mon, kickedobj) /* caught? */ if (isgold ? ghitm(mon, g.kickedobj) /* caught? */
: thitmonst(mon, kickedobj)) /* hit && used up? */ : thitmonst(mon, g.kickedobj)) /* hit && used up? */
return 1; return 1;
} }
/* the object might have fallen down a hole; /* the object might have fallen down a hole;
ship_object() will have taken care of shop billing */ ship_object() will have taken care of shop billing */
if (kickedobj->where == OBJ_MIGRATING) if (g.kickedobj->where == OBJ_MIGRATING)
return 1; return 1;
bhitroom = *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE); bhitroom = *in_rooms(g.bhitpos.x, g.bhitpos.y, SHOPBASE);
if (costly && (!costly_spot(bhitpos.x, bhitpos.y) if (costly && (!costly_spot(g.bhitpos.x, g.bhitpos.y)
|| *in_rooms(x, y, SHOPBASE) != bhitroom)) { || *in_rooms(x, y, SHOPBASE) != bhitroom)) {
if (isgold) if (isgold)
costly_gold(x, y, kickedobj->quan); costly_gold(x, y, g.kickedobj->quan);
else else
(void) stolen_value(kickedobj, x, y, (boolean) shkp->mpeaceful, (void) stolen_value(g.kickedobj, x, y, (boolean) shkp->mpeaceful,
FALSE); FALSE);
} }
if (flooreffects(kickedobj, bhitpos.x, bhitpos.y, "fall")) if (flooreffects(g.kickedobj, g.bhitpos.x, g.bhitpos.y, "fall"))
return 1; return 1;
if (kickedobj->unpaid) if (g.kickedobj->unpaid)
subfrombill(kickedobj, shkp); subfrombill(g.kickedobj, shkp);
place_object(kickedobj, bhitpos.x, bhitpos.y); place_object(g.kickedobj, g.bhitpos.x, g.bhitpos.y);
stackobj(kickedobj); stackobj(g.kickedobj);
newsym(kickedobj->ox, kickedobj->oy); newsym(g.kickedobj->ox, g.kickedobj->oy);
return 1; return 1;
} }
@@ -1089,7 +1089,7 @@ dokick()
/* nothing, fruit or trouble? 75:23.5:1.5% */ /* nothing, fruit or trouble? 75:23.5:1.5% */
if (rn2(3)) { if (rn2(3)) {
if (!rn2(6) && !(mvitals[PM_KILLER_BEE].mvflags & G_GONE)) if (!rn2(6) && !(g.mvitals[PM_KILLER_BEE].mvflags & G_GONE))
You_hear("a low buzzing."); /* a warning */ You_hear("a low buzzing."); /* a warning */
goto ouch; goto ouch;
} }
@@ -1157,7 +1157,7 @@ dokick()
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return 1; return 1;
} else if (!(g.maploc->looted & S_LPUDDING) && !rn2(3) } else if (!(g.maploc->looted & S_LPUDDING) && !rn2(3)
&& !(mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) { && !(g.mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) {
if (Blind) if (Blind)
You_hear("a gushing sound."); You_hear("a gushing sound.");
else else
@@ -1169,7 +1169,7 @@ dokick()
g.maploc->looted |= S_LPUDDING; g.maploc->looted |= S_LPUDDING;
return 1; return 1;
} else if (!(g.maploc->looted & S_LDWASHER) && !rn2(3) } else if (!(g.maploc->looted & S_LDWASHER) && !rn2(3)
&& !(mvitals[washerndx].mvflags & G_GONE)) { && !(g.mvitals[washerndx].mvflags & G_GONE)) {
/* can't resist... */ /* can't resist... */
pline("%s returns!", (Blind ? Something : "The dish washer")); pline("%s returns!", (Blind ? Something : "The dish washer"));
if (makemon(&mons[washerndx], x, y, NO_MM_FLAGS)) if (makemon(&mons[washerndx], x, y, NO_MM_FLAGS))
+65 -65
View File
@@ -26,7 +26,7 @@ static NEARDATA const char toss_objs[] = { ALLOW_COUNT, COIN_CLASS,
static NEARDATA const char bullets[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, static NEARDATA const char bullets[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES,
GEM_CLASS, 0 }; GEM_CLASS, 0 };
/* thrownobj (decl.c) tracks an object until it lands */ /* g.thrownobj (decl.c) tracks an object until it lands */
/* Throw the selected object, asking for direction */ /* Throw the selected object, asking for direction */
STATIC_OVL int STATIC_OVL int
@@ -1041,12 +1041,12 @@ boolean hitsroof;
You("turn to stone."); You("turn to stone.");
if (obj) if (obj)
dropy(obj); /* bypass most of hitfloor() */ dropy(obj); /* bypass most of hitfloor() */
thrownobj = 0; /* now either gone or on floor */ g.thrownobj = 0; /* now either gone or on floor */
done(STONING); done(STONING);
return obj ? TRUE : FALSE; return obj ? TRUE : FALSE;
} }
hitfloor(obj, TRUE); hitfloor(obj, TRUE);
thrownobj = 0; g.thrownobj = 0;
losehp(Maybe_Half_Phys(dmg), "falling object", KILLED_BY_AN); losehp(Maybe_Half_Phys(dmg), "falling object", KILLED_BY_AN);
} }
return TRUE; return TRUE;
@@ -1071,8 +1071,8 @@ sho_obj_return_to_u(obj)
struct obj *obj; struct obj *obj;
{ {
/* might already be our location (bounced off a wall) */ /* might already be our location (bounced off a wall) */
if ((u.dx || u.dy) && (bhitpos.x != u.ux || bhitpos.y != u.uy)) { if ((u.dx || u.dy) && (g.bhitpos.x != u.ux || g.bhitpos.y != u.uy)) {
int x = bhitpos.x - u.dx, y = bhitpos.y - u.dy; int x = g.bhitpos.x - u.dx, y = g.bhitpos.y - u.dy;
tmp_at(DISP_FLASH, obj_to_glyph(obj)); tmp_at(DISP_FLASH, obj_to_glyph(obj));
while (isok(x,y) && (x != u.ux || y != u.uy)) { while (isok(x,y) && (x != u.ux || y != u.uy)) {
@@ -1135,13 +1135,13 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
u.dz = 1; u.dz = 1;
} }
thrownobj = obj; g.thrownobj = obj;
thrownobj->was_thrown = 1; g.thrownobj->was_thrown = 1;
if (u.uswallow) { if (u.uswallow) {
mon = u.ustuck; mon = u.ustuck;
bhitpos.x = mon->mx; g.bhitpos.x = mon->mx;
bhitpos.y = mon->my; g.bhitpos.y = mon->my;
if (tethered_weapon) if (tethered_weapon)
tmp_at(DISP_TETHER, obj_to_glyph(obj)); tmp_at(DISP_TETHER, obj_to_glyph(obj));
} else if (u.dz) { } else if (u.dz) {
@@ -1168,7 +1168,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
} else { } else {
hitfloor(obj, TRUE); hitfloor(obj, TRUE);
} }
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} else if (obj->otyp == BOOMERANG && !Underwater) { } else if (obj->otyp == BOOMERANG && !Underwater) {
@@ -1183,7 +1183,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
setworn(obj, wep_mask); setworn(obj, wep_mask);
u.twoweap = twoweap; u.twoweap = twoweap;
} }
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} }
} else { } else {
@@ -1247,7 +1247,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
tethered_weapon ? THROWN_TETHERED_WEAPON : THROWN_WEAPON, tethered_weapon ? THROWN_TETHERED_WEAPON : THROWN_WEAPON,
(int FDECL((*), (MONST_P, OBJ_P))) 0, (int FDECL((*), (MONST_P, OBJ_P))) 0,
(int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj); (int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj);
thrownobj = obj; /* obj may be null now */ g.thrownobj = obj; /* obj may be null now */
/* have to do this after bhit() so u.ux & u.uy are correct */ /* have to do this after bhit() so u.ux & u.uy are correct */
if (Is_airlevel(&u.uz) || Levitation) if (Is_airlevel(&u.uz) || Levitation)
@@ -1267,14 +1267,14 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
boolean obj_gone; boolean obj_gone;
if (mon->isshk && obj->where == OBJ_MINVENT && obj->ocarry == mon) { if (mon->isshk && obj->where == OBJ_MINVENT && obj->ocarry == mon) {
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; /* alert shk caught it */ return; /* alert shk caught it */
} }
(void) snuff_candle(obj); (void) snuff_candle(obj);
g.notonhead = (bhitpos.x != mon->mx || bhitpos.y != mon->my); g.notonhead = (g.bhitpos.x != mon->mx || g.bhitpos.y != mon->my);
obj_gone = thitmonst(mon, obj); obj_gone = thitmonst(mon, obj);
/* Monster may have been tamed; this frees old mon */ /* Monster may have been tamed; this frees old mon */
mon = m_at(bhitpos.x, bhitpos.y); mon = m_at(g.bhitpos.x, g.bhitpos.y);
/* [perhaps this should be moved into thitmonst or hmon] */ /* [perhaps this should be moved into thitmonst or hmon] */
if (mon && mon->isshk if (mon && mon->isshk
@@ -1283,27 +1283,27 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
hot_pursuit(mon); hot_pursuit(mon);
if (obj_gone) if (obj_gone)
thrownobj = 0; g.thrownobj = 0;
} }
if (!thrownobj) { if (!g.thrownobj) {
/* missile has already been handled */ /* missile has already been handled */
if (tethered_weapon) tmp_at(DISP_END, 0); if (tethered_weapon) tmp_at(DISP_END, 0);
} else if (u.uswallow) { } else if (u.uswallow) {
if (tethered_weapon) { if (tethered_weapon) {
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
pline("%s returns to your hand!", The(xname(thrownobj))); pline("%s returns to your hand!", The(xname(g.thrownobj)));
thrownobj = addinv(thrownobj); g.thrownobj = addinv(g.thrownobj);
(void) encumber_msg(); (void) encumber_msg();
/* in case addinv() autoquivered */ /* in case addinv() autoquivered */
if (thrownobj->owornmask & W_QUIVER) if (g.thrownobj->owornmask & W_QUIVER)
setuqwep((struct obj *) 0); setuqwep((struct obj *) 0);
setuwep(thrownobj); setuwep(g.thrownobj);
} else { } else {
/* ball is not picked up by monster */ /* ball is not picked up by monster */
if (obj != uball) if (obj != uball)
(void) mpickobj(u.ustuck, obj); (void) mpickobj(u.ustuck, obj);
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
} }
} else { } else {
/* Mjollnir must we wielded to be thrown--caller verifies this; /* Mjollnir must we wielded to be thrown--caller verifies this;
@@ -1326,8 +1326,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
setuqwep((struct obj *) 0); setuqwep((struct obj *) 0);
setuwep(obj); setuwep(obj);
u.twoweap = twoweap; u.twoweap = twoweap;
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
newsym(bhitpos.x, bhitpos.y); newsym(g.bhitpos.x, g.bhitpos.y);
} else { } else {
int dmg = rn2(2); int dmg = rn2(2);
@@ -1350,12 +1350,12 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
KILLED_BY); KILLED_BY);
} }
if (ship_object(obj, u.ux, u.uy, FALSE)) { if (ship_object(obj, u.ux, u.uy, FALSE)) {
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} }
dropy(obj); dropy(obj);
} }
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} else { } else {
if (tethered_weapon) tmp_at(DISP_END, 0); if (tethered_weapon) tmp_at(DISP_END, 0);
@@ -1371,55 +1371,55 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
} }
} }
if (!IS_SOFT(levl[bhitpos.x][bhitpos.y].typ) && breaktest(obj)) { if (!IS_SOFT(levl[g.bhitpos.x][g.bhitpos.y].typ) && breaktest(obj)) {
tmp_at(DISP_FLASH, obj_to_glyph(obj)); tmp_at(DISP_FLASH, obj_to_glyph(obj));
tmp_at(bhitpos.x, bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
delay_output(); delay_output();
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
breakmsg(obj, cansee(bhitpos.x, bhitpos.y)); breakmsg(obj, cansee(g.bhitpos.x, g.bhitpos.y));
breakobj(obj, bhitpos.x, bhitpos.y, TRUE, TRUE); breakobj(obj, g.bhitpos.x, g.bhitpos.y, TRUE, TRUE);
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} }
if (flooreffects(obj, bhitpos.x, bhitpos.y, "fall")) { if (flooreffects(obj, g.bhitpos.x, g.bhitpos.y, "fall")) {
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} }
obj_no_longer_held(obj); obj_no_longer_held(obj);
if (mon && mon->isshk && is_pick(obj)) { if (mon && mon->isshk && is_pick(obj)) {
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
pline("%s snatches up %s.", Monnam(mon), the(xname(obj))); pline("%s snatches up %s.", Monnam(mon), the(xname(obj)));
if (*u.ushops || obj->unpaid) if (*u.ushops || obj->unpaid)
check_shop_obj(obj, bhitpos.x, bhitpos.y, FALSE); check_shop_obj(obj, g.bhitpos.x, g.bhitpos.y, FALSE);
(void) mpickobj(mon, obj); /* may merge and free obj */ (void) mpickobj(mon, obj); /* may merge and free obj */
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} }
(void) snuff_candle(obj); (void) snuff_candle(obj);
if (!mon && ship_object(obj, bhitpos.x, bhitpos.y, FALSE)) { if (!mon && ship_object(obj, g.bhitpos.x, g.bhitpos.y, FALSE)) {
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
return; return;
} }
thrownobj = (struct obj *) 0; g.thrownobj = (struct obj *) 0;
place_object(obj, bhitpos.x, bhitpos.y); place_object(obj, g.bhitpos.x, g.bhitpos.y);
/* container contents might break; /* container contents might break;
do so before turning ownership of thrownobj over to shk do so before turning ownership of g.thrownobj over to shk
(container_impact_dmg handles item already owned by shop) */ (container_impact_dmg handles item already owned by shop) */
if (!IS_SOFT(levl[bhitpos.x][bhitpos.y].typ)) if (!IS_SOFT(levl[g.bhitpos.x][g.bhitpos.y].typ))
/* <x,y> is spot where you initiated throw, not bhitpos */ /* <x,y> is spot where you initiated throw, not g.bhitpos */
container_impact_dmg(obj, u.ux, u.uy); container_impact_dmg(obj, u.ux, u.uy);
/* charge for items thrown out of shop; /* charge for items thrown out of shop;
shk takes possession for items thrown into one */ shk takes possession for items thrown into one */
if ((*u.ushops || obj->unpaid) && obj != uball) if ((*u.ushops || obj->unpaid) && obj != uball)
check_shop_obj(obj, bhitpos.x, bhitpos.y, FALSE); check_shop_obj(obj, g.bhitpos.x, g.bhitpos.y, FALSE);
stackobj(obj); stackobj(obj);
if (obj == uball) if (obj == uball)
drop_ball(bhitpos.x, bhitpos.y); drop_ball(g.bhitpos.x, g.bhitpos.y);
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
newsym(bhitpos.x, bhitpos.y); newsym(g.bhitpos.x, g.bhitpos.y);
if (obj_sheds_light(obj)) if (obj_sheds_light(obj))
vision_full_recalc = 1; g.vision_full_recalc = 1;
} }
} }
@@ -1503,7 +1503,7 @@ boolean maybe_wakeup;
int int
thitmonst(mon, obj) thitmonst(mon, obj)
register struct monst *mon; register struct monst *mon;
register struct obj *obj; /* thrownobj or kickedobj or uwep */ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */
{ {
register int tmp; /* Base chance to hit */ register int tmp; /* Base chance to hit */
register int disttmp; /* distance modifier */ register int disttmp; /* distance modifier */
@@ -1512,7 +1512,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
int dieroll; int dieroll;
hmode = (obj == uwep) ? HMON_APPLIED hmode = (obj == uwep) ? HMON_APPLIED
: (obj == kickedobj) ? HMON_KICKED : (obj == g.kickedobj) ? HMON_KICKED
: HMON_THROWN; : HMON_THROWN;
/* Differences from melee weapons: /* Differences from melee weapons:
@@ -1652,7 +1652,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
tmp += 4; tmp += 4;
else if (throwing_weapon(obj)) /* meant to be thrown */ else if (throwing_weapon(obj)) /* meant to be thrown */
tmp += 2; tmp += 2;
else if (obj == thrownobj) /* not meant to be thrown */ else if (obj == g.thrownobj) /* not meant to be thrown */
tmp -= 2; tmp -= 2;
/* we know we're dealing with a weapon or weptool handled /* we know we're dealing with a weapon or weptool handled
by WEAPON_SKILLS once ammo objects have been excluded */ by WEAPON_SKILLS once ammo objects have been excluded */
@@ -1660,7 +1660,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
} }
if (tmp >= dieroll) { if (tmp >= dieroll) {
boolean wasthrown = (thrownobj != 0), boolean wasthrown = (g.thrownobj != 0),
/* remember weapon attribute; hmon() might destroy obj */ /* remember weapon attribute; hmon() might destroy obj */
chopper = is_axe(obj); chopper = is_axe(obj);
@@ -1669,14 +1669,14 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
u.uconduct.weaphit++; u.uconduct.weaphit++;
if (hmon(mon, obj, hmode, dieroll)) { /* mon still alive */ if (hmon(mon, obj, hmode, dieroll)) { /* mon still alive */
if (mon->wormno) if (mon->wormno)
cutworm(mon, bhitpos.x, bhitpos.y, chopper); cutworm(mon, g.bhitpos.x, g.bhitpos.y, chopper);
} }
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
/* if hero was swallowed and projectile killed the engulfer, /* if hero was swallowed and projectile killed the engulfer,
'obj' got added to engulfer's inventory and then dropped, 'obj' got added to engulfer's inventory and then dropped,
so we can't safely use that pointer anymore; it escapes so we can't safely use that pointer anymore; it escapes
the chance to be used up here... */ the chance to be used up here... */
if (wasthrown && !thrownobj) if (wasthrown && !g.thrownobj)
return 1; return 1;
/* projectiles other than magic stones sometimes disappear /* projectiles other than magic stones sometimes disappear
@@ -1701,7 +1701,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
if (broken) { if (broken) {
if (*u.ushops || obj->unpaid) if (*u.ushops || obj->unpaid)
check_shop_obj(obj, bhitpos.x, bhitpos.y, TRUE); check_shop_obj(obj, g.bhitpos.x, g.bhitpos.y, TRUE);
obfree(obj, (struct obj *) 0); obfree(obj, (struct obj *) 0);
return 1; return 1;
} }
@@ -2125,8 +2125,8 @@ struct obj *obj;
pline("Fortunately, you are wearing %s!", pline("Fortunately, you are wearing %s!",
an(helm_simple_name(uarmh))); an(helm_simple_name(uarmh)));
} }
bhitpos.x = u.ux; g.bhitpos.x = u.ux;
bhitpos.y = u.uy; g.bhitpos.y = u.uy;
} else { } else {
/* consistent with range for normal objects */ /* consistent with range for normal objects */
range = (int) ((ACURRSTR) / 2 - obj->owt / 40); range = (int) ((ACURRSTR) / 2 - obj->owt / 40);
@@ -2135,8 +2135,8 @@ struct obj *obj;
odx = u.ux + u.dx; odx = u.ux + u.dx;
ody = u.uy + u.dy; ody = u.uy + u.dy;
if (!ZAP_POS(levl[odx][ody].typ) || closed_door(odx, ody)) { if (!ZAP_POS(levl[odx][ody].typ) || closed_door(odx, ody)) {
bhitpos.x = u.ux; g.bhitpos.x = u.ux;
bhitpos.y = u.uy; g.bhitpos.y = u.uy;
} else { } else {
mon = bhit(u.dx, u.dy, range, THROWN_WEAPON, mon = bhit(u.dx, u.dy, range, THROWN_WEAPON,
(int FDECL((*), (MONST_P, OBJ_P))) 0, (int FDECL((*), (MONST_P, OBJ_P))) 0,
@@ -2147,21 +2147,21 @@ struct obj *obj;
if (ghitm(mon, obj)) /* was it caught? */ if (ghitm(mon, obj)) /* was it caught? */
return 1; return 1;
} else { } else {
if (ship_object(obj, bhitpos.x, bhitpos.y, FALSE)) if (ship_object(obj, g.bhitpos.x, g.bhitpos.y, FALSE))
return 1; return 1;
} }
} }
} }
if (flooreffects(obj, bhitpos.x, bhitpos.y, "fall")) if (flooreffects(obj, g.bhitpos.x, g.bhitpos.y, "fall"))
return 1; return 1;
if (u.dz > 0) if (u.dz > 0)
pline_The("gold hits the %s.", surface(bhitpos.x, bhitpos.y)); pline_The("gold hits the %s.", surface(g.bhitpos.x, g.bhitpos.y));
place_object(obj, bhitpos.x, bhitpos.y); place_object(obj, g.bhitpos.x, g.bhitpos.y);
if (*u.ushops) if (*u.ushops)
sellobj(obj, bhitpos.x, bhitpos.y); sellobj(obj, g.bhitpos.x, g.bhitpos.y);
stackobj(obj); stackobj(obj);
newsym(bhitpos.x, bhitpos.y); newsym(g.bhitpos.x, g.bhitpos.y);
return 1; return 1;
} }
+13 -13
View File
@@ -153,7 +153,7 @@ boolean perform_write, free_data;
count = maxledgerno(); count = maxledgerno();
bwrite(fd, (genericptr_t) &count, sizeof count); bwrite(fd, (genericptr_t) &count, sizeof count);
bwrite(fd, (genericptr_t) level_info, bwrite(fd, (genericptr_t) g.level_info,
(unsigned) count * sizeof(struct linfo)); (unsigned) count * sizeof(struct linfo));
bwrite(fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos); bwrite(fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos);
@@ -214,7 +214,7 @@ int fd;
if (count >= MAXLINFO) if (count >= MAXLINFO)
panic("level information count larger (%d) than allocated size", panic("level information count larger (%d) than allocated size",
count); count);
mread(fd, (genericptr_t) level_info, mread(fd, (genericptr_t) g.level_info,
(unsigned) count * sizeof(struct linfo)); (unsigned) count * sizeof(struct linfo));
mread(fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos); mread(fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos);
@@ -1677,7 +1677,7 @@ const char *nam;
&& dlev.dnum == valley_level.dnum)) && dlev.dnum == valley_level.dnum))
&& (/* either wizard mode or else seen and not forgotten */ && (/* either wizard mode or else seen and not forgotten */
wizard wizard
|| (level_info[idx].flags & (FORGOTTEN | VISITED)) || (g.level_info[idx].flags & (FORGOTTEN | VISITED))
== VISITED)) { == VISITED)) {
lev = depth(&dlev); lev = depth(&dlev);
} }
@@ -1692,8 +1692,8 @@ const char *nam;
idx &= 0x00FF; idx &= 0x00FF;
if (/* either wizard mode, or else _both_ sides of branch seen */ if (/* either wizard mode, or else _both_ sides of branch seen */
wizard wizard
|| ((level_info[idx].flags & (FORGOTTEN | VISITED)) == VISITED || ((g.level_info[idx].flags & (FORGOTTEN | VISITED)) == VISITED
&& (level_info[idxtoo].flags & (FORGOTTEN | VISITED)) && (g.level_info[idxtoo].flags & (FORGOTTEN | VISITED))
== VISITED)) { == VISITED)) {
if (ledger_to_dnum(idxtoo) == u.uz.dnum) if (ledger_to_dnum(idxtoo) == u.uz.dnum)
idx = idxtoo; idx = idxtoo;
@@ -1956,7 +1956,7 @@ xchar *rdgn;
dungeon matched with one in the corresponding branch), the dungeon matched with one in the corresponding branch), the
elemental planes have singletons (connection to next plane) */ elemental planes have singletons (connection to next plane) */
*buf = '\0'; *buf = '\0';
for (trap = ftrap; trap; trap = trap->ntrap) for (trap = g.ftrap; trap; trap = trap->ntrap)
if (trap->ttyp == MAGIC_PORTAL) if (trap->ttyp == MAGIC_PORTAL)
break; break;
@@ -2317,9 +2317,9 @@ d_level *lev;
explicitly initialize pointers to null */ explicitly initialize pointers to null */
init->next = 0, init->br = 0, init->custom = 0; init->next = 0, init->br = 0, init->custom = 0;
init->final_resting_place = 0; init->final_resting_place = 0;
/* lastseentyp[][] is reused for each level, so get rid of /* g.lastseentyp[][] is reused for each level, so get rid of
previous level's data */ previous level's data */
(void) memset((genericptr_t) lastseentyp, 0, sizeof lastseentyp); (void) memset((genericptr_t) g.lastseentyp, 0, sizeof g.lastseentyp);
init->lev.dnum = lev->dnum; init->lev.dnum = lev->dnum;
init->lev.dlevel = lev->dlevel; init->lev.dlevel = lev->dlevel;
@@ -2483,7 +2483,7 @@ recalc_mapseen()
} }
} }
/* Update lastseentyp with typ if and only if it is in sight or the /* Update g.lastseentyp with typ if and only if it is in sight or the
* hero can feel it on their current location (i.e. not levitating). * hero can feel it on their current location (i.e. not levitating).
* This *should* give the "last known typ" for each dungeon location. * This *should* give the "last known typ" for each dungeon location.
* (At the very least, it's a better assumption than determining what * (At the very least, it's a better assumption than determining what
@@ -2494,7 +2494,7 @@ recalc_mapseen()
* we could track "features" and then update them all here, and keep * we could track "features" and then update them all here, and keep
* track of when new features are created or destroyed, but this * track of when new features are created or destroyed, but this
* seemed the most elegant, despite adding more data to struct rm. * seemed the most elegant, despite adding more data to struct rm.
* [3.6.0: we're using lastseentyp[][] rather than level.locations * [3.6.0: we're using g.lastseentyp[][] rather than level.locations
* to track the features seen.] * to track the features seen.]
* *
* Although no current windowing systems (can) do this, this would add * Although no current windowing systems (can) do this, this would add
@@ -2510,10 +2510,10 @@ recalc_mapseen()
if ((mtmp = m_at(x, y)) != 0 if ((mtmp = m_at(x, y)) != 0
&& mtmp->m_ap_type == M_AP_FURNITURE && canseemon(mtmp)) && mtmp->m_ap_type == M_AP_FURNITURE && canseemon(mtmp))
ltyp = cmap_to_type(mtmp->mappearance); ltyp = cmap_to_type(mtmp->mappearance);
lastseentyp[x][y] = ltyp; g.lastseentyp[x][y] = ltyp;
} }
switch (lastseentyp[x][y]) { switch (g.lastseentyp[x][y]) {
#if 0 #if 0
case ICE: case ICE:
count = mptr->feat.ice + 1; count = mptr->feat.ice + 1;
@@ -2637,7 +2637,7 @@ recalc_mapseen()
guarantee of either a grave or a ghost, so we go by whether the guarantee of either a grave or a ghost, so we go by whether the
current hero has seen the map location where each old one died */ current hero has seen the map location where each old one died */
for (bp = mptr->final_resting_place; bp; bp = bp->next) for (bp = mptr->final_resting_place; bp; bp = bp->next)
if (lastseentyp[bp->frpx][bp->frpy]) { if (g.lastseentyp[bp->frpx][bp->frpy]) {
bp->bonesknown = TRUE; bp->bonesknown = TRUE;
mptr->flags.knownbones = 1; mptr->flags.knownbones = 1;
} }
+18 -18
View File
@@ -489,7 +489,7 @@ int how;
/* this could happen if a high-end vampire kills the hero /* this could happen if a high-end vampire kills the hero
when ordinary vampires are genocided; ditto for wraiths */ when ordinary vampires are genocided; ditto for wraiths */
if (u.ugrave_arise >= LOW_PM if (u.ugrave_arise >= LOW_PM
&& (mvitals[u.ugrave_arise].mvflags & G_GENOD)) && (g.mvitals[u.ugrave_arise].mvflags & G_GENOD))
u.ugrave_arise = NON_PM; u.ugrave_arise = NON_PM;
done(how); done(how);
@@ -1134,10 +1134,10 @@ int how;
inven_inuse(TRUE); inven_inuse(TRUE);
/* maybe not on object lists; if an active light source, would cause /* maybe not on object lists; if an active light source, would cause
big trouble (`obj_is_local' panic) for savebones() -> savelev() */ big trouble (`obj_is_local' panic) for savebones() -> savelev() */
if (thrownobj && thrownobj->where == OBJ_FREE) if (g.thrownobj && g.thrownobj->where == OBJ_FREE)
dealloc_obj(thrownobj); dealloc_obj(g.thrownobj);
if (kickedobj && kickedobj->where == OBJ_FREE) if (g.kickedobj && g.kickedobj->where == OBJ_FREE)
dealloc_obj(kickedobj); dealloc_obj(g.kickedobj);
/* remember time of death here instead of having bones, rip, and /* remember time of death here instead of having bones, rip, and
topten figure it out separately and possibly getting different topten figure it out separately and possibly getting different
@@ -1180,7 +1180,7 @@ int how;
have been genocided: genocide could occur after hero is have been genocided: genocide could occur after hero is
already infected or hero could eat a glob of one created already infected or hero could eat a glob of one created
before genocide; don't try to arise as one if they're gone */ before genocide; don't try to arise as one if they're gone */
&& !(mvitals[PM_GREEN_SLIME].mvflags & G_GENOD)) && !(g.mvitals[PM_GREEN_SLIME].mvflags & G_GENOD))
u.ugrave_arise = PM_GREEN_SLIME; u.ugrave_arise = PM_GREEN_SLIME;
if (how == QUIT) { if (how == QUIT) {
@@ -1244,7 +1244,7 @@ int how;
dump_everything(how, endtime); dump_everything(how, endtime);
} }
/* if pets will contribute to score, populate mydogs list now /* if pets will contribute to score, populate g.mydogs list now
(bones creation isn't a factor, but pline() messaging is; used to (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() 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) */ so that any accompanying pets are still on the map during dump) */
@@ -1258,7 +1258,7 @@ int how;
/* grave creation should be after disclosure so it doesn't have /* grave creation should be after disclosure so it doesn't have
this grave in the current level's features for #overview */ this grave in the current level's features for #overview */
if (bones_ok && u.ugrave_arise == NON_PM if (bones_ok && u.ugrave_arise == NON_PM
&& !(mvitals[u.umonnum].mvflags & G_NOCORPSE)) { && !(g.mvitals[u.umonnum].mvflags & G_NOCORPSE)) {
int mnum = u.umonnum; int mnum = u.umonnum;
if (!Upolyd) { if (!Upolyd) {
@@ -1407,8 +1407,8 @@ int how;
/* count the points for artifacts */ /* count the points for artifacts */
artifact_score(invent, TRUE, endwin); artifact_score(invent, TRUE, endwin);
viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */ g.viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */
mtmp = mydogs; mtmp = g.mydogs;
Strcpy(pbuf, "You"); Strcpy(pbuf, "You");
if (mtmp || Schroedingers_cat) { if (mtmp || Schroedingers_cat) {
while (mtmp) { while (mtmp) {
@@ -1418,7 +1418,7 @@ int how;
mtmp = mtmp->nmon; mtmp = mtmp->nmon;
} }
/* [it might be more robust to create a housecat and add it to /* [it might be more robust to create a housecat and add it to
mydogs; it doesn't have to be placed on the map for that] */ g.mydogs; it doesn't have to be placed on the map for that] */
if (Schroedingers_cat) { if (Schroedingers_cat) {
int mhp, m_lev = adj_lev(&mons[PM_HOUSECAT]); int mhp, m_lev = adj_lev(&mons[PM_HOUSECAT]);
@@ -1716,7 +1716,7 @@ const genericptr vptr2;
break; break;
case VANQ_COUNT_H_L: case VANQ_COUNT_H_L:
case VANQ_COUNT_L_H: case VANQ_COUNT_L_H:
died1 = mvitals[indx1].died, died2 = mvitals[indx2].died; died1 = g.mvitals[indx1].died, died2 = g.mvitals[indx2].died;
res = died2 - died1; /* dead count high to low */ res = died2 - died1; /* dead count high to low */
if (g.vanq_sortmode == VANQ_COUNT_L_H) if (g.vanq_sortmode == VANQ_COUNT_L_H)
res = -res; /* dead count low to high */ res = -res; /* dead count low to high */
@@ -1795,7 +1795,7 @@ boolean ask;
/* get totals first */ /* get totals first */
ntypes = 0; ntypes = 0;
for (i = LOW_PM; i < NUMMONS; i++) { for (i = LOW_PM; i < NUMMONS; i++) {
if ((nkilled = (int) mvitals[i].died) == 0) if ((nkilled = (int) g.mvitals[i].died) == 0)
continue; continue;
mindx[ntypes++] = i; mindx[ntypes++] = i;
total_killed += (long) nkilled; total_killed += (long) nkilled;
@@ -1833,7 +1833,7 @@ boolean ask;
qsort((genericptr_t) mindx, ntypes, sizeof *mindx, vanqsort_cmp); qsort((genericptr_t) mindx, ntypes, sizeof *mindx, vanqsort_cmp);
for (ni = 0; ni < ntypes; ni++) { for (ni = 0; ni < ntypes; ni++) {
i = mindx[ni]; i = mindx[ni];
nkilled = mvitals[i].died; nkilled = g.mvitals[i].died;
mlet = mons[i].mlet; mlet = mons[i].mlet;
if (class_header && mlet != prev_mlet) { if (class_header && mlet != prev_mlet) {
Strcpy(buf, def_monsyms[(int) mlet].explain); Strcpy(buf, def_monsyms[(int) mlet].explain);
@@ -1912,7 +1912,7 @@ num_genocides()
int i, n = 0; int i, n = 0;
for (i = LOW_PM; i < NUMMONS; ++i) { for (i = LOW_PM; i < NUMMONS; ++i) {
if (mvitals[i].mvflags & G_GENOD) { if (g.mvitals[i].mvflags & G_GENOD) {
++n; ++n;
if (UniqCritterIndx(i)) if (UniqCritterIndx(i))
impossible("unique creature '%d: %s' genocided?", impossible("unique creature '%d: %s' genocided?",
@@ -1930,7 +1930,7 @@ num_extinct()
for (i = LOW_PM; i < NUMMONS; ++i) { for (i = LOW_PM; i < NUMMONS; ++i) {
if (UniqCritterIndx(i)) if (UniqCritterIndx(i))
continue; continue;
if ((mvitals[i].mvflags & G_GONE) == G_EXTINCT) if ((g.mvitals[i].mvflags & G_GONE) == G_EXTINCT)
++n; ++n;
} }
return n; return n;
@@ -1978,7 +1978,7 @@ boolean ask;
however, they're never reported as extinct, so skip them */ however, they're never reported as extinct, so skip them */
if (UniqCritterIndx(i)) if (UniqCritterIndx(i))
continue; continue;
if (mvitals[i].mvflags & G_GONE) { if (g.mvitals[i].mvflags & G_GONE) {
Sprintf(buf, " %s", makeplural(mons[i].mname)); Sprintf(buf, " %s", makeplural(mons[i].mname));
/* /*
* "Extinct" is unfortunate terminology. A species * "Extinct" is unfortunate terminology. A species
@@ -1986,7 +1986,7 @@ boolean ask;
* but there might be members of the species still * but there might be members of the species still
* alive, contradicting the meaning of the word. * alive, contradicting the meaning of the word.
*/ */
if ((mvitals[i].mvflags & G_GONE) == G_EXTINCT) if ((g.mvitals[i].mvflags & G_GONE) == G_EXTINCT)
Strcat(buf, " (extinct)"); Strcat(buf, " (extinct)");
putstr(klwin, 0, buf); putstr(klwin, 0, buf);
} }
+14 -14
View File
@@ -699,19 +699,19 @@ struct obj *obj; /* only scatter this obj */
while (farthest-- > 0) { while (farthest-- > 0) {
for (stmp = schain; stmp; stmp = stmp->next) { for (stmp = schain; stmp; stmp = stmp->next) {
if ((stmp->range-- > 0) && (!stmp->stopped)) { if ((stmp->range-- > 0) && (!stmp->stopped)) {
bhitpos.x = stmp->ox + stmp->dx; g.bhitpos.x = stmp->ox + stmp->dx;
bhitpos.y = stmp->oy + stmp->dy; g.bhitpos.y = stmp->oy + stmp->dy;
typ = levl[bhitpos.x][bhitpos.y].typ; typ = levl[g.bhitpos.x][g.bhitpos.y].typ;
if (!isok(bhitpos.x, bhitpos.y)) { if (!isok(g.bhitpos.x, g.bhitpos.y)) {
bhitpos.x -= stmp->dx; g.bhitpos.x -= stmp->dx;
bhitpos.y -= stmp->dy; g.bhitpos.y -= stmp->dy;
stmp->stopped = TRUE; stmp->stopped = TRUE;
} else if (!ZAP_POS(typ) } else if (!ZAP_POS(typ)
|| closed_door(bhitpos.x, bhitpos.y)) { || closed_door(g.bhitpos.x, g.bhitpos.y)) {
bhitpos.x -= stmp->dx; g.bhitpos.x -= stmp->dx;
bhitpos.y -= stmp->dy; g.bhitpos.y -= stmp->dy;
stmp->stopped = TRUE; stmp->stopped = TRUE;
} else if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) { } else if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) {
if (scflags & MAY_HITMON) { if (scflags & MAY_HITMON) {
stmp->range--; stmp->range--;
if (ohitmon(mtmp, stmp->obj, 1, FALSE)) { if (ohitmon(mtmp, stmp->obj, 1, FALSE)) {
@@ -719,7 +719,7 @@ struct obj *obj; /* only scatter this obj */
stmp->stopped = TRUE; stmp->stopped = TRUE;
} }
} }
} else if (bhitpos.x == u.ux && bhitpos.y == u.uy) { } else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
if (scflags & MAY_HITYOU) { if (scflags & MAY_HITYOU) {
int hitvalu, hitu; int hitvalu, hitu;
@@ -739,12 +739,12 @@ struct obj *obj; /* only scatter this obj */
} }
} else { } else {
if (scflags & VIS_EFFECTS) { if (scflags & VIS_EFFECTS) {
/* tmp_at(bhitpos.x, bhitpos.y); */ /* tmp_at(g.bhitpos.x, g.bhitpos.y); */
/* delay_output(); */ /* delay_output(); */
} }
} }
stmp->ox = bhitpos.x; stmp->ox = g.bhitpos.x;
stmp->oy = bhitpos.y; stmp->oy = g.bhitpos.y;
} }
} }
} }
+8 -8
View File
@@ -508,7 +508,7 @@ char errbuf[];
#endif /* MICRO || WIN32 */ #endif /* MICRO || WIN32 */
if (fd >= 0) if (fd >= 0)
level_info[lev].flags |= LFILE_EXISTS; g.level_info[lev].flags |= LFILE_EXISTS;
else if (errbuf) /* failure explanation */ else if (errbuf) /* failure explanation */
Sprintf(errbuf, "Cannot create file \"%s\" for level %d (errno %d).", Sprintf(errbuf, "Cannot create file \"%s\" for level %d (errno %d).",
lock, lev, errno); lock, lev, errno);
@@ -530,7 +530,7 @@ char errbuf[];
fq_lock = fqname(lock, LEVELPREFIX, 0); fq_lock = fqname(lock, LEVELPREFIX, 0);
#ifdef MFLOPPY #ifdef MFLOPPY
/* If not currently accessible, swap it in. */ /* If not currently accessible, swap it in. */
if (level_info[lev].where != ACTIVE) if (g.level_info[lev].where != ACTIVE)
swapin_file(lev); swapin_file(lev);
#endif #endif
#ifdef MAC #ifdef MAC
@@ -562,14 +562,14 @@ int lev;
* Level 0 might be created by port specific code that doesn't * Level 0 might be created by port specific code that doesn't
* call create_levfile(), so always assume that it exists. * call create_levfile(), so always assume that it exists.
*/ */
if (lev == 0 || (level_info[lev].flags & LFILE_EXISTS)) { if (lev == 0 || (g.level_info[lev].flags & LFILE_EXISTS)) {
set_levelfile_name(lock, lev); set_levelfile_name(lock, lev);
#ifdef HOLD_LOCKFILE_OPEN #ifdef HOLD_LOCKFILE_OPEN
if (lev == 0) if (lev == 0)
really_close(); really_close();
#endif #endif
(void) unlink(fqname(lock, LEVELPREFIX, 0)); (void) unlink(fqname(lock, LEVELPREFIX, 0));
level_info[lev].flags &= ~LFILE_EXISTS; g.level_info[lev].flags &= ~LFILE_EXISTS;
} }
} }
@@ -2364,10 +2364,10 @@ char *origbuf;
|| match_varname(buf, "CHARACTER", 4)) { || match_varname(buf, "CHARACTER", 4)) {
if ((len = str2role(bufp)) >= 0) if ((len = str2role(bufp)) >= 0)
flags.initrole = len; flags.initrole = len;
} else if (match_varname(buf, "DOGNAME", 3)) { } else if (match_varname(buf, "dogname", 3)) {
(void) strncpy(dogname, bufp, PL_PSIZ - 1); (void) strncpy(g.dogname, bufp, PL_PSIZ - 1);
} else if (match_varname(buf, "CATNAME", 3)) { } else if (match_varname(buf, "catname", 3)) {
(void) strncpy(catname, bufp, PL_PSIZ - 1); (void) strncpy(g.catname, bufp, PL_PSIZ - 1);
#ifdef SYSCF #ifdef SYSCF
} else if (src == SET_IN_SYS && match_varname(buf, "WIZARDS", 7)) { } else if (src == SET_IN_SYS && match_varname(buf, "WIZARDS", 7)) {
+5 -5
View File
@@ -36,7 +36,7 @@ dowatersnakes()
register int num = rn1(5, 2); register int num = rn1(5, 2);
struct monst *mtmp; struct monst *mtmp;
if (!(mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) { if (!(g.mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) {
if (!Blind) if (!Blind)
pline("An endless stream of %s pours forth!", pline("An endless stream of %s pours forth!",
Hallucination ? makeplural(rndmonnam(NULL)) : "snakes"); Hallucination ? makeplural(rndmonnam(NULL)) : "snakes");
@@ -57,7 +57,7 @@ dowaterdemon()
{ {
struct monst *mtmp; struct monst *mtmp;
if (!(mvitals[PM_WATER_DEMON].mvflags & G_GONE)) { if (!(g.mvitals[PM_WATER_DEMON].mvflags & G_GONE)) {
if ((mtmp = makemon(&mons[PM_WATER_DEMON], u.ux, u.uy, if ((mtmp = makemon(&mons[PM_WATER_DEMON], u.ux, u.uy,
NO_MM_FLAGS)) != 0) { NO_MM_FLAGS)) != 0) {
if (!Blind) if (!Blind)
@@ -85,7 +85,7 @@ dowaternymph()
{ {
register struct monst *mtmp; register struct monst *mtmp;
if (!(mvitals[PM_WATER_NYMPH].mvflags & G_GONE) if (!(g.mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
&& (mtmp = makemon(&mons[PM_WATER_NYMPH], u.ux, u.uy, && (mtmp = makemon(&mons[PM_WATER_NYMPH], u.ux, u.uy,
NO_MM_FLAGS)) != 0) { NO_MM_FLAGS)) != 0) {
if (!Blind) if (!Blind)
@@ -542,7 +542,7 @@ drinksink()
/* boiling water burns considered fire damage */ /* boiling water burns considered fire damage */
break; break;
case 3: case 3:
if (mvitals[PM_SEWER_RAT].mvflags & G_GONE) if (g.mvitals[PM_SEWER_RAT].mvflags & G_GONE)
pline_The("sink seems quite dirty."); pline_The("sink seems quite dirty.");
else { else {
mtmp = makemon(&mons[PM_SEWER_RAT], u.ux, u.uy, NO_MM_FLAGS); mtmp = makemon(&mons[PM_SEWER_RAT], u.ux, u.uy, NO_MM_FLAGS);
@@ -584,7 +584,7 @@ drinksink()
break; break;
case 7: case 7:
pline_The("%s moves as though of its own will!", hliquid("water")); pline_The("%s moves as though of its own will!", hliquid("water"));
if ((mvitals[PM_WATER_ELEMENTAL].mvflags & G_GONE) if ((g.mvitals[PM_WATER_ELEMENTAL].mvflags & G_GONE)
|| !makemon(&mons[PM_WATER_ELEMENTAL], u.ux, u.uy, NO_MM_FLAGS)) || !makemon(&mons[PM_WATER_ELEMENTAL], u.ux, u.uy, NO_MM_FLAGS))
pline("But it quiets down."); pline("But it quiets down.");
break; break;
+6 -6
View File
@@ -192,7 +192,7 @@ moverock()
the pit will temporarily be seen even the pit will temporarily be seen even
if this is one among multiple boulders */ if this is one among multiple boulders */
if (!Blind) if (!Blind)
viz_array[ry][rx] |= IN_SIGHT; g.viz_array[ry][rx] |= IN_SIGHT;
if (!flooreffects(otmp, rx, ry, "fall")) { if (!flooreffects(otmp, rx, ry, "fall")) {
place_object(otmp, rx, ry); place_object(otmp, rx, ry);
} }
@@ -1531,8 +1531,8 @@ domove()
u.ux0 = u.ux; u.ux0 = u.ux;
u.uy0 = u.uy; u.uy0 = u.uy;
bhitpos.x = x; g.bhitpos.x = x;
bhitpos.y = y; g.bhitpos.y = y;
tmpr = &levl[x][y]; tmpr = &levl[x][y];
/* attack monster */ /* attack monster */
@@ -1812,7 +1812,7 @@ domove()
u.uconduct.killer++; u.uconduct.killer++;
mndx = monsndx(mtmp->data); mndx = monsndx(mtmp->data);
tmp = experience(mtmp, (int) mvitals[mndx].died); tmp = experience(mtmp, (int) g.mvitals[mndx].died);
more_experienced(tmp, 0); more_experienced(tmp, 0);
newexplevel(); /* will decide if you go up */ newexplevel(); /* will decide if you go up */
} }
@@ -2020,7 +2020,7 @@ boolean newspot; /* true if called by spoteffects */
u.uinwater = 0; /* leave the water */ u.uinwater = 0; /* leave the water */
if (was_underwater) { /* restore vision */ if (was_underwater) { /* restore vision */
docrt(); docrt();
vision_full_recalc = 1; g.vision_full_recalc = 1;
} }
} }
} }
@@ -2100,7 +2100,7 @@ boolean pick;
check_special_room(FALSE); check_special_room(FALSE);
if (IS_SINK(levl[u.ux][u.uy].typ) && Levitation) if (IS_SINK(levl[u.ux][u.uy].typ) && Levitation)
dosinkfall(); dosinkfall();
if (!in_steed_dismounting) { /* if dismounting, we'll check again later */ if (!g.in_steed_dismounting) { /* if dismounting, we'll check again later */
boolean pit; boolean pit;
/* if levitation is due to time out at the end of this /* if levitation is due to time out at the end of this
+7 -7
View File
@@ -74,7 +74,7 @@ anything *id;
ls->flags = 0; ls->flags = 0;
g.light_base = ls; g.light_base = ls;
vision_full_recalc = 1; /* make the source show up */ g.vision_full_recalc = 1; /* make the source show up */
} }
/* /*
@@ -116,7 +116,7 @@ anything *id;
g.light_base = curr->next; g.light_base = curr->next;
free((genericptr_t) curr); free((genericptr_t) curr);
vision_full_recalc = 1; g.vision_full_recalc = 1;
return; return;
} }
} }
@@ -225,11 +225,11 @@ unsigned fmflags;
if (!DEADMONSTER(mtmp) && mtmp->m_id == nid) if (!DEADMONSTER(mtmp) && mtmp->m_id == nid)
return mtmp; return mtmp;
if (fmflags & FM_MIGRATE) if (fmflags & FM_MIGRATE)
for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon)
if (mtmp->m_id == nid) if (mtmp->m_id == nid)
return mtmp; return mtmp;
if (fmflags & FM_MYDOGS) if (fmflags & FM_MYDOGS)
for (mtmp = mydogs; mtmp; mtmp = mtmp->nmon) for (mtmp = g.mydogs; mtmp; mtmp = mtmp->nmon)
if (mtmp->m_id == nid) if (mtmp->m_id == nid)
return mtmp; return mtmp;
return (struct monst *) 0; return (struct monst *) 0;
@@ -564,7 +564,7 @@ struct obj *src, *dest;
/* split candles may emit less light than original group */ /* split candles may emit less light than original group */
ls->range = candle_light_range(src); ls->range = candle_light_range(src);
new_ls->range = candle_light_range(dest); new_ls->range = candle_light_range(dest);
vision_full_recalc = 1; /* in case range changed */ g.vision_full_recalc = 1; /* in case range changed */
} }
new_ls->id.a_obj = dest; new_ls->id.a_obj = dest;
new_ls->next = g.light_base; new_ls->next = g.light_base;
@@ -588,7 +588,7 @@ struct obj *src, *dest;
for (ls = g.light_base; ls; ls = ls->next) for (ls = g.light_base; ls; ls = ls->next)
if (ls->type == LS_OBJECT && ls->id.a_obj == dest) { if (ls->type == LS_OBJECT && ls->id.a_obj == dest) {
ls->range = candle_light_range(dest); ls->range = candle_light_range(dest);
vision_full_recalc = 1; /* in case range changed */ g.vision_full_recalc = 1; /* in case range changed */
break; break;
} }
} }
@@ -604,7 +604,7 @@ int new_radius;
for (ls = g.light_base; ls; ls = ls->next) for (ls = g.light_base; ls; ls = ls->next)
if (ls->type == LS_OBJECT && ls->id.a_obj == obj) { if (ls->type == LS_OBJECT && ls->id.a_obj == obj) {
if (new_radius != ls->range) if (new_radius != ls->range)
vision_full_recalc = 1; g.vision_full_recalc = 1;
ls->range = new_radius; ls->range = new_radius;
return; return;
} }
+5 -5
View File
@@ -643,11 +643,11 @@ int x, y;
portcullis = (is_drawbridge_wall(cc.x, cc.y) >= 0); portcullis = (is_drawbridge_wall(cc.x, cc.y) >= 0);
if (Blind) { if (Blind) {
int oldglyph = door->glyph; int oldglyph = door->glyph;
schar oldlastseentyp = lastseentyp[cc.x][cc.y]; schar oldlastseentyp = g.lastseentyp[cc.x][cc.y];
feel_location(cc.x, cc.y); feel_location(cc.x, cc.y);
if (door->glyph != oldglyph if (door->glyph != oldglyph
|| lastseentyp[cc.x][cc.y] != oldlastseentyp) || g.lastseentyp[cc.x][cc.y] != oldlastseentyp)
res = 1; /* learned something */ res = 1; /* learned something */
} }
@@ -789,10 +789,10 @@ doclose()
portcullis = (is_drawbridge_wall(x, y) >= 0); portcullis = (is_drawbridge_wall(x, y) >= 0);
if (Blind) { if (Blind) {
int oldglyph = door->glyph; int oldglyph = door->glyph;
schar oldlastseentyp = lastseentyp[x][y]; schar oldlastseentyp = g.lastseentyp[x][y];
feel_location(x, y); feel_location(x, y);
if (door->glyph != oldglyph || lastseentyp[x][y] != oldlastseentyp) if (door->glyph != oldglyph || g.lastseentyp[x][y] != oldlastseentyp)
res = 1; /* learned something */ res = 1; /* learned something */
} }
@@ -1016,7 +1016,7 @@ int x, y;
unblock_point(x, y); unblock_point(x, y);
newsym(x, y); newsym(x, y);
/* force vision recalc before printing more messages */ /* force vision recalc before printing more messages */
if (vision_full_recalc) if (g.vision_full_recalc)
vision_recalc(0); vision_recalc(0);
loudness = 20; loudness = 20;
} else } else
+8 -10
View File
@@ -41,8 +41,6 @@ STATIC_DCL boolean FDECL(md_stop, (coord *, coord *));
STATIC_DCL boolean FDECL(md_rush, (struct monst *, int, int)); STATIC_DCL boolean FDECL(md_rush, (struct monst *, int, int));
STATIC_DCL void FDECL(newmail, (struct mail_info *)); STATIC_DCL void FDECL(newmail, (struct mail_info *));
extern char *viz_rmin, *viz_rmax; /* line-of-sight limits (vision.c) */
#if !defined(UNIX) && !defined(VMS) #if !defined(UNIX) && !defined(VMS)
int mustgetmail = -1; int mustgetmail = -1;
#endif #endif
@@ -181,23 +179,23 @@ coord *startp;
* position that could be seen. What we really ought to be doing is * position that could be seen. What we really ought to be doing is
* finding a path from a stairwell... * finding a path from a stairwell...
* *
* The arrays viz_rmin[] and viz_rmax[] are set even when blind. These * The arrays g.viz_rmin[] and g.viz_rmax[] are set even when blind. These
* are the LOS limits for each row. * are the LOS limits for each row.
*/ */
lax = 0; /* be picky */ lax = 0; /* be picky */
max_distance = -1; max_distance = -1;
retry: retry:
for (row = 0; row < ROWNO; row++) { for (row = 0; row < ROWNO; row++) {
if (viz_rmin[row] < viz_rmax[row]) { if (g.viz_rmin[row] < g.viz_rmax[row]) {
/* There are valid positions on this row. */ /* There are valid positions on this row. */
dd = distu(viz_rmin[row], row); dd = distu(g.viz_rmin[row], row);
if (dd > max_distance) { if (dd > max_distance) {
if (lax) { if (lax) {
max_distance = dd; max_distance = dd;
startp->y = row; startp->y = row;
startp->x = viz_rmin[row]; startp->x = g.viz_rmin[row];
} else if (enexto(&testcc, (xchar) viz_rmin[row], row, } else if (enexto(&testcc, (xchar) g.viz_rmin[row], row,
(struct permonst *) 0) (struct permonst *) 0)
&& !cansee(testcc.x, testcc.y) && !cansee(testcc.x, testcc.y)
&& couldsee(testcc.x, testcc.y)) { && couldsee(testcc.x, testcc.y)) {
@@ -205,14 +203,14 @@ coord *startp;
*startp = testcc; *startp = testcc;
} }
} }
dd = distu(viz_rmax[row], row); dd = distu(g.viz_rmax[row], row);
if (dd > max_distance) { if (dd > max_distance) {
if (lax) { if (lax) {
max_distance = dd; max_distance = dd;
startp->y = row; startp->y = row;
startp->x = viz_rmax[row]; startp->x = g.viz_rmax[row];
} else if (enexto(&testcc, (xchar) viz_rmax[row], row, } else if (enexto(&testcc, (xchar) g.viz_rmax[row], row,
(struct permonst *) 0) (struct permonst *) 0)
&& !cansee(testcc.x, testcc.y) && !cansee(testcc.x, testcc.y)
&& couldsee(testcc.x, testcc.y)) { && couldsee(testcc.x, testcc.y)) {
+16 -16
View File
@@ -813,7 +813,7 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */
struct monst *m2; struct monst *m2;
/* may be too weak or have been extinguished for population control */ /* may be too weak or have been extinguished for population control */
if (mon->mhp <= 1 || (mvitals[monsndx(mon->data)].mvflags & G_EXTINCT)) if (mon->mhp <= 1 || (g.mvitals[monsndx(mon->data)].mvflags & G_EXTINCT))
return (struct monst *) 0; return (struct monst *) 0;
if (x == 0) { if (x == 0) {
@@ -924,24 +924,24 @@ boolean ghostly;
{ {
boolean result; boolean result;
uchar lim = mbirth_limit(mndx); uchar lim = mbirth_limit(mndx);
boolean gone = (mvitals[mndx].mvflags & G_GONE) != 0; /* geno'd|extinct */ boolean gone = (g.mvitals[mndx].mvflags & G_GONE) != 0; /* geno'd|extinct */
result = (((int) mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE; result = (((int) g.mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE;
/* if it's unique, don't ever make it again */ /* if it's unique, don't ever make it again */
if ((mons[mndx].geno & G_UNIQ) && mndx != PM_HIGH_PRIEST) if ((mons[mndx].geno & G_UNIQ) && mndx != PM_HIGH_PRIEST)
mvitals[mndx].mvflags |= G_EXTINCT; g.mvitals[mndx].mvflags |= G_EXTINCT;
if (mvitals[mndx].born < 255 && tally if (g.mvitals[mndx].born < 255 && tally
&& (!ghostly || (ghostly && result))) && (!ghostly || (ghostly && result)))
mvitals[mndx].born++; g.mvitals[mndx].born++;
if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) if ((int) g.mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN)
&& !(mvitals[mndx].mvflags & G_EXTINCT)) { && !(g.mvitals[mndx].mvflags & G_EXTINCT)) {
if (wizard) { if (wizard) {
debugpline1("Automatically extinguished %s.", debugpline1("Automatically extinguished %s.",
makeplural(mons[mndx].mname)); makeplural(mons[mndx].mname));
} }
mvitals[mndx].mvflags |= G_EXTINCT; g.mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx); reset_rndmonst(mndx);
} }
return result; return result;
@@ -1151,9 +1151,9 @@ int mmflags;
mndx = monsndx(ptr); mndx = monsndx(ptr);
/* if you are to make a specific monster and it has /* if you are to make a specific monster and it has
already been genocided, return */ already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD) if (g.mvitals[mndx].mvflags & G_GENOD)
return (struct monst *) 0; return (struct monst *) 0;
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT)) { if (wizard && (g.mvitals[mndx].mvflags & G_EXTINCT)) {
debugpline1("Explicitly creating extinct monster %s.", debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].mname); mons[mndx].mname);
} }
@@ -1466,7 +1466,7 @@ int mndx;
{ {
if (mons[mndx].geno & (G_NOGEN | G_UNIQ)) if (mons[mndx].geno & (G_NOGEN | G_UNIQ))
return TRUE; return TRUE;
if (mvitals[mndx].mvflags & G_GONE) if (g.mvitals[mndx].mvflags & G_GONE)
return TRUE; return TRUE;
if (Inhell) if (Inhell)
return (boolean) (mons[mndx].maligntyp > A_NEUTRAL); return (boolean) (mons[mndx].maligntyp > A_NEUTRAL);
@@ -1615,7 +1615,7 @@ int mndx, mvflagsmask, genomask;
{ {
struct permonst *ptr = &mons[mndx]; struct permonst *ptr = &mons[mndx];
if (mvitals[mndx].mvflags & mvflagsmask) if (g.mvitals[mndx].mvflags & mvflagsmask)
return FALSE; return FALSE;
if (ptr->geno & genomask) if (ptr->geno & genomask)
return FALSE; return FALSE;
@@ -1756,7 +1756,7 @@ register struct permonst *ptr;
/* does not depend on other strengths, but does get stronger /* does not depend on other strengths, but does get stronger
* every time he is killed * every time he is killed
*/ */
tmp = ptr->mlevel + mvitals[PM_WIZARD_OF_YENDOR].died; tmp = ptr->mlevel + g.mvitals[PM_WIZARD_OF_YENDOR].died;
if (tmp > 49) if (tmp > 49)
tmp = 49; tmp = 49;
return tmp; return tmp;
@@ -1855,12 +1855,12 @@ struct monst *mtmp, *victim;
/* new form might force gender change */ /* new form might force gender change */
fem = is_male(ptr) ? 0 : is_female(ptr) ? 1 : mtmp->female; fem = is_male(ptr) ? 0 : is_female(ptr) ? 1 : mtmp->female;
if (mvitals[newtype].mvflags & G_GENOD) { /* allow G_EXTINCT */ if (g.mvitals[newtype].mvflags & G_GENOD) { /* allow G_EXTINCT */
if (canspotmon(mtmp)) if (canspotmon(mtmp))
pline("As %s grows up into %s, %s %s!", mon_nam(mtmp), pline("As %s grows up into %s, %s %s!", mon_nam(mtmp),
an(ptr->mname), mhe(mtmp), an(ptr->mname), mhe(mtmp),
nonliving(ptr) ? "expires" : "dies"); nonliving(ptr) ? "expires" : "dies");
set_mon_data(mtmp, ptr, -1); /* keep mvitals[] accurate */ set_mon_data(mtmp, ptr, -1); /* keep g.mvitals[] accurate */
mondied(mtmp); mondied(mtmp);
return (struct permonst *) 0; return (struct permonst *) 0;
} else if (canspotmon(mtmp)) { } else if (canspotmon(mtmp)) {
+3 -3
View File
@@ -148,8 +148,8 @@ register struct monst *mtmp;
} }
/* mtmp can be killed */ /* mtmp can be killed */
bhitpos.x = mon->mx; g.bhitpos.x = mon->mx;
bhitpos.y = mon->my; g.bhitpos.y = mon->my;
g.notonhead = 0; g.notonhead = 0;
result = mattackm(mtmp, mon); result = mattackm(mtmp, mon);
@@ -871,7 +871,7 @@ register struct attack *mattk;
*/ */
num = monsndx(pd); num = monsndx(pd);
if (magr->mtame && !magr->isminion if (magr->mtame && !magr->isminion
&& !(mvitals[num].mvflags & G_NOCORPSE)) { && !(g.mvitals[num].mvflags & G_NOCORPSE)) {
struct obj *virtualcorpse = mksobj(CORPSE, FALSE, FALSE); struct obj *virtualcorpse = mksobj(CORPSE, FALSE, FALSE);
int nutrit; int nutrit;
+1 -1
View File
@@ -2903,7 +2903,7 @@ cloneu()
if (u.mh <= 1) if (u.mh <= 1)
return (struct monst *) 0; return (struct monst *) 0;
if (mvitals[mndx].mvflags & G_EXTINCT) if (g.mvitals[mndx].mvflags & G_EXTINCT)
return (struct monst *) 0; return (struct monst *) 0;
mon = makemon(youmonst.data, u.ux, u.uy, NO_MINVENT | MM_EDOG); mon = makemon(youmonst.data, u.ux, u.uy, NO_MINVENT | MM_EDOG);
if (!mon) if (!mon)
+4 -4
View File
@@ -120,7 +120,7 @@ struct monst *mon;
* If this daemon is unique and being re-summoned (the only way we * If this daemon is unique and being re-summoned (the only way we
* could get this far with an extinct dtype), try another. * could get this far with an extinct dtype), try another.
*/ */
if (mvitals[dtype].mvflags & G_GONE) { if (g.mvitals[dtype].mvflags & G_GONE) {
dtype = ndemon(atyp); dtype = ndemon(atyp);
if (dtype == NON_PM) if (dtype == NON_PM)
return 0; return 0;
@@ -334,7 +334,7 @@ aligntyp atyp;
for (tryct = !In_endgame(&u.uz) ? 20 : 0; tryct > 0; --tryct) { for (tryct = !In_endgame(&u.uz) ? 20 : 0; tryct > 0; --tryct) {
pm = rn1(PM_DEMOGORGON + 1 - PM_ORCUS, PM_ORCUS); pm = rn1(PM_DEMOGORGON + 1 - PM_ORCUS, PM_ORCUS);
if (!(mvitals[pm].mvflags & G_GONE) if (!(g.mvitals[pm].mvflags & G_GONE)
&& (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp))) && (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp)))
return pm; return pm;
} }
@@ -349,7 +349,7 @@ aligntyp atyp;
for (tryct = !In_endgame(&u.uz) ? 20 : 0; tryct > 0; --tryct) { for (tryct = !In_endgame(&u.uz) ? 20 : 0; tryct > 0; --tryct) {
pm = rn1(PM_YEENOGHU + 1 - PM_JUIBLEX, PM_JUIBLEX); pm = rn1(PM_YEENOGHU + 1 - PM_JUIBLEX, PM_JUIBLEX);
if (!(mvitals[pm].mvflags & G_GONE) if (!(g.mvitals[pm].mvflags & G_GONE)
&& (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp))) && (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp)))
return pm; return pm;
} }
@@ -360,7 +360,7 @@ aligntyp atyp;
int int
llord() llord()
{ {
if (!(mvitals[PM_ARCHON].mvflags & G_GONE)) if (!(g.mvitals[PM_ARCHON].mvflags & G_GONE))
return PM_ARCHON; return PM_ARCHON;
return lminion(); /* approximate */ return lminion(); /* approximate */
+17 -17
View File
@@ -359,7 +359,7 @@ register struct mkroom *aroom;
aroom->doorct++; aroom->doorct++;
for (tmp = g.doorindex; tmp > aroom->fdoor; tmp--) for (tmp = g.doorindex; tmp > aroom->fdoor; tmp--)
doors[tmp] = doors[tmp - 1]; g.doors[tmp] = g.doors[tmp - 1];
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
broom = &rooms[i]; broom = &rooms[i];
@@ -373,8 +373,8 @@ register struct mkroom *aroom;
} }
g.doorindex++; g.doorindex++;
doors[aroom->fdoor].x = x; g.doors[aroom->fdoor].x = x;
doors[aroom->fdoor].y = y; g.doors[aroom->fdoor].y = y;
} }
STATIC_OVL void STATIC_OVL void
@@ -385,7 +385,7 @@ int type;
{ {
boolean shdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE; boolean shdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
if (!IS_WALL(levl[x][y].typ)) /* avoid SDOORs on already made doors */ if (!IS_WALL(levl[x][y].typ)) /* avoid S.doors on already made doors */
type = DOOR; type = DOOR;
levl[x][y].typ = type; levl[x][y].typ = type;
if (type == DOOR) { if (type == DOOR) {
@@ -420,9 +420,9 @@ int type;
struct monst *mtmp; struct monst *mtmp;
if (level_difficulty() >= 9 && !rn2(5) if (level_difficulty() >= 9 && !rn2(5)
&& !((mvitals[PM_SMALL_MIMIC].mvflags & G_GONE) && !((g.mvitals[PM_SMALL_MIMIC].mvflags & G_GONE)
&& (mvitals[PM_LARGE_MIMIC].mvflags & G_GONE) && (g.mvitals[PM_LARGE_MIMIC].mvflags & G_GONE)
&& (mvitals[PM_GIANT_MIMIC].mvflags & G_GONE))) { && (g.mvitals[PM_GIANT_MIMIC].mvflags & G_GONE))) {
/* make a mimic instead */ /* make a mimic instead */
levl[x][y].doormask = D_NODOOR; levl[x][y].doormask = D_NODOOR;
mtmp = makemon(mkclass(S_MIMIC, 0), x, y, NO_MM_FLAGS); mtmp = makemon(mkclass(S_MIMIC, 0), x, y, NO_MM_FLAGS);
@@ -760,26 +760,26 @@ makelevel()
else if (u_depth > 4 && !rn2(6)) else if (u_depth > 4 && !rn2(6))
mkroom(COURT); mkroom(COURT);
else if (u_depth > 5 && !rn2(8) else if (u_depth > 5 && !rn2(8)
&& !(mvitals[PM_LEPRECHAUN].mvflags & G_GONE)) && !(g.mvitals[PM_LEPRECHAUN].mvflags & G_GONE))
mkroom(LEPREHALL); mkroom(LEPREHALL);
else if (u_depth > 6 && !rn2(7)) else if (u_depth > 6 && !rn2(7))
mkroom(ZOO); mkroom(ZOO);
else if (u_depth > 8 && !rn2(5)) else if (u_depth > 8 && !rn2(5))
mkroom(TEMPLE); mkroom(TEMPLE);
else if (u_depth > 9 && !rn2(5) else if (u_depth > 9 && !rn2(5)
&& !(mvitals[PM_KILLER_BEE].mvflags & G_GONE)) && !(g.mvitals[PM_KILLER_BEE].mvflags & G_GONE))
mkroom(BEEHIVE); mkroom(BEEHIVE);
else if (u_depth > 11 && !rn2(6)) else if (u_depth > 11 && !rn2(6))
mkroom(MORGUE); mkroom(MORGUE);
else if (u_depth > 12 && !rn2(8) && antholemon()) else if (u_depth > 12 && !rn2(8) && antholemon())
mkroom(ANTHOLE); mkroom(ANTHOLE);
else if (u_depth > 14 && !rn2(4) else if (u_depth > 14 && !rn2(4)
&& !(mvitals[PM_SOLDIER].mvflags & G_GONE)) && !(g.mvitals[PM_SOLDIER].mvflags & G_GONE))
mkroom(BARRACKS); mkroom(BARRACKS);
else if (u_depth > 15 && !rn2(6)) else if (u_depth > 15 && !rn2(6))
mkroom(SWAMP); mkroom(SWAMP);
else if (u_depth > 16 && !rn2(8) else if (u_depth > 16 && !rn2(8)
&& !(mvitals[PM_COCKATRICE].mvflags & G_GONE)) && !(g.mvitals[PM_COCKATRICE].mvflags & G_GONE))
mkroom(COCKNEST); mkroom(COCKNEST);
} }
@@ -1090,7 +1090,7 @@ coord *mp;
do do
croom = &rooms[rn2(g.nroom)]; croom = &rooms[rn2(g.nroom)];
while ((croom == dnstairs_room || croom == upstairs_room while ((croom == g.dnstairs_room || croom == g.upstairs_room
|| croom->rtype != OROOM) && (++tryct < 100)); || croom->rtype != OROOM) && (++tryct < 100));
} else } else
croom = &rooms[rn2(g.nroom)]; croom = &rooms[rn2(g.nroom)];
@@ -1166,7 +1166,7 @@ xchar x, y; /* location */
g.sstairs.up = g.sstairs.up =
(char) on_level(&br->end1, &u.uz) ? br->end1_up : !br->end1_up; (char) on_level(&br->end1, &u.uz) ? br->end1_up : !br->end1_up;
assign_level(&g.sstairs.tolev, dest); assign_level(&g.sstairs.tolev, dest);
sstairs_room = br_room; g.sstairs_room = br_room;
levl[x][y].ladder = g.sstairs.up ? LA_UP : LA_DOWN; levl[x][y].ladder = g.sstairs.up ? LA_UP : LA_DOWN;
levl[x][y].typ = STAIRS; levl[x][y].typ = STAIRS;
@@ -1520,11 +1520,11 @@ struct mkroom *croom;
if (up) { if (up) {
xupstair = x; xupstair = x;
yupstair = y; yupstair = y;
upstairs_room = croom; g.upstairs_room = croom;
} else { } else {
xdnstair = x; xdnstair = x;
ydnstair = y; ydnstair = y;
dnstairs_room = croom; g.dnstairs_room = croom;
} }
levl[x][y].typ = STAIRS; levl[x][y].typ = STAIRS;
@@ -1714,7 +1714,7 @@ mkinvokearea()
You("are standing at the top of a stairwell leading down!"); You("are standing at the top of a stairwell leading down!");
mkstairs(u.ux, u.uy, 0, (struct mkroom *) 0); /* down */ mkstairs(u.ux, u.uy, 0, (struct mkroom *) 0); /* down */
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
vision_full_recalc = 1; /* everything changed */ g.vision_full_recalc = 1; /* everything changed */
} }
/* Change level topology. Boulders in the vicinity are eliminated. /* Change level topology. Boulders in the vicinity are eliminated.
@@ -1765,7 +1765,7 @@ int dist;
lev->waslit = TRUE; lev->waslit = TRUE;
lev->horizontal = FALSE; lev->horizontal = FALSE;
/* short-circuit vision recalc */ /* short-circuit vision recalc */
viz_array[y][x] = (dist < 6) ? (IN_SIGHT | COULD_SEE) : COULD_SEE; g.viz_array[y][x] = (dist < 6) ? (IN_SIGHT | COULD_SEE) : COULD_SEE;
switch (dist) { switch (dist) {
case 1: /* fire traps */ case 1: /* fire traps */
+2 -2
View File
@@ -1517,7 +1517,7 @@ movebubbles()
/* put attached ball&chain back */ /* put attached ball&chain back */
if (Is_waterlevel(&u.uz) && Punished) if (Is_waterlevel(&u.uz) && Punished)
placebc(); placebc();
vision_full_recalc = 1; g.vision_full_recalc = 1;
} }
/* when moving in water, possibly (1 in 3) alter the intended destination */ /* when moving in water, possibly (1 in 3) alter the intended destination */
@@ -1648,7 +1648,7 @@ STATIC_OVL void
set_wportal() set_wportal()
{ {
/* there better be only one magic portal on water level... */ /* there better be only one magic portal on water level... */
for (g.wportal = ftrap; g.wportal; g.wportal = g.wportal->ntrap) for (g.wportal = g.ftrap; g.wportal; g.wportal = g.wportal->ntrap)
if (g.wportal->ttyp == MAGIC_PORTAL) if (g.wportal->ttyp == MAGIC_PORTAL)
return; return;
impossible("set_wportal(): no portal!"); impossible("set_wportal(): no portal!");
+18 -18
View File
@@ -806,7 +806,7 @@ boolean artif;
tryct = 50; tryct = 50;
do do
otmp->corpsenm = undead_to_corpse(rndmonnum()); otmp->corpsenm = undead_to_corpse(rndmonnum());
while ((mvitals[otmp->corpsenm].mvflags & G_NOCORPSE) while ((g.mvitals[otmp->corpsenm].mvflags & G_NOCORPSE)
&& (--tryct > 0)); && (--tryct > 0));
if (tryct == 0) { if (tryct == 0) {
/* perhaps rndmonnum() only wants to make G_NOCORPSE /* perhaps rndmonnum() only wants to make G_NOCORPSE
@@ -836,7 +836,7 @@ boolean artif;
for (tryct = 200; tryct > 0; --tryct) { for (tryct = 200; tryct > 0; --tryct) {
mndx = undead_to_corpse(rndmonnum()); mndx = undead_to_corpse(rndmonnum());
if (mons[mndx].cnutrit if (mons[mndx].cnutrit
&& !(mvitals[mndx].mvflags & G_NOCORPSE)) { && !(g.mvitals[mndx].mvflags & G_NOCORPSE)) {
otmp->corpsenm = mndx; otmp->corpsenm = mndx;
set_tin_variety(otmp, RANDOM_TIN); set_tin_variety(otmp, RANDOM_TIN);
break; break;
@@ -1054,7 +1054,7 @@ boolean artif;
case CORPSE: case CORPSE:
if (otmp->corpsenm == NON_PM) { if (otmp->corpsenm == NON_PM) {
otmp->corpsenm = undead_to_corpse(rndmonnum()); otmp->corpsenm = undead_to_corpse(rndmonnum());
if (mvitals[otmp->corpsenm].mvflags & (G_NOCORPSE | G_GONE)) if (g.mvitals[otmp->corpsenm].mvflags & (G_NOCORPSE | G_GONE))
otmp->corpsenm = urole.malenum; otmp->corpsenm = urole.malenum;
} }
/*FALLTHRU*/ /*FALLTHRU*/
@@ -2115,10 +2115,10 @@ struct obj *obj;
if (obj_sheds_light(obj)) if (obj_sheds_light(obj))
del_light_source(LS_OBJECT, obj_to_any(obj)); del_light_source(LS_OBJECT, obj_to_any(obj));
if (obj == thrownobj) if (obj == g.thrownobj)
thrownobj = 0; g.thrownobj = 0;
if (obj == kickedobj) if (obj == g.kickedobj)
kickedobj = 0; g.kickedobj = 0;
if (obj->oextra) if (obj->oextra)
dealloc_oextra(obj); dealloc_oextra(obj);
@@ -2248,26 +2248,26 @@ obj_sanity_check()
objlist_sanity(billobjs, OBJ_ONBILL, "bill sanity"); objlist_sanity(billobjs, OBJ_ONBILL, "bill sanity");
mon_obj_sanity(fmon, "minvent sanity"); mon_obj_sanity(fmon, "minvent sanity");
mon_obj_sanity(migrating_mons, "migrating minvent sanity"); mon_obj_sanity(g.migrating_mons, "migrating minvent sanity");
/* monsters temporarily in transit; /* monsters temporarily in transit;
they should have arrived with hero by the time we get called */ they should have arrived with hero by the time we get called */
if (mydogs) { if (g.mydogs) {
impossible("mydogs sanity [not empty]"); impossible("g.mydogs sanity [not empty]");
mon_obj_sanity(mydogs, "mydogs minvent sanity"); mon_obj_sanity(g.mydogs, "mydogs minvent sanity");
} }
/* objects temporarily freed from invent/floor lists; /* objects temporarily freed from invent/floor lists;
they should have arrived somewhere by the time we get called */ they should have arrived somewhere by the time we get called */
if (thrownobj) if (g.thrownobj)
insane_object(thrownobj, ofmt3, "thrownobj sanity", insane_object(g.thrownobj, ofmt3, "g.thrownobj sanity",
(struct monst *) 0); (struct monst *) 0);
if (kickedobj) if (g.kickedobj)
insane_object(kickedobj, ofmt3, "kickedobj sanity", insane_object(g.kickedobj, ofmt3, "g.kickedobj sanity",
(struct monst *) 0); (struct monst *) 0);
/* current_wand isn't removed from invent while in use, but should /* g.current_wand isn't removed from invent while in use, but should
be Null between moves when we're called */ be Null between moves when we're called */
if (current_wand) if (g.current_wand)
insane_object(current_wand, ofmt3, "current_wand sanity", insane_object(g.current_wand, ofmt3, "g.current_wand sanity",
(struct monst *) 0); (struct monst *) 0);
} }
+13 -13
View File
@@ -311,15 +311,15 @@ struct mkroom *sroom;
if (sroom->irregular) { if (sroom->irregular) {
if ((int) levl[sx][sy].roomno != rmno || levl[sx][sy].edge if ((int) levl[sx][sy].roomno != rmno || levl[sx][sy].edge
|| (sroom->doorct || (sroom->doorct
&& distmin(sx, sy, doors[sh].x, doors[sh].y) <= 1)) && distmin(sx, sy, g.doors[sh].x, g.doors[sh].y) <= 1))
continue; continue;
} else if (!SPACE_POS(levl[sx][sy].typ) } else if (!SPACE_POS(levl[sx][sy].typ)
|| (sroom->doorct || (sroom->doorct
&& ((sx == sroom->lx && doors[sh].x == sx - 1) && ((sx == sroom->lx && g.doors[sh].x == sx - 1)
|| (sx == sroom->hx && doors[sh].x == sx + 1) || (sx == sroom->hx && g.doors[sh].x == sx + 1)
|| (sy == sroom->ly && doors[sh].y == sy - 1) || (sy == sroom->ly && g.doors[sh].y == sy - 1)
|| (sy == sroom->hy || (sy == sroom->hy
&& doors[sh].y == sy + 1)))) && g.doors[sh].y == sy + 1))))
continue; continue;
/* don't place monster on explicitly placed throne */ /* don't place monster on explicitly placed throne */
if (type == COURT && IS_THRONE(levl[sx][sy].typ)) if (type == COURT && IS_THRONE(levl[sx][sy].typ))
@@ -353,7 +353,7 @@ struct mkroom *sroom;
case ZOO: case ZOO:
case LEPREHALL: case LEPREHALL:
if (sroom->doorct) { if (sroom->doorct) {
int distval = dist2(sx, sy, doors[sh].x, doors[sh].y); int distval = dist2(sx, sy, g.doors[sh].x, g.doors[sh].y);
i = sq(distval); i = sq(distval);
} else } else
i = goldlim; i = goldlim;
@@ -502,9 +502,9 @@ antholemon()
break; break;
} }
/* try again if chosen type has been genocided or used up */ /* try again if chosen type has been genocided or used up */
} while (++trycnt < 3 && (mvitals[mtyp].mvflags & G_GONE)); } while (++trycnt < 3 && (g.mvitals[mtyp].mvflags & G_GONE));
return ((mvitals[mtyp].mvflags & G_GONE) ? (struct permonst *) 0 return ((g.mvitals[mtyp].mvflags & G_GONE) ? (struct permonst *) 0
: &mons[mtyp]); : &mons[mtyp]);
} }
@@ -615,10 +615,10 @@ boolean
has_dnstairs(sroom) has_dnstairs(sroom)
register struct mkroom *sroom; register struct mkroom *sroom;
{ {
if (sroom == dnstairs_room) if (sroom == g.dnstairs_room)
return TRUE; return TRUE;
if (g.sstairs.sx && !g.sstairs.up) if (g.sstairs.sx && !g.sstairs.up)
return (boolean) (sroom == sstairs_room); return (boolean) (sroom == g.sstairs_room);
return FALSE; return FALSE;
} }
@@ -626,10 +626,10 @@ boolean
has_upstairs(sroom) has_upstairs(sroom)
register struct mkroom *sroom; register struct mkroom *sroom;
{ {
if (sroom == upstairs_room) if (sroom == g.upstairs_room)
return TRUE; return TRUE;
if (g.sstairs.sx && g.sstairs.up) if (g.sstairs.sx && g.sstairs.up)
return (boolean) (sroom == sstairs_room); return (boolean) (sroom == g.sstairs_room);
return FALSE; return FALSE;
} }
@@ -785,7 +785,7 @@ squadmon()
} }
mndx = squadprob[rn2(NSTYPES)].pm; mndx = squadprob[rn2(NSTYPES)].pm;
gotone: gotone:
if (!(mvitals[mndx].mvflags & G_GONE)) if (!(g.mvitals[mndx].mvflags & G_GONE))
return &mons[mndx]; return &mons[mndx];
else else
return (struct permonst *) 0; return (struct permonst *) 0;
+30 -30
View File
@@ -66,7 +66,7 @@ const char *msg;
#endif #endif
return; return;
} }
if (chk_geno && (mvitals[mndx].mvflags & G_GENOD) != 0) if (chk_geno && (g.mvitals[mndx].mvflags & G_GENOD) != 0)
impossible("genocided %s in play (%s)", mons[mndx].mname, msg); impossible("genocided %s in play (%s)", mons[mndx].mname, msg);
} }
if (mtmp->isshk && !has_eshk(mtmp)) if (mtmp->isshk && !has_eshk(mtmp))
@@ -131,7 +131,7 @@ mon_sanity_check()
mtmp->mx, mtmp->my, x, y); mtmp->mx, mtmp->my, x, y);
} }
for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) { for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon) {
sanity_check_single_mon(mtmp, FALSE, "migr"); sanity_check_single_mon(mtmp, FALSE, "migr");
} }
} }
@@ -435,7 +435,7 @@ unsigned corpseflags;
return obj; return obj;
default_1: default_1:
default: default:
if (mvitals[mndx].mvflags & G_NOCORPSE) { if (g.mvitals[mndx].mvflags & G_NOCORPSE) {
return (struct obj *) 0; return (struct obj *) 0;
} else { } else {
corpstatflags |= CORPSTAT_INIT; corpstatflags |= CORPSTAT_INIT;
@@ -681,7 +681,7 @@ mcalcdistress()
/* must check non-moving monsters once/turn in case /* must check non-moving monsters once/turn in case
* they managed to end up in liquid */ * they managed to end up in liquid */
if (mtmp->data->mmove == 0) { if (mtmp->data->mmove == 0) {
if (vision_full_recalc) if (g.vision_full_recalc)
vision_recalc(0); vision_recalc(0);
if (minliquid(mtmp)) if (minliquid(mtmp))
continue; continue;
@@ -771,7 +771,7 @@ movemon()
if (mtmp->movement >= NORMAL_SPEED) if (mtmp->movement >= NORMAL_SPEED)
somebody_can_move = TRUE; somebody_can_move = TRUE;
if (vision_full_recalc) if (g.vision_full_recalc)
vision_recalc(0); /* vision! */ vision_recalc(0); /* vision! */
/* reset obj bypasses before next monster moves */ /* reset obj bypasses before next monster moves */
@@ -831,7 +831,7 @@ movemon()
} }
if (any_light_source()) if (any_light_source())
vision_full_recalc = 1; /* in case a mon moved with a light source */ g.vision_full_recalc = 1; /* in case a mon moved with a light source */
/* reset obj bypasses after last monster has moved */ /* reset obj bypasses after last monster has moved */
if (context.bypasses) if (context.bypasses)
clear_bypasses(); clear_bypasses();
@@ -1664,7 +1664,7 @@ struct monst *mtmp, *mtmp2;
void void
relmon(mon, monst_list) relmon(mon, monst_list)
struct monst *mon; struct monst *mon;
struct monst **monst_list; /* &migrating_mons or &mydogs or null */ struct monst **monst_list; /* &g.migrating_mons or &g.mydogs or null */
{ {
struct monst *mtmp; struct monst *mtmp;
int mx = mon->mx, my = mon->my; int mx = mon->mx, my = mon->my;
@@ -1706,7 +1706,7 @@ struct monst **monst_list; /* &migrating_mons or &mydogs or null */
if (unhide) { if (unhide) {
if (on_map) if (on_map)
newsym(mx, my); newsym(mx, my);
/* insert into mydogs or migrating_mons */ /* insert into g.mydogs or g.migrating_mons */
mon->nmon = *monst_list; mon->nmon = *monst_list;
*monst_list = mon; *monst_list = mon;
} else { } else {
@@ -1877,7 +1877,7 @@ struct monst *mtmp;
/* equip replacement amulet, if any, on next move */ /* equip replacement amulet, if any, on next move */
mtmp->misc_worn_check |= I_SPECIAL; mtmp->misc_worn_check |= I_SPECIAL;
surviver = !(mvitals[monsndx(mtmp->data)].mvflags & G_GENOD); surviver = !(g.mvitals[monsndx(mtmp->data)].mvflags & G_GENOD);
mtmp->mcanmove = 1; mtmp->mcanmove = 1;
mtmp->mfrozen = 0; mtmp->mfrozen = 0;
if (mtmp->mtame && !mtmp->isminion) { if (mtmp->mtame && !mtmp->isminion) {
@@ -1915,7 +1915,7 @@ register struct monst *mtmp;
/* this only happens if shapeshifted */ /* this only happens if shapeshifted */
if (mndx >= LOW_PM && mndx != monsndx(mtmp->data) if (mndx >= LOW_PM && mndx != monsndx(mtmp->data)
&& !(mvitals[mndx].mvflags & G_GENOD)) { && !(g.mvitals[mndx].mvflags & G_GENOD)) {
char buf[BUFSZ]; char buf[BUFSZ];
boolean in_door = (amorphous(mtmp->data) boolean in_door = (amorphous(mtmp->data)
&& closed_door(mtmp->mx, mtmp->my)), && closed_door(mtmp->mx, mtmp->my)),
@@ -1994,7 +1994,7 @@ register struct monst *mtmp;
set_mon_data(mtmp, &mons[PM_HUMAN_WERERAT], -1); set_mon_data(mtmp, &mons[PM_HUMAN_WERERAT], -1);
/* /*
* mvitals[].died does double duty as total number of dead monsters * g.mvitals[].died does double duty as total number of dead monsters
* and as experience factor for the player killing more monsters. * and as experience factor for the player killing more monsters.
* this means that a dragon dying by other means reduces the * this means that a dragon dying by other means reduces the
* experience the player gets for killing a dragon directly; this * experience the player gets for killing a dragon directly; this
@@ -2004,8 +2004,8 @@ register struct monst *mtmp;
* for rings of conflict and such. * for rings of conflict and such.
*/ */
tmp = monsndx(mtmp->data); tmp = monsndx(mtmp->data);
if (mvitals[tmp].died < 255) if (g.mvitals[tmp].died < 255)
mvitals[tmp].died++; g.mvitals[tmp].died++;
/* if it's a (possibly polymorphed) quest leader, mark him as dead */ /* if it's a (possibly polymorphed) quest leader, mark him as dead */
if (mtmp->m_id == g.quest_status.leader_m_id) if (mtmp->m_id == g.quest_status.leader_m_id)
@@ -2013,7 +2013,7 @@ register struct monst *mtmp;
#ifdef MAIL #ifdef MAIL
/* if the mail daemon dies, no more mail delivery. -3. */ /* if the mail daemon dies, no more mail delivery. -3. */
if (tmp == PM_MAIL_DAEMON) if (tmp == PM_MAIL_DAEMON)
mvitals[tmp].mvflags |= G_GENOD; g.mvitals[tmp].mvflags |= G_GENOD;
#endif #endif
if (mtmp->data->mlet == S_KOP) { if (mtmp->data->mlet == S_KOP) {
@@ -2273,7 +2273,7 @@ struct monst *mtmp;
u.uswldtim = 0; u.uswldtim = 0;
if (Punished && uchain->where != OBJ_FLOOR) if (Punished && uchain->where != OBJ_FLOOR)
placebc(); placebc();
vision_full_recalc = 1; g.vision_full_recalc = 1;
docrt(); docrt();
/* prevent swallower (mtmp might have just poly'd into something /* prevent swallower (mtmp might have just poly'd into something
without an engulf attack) from immediately re-engulfing */ without an engulf attack) from immediately re-engulfing */
@@ -2337,15 +2337,15 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
if (mtmp->mtame && !mtmp->isminion) if (mtmp->mtame && !mtmp->isminion)
EDOG(mtmp)->killed_by_u = 1; EDOG(mtmp)->killed_by_u = 1;
if (wasinside && thrownobj && thrownobj != uball) { if (wasinside && g.thrownobj && g.thrownobj != uball) {
/* thrown object has killed hero's engulfer; add it to mon's /* thrown object has killed hero's engulfer; add it to mon's
inventory now so that it will be placed with mon's other inventory now so that it will be placed with mon's other
stuff prior to lookhere/autopickup when hero is expelled stuff prior to lookhere/autopickup when hero is expelled
below (as a side-effect, this missile has immunity from below (as a side-effect, this missile has immunity from
being consumed [for this shot/throw only]) */ being consumed [for this shot/throw only]) */
mpickobj(mtmp, thrownobj); mpickobj(mtmp, g.thrownobj);
/* let throwing code know that missile has been disposed of */ /* let throwing code know that missile has been disposed of */
thrownobj = 0; g.thrownobj = 0;
} }
g.vamp_rise_msg = FALSE; /* might get set in mondead(); only checked below */ g.vamp_rise_msg = FALSE; /* might get set in mondead(); only checked below */
@@ -2389,7 +2389,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
int otyp; int otyp;
/* illogical but traditional "treasure drop" */ /* illogical but traditional "treasure drop" */
if (!rn2(6) && !(mvitals[mndx].mvflags & G_NOCORPSE) if (!rn2(6) && !(g.mvitals[mndx].mvflags & G_NOCORPSE)
/* no extra item from swallower or steed */ /* no extra item from swallower or steed */
&& (x != u.ux || y != u.uy) && (x != u.ux || y != u.uy)
/* no extra item from kops--too easy to abuse */ /* no extra item from kops--too easy to abuse */
@@ -2443,7 +2443,7 @@ cleanup:
} }
/* give experience points */ /* give experience points */
tmp = experience(mtmp, (int) mvitals[mndx].died); tmp = experience(mtmp, (int) g.mvitals[mndx].died);
more_experienced(tmp, 0); more_experienced(tmp, 0);
newexplevel(); /* will decide if you go up */ newexplevel(); /* will decide if you go up */
@@ -2512,7 +2512,7 @@ struct monst *mtmp;
/* this only happens if shapeshifted */ /* this only happens if shapeshifted */
if (mndx >= LOW_PM && mndx != monsndx(mtmp->data) if (mndx >= LOW_PM && mndx != monsndx(mtmp->data)
&& !(mvitals[mndx].mvflags & G_GENOD)) { && !(g.mvitals[mndx].mvflags & G_GENOD)) {
char buf[BUFSZ]; char buf[BUFSZ];
boolean in_door = (amorphous(mtmp->data) boolean in_door = (amorphous(mtmp->data)
&& closed_door(mtmp->mx, mtmp->my)); && closed_door(mtmp->mx, mtmp->my));
@@ -3068,10 +3068,10 @@ struct monst *mon;
if ((is_hider(mon->data) || hider_under) if ((is_hider(mon->data) || hider_under)
&& !(mon->mundetected || mon->m_ap_type)) { && !(mon->mundetected || mon->m_ap_type)) {
xchar x = mon->mx, y = mon->my; xchar x = mon->mx, y = mon->my;
char save_viz = viz_array[y][x]; char save_viz = g.viz_array[y][x];
/* override vision, forcing hero to be unable to see monster's spot */ /* override vision, forcing hero to be unable to see monster's spot */
viz_array[y][x] &= ~(IN_SIGHT | COULD_SEE); g.viz_array[y][x] &= ~(IN_SIGHT | COULD_SEE);
if (is_hider(mon->data)) if (is_hider(mon->data))
(void) restrap(mon); (void) restrap(mon);
/* try again if mimic missed its 1/3 chance to hide */ /* try again if mimic missed its 1/3 chance to hide */
@@ -3079,7 +3079,7 @@ struct monst *mon;
(void) restrap(mon); (void) restrap(mon);
if (hider_under) if (hider_under)
(void) hideunder(mon); (void) hideunder(mon);
viz_array[y][x] = save_viz; g.viz_array[y][x] = save_viz;
} }
} }
@@ -3427,7 +3427,7 @@ int mndx;
if (mndx == NON_PM) if (mndx == NON_PM)
return 0; return 0;
mdat = &mons[mndx]; mdat = &mons[mndx];
if ((mvitals[mndx].mvflags & G_GENOD) != 0) if ((g.mvitals[mndx].mvflags & G_GENOD) != 0)
return 0; return 0;
if (is_placeholder(mdat)) if (is_placeholder(mdat))
return 0; return 0;
@@ -3518,7 +3518,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
} while (--tryct > 0); } while (--tryct > 0);
if (!tryct) if (!tryct)
return 0; return 0;
} else if (mvitals[monsndx(mdat)].mvflags & G_GENOD) } else if (g.mvitals[monsndx(mdat)].mvflags & G_GENOD)
return 0; /* passed in mdat is genocided */ return 0; /* passed in mdat is genocided */
if (mdat == olddata) if (mdat == olddata)
@@ -3750,8 +3750,8 @@ boolean egg;
* overpopulation does not kill eggs. * overpopulation does not kill eggs.
*/ */
alt_idx = egg ? big_to_little(m_idx) : m_idx; alt_idx = egg ? big_to_little(m_idx) : m_idx;
return (boolean) ((mvitals[m_idx].mvflags & G_GENOD) != 0 return (boolean) ((g.mvitals[m_idx].mvflags & G_GENOD) != 0
|| (mvitals[alt_idx].mvflags & G_GENOD) != 0); || (g.mvitals[alt_idx].mvflags & G_GENOD) != 0);
} }
/* kill off any eggs of genocided monsters */ /* kill off any eggs of genocided monsters */
@@ -3810,8 +3810,8 @@ kill_genocided_monsters()
continue; continue;
mndx = monsndx(mtmp->data); mndx = monsndx(mtmp->data);
kill_cham = (mtmp->cham >= LOW_PM kill_cham = (mtmp->cham >= LOW_PM
&& (mvitals[mtmp->cham].mvflags & G_GENOD)); && (g.mvitals[mtmp->cham].mvflags & G_GENOD));
if ((mvitals[mndx].mvflags & G_GENOD) || kill_cham) { if ((g.mvitals[mndx].mvflags & G_GENOD) || kill_cham) {
if (mtmp->cham >= LOW_PM && !kill_cham) if (mtmp->cham >= LOW_PM && !kill_cham)
(void) newcham(mtmp, (struct permonst *) 0, FALSE, FALSE); (void) newcham(mtmp, (struct permonst *) 0, FALSE, FALSE);
else else
+1 -1
View File
@@ -88,7 +88,7 @@ struct permonst *ptr;
{ {
/* non-stone golems turn into stone golems unless latter is genocided */ /* non-stone golems turn into stone golems unless latter is genocided */
return (boolean) (is_golem(ptr) && ptr != &mons[PM_STONE_GOLEM] return (boolean) (is_golem(ptr) && ptr != &mons[PM_STONE_GOLEM]
&& !(mvitals[PM_STONE_GOLEM].mvflags & G_GENOD)); && !(g.mvitals[PM_STONE_GOLEM].mvflags & G_GENOD));
/* allow G_EXTINCT */ /* allow G_EXTINCT */
} }
+2 -2
View File
@@ -264,7 +264,7 @@ struct obj *obj;
struct monst *mtmp = 0; struct monst *mtmp = 0;
/* find a queen bee */ /* find a queen bee */
if ((mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0) if ((g.mvitals[PM_QUEEN_BEE].mvflags & G_GENOD) == 0)
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
@@ -1731,7 +1731,7 @@ boolean
can_fog(mtmp) can_fog(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
if (!(mvitals[PM_FOG_CLOUD].mvflags & G_GENOD) && is_vampshifter(mtmp) if (!(g.mvitals[PM_FOG_CLOUD].mvflags & G_GENOD) && is_vampshifter(mtmp)
&& !Protection_from_shape_changers && !stuff_prevents_passage(mtmp)) && !Protection_from_shape_changers && !stuff_prevents_passage(mtmp))
return TRUE; return TRUE;
return FALSE; return FALSE;
+24 -24
View File
@@ -299,7 +299,7 @@ struct obj *otmp, *mwep;
return 1 if the object has stopped moving (hit or its range used up) */ return 1 if the object has stopped moving (hit or its range used up) */
int int
ohitmon(mtmp, otmp, range, verbose) ohitmon(mtmp, otmp, range, verbose)
struct monst *mtmp; /* accidental target, located at <bhitpos.x,.y> */ struct monst *mtmp; /* accidental target, located at <g.bhitpos.x,.y> */
struct obj *otmp; /* missile; might be destroyed by drop_throw */ struct obj *otmp; /* missile; might be destroyed by drop_throw */
int range; /* how much farther will object travel if it misses; int range; /* how much farther will object travel if it misses;
use -1 to signify to keep going even after hit, use -1 to signify to keep going even after hit,
@@ -311,9 +311,9 @@ boolean verbose; /* give message(s) even when you can't see what happened */
int objgone = 1; int objgone = 1;
struct obj *mon_launcher = archer ? MON_WEP(archer) : NULL; struct obj *mon_launcher = archer ? MON_WEP(archer) : NULL;
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my); g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER; ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER;
vis = cansee(bhitpos.x, bhitpos.y); vis = cansee(g.bhitpos.x, g.bhitpos.y);
tmp = 5 + find_mac(mtmp) + omon_adj(mtmp, otmp, FALSE); tmp = 5 + find_mac(mtmp) + omon_adj(mtmp, otmp, FALSE);
/* High level monsters will be more likely to hit */ /* High level monsters will be more likely to hit */
@@ -435,7 +435,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */
mtmp->mblinded = tmp; mtmp->mblinded = tmp;
} }
objgone = drop_throw(otmp, 1, bhitpos.x, bhitpos.y); objgone = drop_throw(otmp, 1, g.bhitpos.x, g.bhitpos.y);
if (!objgone && range == -1) { /* special case */ if (!objgone && range == -1) { /* special case */
obj_extract_self(otmp); /* free it for motion again */ obj_extract_self(otmp); /* free it for motion again */
return 0; return 0;
@@ -447,21 +447,21 @@ boolean verbose; /* give message(s) even when you can't see what happened */
#define MT_FLIGHTCHECK(pre) \ #define MT_FLIGHTCHECK(pre) \
(/* missile hits edge of screen */ \ (/* missile hits edge of screen */ \
!isok(bhitpos.x + dx, bhitpos.y + dy) \ !isok(g.bhitpos.x + dx, g.bhitpos.y + dy) \
/* missile hits the wall */ \ /* missile hits the wall */ \
|| IS_ROCK(levl[bhitpos.x + dx][bhitpos.y + dy].typ) \ || IS_ROCK(levl[g.bhitpos.x + dx][g.bhitpos.y + dy].typ) \
/* missile hit closed door */ \ /* missile hit closed door */ \
|| closed_door(bhitpos.x + dx, bhitpos.y + dy) \ || closed_door(g.bhitpos.x + dx, g.bhitpos.y + dy) \
/* missile might hit iron bars */ \ /* missile might hit iron bars */ \
/* the random chance for small objects hitting bars is */ \ /* the random chance for small objects hitting bars is */ \
/* skipped when reaching them at point blank range */ \ /* skipped when reaching them at point blank range */ \
|| (levl[bhitpos.x + dx][bhitpos.y + dy].typ == IRONBARS \ || (levl[g.bhitpos.x + dx][g.bhitpos.y + dy].typ == IRONBARS \
&& hits_bars(&singleobj, \ && hits_bars(&singleobj, \
bhitpos.x, bhitpos.y, \ g.bhitpos.x, g.bhitpos.y, \
bhitpos.x + dx, bhitpos.y + dy, \ g.bhitpos.x + dx, g.bhitpos.y + dy, \
((pre) ? 0 : !rn2(5)), 0)) \ ((pre) ? 0 : !rn2(5)), 0)) \
/* Thrown objects "sink" */ \ /* Thrown objects "sink" */ \
|| (!(pre) && IS_SINK(levl[bhitpos.x][bhitpos.y].typ))) || (!(pre) && IS_SINK(levl[g.bhitpos.x][g.bhitpos.y].typ)))
void void
m_throw(mon, x, y, dx, dy, range, obj) m_throw(mon, x, y, dx, dy, range, obj)
@@ -474,8 +474,8 @@ struct obj *obj; /* missile (or stack providing it) */
char sym = obj->oclass; char sym = obj->oclass;
int hitu = 0, oldumort, blindinc = 0; int hitu = 0, oldumort, blindinc = 0;
bhitpos.x = x; g.bhitpos.x = x;
bhitpos.y = y; g.bhitpos.y = y;
g.notonhead = FALSE; /* reset potentially stale value */ g.notonhead = FALSE; /* reset potentially stale value */
if (obj->quan == 1L) { if (obj->quan == 1L) {
@@ -515,13 +515,13 @@ struct obj *obj; /* missile (or stack providing it) */
dy = rn2(3) - 1; dy = rn2(3) - 1;
/* check validity of new direction */ /* check validity of new direction */
if (!dx && !dy) { if (!dx && !dy) {
(void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y); (void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
return; return;
} }
} }
if (MT_FLIGHTCHECK(TRUE)) { if (MT_FLIGHTCHECK(TRUE)) {
(void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y); (void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
return; return;
} }
mesg_given = 0; /* a 'missile misses' message has not yet been shown */ mesg_given = 0; /* a 'missile misses' message has not yet been shown */
@@ -533,12 +533,12 @@ struct obj *obj; /* missile (or stack providing it) */
if (sym) if (sym)
tmp_at(DISP_FLASH, obj_to_glyph(singleobj)); tmp_at(DISP_FLASH, obj_to_glyph(singleobj));
while (range-- > 0) { /* Actually the loop is always exited by break */ while (range-- > 0) { /* Actually the loop is always exited by break */
bhitpos.x += dx; g.bhitpos.x += dx;
bhitpos.y += dy; g.bhitpos.y += dy;
if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) { if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) {
if (ohitmon(mtmp, singleobj, range, TRUE)) if (ohitmon(mtmp, singleobj, range, TRUE))
break; break;
} else if (bhitpos.x == u.ux && bhitpos.y == u.uy) { } else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
if (g.multi) if (g.multi)
nomul(0); nomul(0);
@@ -654,18 +654,18 @@ struct obj *obj; /* missile (or stack providing it) */
|| MT_FLIGHTCHECK(FALSE)) { || MT_FLIGHTCHECK(FALSE)) {
if (singleobj) { /* hits_bars might have destroyed it */ if (singleobj) { /* hits_bars might have destroyed it */
if (g.m_shot.n > 1 if (g.m_shot.n > 1
&& (!mesg_given || bhitpos.x != u.ux || bhitpos.y != u.uy) && (!mesg_given || g.bhitpos.x != u.ux || g.bhitpos.y != u.uy)
&& (cansee(bhitpos.x, bhitpos.y) && (cansee(g.bhitpos.x, g.bhitpos.y)
|| (archer && canseemon(archer)))) || (archer && canseemon(archer))))
pline("%s misses.", The(mshot_xname(singleobj))); pline("%s misses.", The(mshot_xname(singleobj)));
(void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y); (void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
} }
break; break;
} }
tmp_at(bhitpos.x, bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
delay_output(); delay_output();
} }
tmp_at(bhitpos.x, bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
delay_output(); delay_output();
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
mesg_given = 0; /* reset */ mesg_given = 0; /* reset */
+27 -27
View File
@@ -58,8 +58,8 @@ struct obj *obj;
potion_descr = OBJ_DESCR(objects[obj->otyp]); potion_descr = OBJ_DESCR(objects[obj->otyp]);
if (potion_descr && !strcmp(potion_descr, "milky")) { if (potion_descr && !strcmp(potion_descr, "milky")) {
if (!(mvitals[PM_GHOST].mvflags & G_GONE) if (!(g.mvitals[PM_GHOST].mvflags & G_GONE)
&& !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_GHOST].born))) { && !rn2(POTION_OCCUPANT_CHANCE(g.mvitals[PM_GHOST].born))) {
if (!enexto(&cc, mon->mx, mon->my, &mons[PM_GHOST])) if (!enexto(&cc, mon->mx, mon->my, &mons[PM_GHOST]))
return 0; return 0;
mquaffmsg(mon, obj); mquaffmsg(mon, obj);
@@ -84,8 +84,8 @@ struct obj *obj;
} }
} }
if (potion_descr && !strcmp(potion_descr, "smoky") if (potion_descr && !strcmp(potion_descr, "smoky")
&& !(mvitals[PM_DJINNI].mvflags & G_GONE) && !(g.mvitals[PM_DJINNI].mvflags & G_GONE)
&& !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_DJINNI].born))) { && !rn2(POTION_OCCUPANT_CHANCE(g.mvitals[PM_DJINNI].born))) {
if (!enexto(&cc, mon->mx, mon->my, &mons[PM_DJINNI])) if (!enexto(&cc, mon->mx, mon->my, &mons[PM_DJINNI]))
return 0; return 0;
mquaffmsg(mon, obj); mquaffmsg(mon, obj);
@@ -1252,9 +1252,9 @@ register struct obj *otmp;
break; break;
} }
if (reveal_invis) { if (reveal_invis) {
if (!DEADMONSTER(mtmp) && cansee(bhitpos.x, bhitpos.y) if (!DEADMONSTER(mtmp) && cansee(g.bhitpos.x, g.bhitpos.y)
&& !canspotmon(mtmp)) && !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y); map_invisible(g.bhitpos.x, g.bhitpos.y);
} }
return 0; return 0;
} }
@@ -1277,22 +1277,22 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */
register uchar typ; register uchar typ;
int ddx, ddy; int ddx, ddy;
bhitpos.x = mon->mx; g.bhitpos.x = mon->mx;
bhitpos.y = mon->my; g.bhitpos.y = mon->my;
ddx = sgn(mon->mux - mon->mx); ddx = sgn(mon->mux - mon->mx);
ddy = sgn(mon->muy - mon->my); ddy = sgn(mon->muy - mon->my);
while (range-- > 0) { while (range-- > 0) {
int x, y; int x, y;
bhitpos.x += ddx; g.bhitpos.x += ddx;
bhitpos.y += ddy; g.bhitpos.y += ddy;
x = bhitpos.x; x = g.bhitpos.x;
y = bhitpos.y; y = g.bhitpos.y;
if (!isok(x, y)) { if (!isok(x, y)) {
bhitpos.x -= ddx; g.bhitpos.x -= ddx;
bhitpos.y -= ddy; g.bhitpos.y -= ddy;
break; break;
} }
if (find_drawbridge(&x, &y)) if (find_drawbridge(&x, &y))
@@ -1300,12 +1300,12 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */
case WAN_STRIKING: case WAN_STRIKING:
destroy_drawbridge(x, y); destroy_drawbridge(x, y);
} }
if (bhitpos.x == u.ux && bhitpos.y == u.uy) { if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
(*fhitm)(&youmonst, obj); (*fhitm)(&youmonst, obj);
range -= 3; range -= 3;
} else if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) { } else if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) {
if (cansee(bhitpos.x, bhitpos.y) && !canspotmon(mtmp)) if (cansee(g.bhitpos.x, g.bhitpos.y) && !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y); map_invisible(g.bhitpos.x, g.bhitpos.y);
(*fhitm)(mtmp, obj); (*fhitm)(mtmp, obj);
range -= 3; range -= 3;
} }
@@ -1314,7 +1314,7 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */
int hitanything = 0; int hitanything = 0;
register struct obj *next_obj; register struct obj *next_obj;
for (otmp = level.objects[bhitpos.x][bhitpos.y]; otmp; for (otmp = level.objects[g.bhitpos.x][g.bhitpos.y]; otmp;
otmp = next_obj) { otmp = next_obj) {
/* Fix for polymorph bug, Tim Wright */ /* Fix for polymorph bug, Tim Wright */
next_obj = otmp->nexthere; next_obj = otmp->nexthere;
@@ -1323,7 +1323,7 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */
if (hitanything) if (hitanything)
range--; range--;
} }
typ = levl[bhitpos.x][bhitpos.y].typ; typ = levl[g.bhitpos.x][g.bhitpos.y].typ;
if (IS_DOOR(typ) || typ == SDOOR) { if (IS_DOOR(typ) || typ == SDOOR) {
switch (obj->otyp) { switch (obj->otyp) {
/* note: monsters don't use opening or locking magic /* note: monsters don't use opening or locking magic
@@ -1331,23 +1331,23 @@ struct obj *obj; /* 2nd arg to fhitm/fhito */
case WAN_OPENING: case WAN_OPENING:
case WAN_LOCKING: case WAN_LOCKING:
case WAN_STRIKING: case WAN_STRIKING:
if (doorlock(obj, bhitpos.x, bhitpos.y)) { if (doorlock(obj, g.bhitpos.x, g.bhitpos.y)) {
if (g.zap_oseen) if (g.zap_oseen)
makeknown(obj->otyp); makeknown(obj->otyp);
/* if a shop door gets broken, add it to /* if a shop door gets broken, add it to
the shk's fix list (no cost to player) */ the shk's fix list (no cost to player) */
if (levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN if (levl[g.bhitpos.x][g.bhitpos.y].doormask == D_BROKEN
&& *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE)) && *in_rooms(g.bhitpos.x, g.bhitpos.y, SHOPBASE))
add_damage(bhitpos.x, bhitpos.y, 0L); add_damage(g.bhitpos.x, g.bhitpos.y, 0L);
} }
break; break;
} }
} }
if (!ZAP_POS(typ) if (!ZAP_POS(typ)
|| (IS_DOOR(typ) && (levl[bhitpos.x][bhitpos.y].doormask || (IS_DOOR(typ) && (levl[g.bhitpos.x][g.bhitpos.y].doormask
& (D_LOCKED | D_CLOSED)))) { & (D_LOCKED | D_CLOSED)))) {
bhitpos.x -= ddx; g.bhitpos.x -= ddx;
bhitpos.y -= ddy; g.bhitpos.y -= ddy;
break; break;
} }
} }
+3 -3
View File
@@ -1121,7 +1121,7 @@ unsigned doname_flags;
Strcat(prefix, "stale "); Strcat(prefix, "stale ");
#endif #endif
if (omndx >= LOW_PM if (omndx >= LOW_PM
&& (known || (mvitals[omndx].mvflags & MV_KNOWS_EGG))) { && (known || (g.mvitals[omndx].mvflags & MV_KNOWS_EGG))) {
Strcat(prefix, mons[omndx].mname); Strcat(prefix, mons[omndx].mname);
Strcat(prefix, " "); Strcat(prefix, " ");
if (obj->spe) if (obj->spe)
@@ -3812,14 +3812,14 @@ typfnd:
if (dead_species(mntmp, FALSE)) { if (dead_species(mntmp, FALSE)) {
otmp->corpsenm = NON_PM; /* it's empty */ otmp->corpsenm = NON_PM; /* it's empty */
} else if ((!(mons[mntmp].geno & G_UNIQ) || wizard) } else if ((!(mons[mntmp].geno & G_UNIQ) || wizard)
&& !(mvitals[mntmp].mvflags & G_NOCORPSE) && !(g.mvitals[mntmp].mvflags & G_NOCORPSE)
&& mons[mntmp].cnutrit != 0) { && mons[mntmp].cnutrit != 0) {
otmp->corpsenm = mntmp; otmp->corpsenm = mntmp;
} }
break; break;
case CORPSE: case CORPSE:
if ((!(mons[mntmp].geno & G_UNIQ) || wizard) if ((!(mons[mntmp].geno & G_UNIQ) || wizard)
&& !(mvitals[mntmp].mvflags & G_NOCORPSE)) { && !(g.mvitals[mntmp].mvflags & G_NOCORPSE)) {
if (mons[mntmp].msound == MS_GUARDIAN) if (mons[mntmp].msound == MS_GUARDIAN)
mntmp = genus(mntmp, 1); mntmp = genus(mntmp, 1);
set_corpsenm(otmp, mntmp); set_corpsenm(otmp, mntmp);
+38 -40
View File
@@ -1320,8 +1320,6 @@ STATIC_VAR const struct paranoia_opts {
{ ~0, "all", 3, 0, 0, 0 }, /* ditto */ { ~0, "all", 3, 0, 0, 0 }, /* ditto */
}; };
extern struct menucoloring *menu_colorings;
static const struct { static const struct {
const char *name; const char *name;
const int color; const int color;
@@ -1631,8 +1629,8 @@ char *pattern;
return FALSE; return FALSE;
} }
tmp->pattern = dupstr(pattern); tmp->pattern = dupstr(pattern);
tmp->next = plinemsg_types; tmp->next = g.plinemsg_types;
plinemsg_types = tmp; g.plinemsg_types = tmp;
return TRUE; return TRUE;
} }
@@ -1641,20 +1639,20 @@ msgtype_free()
{ {
struct plinemsg_type *tmp, *tmp2 = 0; struct plinemsg_type *tmp, *tmp2 = 0;
for (tmp = plinemsg_types; tmp; tmp = tmp2) { for (tmp = g.plinemsg_types; tmp; tmp = tmp2) {
tmp2 = tmp->next; tmp2 = tmp->next;
free((genericptr_t) tmp->pattern); free((genericptr_t) tmp->pattern);
regex_free(tmp->regex); regex_free(tmp->regex);
free((genericptr_t) tmp); free((genericptr_t) tmp);
} }
plinemsg_types = (struct plinemsg_type *) 0; g.plinemsg_types = (struct plinemsg_type *) 0;
} }
STATIC_OVL void STATIC_OVL void
free_one_msgtype(idx) free_one_msgtype(idx)
int idx; /* 0 .. */ int idx; /* 0 .. */
{ {
struct plinemsg_type *tmp = plinemsg_types; struct plinemsg_type *tmp = g.plinemsg_types;
struct plinemsg_type *prev = NULL; struct plinemsg_type *prev = NULL;
while (tmp) { while (tmp) {
@@ -1667,7 +1665,7 @@ int idx; /* 0 .. */
if (prev) if (prev)
prev->next = next; prev->next = next;
else else
plinemsg_types = next; g.plinemsg_types = next;
return; return;
} }
idx--; idx--;
@@ -1681,7 +1679,7 @@ msgtype_type(msg, norepeat)
const char *msg; const char *msg;
boolean norepeat; /* called from Norep(via pline) */ boolean norepeat; /* called from Norep(via pline) */
{ {
struct plinemsg_type *tmp = plinemsg_types; struct plinemsg_type *tmp = g.plinemsg_types;
while (tmp) { while (tmp) {
/* we don't exclude entries with negative msgtype values /* we don't exclude entries with negative msgtype values
@@ -1704,7 +1702,7 @@ int hide_mask;
int mt; int mt;
/* negative msgtype value won't be recognized by pline, so does nothing */ /* negative msgtype value won't be recognized by pline, so does nothing */
for (tmp = plinemsg_types; tmp; tmp = tmp->next) { for (tmp = g.plinemsg_types; tmp; tmp = tmp->next) {
mt = tmp->msgtype; mt = tmp->msgtype;
if (!hide) if (!hide)
mt = -mt; /* unhide: negate negative, yielding positive */ mt = -mt; /* unhide: negate negative, yielding positive */
@@ -1717,7 +1715,7 @@ STATIC_OVL int
msgtype_count(VOID_ARGS) msgtype_count(VOID_ARGS)
{ {
int c = 0; int c = 0;
struct plinemsg_type *tmp = plinemsg_types; struct plinemsg_type *tmp = g.plinemsg_types;
while (tmp) { while (tmp) {
c++; c++;
@@ -1797,11 +1795,11 @@ int c, a;
free(tmp); free(tmp);
return FALSE; return FALSE;
} else { } else {
tmp->next = menu_colorings; tmp->next = g.menu_colorings;
tmp->origstr = dupstr(str); tmp->origstr = dupstr(str);
tmp->color = c; tmp->color = c;
tmp->attr = a; tmp->attr = a;
menu_colorings = tmp; g.menu_colorings = tmp;
return TRUE; return TRUE;
} }
} }
@@ -1862,7 +1860,7 @@ int *color, *attr;
struct menucoloring *tmpmc; struct menucoloring *tmpmc;
if (iflags.use_menu_color) if (iflags.use_menu_color)
for (tmpmc = menu_colorings; tmpmc; tmpmc = tmpmc->next) for (tmpmc = g.menu_colorings; tmpmc; tmpmc = tmpmc->next)
if (regex_match(str, tmpmc->match)) { if (regex_match(str, tmpmc->match)) {
*color = tmpmc->color; *color = tmpmc->color;
*attr = tmpmc->attr; *attr = tmpmc->attr;
@@ -1874,7 +1872,7 @@ int *color, *attr;
void void
free_menu_coloring() free_menu_coloring()
{ {
struct menucoloring *tmp = menu_colorings; struct menucoloring *tmp = g.menu_colorings;
while (tmp) { while (tmp) {
struct menucoloring *tmp2 = tmp->next; struct menucoloring *tmp2 = tmp->next;
@@ -1890,7 +1888,7 @@ STATIC_OVL void
free_one_menu_coloring(idx) free_one_menu_coloring(idx)
int idx; /* 0 .. */ int idx; /* 0 .. */
{ {
struct menucoloring *tmp = menu_colorings; struct menucoloring *tmp = g.menu_colorings;
struct menucoloring *prev = NULL; struct menucoloring *prev = NULL;
while (tmp) { while (tmp) {
@@ -1903,7 +1901,7 @@ int idx; /* 0 .. */
if (prev) if (prev)
prev->next = next; prev->next = next;
else else
menu_colorings = next; g.menu_colorings = next;
return; return;
} }
idx--; idx--;
@@ -1916,7 +1914,7 @@ STATIC_OVL int
count_menucolors(VOID_ARGS) count_menucolors(VOID_ARGS)
{ {
int count = 0; int count = 0;
struct menucoloring *tmp = menu_colorings; struct menucoloring *tmp = g.menu_colorings;
while (tmp) { while (tmp) {
count++; count++;
@@ -2140,23 +2138,23 @@ boolean tinitial, tfrom_file;
} else } else
switch (lowc(*op)) { switch (lowc(*op)) {
case 'd': /* dog */ case 'd': /* dog */
preferred_pet = 'd'; g.preferred_pet = 'd';
break; break;
case 'c': /* cat */ case 'c': /* cat */
case 'f': /* feline */ case 'f': /* feline */
preferred_pet = 'c'; g.preferred_pet = 'c';
break; break;
case 'h': /* horse */ case 'h': /* horse */
case 'q': /* quadruped */ case 'q': /* quadruped */
/* avoids giving "unrecognized type of pet" but /* avoids giving "unrecognized type of pet" but
pet_type(dog.c) won't actually honor this */ pet_type(dog.c) won't actually honor this */
preferred_pet = 'h'; g.preferred_pet = 'h';
break; break;
case 'n': /* no pet */ case 'n': /* no pet */
preferred_pet = 'n'; g.preferred_pet = 'n';
break; break;
case '*': /* random */ case '*': /* random */
preferred_pet = '\0'; g.preferred_pet = '\0';
break; break;
default: default:
config_error_add("Unrecognized pet type '%s'.", op); config_error_add("Unrecognized pet type '%s'.", op);
@@ -2164,7 +2162,7 @@ boolean tinitial, tfrom_file;
break; break;
} }
} else if (negated) } else if (negated)
preferred_pet = 'n'; g.preferred_pet = 'n';
return retval; return retval;
} }
@@ -2176,10 +2174,10 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE); bad_negation(fullname, FALSE);
return FALSE; return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) { } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
nmcpy(catname, op, PL_PSIZ); nmcpy(g.catname, op, PL_PSIZ);
} else } else
return FALSE; return FALSE;
sanitize_name(catname); sanitize_name(g.catname);
return retval; return retval;
} }
@@ -2191,10 +2189,10 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE); bad_negation(fullname, FALSE);
return FALSE; return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) { } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
nmcpy(dogname, op, PL_PSIZ); nmcpy(g.dogname, op, PL_PSIZ);
} else } else
return FALSE; return FALSE;
sanitize_name(dogname); sanitize_name(g.dogname);
return retval; return retval;
} }
@@ -2206,10 +2204,10 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE); bad_negation(fullname, FALSE);
return FALSE; return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) { } else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
nmcpy(horsename, op, PL_PSIZ); nmcpy(g.horsename, op, PL_PSIZ);
} else } else
return FALSE; return FALSE;
sanitize_name(horsename); sanitize_name(g.horsename);
return retval; return retval;
} }
@@ -3974,7 +3972,7 @@ boolean tinitial, tfrom_file;
* isn't set up yet. * isn't set up yet.
*/ */
vision_recalc(2); /* shut down vision */ vision_recalc(2); /* shut down vision */
vision_full_recalc = 1; /* delayed recalc */ g.vision_full_recalc = 1; /* delayed recalc */
if (iflags.use_color) if (iflags.use_color)
need_redraw = TRUE; /* darkroom refresh */ need_redraw = TRUE; /* darkroom refresh */
} else if (boolopt[i].addr == &flags.showrace } else if (boolopt[i].addr == &flags.showrace
@@ -5022,7 +5020,7 @@ boolean setinitial, setfromfile;
unsigned ln; unsigned ln;
const char *mtype; const char *mtype;
menu_item *pick_list = (menu_item *) 0; menu_item *pick_list = (menu_item *) 0;
struct plinemsg_type *tmp = plinemsg_types; struct plinemsg_type *tmp = g.plinemsg_types;
tmpwin = create_nhwindow(NHW_MENU); tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin); start_menu(tmpwin);
@@ -5089,7 +5087,7 @@ boolean setinitial, setfromfile;
unsigned ln; unsigned ln;
const char *sattr, *sclr; const char *sattr, *sclr;
menu_item *pick_list = (menu_item *) 0; menu_item *pick_list = (menu_item *) 0;
struct menucoloring *tmp = menu_colorings; struct menucoloring *tmp = g.menu_colorings;
char clrbuf[QBUFSZ]; char clrbuf[QBUFSZ];
tmpwin = create_nhwindow(NHW_MENU); tmpwin = create_nhwindow(NHW_MENU);
@@ -5431,7 +5429,7 @@ char *buf;
: g.showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]); : g.showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]);
#endif #endif
else if (!strcmp(optname, "catname")) else if (!strcmp(optname, "catname"))
Sprintf(buf, "%s", catname[0] ? catname : none); Sprintf(buf, "%s", g.catname[0] ? g.catname : none);
else if (!strcmp(optname, "disclose")) else if (!strcmp(optname, "disclose"))
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) { for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) {
if (i) if (i)
@@ -5440,7 +5438,7 @@ char *buf;
(void) strkitten(buf, disclosure_options[i]); (void) strkitten(buf, disclosure_options[i]);
} }
else if (!strcmp(optname, "dogname")) else if (!strcmp(optname, "dogname"))
Sprintf(buf, "%s", dogname[0] ? dogname : none); Sprintf(buf, "%s", g.dogname[0] ? g.dogname : none);
else if (!strcmp(optname, "dungeon")) else if (!strcmp(optname, "dungeon"))
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
else if (!strcmp(optname, "effects")) else if (!strcmp(optname, "effects"))
@@ -5489,7 +5487,7 @@ char *buf;
else if (!strcmp(optname, "gender")) else if (!strcmp(optname, "gender"))
Sprintf(buf, "%s", rolestring(flags.initgend, genders, adj)); Sprintf(buf, "%s", rolestring(flags.initgend, genders, adj));
else if (!strcmp(optname, "horsename")) else if (!strcmp(optname, "horsename"))
Sprintf(buf, "%s", horsename[0] ? horsename : none); Sprintf(buf, "%s", g.horsename[0] ? g.horsename : none);
else if (!strcmp(optname, "map_mode")) { else if (!strcmp(optname, "map_mode")) {
i = iflags.wc_map_mode; i = iflags.wc_map_mode;
Sprintf(buf, "%s", Sprintf(buf, "%s",
@@ -5595,10 +5593,10 @@ char *buf;
Sprintf(eos(tmpbuf), " %s", paranoia[i].argname); Sprintf(eos(tmpbuf), " %s", paranoia[i].argname);
Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none"); Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none");
} else if (!strcmp(optname, "pettype")) { } else if (!strcmp(optname, "pettype")) {
Sprintf(buf, "%s", (preferred_pet == 'c') ? "cat" Sprintf(buf, "%s", (g.preferred_pet == 'c') ? "cat"
: (preferred_pet == 'd') ? "dog" : (g.preferred_pet == 'd') ? "dog"
: (preferred_pet == 'h') ? "horse" : (g.preferred_pet == 'h') ? "horse"
: (preferred_pet == 'n') ? "none" : (g.preferred_pet == 'n') ? "none"
: "random"); : "random");
} else if (!strcmp(optname, "pickup_burden")) { } else if (!strcmp(optname, "pickup_burden")) {
Sprintf(buf, "%s", burdentype[flags.pickup_burden]); Sprintf(buf, "%s", burdentype[flags.pickup_burden]);
+5 -5
View File
@@ -422,8 +422,8 @@ char *buf, *monbuf;
Sprintf(buf, "interior of %s", a_monnam(u.ustuck)); Sprintf(buf, "interior of %s", a_monnam(u.ustuck));
pm = u.ustuck->data; pm = u.ustuck->data;
} else if (glyph_is_monster(glyph)) { } else if (glyph_is_monster(glyph)) {
bhitpos.x = x; g.bhitpos.x = x;
bhitpos.y = y; g.bhitpos.y = y;
if ((mtmp = m_at(x, y)) != 0) { if ((mtmp = m_at(x, y)) != 0) {
look_at_monster(buf, monbuf, mtmp, x, y); look_at_monster(buf, monbuf, mtmp, x, y);
pm = mtmp->data; pm = mtmp->data;
@@ -1286,8 +1286,8 @@ boolean do_mons; /* True => monsters, False => objects */
if (glyph_is_monster(glyph)) { if (glyph_is_monster(glyph)) {
struct monst *mtmp; struct monst *mtmp;
bhitpos.x = x; /* [is this actually necessary?] */ g.bhitpos.x = x; /* [is this actually necessary?] */
bhitpos.y = y; g.bhitpos.y = y;
if (x == u.ux && y == u.uy && canspotself()) { if (x == u.ux && y == u.uy && canspotself()) {
(void) self_lookat(lookbuf); (void) self_lookat(lookbuf);
++count; ++count;
@@ -1477,7 +1477,7 @@ doidtrap()
} }
} }
for (trap = ftrap; trap; trap = trap->ntrap) for (trap = g.ftrap; trap; trap = trap->ntrap)
if (trap->tx == x && trap->ty == y) { if (trap->tx == x && trap->ty == y) {
if (!trap->tseen) if (!trap->tseen)
break; break;
+1 -1
View File
@@ -162,7 +162,7 @@ VA_DECL(const char *, line)
goto pline_done; goto pline_done;
} }
if (vision_full_recalc) if (g.vision_full_recalc)
vision_recalc(0); vision_recalc(0);
if (u.ux) if (u.ux)
flush_screen(1); /* %% */ flush_screen(1); /* %% */
+8 -8
View File
@@ -496,7 +496,7 @@ int psflags;
if (draconian) { if (draconian) {
do_merge: do_merge:
mntmp = armor_to_dragon(uarm->otyp); mntmp = armor_to_dragon(uarm->otyp);
if (!(mvitals[mntmp].mvflags & G_GENOD)) { if (!(g.mvitals[mntmp].mvflags & G_GENOD)) {
/* allow G_EXTINCT */ /* allow G_EXTINCT */
if (Is_dragon_scales(uarm)) { if (Is_dragon_scales(uarm)) {
/* dragon scales remain intact as uskin */ /* dragon scales remain intact as uskin */
@@ -602,7 +602,7 @@ int mntmp;
was_blind = !!Blind, dochange = FALSE; was_blind = !!Blind, dochange = FALSE;
int mlvl; int mlvl;
if (mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */ if (g.mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
You_feel("rather %s-ish.", mons[mntmp].mname); You_feel("rather %s-ish.", mons[mntmp].mname);
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
return 0; return 0;
@@ -840,7 +840,7 @@ int mntmp;
check_strangling(TRUE); /* maybe start strangling */ check_strangling(TRUE); /* maybe start strangling */
context.botl = 1; context.botl = 1;
vision_full_recalc = 1; g.vision_full_recalc = 1;
see_monsters(); see_monsters();
(void) encumber_msg(); (void) encumber_msg();
@@ -1056,7 +1056,7 @@ rehumanize()
nomul(0); nomul(0);
context.botl = 1; context.botl = 1;
vision_full_recalc = 1; g.vision_full_recalc = 1;
(void) encumber_msg(); (void) encumber_msg();
if (was_flying && !Flying && u.usteed) if (was_flying && !Flying && u.usteed)
You("and %s return gently to the %s.", You("and %s return gently to the %s.",
@@ -1839,12 +1839,12 @@ polysense()
boolean boolean
ugenocided() ugenocided()
{ {
return (boolean) ((mvitals[urole.malenum].mvflags & G_GENOD) return (boolean) ((g.mvitals[urole.malenum].mvflags & G_GENOD)
|| (urole.femalenum != NON_PM || (urole.femalenum != NON_PM
&& (mvitals[urole.femalenum].mvflags & G_GENOD)) && (g.mvitals[urole.femalenum].mvflags & G_GENOD))
|| (mvitals[urace.malenum].mvflags & G_GENOD) || (g.mvitals[urace.malenum].mvflags & G_GENOD)
|| (urace.femalenum != NON_PM || (urace.femalenum != NON_PM
&& (mvitals[urace.femalenum].mvflags & G_GENOD))); && (g.mvitals[urace.femalenum].mvflags & G_GENOD)));
} }
/* how hero feels "inside" after self-genocide of role or race */ /* how hero feels "inside" after self-genocide of role or race */
+5 -5
View File
@@ -316,7 +316,7 @@ toggle_blindness()
/* blindness has just been toggled */ /* blindness has just been toggled */
context.botl = TRUE; /* status conditions need update */ context.botl = TRUE; /* status conditions need update */
vision_full_recalc = 1; /* vision has changed */ g.vision_full_recalc = 1; /* vision has changed */
/* this vision recalculation used to be deferred until moveloop(), /* this vision recalculation used to be deferred until moveloop(),
but that made it possible for vision irregularities to occur but that made it possible for vision irregularities to occur
(cited case was force bolt hitting an adjacent potion of blindness (cited case was force bolt hitting an adjacent potion of blindness
@@ -522,14 +522,14 @@ dodrink()
potion_descr = OBJ_DESCR(objects[otmp->otyp]); potion_descr = OBJ_DESCR(objects[otmp->otyp]);
if (potion_descr) { if (potion_descr) {
if (!strcmp(potion_descr, "milky") if (!strcmp(potion_descr, "milky")
&& !(mvitals[PM_GHOST].mvflags & G_GONE) && !(g.mvitals[PM_GHOST].mvflags & G_GONE)
&& !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_GHOST].born))) { && !rn2(POTION_OCCUPANT_CHANCE(g.mvitals[PM_GHOST].born))) {
ghost_from_bottle(); ghost_from_bottle();
useup(otmp); useup(otmp);
return 1; return 1;
} else if (!strcmp(potion_descr, "smoky") } else if (!strcmp(potion_descr, "smoky")
&& !(mvitals[PM_DJINNI].mvflags & G_GONE) && !(g.mvitals[PM_DJINNI].mvflags & G_GONE)
&& !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_DJINNI].born))) { && !rn2(POTION_OCCUPANT_CHANCE(g.mvitals[PM_DJINNI].born))) {
djinni_from_bottle(otmp); djinni_from_bottle(otmp);
useup(otmp); useup(otmp);
return 1; return 1;
+4 -4
View File
@@ -789,7 +789,7 @@ gcrownu()
/* when getting a new book for known spell, enhance /* when getting a new book for known spell, enhance
currently wielded weapon rather than the book */ currently wielded weapon rather than the book */
for (sp_no = 0; sp_no < MAXSPELL; sp_no++) for (sp_no = 0; sp_no < MAXSPELL; sp_no++)
if (spl_book[sp_no].sp_id == class_gift) { if (g.spl_book[sp_no].sp_id == class_gift) {
if (ok_wep(uwep)) if (ok_wep(uwep))
obj = uwep; /* to be blessed,&c */ obj = uwep; /* to be blessed,&c */
break; break;
@@ -1161,7 +1161,7 @@ aligntyp g_align;
while (--trycnt > 0) { while (--trycnt > 0) {
if (otmp->otyp != SPE_BLANK_PAPER) { if (otmp->otyp != SPE_BLANK_PAPER) {
for (sp_no = 0; sp_no < MAXSPELL; sp_no++) for (sp_no = 0; sp_no < MAXSPELL; sp_no++)
if (spl_book[sp_no].sp_id == otmp->otyp) if (g.spl_book[sp_no].sp_id == otmp->otyp)
break; break;
if (sp_no == MAXSPELL if (sp_no == MAXSPELL
&& !P_RESTRICTED(spell_skilltype(otmp->otyp))) && !P_RESTRICTED(spell_skilltype(otmp->otyp)))
@@ -1921,9 +1921,9 @@ doturn()
int sp_no; int sp_no;
for (sp_no = 0; sp_no < MAXSPELL; ++sp_no) { for (sp_no = 0; sp_no < MAXSPELL; ++sp_no) {
if (spl_book[sp_no].sp_id == NO_SPELL) if (g.spl_book[sp_no].sp_id == NO_SPELL)
break; break;
else if (spl_book[sp_no].sp_id == SPE_TURN_UNDEAD) else if (g.spl_book[sp_no].sp_id == SPE_TURN_UNDEAD)
return spelleffects(sp_no, FALSE); return spelleffects(sp_no, FALSE);
} }
You("don't know how to turn undead!"); You("don't know how to turn undead!");
+2 -2
View File
@@ -495,7 +495,7 @@ int roomno;
if (!rn2(5) if (!rn2(5)
&& (mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS)) && (mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS))
!= 0) { != 0) {
int ngen = mvitals[PM_GHOST].born; int ngen = g.mvitals[PM_GHOST].born;
if (canspotmon(mtmp)) if (canspotmon(mtmp))
pline("A%s ghost appears next to you%c", pline("A%s ghost appears next to you%c",
ngen < 5 ? "n enormous" : "", ngen < 5 ? "n enormous" : "",
@@ -959,7 +959,7 @@ struct monst *mtmp;
Strcat(info, ", single segment"); Strcat(info, ", single segment");
} else { } else {
++nsegs; /* include head in the segment count */ ++nsegs; /* include head in the segment count */
segndx = wseg_at(mtmp, bhitpos.x, bhitpos.y); segndx = wseg_at(mtmp, g.bhitpos.x, g.bhitpos.y);
Sprintf(eos(info), ", %d%s of %d segments", Sprintf(eos(info), ", %d%s of %d segments",
segndx, ordin(segndx), nsegs); segndx, ordin(segndx), nsegs);
} }
+1 -1
View File
@@ -199,7 +199,7 @@ boolean seal;
portal will be deleted as part of arrival on that level. portal will be deleted as part of arrival on that level.
If monster movement is in progress, any who haven't moved If monster movement is in progress, any who haven't moved
yet will now miss out on a chance to wander through it... */ yet will now miss out on a chance to wander through it... */
for (t = ftrap; t; t = t->ntrap) for (t = g.ftrap; t; t = t->ntrap)
if (t->ttyp == MAGIC_PORTAL) if (t->ttyp == MAGIC_PORTAL)
break; break;
if (t) if (t)
+3 -3
View File
@@ -225,7 +225,7 @@ unsigned whichchains;
} }
if (!qarti && (whichchains & (1 << OBJ_MIGRATING)) != 0) { if (!qarti && (whichchains & (1 << OBJ_MIGRATING)) != 0) {
/* check migrating objects and minvent of migrating monsters */ /* check migrating objects and minvent of migrating monsters */
for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) { for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if ((qarti = find_qarti(mtmp->minvent)) != 0) if ((qarti = find_qarti(mtmp->minvent)) != 0)
@@ -650,12 +650,12 @@ qt_montype()
if (rn2(5)) { if (rn2(5)) {
qpm = urole.enemy1num; qpm = urole.enemy1num;
if (qpm != NON_PM && rn2(5) && !(mvitals[qpm].mvflags & G_GENOD)) if (qpm != NON_PM && rn2(5) && !(g.mvitals[qpm].mvflags & G_GENOD))
return &mons[qpm]; return &mons[qpm];
return mkclass(urole.enemy1sym, 0); return mkclass(urole.enemy1sym, 0);
} }
qpm = urole.enemy2num; qpm = urole.enemy2num;
if (qpm != NON_PM && rn2(5) && !(mvitals[qpm].mvflags & G_GENOD)) if (qpm != NON_PM && rn2(5) && !(g.mvitals[qpm].mvflags & G_GENOD))
return &mons[qpm]; return &mons[qpm];
return mkclass(urole.enemy2sym, 0); return mkclass(urole.enemy2sym, 0);
} }
+18 -18
View File
@@ -807,7 +807,7 @@ int howmuch;
levl[zx][zy].seenv = 0; levl[zx][zy].seenv = 0;
levl[zx][zy].waslit = 0; levl[zx][zy].waslit = 0;
levl[zx][zy].glyph = cmap_to_glyph(S_stone); levl[zx][zy].glyph = cmap_to_glyph(S_stone);
lastseentyp[zx][zy] = STONE; g.lastseentyp[zx][zy] = STONE;
} }
/* forget overview data for this level */ /* forget overview data for this level */
forget_mapseen(ledger_no(&u.uz)); forget_mapseen(ledger_no(&u.uz));
@@ -820,7 +820,7 @@ forget_traps()
register struct trap *trap; register struct trap *trap;
/* forget all traps (except the one the hero is in :-) */ /* forget all traps (except the one the hero is in :-) */
for (trap = ftrap; trap; trap = trap->ntrap) for (trap = g.ftrap; trap; trap = trap->ntrap)
if ((trap->tx != u.ux || trap->ty != u.uy) && (trap->ttyp != HOLE)) if ((trap->tx != u.ux || trap->ty != u.uy) && (trap->ttyp != HOLE))
trap->tseen = 0; trap->tseen = 0;
} }
@@ -856,8 +856,8 @@ int percent;
*/ */
indices[0] = 0; /* lint suppression */ indices[0] = 0; /* lint suppression */
for (count = 0, i = 0; i <= maxl; i++) for (count = 0, i = 0; i <= maxl; i++)
if ((level_info[i].flags & VISITED) if ((g.level_info[i].flags & VISITED)
&& !(level_info[i].flags & FORGOTTEN) && i != this_lev) { && !(g.level_info[i].flags & FORGOTTEN) && i != this_lev) {
if (ledger_to_dnum(i) == sokoban_dnum) if (ledger_to_dnum(i) == sokoban_dnum)
percent += 2; percent += 2;
else else
@@ -873,7 +873,7 @@ int percent;
/* forget first % of randomized indices */ /* forget first % of randomized indices */
count = ((count * percent) + 50) / 100; count = ((count * percent) + 50) / 100;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
level_info[indices[i]].flags |= FORGOTTEN; g.level_info[indices[i]].flags |= FORGOTTEN;
forget_mapseen(indices[i]); forget_mapseen(indices[i]);
} }
} }
@@ -2008,7 +2008,7 @@ struct obj *obj;
move_bc(0, 0, uball->ox, uball->oy, uchain->ox, uchain->oy); move_bc(0, 0, uball->ox, uball->oy, uchain->ox, uchain->oy);
} }
vision_full_recalc = 1; /* delayed vision recalculation */ g.vision_full_recalc = 1; /* delayed vision recalculation */
if (gremlins) { if (gremlins) {
struct litmon *gremlin; struct litmon *gremlin;
@@ -2054,7 +2054,7 @@ do_class_genocide()
if (mons[i].mlet == class) { if (mons[i].mlet == class) {
if (!(mons[i].geno & G_GENO)) if (!(mons[i].geno & G_GENO))
immunecnt++; immunecnt++;
else if (mvitals[i].mvflags & G_GENOD) else if (g.mvitals[i].mvflags & G_GENOD)
gonecnt++; gonecnt++;
else else
goodcnt++; goodcnt++;
@@ -2095,11 +2095,11 @@ do_class_genocide()
*/ */
if (Your_Own_Role(i) || Your_Own_Race(i) if (Your_Own_Role(i) || Your_Own_Race(i)
|| ((mons[i].geno & G_GENO) || ((mons[i].geno & G_GENO)
&& !(mvitals[i].mvflags & G_GENOD))) { && !(g.mvitals[i].mvflags & G_GENOD))) {
/* This check must be first since player monsters might /* This check must be first since player monsters might
* have G_GENOD or !G_GENO. * have G_GENOD or !G_GENO.
*/ */
mvitals[i].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[i].mvflags |= (G_GENOD | G_NOCORPSE);
reset_rndmonst(i); reset_rndmonst(i);
kill_genocided_monsters(); kill_genocided_monsters();
update_inventory(); /* eggs & tins */ update_inventory(); /* eggs & tins */
@@ -2129,7 +2129,7 @@ do_class_genocide()
gameover = TRUE; gameover = TRUE;
} }
} }
} else if (mvitals[i].mvflags & G_GENOD) { } else if (g.mvitals[i].mvflags & G_GENOD) {
if (!gameover) if (!gameover)
pline("All %s are already nonexistent.", nam); pline("All %s are already nonexistent.", nam);
} else if (!gameover) { } else if (!gameover) {
@@ -2216,7 +2216,7 @@ int how;
} }
mndx = name_to_mon(buf); mndx = name_to_mon(buf);
if (mndx == NON_PM || (mvitals[mndx].mvflags & G_GENOD)) { if (mndx == NON_PM || (g.mvitals[mndx].mvflags & G_GENOD)) {
pline("Such creatures %s exist in this world.", pline("Such creatures %s exist in this world.",
(mndx == NON_PM) ? "do not" : "no longer"); (mndx == NON_PM) ? "do not" : "no longer");
continue; continue;
@@ -2270,20 +2270,20 @@ int how;
} }
if (how & REALLY) { if (how & REALLY) {
/* setting no-corpse affects wishing and random tin generation */ /* setting no-corpse affects wishing and random tin generation */
mvitals[mndx].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[mndx].mvflags |= (G_GENOD | G_NOCORPSE);
pline("Wiped out %s%s.", which, pline("Wiped out %s%s.", which,
(*which != 'a') ? buf : makeplural(buf)); (*which != 'a') ? buf : makeplural(buf));
if (killplayer) { if (killplayer) {
/* might need to wipe out dual role */ /* might need to wipe out dual role */
if (urole.femalenum != NON_PM && mndx == urole.malenum) if (urole.femalenum != NON_PM && mndx == urole.malenum)
mvitals[urole.femalenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[urole.femalenum].mvflags |= (G_GENOD | G_NOCORPSE);
if (urole.femalenum != NON_PM && mndx == urole.femalenum) if (urole.femalenum != NON_PM && mndx == urole.femalenum)
mvitals[urole.malenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[urole.malenum].mvflags |= (G_GENOD | G_NOCORPSE);
if (urace.femalenum != NON_PM && mndx == urace.malenum) if (urace.femalenum != NON_PM && mndx == urace.malenum)
mvitals[urace.femalenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[urace.femalenum].mvflags |= (G_GENOD | G_NOCORPSE);
if (urace.femalenum != NON_PM && mndx == urace.femalenum) if (urace.femalenum != NON_PM && mndx == urace.femalenum)
mvitals[urace.malenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[urace.malenum].mvflags |= (G_GENOD | G_NOCORPSE);
u.uhp = -1; u.uhp = -1;
if (how & PLAYER) { if (how & PLAYER) {
@@ -2316,12 +2316,12 @@ int how;
int cnt = 0, census = monster_census(FALSE); int cnt = 0, census = monster_census(FALSE);
if (!(mons[mndx].geno & G_UNIQ) if (!(mons[mndx].geno & G_UNIQ)
&& !(mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT))) && !(g.mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT)))
for (i = rn1(3, 4); i > 0; i--) { for (i = rn1(3, 4); i > 0; i--) {
if (!makemon(ptr, u.ux, u.uy, NO_MINVENT)) if (!makemon(ptr, u.ux, u.uy, NO_MINVENT))
break; /* couldn't make one */ break; /* couldn't make one */
++cnt; ++cnt;
if (mvitals[mndx].mvflags & G_EXTINCT) if (g.mvitals[mndx].mvflags & G_EXTINCT)
break; /* just made last one */ break; /* just made last one */
} }
if (cnt) { if (cnt) {
+11 -11
View File
@@ -650,8 +650,8 @@ unsigned int *stuckid, *steedid;
} }
migrating_objs = restobjchn(fd, FALSE, FALSE); migrating_objs = restobjchn(fd, FALSE, FALSE);
migrating_mons = restmonchn(fd, FALSE); g.migrating_mons = restmonchn(fd, FALSE);
mread(fd, (genericptr_t) mvitals, sizeof(mvitals)); mread(fd, (genericptr_t) g.mvitals, sizeof(g.mvitals));
/* /*
* There are some things after this that can have unintended display * There are some things after this that can have unintended display
@@ -679,7 +679,7 @@ unsigned int *stuckid, *steedid;
mread(fd, (genericptr_t) &moves, sizeof moves); mread(fd, (genericptr_t) &moves, sizeof moves);
mread(fd, (genericptr_t) &monstermoves, sizeof monstermoves); mread(fd, (genericptr_t) &monstermoves, sizeof monstermoves);
mread(fd, (genericptr_t) &g.quest_status, sizeof (struct q_score)); mread(fd, (genericptr_t) &g.quest_status, sizeof (struct q_score));
mread(fd, (genericptr_t) spl_book, (MAXSPELL + 1) * sizeof (struct spell)); mread(fd, (genericptr_t) g.spl_book, (MAXSPELL + 1) * sizeof (struct spell));
restore_artifacts(fd); restore_artifacts(fd);
restore_oracles(fd); restore_oracles(fd);
if (u.ustuck) if (u.ustuck)
@@ -918,7 +918,7 @@ register int fd;
but before docrt(). */ but before docrt(). */
reglyph_darkroom(); reglyph_darkroom();
vision_reset(); vision_reset();
vision_full_recalc = 1; /* recompute vision (not saved) */ g.vision_full_recalc = 1; /* recompute vision (not saved) */
run_timers(); /* expire all timers that have gone off while away */ run_timers(); /* expire all timers that have gone off while away */
docrt(); docrt();
@@ -1055,7 +1055,7 @@ boolean ghostly;
restcemetery(fd, &level.bonesinfo); restcemetery(fd, &level.bonesinfo);
rest_levl(fd, rest_levl(fd,
(boolean) ((sfrestinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP)); (boolean) ((sfrestinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
mread(fd, (genericptr_t) lastseentyp, sizeof(lastseentyp)); mread(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp));
mread(fd, (genericptr_t) &g.omoves, sizeof(g.omoves)); mread(fd, (genericptr_t) &g.omoves, sizeof(g.omoves));
elapsed = monstermoves - g.omoves; elapsed = monstermoves - g.omoves;
mread(fd, (genericptr_t) &g.upstair, sizeof(stairway)); mread(fd, (genericptr_t) &g.upstair, sizeof(stairway));
@@ -1066,7 +1066,7 @@ boolean ghostly;
mread(fd, (genericptr_t) &g.updest, sizeof(dest_area)); mread(fd, (genericptr_t) &g.updest, sizeof(dest_area));
mread(fd, (genericptr_t) &g.dndest, sizeof(dest_area)); mread(fd, (genericptr_t) &g.dndest, sizeof(dest_area));
mread(fd, (genericptr_t) &level.flags, sizeof(level.flags)); mread(fd, (genericptr_t) &level.flags, sizeof(level.flags));
mread(fd, (genericptr_t) doors, sizeof(doors)); mread(fd, (genericptr_t) g.doors, sizeof(g.doors));
rest_rooms(fd); /* No joke :-) */ rest_rooms(fd); /* No joke :-) */
if (g.nroom) if (g.nroom)
g.doorindex = rooms[g.nroom - 1].fdoor + rooms[g.nroom - 1].doorct; g.doorindex = rooms[g.nroom - 1].fdoor + rooms[g.nroom - 1].doorct;
@@ -1078,12 +1078,12 @@ boolean ghostly;
fmon = restmonchn(fd, ghostly); fmon = restmonchn(fd, ghostly);
rest_worm(fd); /* restore worm information */ rest_worm(fd); /* restore worm information */
ftrap = 0; g.ftrap = 0;
while (trap = newtrap(), while (trap = newtrap(),
mread(fd, (genericptr_t) trap, sizeof(struct trap)), mread(fd, (genericptr_t) trap, sizeof(struct trap)),
trap->tx != 0) { /* need "!= 0" to work around DICE 3.0 bug */ trap->tx != 0) { /* need "!= 0" to work around DICE 3.0 bug */
trap->ntrap = ftrap; trap->ntrap = g.ftrap;
ftrap = trap; g.ftrap = trap;
} }
dealloc_trap(trap); dealloc_trap(trap);
fobj = restobjchn(fd, ghostly, FALSE); fobj = restobjchn(fd, ghostly, FALSE);
@@ -1161,7 +1161,7 @@ boolean ghostly;
assign_level(&g.sstairs.tolev, &ltmp); assign_level(&g.sstairs.tolev, &ltmp);
break; break;
case BR_PORTAL: /* max of 1 portal per level */ case BR_PORTAL: /* max of 1 portal per level */
for (trap = ftrap; trap; trap = trap->ntrap) for (trap = g.ftrap; trap; trap = trap->ntrap)
if (trap->ttyp == MAGIC_PORTAL) if (trap->ttyp == MAGIC_PORTAL)
break; break;
if (!trap) if (!trap)
@@ -1173,7 +1173,7 @@ boolean ghostly;
struct trap *ttmp = 0; struct trap *ttmp = 0;
/* Remove any dangling portals. */ /* Remove any dangling portals. */
for (trap = ftrap; trap; trap = ttmp) { for (trap = g.ftrap; trap; trap = ttmp) {
ttmp = trap->ntrap; ttmp = trap->ntrap;
if (trap->ttyp == MAGIC_PORTAL) if (trap->ttyp == MAGIC_PORTAL)
deltrap(trap); deltrap(trap);
+26 -26
View File
@@ -188,8 +188,8 @@ dosave0()
needed = bytes_counted; needed = bytes_counted;
for (ltmp = 1; ltmp <= maxledgerno(); ltmp++) for (ltmp = 1; ltmp <= maxledgerno(); ltmp++)
if (ltmp != ledger_no(&u.uz) && level_info[ltmp].where) if (ltmp != ledger_no(&u.uz) && g.level_info[ltmp].where)
needed += level_info[ltmp].size + (sizeof ltmp); needed += g.level_info[ltmp].size + (sizeof ltmp);
fds = freediskspace(fq_save); fds = freediskspace(fq_save);
if (needed > fds) { if (needed > fds) {
HUP HUP
@@ -231,7 +231,7 @@ dosave0()
for (ltmp = (xchar) 1; ltmp <= maxledgerno(); ltmp++) { for (ltmp = (xchar) 1; ltmp <= maxledgerno(); ltmp++) {
if (ltmp == ledger_no(&uz_save)) if (ltmp == ledger_no(&uz_save))
continue; continue;
if (!(level_info[ltmp].flags & LFILE_EXISTS)) if (!(g.level_info[ltmp].flags & LFILE_EXISTS))
continue; continue;
#ifdef MICRO #ifdef MICRO
curs(WIN_MAP, 1 + dotcnt++, dotrow); curs(WIN_MAP, 1 + dotcnt++, dotrow);
@@ -300,7 +300,7 @@ register int fd, mode;
urealtime.start_timing = urealtime.finish_time; urealtime.start_timing = urealtime.finish_time;
save_killers(fd, mode); save_killers(fd, mode);
/* must come before migrating_objs and migrating_mons are freed */ /* must come before migrating_objs and g.migrating_mons are freed */
save_timers(fd, mode, RANGE_GLOBAL); save_timers(fd, mode, RANGE_GLOBAL);
save_light_sources(fd, mode, RANGE_GLOBAL); save_light_sources(fd, mode, RANGE_GLOBAL);
@@ -315,13 +315,13 @@ register int fd, mode;
} }
saveobjchn(fd, migrating_objs, mode); saveobjchn(fd, migrating_objs, mode);
savemonchn(fd, migrating_mons, mode); savemonchn(fd, g.migrating_mons, mode);
if (release_data(mode)) { if (release_data(mode)) {
invent = 0; invent = 0;
migrating_objs = 0; migrating_objs = 0;
migrating_mons = 0; g.migrating_mons = 0;
} }
bwrite(fd, (genericptr_t) mvitals, sizeof(mvitals)); bwrite(fd, (genericptr_t) g.mvitals, sizeof(g.mvitals));
save_dungeon(fd, (boolean) !!perform_bwrite(mode), save_dungeon(fd, (boolean) !!perform_bwrite(mode),
(boolean) !!release_data(mode)); (boolean) !!release_data(mode));
@@ -329,7 +329,7 @@ register int fd, mode;
bwrite(fd, (genericptr_t) &moves, sizeof moves); bwrite(fd, (genericptr_t) &moves, sizeof moves);
bwrite(fd, (genericptr_t) &monstermoves, sizeof monstermoves); bwrite(fd, (genericptr_t) &monstermoves, sizeof monstermoves);
bwrite(fd, (genericptr_t) &g.quest_status, sizeof(struct q_score)); bwrite(fd, (genericptr_t) &g.quest_status, sizeof(struct q_score));
bwrite(fd, (genericptr_t) spl_book, bwrite(fd, (genericptr_t) g.spl_book,
sizeof(struct spell) * (MAXSPELL + 1)); sizeof(struct spell) * (MAXSPELL + 1));
save_artifacts(fd); save_artifacts(fd);
save_oracles(fd, mode); save_oracles(fd, mode);
@@ -451,9 +451,9 @@ int mode;
savelev0(fd, lev, mode); savelev0(fd, lev, mode);
} }
if (mode != FREE_SAVE) { if (mode != FREE_SAVE) {
level_info[lev].where = ACTIVE; g.level_info[lev].where = ACTIVE;
level_info[lev].time = moves; g.level_info[lev].time = moves;
level_info[lev].size = bytes_counted; g.level_info[lev].size = bytes_counted;
} }
return TRUE; return TRUE;
} }
@@ -491,7 +491,7 @@ int mode;
count_only = (mode & COUNT_SAVE); count_only = (mode & COUNT_SAVE);
#endif #endif
if (lev >= 0 && lev <= maxledgerno()) if (lev >= 0 && lev <= maxledgerno())
level_info[lev].flags |= VISITED; g.level_info[lev].flags |= VISITED;
bwrite(fd, (genericptr_t) &g.hackpid, sizeof(g.hackpid)); bwrite(fd, (genericptr_t) &g.hackpid, sizeof(g.hackpid));
#ifdef TOS #ifdef TOS
tlev = lev; tlev = lev;
@@ -503,7 +503,7 @@ int mode;
savecemetery(fd, mode, &level.bonesinfo); savecemetery(fd, mode, &level.bonesinfo);
savelevl(fd, savelevl(fd,
(boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP)); (boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
bwrite(fd, (genericptr_t) lastseentyp, sizeof(lastseentyp)); bwrite(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp));
bwrite(fd, (genericptr_t) &monstermoves, sizeof(monstermoves)); bwrite(fd, (genericptr_t) &monstermoves, sizeof(monstermoves));
bwrite(fd, (genericptr_t) &g.upstair, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.upstair, sizeof(stairway));
bwrite(fd, (genericptr_t) &g.dnstair, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.dnstair, sizeof(stairway));
@@ -513,7 +513,7 @@ int mode;
bwrite(fd, (genericptr_t) &g.updest, sizeof(dest_area)); bwrite(fd, (genericptr_t) &g.updest, sizeof(dest_area));
bwrite(fd, (genericptr_t) &g.dndest, sizeof(dest_area)); bwrite(fd, (genericptr_t) &g.dndest, sizeof(dest_area));
bwrite(fd, (genericptr_t) &level.flags, sizeof(level.flags)); bwrite(fd, (genericptr_t) &level.flags, sizeof(level.flags));
bwrite(fd, (genericptr_t) doors, sizeof(doors)); bwrite(fd, (genericptr_t) g.doors, sizeof(g.doors));
save_rooms(fd); /* no dynamic memory to reclaim */ save_rooms(fd); /* no dynamic memory to reclaim */
/* from here on out, saving also involves allocated memory cleanup */ /* from here on out, saving also involves allocated memory cleanup */
@@ -527,7 +527,7 @@ skip_lots:
savemonchn(fd, fmon, mode); savemonchn(fd, fmon, mode);
save_worm(fd, mode); /* save worm information */ save_worm(fd, mode); /* save worm information */
savetrapchn(fd, ftrap, mode); savetrapchn(fd, g.ftrap, mode);
saveobjchn(fd, fobj, mode); saveobjchn(fd, fobj, mode);
saveobjchn(fd, level.buriedobjlist, mode); saveobjchn(fd, level.buriedobjlist, mode);
saveobjchn(fd, billobjs, mode); saveobjchn(fd, billobjs, mode);
@@ -538,7 +538,7 @@ skip_lots:
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
level.monsters[x][y] = 0; level.monsters[x][y] = 0;
fmon = 0; fmon = 0;
ftrap = 0; g.ftrap = 0;
fobj = 0; fobj = 0;
level.buriedobjlist = 0; level.buriedobjlist = 0;
billobjs = 0; billobjs = 0;
@@ -1159,7 +1159,7 @@ register struct monst *mtmp;
bwrite(fd, (genericptr_t) &minusone, sizeof(int)); bwrite(fd, (genericptr_t) &minusone, sizeof(int));
} }
/* save traps; ftrap is the only trap chain so the 2nd arg is superfluous */ /* save traps; g.ftrap is the only trap chain so the 2nd arg is superfluous */
STATIC_OVL void STATIC_OVL void
savetrapchn(fd, trap, mode) savetrapchn(fd, trap, mode)
int fd; int fd;
@@ -1357,7 +1357,7 @@ freedynamicdata()
clear_regions(); clear_regions();
freemonchn(fmon); freemonchn(fmon);
free_worm(); /* release worm segment information */ free_worm(); /* release worm segment information */
freetrapchn(ftrap); freetrapchn(g.ftrap);
freeobjchn(fobj); freeobjchn(fobj);
freeobjchn(level.buriedobjlist); freeobjchn(level.buriedobjlist);
freeobjchn(billobjs); freeobjchn(billobjs);
@@ -1370,8 +1370,8 @@ freedynamicdata()
free_light_sources(RANGE_GLOBAL); free_light_sources(RANGE_GLOBAL);
freeobjchn(invent); freeobjchn(invent);
freeobjchn(migrating_objs); freeobjchn(migrating_objs);
freemonchn(migrating_mons); freemonchn(g.migrating_mons);
freemonchn(mydogs); /* ascension or dungeon escape */ freemonchn(g.mydogs); /* ascension or dungeon escape */
/* freelevchn(); -- [folded into free_dungeons()] */ /* freelevchn(); -- [folded into free_dungeons()] */
free_animals(); free_animals();
free_oracles(); free_oracles();
@@ -1424,7 +1424,7 @@ int lev;
set_levelfile_name(from, lev); set_levelfile_name(from, lev);
set_levelfile_name(to, lev); set_levelfile_name(to, lev);
if (iflags.checkspace) { if (iflags.checkspace) {
while (level_info[lev].size > freediskspace(to)) while (g.level_info[lev].size > freediskspace(to))
if (!swapout_oldest()) if (!swapout_oldest())
return FALSE; return FALSE;
} }
@@ -1434,7 +1434,7 @@ int lev;
} }
copyfile(from, to); copyfile(from, to);
(void) unlink(from); (void) unlink(from);
level_info[lev].where = ACTIVE; g.level_info[lev].where = ACTIVE;
return TRUE; return TRUE;
} }
@@ -1448,10 +1448,10 @@ swapout_oldest()
if (!ramdisk) if (!ramdisk)
return FALSE; return FALSE;
for (i = 1, oldtime = 0, oldest = 0; i <= maxledgerno(); i++) for (i = 1, oldtime = 0, oldest = 0; i <= maxledgerno(); i++)
if (level_info[i].where == ACTIVE if (g.level_info[i].where == ACTIVE
&& (!oldtime || level_info[i].time < oldtime)) { && (!oldtime || g.level_info[i].time < oldtime)) {
oldest = i; oldest = i;
oldtime = level_info[i].time; oldtime = g.level_info[i].time;
} }
if (!oldest) if (!oldest)
return FALSE; return FALSE;
@@ -1465,7 +1465,7 @@ swapout_oldest()
} }
copyfile(from, to); copyfile(from, to);
(void) unlink(from); (void) unlink(from);
level_info[oldest].where = SWAPPED; g.level_info[oldest].where = SWAPPED;
return TRUE; return TRUE;
} }
+13 -13
View File
@@ -296,13 +296,13 @@ register struct monst *shkp;
clear_unpaid(shkp, invent); clear_unpaid(shkp, invent);
clear_unpaid(shkp, fobj); clear_unpaid(shkp, fobj);
clear_unpaid(shkp, level.buriedobjlist); clear_unpaid(shkp, level.buriedobjlist);
if (thrownobj) if (g.thrownobj)
clear_unpaid_obj(shkp, thrownobj); clear_unpaid_obj(shkp, g.thrownobj);
if (kickedobj) if (g.kickedobj)
clear_unpaid_obj(shkp, kickedobj); clear_unpaid_obj(shkp, g.kickedobj);
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
clear_unpaid(shkp, mtmp->minvent); clear_unpaid(shkp, mtmp->minvent);
for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon)
clear_unpaid(shkp, mtmp->minvent); clear_unpaid(shkp, mtmp->minvent);
while ((obj = billobjs) != 0) { while ((obj = billobjs) != 0) {
@@ -346,10 +346,10 @@ register boolean nearshop;
if (!Deaf) if (!Deaf)
pline("An alarm sounds!"); pline("An alarm sounds!");
nokops = ((mvitals[PM_KEYSTONE_KOP].mvflags & G_GONE) nokops = ((g.mvitals[PM_KEYSTONE_KOP].mvflags & G_GONE)
&& (mvitals[PM_KOP_SERGEANT].mvflags & G_GONE) && (g.mvitals[PM_KOP_SERGEANT].mvflags & G_GONE)
&& (mvitals[PM_KOP_LIEUTENANT].mvflags & G_GONE) && (g.mvitals[PM_KOP_LIEUTENANT].mvflags & G_GONE)
&& (mvitals[PM_KOP_KAPTAIN].mvflags & G_GONE)); && (g.mvitals[PM_KOP_KAPTAIN].mvflags & G_GONE));
if (!angry_guards(!!Deaf) && nokops) { if (!angry_guards(!!Deaf) && nokops) {
if (flags.verbose && !Deaf) if (flags.verbose && !Deaf)
@@ -1946,8 +1946,8 @@ unsigned id;
/* not found yet; check inventory for members of various monst lists */ /* not found yet; check inventory for members of various monst lists */
mmtmp[0] = fmon; mmtmp[0] = fmon;
mmtmp[1] = migrating_mons; mmtmp[1] = g.migrating_mons;
mmtmp[2] = mydogs; /* for use during level changes */ mmtmp[2] = g.mydogs; /* for use during level changes */
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
for (mon = mmtmp[i]; mon; mon = mon->nmon) for (mon = mmtmp[i]; mon; mon = mon->nmon)
if ((obj = o_on(id, mon->minvent)) != 0) if ((obj = o_on(id, mon->minvent)) != 0)
@@ -3880,7 +3880,7 @@ register int fall;
|| (obj == uswapwep && u.twoweap) || (obj == uswapwep && u.twoweap)
|| (obj->otyp == LEASH && obj->leashmon)) || (obj->otyp == LEASH && obj->leashmon))
continue; continue;
if (obj == current_wand) if (obj == g.current_wand)
continue; continue;
setnotworn(obj); setnotworn(obj);
freeinv(obj); freeinv(obj);
@@ -3907,7 +3907,7 @@ coord *mm;
if ((cnt = k_cnt[k]) == 0) if ((cnt = k_cnt[k]) == 0)
break; break;
mndx = k_mndx[k]; mndx = k_mndx[k];
if (mvitals[mndx].mvflags & G_GONE) if (g.mvitals[mndx].mvflags & G_GONE)
continue; continue;
while (cnt--) while (cnt--)
+11 -11
View File
@@ -596,8 +596,8 @@ struct mkroom *sroom;
/* place the shopkeeper in the given room */ /* place the shopkeeper in the given room */
sh = sroom->fdoor; sh = sroom->fdoor;
sx = doors[sh].x; sx = g.doors[sh].x;
sy = doors[sh].y; sy = g.doors[sh].y;
/* check that the shopkeeper placement is sane */ /* check that the shopkeeper placement is sane */
if (sroom->irregular) { if (sroom->irregular) {
@@ -639,7 +639,7 @@ struct mkroom *sroom;
pline("doormax=%d doorct=%d fdoor=%d", g.doorindex, sroom->doorct, pline("doormax=%d doorct=%d fdoor=%d", g.doorindex, sroom->doorct,
sh); sh);
while (j--) { while (j--) {
pline("door [%d,%d]", doors[sh].x, doors[sh].y); pline("door [%d,%d]", g.doors[sh].x, g.doors[sh].y);
sh++; sh++;
} }
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
@@ -663,7 +663,7 @@ struct mkroom *sroom;
sroom->resident = shk; sroom->resident = shk;
eshkp->shoptype = sroom->rtype; eshkp->shoptype = sroom->rtype;
assign_level(&eshkp->shoplevel, &u.uz); assign_level(&eshkp->shoplevel, &u.uz);
eshkp->shd = doors[sh]; eshkp->shd = g.doors[sh];
eshkp->shk.x = sx; eshkp->shk.x = sx;
eshkp->shk.y = sy; eshkp->shk.y = sy;
eshkp->robbed = eshkp->credit = eshkp->debit = eshkp->loan = 0L; eshkp->robbed = eshkp->credit = eshkp->debit = eshkp->loan = 0L;
@@ -687,12 +687,12 @@ int rmno, sh, sx,sy;
if (sroom->irregular) { if (sroom->irregular) {
if (levl[sx][sy].edge if (levl[sx][sy].edge
|| (int) levl[sx][sy].roomno != rmno || (int) levl[sx][sy].roomno != rmno
|| distmin(sx, sy, doors[sh].x, doors[sh].y) <= 1) || distmin(sx, sy, g.doors[sh].x, g.doors[sh].y) <= 1)
return FALSE; return FALSE;
} else if ((sx == sroom->lx && doors[sh].x == sx - 1) } else if ((sx == sroom->lx && g.doors[sh].x == sx - 1)
|| (sx == sroom->hx && doors[sh].x == sx + 1) || (sx == sroom->hx && g.doors[sh].x == sx + 1)
|| (sy == sroom->ly && doors[sh].y == sy - 1) || (sy == sroom->ly && g.doors[sh].y == sy - 1)
|| (sy == sroom->hy && doors[sh].y == sy + 1)) || (sy == sroom->hy && g.doors[sh].y == sy + 1))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@@ -720,8 +720,8 @@ register struct mkroom *sroom;
return; return;
/* make sure no doorways without doors, and no trapped doors, in shops */ /* make sure no doorways without doors, and no trapped doors, in shops */
sx = doors[sroom->fdoor].x; sx = g.doors[sroom->fdoor].x;
sy = doors[sroom->fdoor].y; sy = g.doors[sroom->fdoor].y;
if (levl[sx][sy].doormask == D_NODOOR) { if (levl[sx][sy].doormask == D_NODOOR) {
levl[sx][sy].doormask = D_ISOPEN; levl[sx][sy].doormask = D_ISOPEN;
newsym(sx, sy); newsym(sx, sy);
+12 -12
View File
@@ -1589,7 +1589,7 @@ struct mkroom *croom;
pm = (struct permonst *) 0; pm = (struct permonst *) 0;
else if (m->id != NON_PM) { else if (m->id != NON_PM) {
pm = &mons[m->id]; pm = &mons[m->id];
g_mvflags = (unsigned) mvitals[monsndx(pm)].mvflags; g_mvflags = (unsigned) g.mvitals[monsndx(pm)].mvflags;
if ((pm->geno & G_UNIQ) && (g_mvflags & G_EXTINCT)) if ((pm->geno & G_UNIQ) && (g_mvflags & G_EXTINCT))
return; return;
else if (g_mvflags & G_GONE) /* genocided or extinct */ else if (g_mvflags & G_GONE) /* genocided or extinct */
@@ -2313,8 +2313,8 @@ schar ftyp, btyp;
/* /*
* Disgusting hack: since special levels have their rooms filled before * Disgusting hack: since special levels have their rooms filled before
* sorting the rooms, we have to re-arrange the speed values upstairs_room * sorting the rooms, we have to re-arrange the speed values g.upstairs_room
* and dnstairs_room after the rooms have been sorted. On normal levels, * and g.dnstairs_room after the rooms have been sorted. On normal levels,
* stairs don't get created until _after_ sorting takes place. * stairs don't get created until _after_ sorting takes place.
*/ */
STATIC_OVL void STATIC_OVL void
@@ -2324,14 +2324,14 @@ fix_stair_rooms()
struct mkroom *croom; struct mkroom *croom;
if (xdnstair if (xdnstair
&& !((dnstairs_room->lx <= xdnstair && xdnstair <= dnstairs_room->hx) && !((g.dnstairs_room->lx <= xdnstair && xdnstair <= g.dnstairs_room->hx)
&& (dnstairs_room->ly <= ydnstair && (g.dnstairs_room->ly <= ydnstair
&& ydnstair <= dnstairs_room->hy))) { && ydnstair <= g.dnstairs_room->hy))) {
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
croom = &rooms[i]; croom = &rooms[i];
if ((croom->lx <= xdnstair && xdnstair <= croom->hx) if ((croom->lx <= xdnstair && xdnstair <= croom->hx)
&& (croom->ly <= ydnstair && ydnstair <= croom->hy)) { && (croom->ly <= ydnstair && ydnstair <= croom->hy)) {
dnstairs_room = croom; g.dnstairs_room = croom;
break; break;
} }
} }
@@ -2339,14 +2339,14 @@ fix_stair_rooms()
panic("Couldn't find dnstair room in fix_stair_rooms!"); panic("Couldn't find dnstair room in fix_stair_rooms!");
} }
if (xupstair if (xupstair
&& !((upstairs_room->lx <= xupstair && xupstair <= upstairs_room->hx) && !((g.upstairs_room->lx <= xupstair && xupstair <= g.upstairs_room->hx)
&& (upstairs_room->ly <= yupstair && (g.upstairs_room->ly <= yupstair
&& yupstair <= upstairs_room->hy))) { && yupstair <= g.upstairs_room->hy))) {
for (i = 0; i < g.nroom; i++) { for (i = 0; i < g.nroom; i++) {
croom = &rooms[i]; croom = &rooms[i];
if ((croom->lx <= xupstair && xupstair <= croom->hx) if ((croom->lx <= xupstair && xupstair <= croom->hx)
&& (croom->ly <= yupstair && yupstair <= croom->hy)) { && (croom->ly <= yupstair && yupstair <= croom->hy)) {
upstairs_room = croom; g.upstairs_room = croom;
break; break;
} }
} }
@@ -4458,7 +4458,7 @@ ensure_way_out()
{ {
static const char nhFunc[] = "ensure_way_out"; static const char nhFunc[] = "ensure_way_out";
struct opvar *ov = selection_opvar((char *) 0); struct opvar *ov = selection_opvar((char *) 0);
struct trap *ttmp = ftrap; struct trap *ttmp = g.ftrap;
int x,y; int x,y;
boolean ret = TRUE; boolean ret = TRUE;
+17 -17
View File
@@ -4,7 +4,7 @@
#include "hack.h" #include "hack.h"
/* spellmenu arguments; 0 thru n-1 used as spl_book[] index when swapping */ /* spellmenu arguments; 0 thru n-1 used as g.spl_book[] index when swapping */
#define SPELLMENU_CAST (-2) #define SPELLMENU_CAST (-2)
#define SPELLMENU_VIEW (-1) #define SPELLMENU_VIEW (-1)
#define SPELLMENU_SORT (MAXSPELL) /* special menu entry */ #define SPELLMENU_SORT (MAXSPELL) /* special menu entry */
@@ -18,9 +18,9 @@
initialization; spell memory is decremented at the end of each turn, initialization; spell memory is decremented at the end of each turn,
including the turn on which the spellbook is read; without the extra including the turn on which the spellbook is read; without the extra
increment, the hero used to get cheated out of 1 turn of retention */ increment, the hero used to get cheated out of 1 turn of retention */
#define incrnknow(spell, x) (spl_book[spell].sp_know = KEEN + (x)) #define incrnknow(spell, x) (g.spl_book[spell].sp_know = KEEN + (x))
#define spellev(spell) spl_book[spell].sp_lev #define spellev(spell) g.spl_book[spell].sp_lev
#define spellname(spell) OBJ_NAME(objects[spellid(spell)]) #define spellname(spell) OBJ_NAME(objects[spellid(spell)])
#define spellet(spell) \ #define spellet(spell) \
((char) ((spell < 26) ? ('a' + spell) : ('A' + spell - 26))) ((char) ((spell < 26) ? ('a' + spell) : ('A' + spell - 26)))
@@ -410,8 +410,8 @@ learn(VOID_ARGS)
/* reset spestudied as if polymorph had taken place */ /* reset spestudied as if polymorph had taken place */
book->spestudied = rn2(book->spestudied); book->spestudied = rn2(book->spestudied);
} else { } else {
spl_book[i].sp_id = booktype; g.spl_book[i].sp_id = booktype;
spl_book[i].sp_lev = objects[booktype].oc_level; g.spl_book[i].sp_lev = objects[booktype].oc_level;
incrnknow(i, 1); incrnknow(i, 1);
book->spestudied++; book->spestudied++;
You(i > 0 ? "add %s to your repertoire." : "learn %s.", splname); You(i > 0 ? "add %s to your repertoire." : "learn %s.", splname);
@@ -1387,13 +1387,13 @@ const genericptr vptr2;
/* /*
* gather up all of the possible parameters except spell name * gather up all of the possible parameters except spell name
* in advance, even though some might not be needed: * in advance, even though some might not be needed:
* indx. = spl_orderindx[] index into spl_book[]; * indx. = spl_orderindx[] index into g.spl_book[];
* otyp. = spl_book[] index into objects[]; * otyp. = g.spl_book[] index into objects[];
* levl. = spell level; * levl. = spell level;
* skil. = skill group aka spell class. * skil. = skill group aka spell class.
*/ */
int indx1 = *(int *) vptr1, indx2 = *(int *) vptr2, int indx1 = *(int *) vptr1, indx2 = *(int *) vptr2,
otyp1 = spl_book[indx1].sp_id, otyp2 = spl_book[indx2].sp_id, otyp1 = g.spl_book[indx1].sp_id, otyp2 = g.spl_book[indx2].sp_id,
levl1 = objects[otyp1].oc_level, levl2 = objects[otyp2].oc_level, levl1 = objects[otyp1].oc_level, levl2 = objects[otyp2].oc_level,
skil1 = objects[otyp1].oc_skill, skil2 = objects[otyp2].oc_skill; skil1 = objects[otyp1].oc_skill, skil2 = objects[otyp2].oc_skill;
@@ -1469,13 +1469,13 @@ sortspells()
if (g.spl_sortmode == SORTRETAINORDER) { if (g.spl_sortmode == SORTRETAINORDER) {
struct spell tmp_book[MAXSPELL]; struct spell tmp_book[MAXSPELL];
/* sort spl_book[] rather than spl_orderindx[]; /* sort g.spl_book[] rather than spl_orderindx[];
this also updates the index to reflect the new ordering (we this also updates the index to reflect the new ordering (we
could just free it since that ordering becomes the default) */ could just free it since that ordering becomes the default) */
for (i = 0; i < MAXSPELL; i++) for (i = 0; i < MAXSPELL; i++)
tmp_book[i] = spl_book[g.spl_orderindx[i]]; tmp_book[i] = g.spl_book[g.spl_orderindx[i]];
for (i = 0; i < MAXSPELL; i++) for (i = 0; i < MAXSPELL; i++)
spl_book[i] = tmp_book[i], g.spl_orderindx[i] = i; g.spl_book[i] = tmp_book[i], g.spl_orderindx[i] = i;
g.spl_sortmode = SORTBY_LETTER; /* reset */ g.spl_sortmode = SORTBY_LETTER; /* reset */
return; return;
} }
@@ -1551,9 +1551,9 @@ dovspell()
if (!dospellmenu(qbuf, splnum, &othnum)) if (!dospellmenu(qbuf, splnum, &othnum))
break; break;
spl_tmp = spl_book[splnum]; spl_tmp = g.spl_book[splnum];
spl_book[splnum] = spl_book[othnum]; g.spl_book[splnum] = g.spl_book[othnum];
spl_book[othnum] = spl_tmp; g.spl_book[othnum] = spl_tmp;
} }
} }
} }
@@ -1568,7 +1568,7 @@ dovspell()
STATIC_OVL boolean STATIC_OVL boolean
dospellmenu(prompt, splaction, spell_no) dospellmenu(prompt, splaction, spell_no)
const char *prompt; const char *prompt;
int splaction; /* SPELLMENU_CAST, SPELLMENU_VIEW, or spl_book[] index */ int splaction; /* SPELLMENU_CAST, SPELLMENU_VIEW, or g.spl_book[] index */
int *spell_no; int *spell_no;
{ {
winid tmpwin; winid tmpwin;
@@ -1825,8 +1825,8 @@ struct obj *obj;
/* initial inventory shouldn't contain duplicate spellbooks */ /* initial inventory shouldn't contain duplicate spellbooks */
impossible("Spell %s already known.", OBJ_NAME(objects[otyp])); impossible("Spell %s already known.", OBJ_NAME(objects[otyp]));
} else { } else {
spl_book[i].sp_id = otyp; g.spl_book[i].sp_id = otyp;
spl_book[i].sp_lev = objects[otyp].oc_level; g.spl_book[i].sp_lev = objects[otyp].oc_level;
incrnknow(i, 0); incrnknow(i, 0);
} }
return; return;
+4 -4
View File
@@ -479,10 +479,10 @@ register struct obj *otmp;
/* if monster is acquiring a thrown or kicked object, the throwing /* if monster is acquiring a thrown or kicked object, the throwing
or kicking code shouldn't continue to track and place it */ or kicking code shouldn't continue to track and place it */
if (otmp == thrownobj) if (otmp == g.thrownobj)
thrownobj = 0; g.thrownobj = 0;
else if (otmp == kickedobj) else if (otmp == g.kickedobj)
kickedobj = 0; g.kickedobj = 0;
/* don't want hidden light source inside the monster; assumes that /* don't want hidden light source inside the monster; assumes that
engulfers won't have external inventories; whirly monsters cause engulfers won't have external inventories; whirly monsters cause
the light to be extinguished rather than letting it shine thru */ the light to be extinguished rather than letting it shine thru */
+5 -5
View File
@@ -642,9 +642,9 @@ int reason; /* Player was thrown off etc. */
/* Keep steed here, move the player to cc; /* Keep steed here, move the player to cc;
* teleds() clears u.utrap * teleds() clears u.utrap
*/ */
in_steed_dismounting = TRUE; g.in_steed_dismounting = TRUE;
teleds(cc.x, cc.y, TRUE); teleds(cc.x, cc.y, TRUE);
in_steed_dismounting = FALSE; g.in_steed_dismounting = FALSE;
/* Put your steed in your trap */ /* Put your steed in your trap */
if (save_utrap) if (save_utrap)
@@ -673,12 +673,12 @@ int reason; /* Player was thrown off etc. */
/* usually return the hero to the surface */ /* usually return the hero to the surface */
if (reason != DISMOUNT_ENGULFED && reason != DISMOUNT_BONES) { if (reason != DISMOUNT_ENGULFED && reason != DISMOUNT_BONES) {
in_steed_dismounting = TRUE; g.in_steed_dismounting = TRUE;
(void) float_down(0L, W_SADDLE); (void) float_down(0L, W_SADDLE);
in_steed_dismounting = FALSE; g.in_steed_dismounting = FALSE;
context.botl = TRUE; context.botl = TRUE;
(void) encumber_msg(); (void) encumber_msg();
vision_full_recalc = 1; g.vision_full_recalc = 1;
} else } else
context.botl = TRUE; context.botl = TRUE;
/* polearms behave differently when not mounted */ /* polearms behave differently when not mounted */
+2 -2
View File
@@ -337,7 +337,7 @@ boolean allow_drag;
*/ */
newsym(u.ux0, u.uy0); newsym(u.ux0, u.uy0);
see_monsters(); see_monsters();
vision_full_recalc = 1; g.vision_full_recalc = 1;
nomul(0); nomul(0);
vision_recalc(0); /* vision before effects */ vision_recalc(0); /* vision before effects */
/* if terrain type changes, levitation or flying might become blocked /* if terrain type changes, levitation or flying might become blocked
@@ -537,7 +537,7 @@ boolean break_the_rules;
/* Try to use teleport away spell. */ /* Try to use teleport away spell. */
if (objects[SPE_TELEPORT_AWAY].oc_name_known && !Confusion) if (objects[SPE_TELEPORT_AWAY].oc_name_known && !Confusion)
for (sp_no = 0; sp_no < MAXSPELL; sp_no++) for (sp_no = 0; sp_no < MAXSPELL; sp_no++)
if (spl_book[sp_no].sp_id == SPE_TELEPORT_AWAY) { if (g.spl_book[sp_no].sp_id == SPE_TELEPORT_AWAY) {
castit = TRUE; castit = TRUE;
break; break;
} }
+10 -10
View File
@@ -401,15 +401,15 @@ struct kinfo *kptr;
*/ */
if (emits_light(youmonst.data)) if (emits_light(youmonst.data))
del_light_source(LS_MONSTER, monst_to_any(&youmonst)); del_light_source(LS_MONSTER, monst_to_any(&youmonst));
save_mvflags = mvitals[PM_GREEN_SLIME].mvflags; save_mvflags = g.mvitals[PM_GREEN_SLIME].mvflags;
mvitals[PM_GREEN_SLIME].mvflags = save_mvflags & ~G_GENOD; g.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags & ~G_GENOD;
(void) polymon(PM_GREEN_SLIME); (void) polymon(PM_GREEN_SLIME);
mvitals[PM_GREEN_SLIME].mvflags = save_mvflags; g.mvitals[PM_GREEN_SLIME].mvflags = save_mvflags;
done(TURNED_SLIME); done(TURNED_SLIME);
/* life-saved; even so, hero still has turned into green slime; /* life-saved; even so, hero still has turned into green slime;
player may have genocided green slimes after being infected */ player may have genocided green slimes after being infected */
if ((mvitals[PM_GREEN_SLIME].mvflags & G_GENOD) != 0) { if ((g.mvitals[PM_GREEN_SLIME].mvflags & G_GENOD) != 0) {
killer.format = KILLED_BY; killer.format = KILLED_BY;
Strcpy(killer.name, "slimicide"); Strcpy(killer.name, "slimicide");
/* immediately follows "OK, so you don't die." */ /* immediately follows "OK, so you don't die." */
@@ -794,7 +794,7 @@ long timeout;
hatchcount = rnd((int) egg->quan); hatchcount = rnd((int) egg->quan);
cansee_hatchspot = cansee(x, y) && !silent; cansee_hatchspot = cansee(x, y) && !silent;
if (!(mons[mnum].geno & G_UNIQ) if (!(mons[mnum].geno & G_UNIQ)
&& !(mvitals[mnum].mvflags & (G_GENOD | G_EXTINCT))) { && !(g.mvitals[mnum].mvflags & (G_GENOD | G_EXTINCT))) {
for (i = hatchcount; i > 0; i--) { for (i = hatchcount; i > 0; i--) {
if (!enexto(&cc, x, y, &mons[mnum]) if (!enexto(&cc, x, y, &mons[mnum])
|| !(mon = makemon(&mons[mnum], cc.x, cc.y, NO_MINVENT))) || !(mon = makemon(&mons[mnum], cc.x, cc.y, NO_MINVENT)))
@@ -809,7 +809,7 @@ long timeout;
mon->mtame = 20; mon->mtame = 20;
} }
} }
if (mvitals[mnum].mvflags & G_EXTINCT) if (g.mvitals[mnum].mvflags & G_EXTINCT)
break; /* just made last one */ break; /* just made last one */
mon2 = mon; /* in case makemon() fails on 2nd egg */ mon2 = mon; /* in case makemon() fails on 2nd egg */
} }
@@ -936,7 +936,7 @@ int mnum;
{ {
/* baby monsters hatch from grown-up eggs */ /* baby monsters hatch from grown-up eggs */
mnum = little_to_big(mnum); mnum = little_to_big(mnum);
mvitals[mnum].mvflags |= MV_KNOWS_EGG; g.mvitals[mnum].mvflags |= MV_KNOWS_EGG;
/* we might have just learned about other eggs being carried */ /* we might have just learned about other eggs being carried */
update_inventory(); update_inventory();
} }
@@ -2183,11 +2183,11 @@ struct monst *mon;
{ {
struct monst *curr; struct monst *curr;
for (curr = migrating_mons; curr; curr = curr->nmon) for (curr = g.migrating_mons; curr; curr = curr->nmon)
if (curr == mon) if (curr == mon)
return FALSE; return FALSE;
/* `mydogs' is used during level changes, never saved and restored */ /* `g.mydogs' is used during level changes, never saved and restored */
for (curr = mydogs; curr; curr = curr->nmon) for (curr = g.mydogs; curr; curr = curr->nmon)
if (curr == mon) if (curr == mon)
return FALSE; return FALSE;
return TRUE; return TRUE;
+55 -55
View File
@@ -157,8 +157,8 @@ int ef_flags;
victim = carried(otmp) ? &youmonst : mcarried(otmp) ? otmp->ocarry : NULL; victim = carried(otmp) ? &youmonst : mcarried(otmp) ? otmp->ocarry : NULL;
uvictim = (victim == &youmonst); uvictim = (victim == &youmonst);
vismon = victim && (victim != &youmonst) && canseemon(victim); vismon = victim && (victim != &youmonst) && canseemon(victim);
/* Is bhitpos correct here? Ugh. */ /* Is g.bhitpos correct here? Ugh. */
visobj = !victim && cansee(bhitpos.x, bhitpos.y); visobj = !victim && cansee(g.bhitpos.x, g.bhitpos.y);
switch (type) { switch (type) {
case ERODE_BURN: case ERODE_BURN:
@@ -356,7 +356,7 @@ int x, y, typ;
for (k = 0; k < 12; ++k) for (k = 0; k < 12; ++k)
tavail[k] = tpick[k] = 0; tavail[k] = tpick[k] = 0;
for (t = ftrap; t; t = t->ntrap) for (t = g.ftrap; t; t = t->ntrap)
if (t->ttyp == SQKY_BOARD && t != ttmp) if (t->ttyp == SQKY_BOARD && t != ttmp)
tavail[t->tnote] = 1; tavail[t->tnote] = 1;
/* now populate tpick[] with the available indices */ /* now populate tpick[] with the available indices */
@@ -427,8 +427,8 @@ int x, y, typ;
} }
if (!oldplace) { if (!oldplace) {
ttmp->ntrap = ftrap; ttmp->ntrap = g.ftrap;
ftrap = ttmp; g.ftrap = ttmp;
} else { } else {
/* oldplace; /* oldplace;
it shouldn't be possible to override a sokoban pit or hole it shouldn't be possible to override a sokoban pit or hole
@@ -1269,7 +1269,7 @@ unsigned trflags;
} }
if (!conj_pit) if (!conj_pit)
selftouch("Falling, you"); selftouch("Falling, you");
vision_full_recalc = 1; /* vision limits change */ g.vision_full_recalc = 1; /* vision limits change */
exercise(A_STR, FALSE); exercise(A_STR, FALSE);
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
} }
@@ -1775,8 +1775,8 @@ int style;
sizeof(struct dig_info)); sizeof(struct dig_info));
dist = distmin(x1, y1, x2, y2); dist = distmin(x1, y1, x2, y2);
bhitpos.x = x1; g.bhitpos.x = x1;
bhitpos.y = y1; g.bhitpos.y = y1;
dx = sgn(x2 - x1); dx = sgn(x2 - x1);
dy = sgn(y2 - y1); dy = sgn(y2 - y1);
switch (style) { switch (style) {
@@ -1799,10 +1799,10 @@ int style;
default: default:
if (!delaycnt) if (!delaycnt)
delaycnt = 1; delaycnt = 1;
if (!cansee(bhitpos.x, bhitpos.y)) if (!cansee(g.bhitpos.x, g.bhitpos.y))
curs_on_u(); curs_on_u();
tmp_at(DISP_FLASH, obj_to_glyph(singleobj)); tmp_at(DISP_FLASH, obj_to_glyph(singleobj));
tmp_at(bhitpos.x, bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
} }
/* Mark a spot to place object in bones files to prevent /* Mark a spot to place object in bones files to prevent
* loss of object. Use the starting spot to ensure that * loss of object. Use the starting spot to ensure that
@@ -1812,27 +1812,27 @@ int style;
* that would prevent it from ever getting there (bars), and we * that would prevent it from ever getting there (bars), and we
* can't tell that yet. * can't tell that yet.
*/ */
launch_drop_spot(singleobj, bhitpos.x, bhitpos.y); launch_drop_spot(singleobj, g.bhitpos.x, g.bhitpos.y);
/* Set the object in motion */ /* Set the object in motion */
while (dist-- > 0 && !used_up) { while (dist-- > 0 && !used_up) {
struct trap *t; struct trap *t;
tmp_at(bhitpos.x, bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
tmp = delaycnt; tmp = delaycnt;
/* dstage@u.washington.edu -- Delay only if hero sees it */ /* dstage@u.washington.edu -- Delay only if hero sees it */
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
while (tmp-- > 0) while (tmp-- > 0)
delay_output(); delay_output();
bhitpos.x += dx; g.bhitpos.x += dx;
bhitpos.y += dy; g.bhitpos.y += dy;
t = t_at(bhitpos.x, bhitpos.y); t = t_at(g.bhitpos.x, g.bhitpos.y);
if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) { if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) {
if (otyp == BOULDER && throws_rocks(mtmp->data)) { if (otyp == BOULDER && throws_rocks(mtmp->data)) {
if (rn2(3)) { if (rn2(3)) {
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
pline("%s snatches the boulder.", Monnam(mtmp)); pline("%s snatches the boulder.", Monnam(mtmp));
singleobj->otrapped = 0; singleobj->otrapped = 0;
(void) mpickobj(mtmp, singleobj); (void) mpickobj(mtmp, singleobj);
@@ -1847,7 +1847,7 @@ int style;
launch_drop_spot((struct obj *) 0, 0, 0); launch_drop_spot((struct obj *) 0, 0, 0);
break; break;
} }
} else if (bhitpos.x == u.ux && bhitpos.y == u.uy) { } else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) {
if (g.multi) if (g.multi)
nomul(0); nomul(0);
if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst), if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst),
@@ -1855,8 +1855,8 @@ int style;
stop_occupation(); stop_occupation();
} }
if (style == ROLL) { if (style == ROLL) {
if (down_gate(bhitpos.x, bhitpos.y) != -1) { if (down_gate(g.bhitpos.x, g.bhitpos.y) != -1) {
if (ship_object(singleobj, bhitpos.x, bhitpos.y, FALSE)) { if (ship_object(singleobj, g.bhitpos.x, g.bhitpos.y, FALSE)) {
used_up = TRUE; used_up = TRUE;
launch_drop_spot((struct obj *) 0, 0, 0); launch_drop_spot((struct obj *) 0, 0, 0);
break; break;
@@ -1868,27 +1868,27 @@ int style;
if (rn2(10) > 2) { if (rn2(10) > 2) {
pline( pline(
"KAABLAMM!!!%s", "KAABLAMM!!!%s",
cansee(bhitpos.x, bhitpos.y) cansee(g.bhitpos.x, g.bhitpos.y)
? " The rolling boulder triggers a land mine." ? " The rolling boulder triggers a land mine."
: ""); : "");
deltrap(t); deltrap(t);
del_engr_at(bhitpos.x, bhitpos.y); del_engr_at(g.bhitpos.x, g.bhitpos.y);
place_object(singleobj, bhitpos.x, bhitpos.y); place_object(singleobj, g.bhitpos.x, g.bhitpos.y);
singleobj->otrapped = 0; singleobj->otrapped = 0;
fracture_rock(singleobj); fracture_rock(singleobj);
(void) scatter(bhitpos.x, bhitpos.y, 4, (void) scatter(g.bhitpos.x, g.bhitpos.y, 4,
MAY_DESTROY | MAY_HIT | MAY_FRACTURE MAY_DESTROY | MAY_HIT | MAY_FRACTURE
| VIS_EFFECTS, | VIS_EFFECTS,
(struct obj *) 0); (struct obj *) 0);
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
newsym(bhitpos.x, bhitpos.y); newsym(g.bhitpos.x, g.bhitpos.y);
used_up = TRUE; used_up = TRUE;
launch_drop_spot((struct obj *) 0, 0, 0); launch_drop_spot((struct obj *) 0, 0, 0);
} }
break; break;
case LEVEL_TELEP: case LEVEL_TELEP:
case TELEP_TRAP: case TELEP_TRAP:
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
pline("Suddenly the rolling boulder disappears!"); pline("Suddenly the rolling boulder disappears!");
else else
You_hear("a rumbling stop abruptly."); You_hear("a rumbling stop abruptly.");
@@ -1917,7 +1917,7 @@ int style;
case TRAPDOOR: case TRAPDOOR:
/* the boulder won't be used up if there is a /* the boulder won't be used up if there is a
monster in the trap; stop rolling anyway */ monster in the trap; stop rolling anyway */
x2 = bhitpos.x, y2 = bhitpos.y; /* stops here */ x2 = g.bhitpos.x, y2 = g.bhitpos.y; /* stops here */
if (flooreffects(singleobj, x2, y2, "fall")) { if (flooreffects(singleobj, x2, y2, "fall")) {
used_up = TRUE; used_up = TRUE;
launch_drop_spot((struct obj *) 0, 0, 0); launch_drop_spot((struct obj *) 0, 0, 0);
@@ -1928,43 +1928,43 @@ int style;
if (used_up || dist == -1) if (used_up || dist == -1)
break; break;
} }
if (flooreffects(singleobj, bhitpos.x, bhitpos.y, "fall")) { if (flooreffects(singleobj, g.bhitpos.x, g.bhitpos.y, "fall")) {
used_up = TRUE; used_up = TRUE;
launch_drop_spot((struct obj *) 0, 0, 0); launch_drop_spot((struct obj *) 0, 0, 0);
break; break;
} }
if (otyp == BOULDER if (otyp == BOULDER
&& (otmp2 = sobj_at(BOULDER, bhitpos.x, bhitpos.y)) != 0) { && (otmp2 = sobj_at(BOULDER, g.bhitpos.x, g.bhitpos.y)) != 0) {
const char *bmsg = " as one boulder sets another in motion"; const char *bmsg = " as one boulder sets another in motion";
if (!isok(bhitpos.x + dx, bhitpos.y + dy) || !dist if (!isok(g.bhitpos.x + dx, g.bhitpos.y + dy) || !dist
|| IS_ROCK(levl[bhitpos.x + dx][bhitpos.y + dy].typ)) || IS_ROCK(levl[g.bhitpos.x + dx][g.bhitpos.y + dy].typ))
bmsg = " as one boulder hits another"; bmsg = " as one boulder hits another";
You_hear("a loud crash%s!", You_hear("a loud crash%s!",
cansee(bhitpos.x, bhitpos.y) ? bmsg : ""); cansee(g.bhitpos.x, g.bhitpos.y) ? bmsg : "");
obj_extract_self(otmp2); obj_extract_self(otmp2);
/* pass off the otrapped flag to the next boulder */ /* pass off the otrapped flag to the next boulder */
otmp2->otrapped = singleobj->otrapped; otmp2->otrapped = singleobj->otrapped;
singleobj->otrapped = 0; singleobj->otrapped = 0;
place_object(singleobj, bhitpos.x, bhitpos.y); place_object(singleobj, g.bhitpos.x, g.bhitpos.y);
singleobj = otmp2; singleobj = otmp2;
otmp2 = (struct obj *) 0; otmp2 = (struct obj *) 0;
wake_nearto(bhitpos.x, bhitpos.y, 10 * 10); wake_nearto(g.bhitpos.x, g.bhitpos.y, 10 * 10);
} }
} }
if (otyp == BOULDER && closed_door(bhitpos.x, bhitpos.y)) { if (otyp == BOULDER && closed_door(g.bhitpos.x, g.bhitpos.y)) {
if (cansee(bhitpos.x, bhitpos.y)) if (cansee(g.bhitpos.x, g.bhitpos.y))
pline_The("boulder crashes through a door."); pline_The("boulder crashes through a door.");
levl[bhitpos.x][bhitpos.y].doormask = D_BROKEN; levl[g.bhitpos.x][g.bhitpos.y].doormask = D_BROKEN;
if (dist) if (dist)
unblock_point(bhitpos.x, bhitpos.y); unblock_point(g.bhitpos.x, g.bhitpos.y);
} }
/* if about to hit iron bars, do so now */ /* if about to hit iron bars, do so now */
if (dist > 0 && isok(bhitpos.x + dx, bhitpos.y + dy) if (dist > 0 && isok(g.bhitpos.x + dx, g.bhitpos.y + dy)
&& levl[bhitpos.x + dx][bhitpos.y + dy].typ == IRONBARS) { && levl[g.bhitpos.x + dx][g.bhitpos.y + dy].typ == IRONBARS) {
x2 = bhitpos.x, y2 = bhitpos.y; /* object stops here */ x2 = g.bhitpos.x, y2 = g.bhitpos.y; /* object stops here */
if (hits_bars(&singleobj, if (hits_bars(&singleobj,
x2, y2, x2+dx, y2+dy, x2, y2, x2+dx, y2+dy,
!rn2(20), 0)) { !rn2(20), 0)) {
@@ -2815,7 +2815,7 @@ float_up()
if (u.utraptype == TT_PIT) { if (u.utraptype == TT_PIT) {
reset_utrap(FALSE); reset_utrap(FALSE);
You("float up, out of the pit!"); You("float up, out of the pit!");
vision_full_recalc = 1; /* vision limits change */ g.vision_full_recalc = 1; /* vision limits change */
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
} else if (u.utraptype == TT_LAVA /* molten lava */ } else if (u.utraptype == TT_LAVA /* molten lava */
|| u.utraptype == TT_INFLOOR) { /* solidified lava */ || u.utraptype == TT_INFLOOR) { /* solidified lava */
@@ -2950,7 +2950,7 @@ long hmask, emask; /* might cancel timeout */
u.uy = uball->oy; u.uy = uball->oy;
movobj(uchain, uball->ox, uball->oy); movobj(uchain, uball->ox, uball->oy);
newsym(u.ux0, u.uy0); newsym(u.ux0, u.uy0);
vision_full_recalc = 1; /* in case the hero moved. */ g.vision_full_recalc = 1; /* in case the hero moved. */
} }
/* check for falling into pool - added by GAN 10/20/86 */ /* check for falling into pool - added by GAN 10/20/86 */
if (!Flying) { if (!Flying) {
@@ -3059,7 +3059,7 @@ climb_pit()
You("ascend from the pit."); You("ascend from the pit.");
reset_utrap(FALSE); reset_utrap(FALSE);
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
vision_full_recalc = 1; /* vision limits change */ g.vision_full_recalc = 1; /* vision limits change */
} else if (!rn2(2) && sobj_at(BOULDER, u.ux, u.uy)) { } else if (!rn2(2) && sobj_at(BOULDER, u.ux, u.uy)) {
Your("%s gets stuck in a crevice.", body_part(LEG)); Your("%s gets stuck in a crevice.", body_part(LEG));
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
@@ -3071,7 +3071,7 @@ climb_pit()
You("%s from the pit.", Flying ? "fly" : "climb"); You("%s from the pit.", Flying ? "fly" : "climb");
reset_utrap(FALSE); reset_utrap(FALSE);
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
vision_full_recalc = 1; /* vision limits change */ g.vision_full_recalc = 1; /* vision limits change */
} else if (!(--u.utrap)) { } else if (!(--u.utrap)) {
reset_utrap(FALSE); reset_utrap(FALSE);
You("%s to the edge of the pit.", You("%s to the edge of the pit.",
@@ -3079,7 +3079,7 @@ climb_pit()
? "struggle against the air currents and float" ? "struggle against the air currents and float"
: u.usteed ? "ride" : "crawl"); : u.usteed ? "ride" : "crawl");
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
vision_full_recalc = 1; /* vision limits change */ g.vision_full_recalc = 1; /* vision limits change */
} else if (u.dz || flags.verbose) { } else if (u.dz || flags.verbose) {
if (u.usteed) if (u.usteed)
Norep("%s is still in a pit.", upstart(y_monnam(u.usteed))); Norep("%s is still in a pit.", upstart(y_monnam(u.usteed)));
@@ -3420,7 +3420,7 @@ xchar x, y;
/* this feedback is pretty clunky and can become very verbose /* this feedback is pretty clunky and can become very verbose
when former contents of a burned container get here via when former contents of a burned container get here via
flooreffects() */ flooreffects() */
if (obj == thrownobj || obj == kickedobj) if (obj == g.thrownobj || obj == g.kickedobj)
pline("%s %s up!", is_plural(obj) ? "They" : "It", pline("%s %s up!", is_plural(obj) ? "They" : "It",
otense(obj, "burn")); otense(obj, "burn"));
else else
@@ -3764,7 +3764,7 @@ drown()
vision_recalc(2); /* unsee old position */ vision_recalc(2); /* unsee old position */
u.uinwater = 1; u.uinwater = 1;
under_water(1); under_water(1);
vision_full_recalc = 1; g.vision_full_recalc = 1;
return FALSE; return FALSE;
} }
if ((Teleportation || can_teleport(youmonst.data)) && !Unaware if ((Teleportation || can_teleport(youmonst.data)) && !Unaware
@@ -4942,7 +4942,7 @@ struct trap *
t_at(x, y) t_at(x, y)
register int x, y; register int x, y;
{ {
register struct trap *trap = ftrap; register struct trap *trap = g.ftrap;
while (trap) { while (trap) {
if (trap->tx == x && trap->ty == y) if (trap->tx == x && trap->ty == y)
@@ -4959,10 +4959,10 @@ register struct trap *trap;
register struct trap *ttmp; register struct trap *ttmp;
clear_conjoined_pits(trap); clear_conjoined_pits(trap);
if (trap == ftrap) { if (trap == g.ftrap) {
ftrap = ftrap->ntrap; g.ftrap = g.ftrap->ntrap;
} else { } else {
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap)
if (ttmp->ntrap == trap) if (ttmp->ntrap == trap)
break; break;
if (!ttmp) if (!ttmp)
@@ -5399,7 +5399,7 @@ maybe_finish_sokoban()
/* scan all remaining traps, ignoring any created by the hero; /* scan all remaining traps, ignoring any created by the hero;
if this level has no more pits or holes, the current sokoban if this level has no more pits or holes, the current sokoban
puzzle has been solved */ puzzle has been solved */
for (t = ftrap; t; t = t->ntrap) { for (t = g.ftrap; t; t = t->ntrap) {
if (t->madeby_u) if (t->madeby_u)
continue; continue;
if (t->ttyp == PIT || t->ttyp == HOLE) if (t->ttyp == PIT || t->ttyp == HOLE)
+1 -1
View File
@@ -640,7 +640,7 @@ u_init()
init_uhunger(); init_uhunger();
for (i = 0; i <= MAXSPELL; i++) for (i = 0; i <= MAXSPELL; i++)
spl_book[i].sp_id = NO_SPELL; g.spl_book[i].sp_id = NO_SPELL;
u.ublesscnt = 300; /* no prayers just yet */ u.ublesscnt = 300; /* no prayers just yet */
u.ualignbase[A_CURRENT] = u.ualignbase[A_ORIGINAL] = u.ualign.type = u.ualignbase[A_CURRENT] = u.ualignbase[A_ORIGINAL] = u.ualign.type =
aligns[flags.initalign].value; aligns[flags.initalign].value;
+8 -8
View File
@@ -113,8 +113,8 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
* not stay there, so the player will have suddenly forgotten * not stay there, so the player will have suddenly forgotten
* the square's contents for no apparent reason. * the square's contents for no apparent reason.
if (!canspotmon(mtmp) if (!canspotmon(mtmp)
&& !glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph)) && !glyph_is_invisible(levl[g.bhitpos.x][g.bhitpos.y].glyph))
map_invisible(bhitpos.x, bhitpos.y); map_invisible(g.bhitpos.x, g.bhitpos.y);
*/ */
return FALSE; return FALSE;
} }
@@ -123,7 +123,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
cases which might change it (by placing or removing cases which might change it (by placing or removing
'rembered, unseen monster' glyph or revealing a mimic) 'rembered, unseen monster' glyph or revealing a mimic)
always return without further reference to this */ always return without further reference to this */
glyph = glyph_at(bhitpos.x, bhitpos.y); glyph = glyph_at(g.bhitpos.x, g.bhitpos.y);
/* Put up an invisible monster marker, but with exceptions for /* Put up an invisible monster marker, but with exceptions for
* monsters that hide and monsters you've been warned about. * monsters that hide and monsters you've been warned about.
@@ -137,7 +137,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
&& !glyph_is_warning(glyph) && !glyph_is_invisible(glyph) && !glyph_is_warning(glyph) && !glyph_is_invisible(glyph)
&& !(!Blind && mtmp->mundetected && hides_under(mtmp->data))) { && !(!Blind && mtmp->mundetected && hides_under(mtmp->data))) {
pline("Wait! There's %s there you can't see!", something); pline("Wait! There's %s there you can't see!", something);
map_invisible(bhitpos.x, bhitpos.y); map_invisible(g.bhitpos.x, g.bhitpos.y);
/* if it was an invisible mimic, treat it as if we stumbled /* if it was an invisible mimic, treat it as if we stumbled
* onto a visible mimic * onto a visible mimic
*/ */
@@ -384,9 +384,9 @@ register struct monst *mtmp;
examined in known_hitum, called via hitum or hmonas below */ examined in known_hitum, called via hitum or hmonas below */
g.override_confirmation = FALSE; g.override_confirmation = FALSE;
/* attack_checks() used to use <u.ux+u.dx,u.uy+u.dy> directly, now /* attack_checks() used to use <u.ux+u.dx,u.uy+u.dy> directly, now
it uses bhitpos instead; it might map an invisible monster there */ it uses g.bhitpos instead; it might map an invisible monster there */
bhitpos.x = u.ux + u.dx; g.bhitpos.x = u.ux + u.dx;
bhitpos.y = u.uy + u.dy; g.bhitpos.y = u.uy + u.dy;
if (attack_checks(mtmp, uwep)) if (attack_checks(mtmp, uwep))
return TRUE; return TRUE;
@@ -2129,7 +2129,7 @@ register struct attack *mattk;
} else { } else {
tmp = 1 + (pd->cwt >> 8); tmp = 1 + (pd->cwt >> 8);
if (corpse_chance(mdef, &youmonst, TRUE) if (corpse_chance(mdef, &youmonst, TRUE)
&& !(mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) { && !(g.mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) {
/* nutrition only if there can be a corpse */ /* nutrition only if there can be a corpse */
u.uhunger += (pd->cnutrit + 1) / 2; u.uhunger += (pd->cnutrit + 1) / 2;
} else } else
+5 -5
View File
@@ -99,7 +99,7 @@ boolean forceshow;
map_location(fcx, fcy, 1); /* bypass vision */ map_location(fcx, fcy, 1); /* bypass vision */
if (!ACCESSIBLE(lev->typ)) if (!ACCESSIBLE(lev->typ))
block_point(fcx, fcy); block_point(fcx, fcy);
vision_full_recalc = 1; g.vision_full_recalc = 1;
egrd->fcbeg++; egrd->fcbeg++;
} }
if (sawcorridor) if (sawcorridor)
@@ -426,7 +426,7 @@ invault()
if (!strcmpi(buf, "Croesus") || !strcmpi(buf, "Kroisos") if (!strcmpi(buf, "Croesus") || !strcmpi(buf, "Kroisos")
|| !strcmpi(buf, "Creosote")) { /* Discworld */ || !strcmpi(buf, "Creosote")) { /* Discworld */
if (!mvitals[PM_CROESUS].died) { if (!g.mvitals[PM_CROESUS].died) {
if (Deaf) { if (Deaf) {
if (!Blind) if (!Blind)
pline("%s waves goodbye.", noit_Monnam(guard)); pline("%s waves goodbye.", noit_Monnam(guard));
@@ -583,10 +583,10 @@ struct monst *grd;
* hack: player knows walls are restored because of the * hack: player knows walls are restored because of the
* message, below, so show this on the screen. * message, below, so show this on the screen.
*/ */
tmp_viz = viz_array[y][x]; tmp_viz = g.viz_array[y][x];
viz_array[y][x] = IN_SIGHT | COULD_SEE; g.viz_array[y][x] = IN_SIGHT | COULD_SEE;
newsym(x, y); newsym(x, y);
viz_array[y][x] = tmp_viz; g.viz_array[y][x] = tmp_viz;
block_point(x, y); block_point(x, y);
fixed = TRUE; fixed = TRUE;
} }
+26 -37
View File
@@ -69,17 +69,6 @@ char circle_start[] = {
/* Vision (arbitrary line of sight) /* Vision (arbitrary line of sight)
* =========================================*/ * =========================================*/
/*------ global variables ------*/
#if 0 /* (moved to decl.c) */
/* True if we need to run a full vision recalculation. */
boolean vision_full_recalc = 0;
/* Pointers to the current vision array. */
char **viz_array;
#endif
char *viz_rmin, *viz_rmax; /* current vision cs bounds */
/*------ local variables ------*/ /*------ local variables ------*/
static char could_see[2][ROWNO][COLNO]; /* vision work space */ static char could_see[2][ROWNO][COLNO]; /* vision work space */
@@ -128,11 +117,11 @@ vision_init()
} }
/* Start out with cs0 as our current array */ /* Start out with cs0 as our current array */
viz_array = cs_rows0; g.viz_array = cs_rows0;
viz_rmin = cs_rmin0; g.viz_rmin = cs_rmin0;
viz_rmax = cs_rmax0; g.viz_rmax = cs_rmax0;
vision_full_recalc = 0; g.vision_full_recalc = 0;
(void) memset((genericptr_t) could_see, 0, sizeof(could_see)); (void) memset((genericptr_t) could_see, 0, sizeof(could_see));
/* Initialize the vision algorithm (currently C or D). */ /* Initialize the vision algorithm (currently C or D). */
@@ -197,9 +186,9 @@ vision_reset()
register struct rm *lev; register struct rm *lev;
/* Start out with cs0 as our current array */ /* Start out with cs0 as our current array */
viz_array = cs_rows0; g.viz_array = cs_rows0;
viz_rmin = cs_rmin0; g.viz_rmin = cs_rmin0;
viz_rmax = cs_rmax0; g.viz_rmax = cs_rmax0;
(void) memset((genericptr_t) could_see, 0, sizeof(could_see)); (void) memset((genericptr_t) could_see, 0, sizeof(could_see));
@@ -243,7 +232,7 @@ vision_reset()
} }
iflags.vision_inited = 1; /* vision is ready */ iflags.vision_inited = 1; /* vision is ready */
vision_full_recalc = 1; /* we want to run vision_recalc() */ g.vision_full_recalc = 1; /* we want to run vision_recalc() */
} }
/* /*
@@ -260,7 +249,7 @@ char **rmin, **rmax;
register int row; register int row;
register char *nrmin, *nrmax; register char *nrmin, *nrmax;
if (viz_array == cs_rows0) { if (g.viz_array == cs_rows0) {
*rows = cs_rows1; *rows = cs_rows1;
*rmin = cs_rmin1; *rmin = cs_rmin1;
*rmax = cs_rmax1; *rmax = cs_rmax1;
@@ -519,7 +508,7 @@ int control;
unsigned char *sv; /* ptr to seen angle bits */ unsigned char *sv; /* ptr to seen angle bits */
int oldseenv; /* previous seenv value */ int oldseenv; /* previous seenv value */
vision_full_recalc = 0; /* reset flag */ g.vision_full_recalc = 0; /* reset flag */
if (g.in_mklev || !iflags.vision_inited) if (g.in_mklev || !iflags.vision_inited)
return; return;
@@ -555,15 +544,15 @@ int control;
* anything, so we only need update positions we used to be able * anything, so we only need update positions we used to be able
* to see. * to see.
*/ */
temp_array = viz_array; /* set viz_array so newsym() will work */ temp_array = g.viz_array; /* set g.viz_array so newsym() will work */
viz_array = next_array; g.viz_array = next_array;
for (row = 0; row < ROWNO; row++) { for (row = 0; row < ROWNO; row++) {
old_row = temp_array[row]; old_row = temp_array[row];
/* Find the min and max positions on the row. */ /* Find the min and max positions on the row. */
start = min(viz_rmin[row], next_rmin[row]); start = min(g.viz_rmin[row], next_rmin[row]);
stop = max(viz_rmax[row], next_rmax[row]); stop = max(g.viz_rmax[row], next_rmax[row]);
for (col = start; col <= stop; col++) for (col = start; col <= stop; col++)
if (old_row[col] & IN_SIGHT) if (old_row[col] & IN_SIGHT)
@@ -692,10 +681,10 @@ int control;
do_light_sources(next_array); do_light_sources(next_array);
/* /*
* Make the viz_array the new array so that cansee() will work correctly. * Make the g.viz_array the new array so that cansee() will work correctly.
*/ */
temp_array = viz_array; temp_array = g.viz_array;
viz_array = next_array; g.viz_array = next_array;
/* /*
* The main update loop. Here we do two things: * The main update loop. Here we do two things:
@@ -721,8 +710,8 @@ int control;
old_row = temp_array[row]; old_row = temp_array[row];
/* Find the min and max positions on the row. */ /* Find the min and max positions on the row. */
start = min(viz_rmin[row], next_rmin[row]); start = min(g.viz_rmin[row], next_rmin[row]);
stop = max(viz_rmax[row], next_rmax[row]); stop = max(g.viz_rmax[row], next_rmax[row]);
lev = &levl[start][row]; lev = &levl[start][row];
sv = &seenv_matrix[dy + 1][start < u.ux ? 0 : (start > u.ux ? 2 : 1)]; sv = &seenv_matrix[dy + 1][start < u.ux ? 0 : (start > u.ux ? 2 : 1)];
@@ -829,8 +818,8 @@ skip:
newsym(u.ux, u.uy); /* Make sure the hero shows up! */ newsym(u.ux, u.uy); /* Make sure the hero shows up! */
/* Set the new min and max pointers. */ /* Set the new min and max pointers. */
viz_rmin = next_rmin; g.viz_rmin = next_rmin;
viz_rmax = next_rmax; g.viz_rmax = next_rmax;
recalc_mapseen(); recalc_mapseen();
} }
@@ -855,8 +844,8 @@ int x, y;
* was out of night-vision range of the hero. Suddenly the hero should * was out of night-vision range of the hero. Suddenly the hero should
* see the lit room. * see the lit room.
*/ */
if (viz_array[y][x]) if (g.viz_array[y][x])
vision_full_recalc = 1; g.vision_full_recalc = 1;
} }
/* /*
@@ -872,8 +861,8 @@ int x, y;
/* recalc light sources here? */ /* recalc light sources here? */
if (viz_array[y][x]) if (g.viz_array[y][x])
vision_full_recalc = 1; g.vision_full_recalc = 1;
} }
/*==========================================================================*\ /*==========================================================================*\
@@ -2766,7 +2755,7 @@ genericptr_t arg;
if (range > MAX_RADIUS || range < 1) if (range > MAX_RADIUS || range < 1)
panic("do_clear_area: illegal range %d", range); panic("do_clear_area: illegal range %d", range);
if (vision_full_recalc) if (g.vision_full_recalc)
vision_recalc(0); /* recalc vision if dirty */ vision_recalc(0); /* recalc vision if dirty */
limits = circle_ptr(range); limits = circle_ptr(range);
if ((max_y = (srow + range)) >= ROWNO) if ((max_y = (srow + range)) >= ROWNO)
+2 -2
View File
@@ -68,7 +68,7 @@ amulet()
if ((((amu = uamul) != 0 && amu->otyp == AMULET_OF_YENDOR) if ((((amu = uamul) != 0 && amu->otyp == AMULET_OF_YENDOR)
|| ((amu = uwep) != 0 && amu->otyp == AMULET_OF_YENDOR)) || ((amu = uwep) != 0 && amu->otyp == AMULET_OF_YENDOR))
&& !rn2(15)) { && !rn2(15)) {
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) { for (ttmp = g.ftrap; ttmp; ttmp = ttmp->ntrap) {
if (ttmp->ttyp == MAGIC_PORTAL) { if (ttmp->ttyp == MAGIC_PORTAL) {
int du = distu(ttmp->tx, ttmp->ty); int du = distu(ttmp->tx, ttmp->ty);
if (du <= 9) if (du <= 9)
@@ -637,7 +637,7 @@ resurrect()
} else { } else {
/* look for a migrating Wizard */ /* look for a migrating Wizard */
verb = "elude"; verb = "elude";
mmtmp = &migrating_mons; mmtmp = &g.migrating_mons;
while ((mtmp = *mmtmp) != 0) { while ((mtmp = *mmtmp) != 0) {
if (mtmp->iswiz if (mtmp->iswiz
/* if he has the Amulet, he won't bring it to you */ /* if he has the Amulet, he won't bring it to you */
+2 -2
View File
@@ -756,13 +756,13 @@ clear_bypasses()
if (mtmp->data == &mons[PM_LONG_WORM] && has_mcorpsenm(mtmp)) if (mtmp->data == &mons[PM_LONG_WORM] && has_mcorpsenm(mtmp))
MCORPSENM(mtmp) = NON_PM; MCORPSENM(mtmp) = NON_PM;
} }
for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) { for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon) {
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
otmp->bypass = 0; otmp->bypass = 0;
/* no MCORPSENM(mtmp)==PM_LONG_WORM check here; long worms can't /* no MCORPSENM(mtmp)==PM_LONG_WORM check here; long worms can't
be just created by polymorph and migrating at the same time */ be just created by polymorph and migrating at the same time */
} }
/* billobjs and mydogs chains don't matter here */ /* billobjs and g.mydogs chains don't matter here */
context.bypasses = FALSE; context.bypasses = FALSE;
} }
+74 -74
View File
@@ -141,7 +141,7 @@ struct obj *otmp;
if (u.uswallow && mtmp == u.ustuck) if (u.uswallow && mtmp == u.ustuck)
reveal_invis = FALSE; reveal_invis = FALSE;
g.notonhead = (mtmp->mx != bhitpos.x || mtmp->my != bhitpos.y); g.notonhead = (mtmp->mx != g.bhitpos.x || mtmp->my != g.bhitpos.y);
skilled_spell = (otmp && otmp->oclass == SPBOOK_CLASS && otmp->blessed); skilled_spell = (otmp && otmp->oclass == SPBOOK_CLASS && otmp->blessed);
switch (otyp) { switch (otyp) {
@@ -456,14 +456,14 @@ struct obj *otmp;
} else if (mtmp->m_ap_type) } else if (mtmp->m_ap_type)
seemimic(mtmp); /* might unblock if mimicing a boulder/door */ seemimic(mtmp); /* might unblock if mimicing a boulder/door */
} }
/* note: bhitpos won't be set if swallowed, but that's okay since /* note: g.bhitpos won't be set if swallowed, but that's okay since
* reveal_invis will be false. We can't use mtmp->mx, my since it * reveal_invis will be false. We can't use mtmp->mx, my since it
* might be an invisible worm hit on the tail. * might be an invisible worm hit on the tail.
*/ */
if (reveal_invis) { if (reveal_invis) {
if (!DEADMONSTER(mtmp) && cansee(bhitpos.x, bhitpos.y) if (!DEADMONSTER(mtmp) && cansee(g.bhitpos.x, g.bhitpos.y)
&& !canspotmon(mtmp)) && !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y); map_invisible(g.bhitpos.x, g.bhitpos.y);
} }
/* if effect was observable then discover the wand type provided /* if effect was observable then discover the wand type provided
that the wand itself has been seen */ that the wand itself has been seen */
@@ -1337,7 +1337,7 @@ int okind;
break; break;
} }
if (!(mvitals[pm_index].mvflags & G_GENOD)) if (!(g.mvitals[pm_index].mvflags & G_GENOD))
mdat = &mons[pm_index]; mdat = &mons[pm_index];
mtmp = makemon(mdat, obj->ox, obj->oy, NO_MM_FLAGS); mtmp = makemon(mdat, obj->ox, obj->oy, NO_MM_FLAGS);
@@ -2213,10 +2213,10 @@ dozap()
* buzz(AD_ELEC) -> destroy_item(WAND_CLASS) -> * buzz(AD_ELEC) -> destroy_item(WAND_CLASS) ->
* useup -> obfree -> dealloc_obj -> free(obj) * useup -> obfree -> dealloc_obj -> free(obj)
*/ */
current_wand = obj; g.current_wand = obj;
weffects(obj); weffects(obj);
obj = current_wand; obj = g.current_wand;
current_wand = 0; g.current_wand = 0;
} }
if (obj && obj->spe < 0) { if (obj && obj->spe < 0) {
pline("%s to dust.", Tobjnam(obj, "turn")); pline("%s to dust.", Tobjnam(obj, "turn"));
@@ -2609,7 +2609,7 @@ struct obj *obj; /* wand or spell */
{ {
int steedhit = FALSE; int steedhit = FALSE;
bhitpos.x = u.usteed->mx, bhitpos.y = u.usteed->my; g.bhitpos.x = u.usteed->mx, g.bhitpos.y = u.usteed->my;
g.notonhead = FALSE; g.notonhead = FALSE;
switch (obj->otyp) { switch (obj->otyp) {
/* /*
@@ -3101,7 +3101,7 @@ const char *str;
struct monst *mtmp; struct monst *mtmp;
const char *force; /* usually either "." or "!" */ const char *force; /* usually either "." or "!" */
{ {
if ((!cansee(bhitpos.x, bhitpos.y) && !canspotmon(mtmp) if ((!cansee(g.bhitpos.x, g.bhitpos.y) && !canspotmon(mtmp)
&& !(u.uswallow && mtmp == u.ustuck)) || !flags.verbose) && !(u.uswallow && mtmp == u.ustuck)) || !flags.verbose)
pline("%s %s it.", The(str), vtense(str, "hit")); pline("%s %s it.", The(str), vtense(str, "hit"));
else else
@@ -3116,7 +3116,7 @@ register struct monst *mtmp;
{ {
pline( pline(
"%s %s %s.", The(str), vtense(str, "miss"), "%s %s %s.", The(str), vtense(str, "miss"),
((cansee(bhitpos.x, bhitpos.y) || canspotmon(mtmp)) && flags.verbose) ((cansee(g.bhitpos.x, g.bhitpos.y) || canspotmon(mtmp)) && flags.verbose)
? mon_nam(mtmp) ? mon_nam(mtmp)
: "it"); : "it");
} }
@@ -3142,7 +3142,7 @@ int range, *skipstart, *skipend;
* when a light beam is flashed (FLASHED_LIGHT) * when a light beam is flashed (FLASHED_LIGHT)
* when a mirror is applied (INVIS_BEAM) * when a mirror is applied (INVIS_BEAM)
* A thrown/kicked object falls down at end of its range or when a monster * A thrown/kicked object falls down at end of its range or when a monster
* is hit. The variable 'bhitpos' is set to the final position of the weapon * is hit. The variable 'g.bhitpos' is set to the final position of the weapon
* thrown/zapped. The ray of a wand may affect (by calling a provided * thrown/zapped. The ray of a wand may affect (by calling a provided
* function) several objects and monsters on its path. The return value * function) several objects and monsters on its path. The return value
* is the monster hit (weapon != ZAPPED_WAND), or a null monster pointer. * is the monster hit (weapon != ZAPPED_WAND), or a null monster pointer.
@@ -3174,12 +3174,12 @@ struct obj **pobj; /* object tossed/used, set to NULL
if (weapon == KICKED_WEAPON) { if (weapon == KICKED_WEAPON) {
/* object starts one square in front of player */ /* object starts one square in front of player */
bhitpos.x = u.ux + ddx; g.bhitpos.x = u.ux + ddx;
bhitpos.y = u.uy + ddy; g.bhitpos.y = u.uy + ddy;
range--; range--;
} else { } else {
bhitpos.x = u.ux; g.bhitpos.x = u.ux;
bhitpos.y = u.uy; g.bhitpos.y = u.uy;
} }
if (weapon == THROWN_WEAPON && obj && obj->otyp == ROCK) { if (weapon == THROWN_WEAPON && obj && obj->otyp == ROCK) {
@@ -3199,14 +3199,14 @@ struct obj **pobj; /* object tossed/used, set to NULL
while (range-- > 0) { while (range-- > 0) {
int x, y; int x, y;
bhitpos.x += ddx; g.bhitpos.x += ddx;
bhitpos.y += ddy; g.bhitpos.y += ddy;
x = bhitpos.x; x = g.bhitpos.x;
y = bhitpos.y; y = g.bhitpos.y;
if (!isok(x, y)) { if (!isok(x, y)) {
bhitpos.x -= ddx; g.bhitpos.x -= ddx;
bhitpos.y -= ddy; g.bhitpos.y -= ddy;
break; break;
} }
@@ -3216,17 +3216,17 @@ struct obj **pobj; /* object tossed/used, set to NULL
return mtmp; return mtmp;
} }
typ = levl[bhitpos.x][bhitpos.y].typ; typ = levl[g.bhitpos.x][g.bhitpos.y].typ;
/* iron bars will block anything big enough */ /* iron bars will block anything big enough */
if ((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON) if ((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON)
&& typ == IRONBARS && typ == IRONBARS
&& hits_bars(pobj, x - ddx, y - ddy, bhitpos.x, bhitpos.y, && hits_bars(pobj, x - ddx, y - ddy, g.bhitpos.x, g.bhitpos.y,
point_blank ? 0 : !rn2(5), 1)) { point_blank ? 0 : !rn2(5), 1)) {
/* caveat: obj might now be null... */ /* caveat: obj might now be null... */
obj = *pobj; obj = *pobj;
bhitpos.x -= ddx; g.bhitpos.x -= ddx;
bhitpos.y -= ddy; g.bhitpos.y -= ddy;
break; break;
} }
@@ -3236,15 +3236,15 @@ struct obj **pobj; /* object tossed/used, set to NULL
switch (obj->otyp) { switch (obj->otyp) {
case WAN_OPENING: case WAN_OPENING:
case SPE_KNOCK: case SPE_KNOCK:
if (is_db_wall(bhitpos.x, bhitpos.y)) { if (is_db_wall(g.bhitpos.x, g.bhitpos.y)) {
if (cansee(x, y) || cansee(bhitpos.x, bhitpos.y)) if (cansee(x, y) || cansee(g.bhitpos.x, g.bhitpos.y))
learn_it = TRUE; learn_it = TRUE;
open_drawbridge(x, y); open_drawbridge(x, y);
} }
break; break;
case WAN_LOCKING: case WAN_LOCKING:
case SPE_WIZARD_LOCK: case SPE_WIZARD_LOCK:
if ((cansee(x, y) || cansee(bhitpos.x, bhitpos.y)) if ((cansee(x, y) || cansee(g.bhitpos.x, g.bhitpos.y))
&& levl[x][y].typ == DRAWBRIDGE_DOWN) && levl[x][y].typ == DRAWBRIDGE_DOWN)
learn_it = TRUE; learn_it = TRUE;
close_drawbridge(x, y); close_drawbridge(x, y);
@@ -3260,7 +3260,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
learnwand(obj); learnwand(obj);
} }
mtmp = m_at(bhitpos.x, bhitpos.y); mtmp = m_at(g.bhitpos.x, g.bhitpos.y);
/* /*
* skipping rocks * skipping rocks
@@ -3268,7 +3268,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
* skiprange_start is only set if this is a thrown rock * skiprange_start is only set if this is a thrown rock
*/ */
if (skiprange_start && (range == skiprange_start) && allow_skip) { if (skiprange_start && (range == skiprange_start) && allow_skip) {
if (is_pool(bhitpos.x, bhitpos.y) && !mtmp) { if (is_pool(g.bhitpos.x, g.bhitpos.y) && !mtmp) {
in_skip = TRUE; in_skip = TRUE;
if (!Blind) if (!Blind)
pline("%s %s%s.", Yname2(obj), otense(obj, "skip"), pline("%s %s%s.", Yname2(obj), otense(obj, "skip"),
@@ -3293,7 +3293,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
} }
if (mtmp && !(in_skip && M_IN_WATER(mtmp->data))) { if (mtmp && !(in_skip && M_IN_WATER(mtmp->data))) {
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my); g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
if (weapon == FLASHED_LIGHT) { if (weapon == FLASHED_LIGHT) {
/* FLASHED_LIGHT hitting invisible monster should /* FLASHED_LIGHT hitting invisible monster should
pass through instead of stop so we call pass through instead of stop so we call
@@ -3323,8 +3323,8 @@ struct obj **pobj; /* object tossed/used, set to NULL
if (!tethered_weapon) if (!tethered_weapon)
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
if (cansee(bhitpos.x, bhitpos.y) && !canspotmon(mtmp)) if (cansee(g.bhitpos.x, g.bhitpos.y) && !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y); map_invisible(g.bhitpos.x, g.bhitpos.y);
return mtmp; return mtmp;
} else { } else {
/* ZAPPED_WAND */ /* ZAPPED_WAND */
@@ -3333,20 +3333,20 @@ struct obj **pobj; /* object tossed/used, set to NULL
} }
} else { } else {
if (weapon == ZAPPED_WAND && obj->otyp == WAN_PROBING if (weapon == ZAPPED_WAND && obj->otyp == WAN_PROBING
&& glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph)) { && glyph_is_invisible(levl[g.bhitpos.x][g.bhitpos.y].glyph)) {
unmap_object(bhitpos.x, bhitpos.y); unmap_object(g.bhitpos.x, g.bhitpos.y);
newsym(x, y); newsym(x, y);
} }
} }
if (fhito) { if (fhito) {
if (bhitpile(obj, fhito, bhitpos.x, bhitpos.y, 0)) if (bhitpile(obj, fhito, g.bhitpos.x, g.bhitpos.y, 0))
range--; range--;
} else { } else {
if (weapon == KICKED_WEAPON if (weapon == KICKED_WEAPON
&& ((obj->oclass == COIN_CLASS && ((obj->oclass == COIN_CLASS
&& OBJ_AT(bhitpos.x, bhitpos.y)) && OBJ_AT(g.bhitpos.x, g.bhitpos.y))
|| ship_object(obj, bhitpos.x, bhitpos.y, || ship_object(obj, g.bhitpos.x, g.bhitpos.y,
costly_spot(bhitpos.x, bhitpos.y)))) { costly_spot(g.bhitpos.x, g.bhitpos.y)))) {
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
return (struct monst *) 0; return (struct monst *) 0;
} }
@@ -3359,38 +3359,38 @@ struct obj **pobj; /* object tossed/used, set to NULL
case SPE_KNOCK: case SPE_KNOCK:
case SPE_WIZARD_LOCK: case SPE_WIZARD_LOCK:
case SPE_FORCE_BOLT: case SPE_FORCE_BOLT:
if (doorlock(obj, bhitpos.x, bhitpos.y)) { if (doorlock(obj, g.bhitpos.x, g.bhitpos.y)) {
if (cansee(bhitpos.x, bhitpos.y) if (cansee(g.bhitpos.x, g.bhitpos.y)
|| (obj->otyp == WAN_STRIKING && !Deaf)) || (obj->otyp == WAN_STRIKING && !Deaf))
learnwand(obj); learnwand(obj);
if (levl[bhitpos.x][bhitpos.y].doormask == D_BROKEN if (levl[g.bhitpos.x][g.bhitpos.y].doormask == D_BROKEN
&& *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE)) { && *in_rooms(g.bhitpos.x, g.bhitpos.y, SHOPBASE)) {
shopdoor = TRUE; shopdoor = TRUE;
add_damage(bhitpos.x, bhitpos.y, SHOP_DOOR_COST); add_damage(g.bhitpos.x, g.bhitpos.y, SHOP_DOOR_COST);
} }
} }
break; break;
} }
} }
if (!ZAP_POS(typ) || closed_door(bhitpos.x, bhitpos.y)) { if (!ZAP_POS(typ) || closed_door(g.bhitpos.x, g.bhitpos.y)) {
bhitpos.x -= ddx; g.bhitpos.x -= ddx;
bhitpos.y -= ddy; g.bhitpos.y -= ddy;
break; break;
} }
if (weapon != ZAPPED_WAND && weapon != INVIS_BEAM) { if (weapon != ZAPPED_WAND && weapon != INVIS_BEAM) {
/* 'I' present but no monster: erase */ /* 'I' present but no monster: erase */
/* do this before the tmp_at() */ /* do this before the tmp_at() */
if (glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph) if (glyph_is_invisible(levl[g.bhitpos.x][g.bhitpos.y].glyph)
&& cansee(x, y)) { && cansee(x, y)) {
unmap_object(bhitpos.x, bhitpos.y); unmap_object(g.bhitpos.x, g.bhitpos.y);
newsym(x, y); newsym(x, y);
} }
tmp_at(bhitpos.x, bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
delay_output(); delay_output();
/* kicked objects fall in pools */ /* kicked objects fall in pools */
if ((weapon == KICKED_WEAPON) if ((weapon == KICKED_WEAPON)
&& (is_pool(bhitpos.x, bhitpos.y) && (is_pool(g.bhitpos.x, g.bhitpos.y)
|| is_lava(bhitpos.x, bhitpos.y))) || is_lava(g.bhitpos.x, g.bhitpos.y)))
break; break;
if (IS_SINK(typ) && weapon != FLASHED_LIGHT) if (IS_SINK(typ) && weapon != FLASHED_LIGHT)
break; /* physical objects fall onto sink */ break; /* physical objects fall onto sink */
@@ -3463,8 +3463,8 @@ int dx, dy;
* (invert rows for corresponding clockwise patterns) * (invert rows for corresponding clockwise patterns)
*/ */
bhitpos.x = u.ux; g.bhitpos.x = u.ux;
bhitpos.y = u.uy; g.bhitpos.y = u.uy;
boom = counterclockwise ? S_boomleft : S_boomright; boom = counterclockwise ? S_boomleft : S_boomright;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
if (xdir[i] == dx && ydir[i] == dy) if (xdir[i] == dx && ydir[i] == dy)
@@ -3476,20 +3476,20 @@ int dx, dy;
tmp_at(DISP_CHANGE, cmap_to_glyph(boom)); /* change glyph */ tmp_at(DISP_CHANGE, cmap_to_glyph(boom)); /* change glyph */
dx = xdir[i]; dx = xdir[i];
dy = ydir[i]; dy = ydir[i];
bhitpos.x += dx; g.bhitpos.x += dx;
bhitpos.y += dy; g.bhitpos.y += dy;
if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) { if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) {
m_respond(mtmp); m_respond(mtmp);
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
return mtmp; return mtmp;
} }
if (!ZAP_POS(levl[bhitpos.x][bhitpos.y].typ) if (!ZAP_POS(levl[g.bhitpos.x][g.bhitpos.y].typ)
|| closed_door(bhitpos.x, bhitpos.y)) { || closed_door(g.bhitpos.x, g.bhitpos.y)) {
bhitpos.x -= dx; g.bhitpos.x -= dx;
bhitpos.y -= dy; g.bhitpos.y -= dy;
break; break;
} }
if (bhitpos.x == u.ux && bhitpos.y == u.uy) { /* ct == 9 */ if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) { /* ct == 9 */
if (Fumbling || rn2(20) >= ACURR(A_DEX)) { if (Fumbling || rn2(20) >= ACURR(A_DEX)) {
/* we hit ourselves */ /* we hit ourselves */
(void) thitu(10 + obj->spe, dmgval(obj, &youmonst), &obj, (void) thitu(10 + obj->spe, dmgval(obj, &youmonst), &obj,
@@ -3502,9 +3502,9 @@ int dx, dy;
return &youmonst; return &youmonst;
} }
} }
tmp_at(bhitpos.x, bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
delay_output(); delay_output();
if (IS_SINK(levl[bhitpos.x][bhitpos.y].typ)) { if (IS_SINK(levl[g.bhitpos.x][g.bhitpos.y].typ)) {
if (!Deaf) if (!Deaf)
pline("Klonk!"); pline("Klonk!");
break; /* boomerang falls on sink */ break; /* boomerang falls on sink */
@@ -4005,7 +4005,7 @@ boolean say; /* Announce out of sight hit/miss events if true */
range = rn1(7, 7); range = rn1(7, 7);
if (dx == 0 && dy == 0) if (dx == 0 && dy == 0)
range = 1; range = 1;
save_bhitpos = bhitpos; save_bhitpos = g.bhitpos;
tmp_at(DISP_BEAM, zapdir_to_glyph(dx, dy, abstype)); tmp_at(DISP_BEAM, zapdir_to_glyph(dx, dy, abstype));
while (range-- > 0) { while (range-- > 0) {
@@ -4029,8 +4029,8 @@ boolean say; /* Announce out of sight hit/miss events if true */
delay_output(); /* wait a little */ delay_output(); /* wait a little */
} }
/* hit() and miss() need bhitpos to match the target */ /* hit() and miss() need g.bhitpos to match the target */
bhitpos.x = sx, bhitpos.y = sy; g.bhitpos.x = sx, g.bhitpos.y = sy;
/* Fireballs only damage when they explode */ /* Fireballs only damage when they explode */
if (type != ZT_SPELL(ZT_FIRE)) { if (type != ZT_SPELL(ZT_FIRE)) {
range += zap_over_floor(sx, sy, type, &shopdamage, 0); range += zap_over_floor(sx, sy, type, &shopdamage, 0);
@@ -4045,7 +4045,7 @@ boolean say; /* Announce out of sight hit/miss events if true */
if (type >= 0) if (type >= 0)
mon->mstrategy &= ~STRAT_WAITMASK; mon->mstrategy &= ~STRAT_WAITMASK;
buzzmonst: buzzmonst:
g.notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y); g.notonhead = (mon->mx != g.bhitpos.x || mon->my != g.bhitpos.y);
if (zap_hit(find_mac(mon), spell_type)) { if (zap_hit(find_mac(mon), spell_type)) {
if (mon_reflects(mon, (char *) 0)) { if (mon_reflects(mon, (char *) 0)) {
if (cansee(mon->mx, mon->my)) { if (cansee(mon->mx, mon->my)) {
@@ -4230,7 +4230,7 @@ boolean say; /* Announce out of sight hit/miss events if true */
? "disintegrate" ? "disintegrate"
: "destroy", : "destroy",
FALSE); FALSE);
bhitpos = save_bhitpos; g.bhitpos = save_bhitpos;
} }
void void
@@ -4439,7 +4439,7 @@ short exploding_wand_typ;
u.uinwater = 0; u.uinwater = 0;
u.uundetected = 0; u.uundetected = 0;
docrt(); docrt();
vision_full_recalc = 1; g.vision_full_recalc = 1;
} else if (u.utrap && u.utraptype == TT_LAVA) { } else if (u.utrap && u.utraptype == TT_LAVA) {
if (Passes_walls) { if (Passes_walls) {
You("pass through the now-solid rock."); You("pass through the now-solid rock.");
@@ -4805,7 +4805,7 @@ int osym, dmgtyp;
break; break;
} }
#if 0 #if 0
if (obj == current_wand) { skip++; break; } if (obj == g.current_wand) { skip++; break; }
#endif #endif
dindx = 6; dindx = 6;
dmg = rnd(10); dmg = rnd(10);
@@ -4847,8 +4847,8 @@ int osym, dmgtyp;
else else
setnotworn(obj); setnotworn(obj);
} }
if (obj == current_wand) if (obj == g.current_wand)
current_wand = 0; /* destroyed */ g.current_wand = 0; /* destroyed */
for (i = 0; i < cnt; i++) for (i = 0; i < cnt; i++)
useup(obj); useup(obj);
if (dmg) { if (dmg) {
+3 -3
View File
@@ -72,7 +72,7 @@ getlin_hook_proc hook;
for (;;) { for (;;) {
(void) fflush(stdout); (void) fflush(stdout);
Strcat(strcat(strcpy(toplines, query), " "), obufp); Strcat(strcat(strcpy(g.toplines, query), " "), obufp);
c = pgetchar(); c = pgetchar();
if (c == '\033' || c == EOF) { if (c == '\033' || c == EOF) {
if (c == '\033' && obufp[0] != '\0') { if (c == '\033' && obufp[0] != '\0') {
@@ -200,11 +200,11 @@ getlin_hook_proc hook;
if (suppress_history) { if (suppress_history) {
/* prevent next message from pushing current query+answer into /* prevent next message from pushing current query+answer into
tty message history */ tty message history */
*toplines = '\0'; *g.toplines = '\0';
#ifdef DUMPLOG #ifdef DUMPLOG
} else { } else {
/* needed because we've bypassed pline() */ /* needed because we've bypassed pline() */
dumplogmsg(toplines); dumplogmsg(g.toplines);
#endif #endif
} }
} }
+24 -24
View File
@@ -41,7 +41,7 @@ tty_doprev_message()
putstr(prevmsg_win, 0, cw->data[i]); putstr(prevmsg_win, 0, cw->data[i]);
i = (i + 1) % cw->rows; i = (i + 1) % cw->rows;
} while (i != cw->maxcol); } while (i != cw->maxcol);
putstr(prevmsg_win, 0, toplines); putstr(prevmsg_win, 0, g.toplines);
display_nhwindow(prevmsg_win, TRUE); display_nhwindow(prevmsg_win, TRUE);
destroy_nhwindow(prevmsg_win); destroy_nhwindow(prevmsg_win);
} else if (iflags.prevmsg_window == 'c') { /* combination */ } else if (iflags.prevmsg_window == 'c') { /* combination */
@@ -49,7 +49,7 @@ tty_doprev_message()
morc = 0; morc = 0;
if (cw->maxcol == cw->maxrow) { if (cw->maxcol == cw->maxrow) {
ttyDisplay->dismiss_more = C('p'); /* ^P ok at --More-- */ ttyDisplay->dismiss_more = C('p'); /* ^P ok at --More-- */
redotoplin(toplines); redotoplin(g.toplines);
cw->maxcol--; cw->maxcol--;
if (cw->maxcol < 0) if (cw->maxcol < 0)
cw->maxcol = cw->rows - 1; cw->maxcol = cw->rows - 1;
@@ -74,7 +74,7 @@ tty_doprev_message()
putstr(prevmsg_win, 0, cw->data[i]); putstr(prevmsg_win, 0, cw->data[i]);
i = (i + 1) % cw->rows; i = (i + 1) % cw->rows;
} while (i != cw->maxcol); } while (i != cw->maxcol);
putstr(prevmsg_win, 0, toplines); putstr(prevmsg_win, 0, g.toplines);
display_nhwindow(prevmsg_win, TRUE); display_nhwindow(prevmsg_win, TRUE);
destroy_nhwindow(prevmsg_win); destroy_nhwindow(prevmsg_win);
} }
@@ -86,7 +86,7 @@ tty_doprev_message()
prevmsg_win = create_nhwindow(NHW_MENU); prevmsg_win = create_nhwindow(NHW_MENU);
putstr(prevmsg_win, 0, "Message History"); putstr(prevmsg_win, 0, "Message History");
putstr(prevmsg_win, 0, ""); putstr(prevmsg_win, 0, "");
putstr(prevmsg_win, 0, toplines); putstr(prevmsg_win, 0, g.toplines);
cw->maxcol = cw->maxrow - 1; cw->maxcol = cw->maxrow - 1;
if (cw->maxcol < 0) if (cw->maxcol < 0)
cw->maxcol = cw->rows - 1; cw->maxcol = cw->rows - 1;
@@ -109,7 +109,7 @@ tty_doprev_message()
do { do {
morc = 0; morc = 0;
if (cw->maxcol == cw->maxrow) if (cw->maxcol == cw->maxrow)
redotoplin(toplines); redotoplin(g.toplines);
else if (cw->data[cw->maxcol]) else if (cw->data[cw->maxcol])
redotoplin(cw->data[cw->maxcol]); redotoplin(cw->data[cw->maxcol]);
cw->maxcol--; cw->maxcol--;
@@ -149,9 +149,9 @@ remember_topl()
{ {
register struct WinDesc *cw = wins[WIN_MESSAGE]; register struct WinDesc *cw = wins[WIN_MESSAGE];
int idx = cw->maxrow; int idx = cw->maxrow;
unsigned len = strlen(toplines) + 1; unsigned len = strlen(g.toplines) + 1;
if ((cw->flags & WIN_LOCKHISTORY) || !*toplines) if ((cw->flags & WIN_LOCKHISTORY) || !*g.toplines)
return; return;
if (len > (unsigned) cw->datlen[idx]) { if (len > (unsigned) cw->datlen[idx]) {
@@ -161,8 +161,8 @@ remember_topl()
cw->data[idx] = (char *) alloc(len); cw->data[idx] = (char *) alloc(len);
cw->datlen[idx] = (short) len; cw->datlen[idx] = (short) len;
} }
Strcpy(cw->data[idx], toplines); Strcpy(cw->data[idx], g.toplines);
*toplines = '\0'; *g.toplines = '\0';
cw->maxcol = cw->maxrow = (idx + 1) % cw->rows; cw->maxcol = cw->maxrow = (idx + 1) % cw->rows;
} }
@@ -232,10 +232,10 @@ register const char *bp;
/* But messages like "You die..." deserve their own line */ /* But messages like "You die..." deserve their own line */
n0 = strlen(bp); n0 = strlen(bp);
if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP)) && cw->cury == 0 if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP)) && cw->cury == 0
&& n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */ && n0 + (int) strlen(g.toplines) + 3 < CO - 8 /* room for --More-- */
&& (notdied = strncmp(bp, "You die", 7)) != 0) { && (notdied = strncmp(bp, "You die", 7)) != 0) {
Strcat(toplines, " "); Strcat(g.toplines, " ");
Strcat(toplines, bp); Strcat(g.toplines, bp);
cw->curx += 2; cw->curx += 2;
if (!(cw->flags & WIN_STOP)) if (!(cw->flags & WIN_STOP))
addtopl(bp); addtopl(bp);
@@ -249,10 +249,10 @@ register const char *bp;
} }
} }
remember_topl(); remember_topl();
(void) strncpy(toplines, bp, TBUFSZ); (void) strncpy(g.toplines, bp, TBUFSZ);
toplines[TBUFSZ - 1] = 0; g.toplines[TBUFSZ - 1] = 0;
for (tl = toplines; n0 >= CO; ) { for (tl = g.toplines; n0 >= CO; ) {
otl = tl; otl = tl;
for (tl += CO - 1; tl != otl; --tl) for (tl += CO - 1; tl != otl; --tl)
if (*tl == ' ') if (*tl == ' ')
@@ -269,7 +269,7 @@ register const char *bp;
if (!notdied) if (!notdied)
cw->flags &= ~WIN_STOP; cw->flags &= ~WIN_STOP;
if (!(cw->flags & WIN_STOP)) if (!(cw->flags & WIN_STOP))
redotoplin(toplines); redotoplin(g.toplines);
} }
STATIC_OVL STATIC_OVL
@@ -503,10 +503,10 @@ char def;
Sprintf(rtmp, "#%ld", yn_number); Sprintf(rtmp, "#%ld", yn_number);
else else
(void) key2txt(q, rtmp); (void) key2txt(q, rtmp);
/* addtopl(rtmp); -- rewrite toplines instead */ /* addtopl(rtmp); -- rewrite g.toplines instead */
Sprintf(toplines, "%s%s", prompt, rtmp); Sprintf(g.toplines, "%s%s", prompt, rtmp);
#ifdef DUMPLOG #ifdef DUMPLOG
dumplogmsg(toplines); dumplogmsg(g.toplines);
#endif #endif
ttyDisplay->inread--; ttyDisplay->inread--;
ttyDisplay->toplin = 2; ttyDisplay->toplin = 2;
@@ -536,7 +536,7 @@ boolean purge; /* clear message history buffer as we copy it */
return; return;
cw = wins[WIN_MESSAGE]; cw = wins[WIN_MESSAGE];
/* flush toplines[], moving most recent message to history */ /* flush g.toplines[], moving most recent message to history */
remember_topl(); remember_topl();
/* for a passive snapshot, we just copy pointers, so can't allow further /* for a passive snapshot, we just copy pointers, so can't allow further
@@ -666,17 +666,17 @@ boolean restoring_msghist;
if (msg) { if (msg) {
/* move most recent message to history, make this become most recent */ /* move most recent message to history, make this become most recent */
remember_topl(); remember_topl();
Strcpy(toplines, msg); Strcpy(g.toplines, msg);
#ifdef DUMPLOG #ifdef DUMPLOG
dumplogmsg(toplines); dumplogmsg(g.toplines);
#endif #endif
} else if (snapshot_mesgs) { } else if (snapshot_mesgs) {
/* done putting arbitrary messages in; put the snapshot ones back */ /* done putting arbitrary messages in; put the snapshot ones back */
for (idx = 0; snapshot_mesgs[idx]; ++idx) { for (idx = 0; snapshot_mesgs[idx]; ++idx) {
remember_topl(); remember_topl();
Strcpy(toplines, snapshot_mesgs[idx]); Strcpy(g.toplines, snapshot_mesgs[idx]);
#ifdef DUMPLOG #ifdef DUMPLOG
dumplogmsg(toplines); dumplogmsg(g.toplines);
#endif #endif
} }
/* now release the snapshot */ /* now release the snapshot */
+1 -1
View File
@@ -342,7 +342,7 @@ int sig_unused UNUSED;
ttyDisplay->toplin = i; ttyDisplay->toplin = i;
flush_screen(1); flush_screen(1);
if (i) { if (i) {
addtopl(toplines); addtopl(g.toplines);
} else } else
for (i = WIN_INVEN; i < MAXWIN; i++) for (i = WIN_INVEN; i < MAXWIN; i++)
if (wins[i] && wins[i]->active) { if (wins[i] && wins[i]->active) {