Moved more globals to instance_globals.

This commit is contained in:
Bart House
2018-12-16 19:52:43 -08:00
parent 471224ea70
commit 40b682ecf6
37 changed files with 987 additions and 869 deletions
+148 -2
View File
@@ -37,8 +37,6 @@ E NEARDATA int nroom;
E NEARDATA int nsubroom; E NEARDATA int nsubroom;
E NEARDATA int occtime; E NEARDATA int occtime;
#define WARNCOUNT 6 /* number of different warning levels */
E nhsym warnsyms[WARNCOUNT];
E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */ E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */
E int x_maze_max, y_maze_max; E int x_maze_max, y_maze_max;
@@ -514,12 +512,47 @@ struct cmd {
char spkeys[NUM_NHKF]; char spkeys[NUM_NHKF];
}; };
#define ENTITIES 2
struct entity {
struct monst *emon; /* youmonst for the player */
struct permonst *edata; /* must be non-zero for record to be valid */
int ex, ey;
};
/* these probably ought to be generated by makedefs, like LAST_GEM */
#define FIRST_GEM DILITHIUM_CRYSTAL
#define FIRST_AMULET AMULET_OF_ESP
#define LAST_AMULET AMULET_OF_YENDOR
struct valuable_data {
long count;
int typ;
};
struct val_list {
struct valuable_data *list;
int size;
};
/* at most one of `door' and `box' should be non-null at any given time */
struct xlock_s {
struct rm *door;
struct obj *box;
int picktyp, /* key|pick|card for unlock, sharp vs blunt for #force */
chance, usedtime;
boolean magic_key;
};
/* instance_globals holds engine state that does not need to be /* instance_globals holds engine state that does not need to be
* persisted upon game exit. The initialization state is well defined * persisted upon game exit. The initialization state is well defined
* an set in decl.c during early early engine initialization. * an set in decl.c during early early engine initialization.
* *
* unlike instance_flags, values in the structure can be of any type. */ * unlike instance_flags, values in the structure can be of any type. */
#define BSIZE 20
struct instance_globals { struct instance_globals {
/* apply.c */ /* apply.c */
@@ -540,9 +573,85 @@ struct instance_globals {
/* cmd.c */ /* cmd.c */
struct cmd Cmd; /* flag.h */ struct cmd Cmd; /* flag.h */
/* Provide a means to redo the last command. The flag `in_doagain' is set
* to true while redoing the command. This flag is tested in commands that
* require additional input (like `throw' which requires a thing and a
* direction), and the input prompt is not shown. Also, while in_doagain is
* TRUE, no keystrokes can be saved into the saveq.
*/
char pushq[BSIZE];
char saveq[BSIZE];
int phead;
int ptail;
int shead;
int stail;
coord clicklook_cc;
winid en_win;
boolean en_via_menu;
/* dbridge.c */
struct entity occupants[ENTITIES];
/* dig.c */
boolean did_dig_msg;
/* do.c */
boolean at_ladder;
char *dfr_pre_msg; /* pline() before level change */
char *dfr_post_msg; /* pline() after level change */
d_level save_dlevel;
/* do_name.c */
struct opvar *gloc_filter_map;
int gloc_filter_floodfill_match_glyph;
int via_naming;
/* dog.c */ /* dog.c */
int petname_used; /* user preferred pet name has been used */ int petname_used; /* user preferred pet name has been used */
xchar gtyp; /* type of dog's current goal */
xchar gx; /* x position of dog's current goal */
char gy; /* y position of dog's current goal */
/* dokick.c */
struct rm *maploc;
struct rm nowhere;
const char *gate_str;
/* drawing */
struct symsetentry symset[NUM_GRAPHICS];
int currentgraphics;
nhsym showsyms[SYM_MAX]; /* symbols to be displayed */
nhsym l_syms[SYM_MAX]; /* loaded symbols */
nhsym r_syms[SYM_MAX]; /* rogue symbols */
nhsym warnsyms[WARNCOUNT]; /* the current warning display symbols */
/* dungeon.c */
int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */
branch *branches; /* dungeon branch list */
mapseen *mapseenchn; /*DUNGEON_OVERVIEW*/
/* eat.c */
boolean force_save_hs;
/* end.c */
struct valuable_data gems[LAST_GEM + 1 - FIRST_GEM + 1]; /* +1 for glass */
struct valuable_data amulets[LAST_AMULET + 1 - FIRST_AMULET];
struct val_list valuables[3];
/* hack.c */
anything tmp_anything;
int wc; /* current weight_cap(); valid after call to inv_weight() */
/* invent.c */
int lastinvnr; /* 0 ... 51 (never saved&restored) */
unsigned sortlootmode; /* set by sortloot() for use by sortloot_cmp();
* reset by sortloot when done */
char *invbuf;
unsigned invbufsiz;
/* lock.c */
struct xlock_s xlock;
/* makemon.c */ /* makemon.c */
struct { struct {
@@ -550,6 +659,38 @@ struct instance_globals {
char mchoices[SPECIAL_PM]; /* value range is 0..127 */ char mchoices[SPECIAL_PM]; /* value range is 0..127 */
} rndmonst_state; } rndmonst_state;
/* mhitm.c */
boolean vis;
boolean far_noise;
long noisetime;
struct obj *otmp;
int dieroll; /* Needed for the special case of monsters wielding vorpal
* blades (rare). If we use this a lot it should probably
* be a parameter to mdamagem() instead of a global variable.
*/
/* mhitu.c */
int mhitu_dieroll;
/* mklev.c */
xchar vault_x;
xchar vault_y;
boolean made_branch; /* used only during level creation */
/* mkmap.c */
char *new_locations;
int min_rx; /* rectangle bounds for regions */
int max_rx;
int min_ry;
int max_ry;
int n_loc_filled;
/* mkmaze.c */
lev_region bughack; /* for preserving the insect legs when wallifying
* baalz level */
boolean was_waterlevel; /* ugh... this shouldn't be needed */
/* muse.c */ /* muse.c */
boolean m_using; /* kludge to use mondided instead of killed */ boolean m_using; /* kludge to use mondided instead of killed */
int trapx; int trapx;
@@ -630,6 +771,11 @@ struct instance_globals {
unsigned ustuck_id; /* need to preserve during save */ unsigned ustuck_id; /* need to preserve during save */
unsigned usteed_id; /* need to preserve during save */ unsigned usteed_id; /* need to preserve during save */
/* sp_lev.c */
char *lev_message;
lev_region *lregions;
int num_lregions;
/* trap.c */ /* trap.c */
int force_mintrap; /* mintrap() should take a flags argument, but for time int force_mintrap; /* mintrap() should take a flags argument, but for time
being we use this */ being we use this */
+31 -9
View File
@@ -167,6 +167,27 @@ typedef struct strbuf {
char buf[256]; char buf[256];
} strbuf_t; } strbuf_t;
/* str_or_len from sp_lev.h */
typedef union str_or_len {
char *str;
int len;
} Str_or_Len;
/* values for rtype are defined in dungeon.h */
/* lev_region from sp_lev.h */
typedef struct {
struct {
xchar x1, y1, x2, y2;
} inarea;
struct {
xchar x1, y1, x2, y2;
} delarea;
boolean in_islev, del_islev;
xchar rtype, padding;
Str_or_Len rname;
} lev_region;
#include "align.h" #include "align.h"
#include "dungeon.h" #include "dungeon.h"
#include "monsym.h" #include "monsym.h"
@@ -175,6 +196,16 @@ typedef struct strbuf {
#include "youprop.h" #include "youprop.h"
#include "wintype.h" #include "wintype.h"
#include "context.h" #include "context.h"
#include "rm.h"
/* Symbol offsets */
#define SYM_OFF_P (0)
#define SYM_OFF_O (SYM_OFF_P + MAXPCHARS) /* MAXPCHARS from rm.h */
#define SYM_OFF_M (SYM_OFF_O + MAXOCLASSES) /* MAXOCLASSES from objclass.h */
#define SYM_OFF_W (SYM_OFF_M + MAXMCLASSES) /* MAXMCLASSES from monsym.h*/
#define SYM_OFF_X (SYM_OFF_W + WARNCOUNT)
#define SYM_MAX (SYM_OFF_X + MAXOTHER)
#include "decl.h" #include "decl.h"
#include "timeout.h" #include "timeout.h"
@@ -221,21 +252,12 @@ typedef struct sortloot_item Loot;
#include "trap.h" #include "trap.h"
#include "flag.h" #include "flag.h"
#include "rm.h"
#include "vision.h" #include "vision.h"
#include "display.h" #include "display.h"
#include "engrave.h" #include "engrave.h"
#include "rect.h" #include "rect.h"
#include "region.h" #include "region.h"
/* Symbol offsets */
#define SYM_OFF_P (0)
#define SYM_OFF_O (SYM_OFF_P + MAXPCHARS)
#define SYM_OFF_M (SYM_OFF_O + MAXOCLASSES)
#define SYM_OFF_W (SYM_OFF_M + MAXMCLASSES)
#define SYM_OFF_X (SYM_OFF_W + WARNCOUNT)
#define SYM_MAX (SYM_OFF_X + MAXOTHER)
#ifdef USE_TRAMPOLI /* this doesn't belong here, but we have little choice */ #ifdef USE_TRAMPOLI /* this doesn't belong here, but we have little choice */
#undef NDECL #undef NDECL
#define NDECL(f) f() #define NDECL(f) f()
+2 -7
View File
@@ -300,14 +300,9 @@ struct symsetentry {
#define H_CURS 3 #define H_CURS 3
extern const struct symdef defsyms[MAXPCHARS]; /* defaults */ extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
#define WARNCOUNT 6 /* number of different warning levels */
extern const struct symdef def_warnsyms[WARNCOUNT]; extern const struct symdef def_warnsyms[WARNCOUNT];
extern int currentgraphics; /* from drawing.c */ #define SYMHANDLING(ht) (g.symset[g.currentgraphics].handling == (ht))
extern nhsym showsyms[];
extern nhsym l_syms[];
extern nhsym r_syms[];
extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */
#define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht))
/* /*
* The 5 possible states of doors * The 5 possible states of doors
-18
View File
@@ -327,11 +327,6 @@ typedef struct {
long jmp_target; long jmp_target;
} opjmp; } opjmp;
typedef union str_or_len {
char *str;
int len;
} Str_or_Len;
typedef struct { typedef struct {
xchar init_style; /* one of LVLINIT_foo */ xchar init_style; /* one of LVLINIT_foo */
long flags; long flags;
@@ -400,19 +395,6 @@ typedef struct {
xchar fromter, toter, tolit; xchar fromter, toter, tolit;
} replaceterrain; } replaceterrain;
/* values for rtype are defined in dungeon.h */
typedef struct {
struct {
xchar x1, y1, x2, y2;
} inarea;
struct {
xchar x1, y1, x2, y2;
} delarea;
boolean in_islev, del_islev;
xchar rtype, padding;
Str_or_Len rname;
} lev_region;
typedef struct { typedef struct {
struct { struct {
xchar room; xchar room;
+1 -2
View File
@@ -1508,14 +1508,13 @@ struct obj *obj;
case CREATE_PORTAL: { case CREATE_PORTAL: {
int i, num_ok_dungeons, last_ok_dungeon = 0; int i, num_ok_dungeons, last_ok_dungeon = 0;
d_level newlev; d_level newlev;
extern int n_dgns; /* from dungeon.c */
winid tmpwin = create_nhwindow(NHW_MENU); winid tmpwin = create_nhwindow(NHW_MENU);
anything any; anything any;
any = zeroany; /* set all bits to zero */ any = zeroany; /* set all bits to zero */
start_menu(tmpwin); start_menu(tmpwin);
/* use index+1 (cant use 0) as identifier */ /* use index+1 (cant use 0) as identifier */
for (i = num_ok_dungeons = 0; i < n_dgns; i++) { for (i = num_ok_dungeons = 0; i < g.n_dgns; i++) {
if (!dungeons[i].dunlev_ureached) if (!dungeons[i].dunlev_ureached)
continue; continue;
any.a_int = i + 1; any.a_int = i + 1;
+2 -3
View File
@@ -20,11 +20,10 @@ STATIC_OVL boolean
no_bones_level(lev) no_bones_level(lev)
d_level *lev; d_level *lev;
{ {
extern d_level save_dlevel; /* in do.c */
s_level *sptr; s_level *sptr;
if (ledger_no(&save_dlevel)) if (ledger_no(&g.save_dlevel))
assign_level(lev, &save_dlevel); assign_level(lev, &g.save_dlevel);
return (boolean) (((sptr = Is_special(lev)) != 0 && !sptr->boneid) return (boolean) (((sptr = Is_special(lev)) != 0 && !sptr->boneid)
|| !dungeons[lev->dnum].boneid || !dungeons[lev->dnum].boneid
+2 -2
View File
@@ -739,10 +739,10 @@ boolean *valsetlist;
*/ */
if (fld == BL_GOLD if (fld == BL_GOLD
&& (context.rndencode != oldrndencode && (context.rndencode != oldrndencode
|| showsyms[COIN_CLASS + SYM_OFF_O] != oldgoldsym)) { || g.showsyms[COIN_CLASS + SYM_OFF_O] != oldgoldsym)) {
update_all = TRUE; /* chg = 2; */ update_all = TRUE; /* chg = 2; */
oldrndencode = context.rndencode; oldrndencode = context.rndencode;
oldgoldsym = showsyms[COIN_CLASS + SYM_OFF_O]; oldgoldsym = g.showsyms[COIN_CLASS + SYM_OFF_O];
} }
reset = FALSE; reset = FALSE;
+32 -44
View File
@@ -266,16 +266,6 @@ int xtime;
STATIC_DCL char NDECL(popch); STATIC_DCL char NDECL(popch);
/* Provide a means to redo the last command. The flag `in_doagain' is set
* to true while redoing the command. This flag is tested in commands that
* require additional input (like `throw' which requires a thing and a
* direction), and the input prompt is not shown. Also, while in_doagain is
* TRUE, no keystrokes can be saved into the saveq.
*/
#define BSIZE 20
static char pushq[BSIZE], saveq[BSIZE];
static NEARDATA int phead, ptail, shead, stail;
STATIC_OVL char STATIC_OVL char
popch() popch()
{ {
@@ -287,9 +277,9 @@ popch()
if (occupation) if (occupation)
return '\0'; return '\0';
if (in_doagain) if (in_doagain)
return (char) ((shead != stail) ? saveq[stail++] : '\0'); return (char) ((g.shead != g.stail) ? g.saveq[g.stail++] : '\0');
else else
return (char) ((phead != ptail) ? pushq[ptail++] : '\0'); return (char) ((g.phead != g.ptail) ? g.pushq[g.ptail++] : '\0');
} }
char char
@@ -310,9 +300,9 @@ pushch(ch)
char ch; char ch;
{ {
if (!ch) if (!ch)
phead = ptail = 0; g.phead = g.ptail = 0;
if (phead < BSIZE) if (g.phead < BSIZE)
pushq[phead++] = ch; g.pushq[g.phead++] = ch;
return; return;
} }
@@ -325,9 +315,9 @@ char ch;
{ {
if (!in_doagain) { if (!in_doagain) {
if (!ch) if (!ch)
phead = ptail = shead = stail = 0; g.phead = g.ptail = g.shead = g.stail = 0;
else if (shead < BSIZE) else if (g.shead < BSIZE)
saveq[shead++] = ch; g.saveq[g.shead++] = ch;
} }
return; return;
} }
@@ -1547,8 +1537,6 @@ doterrain(VOID_ARGS)
} }
/* -enlightenment and conduct- */ /* -enlightenment and conduct- */
static winid en_win = WIN_ERR;
static boolean en_via_menu = FALSE;
static const char You_[] = "You ", are[] = "are ", were[] = "were ", static const char You_[] = "You ", are[] = "are ", were[] = "were ",
have[] = "have ", had[] = "had ", can[] = "can ", have[] = "have ", had[] = "had ", can[] = "can ",
could[] = "could "; could[] = "could ";
@@ -1570,13 +1558,13 @@ static void
enlght_out(buf) enlght_out(buf)
const char *buf; const char *buf;
{ {
if (en_via_menu) { if (g.en_via_menu) {
anything any; anything any;
any = zeroany; any = zeroany;
add_menu(en_win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(g.en_win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
} else } else
putstr(en_win, 0, buf); putstr(g.en_win, 0, buf);
} }
static void static void
@@ -1708,10 +1696,10 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
{ {
char buf[BUFSZ], tmpbuf[BUFSZ]; char buf[BUFSZ], tmpbuf[BUFSZ];
en_win = create_nhwindow(NHW_MENU); g.en_win = create_nhwindow(NHW_MENU);
en_via_menu = !final; g.en_via_menu = !final;
if (en_via_menu) if (g.en_via_menu)
start_menu(en_win); start_menu(g.en_win);
Strcpy(tmpbuf, plname); Strcpy(tmpbuf, plname);
*tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */ *tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */
@@ -1746,18 +1734,18 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
attributes_enlightenment(mode, final); attributes_enlightenment(mode, final);
} }
if (!en_via_menu) { if (!g.en_via_menu) {
display_nhwindow(en_win, TRUE); display_nhwindow(g.en_win, TRUE);
} else { } else {
menu_item *selected = 0; menu_item *selected = 0;
end_menu(en_win, (char *) 0); end_menu(g.en_win, (char *) 0);
if (select_menu(en_win, PICK_NONE, &selected) > 0) if (select_menu(g.en_win, PICK_NONE, &selected) > 0)
free((genericptr_t) selected); free((genericptr_t) selected);
en_via_menu = FALSE; g.en_via_menu = FALSE;
} }
destroy_nhwindow(en_win); destroy_nhwindow(g.en_win);
en_win = WIN_ERR; g.en_win = WIN_ERR;
} }
/*ARGSUSED*/ /*ARGSUSED*/
@@ -3108,8 +3096,8 @@ int final;
int ngenocided; int ngenocided;
/* Create the conduct window */ /* Create the conduct window */
en_win = create_nhwindow(NHW_MENU); g.en_win = create_nhwindow(NHW_MENU);
putstr(en_win, 0, "Voluntary challenges:"); putstr(g.en_win, 0, "Voluntary challenges:");
if (u.uroleplay.blind) if (u.uroleplay.blind)
you_have_been("blind from birth"); you_have_been("blind from birth");
@@ -3203,9 +3191,9 @@ int final;
} }
/* Pop up the window and wait for a key */ /* Pop up the window and wait for a key */
display_nhwindow(en_win, TRUE); display_nhwindow(g.en_win, TRUE);
destroy_nhwindow(en_win); destroy_nhwindow(g.en_win);
en_win = WIN_ERR; g.en_win = WIN_ERR;
} }
/* ordered by command name */ /* ordered by command name */
@@ -4499,9 +4487,9 @@ register char *cmd;
context.move = FALSE; context.move = FALSE;
return; return;
} }
if (*cmd == DOAGAIN && !in_doagain && saveq[0]) { if (*cmd == DOAGAIN && !in_doagain && g.saveq[0]) {
in_doagain = TRUE; in_doagain = TRUE;
stail = 0; g.stail = 0;
rhack((char *) 0); /* read and execute command */ rhack((char *) 0); /* read and execute command */
in_doagain = FALSE; in_doagain = FALSE;
return; return;
@@ -4582,7 +4570,7 @@ register char *cmd;
case NHKF_CLICKLOOK: case NHKF_CLICKLOOK:
if (iflags.clicklook) { if (iflags.clicklook) {
context.move = FALSE; context.move = FALSE;
do_look(2, &clicklook_cc); do_look(2, &g.clicklook_cc);
} }
return; return;
case NHKF_TRAVEL: case NHKF_TRAVEL:
@@ -5347,8 +5335,8 @@ int x, y, mod;
cmd[1] = 0; cmd[1] = 0;
if (iflags.clicklook && mod == CLICK_2) { if (iflags.clicklook && mod == CLICK_2) {
clicklook_cc.x = x; g.clicklook_cc.x = x;
clicklook_cc.y = y; g.clicklook_cc.y = y;
cmd[0] = g.Cmd.spkeys[NHKF_CLICKLOOK]; cmd[0] = g.Cmd.spkeys[NHKF_CLICKLOOK];
return cmd; return cmd;
} }
+17 -27
View File
@@ -282,16 +282,6 @@ boolean flag;
return TRUE; return TRUE;
} }
struct entity {
struct monst *emon; /* youmonst for the player */
struct permonst *edata; /* must be non-zero for record to be valid */
int ex, ey;
};
#define ENTITIES 2
static NEARDATA struct entity occupants[ENTITIES];
STATIC_OVL STATIC_OVL
struct entity * struct entity *
e_at(x, y) e_at(x, y)
@@ -300,15 +290,15 @@ int x, y;
int entitycnt; int entitycnt;
for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++) for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++)
if ((occupants[entitycnt].edata) && (occupants[entitycnt].ex == x) if ((g.occupants[entitycnt].edata) && (g.occupants[entitycnt].ex == x)
&& (occupants[entitycnt].ey == y)) && (g.occupants[entitycnt].ey == y))
break; break;
debugpline1("entitycnt = %d", entitycnt); debugpline1("entitycnt = %d", entitycnt);
#ifdef D_DEBUG #ifdef D_DEBUG
wait_synch(); wait_synch();
#endif #endif
return (entitycnt == ENTITIES) ? (struct entity *) 0 return (entitycnt == ENTITIES) ? (struct entity *) 0
: &(occupants[entitycnt]); : &(g.occupants[entitycnt]);
} }
STATIC_OVL void STATIC_OVL void
@@ -471,9 +461,9 @@ int xkill_flags, how;
/* dead long worm handling */ /* dead long worm handling */
for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++) { for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++) {
if (etmp != &(occupants[entitycnt]) if (etmp != &(g.occupants[entitycnt])
&& etmp->emon == occupants[entitycnt].emon) && etmp->emon == g.occupants[entitycnt].emon)
occupants[entitycnt].edata = (struct permonst *) 0; g.occupants[entitycnt].edata = (struct permonst *) 0;
} }
#undef mk_message #undef mk_message
#undef mk_corpse #undef mk_corpse
@@ -801,11 +791,11 @@ int x, y;
break; break;
} }
lev2->wall_info = W_NONDIGGABLE; lev2->wall_info = W_NONDIGGABLE;
set_entity(x, y, &(occupants[0])); set_entity(x, y, &(g.occupants[0]));
set_entity(x2, y2, &(occupants[1])); set_entity(x2, y2, &(g.occupants[1]));
do_entity(&(occupants[0])); /* Do set_entity after first */ do_entity(&(g.occupants[0])); /* Do set_entity after first */
set_entity(x2, y2, &(occupants[1])); /* do_entity for worm tail */ set_entity(x2, y2, &(g.occupants[1])); /* do_entity for worm tail */
do_entity(&(occupants[1])); do_entity(&(g.occupants[1]));
if (OBJ_AT(x, y) && !Deaf) if (OBJ_AT(x, y) && !Deaf)
You_hear("smashing and crushing."); You_hear("smashing and crushing.");
(void) revive_nasty(x, y, (char *) 0); (void) revive_nasty(x, y, (char *) 0);
@@ -850,11 +840,11 @@ int x, y;
lev2 = &levl[x2][y2]; lev2 = &levl[x2][y2];
lev2->typ = DOOR; lev2->typ = DOOR;
lev2->doormask = D_NODOOR; lev2->doormask = D_NODOOR;
set_entity(x, y, &(occupants[0])); set_entity(x, y, &(g.occupants[0]));
set_entity(x2, y2, &(occupants[1])); set_entity(x2, y2, &(g.occupants[1]));
do_entity(&(occupants[0])); /* do set_entity after first */ do_entity(&(g.occupants[0])); /* do set_entity after first */
set_entity(x2, y2, &(occupants[1])); /* do_entity for worm tails */ set_entity(x2, y2, &(g.occupants[1])); /* do_entity for worm tails */
do_entity(&(occupants[1])); do_entity(&(g.occupants[1]));
(void) revive_nasty(x, y, (char *) 0); (void) revive_nasty(x, y, (char *) 0);
delallobj(x, y); delallobj(x, y);
if ((t = t_at(x, y)) != 0) if ((t = t_at(x, y)) != 0)
@@ -883,7 +873,7 @@ int x, y;
struct obj *otmp; struct obj *otmp;
int x2, y2, i; int x2, y2, i;
boolean e_inview; boolean e_inview;
struct entity *etmp1 = &(occupants[0]), *etmp2 = &(occupants[1]); struct entity *etmp1 = &(g.occupants[0]), *etmp2 = &(g.occupants[1]);
lev1 = &levl[x][y]; lev1 = &levl[x][y];
if (!IS_DRAWBRIDGE(lev1->typ)) if (!IS_DRAWBRIDGE(lev1->typ))
+110 -2
View File
@@ -337,13 +337,109 @@ const struct instance_globals g_init = {
/* cmd.c */ /* cmd.c */
UNDEFINED_VALUES, /* Cmd */ UNDEFINED_VALUES, /* Cmd */
UNDEFINED_VALUES, /* pushq */
UNDEFINED_VALUES, /* saveq */
UNDEFINED_VALUE, /* phead */
UNDEFINED_VALUE, /* ptail */
UNDEFINED_VALUE, /* shead */
UNDEFINED_VALUE, /* stail */
UNDEFINED_VALUES, /* clicklook_cc */
WIN_ERR, /* en_win */
FALSE, /* en_via_menu */
/* dbridge.c */
UNDEFINED_VALUES,
/* dig.c */
UNDEFINED_VALUE, /* did_dig_msg */
/* do.c */
FALSE, /* at_ladder */
NULL, /* dfr_pre_msg */
NULL, /* dfr_post_msg */
{ 0, 0 }, /* save_dlevel */
/* do_name.c */
NULL, /* gloc_filter_map */
UNDEFINED_VALUE, /* gloc_filter_floodfill_match_glyph */
0, /* via_naming */
/* dog.c */ /* dog.c */
0, /* petname_used */ 0, /* petname_used */
UNDEFINED_VALUE, /* gtyp */
UNDEFINED_VALUE, /* gx */
UNDEFINED_VALUE, /* gy */
/* dokick.c */
UNDEFINED_PTR, /* maploc */
UNDEFINED_VALUES, /* nowhere */
UNDEFINED_PTR, /* gate_str */
/* drawing.c */
DUMMY, /* symset */
0, /* currentgraphics */
DUMMY, /* showsyms */
DUMMY, /* l_syms */
DUMMY, /* r_syms */
DUMMY, /* warnsyms */
/* dungeon.c */
UNDEFINED_VALUE, /* n_dgns */
NULL, /* branches */
NULL, /* mapseenchn */
/* eat.c */
FALSE, /* force_save_hs */
/* end.c */
UNDEFINED_VALUES,
UNDEFINED_VALUES,
UNDEFINED_VALUES,
/* hack.c */
UNDEFINED_VALUES,
UNDEFINED_VALUE,
/* invent.c */
51, /* lastinvr */
0, /* sortloogmode */
NULL, /* invbuf */
0, /* inbufsize */
/* lock.c */
UNDEFINED_VALUES,
/* makemon.c */ /* makemon.c */
{ -1, /* choice_count */ { -1, /* choice_count */
{ 0 } }, /* mchoices */ { 0 } }, /* mchoices */
/* mhitm.c */
UNDEFINED_VALUE, /* vis */
UNDEFINED_VALUE, /* far_noise */
UNDEFINED_VALUE, /* noisetime */
UNDEFINED_PTR, /* otmp */
UNDEFINED_VALUE, /* dieroll */
/* mhitu.c */
UNDEFINED_VALUE, /* mhitu_dieroll */
/* mklev.c */
UNDEFINED_VALUE, /* vault_x */
UNDEFINED_VALUE, /* vault_y */
UNDEFINED_VALUE, /* made_branch */
/* mkmap.c */
UNDEFINED_PTR, /* new_locations */
UNDEFINED_VALUE, /* min_rx */
UNDEFINED_VALUE, /* max_rx */
UNDEFINED_VALUE, /* min_ry */
UNDEFINED_VALUE, /* max_ry */
UNDEFINED_VALUE, /* n_loc_filled */
/* mkmaze.c */
{ {COLNO, ROWNO, 0, 0}, {COLNO, ROWNO, 0, 0} }, /* bughack */
UNDEFINED_VALUE, /* was_waterlevel */
/* mused.c */ /* mused.c */
FALSE, /* m_using */ FALSE, /* m_using */
@@ -406,6 +502,11 @@ const struct instance_globals g_init = {
0, /* ustuck_id */ 0, /* ustuck_id */
0, /* usteed_id */ 0, /* usteed_id */
/* sp_lev.c */
NULL, /* lev_message */
NULL, /* lregions */
0, /* num_lregions */
/* trap.c */ /* trap.c */
0, /* force_mintrap */ 0, /* force_mintrap */
@@ -435,6 +536,13 @@ decl_globals_init()
{ {
g = g_init; g = g_init;
g.valuables[0].list = g.gems;
g.valuables[0].size = SIZE(g.gems);
g.valuables[1].list = g.amulets;
g.valuables[1].size = SIZE(g.amulets);
g.valuables[2].list = NULL;
g.valuables[2].size = 0;
nhassert(g_init.magic == IVMAGIC); nhassert(g_init.magic == IVMAGIC);
nhassert(g_init.havestate == TRUE); nhassert(g_init.havestate == TRUE);
+5 -5
View File
@@ -482,9 +482,9 @@ dig(VOID_ARGS)
|| (dig_target == DIGTYP_ROCK && !IS_ROCK(lev->typ))) || (dig_target == DIGTYP_ROCK && !IS_ROCK(lev->typ)))
return 0; /* statue or boulder got taken */ return 0; /* statue or boulder got taken */
if (!did_dig_msg) { if (!g.did_dig_msg) {
You("hit the %s with all your might.", d_target[dig_target]); You("hit the %s with all your might.", d_target[dig_target]);
did_dig_msg = TRUE; g.did_dig_msg = TRUE;
} }
} }
return 1; return 1;
@@ -1116,7 +1116,7 @@ struct obj *obj;
"chopping at the door", "chopping at the door",
"cutting the tree" }; "cutting the tree" };
did_dig_msg = FALSE; g.did_dig_msg = FALSE;
context.digging.quiet = FALSE; context.digging.quiet = FALSE;
if (context.digging.pos.x != rx || context.digging.pos.y != ry if (context.digging.pos.x != rx || context.digging.pos.y != ry
|| !on_level(&context.digging.level, &u.uz) || !on_level(&context.digging.level, &u.uz)
@@ -1128,7 +1128,7 @@ struct obj *obj;
&& (moves <= context.digging.lastdigtime + 2 && (moves <= context.digging.lastdigtime + 2
&& moves >= context.digging.lastdigtime)) { && moves >= context.digging.lastdigtime)) {
/* avoid messages if repeated autodigging */ /* avoid messages if repeated autodigging */
did_dig_msg = TRUE; g.did_dig_msg = TRUE;
context.digging.quiet = TRUE; context.digging.quiet = TRUE;
} }
context.digging.down = context.digging.chew = FALSE; context.digging.down = context.digging.chew = FALSE;
@@ -1185,7 +1185,7 @@ struct obj *obj;
shopdig(0); shopdig(0);
} else } else
You("continue %s downward.", verbing); You("continue %s downward.", verbing);
did_dig_msg = FALSE; g.did_dig_msg = FALSE;
set_occupation(dig, verbing, 0); set_occupation(dig, verbing, 0);
} }
return 1; return 1;
+24 -34
View File
@@ -19,8 +19,6 @@ STATIC_DCL int NDECL(currentlevel_rewrite);
STATIC_DCL void NDECL(final_level); STATIC_DCL void NDECL(final_level);
/* static boolean FDECL(badspot, (XCHAR_P,XCHAR_P)); */ /* static boolean FDECL(badspot, (XCHAR_P,XCHAR_P)); */
extern int n_dgns; /* number of dungeons, from dungeon.c */
static NEARDATA const char drop_types[] = { ALLOW_COUNT, COIN_CLASS, static NEARDATA const char drop_types[] = { ALLOW_COUNT, COIN_CLASS,
ALL_CLASSES, 0 }; ALL_CLASSES, 0 };
@@ -891,9 +889,6 @@ drop_done:
return n_dropped; return n_dropped;
} }
/* on a ladder, used in goto_level */
static NEARDATA boolean at_ladder = FALSE;
/* the '>' command */ /* the '>' command */
int int
dodown() dodown()
@@ -1024,9 +1019,9 @@ dodown()
if (trap && Is_stronghold(&u.uz)) { if (trap && Is_stronghold(&u.uz)) {
goto_hell(FALSE, TRUE); goto_hell(FALSE, TRUE);
} else { } else {
at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER); g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
next_level(!trap); next_level(!trap);
at_ladder = FALSE; g.at_ladder = FALSE;
} }
return 1; return 1;
} }
@@ -1077,14 +1072,12 @@ doup()
You("are held back by your pet!"); You("are held back by your pet!");
return 0; return 0;
} }
at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER); g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
prev_level(TRUE); prev_level(TRUE);
at_ladder = FALSE; g.at_ladder = FALSE;
return 1; return 1;
} }
d_level save_dlevel = { 0, 0 };
/* check that we can write out the current level */ /* check that we can write out the current level */
STATIC_OVL int STATIC_OVL int
currentlevel_rewrite() currentlevel_rewrite()
@@ -1221,7 +1214,7 @@ boolean at_stairs, falling, portal;
(void) next_to_u(); (void) next_to_u();
return; return;
} else } else
at_stairs = at_ladder = FALSE; at_stairs = g.at_ladder = FALSE;
} }
} }
@@ -1297,7 +1290,7 @@ boolean at_stairs, falling, portal;
for (l_idx = maxledgerno(); l_idx > 0; --l_idx) for (l_idx = maxledgerno(); l_idx > 0; --l_idx)
delete_levelfile(l_idx); delete_levelfile(l_idx);
/* mark #overview data for all dungeon branches as uninteresting */ /* mark #overview data for all dungeon branches as uninteresting */
for (l_idx = 0; l_idx < n_dgns; ++l_idx) for (l_idx = 0; l_idx < g.n_dgns; ++l_idx)
remdun_mapseen(l_idx); remdun_mapseen(l_idx);
} }
@@ -1371,7 +1364,7 @@ boolean at_stairs, falling, portal;
u_on_newpos(ttrap->tx, ttrap->ty); u_on_newpos(ttrap->tx, ttrap->ty);
} else if (at_stairs && !In_endgame(&u.uz)) { } else if (at_stairs && !In_endgame(&u.uz)) {
if (up) { if (up) {
if (at_ladder) if (g.at_ladder)
u_on_newpos(xdnladder, ydnladder); u_on_newpos(xdnladder, ydnladder);
else if (newdungeon) else if (newdungeon)
u_on_sstairs(1); u_on_sstairs(1);
@@ -1384,10 +1377,10 @@ boolean at_stairs, falling, portal;
pline("%s %s up%s the %s.", pline("%s %s up%s the %s.",
great_effort ? "With great effort, you" : "You", great_effort ? "With great effort, you" : "You",
Levitation ? "float" : Flying ? "fly" : "climb", Levitation ? "float" : Flying ? "fly" : "climb",
(Flying && at_ladder) ? " along" : "", (Flying && g.at_ladder) ? " along" : "",
at_ladder ? "ladder" : "stairs"); g.at_ladder ? "ladder" : "stairs");
} else { /* down */ } else { /* down */
if (at_ladder) if (g.at_ladder)
u_on_newpos(xupladder, yupladder); u_on_newpos(xupladder, yupladder);
else if (newdungeon) else if (newdungeon)
u_on_sstairs(0); u_on_sstairs(0);
@@ -1398,10 +1391,10 @@ boolean at_stairs, falling, portal;
} else if (Flying) { } else if (Flying) {
if (flags.verbose) if (flags.verbose)
You("fly down %s.", You("fly down %s.",
at_ladder ? "along the ladder" : "the stairs"); g.at_ladder ? "along the ladder" : "the stairs");
} else if (near_capacity() > UNENCUMBERED } else if (near_capacity() > UNENCUMBERED
|| Punished || Fumbling) { || Punished || Fumbling) {
You("fall down the %s.", at_ladder ? "ladder" : "stairs"); You("fall down the %s.", g.at_ladder ? "ladder" : "stairs");
if (Punished) { if (Punished) {
drag_down(); drag_down();
ballrelease(FALSE); ballrelease(FALSE);
@@ -1411,13 +1404,13 @@ boolean at_stairs, falling, portal;
dismount_steed(DISMOUNT_FELL); dismount_steed(DISMOUNT_FELL);
else else
losehp(Maybe_Half_Phys(rnd(3)), losehp(Maybe_Half_Phys(rnd(3)),
at_ladder ? "falling off a ladder" g.at_ladder ? "falling off a ladder"
: "tumbling down a flight of stairs", : "tumbling down a flight of stairs",
KILLED_BY); KILLED_BY);
selftouch("Falling, you"); selftouch("Falling, you");
} else { /* ordinary descent */ } else { /* ordinary descent */
if (flags.verbose) if (flags.verbose)
You("%s.", at_ladder ? "climb down the ladder" You("%s.", g.at_ladder ? "climb down the ladder"
: "descend the stairs"); : "descend the stairs");
} }
} }
@@ -1615,9 +1608,6 @@ final_level()
gain_guardian_angel(); gain_guardian_angel();
} }
static char *dfr_pre_msg = 0, /* pline() before level change */
*dfr_post_msg = 0; /* pline() after level change */
/* change levels at the end of this turn, after monsters finish moving */ /* change levels at the end of this turn, after monsters finish moving */
void void
schedule_goto(tolev, at_stairs, falling, portal_flag, pre_msg, post_msg) schedule_goto(tolev, at_stairs, falling, portal_flag, pre_msg, post_msg)
@@ -1642,9 +1632,9 @@ const char *pre_msg, *post_msg;
assign_level(&u.utolev, tolev); assign_level(&u.utolev, tolev);
if (pre_msg) if (pre_msg)
dfr_pre_msg = dupstr(pre_msg); g.dfr_pre_msg = dupstr(pre_msg);
if (post_msg) if (post_msg)
dfr_post_msg = dupstr(post_msg); g.dfr_post_msg = dupstr(post_msg);
} }
/* handle something like portal ejection */ /* handle something like portal ejection */
@@ -1656,8 +1646,8 @@ deferred_goto()
int typmask = u.utotype; /* save it; goto_level zeroes u.utotype */ int typmask = u.utotype; /* save it; goto_level zeroes u.utotype */
assign_level(&dest, &u.utolev); assign_level(&dest, &u.utolev);
if (dfr_pre_msg) if (g.dfr_pre_msg)
pline1(dfr_pre_msg); pline1(g.dfr_pre_msg);
goto_level(&dest, !!(typmask & 1), !!(typmask & 2), !!(typmask & 4)); goto_level(&dest, !!(typmask & 1), !!(typmask & 2), !!(typmask & 4));
if (typmask & 0200) { /* remove portal */ if (typmask & 0200) { /* remove portal */
struct trap *t = t_at(u.ux, u.uy); struct trap *t = t_at(u.ux, u.uy);
@@ -1667,14 +1657,14 @@ deferred_goto()
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
} }
} }
if (dfr_post_msg) if (g.dfr_post_msg)
pline1(dfr_post_msg); pline1(g.dfr_post_msg);
} }
u.utotype = 0; /* our caller keys off of this */ u.utotype = 0; /* our caller keys off of this */
if (dfr_pre_msg) if (g.dfr_pre_msg)
free((genericptr_t) dfr_pre_msg), dfr_pre_msg = 0; free((genericptr_t) g.dfr_pre_msg), g.dfr_pre_msg = 0;
if (dfr_post_msg) if (g.dfr_post_msg)
free((genericptr_t) dfr_post_msg), dfr_post_msg = 0; free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0;
} }
/* /*
+15 -20
View File
@@ -244,13 +244,9 @@ const void *b;
&& glyph_to_cmap(levl[(x)][(y)].glyph) == S_stone \ && glyph_to_cmap(levl[(x)][(y)].glyph) == S_stone \
&& !levl[(x)][(y)].seenv) && !levl[(x)][(y)].seenv)
static struct opvar *gloc_filter_map = (struct opvar *) 0;
#define GLOC_SAME_AREA(x,y) \ #define GLOC_SAME_AREA(x,y) \
(isok((x), (y)) \ (isok((x), (y)) \
&& (selection_getpoint((x),(y), gloc_filter_map))) && (selection_getpoint((x),(y), g.gloc_filter_map)))
static int gloc_filter_floodfill_match_glyph;
int int
gloc_filter_classify_glyph(glyph) gloc_filter_classify_glyph(glyph)
@@ -285,11 +281,11 @@ int x, y;
if (!levl[x][y].seenv) if (!levl[x][y].seenv)
return FALSE; return FALSE;
if (glyph == gloc_filter_floodfill_match_glyph) if (glyph == g.gloc_filter_floodfill_match_glyph)
return TRUE; return TRUE;
if (gloc_filter_classify_glyph(glyph) if (gloc_filter_classify_glyph(glyph)
== gloc_filter_classify_glyph(gloc_filter_floodfill_match_glyph)) == gloc_filter_classify_glyph(g.gloc_filter_floodfill_match_glyph))
return TRUE; return TRUE;
return FALSE; return FALSE;
@@ -299,18 +295,18 @@ void
gloc_filter_floodfill(x, y) gloc_filter_floodfill(x, y)
int x, y; int x, y;
{ {
gloc_filter_floodfill_match_glyph = back_to_glyph(x, y); g.gloc_filter_floodfill_match_glyph = back_to_glyph(x, y);
set_selection_floodfillchk(gloc_filter_floodfill_matcharea); set_selection_floodfillchk(gloc_filter_floodfill_matcharea);
selection_floodfill(gloc_filter_map, x, y, FALSE); selection_floodfill(g.gloc_filter_map, x, y, FALSE);
} }
void void
gloc_filter_init() gloc_filter_init()
{ {
if (iflags.getloc_filter == GFILTER_AREA) { if (iflags.getloc_filter == GFILTER_AREA) {
if (!gloc_filter_map) { if (!g.gloc_filter_map) {
gloc_filter_map = selection_opvar((char *) 0); g.gloc_filter_map = selection_opvar((char *) 0);
} }
/* special case: if we're in a doorway, try to figure out which /* special case: if we're in a doorway, try to figure out which
direction we're moving, and use that side of the doorway */ direction we're moving, and use that side of the doorway */
@@ -329,9 +325,10 @@ gloc_filter_init()
void void
gloc_filter_done() gloc_filter_done()
{ {
if (gloc_filter_map) { if (g.gloc_filter_map) {
opvar_free_x(gloc_filter_map); opvar_free_x(g.gloc_filter_map);
gloc_filter_map = (struct opvar *) 0; g.gloc_filter_map = (struct opvar *) 0;
} }
} }
@@ -885,7 +882,7 @@ const char *goal;
|| glyph_to_cmap(k) == S_corr || glyph_to_cmap(k) == S_corr
|| glyph_to_cmap(k) == S_litcorr) || glyph_to_cmap(k) == S_litcorr)
continue; continue;
if (c == defsyms[sidx].sym || c == (int) showsyms[sidx]) if (c == defsyms[sidx].sym || c == (int) g.showsyms[sidx])
matching[sidx] = (char) ++k; matching[sidx] = (char) ++k;
} }
if (k) { if (k) {
@@ -1184,8 +1181,6 @@ do_mname()
(void) christen_monst(mtmp, buf); (void) christen_monst(mtmp, buf);
} }
STATIC_VAR int via_naming = 0;
/* /*
* This routine used to change the address of 'obj' so be unsafe if not * This routine used to change the address of 'obj' so be unsafe if not
* used with extreme care. Applying a name to an object no longer * used with extreme care. Applying a name to an object no longer
@@ -1257,9 +1252,9 @@ register struct obj *obj;
a valid artifact name */ a valid artifact name */
u.uconduct.literate++; u.uconduct.literate++;
} }
++via_naming; /* This ought to be an argument rather than a static... */ ++g.via_naming; /* This ought to be an argument rather than a static... */
obj = oname(obj, buf); obj = oname(obj, buf);
--via_naming; /* ...but oname() is used in a lot of places, so defer. */ --g.via_naming; /* ...but oname() is used in a lot of places, so defer. */
} }
struct obj * struct obj *
@@ -1299,7 +1294,7 @@ const char *name;
/* if obj is owned by a shop, increase your bill */ /* if obj is owned by a shop, increase your bill */
if (obj->unpaid) if (obj->unpaid)
alter_cost(obj, 0L); alter_cost(obj, 0L);
if (via_naming) { if (g.via_naming) {
/* violate illiteracy conduct since successfully wrote arti-name */ /* violate illiteracy conduct since successfully wrote arti-name */
u.uconduct.literate++; u.uconduct.literate++;
} }
+33 -34
View File
@@ -120,7 +120,6 @@ struct monst *mon;
static NEARDATA const char nofetch[] = { BALL_CLASS, CHAIN_CLASS, ROCK_CLASS, static NEARDATA const char nofetch[] = { BALL_CLASS, CHAIN_CLASS, ROCK_CLASS,
0 }; 0 };
STATIC_VAR xchar gtyp, gx, gy; /* type and position of dog's current goal */
STATIC_PTR void FDECL(wantdoor, (int, int, genericptr_t)); STATIC_PTR void FDECL(wantdoor, (int, int, genericptr_t));
@@ -492,17 +491,17 @@ int after, udist, whappr;
dog_has_minvent = (droppables(mtmp) != 0); dog_has_minvent = (droppables(mtmp) != 0);
if (!edog || mtmp->mleashed) { /* he's not going anywhere... */ if (!edog || mtmp->mleashed) { /* he's not going anywhere... */
gtyp = APPORT; g.gtyp = APPORT;
gx = u.ux; g.gx = u.ux;
gy = u.uy; g.gy = u.uy;
} else { } else {
#define DDIST(x, y) (dist2(x, y, omx, omy)) #define DDIST(x, y) (dist2(x, y, omx, omy))
#define SQSRCHRADIUS 5 #define SQSRCHRADIUS 5
int min_x, max_x, min_y, max_y; int min_x, max_x, min_y, max_y;
register int nx, ny; register int nx, ny;
gtyp = UNDEF; /* no goal as yet */ g.gtyp = UNDEF; /* no goal as yet */
gx = gy = 0; /* suppress 'used before set' message */ g.gx = g.gy = 0; /* suppress 'used before set' message */
if ((min_x = omx - SQSRCHRADIUS) < 1) if ((min_x = omx - SQSRCHRADIUS) < 1)
min_x = 1; min_x = 1;
@@ -520,7 +519,7 @@ int after, udist, whappr;
if (nx >= min_x && nx <= max_x && ny >= min_y && ny <= max_y) { if (nx >= min_x && nx <= max_x && ny >= min_y && ny <= max_y) {
otyp = dogfood(mtmp, obj); otyp = dogfood(mtmp, obj);
/* skip inferior goals */ /* skip inferior goals */
if (otyp > gtyp || otyp == UNDEF) if (otyp > g.gtyp || otyp == UNDEF)
continue; continue;
/* avoid cursed items unless starving */ /* avoid cursed items unless starving */
if (cursed_object_at(nx, ny) if (cursed_object_at(nx, ny)
@@ -531,31 +530,31 @@ int after, udist, whappr;
|| !can_reach_location(mtmp, mtmp->mx, mtmp->my, nx, ny)) || !can_reach_location(mtmp, mtmp->mx, mtmp->my, nx, ny))
continue; continue;
if (otyp < MANFOOD) { if (otyp < MANFOOD) {
if (otyp < gtyp || DDIST(nx, ny) < DDIST(gx, gy)) { if (otyp < g.gtyp || DDIST(nx, ny) < DDIST(g.gx, g.gy)) {
gx = nx; g.gx = nx;
gy = ny; g.gy = ny;
gtyp = otyp; g.gtyp = otyp;
} }
} else if (gtyp == UNDEF && in_masters_sight } else if (g.gtyp == UNDEF && in_masters_sight
&& !dog_has_minvent && !dog_has_minvent
&& (!levl[omx][omy].lit || levl[u.ux][u.uy].lit) && (!levl[omx][omy].lit || levl[u.ux][u.uy].lit)
&& (otyp == MANFOOD || m_cansee(mtmp, nx, ny)) && (otyp == MANFOOD || m_cansee(mtmp, nx, ny))
&& edog->apport > rn2(8) && edog->apport > rn2(8)
&& can_carry(mtmp, obj) > 0) { && can_carry(mtmp, obj) > 0) {
gx = nx; g.gx = nx;
gy = ny; g.gy = ny;
gtyp = APPORT; g.gtyp = APPORT;
} }
} }
} }
} }
/* follow player if appropriate */ /* follow player if appropriate */
if (gtyp == UNDEF || (gtyp != DOGFOOD && gtyp != APPORT if (g.gtyp == UNDEF || (g.gtyp != DOGFOOD && g.gtyp != APPORT
&& monstermoves < edog->hungrytime)) { && monstermoves < edog->hungrytime)) {
gx = u.ux; g.gx = u.ux;
gy = u.uy; g.gy = u.uy;
if (after && udist <= 4 && gx == u.ux && gy == u.uy) if (after && udist <= 4 && g.gx == u.ux && g.gy == u.uy)
return -2; return -2;
appr = (udist >= 9) ? 1 : (mtmp->mflee) ? -1 : 0; appr = (udist >= 9) ? 1 : (mtmp->mflee) ? -1 : 0;
if (udist > 1) { if (udist > 1) {
@@ -576,34 +575,34 @@ int after, udist, whappr;
appr = 0; appr = 0;
#define FARAWAY (COLNO + 2) /* position outside screen */ #define FARAWAY (COLNO + 2) /* position outside screen */
if (gx == u.ux && gy == u.uy && !in_masters_sight) { if (g.gx == u.ux && g.gy == u.uy && !in_masters_sight) {
register coord *cp; register coord *cp;
cp = gettrack(omx, omy); cp = gettrack(omx, omy);
if (cp) { if (cp) {
gx = cp->x; g.gx = cp->x;
gy = cp->y; g.gy = cp->y;
if (edog) if (edog)
edog->ogoal.x = 0; edog->ogoal.x = 0;
} else { } else {
/* assume master hasn't moved far, and reuse previous goal */ /* assume master hasn't moved far, and reuse previous goal */
if (edog && edog->ogoal.x if (edog && edog->ogoal.x
&& (edog->ogoal.x != omx || edog->ogoal.y != omy)) { && (edog->ogoal.x != omx || edog->ogoal.y != omy)) {
gx = edog->ogoal.x; g.gx = edog->ogoal.x;
gy = edog->ogoal.y; g.gy = edog->ogoal.y;
edog->ogoal.x = 0; edog->ogoal.x = 0;
} else { } else {
int fardist = FARAWAY * FARAWAY; int fardist = FARAWAY * FARAWAY;
gx = gy = FARAWAY; /* random */ g.gx = g.gy = FARAWAY; /* random */
do_clear_area(omx, omy, 9, wantdoor, (genericptr_t) &fardist); do_clear_area(omx, omy, 9, wantdoor, (genericptr_t) &fardist);
/* here gx == FARAWAY e.g. when dog is in a vault */ /* here gx == FARAWAY e.g. when dog is in a vault */
if (gx == FARAWAY || (gx == omx && gy == omy)) { if (g.gx == FARAWAY || (g.gx == omx && g.gy == omy)) {
gx = u.ux; g.gx = u.ux;
gy = u.uy; g.gy = u.uy;
} else if (edog) { } else if (edog) {
edog->ogoal.x = gx; edog->ogoal.x = g.gx;
edog->ogoal.y = gy; edog->ogoal.y = g.gy;
} }
} }
} }
@@ -878,7 +877,7 @@ int after; /* this is extra fast monster movement */
int chi = -1, nidist, ndist; int chi = -1, nidist, ndist;
coord poss[9]; coord poss[9];
long info[9], allowflags; long info[9], allowflags;
#define GDIST(x, y) (dist2(x, y, gx, gy)) #define GDIST(x, y) (dist2(x, y, g.gx, g.gy))
/* /*
* Tame Angels have isminion set and an ispriest structure instead of * Tame Angels have isminion set and an ispriest structure instead of
@@ -982,7 +981,7 @@ int after; /* this is extra fast monster movement */
uncursedcnt++; uncursedcnt++;
} }
better_with_displacing = should_displace(mtmp, poss, info, cnt, gx, gy); better_with_displacing = should_displace(mtmp, poss, info, cnt, g.gx, g.gy);
chcnt = 0; chcnt = 0;
chi = -1; chi = -1;
@@ -1329,8 +1328,8 @@ genericptr_t distance;
int ndist, *dist_ptr = (int *) distance; int ndist, *dist_ptr = (int *) distance;
if (*dist_ptr > (ndist = distu(x, y))) { if (*dist_ptr > (ndist = distu(x, y))) {
gx = x; g.gx = x;
gy = y; g.gy = y;
*dist_ptr = ndist; *dist_ptr = ndist;
} }
} }
+71 -74
View File
@@ -9,9 +9,6 @@
(martial_bonus() || is_bigfoot(youmonst.data) \ (martial_bonus() || is_bigfoot(youmonst.data) \
|| (uarmf && uarmf->otyp == KICKING_BOOTS)) || (uarmf && uarmf->otyp == KICKING_BOOTS))
static NEARDATA struct rm *maploc, nowhere;
static NEARDATA const char *gate_str;
/* kickedobj (decl.c) tracks a kicked object until placed or destroyed */ /* 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));
@@ -718,33 +715,33 @@ const char *kickobjnam;
if (*kickobjnam) if (*kickobjnam)
what = kickobjnam; what = kickobjnam;
else if (maploc == &nowhere) else if (g.maploc == &g.nowhere)
what = "nothing"; what = "nothing";
else if (IS_DOOR(maploc->typ)) else if (IS_DOOR(g.maploc->typ))
what = "a door"; what = "a door";
else if (IS_TREE(maploc->typ)) else if (IS_TREE(g.maploc->typ))
what = "a tree"; what = "a tree";
else if (IS_STWALL(maploc->typ)) else if (IS_STWALL(g.maploc->typ))
what = "a wall"; what = "a wall";
else if (IS_ROCK(maploc->typ)) else if (IS_ROCK(g.maploc->typ))
what = "a rock"; what = "a rock";
else if (IS_THRONE(maploc->typ)) else if (IS_THRONE(g.maploc->typ))
what = "a throne"; what = "a throne";
else if (IS_FOUNTAIN(maploc->typ)) else if (IS_FOUNTAIN(g.maploc->typ))
what = "a fountain"; what = "a fountain";
else if (IS_GRAVE(maploc->typ)) else if (IS_GRAVE(g.maploc->typ))
what = "a headstone"; what = "a headstone";
else if (IS_SINK(maploc->typ)) else if (IS_SINK(g.maploc->typ))
what = "a sink"; what = "a sink";
else if (IS_ALTAR(maploc->typ)) else if (IS_ALTAR(g.maploc->typ))
what = "an altar"; what = "an altar";
else if (IS_DRAWBRIDGE(maploc->typ)) else if (IS_DRAWBRIDGE(g.maploc->typ))
what = "a drawbridge"; what = "a drawbridge";
else if (maploc->typ == STAIRS) else if (g.maploc->typ == STAIRS)
what = "the stairs"; what = "the stairs";
else if (maploc->typ == LADDER) else if (g.maploc->typ == LADDER)
what = "a ladder"; what = "a ladder";
else if (maploc->typ == IRONBARS) else if (g.maploc->typ == IRONBARS)
what = "an iron bar"; what = "an iron bar";
else else
what = "something weird"; what = "something weird";
@@ -887,10 +884,10 @@ dokick()
u_wipe_engr(2); u_wipe_engr(2);
if (!isok(x, y)) { if (!isok(x, y)) {
maploc = &nowhere; g.maploc = &g.nowhere;
goto ouch; goto ouch;
} }
maploc = &levl[x][y]; g.maploc = &levl[x][y];
/* /*
* The next five tests should stay in their present order: * The next five tests should stay in their present order:
@@ -959,49 +956,49 @@ dokick()
goto ouch; goto ouch;
} }
if (!IS_DOOR(maploc->typ)) { if (!IS_DOOR(g.maploc->typ)) {
if (maploc->typ == SDOOR) { if (g.maploc->typ == SDOOR) {
if (!Levitation && rn2(30) < avrg_attrib) { if (!Levitation && rn2(30) < avrg_attrib) {
cvt_sdoor_to_door(maploc); /* ->typ = DOOR */ cvt_sdoor_to_door(g.maploc); /* ->typ = DOOR */
pline("Crash! %s a secret door!", pline("Crash! %s a secret door!",
/* don't "kick open" when it's locked /* don't "kick open" when it's locked
unless it also happens to be trapped */ unless it also happens to be trapped */
(maploc->doormask & (D_LOCKED | D_TRAPPED)) == D_LOCKED (g.maploc->doormask & (D_LOCKED | D_TRAPPED)) == D_LOCKED
? "Your kick uncovers" ? "Your kick uncovers"
: "You kick open"); : "You kick open");
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
if (maploc->doormask & D_TRAPPED) { if (g.maploc->doormask & D_TRAPPED) {
maploc->doormask = D_NODOOR; g.maploc->doormask = D_NODOOR;
b_trapped("door", FOOT); b_trapped("door", FOOT);
} else if (maploc->doormask != D_NODOOR } else if (g.maploc->doormask != D_NODOOR
&& !(maploc->doormask & D_LOCKED)) && !(g.maploc->doormask & D_LOCKED))
maploc->doormask = D_ISOPEN; g.maploc->doormask = D_ISOPEN;
feel_newsym(x, y); /* we know it's gone */ feel_newsym(x, y); /* we know it's gone */
if (maploc->doormask == D_ISOPEN if (g.maploc->doormask == D_ISOPEN
|| maploc->doormask == D_NODOOR) || g.maploc->doormask == D_NODOOR)
unblock_point(x, y); /* vision */ unblock_point(x, y); /* vision */
return 1; return 1;
} else } else
goto ouch; goto ouch;
} }
if (maploc->typ == SCORR) { if (g.maploc->typ == SCORR) {
if (!Levitation && rn2(30) < avrg_attrib) { if (!Levitation && rn2(30) < avrg_attrib) {
pline("Crash! You kick open a secret passage!"); pline("Crash! You kick open a secret passage!");
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
maploc->typ = CORR; g.maploc->typ = CORR;
feel_newsym(x, y); /* we know it's gone */ feel_newsym(x, y); /* we know it's gone */
unblock_point(x, y); /* vision */ unblock_point(x, y); /* vision */
return 1; return 1;
} else } else
goto ouch; goto ouch;
} }
if (IS_THRONE(maploc->typ)) { if (IS_THRONE(g.maploc->typ)) {
register int i; register int i;
if (Levitation) if (Levitation)
goto dumb; goto dumb;
if ((Luck < 0 || maploc->doormask) && !rn2(3)) { if ((Luck < 0 || g.maploc->doormask) && !rn2(3)) {
maploc->typ = ROOM; g.maploc->typ = ROOM;
maploc->doormask = 0; /* don't leave loose ends.. */ g.maploc->doormask = 0; /* don't leave loose ends.. */
(void) mkgold((long) rnd(200), x, y); (void) mkgold((long) rnd(200), x, y);
if (Blind) if (Blind)
pline("CRASH! You destroy it."); pline("CRASH! You destroy it.");
@@ -1011,7 +1008,7 @@ dokick()
} }
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return 1; return 1;
} else if (Luck > 0 && !rn2(3) && !maploc->looted) { } else if (Luck > 0 && !rn2(3) && !g.maploc->looted) {
(void) mkgold((long) rn1(201, 300), x, y); (void) mkgold((long) rn1(201, 300), x, y);
i = Luck + 1; i = Luck + 1;
if (i > 6) if (i > 6)
@@ -1027,7 +1024,7 @@ dokick()
newsym(x, y); newsym(x, y);
} }
/* prevent endless milking */ /* prevent endless milking */
maploc->looted = T_LOOTED; g.maploc->looted = T_LOOTED;
return 1; return 1;
} else if (!rn2(4)) { } else if (!rn2(4)) {
if (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)) { if (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)) {
@@ -1038,7 +1035,7 @@ dokick()
} }
goto ouch; goto ouch;
} }
if (IS_ALTAR(maploc->typ)) { if (IS_ALTAR(g.maploc->typ)) {
if (Levitation) if (Levitation)
goto dumb; goto dumb;
You("kick %s.", (Blind ? something : "the altar")); You("kick %s.", (Blind ? something : "the altar"));
@@ -1048,7 +1045,7 @@ dokick()
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return 1; return 1;
} }
if (IS_FOUNTAIN(maploc->typ)) { if (IS_FOUNTAIN(g.maploc->typ)) {
if (Levitation) if (Levitation)
goto dumb; goto dumb;
You("kick %s.", (Blind ? something : "the fountain")); You("kick %s.", (Blind ? something : "the fountain"));
@@ -1063,7 +1060,7 @@ dokick()
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return 1; return 1;
} }
if (IS_GRAVE(maploc->typ)) { if (IS_GRAVE(g.maploc->typ)) {
if (Levitation) if (Levitation)
goto dumb; goto dumb;
if (rn2(4)) if (rn2(4))
@@ -1073,8 +1070,8 @@ dokick()
|| ((u.ualign.type == A_LAWFUL) && (u.ualign.record > -10))) { || ((u.ualign.type == A_LAWFUL) && (u.ualign.record > -10))) {
adjalign(-sgn(u.ualign.type)); adjalign(-sgn(u.ualign.type));
} }
maploc->typ = ROOM; g.maploc->typ = ROOM;
maploc->doormask = 0; g.maploc->doormask = 0;
(void) mksobj_at(ROCK, x, y, TRUE, FALSE); (void) mksobj_at(ROCK, x, y, TRUE, FALSE);
del_engr_at(x, y); del_engr_at(x, y);
if (Blind) if (Blind)
@@ -1085,9 +1082,9 @@ dokick()
} }
return 1; return 1;
} }
if (maploc->typ == IRONBARS) if (g.maploc->typ == IRONBARS)
goto ouch; goto ouch;
if (IS_TREE(maploc->typ)) { if (IS_TREE(g.maploc->typ)) {
struct obj *treefruit; struct obj *treefruit;
/* nothing, fruit or trouble? 75:23.5:1.5% */ /* nothing, fruit or trouble? 75:23.5:1.5% */
@@ -1096,7 +1093,7 @@ dokick()
You_hear("a low buzzing."); /* a warning */ You_hear("a low buzzing."); /* a warning */
goto ouch; goto ouch;
} }
if (rn2(15) && !(maploc->looted & TREE_LOOTED) if (rn2(15) && !(g.maploc->looted & TREE_LOOTED)
&& (treefruit = rnd_treefruit_at(x, y))) { && (treefruit = rnd_treefruit_at(x, y))) {
long nfruit = 8L - rnl(7), nfall; long nfruit = 8L - rnl(7), nfall;
short frtype = treefruit->otyp; short frtype = treefruit->otyp;
@@ -1120,9 +1117,9 @@ dokick()
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
exercise(A_WIS, TRUE); /* discovered a new food source! */ exercise(A_WIS, TRUE); /* discovered a new food source! */
newsym(x, y); newsym(x, y);
maploc->looted |= TREE_LOOTED; g.maploc->looted |= TREE_LOOTED;
return 1; return 1;
} else if (!(maploc->looted & TREE_SWARM)) { } else if (!(g.maploc->looted & TREE_SWARM)) {
int cnt = rnl(4) + 2; int cnt = rnl(4) + 2;
int made = 0; int made = 0;
coord mm; coord mm;
@@ -1139,12 +1136,12 @@ dokick()
pline("You've attracted the tree's former occupants!"); pline("You've attracted the tree's former occupants!");
else else
You("smell stale honey."); You("smell stale honey.");
maploc->looted |= TREE_SWARM; g.maploc->looted |= TREE_SWARM;
return 1; return 1;
} }
goto ouch; goto ouch;
} }
if (IS_SINK(maploc->typ)) { if (IS_SINK(g.maploc->typ)) {
int gend = poly_gender(); int gend = poly_gender();
short washerndx = (gend == 1 || (gend == 2 && rn2(2))) short washerndx = (gend == 1 || (gend == 2 && rn2(2)))
? PM_INCUBUS ? PM_INCUBUS
@@ -1159,7 +1156,7 @@ dokick()
pline("Klunk!"); pline("Klunk!");
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return 1; return 1;
} else if (!(maploc->looted & S_LPUDDING) && !rn2(3) } else if (!(g.maploc->looted & S_LPUDDING) && !rn2(3)
&& !(mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) { && !(mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) {
if (Blind) if (Blind)
You_hear("a gushing sound."); You_hear("a gushing sound.");
@@ -1169,37 +1166,37 @@ dokick()
(void) makemon(&mons[PM_BLACK_PUDDING], x, y, NO_MM_FLAGS); (void) makemon(&mons[PM_BLACK_PUDDING], x, y, NO_MM_FLAGS);
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
newsym(x, y); newsym(x, y);
maploc->looted |= S_LPUDDING; g.maploc->looted |= S_LPUDDING;
return 1; return 1;
} else if (!(maploc->looted & S_LDWASHER) && !rn2(3) } else if (!(g.maploc->looted & S_LDWASHER) && !rn2(3)
&& !(mvitals[washerndx].mvflags & G_GONE)) { && !(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))
newsym(x, y); newsym(x, y);
maploc->looted |= S_LDWASHER; g.maploc->looted |= S_LDWASHER;
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return 1; return 1;
} else if (!rn2(3)) { } else if (!rn2(3)) {
pline("Flupp! %s.", pline("Flupp! %s.",
(Blind ? "You hear a sloshing sound" (Blind ? "You hear a sloshing sound"
: "Muddy waste pops up from the drain")); : "Muddy waste pops up from the drain"));
if (!(maploc->looted & S_LRING)) { /* once per sink */ if (!(g.maploc->looted & S_LRING)) { /* once per sink */
if (!Blind) if (!Blind)
You_see("a ring shining in its midst."); You_see("a ring shining in its midst.");
(void) mkobj_at(RING_CLASS, x, y, TRUE); (void) mkobj_at(RING_CLASS, x, y, TRUE);
newsym(x, y); newsym(x, y);
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
exercise(A_WIS, TRUE); /* a discovery! */ exercise(A_WIS, TRUE); /* a discovery! */
maploc->looted |= S_LRING; g.maploc->looted |= S_LRING;
} }
return 1; return 1;
} }
goto ouch; goto ouch;
} }
if (maploc->typ == STAIRS || maploc->typ == LADDER if (g.maploc->typ == STAIRS || g.maploc->typ == LADDER
|| IS_STWALL(maploc->typ)) { || IS_STWALL(g.maploc->typ)) {
if (!IS_STWALL(maploc->typ) && maploc->ladder == LA_DOWN) if (!IS_STWALL(g.maploc->typ) && g.maploc->ladder == LA_DOWN)
goto dumb; goto dumb;
ouch: ouch:
pline("Ouch! That hurts!"); pline("Ouch! That hurts!");
@@ -1212,7 +1209,7 @@ dokick()
pline_The("drawbridge is unaffected."); pline_The("drawbridge is unaffected.");
/* update maploc to refer to the drawbridge */ /* update maploc to refer to the drawbridge */
(void) find_drawbridge(&x, &y); (void) find_drawbridge(&x, &y);
maploc = &levl[x][y]; g.maploc = &levl[x][y];
} }
} }
if (!rn2(3)) if (!rn2(3))
@@ -1226,8 +1223,8 @@ dokick()
goto dumb; goto dumb;
} }
if (maploc->doormask == D_ISOPEN || maploc->doormask == D_BROKEN if (g.maploc->doormask == D_ISOPEN || g.maploc->doormask == D_BROKEN
|| maploc->doormask == D_NODOOR) { || g.maploc->doormask == D_NODOOR) {
dumb: dumb:
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
if (martial() || ACURR(A_DEX) >= 16 || rn2(3)) { if (martial() || ACURR(A_DEX) >= 16 || rn2(3)) {
@@ -1253,20 +1250,20 @@ dokick()
if (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX))) { if (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX))) {
boolean shopdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE; boolean shopdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
/* break the door */ /* break the door */
if (maploc->doormask & D_TRAPPED) { if (g.maploc->doormask & D_TRAPPED) {
if (flags.verbose) if (flags.verbose)
You("kick the door."); You("kick the door.");
exercise(A_STR, FALSE); exercise(A_STR, FALSE);
maploc->doormask = D_NODOOR; g.maploc->doormask = D_NODOOR;
b_trapped("door", FOOT); b_trapped("door", FOOT);
} else if (ACURR(A_STR) > 18 && !rn2(5) && !shopdoor) { } else if (ACURR(A_STR) > 18 && !rn2(5) && !shopdoor) {
pline("As you kick the door, it shatters to pieces!"); pline("As you kick the door, it shatters to pieces!");
exercise(A_STR, TRUE); exercise(A_STR, TRUE);
maploc->doormask = D_NODOOR; g.maploc->doormask = D_NODOOR;
} else { } else {
pline("As you kick the door, it crashes open!"); pline("As you kick the door, it crashes open!");
exercise(A_STR, TRUE); exercise(A_STR, TRUE);
maploc->doormask = D_BROKEN; g.maploc->doormask = D_BROKEN;
} }
feel_newsym(x, y); /* we know we broke it */ feel_newsym(x, y); /* we know we broke it */
unblock_point(x, y); /* vision */ unblock_point(x, y); /* vision */
@@ -1438,11 +1435,11 @@ xchar dlev; /* if !0 send to dlev near player */
dct == oct ? "the " : dct == 1L ? "an" : "", what); dct == oct ? "the " : dct == 1L ? "an" : "", what);
else if (oct == dct) else if (oct == dct)
pline("%s adjacent %s %s.", dct == 1L ? "The" : "All the", what, pline("%s adjacent %s %s.", dct == 1L ? "The" : "All the", what,
gate_str); g.gate_str);
else else
pline("%s adjacent %s %s.", pline("%s adjacent %s %s.",
dct == 1L ? "One of the" : "Some of the", dct == 1L ? "One of the" : "Some of the",
dct == 1L ? "objects falls" : what, gate_str); dct == 1L ? "objects falls" : what, g.gate_str);
} }
if (costly && shkp && price) { if (costly && shkp && price) {
@@ -1746,10 +1743,10 @@ long num;
if (nodrop) if (nodrop)
Sprintf(eos(xbuf), "."); Sprintf(eos(xbuf), ".");
else else
Sprintf(eos(xbuf), " and %s %s.", otense(otmp, "fall"), gate_str); Sprintf(eos(xbuf), " and %s %s.", otense(otmp, "fall"), g.gate_str);
pline("%s%s", obuf, xbuf); pline("%s%s", obuf, xbuf);
} else if (!nodrop) } else if (!nodrop)
pline("%s %s %s.", obuf, otense(otmp, "fall"), gate_str); pline("%s %s %s.", obuf, otense(otmp, "fall"), g.gate_str);
} }
/* migration destination for objects which fall down to next level */ /* migration destination for objects which fall down to next level */
@@ -1759,25 +1756,25 @@ xchar x, y;
{ {
struct trap *ttmp; struct trap *ttmp;
gate_str = 0; g.gate_str = 0;
/* this matches the player restriction in goto_level() */ /* this matches the player restriction in goto_level() */
if (on_level(&u.uz, &qstart_level) && !ok_to_quest()) if (on_level(&u.uz, &qstart_level) && !ok_to_quest())
return MIGR_NOWHERE; return MIGR_NOWHERE;
if ((xdnstair == x && ydnstair == y) if ((xdnstair == x && ydnstair == y)
|| (sstairs.sx == x && sstairs.sy == y && !sstairs.up)) { || (sstairs.sx == x && sstairs.sy == y && !sstairs.up)) {
gate_str = "down the stairs"; g.gate_str = "down the stairs";
return (xdnstair == x && ydnstair == y) ? MIGR_STAIRS_UP return (xdnstair == x && ydnstair == y) ? MIGR_STAIRS_UP
: MIGR_SSTAIRS; : MIGR_SSTAIRS;
} }
if (xdnladder == x && ydnladder == y) { if (xdnladder == x && ydnladder == y) {
gate_str = "down the ladder"; g.gate_str = "down the ladder";
return MIGR_LADDER_UP; return MIGR_LADDER_UP;
} }
if (((ttmp = t_at(x, y)) != 0 && ttmp->tseen) if (((ttmp = t_at(x, y)) != 0 && ttmp->tseen)
&& is_hole(ttmp->ttyp)) { && is_hole(ttmp->ttyp)) {
gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door" g.gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door"
: "through the hole"; : "through the hole";
return MIGR_RANDOM; return MIGR_RANDOM;
} }
+42 -51
View File
@@ -17,15 +17,6 @@
#define C(n) #define C(n)
#endif #endif
struct symsetentry symset[NUM_GRAPHICS];
int currentgraphics = 0;
nhsym showsyms[SYM_MAX] = DUMMY; /* symbols to be displayed */
nhsym l_syms[SYM_MAX] = DUMMY; /* loaded symbols */
nhsym r_syms[SYM_MAX] = DUMMY; /* rogue symbols */
nhsym warnsyms[WARNCOUNT] = DUMMY; /* the current warning display symbols */
const char invisexplain[] = "remembered, unseen, creature", const char invisexplain[] = "remembered, unseen, creature",
altinvisexplain[] = "unseen creature"; /* for clairvoyance */ altinvisexplain[] = "unseen creature"; /* for clairvoyance */
@@ -357,9 +348,9 @@ init_symbols()
void void
update_bouldersym() update_bouldersym()
{ {
showsyms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym; g.showsyms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym;
l_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym; g.l_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym;
r_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym; g.r_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym;
} }
void void
@@ -368,20 +359,20 @@ init_showsyms()
register int i; register int i;
for (i = 0; i < MAXPCHARS; i++) for (i = 0; i < MAXPCHARS; i++)
showsyms[i + SYM_OFF_P] = defsyms[i].sym; g.showsyms[i + SYM_OFF_P] = defsyms[i].sym;
for (i = 0; i < MAXOCLASSES; i++) for (i = 0; i < MAXOCLASSES; i++)
showsyms[i + SYM_OFF_O] = def_oc_syms[i].sym; g.showsyms[i + SYM_OFF_O] = def_oc_syms[i].sym;
for (i = 0; i < MAXMCLASSES; i++) for (i = 0; i < MAXMCLASSES; i++)
showsyms[i + SYM_OFF_M] = def_monsyms[i].sym; g.showsyms[i + SYM_OFF_M] = def_monsyms[i].sym;
for (i = 0; i < WARNCOUNT; i++) for (i = 0; i < WARNCOUNT; i++)
showsyms[i + SYM_OFF_W] = def_warnsyms[i].sym; g.showsyms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++) { for (i = 0; i < MAXOTHER; i++) {
if (i == SYM_BOULDER) if (i == SYM_BOULDER)
showsyms[i + SYM_OFF_X] = iflags.bouldersym g.showsyms[i + SYM_OFF_X] = iflags.bouldersym
? iflags.bouldersym ? iflags.bouldersym
: def_oc_syms[ROCK_CLASS].sym; : def_oc_syms[ROCK_CLASS].sym;
else if (i == SYM_INVISIBLE) else if (i == SYM_INVISIBLE)
showsyms[i + SYM_OFF_X] = DEF_INVISIBLE; g.showsyms[i + SYM_OFF_X] = DEF_INVISIBLE;
} }
} }
@@ -392,20 +383,20 @@ init_l_symbols()
register int i; register int i;
for (i = 0; i < MAXPCHARS; i++) for (i = 0; i < MAXPCHARS; i++)
l_syms[i + SYM_OFF_P] = defsyms[i].sym; g.l_syms[i + SYM_OFF_P] = defsyms[i].sym;
for (i = 0; i < MAXOCLASSES; i++) for (i = 0; i < MAXOCLASSES; i++)
l_syms[i + SYM_OFF_O] = def_oc_syms[i].sym; g.l_syms[i + SYM_OFF_O] = def_oc_syms[i].sym;
for (i = 0; i < MAXMCLASSES; i++) for (i = 0; i < MAXMCLASSES; i++)
l_syms[i + SYM_OFF_M] = def_monsyms[i].sym; g.l_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
for (i = 0; i < WARNCOUNT; i++) for (i = 0; i < WARNCOUNT; i++)
l_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; g.l_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++) { for (i = 0; i < MAXOTHER; i++) {
if (i == SYM_BOULDER) if (i == SYM_BOULDER)
l_syms[i + SYM_OFF_X] = iflags.bouldersym g.l_syms[i + SYM_OFF_X] = iflags.bouldersym
? iflags.bouldersym ? iflags.bouldersym
: def_oc_syms[ROCK_CLASS].sym; : def_oc_syms[ROCK_CLASS].sym;
else if (i == SYM_INVISIBLE) else if (i == SYM_INVISIBLE)
l_syms[i + SYM_OFF_X] = DEF_INVISIBLE; g.l_syms[i + SYM_OFF_X] = DEF_INVISIBLE;
} }
clear_symsetentry(PRIMARY, FALSE); clear_symsetentry(PRIMARY, FALSE);
@@ -420,30 +411,30 @@ init_r_symbols()
later by the roguesymbols option */ later by the roguesymbols option */
for (i = 0; i < MAXPCHARS; i++) for (i = 0; i < MAXPCHARS; i++)
r_syms[i + SYM_OFF_P] = defsyms[i].sym; g.r_syms[i + SYM_OFF_P] = defsyms[i].sym;
r_syms[S_vodoor] = r_syms[S_hodoor] = r_syms[S_ndoor] = '+'; g.r_syms[S_vodoor] = g.r_syms[S_hodoor] = g.r_syms[S_ndoor] = '+';
r_syms[S_upstair] = r_syms[S_dnstair] = '%'; g.r_syms[S_upstair] = g.r_syms[S_dnstair] = '%';
for (i = 0; i < MAXOCLASSES; i++) for (i = 0; i < MAXOCLASSES; i++)
r_syms[i + SYM_OFF_O] = def_r_oc_syms[i]; g.r_syms[i + SYM_OFF_O] = def_r_oc_syms[i];
for (i = 0; i < MAXMCLASSES; i++) for (i = 0; i < MAXMCLASSES; i++)
r_syms[i + SYM_OFF_M] = def_monsyms[i].sym; g.r_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
for (i = 0; i < WARNCOUNT; i++) for (i = 0; i < WARNCOUNT; i++)
r_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; g.r_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
for (i = 0; i < MAXOTHER; i++) { for (i = 0; i < MAXOTHER; i++) {
if (i == SYM_BOULDER) if (i == SYM_BOULDER)
r_syms[i + SYM_OFF_X] = iflags.bouldersym g.r_syms[i + SYM_OFF_X] = iflags.bouldersym
? iflags.bouldersym ? iflags.bouldersym
: def_oc_syms[ROCK_CLASS].sym; : def_oc_syms[ROCK_CLASS].sym;
else if (i == SYM_INVISIBLE) else if (i == SYM_INVISIBLE)
r_syms[i + SYM_OFF_X] = DEF_INVISIBLE; g.r_syms[i + SYM_OFF_X] = DEF_INVISIBLE;
} }
clear_symsetentry(ROGUESET, FALSE); clear_symsetentry(ROGUESET, FALSE);
/* default on Rogue level is no color /* default on Rogue level is no color
* but some symbol sets can override that * but some symbol sets can override that
*/ */
symset[ROGUESET].nocolor = 1; g.symset[ROGUESET].nocolor = 1;
} }
void void
@@ -457,25 +448,25 @@ int whichset;
/* Adjust graphics display characters on Rogue levels */ /* Adjust graphics display characters on Rogue levels */
for (i = 0; i < SYM_MAX; i++) for (i = 0; i < SYM_MAX; i++)
showsyms[i] = r_syms[i]; g.showsyms[i] = g.r_syms[i];
#if defined(MSDOS) && defined(USE_TILES) #if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode) if (iflags.grmode)
tileview(FALSE); tileview(FALSE);
#endif #endif
currentgraphics = ROGUESET; g.currentgraphics = ROGUESET;
break; break;
case PRIMARY: case PRIMARY:
default: default:
for (i = 0; i < SYM_MAX; i++) for (i = 0; i < SYM_MAX; i++)
showsyms[i] = l_syms[i]; g.showsyms[i] = g.l_syms[i];
#if defined(MSDOS) && defined(USE_TILES) #if defined(MSDOS) && defined(USE_TILES)
if (iflags.grmode) if (iflags.grmode)
tileview(TRUE); tileview(TRUE);
#endif #endif
currentgraphics = PRIMARY; g.currentgraphics = PRIMARY;
break; break;
} }
} }
@@ -488,11 +479,11 @@ int nondefault;
if (nondefault) { if (nondefault) {
for (i = 0; i < SYM_MAX; i++) for (i = 0; i < SYM_MAX; i++)
showsyms[i] = l_syms[i]; g.showsyms[i] = g.l_syms[i];
#ifdef PC9800 #ifdef PC9800
if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback) if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback)
(*ibmgraphics_mode_callback)(); (*ibmgraphics_mode_callback)();
else if (!symset[currentgraphics].name && ascgraphics_mode_callback) else if (!g.symset[g.currentgraphics].name && ascgraphics_mode_callback)
(*ascgraphics_mode_callback)(); (*ascgraphics_mode_callback)();
#endif #endif
#ifdef TERMLIB #ifdef TERMLIB
@@ -512,7 +503,7 @@ update_l_symset(symp, val)
struct symparse *symp; struct symparse *symp;
int val; int val;
{ {
l_syms[symp->idx] = val; g.l_syms[symp->idx] = val;
} }
void void
@@ -520,7 +511,7 @@ update_r_symset(symp, val)
struct symparse *symp; struct symparse *symp;
int val; int val;
{ {
r_syms[symp->idx] = val; g.r_syms[symp->idx] = val;
} }
void void
@@ -528,20 +519,20 @@ clear_symsetentry(which_set, name_too)
int which_set; int which_set;
boolean name_too; boolean name_too;
{ {
if (symset[which_set].desc) if (g.symset[which_set].desc)
free((genericptr_t) symset[which_set].desc); free((genericptr_t) g.symset[which_set].desc);
symset[which_set].desc = (char *) 0; g.symset[which_set].desc = (char *) 0;
symset[which_set].handling = H_UNK; g.symset[which_set].handling = H_UNK;
symset[which_set].nocolor = 0; g.symset[which_set].nocolor = 0;
/* initialize restriction bits */ /* initialize restriction bits */
symset[which_set].primary = 0; g.symset[which_set].primary = 0;
symset[which_set].rogue = 0; g.symset[which_set].rogue = 0;
if (name_too) { if (name_too) {
if (symset[which_set].name) if (g.symset[which_set].name)
free((genericptr_t) symset[which_set].name); free((genericptr_t) g.symset[which_set].name);
symset[which_set].name = (char *) 0; g.symset[which_set].name = (char *) 0;
} }
} }
+59 -64
View File
@@ -25,11 +25,6 @@ struct proto_dungeon {
int n_brs; /* number of tmpbranch entries */ int n_brs; /* number of tmpbranch entries */
}; };
int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */
static branch *branches = (branch *) 0; /* dungeon branch list */
mapseen *mapseenchn = (struct mapseen *) 0; /*DUNGEON_OVERVIEW*/
struct lchoice { struct lchoice {
int idx; int idx;
schar lev[MAXLINFO]; schar lev[MAXLINFO];
@@ -88,7 +83,7 @@ dumpit()
if (!explicitdebug(__FILE__)) if (!explicitdebug(__FILE__))
return; return;
for (i = 0; i < n_dgns; i++) { for (i = 0; i < g.n_dgns; i++) {
fprintf(stderr, "\n#%d \"%s\" (%s):\n", i, DD.dname, DD.proto); fprintf(stderr, "\n#%d \"%s\" (%s):\n", i, DD.dname, DD.proto);
fprintf(stderr, " num_dunlevs %d, dunlev_ureached %d\n", fprintf(stderr, " num_dunlevs %d, dunlev_ureached %d\n",
DD.num_dunlevs, DD.dunlev_ureached); DD.num_dunlevs, DD.dunlev_ureached);
@@ -112,7 +107,7 @@ dumpit()
getchar(); getchar();
} }
fprintf(stderr, "\nBranches:\n"); fprintf(stderr, "\nBranches:\n");
for (br = branches; br; br = br->next) { for (br = g.branches; br; br = br->next) {
fprintf(stderr, "%d: %s, end1 %d %d, end2 %d %d, %s\n", br->id, fprintf(stderr, "%d: %s, end1 %d %d, end2 %d %d, %s\n", br->id,
br->type == BR_STAIR br->type == BR_STAIR
? "stair" ? "stair"
@@ -143,17 +138,17 @@ boolean perform_write, free_data;
int count; int count;
if (perform_write) { if (perform_write) {
bwrite(fd, (genericptr_t) &n_dgns, sizeof n_dgns); bwrite(fd, (genericptr_t) &g.n_dgns, sizeof g.n_dgns);
bwrite(fd, (genericptr_t) dungeons, bwrite(fd, (genericptr_t) dungeons,
sizeof(dungeon) * (unsigned) n_dgns); sizeof(dungeon) * (unsigned) g.n_dgns);
bwrite(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology); bwrite(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology);
bwrite(fd, (genericptr_t) tune, sizeof tune); bwrite(fd, (genericptr_t) tune, sizeof tune);
for (count = 0, curr = branches; curr; curr = curr->next) for (count = 0, curr = g.branches; curr; curr = curr->next)
count++; count++;
bwrite(fd, (genericptr_t) &count, sizeof(count)); bwrite(fd, (genericptr_t) &count, sizeof(count));
for (curr = branches; curr; curr = curr->next) for (curr = g.branches; curr; curr = curr->next)
bwrite(fd, (genericptr_t) curr, sizeof(branch)); bwrite(fd, (genericptr_t) curr, sizeof(branch));
count = maxledgerno(); count = maxledgerno();
@@ -162,28 +157,28 @@ boolean perform_write, free_data;
(unsigned) count * sizeof(struct linfo)); (unsigned) count * sizeof(struct linfo));
bwrite(fd, (genericptr_t) &inv_pos, sizeof inv_pos); bwrite(fd, (genericptr_t) &inv_pos, sizeof inv_pos);
for (count = 0, curr_ms = mapseenchn; curr_ms; for (count = 0, curr_ms = g.mapseenchn; curr_ms;
curr_ms = curr_ms->next) curr_ms = curr_ms->next)
count++; count++;
bwrite(fd, (genericptr_t) &count, sizeof(count)); bwrite(fd, (genericptr_t) &count, sizeof(count));
for (curr_ms = mapseenchn; curr_ms; curr_ms = curr_ms->next) for (curr_ms = g.mapseenchn; curr_ms; curr_ms = curr_ms->next)
save_mapseen(fd, curr_ms); save_mapseen(fd, curr_ms);
} }
if (free_data) { if (free_data) {
for (curr = branches; curr; curr = next) { for (curr = g.branches; curr; curr = next) {
next = curr->next; next = curr->next;
free((genericptr_t) curr); free((genericptr_t) curr);
} }
branches = 0; g.branches = 0;
for (curr_ms = mapseenchn; curr_ms; curr_ms = next_ms) { for (curr_ms = g.mapseenchn; curr_ms; curr_ms = next_ms) {
next_ms = curr_ms->next; next_ms = curr_ms->next;
if (curr_ms->custom) if (curr_ms->custom)
free((genericptr_t) curr_ms->custom); free((genericptr_t) curr_ms->custom);
free((genericptr_t) curr_ms); free((genericptr_t) curr_ms);
} }
mapseenchn = 0; g.mapseenchn = 0;
} }
} }
@@ -196,12 +191,12 @@ int fd;
int count, i; int count, i;
mapseen *curr_ms, *last_ms; mapseen *curr_ms, *last_ms;
mread(fd, (genericptr_t) &n_dgns, sizeof(n_dgns)); mread(fd, (genericptr_t) &g.n_dgns, sizeof(g.n_dgns));
mread(fd, (genericptr_t) dungeons, sizeof(dungeon) * (unsigned) n_dgns); mread(fd, (genericptr_t) dungeons, sizeof(dungeon) * (unsigned) g.n_dgns);
mread(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology); mread(fd, (genericptr_t) &dungeon_topology, sizeof dungeon_topology);
mread(fd, (genericptr_t) tune, sizeof tune); mread(fd, (genericptr_t) tune, sizeof tune);
last = branches = (branch *) 0; last = g.branches = (branch *) 0;
mread(fd, (genericptr_t) &count, sizeof(count)); mread(fd, (genericptr_t) &count, sizeof(count));
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
@@ -211,7 +206,7 @@ int fd;
if (last) if (last)
last->next = curr; last->next = curr;
else else
branches = curr; g.branches = curr;
last = curr; last = curr;
} }
@@ -231,7 +226,7 @@ int fd;
if (last_ms) if (last_ms)
last_ms->next = curr_ms; last_ms->next = curr_ms;
else else
mapseenchn = curr_ms; g.mapseenchn = curr_ms;
last_ms = curr_ms; last_ms = curr_ms;
} }
} }
@@ -258,7 +253,7 @@ const char *s;
{ {
xchar i; xchar i;
for (i = 0; i < n_dgns; i++) for (i = 0; i < g.n_dgns; i++)
if (!strcmp(dungeons[i].dname, s)) if (!strcmp(dungeons[i].dname, s))
return i; return i;
@@ -297,7 +292,7 @@ struct proto_dungeon *pd;
branch *br; branch *br;
const char *dnam; const char *dnam;
for (br = branches; br; br = br->next) { for (br = g.branches; br; br = br->next) {
dnam = dungeons[br->end2.dnum].dname; dnam = dungeons[br->end2.dnum].dname;
if (!strcmpi(dnam, s) if (!strcmpi(dnam, s)
|| (!strncmpi(dnam, "The ", 4) && !strcmpi(dnam + 4, s))) || (!strncmpi(dnam, "The ", 4) && !strcmpi(dnam + 4, s)))
@@ -397,7 +392,7 @@ struct proto_dungeon *pd;
do { do {
if (++i >= num) if (++i >= num)
i = 0; i = 0;
for (curr = branches; curr; curr = curr->next) for (curr = g.branches; curr; curr = curr->next)
if ((curr->end1.dnum == dnum && curr->end1.dlevel == base + i) if ((curr->end1.dnum == dnum && curr->end1.dlevel == base + i)
|| (curr->end2.dnum == dnum && curr->end2.dlevel == base + i)) || (curr->end2.dnum == dnum && curr->end2.dlevel == base + i))
break; break;
@@ -439,7 +434,7 @@ boolean extract_first;
long new_val, curr_val, prev_val; long new_val, curr_val, prev_val;
if (extract_first) { if (extract_first) {
for (prev = 0, curr = branches; curr; prev = curr, curr = curr->next) for (prev = 0, curr = g.branches; curr; prev = curr, curr = curr->next)
if (curr == new_branch) if (curr == new_branch)
break; break;
@@ -448,7 +443,7 @@ boolean extract_first;
if (prev) if (prev)
prev->next = curr->next; prev->next = curr->next;
else else
branches = curr->next; g.branches = curr->next;
} }
new_branch->next = (branch *) 0; new_branch->next = (branch *) 0;
@@ -464,7 +459,7 @@ boolean extract_first;
prev = (branch *) 0; prev = (branch *) 0;
prev_val = -1; prev_val = -1;
new_val = branch_val(new_branch); new_val = branch_val(new_branch);
for (curr = branches; curr; for (curr = g.branches; curr;
prev_val = curr_val, prev = curr, curr = curr->next) { prev_val = curr_val, prev = curr, curr = curr->next) {
curr_val = branch_val(curr); curr_val = branch_val(curr);
if (prev_val < new_val && new_val <= curr_val) if (prev_val < new_val && new_val <= curr_val)
@@ -474,8 +469,8 @@ boolean extract_first;
new_branch->next = curr; new_branch->next = curr;
prev->next = new_branch; prev->next = new_branch;
} else { } else {
new_branch->next = branches; new_branch->next = g.branches;
branches = new_branch; g.branches = new_branch;
} }
} }
@@ -763,11 +758,11 @@ init_dungeons()
* dungeon arrays. * dungeon arrays.
*/ */
sp_levchn = (s_level *) 0; sp_levchn = (s_level *) 0;
Fread((genericptr_t) &n_dgns, sizeof(int), 1, dgn_file); Fread((genericptr_t) &g.n_dgns, sizeof(int), 1, dgn_file);
if (n_dgns >= MAXDUNGEON) if (g.n_dgns >= MAXDUNGEON)
panic("init_dungeons: too many dungeons"); panic("init_dungeons: too many dungeons");
for (i = 0; i < n_dgns; i++) { for (i = 0; i < g.n_dgns; i++) {
Fread((genericptr_t) &pd.tmpdungeon[i], sizeof(struct tmpdungeon), 1, Fread((genericptr_t) &pd.tmpdungeon[i], sizeof(struct tmpdungeon), 1,
dgn_file); dgn_file);
if (!wizard && pd.tmpdungeon[i].chance if (!wizard && pd.tmpdungeon[i].chance
@@ -782,7 +777,7 @@ init_dungeons()
for (j = 0; j < pd.tmpdungeon[i].branches; j++) for (j = 0; j < pd.tmpdungeon[i].branches; j++)
Fread((genericptr_t) &pd.tmpbranch[cb], Fread((genericptr_t) &pd.tmpbranch[cb],
sizeof(struct tmpbranch), 1, dgn_file); sizeof(struct tmpbranch), 1, dgn_file);
n_dgns--; g.n_dgns--;
i--; i--;
continue; continue;
} }
@@ -938,12 +933,12 @@ init_dungeons()
* its entrance (end1) has a bogus dnum, namely * its entrance (end1) has a bogus dnum, namely
* n_dgns. * n_dgns.
*/ */
for (br = branches; br; br = br->next) for (br = g.branches; br; br = br->next)
if (on_level(&br->end2, &knox_level)) if (on_level(&br->end2, &knox_level))
break; break;
if (br) if (br)
br->end1.dnum = n_dgns; br->end1.dnum = g.n_dgns;
/* adjust the branch's position on the list */ /* adjust the branch's position on the list */
insert_branch(br, TRUE); insert_branch(br, TRUE);
} }
@@ -1015,7 +1010,7 @@ boolean noquest;
d_level tmp; d_level tmp;
register schar ret = 0; register schar ret = 0;
for (i = 0; i < n_dgns; i++) { for (i = 0; i < g.n_dgns; i++) {
if (noquest && i == quest_dnum) if (noquest && i == quest_dnum)
continue; continue;
tmp.dlevel = dungeons[i].dunlev_ureached; tmp.dlevel = dungeons[i].dunlev_ureached;
@@ -1050,8 +1045,8 @@ d_level *lev;
xchar xchar
maxledgerno() maxledgerno()
{ {
return (xchar) (dungeons[n_dgns - 1].ledger_start return (xchar) (dungeons[g.n_dgns - 1].ledger_start
+ dungeons[n_dgns - 1].num_dunlevs); + dungeons[g.n_dgns - 1].num_dunlevs);
} }
/* return the dungeon that this ledgerno exists in */ /* return the dungeon that this ledgerno exists in */
@@ -1062,7 +1057,7 @@ xchar ledgerno;
register int i; register int i;
/* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */ /* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */
for (i = 0; i < n_dgns; i++) for (i = 0; i < g.n_dgns; i++)
if (dungeons[i].ledger_start < ledgerno if (dungeons[i].ledger_start < ledgerno
&& ledgerno <= dungeons[i].ledger_start + dungeons[i].num_dunlevs) && ledgerno <= dungeons[i].ledger_start + dungeons[i].num_dunlevs)
return (xchar) i; return (xchar) i;
@@ -1123,7 +1118,7 @@ d_level *lev;
{ {
branch *curr; branch *curr;
for (curr = branches; curr; curr = curr->next) { for (curr = g.branches; curr; curr = curr->next) {
if (on_level(lev, &curr->end1) || on_level(lev, &curr->end2)) if (on_level(lev, &curr->end1) || on_level(lev, &curr->end2))
return curr; return curr;
} }
@@ -1373,7 +1368,7 @@ int levnum;
* This assumes that end2 is always the "child" and it is * This assumes that end2 is always the "child" and it is
* unique. * unique.
*/ */
for (br = branches; br; br = br->next) for (br = g.branches; br; br = br->next)
if (br->end2.dnum == dgn) if (br->end2.dnum == dgn)
break; break;
if (!br) if (!br)
@@ -1425,7 +1420,7 @@ const char *s;
dnum = dname_to_dnum(s); dnum = dname_to_dnum(s);
/* Find the branch that connects to dungeon i's branch. */ /* Find the branch that connects to dungeon i's branch. */
for (br = branches; br; br = br->next) for (br = g.branches; br; br = br->next)
if (br->end2.dnum == dnum) if (br->end2.dnum == dnum)
break; break;
@@ -1721,8 +1716,8 @@ struct dungeon *dptr;
/* if other floating branches are added, this will need to change */ /* if other floating branches are added, this will need to change */
if (idx != knox_level.dnum) if (idx != knox_level.dnum)
return FALSE; return FALSE;
for (br = branches; br; br = br->next) for (br = g.branches; br; br = br->next)
if (br->end1.dnum == n_dgns && br->end2.dnum == idx) if (br->end1.dnum == g.n_dgns && br->end2.dnum == idx)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@@ -1816,7 +1811,7 @@ struct lchoice *lchoices_p;
char buf[BUFSZ]; char buf[BUFSZ];
/* This assumes that end1 is the "parent". */ /* This assumes that end1 is the "parent". */
for (br = branches; br; br = br->next) { for (br = g.branches; br; br = br->next) {
if (br->end1.dnum == dnum && lower_bound < br->end1.dlevel if (br->end1.dnum == dnum && lower_bound < br->end1.dlevel
&& br->end1.dlevel <= upper_bound) { && br->end1.dlevel <= upper_bound) {
Sprintf(buf, "%c %s to %s: %d", Sprintf(buf, "%c %s to %s: %d",
@@ -1856,7 +1851,7 @@ xchar *rdgn;
lchoices.menuletter = 'a'; lchoices.menuletter = 'a';
} }
for (i = 0, dptr = dungeons; i < n_dgns; i++, dptr++) { for (i = 0, dptr = dungeons; i < g.n_dgns; i++, dptr++) {
if (bymenu && In_endgame(&u.uz) && i != astral_level.dnum) if (bymenu && In_endgame(&u.uz) && i != astral_level.dnum)
continue; continue;
unplaced = unplaced_floater(dptr); unplaced = unplaced_floater(dptr);
@@ -1933,8 +1928,8 @@ xchar *rdgn;
} }
/* Print out floating branches (if any). */ /* Print out floating branches (if any). */
for (first = TRUE, br = branches; br; br = br->next) { for (first = TRUE, br = g.branches; br; br = br->next) {
if (br->end1.dnum == n_dgns) { if (br->end1.dnum == g.n_dgns) {
if (first) { if (first) {
putstr(win, 0, ""); putstr(win, 0, "");
putstr(win, 0, "Floating branches"); putstr(win, 0, "Floating branches");
@@ -2006,7 +2001,7 @@ d_level *dest;
return; return;
/* we only care about forward branches */ /* we only care about forward branches */
for (br = branches; br; br = br->next) { for (br = g.branches; br; br = br->next) {
if (on_level(source, &br->end1) && on_level(dest, &br->end2)) if (on_level(source, &br->end1) && on_level(dest, &br->end2))
break; break;
if (on_level(source, &br->end2) && on_level(dest, &br->end1)) if (on_level(source, &br->end2) && on_level(dest, &br->end1))
@@ -2094,7 +2089,7 @@ d_level *lev;
{ {
mapseen *mptr; mapseen *mptr;
for (mptr = mapseenchn; mptr; mptr = mptr->next) for (mptr = g.mapseenchn; mptr; mptr = mptr->next)
if (on_level(&(mptr->lev), lev)) if (on_level(&(mptr->lev), lev))
break; break;
@@ -2107,7 +2102,7 @@ const char *s;
{ {
mapseen *mptr; mapseen *mptr;
for (mptr = mapseenchn; mptr; mptr = mptr->next) for (mptr = g.mapseenchn; mptr; mptr = mptr->next)
if (mptr->custom && !strcmpi(s, mptr->custom)) if (mptr->custom && !strcmpi(s, mptr->custom))
break; break;
@@ -2122,7 +2117,7 @@ int ledger_num;
mapseen *mptr; mapseen *mptr;
struct cemetery *bp; struct cemetery *bp;
for (mptr = mapseenchn; mptr; mptr = mptr->next) for (mptr = g.mapseenchn; mptr; mptr = mptr->next)
if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel
== ledger_num) == ledger_num)
break; break;
@@ -2151,7 +2146,7 @@ int ledger_num;
mapseen *mptr, *mprev = (mapseen *)0; mapseen *mptr, *mprev = (mapseen *)0;
struct cemetery *bp, *bpnext; struct cemetery *bp, *bpnext;
for (mptr = mapseenchn; mptr; mprev = mptr, mptr = mptr->next) for (mptr = g.mapseenchn; mptr; mprev = mptr, mptr = mptr->next)
if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel == ledger_num) if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel == ledger_num)
break; break;
@@ -2172,7 +2167,7 @@ int ledger_num;
mprev->next = mptr->next; mprev->next = mptr->next;
free(mptr); free(mptr);
} else { } else {
mapseenchn = mptr->next; g.mapseenchn = mptr->next;
free(mptr); free(mptr);
} }
} }
@@ -2185,7 +2180,7 @@ mapseen *mptr;
branch *curr; branch *curr;
int brindx; int brindx;
for (brindx = 0, curr = branches; curr; curr = curr->next, ++brindx) for (brindx = 0, curr = g.branches; curr; curr = curr->next, ++brindx)
if (curr == mptr->br) if (curr == mptr->br)
break; break;
bwrite(fd, (genericptr_t) &brindx, sizeof brindx); bwrite(fd, (genericptr_t) &brindx, sizeof brindx);
@@ -2211,7 +2206,7 @@ int fd;
load = (mapseen *) alloc(sizeof *load); load = (mapseen *) alloc(sizeof *load);
mread(fd, (genericptr_t) &branchnum, sizeof branchnum); mread(fd, (genericptr_t) &branchnum, sizeof branchnum);
for (brindx = 0, curr = branches; curr; curr = curr->next, ++brindx) for (brindx = 0, curr = g.branches; curr; curr = curr->next, ++brindx)
if (brindx == branchnum) if (brindx == branchnum)
break; break;
load->br = curr; load->br = curr;
@@ -2246,7 +2241,7 @@ long *total_count, *total_size;
mapseen *mptr = find_mapseen(&u.uz); mapseen *mptr = find_mapseen(&u.uz);
ocount = bcount = acount = osize = bsize = asize = 0L; ocount = bcount = acount = osize = bsize = asize = 0L;
for (mptr = mapseenchn; mptr; mptr = mptr->next) { for (mptr = g.mapseenchn; mptr; mptr = mptr->next) {
++ocount; ++ocount;
osize += (long) sizeof *mptr; osize += (long) sizeof *mptr;
for (ce = mptr->final_resting_place; ce; ce = ce->next) { for (ce = mptr->final_resting_place; ce; ce = ce->next) {
@@ -2288,7 +2283,7 @@ int dnum;
{ {
mapseen *mptr, **mptraddr; mapseen *mptr, **mptraddr;
mptraddr = &mapseenchn; mptraddr = &g.mapseenchn;
while ((mptr = *mptraddr) != 0) { while ((mptr = *mptraddr) != 0) {
if (mptr->lev.dnum == dnum) { if (mptr->lev.dnum == dnum) {
#if 1 /* use this... */ #if 1 /* use this... */
@@ -2330,14 +2325,14 @@ d_level *lev;
init->lev.dlevel = lev->dlevel; init->lev.dlevel = lev->dlevel;
/* walk until we get to the place where we should insert init */ /* walk until we get to the place where we should insert init */
for (mptr = mapseenchn, prev = 0; mptr; prev = mptr, mptr = mptr->next) for (mptr = g.mapseenchn, prev = 0; mptr; prev = mptr, mptr = mptr->next)
if (mptr->lev.dnum > init->lev.dnum if (mptr->lev.dnum > init->lev.dnum
|| (mptr->lev.dnum == init->lev.dnum || (mptr->lev.dnum == init->lev.dnum
&& mptr->lev.dlevel > init->lev.dlevel)) && mptr->lev.dlevel > init->lev.dlevel))
break; break;
if (!prev) { if (!prev) {
init->next = mapseenchn; init->next = g.mapseenchn;
mapseenchn = init; g.mapseenchn = init;
} else { } else {
mptr = prev->next; mptr = prev->next;
prev->next = init; prev->next = init;
@@ -2413,7 +2408,7 @@ recalc_mapseen()
if (mptr->flags.unreachable) { if (mptr->flags.unreachable) {
mptr->flags.unreachable = 0; /* reached it; Eye of the Aethiopica? */ mptr->flags.unreachable = 0; /* reached it; Eye of the Aethiopica? */
if (In_quest(&u.uz)) { if (In_quest(&u.uz)) {
mapseen *mptrtmp = mapseenchn; mapseen *mptrtmp = g.mapseenchn;
/* when quest was unreachable due to ejection and portal removal, /* when quest was unreachable due to ejection and portal removal,
getting back to it via arti-invoke should revive annotation getting back to it via arti-invoke should revive annotation
@@ -2716,7 +2711,7 @@ int why, reason, *lastdun_p;
mapseen *mptr; mapseen *mptr;
boolean showheader; boolean showheader;
for (mptr = mapseenchn; mptr; mptr = mptr->next) { for (mptr = g.mapseenchn; mptr; mptr = mptr->next) {
if (viewendgame ^ In_endgame(&mptr->lev)) if (viewendgame ^ In_endgame(&mptr->lev))
continue; continue;
+5 -8
View File
@@ -39,8 +39,6 @@ STATIC_DCL const char *FDECL(foodword, (struct obj *));
STATIC_DCL int FDECL(tin_variety, (struct obj *, BOOLEAN_P)); STATIC_DCL int FDECL(tin_variety, (struct obj *, BOOLEAN_P));
STATIC_DCL boolean FDECL(maybe_cannibal, (int, BOOLEAN_P)); STATIC_DCL boolean FDECL(maybe_cannibal, (int, BOOLEAN_P));
char msgbuf[BUFSZ];
/* also used to see if you're allowed to eat cats and dogs */ /* also used to see if you're allowed to eat cats and dogs */
#define CANNIBAL_ALLOWED() (Role_if(PM_CAVEMAN) || Race_if(PM_ORC)) #define CANNIBAL_ALLOWED() (Role_if(PM_CAVEMAN) || Race_if(PM_ORC))
@@ -69,8 +67,6 @@ STATIC_OVL NEARDATA const char allobj[] = {
BALL_CLASS, CHAIN_CLASS, SPBOOK_CLASS, 0 BALL_CLASS, CHAIN_CLASS, SPBOOK_CLASS, 0
}; };
STATIC_OVL boolean force_save_hs = FALSE;
/* see hunger states in hack.h - texts used on bottom line */ /* see hunger states in hack.h - texts used on bottom line */
const char *hu_stat[] = { "Satiated", " ", "Hungry ", "Weak ", const char *hu_stat[] = { "Satiated", " ", "Hungry ", "Weak ",
"Fainting", "Fainted ", "Starved " }; "Fainting", "Fainted ", "Starved " };
@@ -1733,6 +1729,7 @@ start_eating(otmp)
struct obj *otmp; struct obj *otmp;
{ {
const char *old_nomovemsg, *save_nomovemsg; const char *old_nomovemsg, *save_nomovemsg;
static char msgbuf[BUFSZ];
debugpline2("start_eating: %s (victual = %s)", debugpline2("start_eating: %s (victual = %s)",
/* note: fmt_ptr() returns a static buffer but supports /* note: fmt_ptr() returns a static buffer but supports
@@ -2758,7 +2755,7 @@ bite()
do_reset_eat(); do_reset_eat();
return 0; return 0;
} }
force_save_hs = TRUE; g.force_save_hs = TRUE;
if (context.victual.nmod < 0) { if (context.victual.nmod < 0) {
lesshungry(-context.victual.nmod); lesshungry(-context.victual.nmod);
consume_oeaten(context.victual.piece, consume_oeaten(context.victual.piece,
@@ -2768,7 +2765,7 @@ bite()
lesshungry(1); lesshungry(1);
consume_oeaten(context.victual.piece, -1); /* -= 1 */ consume_oeaten(context.victual.piece, -1); /* -= 1 */
} }
force_save_hs = FALSE; g.force_save_hs = FALSE;
recalc_wt(); recalc_wt();
return 0; return 0;
} }
@@ -2845,7 +2842,7 @@ lesshungry(num)
int num; int num;
{ {
/* See comments in newuhs() for discussion on force_save_hs */ /* See comments in newuhs() for discussion on force_save_hs */
boolean iseating = (occupation == eatfood) || force_save_hs; boolean iseating = (occupation == eatfood) || g.force_save_hs;
debugpline1("lesshungry(%d)", num); debugpline1("lesshungry(%d)", num);
u.uhunger += num; u.uhunger += num;
@@ -2951,7 +2948,7 @@ boolean incr;
* were added or if HUNGRY and WEAK were separated by a big enough * were added or if HUNGRY and WEAK were separated by a big enough
* gap to fit two bites. * gap to fit two bites.
*/ */
if (occupation == eatfood || force_save_hs) { if (occupation == eatfood || g.force_save_hs) {
if (!saved_hs) { if (!saved_hs) {
save_hs = u.uhs; save_hs = u.uhs;
saved_hs = TRUE; saved_hs = TRUE;
+11 -32
View File
@@ -19,27 +19,6 @@
/* add b to long a, convert wraparound to max value */ /* add b to long a, convert wraparound to max value */
#define nowrap_add(a, b) (a = ((a + b) < 0 ? LONG_MAX : (a + b))) #define nowrap_add(a, b) (a = ((a + b) < 0 ? LONG_MAX : (a + b)))
/* these probably ought to be generated by makedefs, like LAST_GEM */
#define FIRST_GEM DILITHIUM_CRYSTAL
#define FIRST_AMULET AMULET_OF_ESP
#define LAST_AMULET AMULET_OF_YENDOR
struct valuable_data {
long count;
int typ;
};
static struct valuable_data
gems[LAST_GEM + 1 - FIRST_GEM + 1], /* 1 extra for glass */
amulets[LAST_AMULET + 1 - FIRST_AMULET];
static struct val_list {
struct valuable_data *list;
int size;
} valuables[] = { { gems, sizeof gems / sizeof *gems },
{ amulets, sizeof amulets / sizeof *amulets },
{ 0, 0 } };
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
STATIC_PTR void FDECL(done_intr, (int)); STATIC_PTR void FDECL(done_intr, (int));
#if defined(UNIX) || defined(VMS) || defined(__EMX__) #if defined(UNIX) || defined(VMS) || defined(__EMX__)
@@ -909,18 +888,18 @@ struct obj *list; /* inventory or container contents */
continue; continue;
} else if (obj->oclass == AMULET_CLASS) { } else if (obj->oclass == AMULET_CLASS) {
i = obj->otyp - FIRST_AMULET; i = obj->otyp - FIRST_AMULET;
if (!amulets[i].count) { if (!g.amulets[i].count) {
amulets[i].count = obj->quan; g.amulets[i].count = obj->quan;
amulets[i].typ = obj->otyp; g.amulets[i].typ = obj->otyp;
} else } else
amulets[i].count += obj->quan; /* always adds one */ g.amulets[i].count += obj->quan; /* always adds one */
} else if (obj->oclass == GEM_CLASS && obj->otyp < LUCKSTONE) { } else if (obj->oclass == GEM_CLASS && obj->otyp < LUCKSTONE) {
i = min(obj->otyp, LAST_GEM + 1) - FIRST_GEM; i = min(obj->otyp, LAST_GEM + 1) - FIRST_GEM;
if (!gems[i].count) { if (!g.gems[i].count) {
gems[i].count = obj->quan; g.gems[i].count = obj->quan;
gems[i].typ = obj->otyp; g.gems[i].typ = obj->otyp;
} else } else
gems[i].count += obj->quan; g.gems[i].count += obj->quan;
} }
return; return;
} }
@@ -1407,14 +1386,14 @@ int how;
register struct val_list *val; register struct val_list *val;
register int i; register int i;
for (val = valuables; val->list; val++) for (val = g.valuables; val->list; val++)
for (i = 0; i < val->size; i++) { for (i = 0; i < val->size; i++) {
val->list[i].count = 0L; val->list[i].count = 0L;
} }
get_valuables(invent); get_valuables(invent);
/* add points for collected valuables */ /* add points for collected valuables */
for (val = valuables; val->list; val++) for (val = g.valuables; val->list; val++)
for (i = 0; i < val->size; i++) for (i = 0; i < val->size; i++)
if (val->list[i].count != 0L) { if (val->list[i].count != 0L) {
tmp = val->list[i].count tmp = val->list[i].count
@@ -1465,7 +1444,7 @@ int how;
#endif #endif
/* list valuables here */ /* list valuables here */
for (val = valuables; val->list; val++) { for (val = g.valuables; val->list; val++) {
sort_valuables(val->list, val->size); sort_valuables(val->list, val->size);
for (i = 0; i < val->size && !done_stopprint; i++) { for (i = 0; i < val->size && !done_stopprint; i++) {
int typ = val->list[i].typ; int typ = val->list[i].typ;
+14 -16
View File
@@ -167,8 +167,6 @@ static int lockptr;
extern char *sounddir; extern char *sounddir;
#endif #endif
extern int n_dgns; /* from dungeon.c */
#if defined(UNIX) && defined(QT_GRAPHICS) #if defined(UNIX) && defined(QT_GRAPHICS)
#define SELECTSAVED #define SELECTSAVED
#endif #endif
@@ -604,7 +602,7 @@ clearlocks()
sethanguphandler((void FDECL((*), (int) )) SIG_IGN); sethanguphandler((void FDECL((*), (int) )) SIG_IGN);
#endif #endif
/* can't access maxledgerno() before dungeons are created -dlc */ /* can't access maxledgerno() before dungeons are created -dlc */
for (x = (n_dgns ? maxledgerno() : 0); x >= 0; x--) for (x = (g.n_dgns ? maxledgerno() : 0); x >= 0; x--)
delete_levelfile(x); /* not all levels need be present */ delete_levelfile(x); /* not all levels need be present */
} }
#endif /* ?PC_LOCKING,&c */ #endif /* ?PC_LOCKING,&c */
@@ -3182,17 +3180,17 @@ int which_set;
/* name caller put in symset[which_set].name was not found; /* name caller put in symset[which_set].name was not found;
if it looks like "Default symbols", null it out and return if it looks like "Default symbols", null it out and return
success to use the default; otherwise, return failure */ success to use the default; otherwise, return failure */
if (symset[which_set].name if (g.symset[which_set].name
&& (fuzzymatch(symset[which_set].name, "Default symbols", && (fuzzymatch(g.symset[which_set].name, "Default symbols",
" -_", TRUE) " -_", TRUE)
|| !strcmpi(symset[which_set].name, "default"))) || !strcmpi(g.symset[which_set].name, "default")))
clear_symsetentry(which_set, TRUE); clear_symsetentry(which_set, TRUE);
config_error_done(); config_error_done();
return (symset[which_set].name == 0) ? 1 : 0; return (g.symset[which_set].name == 0) ? 1 : 0;
} }
if (!chosen_symset_end) if (!chosen_symset_end)
config_error_add("Missing finish for symset \"%s\"", config_error_add("Missing finish for symset \"%s\"",
symset[which_set].name ? symset[which_set].name g.symset[which_set].name ? g.symset[which_set].name
: "unknown"); : "unknown");
config_error_done(); config_error_done();
@@ -3256,7 +3254,7 @@ int which_set;
return 0; return 0;
} }
if (!symset[which_set].name) { if (!g.symset[which_set].name) {
/* A null symset name indicates that we're just /* A null symset name indicates that we're just
building a pick-list of possible symset building a pick-list of possible symset
values from the file, so only do that */ values from the file, so only do that */
@@ -3328,7 +3326,7 @@ int which_set;
switch (symp->idx) { switch (symp->idx) {
case 0: case 0:
/* start of symset */ /* start of symset */
if (!strcmpi(bufp, symset[which_set].name)) { if (!strcmpi(bufp, g.symset[which_set].name)) {
/* matches desired one */ /* matches desired one */
chosen_symset_start = TRUE; chosen_symset_start = TRUE;
/* these init_*() functions clear symset fields too */ /* these init_*() functions clear symset fields too */
@@ -3355,11 +3353,11 @@ int which_set;
if (bufp) { if (bufp) {
if (!strcmpi(bufp, "true") || !strcmpi(bufp, "yes") if (!strcmpi(bufp, "true") || !strcmpi(bufp, "yes")
|| !strcmpi(bufp, "on")) || !strcmpi(bufp, "on"))
symset[which_set].nocolor = 0; g.symset[which_set].nocolor = 0;
else if (!strcmpi(bufp, "false") else if (!strcmpi(bufp, "false")
|| !strcmpi(bufp, "no") || !strcmpi(bufp, "no")
|| !strcmpi(bufp, "off")) || !strcmpi(bufp, "off"))
symset[which_set].nocolor = 1; g.symset[which_set].nocolor = 1;
} }
} }
break; break;
@@ -3371,10 +3369,10 @@ int which_set;
if (!strcmpi(known_restrictions[n], bufp)) { if (!strcmpi(known_restrictions[n], bufp)) {
switch (n) { switch (n) {
case 0: case 0:
symset[which_set].primary = 1; g.symset[which_set].primary = 1;
break; break;
case 1: case 1:
symset[which_set].rogue = 1; g.symset[which_set].rogue = 1;
break; break;
} }
break; /* while loop */ break; /* while loop */
@@ -3405,10 +3403,10 @@ int which_set;
{ {
int i = 0; int i = 0;
symset[which_set].handling = H_UNK; g.symset[which_set].handling = H_UNK;
while (known_handling[i]) { while (known_handling[i]) {
if (!strcmpi(known_handling[i], handling)) { if (!strcmpi(known_handling[i], handling)) {
symset[which_set].handling = i; g.symset[which_set].handling = i;
return; return;
} }
i++; i++;
+17 -21
View File
@@ -24,42 +24,40 @@ STATIC_DCL void FDECL(move_update, (BOOLEAN_P));
#define TRAVP_GUESS 1 #define TRAVP_GUESS 1
#define TRAVP_VALID 2 #define TRAVP_VALID 2
static anything tmp_anything;
anything * anything *
uint_to_any(ui) uint_to_any(ui)
unsigned ui; unsigned ui;
{ {
tmp_anything = zeroany; g.tmp_anything = zeroany;
tmp_anything.a_uint = ui; g.tmp_anything.a_uint = ui;
return &tmp_anything; return &g.tmp_anything;
} }
anything * anything *
long_to_any(lng) long_to_any(lng)
long lng; long lng;
{ {
tmp_anything = zeroany; g.tmp_anything = zeroany;
tmp_anything.a_long = lng; g.tmp_anything.a_long = lng;
return &tmp_anything; return &g.tmp_anything;
} }
anything * anything *
monst_to_any(mtmp) monst_to_any(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
tmp_anything = zeroany; g.tmp_anything = zeroany;
tmp_anything.a_monst = mtmp; g.tmp_anything.a_monst = mtmp;
return &tmp_anything; return &g.tmp_anything;
} }
anything * anything *
obj_to_any(obj) obj_to_any(obj)
struct obj *obj; struct obj *obj;
{ {
tmp_anything = zeroany; g.tmp_anything = zeroany;
tmp_anything.a_obj = obj; g.tmp_anything.a_obj = obj;
return &tmp_anything; return &g.tmp_anything;
} }
boolean boolean
@@ -2968,8 +2966,6 @@ weight_cap()
return (int) carrcap; return (int) carrcap;
} }
static int wc; /* current weight_cap(); valid after call to inv_weight() */
/* returns how far beyond the normal capacity the player is currently. */ /* returns how far beyond the normal capacity the player is currently. */
/* inv_weight() is negative if the player is below normal capacity. */ /* inv_weight() is negative if the player is below normal capacity. */
int int
@@ -2985,8 +2981,8 @@ inv_weight()
wt += otmp->owt; wt += otmp->owt;
otmp = otmp->nobj; otmp = otmp->nobj;
} }
wc = weight_cap(); g.wc = weight_cap();
return (wt - wc); return (wt - g.wc);
} }
/* /*
@@ -3001,9 +2997,9 @@ int xtra_wt;
if (wt <= 0) if (wt <= 0)
return UNENCUMBERED; return UNENCUMBERED;
if (wc <= 1) if (g.wc <= 1)
return OVERLOADED; return OVERLOADED;
cap = (wt * 2 / wc) + 1; cap = (wt * 2 / g.wc) + 1;
return min(cap, OVERLOADED); return min(cap, OVERLOADED);
} }
@@ -3018,7 +3014,7 @@ max_capacity()
{ {
int wt = inv_weight(); int wt = inv_weight();
return (wt - (2 * wc)); return (wt - (2 * g.wc));
} }
boolean boolean
+24 -32
View File
@@ -39,8 +39,6 @@ STATIC_DCL void FDECL(menu_identify, (int));
STATIC_DCL boolean FDECL(tool_in_use, (struct obj *)); STATIC_DCL boolean FDECL(tool_in_use, (struct obj *));
STATIC_DCL char FDECL(obj_to_let, (struct obj *)); STATIC_DCL char FDECL(obj_to_let, (struct obj *));
static int lastinvnr = 51; /* 0 ... 51 (never saved&restored) */
/* wizards can wish for venom, which will become an invisible inventory /* wizards can wish for venom, which will become an invisible inventory
* item without this. putting it in inv_order would mean venom would * item without this. putting it in inv_order would mean venom would
* suddenly become a choice for all the inventory-class commands, which * suddenly become a choice for all the inventory-class commands, which
@@ -263,9 +261,6 @@ struct obj *obj;
return res; return res;
} }
/* set by sortloot() for use by sortloot_cmp(); reset by sortloot when done */
static unsigned sortlootmode = 0;
/* qsort comparison routine for sortloot() */ /* qsort comparison routine for sortloot() */
STATIC_OVL int CFDECLSPEC STATIC_OVL int CFDECLSPEC
sortloot_cmp(vptr1, vptr2) sortloot_cmp(vptr1, vptr2)
@@ -280,7 +275,7 @@ const genericptr vptr2;
int val1, val2, c, namcmp; int val1, val2, c, namcmp;
/* order by object class unless we're doing by-invlet without sortpack */ /* order by object class unless we're doing by-invlet without sortpack */
if ((sortlootmode & (SORTLOOT_PACK | SORTLOOT_INVLET)) if ((g.sortlootmode & (SORTLOOT_PACK | SORTLOOT_INVLET))
!= SORTLOOT_INVLET) { != SORTLOOT_INVLET) {
/* Classify each object at most once no matter how many /* Classify each object at most once no matter how many
comparisons it is involved in. */ comparisons it is involved in. */
@@ -296,7 +291,7 @@ const genericptr vptr2;
return (int) (val1 - val2); return (int) (val1 - val2);
/* skip sub-classes when ordering by sortpack+invlet */ /* skip sub-classes when ordering by sortpack+invlet */
if ((sortlootmode & SORTLOOT_INVLET) == 0) { if ((g.sortlootmode & SORTLOOT_INVLET) == 0) {
/* Class matches; sort by subclass. */ /* Class matches; sort by subclass. */
val1 = sli1->subclass; val1 = sli1->subclass;
val2 = sli2->subclass; val2 = sli2->subclass;
@@ -321,7 +316,7 @@ const genericptr vptr2;
} }
/* order by assigned inventory letter */ /* order by assigned inventory letter */
if ((sortlootmode & SORTLOOT_INVLET) != 0) { if ((g.sortlootmode & SORTLOOT_INVLET) != 0) {
c = obj1->invlet; c = obj1->invlet;
val1 = ('a' <= c && c <= 'z') ? (c - 'a' + 2) val1 = ('a' <= c && c <= 'z') ? (c - 'a' + 2)
: ('A' <= c && c <= 'Z') ? (c - 'A' + 2 + 26) : ('A' <= c && c <= 'Z') ? (c - 'A' + 2 + 26)
@@ -338,7 +333,7 @@ const genericptr vptr2;
return val1 - val2; return val1 - val2;
} }
if ((sortlootmode & SORTLOOT_LOOT) == 0) if ((g.sortlootmode & SORTLOOT_LOOT) == 0)
goto tiebreak; goto tiebreak;
/* /*
@@ -488,9 +483,9 @@ boolean FDECL((*filterfunc), (OBJ_P));
/* do the sort; if no sorting is requested, we'll just return /* do the sort; if no sorting is requested, we'll just return
a sortloot_item array reflecting the current ordering */ a sortloot_item array reflecting the current ordering */
if (mode && n > 1) { if (mode && n > 1) {
sortlootmode = mode; /* extra input for sortloot_cmp() */ g.sortlootmode = mode; /* extra input for sortloot_cmp() */
qsort((genericptr_t) sliarray, n, sizeof *sliarray, sortloot_cmp); qsort((genericptr_t) sliarray, n, sizeof *sliarray, sortloot_cmp);
sortlootmode = 0; /* reset static mode flags */ g.sortlootmode = 0; /* reset static mode flags */
/* if sortloot_cmp formatted any objects, discard their strings now */ /* if sortloot_cmp formatted any objects, discard their strings now */
for (i = 0; i < n; ++i) for (i = 0; i < n; ++i)
if (sliarray[i].str) if (sliarray[i].str)
@@ -520,7 +515,7 @@ boolean by_nexthere; /* T: traverse via obj->nexthere, F: via obj->nobj */
unsigned n, i; unsigned n, i;
boolean already_sorted = TRUE; boolean already_sorted = TRUE;
sortlootmode = mode; /* extra input for sortloot_cmp() */ g.sortlootmode = mode; /* extra input for sortloot_cmp() */
for (n = osli.indx = 0, osli.obj = *olist; (o = osli.obj) != 0; for (n = osli.indx = 0, osli.obj = *olist; (o = osli.obj) != 0;
osli = nsli) { osli = nsli) {
nsli.obj = by_nexthere ? o->nexthere : o->nobj; nsli.obj = by_nexthere ? o->nexthere : o->nobj;
@@ -544,7 +539,7 @@ boolean by_nexthere; /* T: traverse via obj->nexthere, F: via obj->nobj */
*olist = sliarray[0].obj; *olist = sliarray[0].obj;
free((genericptr_t) sliarray); free((genericptr_t) sliarray);
} }
sortlootmode = 0; g.sortlootmode = 0;
} }
#endif /*0*/ #endif /*0*/
@@ -577,7 +572,7 @@ register struct obj *otmp;
if ((i = otmp->invlet) if ((i = otmp->invlet)
&& (('a' <= i && i <= 'z') || ('A' <= i && i <= 'Z'))) && (('a' <= i && i <= 'z') || ('A' <= i && i <= 'Z')))
return; return;
for (i = lastinvnr + 1; i != lastinvnr; i++) { for (i = g.lastinvnr + 1; i != g.lastinvnr; i++) {
if (i == 52) { if (i == 52) {
i = -1; i = -1;
continue; continue;
@@ -587,7 +582,7 @@ register struct obj *otmp;
} }
otmp->invlet = otmp->invlet =
(inuse[i] ? NOINVSYM : (i < 26) ? ('a' + i) : ('A' + i - 26)); (inuse[i] ? NOINVSYM : (i < 26) ? ('a' + i) : ('A' + i - 26));
lastinvnr = i; g.lastinvnr = i;
} }
/* note: assumes ASCII; toggling a bit puts lowercase in front of uppercase */ /* note: assumes ASCII; toggling a bit puts lowercase in front of uppercase */
@@ -3809,9 +3804,6 @@ STATIC_VAR NEARDATA const char *names[] = {
STATIC_VAR NEARDATA const char oth_symbols[] = { CONTAINED_SYM, '\0' }; STATIC_VAR NEARDATA const char oth_symbols[] = { CONTAINED_SYM, '\0' };
STATIC_VAR NEARDATA const char *oth_names[] = { "Bagged/Boxed items" }; STATIC_VAR NEARDATA const char *oth_names[] = { "Bagged/Boxed items" };
STATIC_VAR NEARDATA char *invbuf = (char *) 0;
STATIC_VAR NEARDATA unsigned invbufsiz = 0;
char * char *
let_to_name(let, unpaid, showsym) let_to_name(let, unpaid, showsym)
char let; char let;
@@ -3833,36 +3825,36 @@ boolean unpaid, showsym;
len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "") len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "")
+ (oclass ? (strlen(ocsymfmt) + invbuf_sympadding) : 0); + (oclass ? (strlen(ocsymfmt) + invbuf_sympadding) : 0);
if (len > invbufsiz) { if (len > g.invbufsiz) {
if (invbuf) if (g.invbuf)
free((genericptr_t) invbuf); free((genericptr_t) g.invbuf);
invbufsiz = len + 10; /* add slop to reduce incremental realloc */ g.invbufsiz = len + 10; /* add slop to reduce incremental realloc */
invbuf = (char *) alloc(invbufsiz); g.invbuf = (char *) alloc(g.invbufsiz);
} }
if (unpaid) if (unpaid)
Strcat(strcpy(invbuf, "Unpaid "), class_name); Strcat(strcpy(g.invbuf, "Unpaid "), class_name);
else else
Strcpy(invbuf, class_name); Strcpy(g.invbuf, class_name);
if ((oclass != 0) && showsym) { if ((oclass != 0) && showsym) {
char *bp = eos(invbuf); char *bp = eos(g.invbuf);
int mlen = invbuf_sympadding - strlen(class_name); int mlen = invbuf_sympadding - strlen(class_name);
while (--mlen > 0) { while (--mlen > 0) {
*bp = ' '; *bp = ' ';
bp++; bp++;
} }
*bp = '\0'; *bp = '\0';
Sprintf(eos(invbuf), ocsymfmt, def_oc_syms[oclass].sym); Sprintf(eos(g.invbuf), ocsymfmt, def_oc_syms[oclass].sym);
} }
return invbuf; return g.invbuf;
} }
/* release the static buffer used by let_to_name() */ /* release the static buffer used by let_to_name() */
void void
free_invbuf() free_invbuf()
{ {
if (invbuf) if (g.invbuf)
free((genericptr_t) invbuf), invbuf = (char *) 0; free((genericptr_t) g.invbuf), g.invbuf = (char *) 0;
invbufsiz = 0; g.invbufsiz = 0;
} }
/* give consecutive letters to every item in inventory (for !fixinv mode); /* give consecutive letters to every item in inventory (for !fixinv mode);
@@ -3896,7 +3888,7 @@ reassign()
} }
if (i >= 52) if (i >= 52)
i = 52 - 1; i = 52 - 1;
lastinvnr = i; g.lastinvnr = i;
} }
/* #adjust command /* #adjust command
+81 -90
View File
@@ -5,15 +5,6 @@
#include "hack.h" #include "hack.h"
/* at most one of `door' and `box' should be non-null at any given time */
STATIC_VAR NEARDATA struct xlock_s {
struct rm *door;
struct obj *box;
int picktyp, /* key|pick|card for unlock, sharp vs blunt for #force */
chance, usedtime;
boolean magic_key;
} xlock;
/* occupation callbacks */ /* occupation callbacks */
STATIC_PTR int NDECL(picklock); STATIC_PTR int NDECL(picklock);
STATIC_PTR int NDECL(forcelock); STATIC_PTR int NDECL(forcelock);
@@ -40,7 +31,7 @@ boolean
picking_at(x, y) picking_at(x, y)
int x, y; int x, y;
{ {
return (boolean) (occupation == picklock && xlock.door == &levl[x][y]); return (boolean) (occupation == picklock && g.xlock.door == &levl[x][y]);
} }
/* produce an occupation string appropriate for the current activity */ /* produce an occupation string appropriate for the current activity */
@@ -56,19 +47,19 @@ lock_action()
}; };
/* if the target is currently unlocked, we're trying to lock it now */ /* if the target is currently unlocked, we're trying to lock it now */
if (xlock.door && !(xlock.door->doormask & D_LOCKED)) if (g.xlock.door && !(g.xlock.door->doormask & D_LOCKED))
return actions[0] + 2; /* "locking the door" */ return actions[0] + 2; /* "locking the door" */
else if (xlock.box && !xlock.box->olocked) else if (g.xlock.box && !g.xlock.box->olocked)
return xlock.box->otyp == CHEST ? actions[1] + 2 : actions[2] + 2; return g.xlock.box->otyp == CHEST ? actions[1] + 2 : actions[2] + 2;
/* otherwise we're trying to unlock it */ /* otherwise we're trying to unlock it */
else if (xlock.picktyp == LOCK_PICK) else if (g.xlock.picktyp == LOCK_PICK)
return actions[3]; /* "picking the lock" */ return actions[3]; /* "picking the lock" */
else if (xlock.picktyp == CREDIT_CARD) else if (g.xlock.picktyp == CREDIT_CARD)
return actions[3]; /* same as lock_pick */ return actions[3]; /* same as lock_pick */
else if (xlock.door) else if (g.xlock.door)
return actions[0]; /* "unlocking the door" */ return actions[0]; /* "unlocking the door" */
else if (xlock.box) else if (g.xlock.box)
return xlock.box->otyp == CHEST ? actions[1] : actions[2]; return g.xlock.box->otyp == CHEST ? actions[1] : actions[2];
else else
return actions[3]; return actions[3];
} }
@@ -77,44 +68,44 @@ lock_action()
STATIC_PTR int STATIC_PTR int
picklock(VOID_ARGS) picklock(VOID_ARGS)
{ {
if (xlock.box) { if (g.xlock.box) {
if (xlock.box->where != OBJ_FLOOR if (g.xlock.box->where != OBJ_FLOOR
|| xlock.box->ox != u.ux || xlock.box->oy != u.uy) { || g.xlock.box->ox != u.ux || g.xlock.box->oy != u.uy) {
return ((xlock.usedtime = 0)); /* you or it moved */ return ((g.xlock.usedtime = 0)); /* you or it moved */
} }
} else { /* door */ } else { /* door */
if (xlock.door != &(levl[u.ux + u.dx][u.uy + u.dy])) { if (g.xlock.door != &(levl[u.ux + u.dx][u.uy + u.dy])) {
return ((xlock.usedtime = 0)); /* you moved */ return ((g.xlock.usedtime = 0)); /* you moved */
} }
switch (xlock.door->doormask) { switch (g.xlock.door->doormask) {
case D_NODOOR: case D_NODOOR:
pline("This doorway has no door."); pline("This doorway has no door.");
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
case D_ISOPEN: case D_ISOPEN:
You("cannot lock an open door."); You("cannot lock an open door.");
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
case D_BROKEN: case D_BROKEN:
pline("This door is broken."); pline("This door is broken.");
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
} }
} }
if (xlock.usedtime++ >= 50 || nohands(youmonst.data)) { if (g.xlock.usedtime++ >= 50 || nohands(youmonst.data)) {
You("give up your attempt at %s.", lock_action()); You("give up your attempt at %s.", lock_action());
exercise(A_DEX, TRUE); /* even if you don't succeed */ exercise(A_DEX, TRUE); /* even if you don't succeed */
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
} }
if (rn2(100) >= xlock.chance) if (rn2(100) >= g.xlock.chance)
return 1; /* still busy */ return 1; /* still busy */
/* using the Master Key of Thievery finds traps if its bless/curse /* using the Master Key of Thievery finds traps if its bless/curse
state is adequate (non-cursed for rogues, blessed for others; state is adequate (non-cursed for rogues, blessed for others;
checked when setting up 'xlock') */ checked when setting up 'xlock') */
if ((!xlock.door ? (int) xlock.box->otrapped if ((!g.xlock.door ? (int) g.xlock.box->otrapped
: (xlock.door->doormask & D_TRAPPED) != 0) : (g.xlock.door->doormask & D_TRAPPED) != 0)
&& xlock.magic_key) { && g.xlock.magic_key) {
xlock.chance += 20; /* less effort needed next time */ g.xlock.chance += 20; /* less effort needed next time */
/* unfortunately we don't have a 'tknown' flag to record /* unfortunately we don't have a 'tknown' flag to record
"known to be trapped" so declining to disarm and then "known to be trapped" so declining to disarm and then
retrying lock manipulation will find it all over again */ retrying lock manipulation will find it all over again */
@@ -123,14 +114,14 @@ picklock(VOID_ARGS)
boolean alreadyunlocked; boolean alreadyunlocked;
/* disarming while using magic key always succeeds */ /* disarming while using magic key always succeeds */
if (xlock.door) { if (g.xlock.door) {
xlock.door->doormask &= ~D_TRAPPED; g.xlock.door->doormask &= ~D_TRAPPED;
what = "door"; what = "door";
alreadyunlocked = !(xlock.door->doormask & D_LOCKED); alreadyunlocked = !(g.xlock.door->doormask & D_LOCKED);
} else { } else {
xlock.box->otrapped = 0; g.xlock.box->otrapped = 0;
what = (xlock.box->otyp == CHEST) ? "chest" : "box"; what = (g.xlock.box->otyp == CHEST) ? "chest" : "box";
alreadyunlocked = !xlock.box->olocked; alreadyunlocked = !g.xlock.box->olocked;
} }
You("succeed in disarming the trap. The %s is still %slocked.", You("succeed in disarming the trap. The %s is still %slocked.",
what, alreadyunlocked ? "un" : ""); what, alreadyunlocked ? "un" : "");
@@ -139,30 +130,30 @@ picklock(VOID_ARGS)
You("stop %s.", lock_action()); You("stop %s.", lock_action());
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
} }
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
} }
You("succeed in %s.", lock_action()); You("succeed in %s.", lock_action());
if (xlock.door) { if (g.xlock.door) {
if (xlock.door->doormask & D_TRAPPED) { if (g.xlock.door->doormask & D_TRAPPED) {
b_trapped("door", FINGER); b_trapped("door", FINGER);
xlock.door->doormask = D_NODOOR; g.xlock.door->doormask = D_NODOOR;
unblock_point(u.ux + u.dx, u.uy + u.dy); unblock_point(u.ux + u.dx, u.uy + u.dy);
if (*in_rooms(u.ux + u.dx, u.uy + u.dy, SHOPBASE)) if (*in_rooms(u.ux + u.dx, u.uy + u.dy, SHOPBASE))
add_damage(u.ux + u.dx, u.uy + u.dy, SHOP_DOOR_COST); add_damage(u.ux + u.dx, u.uy + u.dy, SHOP_DOOR_COST);
newsym(u.ux + u.dx, u.uy + u.dy); newsym(u.ux + u.dx, u.uy + u.dy);
} else if (xlock.door->doormask & D_LOCKED) } else if (g.xlock.door->doormask & D_LOCKED)
xlock.door->doormask = D_CLOSED; g.xlock.door->doormask = D_CLOSED;
else else
xlock.door->doormask = D_LOCKED; g.xlock.door->doormask = D_LOCKED;
} else { } else {
xlock.box->olocked = !xlock.box->olocked; g.xlock.box->olocked = !g.xlock.box->olocked;
xlock.box->lknown = 1; g.xlock.box->lknown = 1;
if (xlock.box->otrapped) if (g.xlock.box->otrapped)
(void) chest_trap(xlock.box, FINGER, FALSE); (void) chest_trap(g.xlock.box, FINGER, FALSE);
} }
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
} }
void void
@@ -222,17 +213,17 @@ boolean destroyit;
STATIC_PTR int STATIC_PTR int
forcelock(VOID_ARGS) forcelock(VOID_ARGS)
{ {
if ((xlock.box->ox != u.ux) || (xlock.box->oy != u.uy)) if ((g.xlock.box->ox != u.ux) || (g.xlock.box->oy != u.uy))
return ((xlock.usedtime = 0)); /* you or it moved */ return ((g.xlock.usedtime = 0)); /* you or it moved */
if (xlock.usedtime++ >= 50 || !uwep || nohands(youmonst.data)) { if (g.xlock.usedtime++ >= 50 || !uwep || nohands(youmonst.data)) {
You("give up your attempt to force the lock."); You("give up your attempt to force the lock.");
if (xlock.usedtime >= 50) /* you made the effort */ if (g.xlock.usedtime >= 50) /* you made the effort */
exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE); exercise((g.xlock.picktyp) ? A_DEX : A_STR, TRUE);
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
} }
if (xlock.picktyp) { /* blade */ if (g.xlock.picktyp) { /* blade */
if (rn2(1000 - (int) uwep->spe) > (992 - greatest_erosion(uwep) * 10) if (rn2(1000 - (int) uwep->spe) > (992 - greatest_erosion(uwep) * 10)
&& !uwep->cursed && !obj_resists(uwep, 0, 99)) { && !uwep->cursed && !obj_resists(uwep, 0, 99)) {
/* for a +0 weapon, probability that it survives an unsuccessful /* for a +0 weapon, probability that it survives an unsuccessful
@@ -243,35 +234,35 @@ forcelock(VOID_ARGS)
useup(uwep); useup(uwep);
You("give up your attempt to force the lock."); You("give up your attempt to force the lock.");
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
} }
} else /* blunt */ } else /* blunt */
wake_nearby(); /* due to hammering on the container */ wake_nearby(); /* due to hammering on the container */
if (rn2(100) >= xlock.chance) if (rn2(100) >= g.xlock.chance)
return 1; /* still busy */ return 1; /* still busy */
You("succeed in forcing the lock."); You("succeed in forcing the lock.");
breakchestlock(xlock.box, (boolean) (!xlock.picktyp && !rn2(3))); breakchestlock(g.xlock.box, (boolean) (!g.xlock.picktyp && !rn2(3)));
exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE); exercise((g.xlock.picktyp) ? A_DEX : A_STR, TRUE);
return ((xlock.usedtime = 0)); return ((g.xlock.usedtime = 0));
} }
void void
reset_pick() reset_pick()
{ {
xlock.usedtime = xlock.chance = xlock.picktyp = 0; g.xlock.usedtime = g.xlock.chance = g.xlock.picktyp = 0;
xlock.magic_key = FALSE; g.xlock.magic_key = FALSE;
xlock.door = 0; g.xlock.door = 0;
xlock.box = 0; g.xlock.box = 0;
} }
/* level change; don't reset if hero is carrying xlock.box with him/her */ /* level change; don't reset if hero is carrying xlock.box with him/her */
void void
maybe_reset_pick() maybe_reset_pick()
{ {
if (!xlock.box || !carried(xlock.box)) if (!g.xlock.box || !carried(g.xlock.box))
reset_pick(); reset_pick();
} }
@@ -297,7 +288,7 @@ struct obj *pick;
picktyp = pick->otyp; picktyp = pick->otyp;
/* check whether we're resuming an interrupted previous attempt */ /* check whether we're resuming an interrupted previous attempt */
if (xlock.usedtime && picktyp == xlock.picktyp) { if (g.xlock.usedtime && picktyp == g.xlock.picktyp) {
static char no_longer[] = "Unfortunately, you can no longer %s %s."; static char no_longer[] = "Unfortunately, you can no longer %s %s.";
if (nohands(youmonst.data)) { if (nohands(youmonst.data)) {
@@ -308,7 +299,7 @@ struct obj *pick;
pline(no_longer, "hold the", what); pline(no_longer, "hold the", what);
reset_pick(); reset_pick();
return PICKLOCK_LEARNED_SOMETHING; return PICKLOCK_LEARNED_SOMETHING;
} else if (u.uswallow || (xlock.box && !can_reach_floor(TRUE))) { } else if (u.uswallow || (g.xlock.box && !can_reach_floor(TRUE))) {
pline(no_longer, "reach the", "lock"); pline(no_longer, "reach the", "lock");
reset_pick(); reset_pick();
return PICKLOCK_LEARNED_SOMETHING; return PICKLOCK_LEARNED_SOMETHING;
@@ -316,7 +307,7 @@ struct obj *pick;
const char *action = lock_action(); const char *action = lock_action();
You("resume your attempt at %s.", action); You("resume your attempt at %s.", action);
xlock.magic_key = is_magic_key(&youmonst, pick); g.xlock.magic_key = is_magic_key(&youmonst, pick);
set_occupation(picklock, action, 0); set_occupation(picklock, action, 0);
return PICKLOCK_DID_SOMETHING; return PICKLOCK_DID_SOMETHING;
} }
@@ -416,8 +407,8 @@ struct obj *pick;
if (otmp->cursed) if (otmp->cursed)
ch /= 2; ch /= 2;
xlock.box = otmp; g.xlock.box = otmp;
xlock.door = 0; g.xlock.door = 0;
break; break;
} }
if (c != 'y') { if (c != 'y') {
@@ -495,15 +486,15 @@ struct obj *pick;
default: default:
ch = 0; ch = 0;
} }
xlock.door = door; g.xlock.door = door;
xlock.box = 0; g.xlock.box = 0;
} }
} }
context.move = 0; context.move = 0;
xlock.chance = ch; g.xlock.chance = ch;
xlock.picktyp = picktyp; g.xlock.picktyp = picktyp;
xlock.magic_key = is_magic_key(&youmonst, pick); g.xlock.magic_key = is_magic_key(&youmonst, pick);
xlock.usedtime = 0; g.xlock.usedtime = 0;
set_occupation(picklock, lock_action(), 0); set_occupation(picklock, lock_action(), 0);
return PICKLOCK_DID_SOMETHING; return PICKLOCK_DID_SOMETHING;
} }
@@ -539,14 +530,14 @@ doforce()
} }
picktyp = is_blade(uwep) && !is_pick(uwep); picktyp = is_blade(uwep) && !is_pick(uwep);
if (xlock.usedtime && xlock.box && picktyp == xlock.picktyp) { if (g.xlock.usedtime && g.xlock.box && picktyp == g.xlock.picktyp) {
You("resume your attempt to force the lock."); You("resume your attempt to force the lock.");
set_occupation(forcelock, "forcing the lock", 0); set_occupation(forcelock, "forcing the lock", 0);
return 1; return 1;
} }
/* A lock is made only for the honest man, the thief will break it. */ /* A lock is made only for the honest man, the thief will break it. */
xlock.box = (struct obj *) 0; g.xlock.box = (struct obj *) 0;
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) { if (Is_box(otmp)) {
if (otmp->obroken || !otmp->olocked) { if (otmp->obroken || !otmp->olocked) {
@@ -574,15 +565,15 @@ doforce()
You("force %s into a crack and pry.", yname(uwep)); You("force %s into a crack and pry.", yname(uwep));
else else
You("start bashing it with %s.", yname(uwep)); You("start bashing it with %s.", yname(uwep));
xlock.box = otmp; g.xlock.box = otmp;
xlock.chance = objects[uwep->otyp].oc_wldam * 2; g.xlock.chance = objects[uwep->otyp].oc_wldam * 2;
xlock.picktyp = picktyp; g.xlock.picktyp = picktyp;
xlock.magic_key = FALSE; g.xlock.magic_key = FALSE;
xlock.usedtime = 0; g.xlock.usedtime = 0;
break; break;
} }
if (xlock.box) if (g.xlock.box)
set_occupation(forcelock, "forcing the lock", 0); set_occupation(forcelock, "forcing the lock", 0);
else else
You("decide not to force the issue."); You("decide not to force the issue.");
@@ -890,7 +881,7 @@ struct obj *obj, *otmp; /* obj *is* a box */
case SPE_POLYMORPH: case SPE_POLYMORPH:
/* maybe start unlocking chest, get interrupted, then zap it; /* maybe start unlocking chest, get interrupted, then zap it;
we must avoid any attempt to resume unlocking it */ we must avoid any attempt to resume unlocking it */
if (xlock.box == obj) if (g.xlock.box == obj)
reset_pick(); reset_pick();
break; break;
} }
+9 -9
View File
@@ -48,10 +48,10 @@ static const int explcolors[] = {
#if defined(USE_TILES) && defined(MSDOS) #if defined(USE_TILES) && defined(MSDOS)
#define HAS_ROGUE_IBM_GRAPHICS \ #define HAS_ROGUE_IBM_GRAPHICS \
(currentgraphics == ROGUESET && SYMHANDLING(H_IBM) && !iflags.grmode) (g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM) && !iflags.grmode)
#else #else
#define HAS_ROGUE_IBM_GRAPHICS \ #define HAS_ROGUE_IBM_GRAPHICS \
(currentgraphics == ROGUESET && SYMHANDLING(H_IBM)) (g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM))
#endif #endif
#define is_objpile(x,y) (!Hallucination && level.objects[(x)][(y)] \ #define is_objpile(x,y) (!Hallucination && level.objects[(x)][(y)] \
@@ -71,7 +71,7 @@ unsigned *ospecial;
/* condense multiple tests in macro version down to single */ /* condense multiple tests in macro version down to single */
boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS; boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS;
boolean has_rogue_color = (has_rogue_ibm_graphics boolean has_rogue_color = (has_rogue_ibm_graphics
&& symset[currentgraphics].nocolor == 0); && g.symset[g.currentgraphics].nocolor == 0);
/* /*
* Map the glyph back to a character and color. * Map the glyph back to a character and color.
@@ -129,14 +129,14 @@ unsigned *ospecial;
/* provide a visible difference if normal and lit corridor /* provide a visible difference if normal and lit corridor
use the same symbol */ use the same symbol */
} else if (iflags.use_color && offset == S_litcorr } else if (iflags.use_color && offset == S_litcorr
&& showsyms[idx] == showsyms[S_corr + SYM_OFF_P]) { && g.showsyms[idx] == g.showsyms[S_corr + SYM_OFF_P]) {
color = CLR_WHITE; color = CLR_WHITE;
#endif #endif
/* try to provide a visible difference between water and lava /* try to provide a visible difference between water and lava
if they use the same symbol and color is disabled */ if they use the same symbol and color is disabled */
} else if (!iflags.use_color && offset == S_lava } else if (!iflags.use_color && offset == S_lava
&& (showsyms[idx] == showsyms[S_pool + SYM_OFF_P] && (g.showsyms[idx] == g.showsyms[S_pool + SYM_OFF_P]
|| showsyms[idx] == showsyms[S_water + SYM_OFF_P])) { || g.showsyms[idx] == g.showsyms[S_water + SYM_OFF_P])) {
special |= MG_BW_LAVA; special |= MG_BW_LAVA;
} else { } else {
cmap_color(offset); cmap_color(offset);
@@ -222,7 +222,7 @@ unsigned *ospecial;
} }
} }
ch = showsyms[idx]; ch = g.showsyms[idx];
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
/* Turn off color if no color defined, or rogue level w/o PC graphics. */ /* Turn off color if no color defined, or rogue level w/o PC graphics. */
if (!has_color(color) || (Is_rogue_level(&u.uz) && !has_rogue_color)) if (!has_color(color) || (Is_rogue_level(&u.uz) && !has_rogue_color))
@@ -283,7 +283,7 @@ const char *str;
else else
break; break;
so = mapglyph(gv, &ch, &oc, &os, 0, 0); so = mapglyph(gv, &ch, &oc, &os, 0, 0);
*put++ = showsyms[so]; *put++ = g.showsyms[so];
/* 'str' is ready for the next loop iteration and '*str' /* 'str' is ready for the next loop iteration and '*str'
should not be copied at the end of this iteration */ should not be copied at the end of this iteration */
continue; continue;
@@ -308,7 +308,7 @@ const char *str;
else else
break; break;
} }
*put++ = showsyms[so]; *put++ = g.showsyms[so];
break; break;
#endif #endif
case '\\': case '\\':
+92 -101
View File
@@ -6,10 +6,6 @@
#include "hack.h" #include "hack.h"
#include "artifact.h" #include "artifact.h"
static NEARDATA boolean vis, far_noise;
static NEARDATA long noisetime;
static NEARDATA struct obj *otmp;
static const char brief_feeling[] = static const char brief_feeling[] =
"have a %s feeling for a moment, then it passes."; "have a %s feeling for a moment, then it passes.";
@@ -32,11 +28,6 @@ STATIC_DCL void FDECL(missmm, (struct monst *, struct monst *,
STATIC_DCL int FDECL(passivemm, (struct monst *, struct monst *, STATIC_DCL int FDECL(passivemm, (struct monst *, struct monst *,
BOOLEAN_P, int)); BOOLEAN_P, int));
/* Needed for the special case of monsters wielding vorpal blades (rare).
* If we use this a lot it should probably be a parameter to mdamagem()
* instead of a global variable.
*/
static int dieroll;
/* returns mon_nam(mon) relative to other_mon; normal name unless they're /* returns mon_nam(mon) relative to other_mon; normal name unless they're
the same, in which case the reference is to {him|her|it} self */ the same, in which case the reference is to {him|her|it} self */
@@ -69,9 +60,9 @@ register struct attack *mattk;
{ {
boolean farq = (distu(magr->mx, magr->my) > 15); boolean farq = (distu(magr->mx, magr->my) > 15);
if (!Deaf && (farq != far_noise || moves - noisetime > 10)) { if (!Deaf && (farq != g.far_noise || moves - g.noisetime > 10)) {
far_noise = farq; g.far_noise = farq;
noisetime = moves; g.noisetime = moves;
You_hear("%s%s.", You_hear("%s%s.",
(mattk->aatyp == AT_EXPL) ? "an explosion" : "some noises", (mattk->aatyp == AT_EXPL) ? "an explosion" : "some noises",
farq ? " in the distance" : ""); farq ? " in the distance" : "");
@@ -87,7 +78,7 @@ struct attack *mattk;
const char *fmt; const char *fmt;
char buf[BUFSZ], mdef_name[BUFSZ]; char buf[BUFSZ], mdef_name[BUFSZ];
if (vis) { if (g.vis) {
if (!canspotmon(magr)) if (!canspotmon(magr))
map_invisible(magr->mx, magr->my); map_invisible(magr->mx, magr->my);
if (!canspotmon(mdef)) if (!canspotmon(mdef))
@@ -235,7 +226,7 @@ boolean quietly;
* You can observe monster displacement if you can see both of * You can observe monster displacement if you can see both of
* the monsters involved. * the monsters involved.
*/ */
vis = (canspotmon(magr) && canspotmon(mdef)); g.vis = (canspotmon(magr) && canspotmon(mdef));
if (touch_petrifies(pd) && !resists_ston(magr)) { if (touch_petrifies(pd) && !resists_ston(magr)) {
if (which_armor(magr, W_ARMG) != 0) { if (which_armor(magr, W_ARMG) != 0) {
@@ -248,7 +239,7 @@ boolean quietly;
monstone(magr); monstone(magr);
if (!DEADMONSTER(magr)) if (!DEADMONSTER(magr))
return MM_HIT; /* lifesaved */ return MM_HIT; /* lifesaved */
else if (magr->mtame && !vis) else if (magr->mtame && !g.vis)
You(brief_feeling, "peculiarly sad"); You(brief_feeling, "peculiarly sad");
return MM_AGR_DIED; return MM_AGR_DIED;
} }
@@ -258,7 +249,7 @@ boolean quietly;
remove_monster(tx, ty); remove_monster(tx, ty);
place_monster(magr, tx, ty); /* put down at target spot */ place_monster(magr, tx, ty); /* put down at target spot */
place_monster(mdef, fx, fy); place_monster(mdef, fx, fy);
if (vis && !quietly) if (g.vis && !quietly)
pline("%s moves %s out of %s way!", Monnam(magr), mon_nam(mdef), pline("%s moves %s out of %s way!", Monnam(magr), mon_nam(mdef),
is_rider(pa) ? "the" : mhis(magr)); is_rider(pa) ? "the" : mhis(magr));
newsym(fx, fy); /* see it */ newsym(fx, fy); /* see it */
@@ -343,7 +334,7 @@ register struct monst *magr, *mdef;
tmp++; tmp++;
/* Set up the visibility of action */ /* Set up the visibility of action */
vis = (cansee(magr->mx, magr->my) && cansee(mdef->mx, mdef->my) g.vis = (cansee(magr->mx, magr->my) && cansee(mdef->mx, mdef->my)
&& (canspotmon(magr) || canspotmon(mdef))); && (canspotmon(magr) || canspotmon(mdef)));
/* Set flag indicating monster has moved this turn. Necessary since a /* Set flag indicating monster has moved this turn. Necessary since a
@@ -357,7 +348,7 @@ register struct monst *magr, *mdef;
for (i = 0; i < NATTK; i++) { for (i = 0; i < NATTK; i++) {
res[i] = MM_MISS; res[i] = MM_MISS;
mattk = getmattk(magr, mdef, i, res, &alt_attk); mattk = getmattk(magr, mdef, i, res, &alt_attk);
otmp = (struct obj *) 0; g.otmp = (struct obj *) 0;
attk = 1; attk = 1;
switch (mattk->aatyp) { switch (mattk->aatyp) {
case AT_WEAP: /* "hand to hand" attacks */ case AT_WEAP: /* "hand to hand" attacks */
@@ -376,12 +367,12 @@ register struct monst *magr, *mdef;
return 0; return 0;
} }
possibly_unwield(magr, FALSE); possibly_unwield(magr, FALSE);
otmp = MON_WEP(magr); g.otmp = MON_WEP(magr);
if (otmp) { if (g.otmp) {
if (vis) if (g.vis)
mswingsm(magr, mdef, otmp); mswingsm(magr, mdef, g.otmp);
tmp += hitval(otmp, mdef); tmp += hitval(g.otmp, mdef);
} }
/*FALLTHRU*/ /*FALLTHRU*/
case AT_CLAW: case AT_CLAW:
@@ -399,26 +390,26 @@ register struct monst *magr, *mdef;
* have a weapon instead. This instinct doesn't work for * have a weapon instead. This instinct doesn't work for
* players, or under conflict or confusion. * players, or under conflict or confusion.
*/ */
if (!magr->mconf && !Conflict && otmp && mattk->aatyp != AT_WEAP if (!magr->mconf && !Conflict && g.otmp && mattk->aatyp != AT_WEAP
&& touch_petrifies(mdef->data)) { && touch_petrifies(mdef->data)) {
strike = 0; strike = 0;
break; break;
} }
dieroll = rnd(20 + i); g.dieroll = rnd(20 + i);
strike = (tmp > dieroll); strike = (tmp > g.dieroll);
/* KMH -- don't accumulate to-hit bonuses */ /* KMH -- don't accumulate to-hit bonuses */
if (otmp) if (g.otmp)
tmp -= hitval(otmp, mdef); tmp -= hitval(g.otmp, mdef);
if (strike) { if (strike) {
res[i] = hitmm(magr, mdef, mattk); res[i] = hitmm(magr, mdef, mattk);
if ((mdef->data == &mons[PM_BLACK_PUDDING] if ((mdef->data == &mons[PM_BLACK_PUDDING]
|| mdef->data == &mons[PM_BROWN_PUDDING]) || mdef->data == &mons[PM_BROWN_PUDDING])
&& (otmp && (objects[otmp->otyp].oc_material == IRON && (g.otmp && (objects[g.otmp->otyp].oc_material == IRON
|| objects[otmp->otyp].oc_material == METAL)) || objects[g.otmp->otyp].oc_material == METAL))
&& mdef->mhp > 1 && mdef->mhp > 1
&& !mdef->mcan) { && !mdef->mcan) {
if (clone_mon(mdef, 0, 0)) { if (clone_mon(mdef, 0, 0)) {
if (vis && canspotmon(mdef)) { if (g.vis && canspotmon(mdef)) {
char buf[BUFSZ]; char buf[BUFSZ];
Strcpy(buf, Monnam(mdef)); Strcpy(buf, Monnam(mdef));
@@ -533,7 +524,7 @@ hitmm(magr, mdef, mattk)
register struct monst *magr, *mdef; register struct monst *magr, *mdef;
struct attack *mattk; struct attack *mattk;
{ {
if (vis) { if (g.vis) {
int compat; int compat;
char buf[BUFSZ], mdef_name[BUFSZ]; char buf[BUFSZ], mdef_name[BUFSZ];
@@ -595,7 +586,7 @@ struct attack *mattk;
{ {
char buf[BUFSZ]; char buf[BUFSZ];
if (vis) { if (g.vis) {
if (mdef->data->mlet == S_MIMIC if (mdef->data->mlet == S_MIMIC
&& mdef->m_ap_type != M_AP_NOTHING) && mdef->m_ap_type != M_AP_NOTHING)
seemimic(mdef); seemimic(mdef);
@@ -606,7 +597,7 @@ struct attack *mattk;
if (magr->mcan || !magr->mcansee || !mdef->mcansee if (magr->mcan || !magr->mcansee || !mdef->mcansee
|| (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) { || (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) {
if (vis && canspotmon(mdef)) if (g.vis && canspotmon(mdef))
pline("but nothing happens."); pline("but nothing happens.");
return MM_MISS; return MM_MISS;
} }
@@ -687,7 +678,7 @@ register struct attack *mattk;
if (!engulf_target(magr, mdef)) if (!engulf_target(magr, mdef))
return MM_MISS; return MM_MISS;
if (vis) { if (g.vis) {
/* [this two-part formatting dates back to when only one x_monnam /* [this two-part formatting dates back to when only one x_monnam
result could be included in an expression because the next one result could be included in an expression because the next one
would overwrite first's result -- that's no longer the case] */ would overwrite first's result -- that's no longer the case] */
@@ -699,7 +690,7 @@ register struct attack *mattk;
if (is_vampshifter(mdef) if (is_vampshifter(mdef)
&& newcham(mdef, &mons[mdef->cham], FALSE, FALSE)) { && newcham(mdef, &mons[mdef->cham], FALSE, FALSE)) {
if (vis) { if (g.vis) {
/* 'it' -- previous form is no longer available and /* 'it' -- previous form is no longer available and
using that would be excessively verbose */ using that would be excessively verbose */
pline("%s expels %s.", Monnam(magr), pline("%s expels %s.", Monnam(magr),
@@ -821,7 +812,7 @@ register struct attack *mattk;
wornitems = magr->misc_worn_check; wornitems = magr->misc_worn_check;
/* wielded weapon gives same protection as gloves here */ /* wielded weapon gives same protection as gloves here */
if (otmp != 0) if (g.otmp != 0)
wornitems |= W_ARMG; wornitems |= W_ARMG;
if (protector == 0L if (protector == 0L
@@ -830,12 +821,12 @@ register struct attack *mattk;
mon_to_stone(magr); mon_to_stone(magr);
return MM_HIT; /* no damage during the polymorph */ return MM_HIT; /* no damage during the polymorph */
} }
if (vis && canspotmon(magr)) if (g.vis && canspotmon(magr))
pline("%s turns to stone!", Monnam(magr)); pline("%s turns to stone!", Monnam(magr));
monstone(magr); monstone(magr);
if (!DEADMONSTER(magr)) if (!DEADMONSTER(magr))
return MM_HIT; /* lifesaved */ return MM_HIT; /* lifesaved */
else if (magr->mtame && !vis) else if (magr->mtame && !g.vis)
You(brief_feeling, "peculiarly sad"); You(brief_feeling, "peculiarly sad");
return MM_AGR_DIED; return MM_AGR_DIED;
} }
@@ -849,7 +840,7 @@ register struct attack *mattk;
case AD_DGST: case AD_DGST:
/* eating a Rider or its corpse is fatal */ /* eating a Rider or its corpse is fatal */
if (is_rider(pd)) { if (is_rider(pd)) {
if (vis && canseemon(magr)) if (g.vis && canseemon(magr))
pline("%s %s!", Monnam(magr), pline("%s %s!", Monnam(magr),
(pd == &mons[PM_FAMINE]) (pd == &mons[PM_FAMINE])
? "belches feebly, shrivels up and dies" ? "belches feebly, shrivels up and dies"
@@ -859,7 +850,7 @@ register struct attack *mattk;
mondied(magr); mondied(magr);
if (!DEADMONSTER(magr)) if (!DEADMONSTER(magr))
return 0; /* lifesaved */ return 0; /* lifesaved */
else if (magr->mtame && !vis) else if (magr->mtame && !g.vis)
You(brief_feeling, "queasy"); You(brief_feeling, "queasy");
return MM_AGR_DIED; return MM_AGR_DIED;
} }
@@ -917,26 +908,26 @@ register struct attack *mattk;
if (mattk->aatyp == AT_KICK && thick_skinned(pd)) { if (mattk->aatyp == AT_KICK && thick_skinned(pd)) {
tmp = 0; tmp = 0;
} else if (mattk->aatyp == AT_WEAP) { } else if (mattk->aatyp == AT_WEAP) {
if (otmp) { if (g.otmp) {
struct obj *marmg; struct obj *marmg;
if (otmp->otyp == CORPSE if (g.otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm])) && touch_petrifies(&mons[g.otmp->corpsenm]))
goto do_stone; goto do_stone;
tmp += dmgval(otmp, mdef); tmp += dmgval(g.otmp, mdef);
if ((marmg = which_armor(magr, W_ARMG)) != 0 if ((marmg = which_armor(magr, W_ARMG)) != 0
&& marmg->otyp == GAUNTLETS_OF_POWER) && marmg->otyp == GAUNTLETS_OF_POWER)
tmp += rn1(4, 3); /* 3..6 */ tmp += rn1(4, 3); /* 3..6 */
if (tmp < 1) /* is this necessary? mhitu.c has it... */ if (tmp < 1) /* is this necessary? mhitu.c has it... */
tmp = 1; tmp = 1;
if (otmp->oartifact) { if (g.otmp->oartifact) {
(void) artifact_hit(magr, mdef, otmp, &tmp, dieroll); (void) artifact_hit(magr, mdef, g.otmp, &tmp, g.dieroll);
if (DEADMONSTER(mdef)) if (DEADMONSTER(mdef))
return (MM_DEF_DIED return (MM_DEF_DIED
| (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
} }
if (tmp) if (tmp)
rustm(mdef, otmp); rustm(mdef, g.otmp);
} }
} else if (pa == &mons[PM_PURPLE_WORM] && pd == &mons[PM_SHRIEKER]) { } else if (pa == &mons[PM_PURPLE_WORM] && pd == &mons[PM_SHRIEKER]) {
/* hack to enhance mm_aggression(); we don't want purple /* hack to enhance mm_aggression(); we don't want purple
@@ -952,22 +943,22 @@ register struct attack *mattk;
tmp = 0; tmp = 0;
break; break;
} }
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s is %s!", Monnam(mdef), on_fire(pd, mattk)); pline("%s is %s!", Monnam(mdef), on_fire(pd, mattk));
if (completelyburns(pd)) { /* paper golem or straw golem */ if (completelyburns(pd)) { /* paper golem or straw golem */
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s burns completely!", Monnam(mdef)); pline("%s burns completely!", Monnam(mdef));
mondead(mdef); /* was mondied() but that dropped paper scrolls */ mondead(mdef); /* was mondied() but that dropped paper scrolls */
if (!DEADMONSTER(mdef)) if (!DEADMONSTER(mdef))
return 0; return 0;
else if (mdef->mtame && !vis) else if (mdef->mtame && !g.vis)
pline("May %s roast in peace.", mon_nam(mdef)); pline("May %s roast in peace.", mon_nam(mdef));
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
} }
tmp += destroy_mitem(mdef, SCROLL_CLASS, AD_FIRE); tmp += destroy_mitem(mdef, SCROLL_CLASS, AD_FIRE);
tmp += destroy_mitem(mdef, SPBOOK_CLASS, AD_FIRE); tmp += destroy_mitem(mdef, SPBOOK_CLASS, AD_FIRE);
if (resists_fire(mdef)) { if (resists_fire(mdef)) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline_The("fire doesn't seem to burn %s!", mon_nam(mdef)); pline_The("fire doesn't seem to burn %s!", mon_nam(mdef));
shieldeff(mdef->mx, mdef->my); shieldeff(mdef->mx, mdef->my);
golemeffects(mdef, AD_FIRE, tmp); golemeffects(mdef, AD_FIRE, tmp);
@@ -981,10 +972,10 @@ register struct attack *mattk;
tmp = 0; tmp = 0;
break; break;
} }
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s is covered in frost!", Monnam(mdef)); pline("%s is covered in frost!", Monnam(mdef));
if (resists_cold(mdef)) { if (resists_cold(mdef)) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline_The("frost doesn't seem to chill %s!", mon_nam(mdef)); pline_The("frost doesn't seem to chill %s!", mon_nam(mdef));
shieldeff(mdef->mx, mdef->my); shieldeff(mdef->mx, mdef->my);
golemeffects(mdef, AD_COLD, tmp); golemeffects(mdef, AD_COLD, tmp);
@@ -997,11 +988,11 @@ register struct attack *mattk;
tmp = 0; tmp = 0;
break; break;
} }
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s gets zapped!", Monnam(mdef)); pline("%s gets zapped!", Monnam(mdef));
tmp += destroy_mitem(mdef, WAND_CLASS, AD_ELEC); tmp += destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
if (resists_elec(mdef)) { if (resists_elec(mdef)) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline_The("zap doesn't shock %s!", mon_nam(mdef)); pline_The("zap doesn't shock %s!", mon_nam(mdef));
shieldeff(mdef->mx, mdef->my); shieldeff(mdef->mx, mdef->my);
golemeffects(mdef, AD_ELEC, tmp); golemeffects(mdef, AD_ELEC, tmp);
@@ -1016,11 +1007,11 @@ register struct attack *mattk;
break; break;
} }
if (resists_acid(mdef)) { if (resists_acid(mdef)) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s is covered in %s, but it seems harmless.", pline("%s is covered in %s, but it seems harmless.",
Monnam(mdef), hliquid("acid")); Monnam(mdef), hliquid("acid"));
tmp = 0; tmp = 0;
} else if (vis && canseemon(mdef)) { } else if (g.vis && canseemon(mdef)) {
pline("%s is covered in %s!", Monnam(mdef), hliquid("acid")); pline("%s is covered in %s!", Monnam(mdef), hliquid("acid"));
pline("It burns %s!", mon_nam(mdef)); pline("It burns %s!", mon_nam(mdef));
} }
@@ -1033,12 +1024,12 @@ register struct attack *mattk;
if (magr->mcan) if (magr->mcan)
break; break;
if (pd == &mons[PM_IRON_GOLEM]) { if (pd == &mons[PM_IRON_GOLEM]) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s falls to pieces!", Monnam(mdef)); pline("%s falls to pieces!", Monnam(mdef));
mondied(mdef); mondied(mdef);
if (!DEADMONSTER(mdef)) if (!DEADMONSTER(mdef))
return 0; return 0;
else if (mdef->mtame && !vis) else if (mdef->mtame && !g.vis)
pline("May %s rust in peace.", mon_nam(mdef)); pline("May %s rust in peace.", mon_nam(mdef));
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
} }
@@ -1057,12 +1048,12 @@ register struct attack *mattk;
if (magr->mcan) if (magr->mcan)
break; break;
if (pd == &mons[PM_WOOD_GOLEM] || pd == &mons[PM_LEATHER_GOLEM]) { if (pd == &mons[PM_WOOD_GOLEM] || pd == &mons[PM_LEATHER_GOLEM]) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s falls to pieces!", Monnam(mdef)); pline("%s falls to pieces!", Monnam(mdef));
mondied(mdef); mondied(mdef);
if (!DEADMONSTER(mdef)) if (!DEADMONSTER(mdef))
return 0; return 0;
else if (mdef->mtame && !vis) else if (mdef->mtame && !g.vis)
pline("May %s rot in peace.", mon_nam(mdef)); pline("May %s rot in peace.", mon_nam(mdef));
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
} }
@@ -1083,13 +1074,13 @@ register struct attack *mattk;
break; break;
} }
if (!resists_ston(mdef)) { if (!resists_ston(mdef)) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s turns to stone!", Monnam(mdef)); pline("%s turns to stone!", Monnam(mdef));
monstone(mdef); monstone(mdef);
post_stone: post_stone:
if (!DEADMONSTER(mdef)) if (!DEADMONSTER(mdef))
return 0; return 0;
else if (mdef->mtame && !vis) else if (mdef->mtame && !g.vis)
You(brief_feeling, "peculiarly sad"); You(brief_feeling, "peculiarly sad");
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
} }
@@ -1101,18 +1092,18 @@ register struct attack *mattk;
boolean wasseen = canspotmon(mdef); boolean wasseen = canspotmon(mdef);
/* save the name before monster teleports, otherwise /* save the name before monster teleports, otherwise
we'll get "it" in the suddenly disappears message */ we'll get "it" in the suddenly disappears message */
if (vis && wasseen) if (g.vis && wasseen)
Strcpy(mdef_Monnam, Monnam(mdef)); Strcpy(mdef_Monnam, Monnam(mdef));
mdef->mstrategy &= ~STRAT_WAITFORU; mdef->mstrategy &= ~STRAT_WAITFORU;
(void) rloc(mdef, TRUE); (void) rloc(mdef, TRUE);
if (vis && wasseen && !canspotmon(mdef) && mdef != u.usteed) if (g.vis && wasseen && !canspotmon(mdef) && mdef != u.usteed)
pline("%s suddenly disappears!", mdef_Monnam); pline("%s suddenly disappears!", mdef_Monnam);
} }
break; break;
case AD_SLEE: case AD_SLEE:
if (!cancelled && !mdef->msleeping if (!cancelled && !mdef->msleeping
&& sleep_monst(mdef, rnd(10), -1)) { && sleep_monst(mdef, rnd(10), -1)) {
if (vis && canspotmon(mdef)) { if (g.vis && canspotmon(mdef)) {
Strcpy(buf, Monnam(mdef)); Strcpy(buf, Monnam(mdef));
pline("%s is put to sleep by %s.", buf, mon_nam(magr)); pline("%s is put to sleep by %s.", buf, mon_nam(magr));
} }
@@ -1122,7 +1113,7 @@ register struct attack *mattk;
break; break;
case AD_PLYS: case AD_PLYS:
if (!cancelled && mdef->mcanmove) { if (!cancelled && mdef->mcanmove) {
if (vis && canspotmon(mdef)) { if (g.vis && canspotmon(mdef)) {
Strcpy(buf, Monnam(mdef)); Strcpy(buf, Monnam(mdef));
pline("%s is frozen by %s.", buf, mon_nam(magr)); pline("%s is frozen by %s.", buf, mon_nam(magr));
} }
@@ -1135,7 +1126,7 @@ register struct attack *mattk;
mon_adjust_speed(mdef, -1, (struct obj *) 0); mon_adjust_speed(mdef, -1, (struct obj *) 0);
mdef->mstrategy &= ~STRAT_WAITFORU; mdef->mstrategy &= ~STRAT_WAITFORU;
if (mdef->mspeed != oldspeed && vis && canspotmon(mdef)) if (mdef->mspeed != oldspeed && g.vis && canspotmon(mdef))
pline("%s slows down.", Monnam(mdef)); pline("%s slows down.", Monnam(mdef));
} }
break; break;
@@ -1145,7 +1136,7 @@ register struct attack *mattk;
* we still should check for it). * we still should check for it).
*/ */
if (!magr->mcan && !mdef->mconf && !magr->mspec_used) { if (!magr->mcan && !mdef->mconf && !magr->mspec_used) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s looks confused.", Monnam(mdef)); pline("%s looks confused.", Monnam(mdef));
mdef->mconf = 1; mdef->mconf = 1;
mdef->mstrategy &= ~STRAT_WAITFORU; mdef->mstrategy &= ~STRAT_WAITFORU;
@@ -1155,7 +1146,7 @@ register struct attack *mattk;
if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) { if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
register unsigned rnd_tmp; register unsigned rnd_tmp;
if (vis && mdef->mcansee && canspotmon(mdef)) if (g.vis && mdef->mcansee && canspotmon(mdef))
pline("%s is blinded.", Monnam(mdef)); pline("%s is blinded.", Monnam(mdef));
rnd_tmp = d((int) mattk->damn, (int) mattk->damd); rnd_tmp = d((int) mattk->damn, (int) mattk->damd);
if ((rnd_tmp += mdef->mblinded) > 127) if ((rnd_tmp += mdef->mblinded) > 127)
@@ -1168,7 +1159,7 @@ register struct attack *mattk;
break; break;
case AD_HALU: case AD_HALU:
if (!magr->mcan && haseyes(pd) && mdef->mcansee) { if (!magr->mcan && haseyes(pd) && mdef->mcansee) {
if (vis && canseemon(mdef)) if (g.vis && canseemon(mdef))
pline("%s looks %sconfused.", Monnam(mdef), pline("%s looks %sconfused.", Monnam(mdef),
mdef->mconf ? "more " : ""); mdef->mconf ? "more " : "");
mdef->mconf = 1; mdef->mconf = 1;
@@ -1185,7 +1176,7 @@ register struct attack *mattk;
if (is_were(pd) && pd->mlet != S_HUMAN) if (is_were(pd) && pd->mlet != S_HUMAN)
were_change(mdef); were_change(mdef);
if (pd == &mons[PM_CLAY_GOLEM]) { if (pd == &mons[PM_CLAY_GOLEM]) {
if (vis && canseemon(mdef)) { if (g.vis && canseemon(mdef)) {
pline("Some writing vanishes from %s head!", pline("Some writing vanishes from %s head!",
s_suffix(mon_nam(mdef))); s_suffix(mon_nam(mdef)));
pline("%s is destroyed!", Monnam(mdef)); pline("%s is destroyed!", Monnam(mdef));
@@ -1193,13 +1184,13 @@ register struct attack *mattk;
mondied(mdef); mondied(mdef);
if (!DEADMONSTER(mdef)) if (!DEADMONSTER(mdef))
return 0; return 0;
else if (mdef->mtame && !vis) else if (mdef->mtame && !g.vis)
You(brief_feeling, "strangely sad"); You(brief_feeling, "strangely sad");
return (MM_DEF_DIED return (MM_DEF_DIED
| (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
} }
if (!Deaf) { if (!Deaf) {
if (!vis) if (!g.vis)
You_hear("laughter."); You_hear("laughter.");
else if (canseemon(magr)) else if (canseemon(magr))
pline("%s chuckles.", Monnam(magr)); pline("%s chuckles.", Monnam(magr));
@@ -1222,21 +1213,21 @@ register struct attack *mattk;
add_to_minv(magr, gold); add_to_minv(magr, gold);
} }
mdef->mstrategy &= ~STRAT_WAITFORU; mdef->mstrategy &= ~STRAT_WAITFORU;
if (vis && canseemon(mdef)) { if (g.vis && canseemon(mdef)) {
Strcpy(buf, Monnam(magr)); Strcpy(buf, Monnam(magr));
pline("%s steals some gold from %s.", buf, mon_nam(mdef)); pline("%s steals some gold from %s.", buf, mon_nam(mdef));
} }
if (!tele_restrict(magr)) { if (!tele_restrict(magr)) {
boolean couldspot = canspotmon(magr); boolean couldspot = canspotmon(magr);
(void) rloc(magr, TRUE); (void) rloc(magr, TRUE);
if (vis && couldspot && !canspotmon(magr)) if (g.vis && couldspot && !canspotmon(magr))
pline("%s suddenly disappears!", buf); pline("%s suddenly disappears!", buf);
} }
break; break;
case AD_DRLI: case AD_DRLI:
if (!cancelled && !rn2(3) && !resists_drli(mdef)) { if (!cancelled && !rn2(3) && !resists_drli(mdef)) {
tmp = d(2, 6); tmp = d(2, 6);
if (vis && canspotmon(mdef)) if (g.vis && canspotmon(mdef))
pline("%s suddenly seems weaker!", Monnam(mdef)); pline("%s suddenly seems weaker!", Monnam(mdef));
mdef->mhpmax -= tmp; mdef->mhpmax -= tmp;
if (mdef->m_lev == 0) if (mdef->m_lev == 0)
@@ -1264,26 +1255,26 @@ register struct attack *mattk;
Strcpy(mdefnambuf, Strcpy(mdefnambuf,
x_monnam(mdef, ARTICLE_THE, (char *) 0, 0, FALSE)); x_monnam(mdef, ARTICLE_THE, (char *) 0, 0, FALSE));
otmp = obj; g.otmp = obj;
if (u.usteed == mdef && otmp == which_armor(mdef, W_SADDLE)) if (u.usteed == mdef && g.otmp == which_armor(mdef, W_SADDLE))
/* "You can no longer ride <steed>." */ /* "You can no longer ride <steed>." */
dismount_steed(DISMOUNT_POLY); dismount_steed(DISMOUNT_POLY);
obj_extract_self(otmp); obj_extract_self(g.otmp);
if (otmp->owornmask) { if (g.otmp->owornmask) {
mdef->misc_worn_check &= ~otmp->owornmask; mdef->misc_worn_check &= ~g.otmp->owornmask;
if (otmp->owornmask & W_WEP) if (g.otmp->owornmask & W_WEP)
mwepgone(mdef); mwepgone(mdef);
otmp->owornmask = 0L; g.otmp->owornmask = 0L;
update_mon_intrinsics(mdef, otmp, FALSE, FALSE); update_mon_intrinsics(mdef, g.otmp, FALSE, FALSE);
/* give monster a chance to wear other equipment on its next /* give monster a chance to wear other equipment on its next
move instead of waiting until it picks something up */ move instead of waiting until it picks something up */
mdef->misc_worn_check |= I_SPECIAL; mdef->misc_worn_check |= I_SPECIAL;
} }
/* add_to_minv() might free otmp [if it merges] */ /* add_to_minv() might free otmp [if it merges] */
if (vis) if (g.vis)
Strcpy(onambuf, doname(otmp)); Strcpy(onambuf, doname(g.otmp));
(void) add_to_minv(magr, otmp); (void) add_to_minv(magr, g.otmp);
if (vis && canseemon(mdef)) { if (g.vis && canseemon(mdef)) {
Strcpy(buf, Monnam(magr)); Strcpy(buf, Monnam(magr));
pline("%s steals %s from %s!", buf, onambuf, mdefnambuf); pline("%s steals %s from %s!", buf, onambuf, mdefnambuf);
} }
@@ -1297,7 +1288,7 @@ register struct attack *mattk;
boolean couldspot = canspotmon(magr); boolean couldspot = canspotmon(magr);
(void) rloc(magr, TRUE); (void) rloc(magr, TRUE);
if (vis && couldspot && !canspotmon(magr)) if (g.vis && couldspot && !canspotmon(magr))
pline("%s suddenly disappears!", buf); pline("%s suddenly disappears!", buf);
} }
} }
@@ -1305,7 +1296,7 @@ register struct attack *mattk;
break; break;
case AD_DREN: case AD_DREN:
if (!cancelled && !rn2(4)) if (!cancelled && !rn2(4))
xdrainenergym(mdef, (boolean) (vis && canspotmon(mdef) xdrainenergym(mdef, (boolean) (g.vis && canspotmon(mdef)
&& mattk->aatyp != AT_ENGL)); && mattk->aatyp != AT_ENGL));
tmp = 0; tmp = 0;
break; break;
@@ -1313,18 +1304,18 @@ register struct attack *mattk;
case AD_DRDX: case AD_DRDX:
case AD_DRCO: case AD_DRCO:
if (!cancelled && !rn2(8)) { if (!cancelled && !rn2(8)) {
if (vis && canspotmon(magr)) if (g.vis && canspotmon(magr))
pline("%s %s was poisoned!", s_suffix(Monnam(magr)), pline("%s %s was poisoned!", s_suffix(Monnam(magr)),
mpoisons_subj(magr, mattk)); mpoisons_subj(magr, mattk));
if (resists_poison(mdef)) { if (resists_poison(mdef)) {
if (vis && canspotmon(mdef) && canspotmon(magr)) if (g.vis && canspotmon(mdef) && canspotmon(magr))
pline_The("poison doesn't seem to affect %s.", pline_The("poison doesn't seem to affect %s.",
mon_nam(mdef)); mon_nam(mdef));
} else { } else {
if (rn2(10)) if (rn2(10))
tmp += rn1(10, 6); tmp += rn1(10, 6);
else { else {
if (vis && canspotmon(mdef)) if (g.vis && canspotmon(mdef))
pline_The("poison was deadly..."); pline_The("poison was deadly...");
tmp = mdef->mhp; tmp = mdef->mhp;
} }
@@ -1333,28 +1324,28 @@ register struct attack *mattk;
break; break;
case AD_DRIN: case AD_DRIN:
if (g.notonhead || !has_head(pd)) { if (g.notonhead || !has_head(pd)) {
if (vis && canspotmon(mdef)) if (g.vis && canspotmon(mdef))
pline("%s doesn't seem harmed.", Monnam(mdef)); pline("%s doesn't seem harmed.", Monnam(mdef));
/* Not clear what to do for green slimes */ /* Not clear what to do for green slimes */
tmp = 0; tmp = 0;
break; break;
} }
if ((mdef->misc_worn_check & W_ARMH) && rn2(8)) { if ((mdef->misc_worn_check & W_ARMH) && rn2(8)) {
if (vis && canspotmon(magr) && canseemon(mdef)) { if (g.vis && canspotmon(magr) && canseemon(mdef)) {
Strcpy(buf, s_suffix(Monnam(mdef))); Strcpy(buf, s_suffix(Monnam(mdef)));
pline("%s helmet blocks %s attack to %s head.", buf, pline("%s helmet blocks %s attack to %s head.", buf,
s_suffix(mon_nam(magr)), mhis(mdef)); s_suffix(mon_nam(magr)), mhis(mdef));
} }
break; break;
} }
res = eat_brains(magr, mdef, vis, &tmp); res = eat_brains(magr, mdef, g.vis, &tmp);
break; break;
case AD_SLIM: case AD_SLIM:
if (cancelled) if (cancelled)
break; /* physical damage only */ break; /* physical damage only */
if (!rn2(4) && !slimeproof(pd)) { if (!rn2(4) && !slimeproof(pd)) {
if (!munslime(mdef, FALSE) && !DEADMONSTER(mdef)) { if (!munslime(mdef, FALSE) && !DEADMONSTER(mdef)) {
if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, vis && canseemon(mdef))) if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, g.vis && canseemon(mdef)))
pd = mdef->data; pd = mdef->data;
mdef->mstrategy &= ~STRAT_WAITFORU; mdef->mstrategy &= ~STRAT_WAITFORU;
res = MM_HIT; res = MM_HIT;
@@ -1558,8 +1549,8 @@ int mdead;
acid_damage(MON_WEP(magr)); acid_damage(MON_WEP(magr));
goto assess_dmg; goto assess_dmg;
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */ case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
if (mhit && !mdef->mcan && otmp) { if (mhit && !mdef->mcan && g.otmp) {
(void) drain_item(otmp, FALSE); (void) drain_item(g.otmp, FALSE);
/* No message */ /* No message */
} }
break; break;
+2 -6
View File
@@ -22,10 +22,6 @@ STATIC_DCL void FDECL(mswings, (struct monst *, struct obj *));
STATIC_DCL void FDECL(wildmiss, (struct monst *, struct attack *)); STATIC_DCL void FDECL(wildmiss, (struct monst *, struct attack *));
STATIC_DCL void FDECL(hitmsg, (struct monst *, struct attack *)); STATIC_DCL void FDECL(hitmsg, (struct monst *, struct attack *));
/* See comment in mhitm.c. If we use this a lot it probably should be */
/* changed to a parameter to mhitu. */
static int dieroll;
STATIC_OVL void STATIC_OVL void
hitmsg(mtmp, mattk) hitmsg(mtmp, mattk)
struct monst *mtmp; struct monst *mtmp;
@@ -755,7 +751,7 @@ register struct monst *mtmp;
tmp += hittmp; tmp += hittmp;
mswings(mtmp, mon_currwep); mswings(mtmp, mon_currwep);
} }
if (tmp > (j = dieroll = rnd(20 + i))) if (tmp > (j = g.mhitu_dieroll = rnd(20 + i)))
sum[i] = hitmu(mtmp, mattk); sum[i] = hitmu(mtmp, mattk);
else else
missmu(mtmp, (tmp == j), mattk); missmu(mtmp, (tmp == j), mattk);
@@ -991,7 +987,7 @@ register struct attack *mattk;
if (dmg <= 0) if (dmg <= 0)
dmg = 1; dmg = 1;
if (!(otmp->oartifact if (!(otmp->oartifact
&& artifact_hit(mtmp, &youmonst, otmp, &dmg, dieroll))) && artifact_hit(mtmp, &youmonst, otmp, &dmg, g.mhitu_dieroll)))
hitmsg(mtmp, mattk); hitmsg(mtmp, mattk);
if (!dmg) if (!dmg)
break; break;
+14 -17
View File
@@ -36,10 +36,8 @@ STATIC_DCL void FDECL(mkinvpos, (XCHAR_P, XCHAR_P, int));
STATIC_DCL void FDECL(mk_knox_portal, (XCHAR_P, XCHAR_P)); STATIC_DCL void FDECL(mk_knox_portal, (XCHAR_P, XCHAR_P));
#define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE) #define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE)
#define init_vault() vault_x = -1 #define init_vault() g.vault_x = -1
#define do_vault() (vault_x != -1) #define do_vault() (g.vault_x != -1)
static xchar vault_x, vault_y;
static boolean made_branch; /* used only during level creation */
/* Args must be (const genericptr) so that qsort will always be happy. */ /* Args must be (const genericptr) so that qsort will always be happy. */
@@ -229,8 +227,8 @@ makerooms()
if (nroom >= (MAXNROFROOMS / 6) && rn2(2) && !tried_vault) { if (nroom >= (MAXNROFROOMS / 6) && rn2(2) && !tried_vault) {
tried_vault = TRUE; tried_vault = TRUE;
if (create_vault()) { if (create_vault()) {
vault_x = rooms[nroom].lx; g.vault_x = rooms[nroom].lx;
vault_y = rooms[nroom].ly; g.vault_y = rooms[nroom].ly;
rooms[nroom].hx = -1; rooms[nroom].hx = -1;
} }
} else if (!create_room(-1, -1, -1, -1, -1, -1, OROOM, -1)) } else if (!create_room(-1, -1, -1, -1, -1, -1, OROOM, -1))
@@ -636,7 +634,7 @@ clear_level_structures()
xdnstair = ydnstair = xupstair = yupstair = 0; xdnstair = ydnstair = xupstair = yupstair = 0;
sstairs.sx = sstairs.sy = 0; sstairs.sx = sstairs.sy = 0;
xdnladder = ydnladder = xupladder = yupladder = 0; xdnladder = ydnladder = xupladder = yupladder = 0;
made_branch = FALSE; g.made_branch = FALSE;
clear_regions(); clear_regions();
} }
@@ -731,20 +729,20 @@ makelevel()
debugpline0("trying to make a vault..."); debugpline0("trying to make a vault...");
w = 1; w = 1;
h = 1; h = 1;
if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) { if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE)) {
fill_vault: fill_vault:
add_room(vault_x, vault_y, vault_x + w, vault_y + h, TRUE, VAULT, add_room(g.vault_x, g.vault_y, g.vault_x + w, g.vault_y + h, TRUE, VAULT,
FALSE); FALSE);
level.flags.has_vault = 1; level.flags.has_vault = 1;
++room_threshold; ++room_threshold;
fill_room(&rooms[nroom - 1], FALSE); fill_room(&rooms[nroom - 1], FALSE);
mk_knox_portal(vault_x + w, vault_y + h); mk_knox_portal(g.vault_x + w, g.vault_y + h);
if (!level.flags.noteleport && !rn2(3)) if (!level.flags.noteleport && !rn2(3))
makevtele(); makevtele();
} else if (rnd_rect() && create_vault()) { } else if (rnd_rect() && create_vault()) {
vault_x = rooms[nroom].lx; g.vault_x = rooms[nroom].lx;
vault_y = rooms[nroom].ly; g.vault_y = rooms[nroom].ly;
if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE))
goto fill_vault; goto fill_vault;
else else
rooms[nroom].hx = -1; rooms[nroom].hx = -1;
@@ -1139,7 +1137,7 @@ xchar x, y; /* location */
* a special level is loaded that specifies an SSTAIR location * a special level is loaded that specifies an SSTAIR location
* as a favored spot for a branch. * as a favored spot for a branch.
*/ */
if (!br || made_branch) if (!br || g.made_branch)
return; return;
if (!x) { /* find random coordinates for branch */ if (!x) { /* find random coordinates for branch */
@@ -1179,7 +1177,7 @@ xchar x, y; /* location */
* per level, if we failed once, we're going to fail again on the * per level, if we failed once, we're going to fail again on the
* next call. * next call.
*/ */
made_branch = TRUE; g.made_branch = TRUE;
} }
STATIC_OVL boolean STATIC_OVL boolean
@@ -1824,7 +1822,6 @@ STATIC_OVL void
mk_knox_portal(x, y) mk_knox_portal(x, y)
xchar x, y; xchar x, y;
{ {
extern int n_dgns; /* from dungeon.c */
d_level *source; d_level *source;
branch *br; branch *br;
schar u_depth; schar u_depth;
@@ -1840,7 +1837,7 @@ xchar x, y;
} }
/* Already set or 2/3 chance of deferring until a later level. */ /* Already set or 2/3 chance of deferring until a later level. */
if (source->dnum < n_dgns || (rn2(3) && !wizard)) if (source->dnum < g.n_dgns || (rn2(3) && !wizard))
return; return;
if (!(u.uz.dnum == oracle_level.dnum /* in main dungeon */ if (!(u.uz.dnum == oracle_level.dnum /* in main dungeon */
+19 -23
View File
@@ -21,10 +21,6 @@ STATIC_DCL void FDECL(finish_map,
STATIC_DCL void FDECL(remove_room, (unsigned)); STATIC_DCL void FDECL(remove_room, (unsigned));
void FDECL(mkmap, (lev_init *)); void FDECL(mkmap, (lev_init *));
static char *new_locations;
int min_rx, max_rx, min_ry, max_ry; /* rectangle bounds for regions */
static int n_loc_filled;
STATIC_OVL void STATIC_OVL void
init_map(bg_typ) init_map(bg_typ)
schar bg_typ; schar bg_typ;
@@ -100,7 +96,7 @@ schar bg_typ, fg_typ;
} }
} }
#define new_loc(i, j) *(new_locations + ((j) * (WIDTH + 1)) + (i)) #define new_loc(i, j) *(g.new_locations + ((j) * (WIDTH + 1)) + (i))
STATIC_OVL void STATIC_OVL void
pass_two(bg_typ, fg_typ) pass_two(bg_typ, fg_typ)
@@ -176,10 +172,10 @@ boolean anyroom;
sx++; /* compensate for extra decrement */ sx++; /* compensate for extra decrement */
/* assume sx,sy is valid */ /* assume sx,sy is valid */
if (sx < min_rx) if (sx < g.min_rx)
min_rx = sx; g.min_rx = sx;
if (sy < min_ry) if (sy < g.min_ry)
min_ry = sy; g.min_ry = sy;
for (i = sx; i <= WIDTH && levl[i][sy].typ == fg_typ; i++) { for (i = sx; i <= WIDTH && levl[i][sy].typ == fg_typ; i++) {
levl[i][sy].roomno = rmno; levl[i][sy].roomno = rmno;
@@ -199,7 +195,7 @@ boolean anyroom;
levl[ii][jj].roomno = SHARED; levl[ii][jj].roomno = SHARED;
} }
} }
n_loc_filled++; g.n_loc_filled++;
} }
nx = i; nx = i;
@@ -240,10 +236,10 @@ boolean anyroom;
} }
} }
if (nx > max_rx) if (nx > g.max_rx)
max_rx = nx - 1; /* nx is just past valid region */ g.max_rx = nx - 1; /* nx is just past valid region */
if (sy > max_ry) if (sy > g.max_ry)
max_ry = sy; g.max_ry = sy;
} }
/* /*
@@ -284,12 +280,12 @@ schar bg_typ, fg_typ;
for (i = 2; i <= WIDTH; i++) for (i = 2; i <= WIDTH; i++)
for (j = 1; j < HEIGHT; j++) { for (j = 1; j < HEIGHT; j++) {
if (levl[i][j].typ == fg_typ && levl[i][j].roomno == NO_ROOM) { if (levl[i][j].typ == fg_typ && levl[i][j].roomno == NO_ROOM) {
min_rx = max_rx = i; g.min_rx = g.max_rx = i;
min_ry = max_ry = j; g.min_ry = g.max_ry = j;
n_loc_filled = 0; g.n_loc_filled = 0;
flood_fill_rm(i, j, nroom + ROOMOFFSET, FALSE, FALSE); flood_fill_rm(i, j, nroom + ROOMOFFSET, FALSE, FALSE);
if (n_loc_filled > 3) { if (g.n_loc_filled > 3) {
add_room(min_rx, min_ry, max_rx, max_ry, FALSE, OROOM, add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OROOM,
TRUE); TRUE);
rooms[nroom - 1].irregular = TRUE; rooms[nroom - 1].irregular = TRUE;
if (nroom >= (MAXNROFROOMS * 2)) if (nroom >= (MAXNROFROOMS * 2))
@@ -299,8 +295,8 @@ schar bg_typ, fg_typ;
* it's a tiny hole; erase it from the map to avoid * it's a tiny hole; erase it from the map to avoid
* having the player end up here with no way out. * having the player end up here with no way out.
*/ */
for (sx = min_rx; sx <= max_rx; sx++) for (sx = g.min_rx; sx <= g.max_rx; sx++)
for (sy = min_ry; sy <= max_ry; sy++) for (sy = g.min_ry; sy <= g.max_ry; sy++)
if ((int) levl[sx][sy].roomno if ((int) levl[sx][sy].roomno
== nroom + ROOMOFFSET) { == nroom + ROOMOFFSET) {
levl[sx][sy].typ = bg_typ; levl[sx][sy].typ = bg_typ;
@@ -460,7 +456,7 @@ lev_init *init_lev;
if (lit < 0) if (lit < 0)
lit = (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? 1 : 0; lit = (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? 1 : 0;
new_locations = (char *) alloc((WIDTH + 1) * HEIGHT); g.new_locations = (char *) alloc((WIDTH + 1) * HEIGHT);
init_map(bg_typ); init_map(bg_typ);
init_fill(bg_typ, fg_typ); init_fill(bg_typ, fg_typ);
@@ -485,7 +481,7 @@ lev_init *init_lev;
level.flags.is_maze_lev = FALSE; level.flags.is_maze_lev = FALSE;
level.flags.is_cavernous_lev = TRUE; level.flags.is_cavernous_lev = TRUE;
} }
free(new_locations); free(g.new_locations);
} }
/*mkmap.c*/ /*mkmap.c*/
+36 -41
View File
@@ -7,12 +7,6 @@
#include "sp_lev.h" #include "sp_lev.h"
#include "lev.h" /* save & restore info */ #include "lev.h" /* save & restore info */
/* from sp_lev.c, for fixup_special() */
extern lev_region *lregions;
extern int num_lregions;
/* for preserving the insect legs when wallifying baalz level */
static lev_region bughack = { {COLNO, ROWNO, 0, 0}, {COLNO, ROWNO, 0, 0} };
STATIC_DCL int FDECL(iswall, (int, int)); STATIC_DCL int FDECL(iswall, (int, int));
STATIC_DCL int FDECL(iswall_or_stone, (int, int)); STATIC_DCL int FDECL(iswall_or_stone, (int, int));
STATIC_DCL boolean FDECL(is_solid, (int, int)); STATIC_DCL boolean FDECL(is_solid, (int, int));
@@ -30,6 +24,9 @@ STATIC_DCL void FDECL(migr_booty_item, (int, const char *));
STATIC_DCL void FDECL(migrate_orc, (struct monst *, unsigned long)); STATIC_DCL void FDECL(migrate_orc, (struct monst *, unsigned long));
STATIC_DCL void NDECL(stolen_booty); STATIC_DCL void NDECL(stolen_booty);
lev_region bughack; /* for preserving the insect legs when wallifying
* baalz level */
/* adjust a coordinate one step in the specified direction */ /* adjust a coordinate one step in the specified direction */
#define mz_move(X, Y, dir) \ #define mz_move(X, Y, dir) \
do { \ do { \
@@ -142,8 +139,8 @@ int x1, y1, x2, y2;
for (x = x1; x <= x2; x++) for (x = x1; x <= x2; x++)
for (y = y1; y <= y2; y++) { for (y = y1; y <= y2; y++) {
if (within_bounded_area(x, y, if (within_bounded_area(x, y,
bughack.inarea.x1, bughack.inarea.y1, g.bughack.inarea.x1, g.bughack.inarea.y1,
bughack.inarea.x2, bughack.inarea.y2)) g.bughack.inarea.x2, g.bughack.inarea.y2))
continue; continue;
lev = &levl[x][y]; lev = &levl[x][y];
type = lev->typ; type = lev->typ;
@@ -193,8 +190,8 @@ int x1, y1, x2, y2;
/* set the locations TRUE if rock or wall or out of bounds */ /* set the locations TRUE if rock or wall or out of bounds */
loc_f = within_bounded_area(x, y, /* for baalz insect */ loc_f = within_bounded_area(x, y, /* for baalz insect */
bughack.inarea.x1, bughack.inarea.y1, g.bughack.inarea.x1, g.bughack.inarea.y1,
bughack.inarea.x2, bughack.inarea.y2) g.bughack.inarea.x2, g.bughack.inarea.y2)
? iswall ? iswall
: iswall_or_stone; : iswall_or_stone;
locale[0][0] = (*loc_f)(x - 1, y - 1); locale[0][0] = (*loc_f)(x - 1, y - 1);
@@ -394,28 +391,28 @@ baalz_fixup()
for (lastx = x = 0; x < COLNO; ++x) for (lastx = x = 0; x < COLNO; ++x)
if ((levl[x][y].wall_info & W_NONDIGGABLE) != 0) { if ((levl[x][y].wall_info & W_NONDIGGABLE) != 0) {
if (!lastx) if (!lastx)
bughack.inarea.x1 = x + 1; g.bughack.inarea.x1 = x + 1;
lastx = x; lastx = x;
} }
bughack.inarea.x2 = ((lastx > bughack.inarea.x1) ? lastx : x) - 1; g.bughack.inarea.x2 = ((lastx > g.bughack.inarea.x1) ? lastx : x) - 1;
/* find low and high y for to-be-wallified portion of level */ /* find low and high y for to-be-wallified portion of level */
x = bughack.inarea.x1; x = g.bughack.inarea.x1;
for (lasty = y = 0; y < ROWNO; ++y) for (lasty = y = 0; y < ROWNO; ++y)
if ((levl[x][y].wall_info & W_NONDIGGABLE) != 0) { if ((levl[x][y].wall_info & W_NONDIGGABLE) != 0) {
if (!lasty) if (!lasty)
bughack.inarea.y1 = y + 1; g.bughack.inarea.y1 = y + 1;
lasty = y; lasty = y;
} }
bughack.inarea.y2 = ((lasty > bughack.inarea.y1) ? lasty : y) - 1; g.bughack.inarea.y2 = ((lasty > g.bughack.inarea.y1) ? lasty : y) - 1;
/* two pools mark where special post-wallify fix-ups are needed */ /* two pools mark where special post-wallify fix-ups are needed */
for (x = bughack.inarea.x1; x <= bughack.inarea.x2; ++x) for (x = g.bughack.inarea.x1; x <= g.bughack.inarea.x2; ++x)
for (y = bughack.inarea.y1; y <= bughack.inarea.y2; ++y) for (y = g.bughack.inarea.y1; y <= g.bughack.inarea.y2; ++y)
if (levl[x][y].typ == POOL) { if (levl[x][y].typ == POOL) {
levl[x][y].typ = HWALL; levl[x][y].typ = HWALL;
if (bughack.delarea.x1 == COLNO) if (g.bughack.delarea.x1 == COLNO)
bughack.delarea.x1 = x, bughack.delarea.y1 = y; g.bughack.delarea.x1 = x, g.bughack.delarea.y1 = y;
else else
bughack.delarea.x2 = x, bughack.delarea.y2 = y; g.bughack.delarea.x2 = x, g.bughack.delarea.y2 = y;
} else if (levl[x][y].typ == IRONBARS) { } else if (levl[x][y].typ == IRONBARS) {
/* novelty effect; allowing digging in front of 'eyes' */ /* novelty effect; allowing digging in front of 'eyes' */
levl[x - 1][y].wall_info &= ~W_NONDIGGABLE; levl[x - 1][y].wall_info &= ~W_NONDIGGABLE;
@@ -423,15 +420,15 @@ baalz_fixup()
levl[x - 2][y].wall_info &= ~W_NONDIGGABLE; levl[x - 2][y].wall_info &= ~W_NONDIGGABLE;
} }
wallification(max(bughack.inarea.x1 - 2, 1), wallification(max(g.bughack.inarea.x1 - 2, 1),
max(bughack.inarea.y1 - 2, 0), max(g.bughack.inarea.y1 - 2, 0),
min(bughack.inarea.x2 + 2, COLNO - 1), min(g.bughack.inarea.x2 + 2, COLNO - 1),
min(bughack.inarea.y2 + 2, ROWNO - 1)); min(g.bughack.inarea.y2 + 2, ROWNO - 1));
/* bughack hack for rear-most legs on baalz level; first joint on /* bughack hack for rear-most legs on baalz level; first joint on
both top and bottom gets a bogus extra connection to room area, both top and bottom gets a bogus extra connection to room area,
producing unwanted rectangles; change back to separated legs */ producing unwanted rectangles; change back to separated legs */
x = bughack.delarea.x1, y = bughack.delarea.y1; x = g.bughack.delarea.x1, y = g.bughack.delarea.y1;
if (isok(x, y) && levl[x][y].typ == TLWALL if (isok(x, y) && levl[x][y].typ == TLWALL
&& isok(x, y + 1) && levl[x][y + 1].typ == TUWALL) { && isok(x, y + 1) && levl[x][y + 1].typ == TUWALL) {
levl[x][y].typ = BRCORNER; levl[x][y].typ = BRCORNER;
@@ -439,7 +436,7 @@ baalz_fixup()
if ((mtmp = m_at(x, y)) != 0) /* something at temporary pool... */ if ((mtmp = m_at(x, y)) != 0) /* something at temporary pool... */
(void) rloc(mtmp, FALSE); (void) rloc(mtmp, FALSE);
} }
x = bughack.delarea.x2, y = bughack.delarea.y2; x = g.bughack.delarea.x2, y = g.bughack.delarea.y2;
if (isok(x, y) && levl[x][y].typ == TLWALL if (isok(x, y) && levl[x][y].typ == TLWALL
&& isok(x, y - 1) && levl[x][y - 1].typ == TDWALL) { && isok(x, y - 1) && levl[x][y - 1].typ == TDWALL) {
levl[x][y].typ = TRCORNER; levl[x][y].typ = TRCORNER;
@@ -451,37 +448,35 @@ baalz_fixup()
/* reset bughack region; set low end to <COLNO,ROWNO> so that /* reset bughack region; set low end to <COLNO,ROWNO> so that
within_bounded_region() in fix_wall_spines() will fail within_bounded_region() in fix_wall_spines() will fail
most quickly--on its first test--when loading other levels */ most quickly--on its first test--when loading other levels */
bughack.inarea.x1 = bughack.delarea.x1 = COLNO; g.bughack.inarea.x1 = g.bughack.delarea.x1 = COLNO;
bughack.inarea.y1 = bughack.delarea.y1 = ROWNO; g.bughack.inarea.y1 = g.bughack.delarea.y1 = ROWNO;
bughack.inarea.x2 = bughack.delarea.x2 = 0; g.bughack.inarea.x2 = g.bughack.delarea.x2 = 0;
bughack.inarea.y2 = bughack.delarea.y2 = 0; g.bughack.inarea.y2 = g.bughack.delarea.y2 = 0;
} }
static boolean was_waterlevel; /* ugh... this shouldn't be needed */
/* this is special stuff that the level compiler cannot (yet) handle */ /* this is special stuff that the level compiler cannot (yet) handle */
void void
fixup_special() fixup_special()
{ {
lev_region *r = lregions; lev_region *r = g.lregions;
struct d_level lev; struct d_level lev;
int x, y; int x, y;
struct mkroom *croom; struct mkroom *croom;
boolean added_branch = FALSE; boolean added_branch = FALSE;
if (was_waterlevel) { if (g.was_waterlevel) {
was_waterlevel = FALSE; g.was_waterlevel = FALSE;
u.uinwater = 0; u.uinwater = 0;
unsetup_waterlevel(); unsetup_waterlevel();
} }
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) { if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) {
level.flags.hero_memory = 0; level.flags.hero_memory = 0;
was_waterlevel = TRUE; g.was_waterlevel = TRUE;
/* water level is an odd beast - it has to be set up /* water level is an odd beast - it has to be set up
before calling place_lregions etc. */ before calling place_lregions etc. */
setup_waterlevel(); setup_waterlevel();
} }
for (x = 0; x < num_lregions; x++, r++) { for (x = 0; x < g.num_lregions; x++, r++) {
switch (r->rtype) { switch (r->rtype) {
case LR_BRANCH: case LR_BRANCH:
added_branch = TRUE; added_branch = TRUE;
@@ -618,9 +613,9 @@ fixup_special()
stolen_booty(); stolen_booty();
} }
if (lregions) if (g.lregions)
free((genericptr_t) lregions), lregions = 0; free((genericptr_t) g.lregions), g.lregions = 0;
num_lregions = 0; g.num_lregions = 0;
} }
void void
@@ -1623,7 +1618,7 @@ int fd;
} }
ebubbles = b; ebubbles = b;
b->next = (struct bubble *) 0; b->next = (struct bubble *) 0;
was_waterlevel = TRUE; g.was_waterlevel = TRUE;
} }
const char * const char *
+32 -32
View File
@@ -599,9 +599,9 @@ reglyph_darkroom()
} }
} }
if (flags.dark_room && iflags.use_color) if (flags.dark_room && iflags.use_color)
showsyms[S_darkroom] = showsyms[S_room]; g.showsyms[S_darkroom] = g.showsyms[S_room];
else else
showsyms[S_darkroom] = showsyms[S_stone]; g.showsyms[S_darkroom] = g.showsyms[S_stone];
} }
/* check whether a user-supplied option string is a proper leading /* check whether a user-supplied option string is a proper leading
@@ -742,7 +742,7 @@ initoptions_init()
/* Set the default monster and object class symbols. */ /* Set the default monster and object class symbols. */
init_symbols(); init_symbols();
for (i = 0; i < WARNCOUNT; i++) for (i = 0; i < WARNCOUNT; i++)
warnsyms[i] = def_warnsyms[i].sym; g.warnsyms[i] = def_warnsyms[i].sym;
iflags.bouldersym = 0; iflags.bouldersym = 0;
/* for "special achievement" tracking (see obj.h, /* for "special achievement" tracking (see obj.h,
@@ -771,9 +771,9 @@ initoptions_init()
*/ */
/* this detects the IBM-compatible console on most 386 boxes */ /* this detects the IBM-compatible console on most 386 boxes */
if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) { if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) {
if (!symset[PRIMARY].name) if (!g.symset[PRIMARY].name)
load_symset("IBMGraphics", PRIMARY); load_symset("IBMGraphics", PRIMARY);
if (!symset[ROGUESET].name) if (!g.symset[ROGUESET].name)
load_symset("RogueIBM", ROGUESET); load_symset("RogueIBM", ROGUESET);
switch_symbols(TRUE); switch_symbols(TRUE);
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
@@ -788,7 +788,7 @@ initoptions_init()
/* [could also check "xterm" which emulates vtXXX by default] */ /* [could also check "xterm" which emulates vtXXX by default] */
&& !strncmpi(opts, "vt", 2) && !strncmpi(opts, "vt", 2)
&& AS && AE && index(AS, '\016') && index(AE, '\017')) { && AS && AE && index(AS, '\016') && index(AE, '\017')) {
if (!symset[PRIMARY].name) if (!g.symset[PRIMARY].name)
load_symset("DECGraphics", PRIMARY); load_symset("DECGraphics", PRIMARY);
switch_symbols(TRUE); switch_symbols(TRUE);
} }
@@ -797,10 +797,10 @@ initoptions_init()
#if defined(MSDOS) || defined(WIN32) #if defined(MSDOS) || defined(WIN32)
/* Use IBM defaults. Can be overridden via config file */ /* Use IBM defaults. Can be overridden via config file */
if (!symset[PRIMARY].name) { if (!g.symset[PRIMARY].name) {
load_symset("IBMGraphics_2", PRIMARY); load_symset("IBMGraphics_2", PRIMARY);
} }
if (!symset[ROGUESET].name) { if (!g.symset[ROGUESET].name) {
load_symset("RogueEpyx", ROGUESET); load_symset("RogueEpyx", ROGUESET);
} }
#endif #endif
@@ -1157,7 +1157,7 @@ register uchar *graph_chars;
for (i = 0; i < WARNCOUNT; i++) for (i = 0; i < WARNCOUNT; i++)
if (graph_chars[i]) if (graph_chars[i])
warnsyms[i] = graph_chars[i]; g.warnsyms[i] = graph_chars[i];
} }
STATIC_OVL int STATIC_OVL int
@@ -2288,7 +2288,7 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE); bad_negation(fullname, FALSE);
return FALSE; return FALSE;
} else if ((op = string_for_opt(opts, FALSE)) != 0) { } else if ((op = string_for_opt(opts, FALSE)) != 0) {
symset[ROGUESET].name = dupstr(op); g.symset[ROGUESET].name = dupstr(op);
if (!read_sym_file(ROGUESET)) { if (!read_sym_file(ROGUESET)) {
clear_symsetentry(ROGUESET, TRUE); clear_symsetentry(ROGUESET, TRUE);
config_error_add( config_error_add(
@@ -2313,7 +2313,7 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE); bad_negation(fullname, FALSE);
return FALSE; return FALSE;
} else if ((op = string_for_opt(opts, FALSE)) != 0) { } else if ((op = string_for_opt(opts, FALSE)) != 0) {
symset[PRIMARY].name = dupstr(op); g.symset[PRIMARY].name = dupstr(op);
if (!read_sym_file(PRIMARY)) { if (!read_sym_file(PRIMARY)) {
clear_symsetentry(PRIMARY, TRUE); clear_symsetentry(PRIMARY, TRUE);
config_error_add( config_error_add(
@@ -2321,7 +2321,7 @@ boolean tinitial, tfrom_file;
op, SYMBOLS); op, SYMBOLS);
return FALSE; return FALSE;
} else { } else {
switch_symbols(symset[PRIMARY].name != (char *) 0); switch_symbols(g.symset[PRIMARY].name != (char *) 0);
need_redraw = TRUE; need_redraw = TRUE;
} }
} else } else
@@ -3779,10 +3779,10 @@ boolean tinitial, tfrom_file;
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
if (!negated) { if (!negated) {
/* There is no rogue level DECgraphics-specific set */ /* There is no rogue level DECgraphics-specific set */
if (symset[PRIMARY].name) { if (g.symset[PRIMARY].name) {
badflag = TRUE; badflag = TRUE;
} else { } else {
symset[PRIMARY].name = dupstr(fullname); g.symset[PRIMARY].name = dupstr(fullname);
if (!read_sym_file(PRIMARY)) { if (!read_sym_file(PRIMARY)) {
badflag = TRUE; badflag = TRUE;
clear_symsetentry(PRIMARY, TRUE); clear_symsetentry(PRIMARY, TRUE);
@@ -3812,12 +3812,12 @@ boolean tinitial, tfrom_file;
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
if (!negated) { if (!negated) {
for (i = 0; i < NUM_GRAPHICS; ++i) { for (i = 0; i < NUM_GRAPHICS; ++i) {
if (symset[i].name) { if (g.symset[i].name) {
badflag = TRUE; badflag = TRUE;
} else { } else {
if (i == ROGUESET) if (i == ROGUESET)
sym_name = "RogueIBM"; sym_name = "RogueIBM";
symset[i].name = dupstr(sym_name); g.symset[i].name = dupstr(sym_name);
if (!read_sym_file(i)) { if (!read_sym_file(i)) {
badflag = TRUE; badflag = TRUE;
clear_symsetentry(i, TRUE); clear_symsetentry(i, TRUE);
@@ -3850,10 +3850,10 @@ boolean tinitial, tfrom_file;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
if (!negated) { if (!negated) {
if (symset[PRIMARY].name) { if (g.symset[PRIMARY].name) {
badflag = TRUE; badflag = TRUE;
} else { } else {
symset[PRIMARY].name = dupstr(fullname); g.symset[PRIMARY].name = dupstr(fullname);
if (!read_sym_file(PRIMARY)) { if (!read_sym_file(PRIMARY)) {
badflag = TRUE; badflag = TRUE;
clear_symsetentry(PRIMARY, TRUE); clear_symsetentry(PRIMARY, TRUE);
@@ -5211,8 +5211,8 @@ boolean setinitial, setfromfile;
which_set = rogueflag ? ROGUESET : PRIMARY; which_set = rogueflag ? ROGUESET : PRIMARY;
/* clear symset[].name as a flag to read_sym_file() to build list */ /* clear symset[].name as a flag to read_sym_file() to build list */
symset_name = symset[which_set].name; symset_name = g.symset[which_set].name;
symset[which_set].name = (char *) 0; g.symset[which_set].name = (char *) 0;
symset_list = (struct symsetentry *) 0; symset_list = (struct symsetentry *) 0;
res = read_sym_file(which_set); res = read_sym_file(which_set);
@@ -5294,7 +5294,7 @@ boolean setinitial, setfromfile;
clear_symsetentry(which_set, TRUE); clear_symsetentry(which_set, TRUE);
/* transfer only the name of the symbol set */ /* transfer only the name of the symbol set */
symset[which_set].name = dupstr(sl->name); g.symset[which_set].name = dupstr(sl->name);
ready_to_switch = TRUE; ready_to_switch = TRUE;
break; break;
} }
@@ -5338,8 +5338,8 @@ boolean setinitial, setfromfile;
if (nothing_to_do) if (nothing_to_do)
return TRUE; return TRUE;
if (!symset[which_set].name && symset_name) if (!g.symset[which_set].name && symset_name)
symset[which_set].name = symset_name; /* not dupstr() here */ g.symset[which_set].name = symset_name; /* not dupstr() here */
/* Set default symbols and clear the handling value */ /* Set default symbols and clear the handling value */
if (rogueflag) if (rogueflag)
@@ -5347,7 +5347,7 @@ boolean setinitial, setfromfile;
else else
init_l_symbols(); init_l_symbols();
if (symset[which_set].name) { if (g.symset[which_set].name) {
if (read_sym_file(which_set)) { if (read_sym_file(which_set)) {
ready_to_switch = TRUE; ready_to_switch = TRUE;
} else { } else {
@@ -5426,7 +5426,7 @@ char *buf;
Sprintf(buf, "%c", Sprintf(buf, "%c",
iflags.bouldersym iflags.bouldersym
? iflags.bouldersym ? iflags.bouldersym
: 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", catname[0] ? catname : none);
@@ -5611,8 +5611,8 @@ char *buf;
Sprintf(buf, "%s", rolestring(flags.initrace, races, noun)); Sprintf(buf, "%s", rolestring(flags.initrace, races, noun));
} else if (!strcmp(optname, "roguesymset")) { } else if (!strcmp(optname, "roguesymset")) {
Sprintf(buf, "%s", Sprintf(buf, "%s",
symset[ROGUESET].name ? symset[ROGUESET].name : "default"); g.symset[ROGUESET].name ? g.symset[ROGUESET].name : "default");
if (currentgraphics == ROGUESET && symset[ROGUESET].name) if (g.currentgraphics == ROGUESET && g.symset[ROGUESET].name)
Strcat(buf, ", active"); Strcat(buf, ", active");
} else if (!strcmp(optname, "role")) { } else if (!strcmp(optname, "role")) {
Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m)); Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
@@ -5671,8 +5671,8 @@ char *buf;
FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH); FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
} else if (!strcmp(optname, "symset")) { } else if (!strcmp(optname, "symset")) {
Sprintf(buf, "%s", Sprintf(buf, "%s",
symset[PRIMARY].name ? symset[PRIMARY].name : "default"); g.symset[PRIMARY].name ? g.symset[PRIMARY].name : "default");
if (currentgraphics == PRIMARY && symset[PRIMARY].name) if (g.currentgraphics == PRIMARY && g.symset[PRIMARY].name)
Strcat(buf, ", active"); Strcat(buf, ", active");
#ifdef CURSES_GRAPHICS #ifdef CURSES_GRAPHICS
} else if (!strcmp(optname, "term_cols")) { } else if (!strcmp(optname, "term_cols")) {
@@ -5903,9 +5903,9 @@ int which_set;
{ {
clear_symsetentry(which_set, TRUE); clear_symsetentry(which_set, TRUE);
if (symset[which_set].name) if (g.symset[which_set].name)
free((genericptr_t) symset[which_set].name); free((genericptr_t) g.symset[which_set].name);
symset[which_set].name = dupstr(s); g.symset[which_set].name = dupstr(s);
if (read_sym_file(which_set)) { if (read_sym_file(which_set)) {
switch_symbols(TRUE); switch_symbols(TRUE);
+7 -7
View File
@@ -44,7 +44,7 @@ int c;
int i; int i;
for (i = S_sw_tl; i <= S_sw_br; i++) for (i = S_sw_tl; i <= S_sw_br; i++)
if ((int) showsyms[i] == c) if ((int) g.showsyms[i] == c)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@@ -851,7 +851,7 @@ struct permonst **for_supplement;
/* Check for monsters */ /* Check for monsters */
if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) { if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) {
for (i = 0; i < MAXMCLASSES; i++) { for (i = 0; i < MAXMCLASSES; i++) {
if (sym == (looked ? showsyms[i + SYM_OFF_M] : def_monsyms[i].sym) if (sym == (looked ? g.showsyms[i + SYM_OFF_M] : def_monsyms[i].sym)
&& def_monsyms[i].explain) { && def_monsyms[i].explain) {
need_to_look = TRUE; need_to_look = TRUE;
if (!found) { if (!found) {
@@ -867,7 +867,7 @@ struct permonst **for_supplement;
/* handle '@' as a special case if it refers to you and you're /* handle '@' as a special case if it refers to you and you're
playing a character which isn't normally displayed by that playing a character which isn't normally displayed by that
symbol; firstmatch is assumed to already be set for '@' */ symbol; firstmatch is assumed to already be set for '@' */
if ((looked ? (sym == showsyms[S_HUMAN + SYM_OFF_M] if ((looked ? (sym == g.showsyms[S_HUMAN + SYM_OFF_M]
&& cc.x == u.ux && cc.y == u.uy) && cc.x == u.ux && cc.y == u.uy)
: (sym == def_monsyms[S_HUMAN].sym && !flags.showrace)) : (sym == def_monsyms[S_HUMAN].sym && !flags.showrace))
&& !(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd) && !(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd)
@@ -877,7 +877,7 @@ struct permonst **for_supplement;
/* Now check for objects */ /* Now check for objects */
if (!iflags.terrainmode || (iflags.terrainmode & TER_OBJ) != 0) { if (!iflags.terrainmode || (iflags.terrainmode & TER_OBJ) != 0) {
for (i = 1; i < MAXOCLASSES; i++) { for (i = 1; i < MAXOCLASSES; i++) {
if (sym == (looked ? showsyms[i + SYM_OFF_O] if (sym == (looked ? g.showsyms[i + SYM_OFF_O]
: def_oc_syms[i].sym) : def_oc_syms[i].sym)
|| (looked && i == ROCK_CLASS && glyph_is_statue(glyph))) { || (looked && i == ROCK_CLASS && glyph_is_statue(glyph))) {
need_to_look = TRUE; need_to_look = TRUE;
@@ -913,7 +913,7 @@ struct permonst **for_supplement;
} }
/* Now check for graphics symbols */ /* Now check for graphics symbols */
alt_i = (sym == (looked ? showsyms[0] : defsyms[0].sym)) ? 0 : (2 + 1); alt_i = (sym == (looked ? g.showsyms[0] : defsyms[0].sym)) ? 0 : (2 + 1);
for (hit_trap = FALSE, i = 0; i < MAXPCHARS; i++) { for (hit_trap = FALSE, i = 0; i < MAXPCHARS; i++) {
/* when sym is the default background character, we process /* when sym is the default background character, we process
i == 0 three times: unexplored, stone, dark part of a room */ i == 0 three times: unexplored, stone, dark part of a room */
@@ -929,7 +929,7 @@ struct permonst **for_supplement;
x_str = "land"; /* replace "dark part of a room" */ x_str = "land"; /* replace "dark part of a room" */
/* alt_i is now 3 or more and no longer of interest */ /* alt_i is now 3 or more and no longer of interest */
} }
if (sym == (looked ? showsyms[i] : defsyms[i].sym) && *x_str) { if (sym == (looked ? g.showsyms[i] : defsyms[i].sym) && *x_str) {
/* avoid "an unexplored", "an stone", "an air", "a water", /* avoid "an unexplored", "an stone", "an air", "a water",
"a floor of a room", "a dark part of a room"; "a floor of a room", "a dark part of a room";
article==2 => "the", 1 => "an", 0 => (none) */ article==2 => "the", 1 => "an", 0 => (none) */
@@ -972,7 +972,7 @@ struct permonst **for_supplement;
/* Now check for warning symbols */ /* Now check for warning symbols */
for (i = 1; i < WARNCOUNT; i++) { for (i = 1; i < WARNCOUNT; i++) {
x_str = def_warnsyms[i].explanation; x_str = def_warnsyms[i].explanation;
if (sym == (looked ? warnsyms[i] : def_warnsyms[i].sym)) { if (sym == (looked ? g.warnsyms[i] : def_warnsyms[i].sym)) {
if (!found) { if (!found) {
Sprintf(out_str, "%s%s", prefix, def_warnsyms[i].explanation); Sprintf(out_str, "%s%s", prefix, def_warnsyms[i].explanation);
*firstmatch = def_warnsyms[i].explanation; *firstmatch = def_warnsyms[i].explanation;
+4 -7
View File
@@ -15,9 +15,6 @@
#include "wintty.h" #include "wintty.h"
#endif #endif
/* from sp_lev.c, for deliver_splev_message() */
extern char *lev_message;
static void NDECL(dump_qtlist); static void NDECL(dump_qtlist);
static void FDECL(Fread, (genericptr_t, int, int, dlb *)); static void FDECL(Fread, (genericptr_t, int, int, dlb *));
STATIC_DCL struct qtmsg *FDECL(construct_qtlist, (long)); STATIC_DCL struct qtmsg *FDECL(construct_qtlist, (long));
@@ -676,10 +673,10 @@ deliver_splev_message()
char *str, *nl, in_line[BUFSZ], out_line[BUFSZ]; char *str, *nl, in_line[BUFSZ], out_line[BUFSZ];
/* there's no provision for delivering via window instead of pline */ /* there's no provision for delivering via window instead of pline */
if (lev_message) { if (g.lev_message) {
/* lev_message can span multiple lines using embedded newline chars; /* lev_message can span multiple lines using embedded newline chars;
any segments too long to fit within in_line[] will be truncated */ any segments too long to fit within in_line[] will be truncated */
for (str = lev_message; *str; str = nl + 1) { for (str = g.lev_message; *str; str = nl + 1) {
/* copying will stop at newline if one is present */ /* copying will stop at newline if one is present */
copynchars(in_line, str, (int) (sizeof in_line) - 1); copynchars(in_line, str, (int) (sizeof in_line) - 1);
@@ -692,8 +689,8 @@ deliver_splev_message()
break; /* done if no newline */ break; /* done if no newline */
} }
free((genericptr_t) lev_message); free((genericptr_t) g.lev_message);
lev_message = 0; g.lev_message = NULL;
} }
} }
+21 -24
View File
@@ -18,6 +18,8 @@
#pragma warning(disable : 4244) #pragma warning(disable : 4244)
#endif #endif
lev_region *lregions;
typedef void FDECL((*select_iter_func), (int, int, genericptr)); typedef void FDECL((*select_iter_func), (int, int, genericptr));
extern void FDECL(mkmap, (lev_init *)); extern void FDECL(mkmap, (lev_init *));
@@ -189,8 +191,6 @@ STATIC_DCL boolean FDECL(sp_level_coder, (sp_lev *));
extern struct engr *head_engr; extern struct engr *head_engr;
extern int min_rx, max_rx, min_ry, max_ry; /* from mkmap.c */
/* positions touched by level elements explicitly defined in the des-file */ /* positions touched by level elements explicitly defined in the des-file */
static char SpLev_Map[COLNO][ROWNO]; static char SpLev_Map[COLNO][ROWNO];
@@ -198,10 +198,6 @@ static aligntyp ralign[3] = { AM_CHAOTIC, AM_NEUTRAL, AM_LAWFUL };
static NEARDATA xchar xstart, ystart; static NEARDATA xchar xstart, ystart;
static NEARDATA char xsize, ysize; static NEARDATA char xsize, ysize;
char *lev_message = 0;
lev_region *lregions = 0;
int num_lregions = 0;
static boolean splev_init_present = FALSE; static boolean splev_init_present = FALSE;
static boolean icedpools = FALSE; static boolean icedpools = FALSE;
static int mines_prize_count = 0, soko_prize_count = 0; /* achievements */ static int mines_prize_count = 0, soko_prize_count = 0; /* achievements */
@@ -2966,19 +2962,19 @@ struct sp_coder *coder;
if (!msg) if (!msg)
return; return;
old_n = lev_message ? (strlen(lev_message) + 1) : 0; old_n = g.lev_message ? (strlen(g.lev_message) + 1) : 0;
n = strlen(msg); n = strlen(msg);
levmsg = (char *) alloc(old_n + n + 1); levmsg = (char *) alloc(old_n + n + 1);
if (old_n) if (old_n)
levmsg[old_n - 1] = '\n'; levmsg[old_n - 1] = '\n';
if (lev_message) if (g.lev_message)
(void) memcpy((genericptr_t) levmsg, (genericptr_t) lev_message, (void) memcpy((genericptr_t) levmsg, (genericptr_t) g.lev_message,
old_n - 1); old_n - 1);
(void) memcpy((genericptr_t) &levmsg[old_n], msg, n); (void) memcpy((genericptr_t) &levmsg[old_n], msg, n);
levmsg[old_n + n] = '\0'; levmsg[old_n + n] = '\0';
Free(lev_message); Free(g.lev_message);
lev_message = levmsg; g.lev_message = levmsg;
opvar_free(op); opvar_free(op);
} }
@@ -4566,21 +4562,21 @@ struct sp_coder *coder;
get_location(&tmplregion->delarea.x2, &tmplregion->delarea.y2, get_location(&tmplregion->delarea.x2, &tmplregion->delarea.y2,
ANY_LOC, (struct mkroom *) 0); ANY_LOC, (struct mkroom *) 0);
} }
if (num_lregions) { if (g.num_lregions) {
/* realloc the lregion space to add the new one */ /* realloc the lregion space to add the new one */
lev_region *newl = (lev_region *) alloc( lev_region *newl = (lev_region *) alloc(
sizeof(lev_region) * (unsigned) (1 + num_lregions)); sizeof(lev_region) * (unsigned) (1 + g.num_lregions));
(void) memcpy((genericptr_t) (newl), (genericptr_t) lregions, (void) memcpy((genericptr_t) (newl), (genericptr_t) g.lregions,
sizeof(lev_region) * num_lregions); sizeof(lev_region) * g.num_lregions);
Free(lregions); Free(g.lregions);
num_lregions++; g.num_lregions++;
lregions = newl; g.lregions = newl;
} else { } else {
num_lregions = 1; g.num_lregions = 1;
lregions = (lev_region *) alloc(sizeof(lev_region)); g.lregions = (lev_region *) alloc(sizeof(lev_region));
} }
(void) memcpy(&lregions[num_lregions - 1], tmplregion, (void) memcpy(&g.lregions[g.num_lregions - 1], tmplregion,
sizeof(lev_region)); sizeof(lev_region));
free(tmplregion); free(tmplregion);
@@ -4669,11 +4665,12 @@ struct sp_coder *coder;
troom->needjoining = joined; troom->needjoining = joined;
if (irregular) { if (irregular) {
min_rx = max_rx = dx1; g.min_rx = g.max_rx = dx1;
min_ry = max_ry = dy1; g.min_ry = g.max_ry = dy1;
smeq[nroom] = nroom; smeq[nroom] = nroom;
flood_fill_rm(dx1, dy1, nroom + ROOMOFFSET, OV_i(rlit), TRUE); flood_fill_rm(dx1, dy1, nroom + ROOMOFFSET, OV_i(rlit), TRUE);
add_room(min_rx, min_ry, max_rx, max_ry, FALSE, OV_i(rtype), TRUE); add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OV_i(rtype),
TRUE);
troom->rlit = OV_i(rlit); troom->rlit = OV_i(rlit);
troom->irregular = TRUE; troom->irregular = TRUE;
} else { } else {
+2 -2
View File
@@ -1583,8 +1583,8 @@ check_font_widths()
boolean used[256]; boolean used[256];
memset(used, 0, sizeof(used)); memset(used, 0, sizeof(used));
for (int i = 0; i < SYM_MAX; i++) { for (int i = 0; i < SYM_MAX; i++) {
used[l_syms[i]] = TRUE; used[g.l_syms[i]] = TRUE;
used[r_syms[i]] = TRUE; used[g.r_syms[i]] = TRUE;
} }
int wcUsedCount = 0; int wcUsedCount = 0;
+1 -1
View File
@@ -791,7 +791,7 @@ curses_init_options()
/* Make sure that DECgraphics is not set to true via the config /* Make sure that DECgraphics is not set to true via the config
file, as this will cause display issues. We can't disable it in file, as this will cause display issues. We can't disable it in
options.c in case the game is compiled with both tty and curses. */ options.c in case the game is compiled with both tty and curses. */
if (!symset[PRIMARY].name || !strcmpi(symset[PRIMARY].name, "DECgraphics")) { if (!g.symset[PRIMARY].name || !strcmpi(g.symset[PRIMARY].name, "DECgraphics")) {
load_symset("curses",PRIMARY); load_symset("curses",PRIMARY);
load_symset("default",ROGUESET); load_symset("default",ROGUESET);
} }
+1 -1
View File
@@ -590,7 +590,7 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph)
if ((special & MG_DETECT) && iflags.use_inverse) { if ((special & MG_DETECT) && iflags.use_inverse) {
attr = A_REVERSE; attr = A_REVERSE;
} }
if (!symset[PRIMARY].name || !strcmpi(symset[PRIMARY].name, "curses")) { if (!g.symset[PRIMARY].name || !strcmpi(g.symset[PRIMARY].name, "curses")) {
ch = curses_convert_glyph(ch, glyph); ch = curses_convert_glyph(ch, glyph);
} }
if (wid == NHW_MAP) { if (wid == NHW_MAP) {
+1 -1
View File
@@ -454,7 +454,7 @@ curses_convert_glyph(int ch, int glyph)
/* If user selected a custom character for this object, don't /* If user selected a custom character for this object, don't
override this. */ override this. */
if (((glyph_is_cmap(glyph)) && (ch != showsyms[symbol]))) { if (((glyph_is_cmap(glyph)) && (ch != g.showsyms[symbol]))) {
return ch; return ch;
} }